diff options
author | Graeme Russ <graeme.russ@gmail.com> | 2012-01-01 15:06:39 +1100 |
---|---|---|
committer | Graeme Russ <graeme.russ@gmail.com> | 2012-01-04 22:17:20 +1100 |
commit | f48dd6fc6cc9fdf15408e98132dc5575a31026cf (patch) | |
tree | 2fe660cd6af72843d0798497a5f1bbb8c813b9ff /arch/x86/lib | |
parent | 74bfbe1ba5ba99adccdc26dc4adbfb9221849310 (diff) | |
download | u-boot-imx-f48dd6fc6cc9fdf15408e98132dc5575a31026cf.zip u-boot-imx-f48dd6fc6cc9fdf15408e98132dc5575a31026cf.tar.gz u-boot-imx-f48dd6fc6cc9fdf15408e98132dc5575a31026cf.tar.bz2 |
x86: Simplify Flash-to-RAM code execution transition
Move the relocation offset calculation out of assembler and into C. This
also paves the way for the upcoming init sequence simplification by adding
the board_init_f_r flash to RAM transitional function
--
Changes for v2:
- Added commit message
- Minor adjustment to new stack address comment
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/board.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index f9eb15b..382ada7 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -253,10 +253,29 @@ void board_init_f(ulong boot_flags) gd->flags |= GD_FLG_RELOC; - /* Enter the relocated U-Boot! */ - relocate_code(gd->start_addr_sp, gd, gd->relocaddr); + /* + * SDRAM is now initialised, U-Boot has been copied into SDRAM, + * the BSS has been cleared etc. The final stack can now be setup + * in SDRAM. Code execution will continue (momentarily) in Flash, + * but with the stack in SDRAM and Global Data in temporary memory + * (CPU cache) + */ + board_init_f_r_trampoline(gd->start_addr_sp); + + /* NOTREACHED - board_init_f_r_trampoline() does not return */ + while (1) + ; +} + +void board_init_f_r(void) +{ + /* + * Transfer execution from Flash to RAM by calculating the address + * of the in-RAM copy of board_init_r() and calling it + */ + (board_init_r + gd->reloc_off)(gd, gd->relocaddr); - /* NOTREACHED - relocate_code() does not return */ + /* NOTREACHED - board_init_r() does not return */ while (1) ; } |