[U-Boot] RFC: Aligning arch initialisation sequences
Reinhard Meyer
u-boot at emk-elektronik.de
Sun Nov 14 05:07:12 CET 2010
Dear Wolfgang Denk,
> Yes, and this is correct. board_init_f != board_early_init_f
To make it crystal clear now:
void board_init_f (ulong bootflag)
{
bd_t *bd;
init_fnc_t **init_fnc_ptr;
gd_t *id;
ulong addr, addr_sp;
+ gd_t auto_gd;
/* Pointer is writable since we allocated a register for it */
- gd = (gd_t *) (CONFIG_SYS_INIT_SP_ADDR);
+ gd = &auto_gd;
/* compiler optimization barrier needed for GCC >= 3.4 */
/* Q: why is that needed anyway ??? */
__asm__ __volatile__("": : :"memory");
memset ((void*)gd, 0, sizeof (gd_t));
....
debug ("relocation Offset is: %08lx\n", gd->reloc_off);
memcpy (id, (void *)gd, sizeof (gd_t));
relocate_code (addr_sp, id, addr);
/* NOTREACHED - relocate_code() does not return */
}
This, and setting CONFIG_SYS_INIT_SP_ADDR to an aligned value in
initial storage (SRAM, pinned down Cache, or other) removes alot
of the headache about making stuff aligned.
Best Regards,
Reinhard
More information about the U-Boot
mailing list