Message ID | 1462977912-13666-3-git-send-email-bmeng.cn@gmail.com |
---|---|
State | Accepted |
Delegated to: | Bin Meng |
Headers | show |
On 11 May 2016 at 08:44, Bin Meng <bmeng.cn@gmail.com> wrote: > At present board_final_cleanup() is called before booting a Linux > kernel. This actually needs to be done before booting anything, > like SeaBIOS, VxWorks or Windows. > > Move the call to last_stage_init() instead. > > Signed-off-by: Bin Meng <bmeng.cn@gmail.com> > --- > > Changes in v2: None > > arch/x86/cpu/coreboot/coreboot.c | 20 +++++++++++--------- > arch/x86/cpu/cpu.c | 10 ++++++++++ > arch/x86/lib/bootm.c | 9 --------- > 3 files changed, 21 insertions(+), 18 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Thu, May 19, 2016 at 12:00 PM, Simon Glass <sjg@chromium.org> wrote: > On 11 May 2016 at 08:44, Bin Meng <bmeng.cn@gmail.com> wrote: >> At present board_final_cleanup() is called before booting a Linux >> kernel. This actually needs to be done before booting anything, >> like SeaBIOS, VxWorks or Windows. >> >> Move the call to last_stage_init() instead. >> >> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> >> --- >> >> Changes in v2: None >> >> arch/x86/cpu/coreboot/coreboot.c | 20 +++++++++++--------- >> arch/x86/cpu/cpu.c | 10 ++++++++++ >> arch/x86/lib/bootm.c | 9 --------- >> 3 files changed, 21 insertions(+), 18 deletions(-) > > Reviewed-by: Simon Glass <sjg@chromium.org> applied to u-boot-x86, thanks!
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index 845f86a..1b04203 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -39,15 +39,7 @@ int print_cpuinfo(void) return default_print_cpuinfo(); } -int last_stage_init(void) -{ - if (gd->flags & GD_FLG_COLD_BOOT) - timestamp_add_to_bootstage(); - - return 0; -} - -void board_final_cleanup(void) +static void board_final_cleanup(void) { /* * Un-cache the ROM so the kernel has one @@ -79,6 +71,16 @@ void board_final_cleanup(void) } } +int last_stage_init(void) +{ + if (gd->flags & GD_FLG_COLD_BOOT) + timestamp_add_to_bootstage(); + + board_final_cleanup(); + + return 0; +} + int misc_init_r(void) { return 0; diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 233a6c8..1482153 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -661,10 +661,20 @@ void show_boot_progress(int val) } #ifndef CONFIG_SYS_COREBOOT +/* + * Implement a weak default function for boards that optionally + * need to clean up the system before jumping to the kernel. + */ +__weak void board_final_cleanup(void) +{ +} + int last_stage_init(void) { write_tables(); + board_final_cleanup(); + return 0; } #endif diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 783be69..7cf9de4 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -26,14 +26,6 @@ DECLARE_GLOBAL_DATA_PTR; #define COMMAND_LINE_OFFSET 0x9000 -/* - * Implement a weak default function for boards that optionally - * need to clean up the system before jumping to the kernel. - */ -__weak void board_final_cleanup(void) -{ -} - void bootm_announce_and_cleanup(void) { printf("\nStarting kernel ...\n\n"); @@ -45,7 +37,6 @@ void bootm_announce_and_cleanup(void) #ifdef CONFIG_BOOTSTAGE_REPORT bootstage_report(); #endif - board_final_cleanup(); } #if defined(CONFIG_OF_LIBFDT) && !defined(CONFIG_OF_NO_KERNEL)
At present board_final_cleanup() is called before booting a Linux kernel. This actually needs to be done before booting anything, like SeaBIOS, VxWorks or Windows. Move the call to last_stage_init() instead. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> --- Changes in v2: None arch/x86/cpu/coreboot/coreboot.c | 20 +++++++++++--------- arch/x86/cpu/cpu.c | 10 ++++++++++ arch/x86/lib/bootm.c | 9 --------- 3 files changed, 21 insertions(+), 18 deletions(-)