Patchwork [U-Boot,06/19] x86: Rationalise kernel booting logic and bootstage

login
register
mail settings
Submitter Simon Glass
Date April 18, 2013, 2:13 a.m.
Message ID <1366251228-19884-7-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/237414/
State Accepted, archived
Delegated to: Simon Glass
Headers show

Comments

Simon Glass - April 18, 2013, 2:13 a.m.
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>
---
 arch/x86/cpu/cpu.c    |  5 +++++
 arch/x86/lib/bootm.c  |  8 --------
 arch/x86/lib/zimage.c | 11 +++++++----
 3 files changed, 12 insertions(+), 12 deletions(-)
Graeme Russ - April 18, 2013, 3:05 a.m.
Hi Simon,

On Thu, Apr 18, 2013 at 12:13 PM, Simon Glass <sjg@chromium.org> wrote:
>
> 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>
> ---
>  arch/x86/cpu/cpu.c    |  5 +++++
>  arch/x86/lib/bootm.c  |  8 --------
>  arch/x86/lib/zimage.c | 11 +++++++----
>  3 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
> index 1a2f85c..7a914a5 100644
> --- a/arch/x86/cpu/cpu.c
> +++ b/arch/x86/cpu/cpu.c
> @@ -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;
>  }
>
> diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
> index 83caf6b..2520228 100644
> --- a/arch/x86/lib/bootm.c
> +++ b/arch/x86/lib/bootm.c
> @@ -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 */
>
> diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
> index 4e9e1f7..b54cf12 100644
> --- a/arch/x86/lib/zimage.c
> +++ b/arch/x86/lib/zimage.c
> @@ -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 */
> --
> 1.8.2.1
>

Acked-by: Graeme Russ <graeme.russ@gmail.com>

Patch

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 1a2f85c..7a914a5 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -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;
 }
 
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 83caf6b..2520228 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -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 */
 
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 4e9e1f7..b54cf12 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -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 */