x86: Rationalise kernel booting logic and bootstage
authorSimon Glass <sjg@chromium.org>
Wed, 17 Apr 2013 16:13:35 +0000 (16:13 +0000)
committerSimon Glass <sjg@chromium.org>
Mon, 13 May 2013 20:33:20 +0000 (13:33 -0700)
The 'Starting linux' message appears twice in the code, but both call
through the same place. Unify these and add calls to bootstage to
mark the occasion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Michael Spang <spang@chromium.org>
Acked-by: Graeme Russ <graeme.russ@gmail.com>
arch/x86/cpu/cpu.c
arch/x86/lib/bootm.c
arch/x86/lib/zimage.c

index 1a2f85c1fe2153a582acf7c9cbcec799b57f9922..7a914a575154252e8c650d563ca7826d977fbe67 100644 (file)
@@ -120,6 +120,11 @@ void setup_gdt(gd_t *id, u64 *gdt_addr)
 
 int __weak x86_cleanup_before_linux(void)
 {
+#ifdef CONFIG_BOOTSTAGE_STASH
+       bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH,
+                       CONFIG_BOOTSTAGE_STASH_SIZE);
+#endif
+
        return 0;
 }
 
index 83caf6bdbd780113862d8d80374412cc9ff3cef4..2520228b4caee000f580e461dcb9294d375b7cac 100644 (file)
@@ -93,14 +93,6 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
                goto error;
        }
 
-#ifdef DEBUG
-       printf("## Transferring control to Linux (at address %08x) ...\n",
-               (u32)base_ptr);
-#endif
-
-       /* we assume that the kernel is in place */
-       printf("\nStarting kernel ...\n\n");
-
        boot_zimage(base_ptr, load_address);
        /* does not return */
 
index 4e9e1f77e5ac35bda83ff2fe8b23c0e9970c9859..b54cf1261f71b35eb074bf50f3b9bc3f33dd369c 100644 (file)
@@ -283,6 +283,13 @@ __weak void board_final_cleanup(void)
 
 void boot_zimage(void *setup_base, void *load_address)
 {
+       debug("## Transferring control to Linux (at address %08x) ...\n",
+             (u32)setup_base);
+
+       bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+#ifdef CONFIG_BOOTSTAGE_REPORT
+       bootstage_report();
+#endif
        board_final_cleanup();
 
        printf("\nStarting kernel ...\n\n");
@@ -363,10 +370,6 @@ int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                return -1;
        }
 
-       printf("## Transferring control to Linux "
-              "(at address %08x) ...\n",
-              (u32)base_ptr);
-
        /* we assume that the kernel is in place */
        boot_zimage(base_ptr, load_address);
        /* does not return */