[PATCH] board_init: Convert CONFIG_MALLOC_F_ADDR to Kconfig

Marek Vasut marex at denx.de
Sun Nov 13 20:39:36 CET 2022


On 9/1/22 23:18, Tom Rini wrote:
> On Sat, Jul 09, 2022 at 03:08:04AM +0200, Marek Vasut wrote:
> 
>> Convert CONFIG_MALLOC_F_ADDR to Kconfig.
>>
>> The CL IoT gate board used MALLOC_F_ADDR 0x912000 on i.MX8M Mini unlike
>> all the other platforms which use 0x930000 . This has been aligned with
>> the other i.MX8M Mini platforms.
>>
>> Signed-off-by: Marek Vasut <marex at denx.de>
> [snip]
>> diff --git a/common/init/board_init.c b/common/init/board_init.c
>> index 6a550261778..35506f2ed35 100644
>> --- a/common/init/board_init.c
>> +++ b/common/init/board_init.c
>> @@ -78,10 +78,8 @@ __weak void board_init_f_init_stack_protection(void)
>>   ulong board_init_f_alloc_reserve(ulong top)
>>   {
>>   	/* Reserve early malloc arena */
>> -#ifndef CONFIG_MALLOC_F_ADDR
>> -#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>> +#if CONFIG_VAL(MALLOC_F_ADDR) && CONFIG_VAL(SYS_MALLOC_F_LEN)
>>   	top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
>> -#endif
>>   #endif
>>   	/* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
>>   	top = rounddown(top-sizeof(struct global_data), 16);
> 
> This isn't equivalent. It was "if we don't have MALLOC_F_ADDR but do
> have SYS_MALLOC_F_LEN ..." and now is "if we have MALLOC_F_ADDR and
> SYS_MALLOC_F_LEN ...". 

But this is not correct. It was

if
CONFIG_MALLOC_F_ADDR is not declared
and
CONFIG_{SPL,TPL,...}SYS_MALLOC_F_LEN is non-zero

With the switch to Kconfig, the MALLOC_F_ADDR is always declared, except 
for the cases where it was not declared before, it is set to 0. So the 
change to:

if
CONFIG_{SPL,TPL,...}MALLOC_F_ADDR is non-zero
and
CONFIG_{SPL,TPL,...}SYS_MALLOC_F_LEN is non-zero

seems equivalent to me, except of course for the handling of SPL/TPL 
part, which is done in the Kconfig

[...]


More information about the U-Boot mailing list