[U-Boot] [PATCH 3/3] microblaze: Fix bdiinfo pointer
Michal Simek
monstr at monstr.eu
Tue Dec 21 21:45:03 CET 2010
Wolfgang Denk wrote:
> Dear Michal Simek,
>
> In message <1292955178-13018-3-git-send-email-monstr at monstr.eu> you wrote:
>> Patch "Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value"
>> (sha1: 25ddd1fb0a2281b182529afbc8fda5de2dc16d96)
>> introduce GENERATED_GBL_DATA_SIZE which is sizeof aligned gd_t
>> (currently 0x40).
>> Microblaze configs used 0x40(128) because this place also contained
>> board info structure which lies on the top of ram.
>
> In the Subject: s/bdiinfo/bd_info/
>
>> index eeef579..8232cf0 100644
>> --- a/arch/microblaze/lib/board.c
>> +++ b/arch/microblaze/lib/board.c
>> @@ -91,15 +91,16 @@ void board_init (void)
>> bd_t *bd;
>> init_fnc_t **init_fnc_ptr;
>> gd = (gd_t *) CONFIG_SYS_GBL_DATA_OFFSET;
>> + bd = (bd_t *) CONFIG_SYS_GBL_DATA_OFFSET - GENERATED_BD_INFO_SIZE;
>
> This is actually wrong.
>
> You are using CONFIG_SYS_GBL_DATA_OFFSET as if it were
> CONFIG_SYS_GBL_DATA_ADDR, but it ain't so: it is an _offset_, and NOT
> and address.
I agree. BTW: Maybe nios2 and sparc use it too.
>
>> - memset ((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
>> - gd->bd = (bd_t *) (gd + 1); /* At end of global data */
>> + memset ((void *)bd, 0, GENERATED_GBL_DATA_SIZE
>> + + GENERATED_BD_INFO_SIZE);
>
> Don't do this. Instead, use two separate memset() calls, one for gd
> and another one for bd. The stucts may be in a contiguous area now,
> but you would probably run into nasty bugs if this gets changed one
> day.
I just wanted to save some instructions and no problem to separate it.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
More information about the U-Boot
mailing list