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] [RFC PATCH v2 06/15] bootstage: Convert progress numbers 20-41 to enums
Date: Sat, 10 Dec 2011 13:07:58 -0800	[thread overview]
Message-ID: <1323551287-5351-7-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1323551287-5351-1-git-send-email-sjg@chromium.org>

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/powerpc/lib/board.c  |    2 +-
 arch/sparc/lib/board.c    |    2 +-
 arch/x86/lib/board.c      |   18 +++++++++---------
 board/hermes/hermes.c     |    4 +++-
 board/pcs440ep/pcs440ep.c |    3 ++-
 include/bootstage.h       |   25 +++++++++++++++++++++++++
 post/post.c               |    4 ++--
 7 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index b11ec8c..837c82d 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -1065,7 +1065,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 void hang(void)
 {
 	puts("### ERROR ### Please RESET the board ###\n");
-	show_boot_error(30);
+	show_boot_error(BOOTSTAGE_ID_NEED_RESET);
 	for (;;)
 		;
 }
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
index fcbc666..770136b 100644
--- a/arch/sparc/lib/board.c
+++ b/arch/sparc/lib/board.c
@@ -426,7 +426,7 @@ void hang(void)
 {
 	puts("### ERROR ### Please RESET the board ###\n");
 #ifdef CONFIG_SHOW_BOOT_PROGRESS
-	show_boot_error(30);
+	show_boot_error(BOOTSTAGE_ID_NEED_RESET);
 #endif
 	for (;;) ;
 }
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index d742fec..1f677cc 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -280,7 +280,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	static gd_t gd_data;
 	init_fnc_t **init_fnc_ptr;
 
-	show_boot_progress(0x21);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_INIT_R);
 
 	/* Global data pointer is now writable */
 	gd = &gd_data;
@@ -291,7 +291,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	gd->bd = &bd_data;
 	memset(gd->bd, 0, sizeof(bd_t));
-	show_boot_progress(0x22);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_GLOBAL_DATA);
 
 	gd->baudrate =  CONFIG_BAUDRATE;
 
@@ -302,7 +302,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 		if ((*init_fnc_ptr)() != 0)
 			hang();
 	}
-	show_boot_progress(0x23);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_INIT_SEQ);
 
 #ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
@@ -312,14 +312,14 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	/* configure available FLASH banks */
 	size = flash_init();
 	display_flash_config(size);
-	show_boot_progress(0x24);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_FLASH);
 #endif
 
-	show_boot_progress(0x25);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_FLASH_37);
 
 	/* initialize environment */
 	env_relocate();
-	show_boot_progress(0x26);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_ENV);
 
 
 #ifdef CONFIG_CMD_NET
@@ -334,7 +334,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	pci_init();
 #endif
 
-	show_boot_progress(0x27);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_PCI);
 
 
 	stdio_init();
@@ -363,7 +363,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	/* enable exceptions */
 	enable_interrupts();
-	show_boot_progress(0x28);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_INTERRUPTS);
 
 #ifdef CONFIG_STATUS_LED
 	status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
@@ -432,7 +432,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
-	show_boot_progress(0x29);
+	show_boot_progress(BOOTSTAGE_ID_BOARD_DONE);
 
 	/* main_loop() can return to retry autoboot, if so just run it again. */
 	for (;;)
diff --git a/board/hermes/hermes.c b/board/hermes/hermes.c
index 1b40ae8..38bab03 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -595,7 +595,9 @@ void show_boot_progress (int status)
 {
 	volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 
-	if (status < -32) status = -1;	/* let things compatible */
+	/* let things compatible */
+	if (status < -BOOTSTAGE_ID_POST_FAIL_R)
+		status = -1;
 	status ^= 0x0F;
 	status = (status & 0x0F) << 14;
 	immr->im_cpm.cp_pbdat = (immr->im_cpm.cp_pbdat & ~PB_LED_ALL) | status;
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 118d81c..f67eedd 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -97,7 +97,8 @@ static void status_led_blink (void)
 void show_boot_progress (int val)
 {
 	/* find all valid Codes for val in README */
-	if (val == -30) return;
+	if (val == -BOOTSTAGE_ID_NEED_RESET)
+		return;
 	if (val < 0) {
 		/* smthing goes wrong */
 		status_led_blink ();
diff --git a/include/bootstage.h b/include/bootstage.h
index 8c5a92e..4b8d818 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -68,6 +68,31 @@ enum bootstage_id {
 	BOOTSTAGE_ID_NO_RAMDISK,	/* No ram disk found (not an error) */
 
 	BOOTSTAGE_ID_RUN_OS	= 15,	/* Exiting U-Boot, entering OS */
+
+	BOOTSTAGE_ID_NEED_RESET = 30,
+	BOOTSTAGE_ID_POST_FAIL,		/* Post failure */
+	BOOTSTAGE_ID_POST_FAIL_R,	/* Post failure reported after reloc */
+
+	/*
+	 * This set is reported ony by x86, and the meaning is different. In
+	 * this case we are reporting completion of a particular stage.
+	 * This should probably change in he x86 code (which doesn't report
+	 * errors in any case), but discussion this can perhaps wait until we
+	 * have a generic board implementation.
+	 */
+	BOOTSTAGE_ID_BOARD_INIT_R,	/* We have relocated */
+	BOOTSTAGE_ID_BOARD_GLOBAL_DATA,	/* Global data is set up */
+
+	BOOTSTAGE_ID_BOARD_INIT_SEQ,	/* We completed the init sequence */
+	BOOTSTAGE_ID_BOARD_FLASH,	/* We have configured flash banks */
+	BOOTSTAGE_ID_BOARD_FLASH_37,	/* In case you didn't hear... */
+	BOOTSTAGE_ID_BOARD_ENV,		/* Environment is relocated & ready */
+	BOOTSTAGE_ID_BOARD_PCI,		/* PCI is up */
+
+	BOOTSTAGE_ID_BOARD_INTERRUPTS,	/* Exceptions / interrupts ready */
+	BOOTSTAGE_ID_BOARD_DONE,	/* Board init done, off to main loop */
+	/* ^^^ here ends the x86 sequence */
+
 };
 
 /*
diff --git a/post/post.c b/post/post.c
index 1cc3f09..3a91020 100644
--- a/post/post.c
+++ b/post/post.c
@@ -157,7 +157,7 @@ void post_output_backlog(void)
 				post_log("PASSED\n");
 			else {
 				post_log("FAILED\n");
-				show_boot_error(31);
+				show_boot_error(BOOTSTAGE_ID_POST_FAIL_R);
 			}
 		}
 	}
@@ -294,7 +294,7 @@ static int post_run_single(struct post_test *test,
 		} else {
 			if ((*test->test)(flags) != 0) {
 				post_log("FAILED\n");
-				show_boot_error(32);
+				show_boot_error(BOOTSTAGE_ID_POST_FAIL_R);
 				show_post_progress(i, POST_AFTER, POST_FAILED);
 				if (test_flags & POST_CRITICAL)
 					gd->flags |= GD_FLG_POSTFAIL;
-- 
1.7.3.1

  parent reply	other threads:[~2011-12-10 21:07 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 01/15] bootstage: Create an initial header for boot progress integers Simon Glass
2012-01-08  8:26   ` Mike Frysinger
2012-01-08 17:22     ` Simon Glass
2012-01-08 19:46       ` Mike Frysinger
2012-01-08 23:43         ` Simon Glass
2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 02/15] bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress() Simon Glass
2012-01-08  8:26   ` Mike Frysinger
2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 03/15] bootstage: Use show_boot_error() for -ve progress numbers Simon Glass
2012-01-08  8:27   ` Mike Frysinger
2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 04/15] bootstage: Convert progress numbers 1-9 into enums Simon Glass
2012-01-08  8:27   ` Mike Frysinger
2012-01-08 17:27     ` Simon Glass
2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 05/15] bootstage: Convert progress numbers 10-19 to enums Simon Glass
2012-01-08  8:28   ` Mike Frysinger
2012-01-08 17:29     ` Simon Glass
2011-12-10 21:07 ` Simon Glass [this message]
2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 07/15] bootstage: Convert IDE progress numbers " Simon Glass
2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 08/15] bootstage: Convert NAND " Simon Glass
2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 09/15] bootstage: Convert net " Simon Glass
2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 10/15] bootstage: Convert FIT " Simon Glass
2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer Simon Glass
2012-01-08  8:30   ` Mike Frysinger
2012-01-08 17:33     ` Simon Glass
2012-01-08 19:57       ` Mike Frysinger
2012-01-08 23:49         ` Simon Glass
2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Simon Glass
2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement Simon Glass
2012-01-08  8:35   ` Mike Frysinger
2012-01-08 17:42     ` Simon Glass
2012-01-09 17:33       ` Mike Frysinger
2012-01-12  5:41         ` Simon Glass
2012-01-15  1:09           ` Mike Frysinger
2012-01-15  1:16             ` Simon Glass
2012-01-15  1:22               ` Mike Frysinger
2012-01-15  1:27                 ` Simon Glass
2012-02-13 23:27                   ` Simon Glass
2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 14/15] bootstage: Plumb in bootstage calls for basic operations Simon Glass
2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm Simon Glass
2012-01-08  8:36   ` Mike Frysinger
2012-01-08 17:43     ` Simon Glass
2012-01-08 19:58       ` Mike Frysinger
2012-01-08 23:48         ` Simon Glass
2012-01-09 17:31           ` Mike Frysinger
2012-01-12  5:38             ` Simon Glass
2012-01-03 22:33 ` [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass

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=1323551287-5351-7-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.