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

Nitin Yadav n-yadav at ti.com
Wed Nov 8 11:13:03 CET 2023



On 31/10/23 19:25, Tom Rini wrote:
> 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?
This is first Board where we have 512M of RAM, Others have 2GB of RAM.
That's why we are reserving this space.
> 

-- 
Regards,
Nitin


More information about the U-Boot mailing list