From: Peter Tyser Date: Tue, 15 Dec 2009 18:10:47 +0000 (-0600) Subject: mpc85xx, mpc86xx: Fix gd->cpu pointer after relocation X-Git-Tag: v2009.11~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f9476902b789b0481b9df49af88d6ca94fb16fa0;p=oweals%2Fu-boot.git mpc85xx, mpc86xx: Fix gd->cpu pointer after relocation The gd->cpu pointer is set to an address located in flash when the probecpu() function is called while U-Boot is executing from flash. This pointer needs to be updated to point to an address in RAM after relocation has occurred otherwise Linux may not be able to boot due to "fdt board" crashing if flash has been erased or changed. This bug was introduced in commit a0e2066f392782730f0398095e583c87812d97f2. Signed-off-by: Peter Tyser Reported-by: Ed Swarthout Tested-by: Kumar Gala Tested on MPC8527DS. Tested by: Ed Swarthout --- diff --git a/lib_ppc/board.c b/lib_ppc/board.c index 765f97a04d..dd22f99c67 100644 --- a/lib_ppc/board.c +++ b/lib_ppc/board.c @@ -645,6 +645,14 @@ void board_init_r (gd_t *id, ulong dest_addr) /* The Malloc area is immediately below the monitor copy in DRAM */ malloc_start = dest_addr - TOTAL_MALLOC_LEN; +#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) + /* + * The gd->cpu pointer is set to an address in flash before relocation. + * We need to update it to point to the same CPU entry in RAM. + */ + gd->cpu += dest_addr - CONFIG_SYS_MONITOR_BASE; +#endif + #ifdef CONFIG_SERIAL_MULTI serial_initialize(); #endif