All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 17/21] arm: Implement the 'fake' go command
Date: Tue, 11 Jun 2013 11:14:49 -0700	[thread overview]
Message-ID: <1370974493-21822-18-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1370974493-21822-1-git-send-email-sjg@chromium.org>

Implement this feature on ARM for tracing.

It would be nice to have generic bootm support so that it is easily
implemented on any arch.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None

 arch/arm/lib/bootm.c | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 1b6e0ac..28fba19 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -68,12 +68,19 @@ void arch_lmb_reserve(struct lmb *lmb)
 		    gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);
 }
 
-static void announce_and_cleanup(void)
+/**
+ * announce_and_cleanup() - Print message and prepare for kernel boot
+ *
+ * @fake: non-zero to do everything except actually boot
+ */
+static void announce_and_cleanup(int fake)
 {
-	printf("\nStarting kernel ...\n\n");
+	printf("\nStarting kernel ...%s\n\n", fake ?
+		"(fake run for tracing)" : "");
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
 #ifdef CONFIG_BOOTSTAGE_FDT
-	bootstage_fdt_add_report();
+	if (flag == BOOTM_STATE_OS_FAKE_GO)
+		bootstage_fdt_add_report();
 #endif
 #ifdef CONFIG_BOOTSTAGE_REPORT
 	bootstage_report();
@@ -225,14 +232,15 @@ static void boot_prep_linux(bootm_headers_t *images)
 }
 
 /* Subcommand: GO */
-static void boot_jump_linux(bootm_headers_t *images)
+static void boot_jump_linux(bootm_headers_t *image, int flag)
 {
 	unsigned long machid = gd->bd->bi_arch_number;
 	char *s;
 	void (*kernel_entry)(int zero, int arch, uint params);
 	unsigned long r2;
+	int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
 
-	kernel_entry = (void (*)(int, int, uint))images->ep;
+	kernel_entry = (void (*)(int, int, uint))image->ep;
 
 	s = getenv("machid");
 	if (s) {
@@ -243,14 +251,15 @@ static void boot_jump_linux(bootm_headers_t *images)
 	debug("## Transferring control to Linux (at address %08lx)" \
 		"...\n", (ulong) kernel_entry);
 	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
-	announce_and_cleanup();
+	announce_and_cleanup(fake);
 
-	if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
-		r2 = (unsigned long)images->ft_addr;
+	if (IMAGE_ENABLE_OF_LIBFDT && image->ft_len)
+		r2 = (unsigned long)image->ft_addr;
 	else
 		r2 = gd->bd->bi_boot_params;
 
-	kernel_entry(0, machid, r2);
+	if (!fake)
+		kernel_entry(0, machid, r2);
 }
 
 /* Main Entry point for arm bootm implementation
@@ -270,13 +279,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 		return 0;
 	}
 
-	if (flag & BOOTM_STATE_OS_GO) {
-		boot_jump_linux(images);
+	if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
+		boot_jump_linux(images, flag);
 		return 0;
 	}
 
 	boot_prep_linux(images);
-	boot_jump_linux(images);
+	boot_jump_linux(images, flag);
 	return 0;
 }
 
-- 
1.8.3

  parent reply	other threads:[~2013-06-11 18:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 18:14 [U-Boot] [PATCH v2 0/21] Add tracing functionality to U-Boot Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 01/21] pci: Convert extern inline functions to static inline Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 02/21] x86: Correct missing local variable in bootm Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 03/21] Fix missing return in do_mem_loop() Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 04/21] Show stdout on error in fit-test Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 05/21] bootstage: Correct printf types Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 06/21] Add function to print a number with grouped digits Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 07/21] Add trace library Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 08/21] Add a trace command Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 09/21] Support tracing in config.mk when enabled Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 10/21] Add trace support to generic board Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 11/21] Add proftool to decode profile data Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 12/21] sandbox: Support trace feature Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 13/21] Add a simple test for sandbox trace Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 14/21] Clarify bootm OS arguments Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 15/21] Refactor the bootm command to reduce code duplication Simon Glass
2013-06-27 13:40   ` Stefan Roese
2013-06-27 14:40     ` Tom Rini
2013-06-27 15:39     ` Simon Glass
2013-06-27 19:51     ` Simon Glass
2013-06-27 20:07       ` Tom Rini
2013-06-28  2:14       ` Simon Glass
2013-06-28  4:12         ` Stefan Roese
2013-06-28  5:44           ` Simon Glass
2013-06-28  6:58           ` Simon Glass
2013-06-28  7:04             ` Stefan Roese
2013-06-28  7:12               ` Simon Glass
2013-06-28  7:57                 ` Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 16/21] Add a 'fake' go command to the bootm command Simon Glass
2013-06-11 18:14 ` Simon Glass [this message]
2013-06-11 19:59   ` [U-Boot] [PATCH v2 17/21] arm: Implement the 'fake' go command Albert ARIBAUD
2013-06-11 20:02     ` Simon Glass
2013-06-11 20:21       ` Albert ARIBAUD
2013-06-11 21:17         ` Simon Glass
2013-06-11 21:36           ` Albert ARIBAUD
2013-06-20  4:16             ` Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 18/21] exynos: Avoid function instrumentation for microsecond timer Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 19/21] exynos: config: Add tracing options Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 20/21] x86: Support tracing function Simon Glass
2013-06-11 18:14 ` [U-Boot] [PATCH v2 21/21] x86: config: Add tracing options Simon Glass
2013-06-26 20:24 ` [U-Boot] [PATCH v2 0/21] Add tracing functionality to U-Boot Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370974493-21822-18-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.