[PATCH 3/6] board: ti: am62x: Avoid overwriting reserve mem for AM62 SIP

Tom Rini trini at konsulko.com
Tue Oct 31 14:55:15 CET 2023


On Tue, Oct 31, 2023 at 06:58:06PM +0530, Nitin Yadav wrote:
> AM62 SIP has 512MB RAM. But the top of the RAM is reserved for
> TF-A and OPTEE. U-Boot relocating there would cause overwriting
> of these reserved regions. Fix this by limit U-Boot to first
> 64MB of RAM for all boards with 512MB.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr at ti.com>
> Signed-off-by: Nitin Yadav <n-yadav at ti.com>
> ---
>  board/ti/am62x/evm.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
> index ad93908840..ad3e415592 100644
> --- a/board/ti/am62x/evm.c
> +++ b/board/ti/am62x/evm.c
> @@ -18,6 +18,7 @@
>  #include <asm/io.h>
>  #include <asm/arch/hardware.h>
>  #include <dm/uclass.h>
> +#include <linux/sizes.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -59,6 +60,16 @@ int dram_init_banksize(void)
>  	return fdtdec_setup_memory_banksize();
>  }
>  
> +phys_size_t get_effective_memsize(void)
> +{
> +	/*
> +	* Just below 512MB are TF-A and OPTEE reserve regions, thus
> +	* SPL/U-Boot RAM has to start below that. Leave 64MB space for
> +	* all reserved memories.
> +	*/
> +	return gd->ram_size == SZ_512M ? SZ_512M - SZ_64M : gd->ram_size;
> +}

Where are TF-A and OPTEE in other cases? Are we not able to read the
reserved memory nodes and handle this through that?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231031/66637a16/attachment.sig>


More information about the U-Boot mailing list