All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing
@ 2011-12-10 21:07 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
                   ` (15 more replies)
  0 siblings, 16 replies; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:07 UTC (permalink / raw)
  To: u-boot

This series creates a simple boot progress timing feature in U-Boot.

Previous discussion on this is here:

http://lists.denx.de/pipermail/u-boot/2011-May/thread.html#92584

A request was made to unify this with show_boot_progress(). As discussed
in the v1 RFC patch, this series addresses this the following way:

1. Create bootstage.h with the intent of replacing integers with enums. This
will allow the values to be easily changed or rationalised later as required.
It also makes it more explicit that (for example) 15 means we are about to
run an OS.

2. Change show_boot_progress() to use these enums. This first patch just
shows doing this with one (commonly used) integer value.

3. Create bootstage.c file which permits recording of bootstage timestamps.

4. Change the existing show_boot_progress() handlers within board files to
use a provided bootstage progress handler instead. This is easy enough as
there are few users.

5. Change show_boot_progress() to call into bootstage, which in turns calls
the board-provided progress handler, if defined, after recording a timestamp.
The function signature will stay the same for now.

Ultimately I would like boot timing available from before U-Boot to user
space in Linux. See RFC patch for Linux here:

http://lwn.net/Articles/460432/

and discussion here:

http://comments.gmane.org/gmane.linux.kernel/1194861

Still to do: change the microsecond time printout to use the Linux
seconds.microseconds format.

Changes in v2:
- Unify show_boot_progress() into this series

Simon Glass (15):
  bootstage: Create an initial header for boot progress integers
  bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
  bootstage: Use show_boot_error() for -ve progress numbers
  bootstage: Convert progress numbers 1-9 into enums
  bootstage: Convert progress numbers 10-19 to enums
  bootstage: Convert progress numbers 20-41 to enums
  bootstage: Convert IDE progress numbers to enums
  bootstage: Convert NAND progress numbers to enums
  bootstage: Convert net progress numbers to enums
  bootstage: Convert FIT progress numbers to enums
  bootstage: Define an optional microsecond timer
  bootstage: Replace show_boot_progress/error() with bootstage_...()
  bootstage: Add microsecond boot time measurement
  bootstage: Plumb in bootstage calls for basic operations
  bootstage: arm: Add bootstage calls in board and bootm

 README                                 |   25 +++
 arch/arm/lib/board.c                   |    3 +
 arch/arm/lib/bootm.c                   |    6 +-
 arch/avr32/lib/bootm.c                 |    2 +-
 arch/m68k/lib/bootm.c                  |    2 +-
 arch/microblaze/lib/bootm.c            |    2 +-
 arch/mips/lib/bootm.c                  |    2 +-
 arch/mips/lib/bootm_qemu_mips.c        |    2 +-
 arch/nds32/lib/bootm.c                 |    2 +-
 arch/powerpc/lib/board.c               |    2 +-
 arch/powerpc/lib/bootm.c               |    2 +-
 arch/sparc/lib/board.c                 |    2 +-
 arch/x86/lib/board.c                   |   19 +--
 board/Seagate/dockstar/dockstar.c      |    4 +-
 board/a4m072/a4m072.c                  |    2 +-
 board/bf533-stamp/bf533-stamp.c        |   30 ++--
 board/hermes/hermes.c                  |    8 +-
 board/ivm/ivm.c                        |    2 +-
 board/matrix_vision/common/mv_common.c |    2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c    |    8 +-
 board/pcs440ep/pcs440ep.c              |   50 +++---
 board/scb9328/scb9328.c                |    6 -
 board/sixnet/sixnet.c                  |    2 +-
 board/ti/beagle/beagle.c               |    2 +-
 common/Makefile                        |    1 +
 common/bootstage.c                     |  160 ++++++++++++++++++++
 common/cmd_bootm.c                     |   95 ++++++------
 common/cmd_ide.c                       |   46 +++---
 common/cmd_nand.c                      |   34 ++--
 common/cmd_net.c                       |   23 ++-
 common/cmd_usb.c                       |    1 +
 common/env_common.c                    |    2 +-
 common/image.c                         |   56 ++++---
 include/bootstage.h                    |  260 ++++++++++++++++++++++++++++++++
 include/common.h                       |   13 +-
 lib/time.c                             |   17 ++
 net/bootp.c                            |    4 +
 net/eth.c                              |    6 +-
 net/net.c                              |    1 +
 post/post.c                            |    4 +-
 40 files changed, 698 insertions(+), 212 deletions(-)
 create mode 100644 common/bootstage.c
 create mode 100644 include/bootstage.h

-- 
1.7.3.1

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 01/15] bootstage: Create an initial header for boot progress integers
  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 ` Simon Glass
  2012-01-08  8:26   ` Mike Frysinger
  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
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:07 UTC (permalink / raw)
  To: u-boot

At present boot_stage_progress() is called with various magic numbers. The
new bootstage.h header will be used to turn these into symbolic names
throughout the code.

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

 include/bootstage.h |   61 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/common.h    |    6 +---
 2 files changed, 63 insertions(+), 4 deletions(-)
 create mode 100644 include/bootstage.h

diff --git a/include/bootstage.h b/include/bootstage.h
new file mode 100644
index 0000000..4a4300f
--- /dev/null
+++ b/include/bootstage.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _BOOTSTAGE_H
+#define _BOOTSTAGE_H
+
+/*
+ * This file implements recording of each stage of the boot process. It is
+ * intended to implement timing of each stage, reporting this information
+ * to the user and passing it to the OS for logging / further analysis.
+ */
+
+/*
+ * A list of boot stages that we know about. Each of these indicates the
+ * state that we are at, and the action that we are about to perform. For
+ * errors, we issue an error for an item when it fails. Therefore the
+ * normal sequence is:
+ *
+ * progres action1
+ * progres action2
+ * progres action3
+ *
+ * and an error condition where action 3 failed would be:
+ *
+ * progres action1
+ * progres action2
+ * progres action3
+ * error on action3
+ */
+enum bootstage_id {
+	BOOTSTAGE_ID_RUN_OS	= 15,	/* Exiting U-Boot, entering OS */
+};
+
+/*
+ * Board-specific platform code can implement show_boot_progress () if
+ * needed.
+ *
+ * @param val	Progress state (enum bootstage_id), or -id if an error
+ *		has occurred.
+ */
+void show_boot_progress(int val);
+
+#endif
diff --git a/include/common.h b/include/common.h
index 05a658c..e918ca0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -801,10 +801,8 @@ int	pcmcia_init (void);
 #ifdef CONFIG_STATUS_LED
 # include <status_led.h>
 #endif
-/*
- * Board-specific Platform code can reimplement show_boot_progress () if needed
- */
-void show_boot_progress(int val);
+
+#include <bootstage.h>
 
 /* Multicore arch functions */
 #ifdef CONFIG_MP
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 02/15] bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
  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
@ 2011-12-10 21:07 ` 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
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:07 UTC (permalink / raw)
  To: u-boot

This changes the number 15 as used in boot_stage_progress() to use the
new name provided for it. This is a separate patch because it touches
so many files.

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

 arch/arm/lib/bootm.c                |    2 +-
 arch/avr32/lib/bootm.c              |    2 +-
 arch/m68k/lib/bootm.c               |    2 +-
 arch/microblaze/lib/bootm.c         |    2 +-
 arch/mips/lib/bootm.c               |    2 +-
 arch/mips/lib/bootm_qemu_mips.c     |    2 +-
 arch/nds32/lib/bootm.c              |    2 +-
 arch/powerpc/lib/bootm.c            |    2 +-
 board/Seagate/dockstar/dockstar.c   |    2 +-
 board/a4m072/a4m072.c               |    2 +-
 board/bf533-stamp/bf533-stamp.c     |    2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c |    2 +-
 board/pcs440ep/pcs440ep.c           |    3 +--
 board/sixnet/sixnet.c               |    2 +-
 board/ti/beagle/beagle.c            |    2 +-
 common/cmd_bootm.c                  |    8 ++++----
 16 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 802e833..2751f44 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -113,7 +113,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 		printf ("Using machid 0x%x from environment\n", machid);
 	}
 
-	show_boot_progress (15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef CONFIG_OF_LIBFDT
 	if (images->ft_len)
diff --git a/arch/avr32/lib/bootm.c b/arch/avr32/lib/bootm.c
index c9a55ff..f180737 100644
--- a/arch/avr32/lib/bootm.c
+++ b/arch/avr32/lib/bootm.c
@@ -192,7 +192,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 
 	theKernel = (void *)images->ep;
 
-	show_boot_progress (15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	params = params_start = (struct tag *)gd->bd->bi_boot_params;
 	params = setup_start_tag(params);
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 1229ac7..233782b 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -104,7 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	debug("## Transferring control to Linux (at address %08lx) ...\n",
 	      (ulong) kernel);
 
-	show_boot_progress (15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * Linux Kernel Parameters (passing board info data):
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 9f6d6d6..24b9e09 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -59,7 +59,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	if (ret)
 		return 1;
 
-	show_boot_progress (15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	if (!of_flat_tree && argc > 3)
 		of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16);
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 40a5647..5b7e74f 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -56,7 +56,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	/* find kernel entry point */
 	theKernel = (void (*)(int, char **, char **, int *))images->ep;
 
-	show_boot_progress (15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef DEBUG
 	printf ("## Transferring control to Linux (at address %08lx) ...\n",
diff --git a/arch/mips/lib/bootm_qemu_mips.c b/arch/mips/lib/bootm_qemu_mips.c
index f1906c6..47f5310 100644
--- a/arch/mips/lib/bootm_qemu_mips.c
+++ b/arch/mips/lib/bootm_qemu_mips.c
@@ -39,7 +39,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	/* find kernel entry point */
 	theKernel = (void (*)(int, char **, char **, int *))images->ep;
 
-	show_boot_progress (15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong) theKernel);
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index b0a5a0d..5ae90fb 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -69,7 +69,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 		printf("Using machid 0x%x from environment\n", machid);
 	}
 
-	show_boot_progress(15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	debug("## Transferring control to Linux (at address %08lx) ...\n",
 	       (ulong)theKernel);
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 8233f1f..e448f6c 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -69,7 +69,7 @@ static void boot_jump_linux(bootm_headers_t *images)
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong)kernel);
 
-	show_boot_progress (15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && !defined(CONFIG_E500)
 	unlock_ram_in_cache();
diff --git a/board/Seagate/dockstar/dockstar.c b/board/Seagate/dockstar/dockstar.c
index a1de0dc..8cbfb02 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -169,7 +169,7 @@ static void set_leds(u32 leds, u32 blinking)
 void show_boot_progress(int val)
 {
 	switch (val) {
-	case 15:		/* booting Linux */
+	case BOOTSTAGE_ID_RUN_OS:		/* booting Linux */
 		set_leds(BOTH_LEDS, NEITHER_LED);
 		break;
 	case 64:		/* Ethernet initialization */
diff --git a/board/a4m072/a4m072.c b/board/a4m072/a4m072.c
index 09a5a51..9485cfb 100644
--- a/board/a4m072/a4m072.c
+++ b/board/a4m072/a4m072.c
@@ -484,7 +484,7 @@ void show_boot_progress(int status)
 	display_out_pos = 0;	/* reset output position */
 
 	/* we want to flush status 15 now */
-	if (status == 15)
+	if (status == BOOTSTAGE_ID_RUN_OS)
 		display_flush();
 }
 #endif
diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index 935aad2..b1134e9 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -117,7 +117,7 @@ void show_boot_progress(int status)
 	case 12:
 	case 13:
 	case 14:
-	case 15:
+	case BOOTSTAGE_ID_RUN_OS:
 		stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
 		break;
 	default:
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c b/board/matrix_vision/mvbc_p/mvbc_p.c
index 4392176..9dffedc 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -250,7 +250,7 @@ void show_boot_progress(int val)
 	case 12:
 		setbits_be32(&gpio->simple_dvo, LED_Y);
 		break;
-	case 15:
+	case BOOTSTAGE_ID_RUN_OS:
 		setbits_be32(&gpio->simple_dvo, LED_R);
 		break;
 	default:
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 5a3ec58..36994b5 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -110,8 +110,7 @@ void show_boot_progress (int val)
 			status_led_set (1, STATUS_LED_ON);
 			status_led_set (2, STATUS_LED_ON);
 			break;
-		case 15:
-			/* booting */
+		case BOOTSTAGE_ID_RUN_OS:
 			status_led_set (0, STATUS_LED_ON);
 			status_led_set (1, STATUS_LED_ON);
 			status_led_set (2, STATUS_LED_ON);
diff --git a/board/sixnet/sixnet.c b/board/sixnet/sixnet.c
index edb5d13..a13c72d 100644
--- a/board/sixnet/sixnet.c
+++ b/board/sixnet/sixnet.c
@@ -46,7 +46,7 @@ void show_boot_progress (int status)
 {
 #if defined(CONFIG_STATUS_LED)
 # if defined(STATUS_LED_BOOT)
-	if (status == 15) {
+	if (status == BOOTSTAGE_ID_RUN_OS) {
 		/* ready to transfer to kernel, make sure LED is proper state */
 		status_led_set(STATUS_LED_BOOT, CONFIG_BOOT_LED_STATE);
 	}
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 6a457cb..4ea0fac 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -462,7 +462,7 @@ int ehci_hcd_stop(void)
 /* Call usb_stop() before starting the kernel */
 void show_boot_progress(int val)
 {
-	if(val == 15)
+	if (val == BOOTSTAGE_ID_RUN_OS)
 		usb_stop();
 }
 
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index d5745b1..6edee3f 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1340,7 +1340,7 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
 		"(at address %08lx) ...\n",
 		(ulong)loader);
 
-	show_boot_progress(15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * NetBSD Stage-2 Loader Parameters:
@@ -1398,7 +1398,7 @@ static int do_bootm_rtems(int flag, int argc, char * const argv[],
 	printf("## Transferring control to RTEMS (at address %08lx) ...\n",
 		(ulong)entry_point);
 
-	show_boot_progress(15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * RTEMS Parameters:
@@ -1431,7 +1431,7 @@ static int do_bootm_ose(int flag, int argc, char * const argv[],
 	printf("## Transferring control to OSE (at address %08lx) ...\n",
 		(ulong)entry_point);
 
-	show_boot_progress(15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * OSE Parameters:
@@ -1512,7 +1512,7 @@ static int do_bootm_integrity(int flag, int argc, char * const argv[],
 	printf("## Transferring control to INTEGRITY (at address %08lx) ...\n",
 		(ulong)entry_point);
 
-	show_boot_progress(15);
+	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * INTEGRITY Parameters:
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 03/15] bootstage: Use show_boot_error() for -ve progress numbers
  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
  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
@ 2011-12-10 21:07 ` 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
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:07 UTC (permalink / raw)
  To: u-boot

Rather than the caller negating our progress numbers to indicate an
error has occurred, which seems hacky, add a function to indicate this.

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

 arch/powerpc/lib/board.c |    2 +-
 arch/sparc/lib/board.c   |    2 +-
 common/cmd_bootm.c       |   50 +++++++++++++++++++++++-----------------------
 common/cmd_ide.c         |   22 ++++++++++----------
 common/cmd_nand.c        |   16 +++++++-------
 common/cmd_net.c         |    8 +++---
 common/env_common.c      |    2 +-
 common/image.c           |   22 ++++++++++----------
 include/bootstage.h      |    4 +++
 net/eth.c                |    2 +-
 post/post.c              |    4 +-
 11 files changed, 69 insertions(+), 65 deletions(-)

diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index ff5888e..b11ec8c 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_progress(-30);
+	show_boot_error(30);
 	for (;;)
 		;
 }
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
index 519a4fb..fcbc666 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_progress(-30);
+	show_boot_error(30);
 #endif
 	for (;;) ;
 }
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 6edee3f..450fa5c 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -222,21 +222,21 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 		if (fit_image_get_type(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.type)) {
 			puts("Can't get image type!\n");
-			show_boot_progress(-109);
+			show_boot_error(109);
 			return 1;
 		}
 
 		if (fit_image_get_comp(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.comp)) {
 			puts("Can't get image compression!\n");
-			show_boot_progress(-110);
+			show_boot_error(110);
 			return 1;
 		}
 
 		if (fit_image_get_os(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.os)) {
 			puts("Can't get image OS!\n");
-			show_boot_progress(-111);
+			show_boot_error(111);
 			return 1;
 		}
 
@@ -245,7 +245,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 		if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
 					&images.os.load)) {
 			puts("Can't get image load address!\n");
-			show_boot_progress(-112);
+			show_boot_error(112);
 			return 1;
 		}
 		break;
@@ -348,7 +348,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			puts("GUNZIP: uncompress, out-of-mem or overwrite "
 				"error - must RESET board to recover\n");
 			if (boot_progress)
-				show_boot_progress(-6);
+				show_boot_error(6);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -370,7 +370,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			printf("BUNZIP2: uncompress or overwrite error %d "
 				"- must RESET board to recover\n", i);
 			if (boot_progress)
-				show_boot_progress(-6);
+				show_boot_error(6);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -389,7 +389,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 		if (ret != SZ_OK) {
 			printf("LZMA: uncompress or overwrite error %d "
 				"- must RESET board to recover\n", ret);
-			show_boot_progress(-6);
+			show_boot_error(6);
 			return BOOTM_ERR_RESET;
 		}
 		*load_end = load + unc_len;
@@ -407,7 +407,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			printf("LZO: uncompress or overwrite error %d "
 			      "- must RESET board to recover\n", ret);
 			if (boot_progress)
-				show_boot_progress(-6);
+				show_boot_error(6);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -649,14 +649,14 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			} else {
 				puts("ERROR: new format image overwritten - "
 					"must RESET the board to recover\n");
-				show_boot_progress(-113);
+				show_boot_error(113);
 				do_reset(cmdtp, flag, argc, argv);
 			}
 		}
 		if (ret == BOOTM_ERR_UNIMPLEMENTED) {
 			if (iflag)
 				enable_interrupts();
-			show_boot_progress(-7);
+			show_boot_error(7);
 			return 1;
 		}
 	}
@@ -685,7 +685,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			enable_interrupts();
 		printf("ERROR: booting os '%s' (%d) is not supported\n",
 			genimg_get_os_name(images.os.os), images.os.os);
-		show_boot_progress(-8);
+		show_boot_error(8);
 		return 1;
 	}
 
@@ -693,7 +693,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	boot_fn(0, argc, argv, &images);
 
-	show_boot_progress(-9);
+	show_boot_error(9);
 #ifdef DEBUG
 	puts("\n## Control returned to monitor - resetting...\n");
 #endif
@@ -735,14 +735,14 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
 
 	if (!image_check_magic(hdr)) {
 		puts("Bad Magic Number\n");
-		show_boot_progress(-1);
+		show_boot_error(1);
 		return NULL;
 	}
 	show_boot_progress(2);
 
 	if (!image_check_hcrc(hdr)) {
 		puts("Bad Header Checksum\n");
-		show_boot_progress(-2);
+		show_boot_error(2);
 		return NULL;
 	}
 
@@ -753,7 +753,7 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
 		puts("   Verifying Checksum ... ");
 		if (!image_check_dcrc(hdr)) {
 			printf("Bad Data CRC\n");
-			show_boot_progress(-3);
+			show_boot_error(3);
 			return NULL;
 		}
 		puts("OK\n");
@@ -762,7 +762,7 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
 
 	if (!image_check_target_arch(hdr)) {
 		printf("Unsupported Architecture 0x%x\n", image_get_arch(hdr));
-		show_boot_progress(-4);
+		show_boot_error(4);
 		return NULL;
 	}
 	return hdr;
@@ -790,7 +790,7 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
 		puts("   Verifying Hash Integrity ... ");
 		if (!fit_image_check_hashes(fit, os_noffset)) {
 			puts("Bad Data Hash\n");
-			show_boot_progress(-104);
+			show_boot_error(104);
 			return 0;
 		}
 		puts("OK\n");
@@ -799,7 +799,7 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
 
 	if (!fit_image_check_target_arch(fit, os_noffset)) {
 		puts("Unsupported Architecture\n");
-		show_boot_progress(-105);
+		show_boot_error(105);
 		return 0;
 	}
 
@@ -807,7 +807,7 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
 	if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) &&
 	    !fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
 		puts("Not a kernel image\n");
-		show_boot_progress(-106);
+		show_boot_error(106);
 		return 0;
 	}
 
@@ -897,7 +897,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		default:
 			printf("Wrong Image Type for %s command\n",
 				cmdtp->name);
-			show_boot_progress(-5);
+			show_boot_error(5);
 			return NULL;
 		}
 
@@ -922,7 +922,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 
 		if (!fit_check_format(fit_hdr)) {
 			puts("Bad FIT kernel image format!\n");
-			show_boot_progress(-100);
+			show_boot_error(100);
 			return NULL;
 		}
 		show_boot_progress(100);
@@ -938,7 +938,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 			cfg_noffset = fit_conf_get_node(fit_hdr,
 							fit_uname_config);
 			if (cfg_noffset < 0) {
-				show_boot_progress(-101);
+				show_boot_error(101);
 				return NULL;
 			}
 			/* save configuration uname provided in the first
@@ -962,7 +962,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 							fit_uname_kernel);
 		}
 		if (os_noffset < 0) {
-			show_boot_progress(-103);
+			show_boot_error(103);
 			return NULL;
 		}
 
@@ -975,7 +975,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		/* get kernel image data address and length */
 		if (fit_image_get_data(fit_hdr, os_noffset, &data, &len)) {
 			puts("Could not find kernel subimage data!\n");
-			show_boot_progress(-107);
+			show_boot_error(107);
 			return NULL;
 		}
 		show_boot_progress(108);
@@ -989,7 +989,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 #endif
 	default:
 		printf("Wrong Image Format for %s command\n", cmdtp->name);
-		show_boot_progress(-108);
+		show_boot_error(108);
 		return NULL;
 	}
 
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 305c602..bdfa8db 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -360,14 +360,14 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		boot_device = argv[2];
 		break;
 	default:
-		show_boot_progress(-42);
+		show_boot_error(42);
 		return cmd_usage(cmdtp);
 	}
 	show_boot_progress(42);
 
 	if (!boot_device) {
 		puts("\n** No boot device **\n");
-		show_boot_progress(-43);
+		show_boot_error(43);
 		return 1;
 	}
 	show_boot_progress(43);
@@ -376,7 +376,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 
 	if (ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN) {
 		printf("\n** Device %d not available\n", dev);
-		show_boot_progress(-44);
+		show_boot_error(44);
 		return 1;
 	}
 	show_boot_progress(44);
@@ -384,14 +384,14 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (*ep) {
 		if (*ep != ':') {
 			puts("\n** Invalid boot device, use `dev[:part]' **\n");
-			show_boot_progress(-45);
+			show_boot_error(45);
 			return 1;
 		}
 		part = simple_strtoul(++ep, NULL, 16);
 	}
 	show_boot_progress(45);
 	if (get_partition_info(&ide_dev_desc[dev], part, &info)) {
-		show_boot_progress(-46);
+		show_boot_error(46);
 		return 1;
 	}
 	show_boot_progress(46);
@@ -402,7 +402,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		printf("\n** Invalid partition type \"%.32s\"" " (expect \""
 			BOOT_PART_TYPE "\")\n",
 			info.type);
-		show_boot_progress(-47);
+		show_boot_error(47);
 		return 1;
 	}
 	show_boot_progress(47);
@@ -416,7 +416,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (ide_dev_desc[dev].
 	    block_read(dev, info.start, 1, (ulong *) addr) != 1) {
 		printf("** Read error on %d:%d\n", dev, part);
-		show_boot_progress(-48);
+		show_boot_error(48);
 		return 1;
 	}
 	show_boot_progress(48);
@@ -429,7 +429,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 
 		if (!image_check_hcrc(hdr)) {
 			puts("\n** Bad Header Checksum **\n");
-			show_boot_progress(-50);
+			show_boot_error(50);
 			return 1;
 		}
 		show_boot_progress(50);
@@ -447,7 +447,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		break;
 #endif
 	default:
-		show_boot_progress(-49);
+		show_boot_error(49);
 		puts("** Unknown image type\n");
 		return 1;
 	}
@@ -459,7 +459,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (ide_dev_desc[dev].block_read(dev, info.start + 1, cnt,
 					 (ulong *)(addr + info.blksz)) != cnt) {
 		printf("** Read error on %d:%d\n", dev, part);
-		show_boot_progress(-51);
+		show_boot_error(51);
 		return 1;
 	}
 	show_boot_progress(51);
@@ -468,7 +468,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
 	if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) {
 		if (!fit_check_format(fit_hdr)) {
-			show_boot_progress(-140);
+			show_boot_error(140);
 			puts("** Bad FIT image format\n");
 			return 1;
 		}
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 3e2edb8..e294b3e 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -787,7 +787,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	if (s != NULL &&
 	    (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {
 		printf("Unknown nand load suffix '%s'\n", s);
-		show_boot_progress(-53);
+		show_boot_error(53);
 		return 1;
 	}
 
@@ -797,7 +797,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
 	if (r) {
 		puts("** Read error\n");
-		show_boot_progress (-56);
+		show_boot_error(56);
 		return 1;
 	}
 	show_boot_progress (56);
@@ -820,7 +820,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 		break;
 #endif
 	default:
-		show_boot_progress (-57);
+		show_boot_error(57);
 		puts ("** Unknown image type\n");
 		return 1;
 	}
@@ -829,7 +829,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
 	if (r) {
 		puts("** Read error\n");
-		show_boot_progress (-58);
+		show_boot_error(58);
 		return 1;
 	}
 	show_boot_progress (58);
@@ -838,7 +838,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
 	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
 		if (!fit_check_format (fit_hdr)) {
-			show_boot_progress (-150);
+			show_boot_error(150);
 			puts ("** Bad FIT image format\n");
 			return 1;
 		}
@@ -907,14 +907,14 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 #if defined(CONFIG_CMD_MTDPARTS)
 usage:
 #endif
-		show_boot_progress(-53);
+		show_boot_error(53);
 		return cmd_usage(cmdtp);
 	}
 
 	show_boot_progress(53);
 	if (!boot_device) {
 		puts("\n** No boot device **\n");
-		show_boot_progress(-54);
+		show_boot_error(54);
 		return 1;
 	}
 	show_boot_progress(54);
@@ -923,7 +923,7 @@ usage:
 
 	if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) {
 		printf("\n** Device %d not available\n", idx);
-		show_boot_progress(-55);
+		show_boot_error(55);
 		return 1;
 	}
 	show_boot_progress(55);
diff --git a/common/cmd_net.c b/common/cmd_net.c
index f89a24b..6798b89 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -227,13 +227,13 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 		break;
 #endif
 	default:
-		show_boot_progress (-80);
+		show_boot_error(80);
 		return cmd_usage(cmdtp);
 	}
 
 	show_boot_progress (80);
 	if ((size = NetLoop(proto)) < 0) {
-		show_boot_progress (-81);
+		show_boot_error(81);
 		return 1;
 	}
 
@@ -243,7 +243,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 
 	/* done if no file was loaded (no errors though) */
 	if (size == 0) {
-		show_boot_progress (-82);
+		show_boot_error(82);
 		return 0;
 	}
 
@@ -254,7 +254,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 	rcode = bootm_maybe_autostart(cmdtp, argv[0]);
 
 	if (rcode < 0)
-		show_boot_progress (-83);
+		show_boot_error(83);
 	else
 		show_boot_progress (84);
 	return rcode;
diff --git a/common/env_common.c b/common/env_common.c
index 8a71096..4060c63 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -221,7 +221,7 @@ void env_relocate(void)
 #if defined(CONFIG_ENV_IS_NOWHERE)	/* Environment not changable */
 		set_default_env(NULL);
 #else
-		show_boot_progress(-60);
+		show_boot_error(60);
 		set_default_env("!bad CRC");
 #endif
 	} else {
diff --git a/common/image.c b/common/image.c
index aacae5a..a7263e5 100644
--- a/common/image.c
+++ b/common/image.c
@@ -372,13 +372,13 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 
 	if (!image_check_magic(rd_hdr)) {
 		puts("Bad Magic Number\n");
-		show_boot_progress(-10);
+		show_boot_error(10);
 		return NULL;
 	}
 
 	if (!image_check_hcrc(rd_hdr)) {
 		puts("Bad Header Checksum\n");
-		show_boot_progress(-11);
+		show_boot_error(11);
 		return NULL;
 	}
 
@@ -389,7 +389,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 		puts("   Verifying Checksum ... ");
 		if (!image_check_dcrc(rd_hdr)) {
 			puts("Bad Data CRC\n");
-			show_boot_progress(-12);
+			show_boot_error(12);
 			return NULL;
 		}
 		puts("OK\n");
@@ -402,7 +402,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 	    !image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
 		printf("No Linux %s Ramdisk Image\n",
 				genimg_get_arch_name(arch));
-		show_boot_progress(-13);
+		show_boot_error(13);
 		return NULL;
 	}
 
@@ -914,7 +914,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			show_boot_progress(120);
 			if (!fit_check_format(fit_hdr)) {
 				puts("Bad FIT ramdisk image format!\n");
-				show_boot_progress(-120);
+				show_boot_error(120);
 				return 1;
 			}
 			show_boot_progress(121);
@@ -931,7 +931,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 				if (cfg_noffset < 0) {
 					puts("Could not find configuration "
 						"node\n");
-					show_boot_progress(-122);
+					show_boot_error(122);
 					return 1;
 				}
 				fit_uname_config = fdt_get_name(fit_hdr,
@@ -951,7 +951,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			}
 			if (rd_noffset < 0) {
 				puts("Could not find subimage node\n");
-				show_boot_progress(-124);
+				show_boot_error(124);
 				return 1;
 			}
 
@@ -967,7 +967,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			if (fit_image_get_data(fit_hdr, rd_noffset, &data,
 						&size)) {
 				puts("Could not find ramdisk subimage data!\n");
-				show_boot_progress(-127);
+				show_boot_error(127);
 				return 1;
 			}
 			show_boot_progress(128);
@@ -978,7 +978,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			if (fit_image_get_load(fit_hdr, rd_noffset, &rd_load)) {
 				puts("Can't get ramdisk subimage load "
 					"address!\n");
-				show_boot_progress(-129);
+				show_boot_error(129);
 				return 1;
 			}
 			show_boot_progress(129);
@@ -3162,7 +3162,7 @@ static int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
 		puts("   Verifying Hash Integrity ... ");
 		if (!fit_image_check_hashes(fit, rd_noffset)) {
 			puts("Bad Data Hash\n");
-			show_boot_progress(-125);
+			show_boot_error(125);
 			return 0;
 		}
 		puts("OK\n");
@@ -3174,7 +3174,7 @@ static int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
 	    !fit_image_check_type(fit, rd_noffset, IH_TYPE_RAMDISK)) {
 		printf("No Linux %s Ramdisk Image\n",
 				genimg_get_arch_name(arch));
-		show_boot_progress(-126);
+		show_boot_error(126);
 		return 0;
 	}
 
diff --git a/include/bootstage.h b/include/bootstage.h
index 4a4300f..dc0c4da 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -57,5 +57,9 @@ enum bootstage_id {
  *		has occurred.
  */
 void show_boot_progress(int val);
+static inline void show_boot_error(int val)
+{
+	show_boot_progress(-val);
+}
 
 #endif
diff --git a/net/eth.c b/net/eth.c
index 4280d6d..e9a0f46 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -274,7 +274,7 @@ int eth_initialize(bd_t *bis)
 #endif
 	if (!eth_devices) {
 		puts ("No ethernet found.\n");
-		show_boot_progress (-64);
+		show_boot_error(64);
 	} else {
 		struct eth_device *dev = eth_devices;
 		char *ethprime = getenv ("ethprime");
diff --git a/post/post.c b/post/post.c
index 0e67ad7..1cc3f09 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_progress(-31);
+				show_boot_error(31);
 			}
 		}
 	}
@@ -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_progress(-32);
+				show_boot_error(32);
 				show_post_progress(i, POST_AFTER, POST_FAILED);
 				if (test_flags & POST_CRITICAL)
 					gd->flags |= GD_FLG_POSTFAIL;
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 04/15] bootstage: Convert progress numbers 1-9 into enums
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (2 preceding siblings ...)
  2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 03/15] bootstage: Use show_boot_error() for -ve progress numbers Simon Glass
@ 2011-12-10 21:07 ` Simon Glass
  2012-01-08  8:27   ` Mike Frysinger
  2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 05/15] bootstage: Convert progress numbers 10-19 to enums Simon Glass
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:07 UTC (permalink / raw)
  To: u-boot

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

 board/bf533-stamp/bf533-stamp.c        |   18 +++++++-------
 board/hermes/hermes.c                  |    2 +-
 board/ivm/ivm.c                        |    2 +-
 board/matrix_vision/common/mv_common.c |    2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c    |    2 +-
 board/pcs440ep/pcs440ep.c              |   22 ++++++++--------
 common/cmd_bootm.c                     |   41 +++++++++++++++----------------
 common/image.c                         |    2 +-
 include/bootstage.h                    |   14 +++++++++++
 9 files changed, 59 insertions(+), 46 deletions(-)

diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index b1134e9..07a988a 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -91,27 +91,27 @@ static void stamp_led_set(int LED1, int LED2, int LED3)
 void show_boot_progress(int status)
 {
 	switch (status) {
-	case 1:
+	case BOOTSTAGE_ID_CHECK_MAGIC:
 		stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
 		break;
-	case 2:
+	case BOOTSTAGE_ID_CHECK_HEADER:
 		stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
 		break;
-	case 3:
+	case BOOTSTAGE_ID_CHECK_CHECKSUM:
 		stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
 		break;
-	case 4:
+	case BOOTSTAGE_ID_CHECK_ARCH:
 		stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
 		break;
-	case 5:
-	case 6:
+	case BOOTSTAGE_ID_CHECK_IMAGETYPE:
+	case BOOTSTAGE_ID_DECOMP_IMAGE:
 		stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
 		break;
-	case 7:
-	case 8:
+	case BOOTSTAGE_ID_KERNEL_LOADED:
+	case BOOTSTAGE_ID_CHECK_BOOT_OS:
 		stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
 		break;
-	case 9:
+	case BOOTSTAGE_ID_BOOT_OS_RETURNED:
 	case 10:
 	case 11:
 	case 12:
diff --git a/board/hermes/hermes.c b/board/hermes/hermes.c
index acf364e..1b40ae8 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -370,7 +370,7 @@ static ulong board_init (void)
 			immr->im_ioport.iop_pcdat |= PC_REP_RES;
 		}
 	}
-	SHOW_BOOT_PROGRESS (0x00);
+	SHOW_BOOT_PROGRESS(BOOTSTAGE_ID_CHECK_MAGIC);
 
 	return ((revision << 16) | (speed & 0xFFFF));
 }
diff --git a/board/ivm/ivm.c b/board/ivm/ivm.c
index 9bec198..71d64d4 100644
--- a/board/ivm/ivm.c
+++ b/board/ivm/ivm.c
@@ -322,7 +322,7 @@ void show_boot_progress (int status)
 			(status < 0) ? STATUS_LED_ON : STATUS_LED_OFF);
 # endif	/* STATUS_LED_YELLOW */
 # if defined(STATUS_LED_BOOT)
-	if (status == 6)
+	if (status == BOOTSTAGE_ID_DECOMP_IMAGE)
 		status_led_set (STATUS_LED_BOOT, STATUS_LED_OFF);
 # endif	/* STATUS_LED_BOOT */
 #endif /* CONFIG_STATUS_LED */
diff --git a/board/matrix_vision/common/mv_common.c b/board/matrix_vision/common/mv_common.c
index acb72c5..7fde4ac 100644
--- a/board/matrix_vision/common/mv_common.c
+++ b/board/matrix_vision/common/mv_common.c
@@ -95,7 +95,7 @@ int mv_load_fpga(void)
 
 	result = fpga_load(0, fpga_data, data_size);
 	if (!result)
-		show_boot_progress(0);
+		show_boot_progress(BOOTSTAGE_ID_START);
 
 	return result;
 }
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c b/board/matrix_vision/mvbc_p/mvbc_p.c
index 9dffedc..a5dc2f0 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -241,7 +241,7 @@ void show_boot_progress(int val)
 	struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
 
 	switch(val) {
-	case 0: /* FPGA ok */
+	case BOOTSTAGE_ID_START: /* FPGA ok */
 		setbits_be32(&gpio->simple_dvo, LED_G0);
 		break;
 	case 65:
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 36994b5..118d81c 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -104,17 +104,17 @@ void show_boot_progress (int val)
 		return;
 	}
 	switch (val) {
-		case 1:
-			/* validating Image */
-			status_led_set (0, STATUS_LED_OFF);
-			status_led_set (1, STATUS_LED_ON);
-			status_led_set (2, STATUS_LED_ON);
-			break;
-		case BOOTSTAGE_ID_RUN_OS:
-			status_led_set (0, STATUS_LED_ON);
-			status_led_set (1, STATUS_LED_ON);
-			status_led_set (2, STATUS_LED_ON);
-			break;
+	case BOOTSTAGE_ID_CHECK_MAGIC:
+		/* validating Image */
+		status_led_set(0, STATUS_LED_OFF);
+		status_led_set(1, STATUS_LED_ON);
+		status_led_set(2, STATUS_LED_ON);
+		break;
+	case BOOTSTAGE_ID_RUN_OS:
+		status_led_set(0, STATUS_LED_ON);
+		status_led_set(1, STATUS_LED_ON);
+		status_led_set(2, STATUS_LED_ON);
+		break;
 #if 0
 		case 64:
 			/* starting Ethernet configuration */
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 450fa5c..9ab1c61 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -348,7 +348,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			puts("GUNZIP: uncompress, out-of-mem or overwrite "
 				"error - must RESET board to recover\n");
 			if (boot_progress)
-				show_boot_error(6);
+				show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -370,7 +370,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			printf("BUNZIP2: uncompress or overwrite error %d "
 				"- must RESET board to recover\n", i);
 			if (boot_progress)
-				show_boot_error(6);
+				show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -389,7 +389,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 		if (ret != SZ_OK) {
 			printf("LZMA: uncompress or overwrite error %d "
 				"- must RESET board to recover\n", ret);
-			show_boot_error(6);
+			show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 			return BOOTM_ERR_RESET;
 		}
 		*load_end = load + unc_len;
@@ -407,7 +407,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			printf("LZO: uncompress or overwrite error %d "
 			      "- must RESET board to recover\n", ret);
 			if (boot_progress)
-				show_boot_error(6);
+				show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -423,8 +423,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 
 	puts("OK\n");
 	debug("   kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end);
-	if (boot_progress)
-		show_boot_progress(7);
+	show_boot_progress(BOOTSTAGE_ID_KERNEL_LOADED);
 
 	if (!no_overlap && (load < blob_end) && (*load_end > blob_start)) {
 		debug("images.os.start = 0x%lX, images.os.end = 0x%lx\n",
@@ -656,7 +655,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (ret == BOOTM_ERR_UNIMPLEMENTED) {
 			if (iflag)
 				enable_interrupts();
-			show_boot_error(7);
+			show_boot_error(BOOTSTAGE_ID_DECOMP_UNIMPL);
 			return 1;
 		}
 	}
@@ -671,7 +670,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 0;
 	}
 
-	show_boot_progress(8);
+	show_boot_progress(BOOTSTAGE_ID_CHECK_BOOT_OS);
 
 #ifdef CONFIG_SILENT_CONSOLE
 	if (images.os.os == IH_OS_LINUX)
@@ -685,7 +684,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			enable_interrupts();
 		printf("ERROR: booting os '%s' (%d) is not supported\n",
 			genimg_get_os_name(images.os.os), images.os.os);
-		show_boot_error(8);
+		show_boot_error(BOOTSTAGE_ID_CHECK_BOOT_OS);
 		return 1;
 	}
 
@@ -693,7 +692,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	boot_fn(0, argc, argv, &images);
 
-	show_boot_error(9);
+	show_boot_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);
 #ifdef DEBUG
 	puts("\n## Control returned to monitor - resetting...\n");
 #endif
@@ -735,34 +734,34 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
 
 	if (!image_check_magic(hdr)) {
 		puts("Bad Magic Number\n");
-		show_boot_error(1);
+		show_boot_error(BOOTSTAGE_ID_CHECK_MAGIC);
 		return NULL;
 	}
-	show_boot_progress(2);
+	show_boot_progress(BOOTSTAGE_ID_CHECK_HEADER);
 
 	if (!image_check_hcrc(hdr)) {
 		puts("Bad Header Checksum\n");
-		show_boot_error(2);
+		show_boot_error(BOOTSTAGE_ID_CHECK_HEADER);
 		return NULL;
 	}
 
-	show_boot_progress(3);
+	show_boot_progress(BOOTSTAGE_ID_CHECK_CHECKSUM);
 	image_print_contents(hdr);
 
 	if (verify) {
 		puts("   Verifying Checksum ... ");
 		if (!image_check_dcrc(hdr)) {
 			printf("Bad Data CRC\n");
-			show_boot_error(3);
+			show_boot_error(BOOTSTAGE_ID_CHECK_CHECKSUM);
 			return NULL;
 		}
 		puts("OK\n");
 	}
-	show_boot_progress(4);
+	show_boot_progress(BOOTSTAGE_ID_CHECK_ARCH);
 
 	if (!image_check_target_arch(hdr)) {
 		printf("Unsupported Architecture 0x%x\n", image_get_arch(hdr));
-		show_boot_error(4);
+		show_boot_error(BOOTSTAGE_ID_CHECK_ARCH);
 		return NULL;
 	}
 	return hdr;
@@ -864,7 +863,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		debug("*  kernel: cmdline image address = 0x%08lx\n", img_addr);
 	}
 
-	show_boot_progress(1);
+	show_boot_progress(BOOTSTAGE_ID_CHECK_MAGIC);
 
 	/* copy from dataflash if needed */
 	img_addr = genimg_get_image(img_addr);
@@ -878,7 +877,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		hdr = image_get_kernel(img_addr, images->verify);
 		if (!hdr)
 			return NULL;
-		show_boot_progress(5);
+		show_boot_progress(BOOTSTAGE_ID_CHECK_IMAGETYPE);
 
 		/* get os_data and os_len */
 		switch (image_get_type(hdr)) {
@@ -897,7 +896,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		default:
 			printf("Wrong Image Type for %s command\n",
 				cmdtp->name);
-			show_boot_error(5);
+			show_boot_error(BOOTSTAGE_ID_CHECK_IMAGETYPE);
 			return NULL;
 		}
 
@@ -912,7 +911,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		images->legacy_hdr_os = hdr;
 
 		images->legacy_hdr_valid = 1;
-		show_boot_progress(6);
+		show_boot_progress(BOOTSTAGE_ID_DECOMP_IMAGE);
 		break;
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
diff --git a/common/image.c b/common/image.c
index a7263e5..7933446 100644
--- a/common/image.c
+++ b/common/image.c
@@ -894,7 +894,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			printf("## Loading init Ramdisk from Legacy "
 					"Image at %08lx ...\n", rd_addr);
 
-			show_boot_progress(9);
+			show_boot_progress(BOOTSTAGE_ID_LOAD_RAMDISK);
 			rd_hdr = image_get_ramdisk(rd_addr, arch,
 							images->verify);
 
diff --git a/include/bootstage.h b/include/bootstage.h
index dc0c4da..2f30909 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -46,6 +46,20 @@
  * error on action3
  */
 enum bootstage_id {
+	BOOTSTAGE_ID_START,
+	BOOTSTAGE_ID_CHECK_MAGIC,	/* Checking image magic */
+	BOOTSTAGE_ID_CHECK_HEADER,	/* Checking image header */
+	BOOTSTAGE_ID_CHECK_CHECKSUM,	/* Checking image checksum */
+	BOOTSTAGE_ID_CHECK_ARCH,	/* Checking architecture */
+
+	BOOTSTAGE_ID_CHECK_IMAGETYPE = 5,/* Checking image type */
+	BOOTSTAGE_ID_DECOMP_IMAGE,	/* Decompressing image */
+	BOOTSTAGE_ID_KERNEL_LOADED,	/* Kernel has been loaded */
+	BOOTSTAGE_ID_DECOMP_UNIMPL = 7,	/* Odd decompression algorithm */
+	BOOTSTAGE_ID_CHECK_BOOT_OS,	/* Calling OS-specific boot function */
+	BOOTSTAGE_ID_BOOT_OS_RETURNED,	/* Tried to boot OS, but it returned */
+	BOOTSTAGE_ID_CHECK_RAMDISK = 9,	/* Checking ram disk */
+
 	BOOTSTAGE_ID_RUN_OS	= 15,	/* Exiting U-Boot, entering OS */
 };
 
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 05/15] bootstage: Convert progress numbers 10-19 to enums
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (3 preceding siblings ...)
  2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 04/15] bootstage: Convert progress numbers 1-9 into enums Simon Glass
@ 2011-12-10 21:07 ` Simon Glass
  2012-01-08  8:28   ` Mike Frysinger
  2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 06/15] bootstage: Convert progress numbers 20-41 " Simon Glass
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:07 UTC (permalink / raw)
  To: u-boot

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

 board/bf533-stamp/bf533-stamp.c     |   10 +++++-----
 board/matrix_vision/mvbc_p/mvbc_p.c |    2 +-
 common/image.c                      |   20 ++++++++++----------
 include/bootstage.h                 |    7 +++++++
 4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index 07a988a..4d36160 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -112,11 +112,11 @@ void show_boot_progress(int status)
 		stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
 		break;
 	case BOOTSTAGE_ID_BOOT_OS_RETURNED:
-	case 10:
-	case 11:
-	case 12:
-	case 13:
-	case 14:
+	case BOOTSTAGE_ID_RD_MAGIC:
+	case BOOTSTAGE_ID_RD_HDR_CHECKSUM:
+	case BOOTSTAGE_ID_RD_CHECKSUM:
+	case BOOTSTAGE_ID_RAMDISK:
+	case BOOTSTAGE_ID_NO_RAMDISK:
 	case BOOTSTAGE_ID_RUN_OS:
 		stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
 		break;
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c b/board/matrix_vision/mvbc_p/mvbc_p.c
index a5dc2f0..7e06d6c 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -247,7 +247,7 @@ void show_boot_progress(int val)
 	case 65:
 		setbits_be32(&gpio->simple_dvo, LED_G1);
 		break;
-	case 12:
+	case BOOTSTAGE_ID_COPY_RAMDISK:
 		setbits_be32(&gpio->simple_dvo, LED_Y);
 		break;
 	case BOOTSTAGE_ID_RUN_OS:
diff --git a/common/image.c b/common/image.c
index 7933446..20f3f82 100644
--- a/common/image.c
+++ b/common/image.c
@@ -372,37 +372,37 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 
 	if (!image_check_magic(rd_hdr)) {
 		puts("Bad Magic Number\n");
-		show_boot_error(10);
+		show_boot_error(BOOTSTAGE_ID_RD_MAGIC);
 		return NULL;
 	}
 
 	if (!image_check_hcrc(rd_hdr)) {
 		puts("Bad Header Checksum\n");
-		show_boot_error(11);
+		show_boot_error(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
 		return NULL;
 	}
 
-	show_boot_progress(10);
+	show_boot_progress(BOOTSTAGE_ID_RD_MAGIC);
 	image_print_contents(rd_hdr);
 
 	if (verify) {
 		puts("   Verifying Checksum ... ");
 		if (!image_check_dcrc(rd_hdr)) {
 			puts("Bad Data CRC\n");
-			show_boot_error(12);
+			show_boot_error(BOOTSTAGE_ID_RD_CHECKSUM);
 			return NULL;
 		}
 		puts("OK\n");
 	}
 
-	show_boot_progress(11);
+	show_boot_progress(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
 
 	if (!image_check_os(rd_hdr, IH_OS_LINUX) ||
 	    !image_check_arch(rd_hdr, arch) ||
 	    !image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
 		printf("No Linux %s Ramdisk Image\n",
 				genimg_get_arch_name(arch));
-		show_boot_error(13);
+		show_boot_error(BOOTSTAGE_ID_RAMDISK);
 		return NULL;
 	}
 
@@ -894,7 +894,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			printf("## Loading init Ramdisk from Legacy "
 					"Image at %08lx ...\n", rd_addr);
 
-			show_boot_progress(BOOTSTAGE_ID_LOAD_RAMDISK);
+			show_boot_progress(BOOTSTAGE_ID_CHECK_RAMDISK);
 			rd_hdr = image_get_ramdisk(rd_addr, arch,
 							images->verify);
 
@@ -1001,7 +1001,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 		 * Now check if we have a legacy mult-component image,
 		 * get second entry data start address and len.
 		 */
-		show_boot_progress(13);
+		show_boot_progress(BOOTSTAGE_ID_RAMDISK);
 		printf("## Loading init Ramdisk from multi component "
 				"Legacy Image at %08lx ...\n",
 				(ulong)images->legacy_hdr_os);
@@ -1011,7 +1011,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 		/*
 		 * no initrd image
 		 */
-		show_boot_progress(14);
+		show_boot_progress(BOOTSTAGE_ID_NO_RAMDISK);
 		rd_len = rd_data = 0;
 	}
 
@@ -1095,7 +1095,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
 				puts("ramdisk - allocation error\n");
 				goto error;
 			}
-			show_boot_progress(12);
+			show_boot_progress(BOOTSTAGE_ID_COPY_RAMDISK);
 
 			*initrd_end = *initrd_start + rd_len;
 			printf("   Loading Ramdisk to %08lx, end %08lx ... ",
diff --git a/include/bootstage.h b/include/bootstage.h
index 2f30909..8c5a92e 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -60,6 +60,13 @@ enum bootstage_id {
 	BOOTSTAGE_ID_BOOT_OS_RETURNED,	/* Tried to boot OS, but it returned */
 	BOOTSTAGE_ID_CHECK_RAMDISK = 9,	/* Checking ram disk */
 
+	BOOTSTAGE_ID_RD_MAGIC,		/* Checking ram disk magic */
+	BOOTSTAGE_ID_RD_HDR_CHECKSUM,	/* Checking ram disk heder checksum */
+	BOOTSTAGE_ID_RD_CHECKSUM,	/* Checking ram disk checksum */
+	BOOTSTAGE_ID_COPY_RAMDISK = 12,	/* Copying ram disk into place */
+	BOOTSTAGE_ID_RAMDISK,		/* Checking for valid ramdisk */
+	BOOTSTAGE_ID_NO_RAMDISK,	/* No ram disk found (not an error) */
+
 	BOOTSTAGE_ID_RUN_OS	= 15,	/* Exiting U-Boot, entering OS */
 };
 
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 06/15] bootstage: Convert progress numbers 20-41 to enums
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (4 preceding siblings ...)
  2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 05/15] bootstage: Convert progress numbers 10-19 to enums Simon Glass
@ 2011-12-10 21:07 ` Simon Glass
  2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 07/15] bootstage: Convert IDE progress numbers " Simon Glass
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:07 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 07/15] bootstage: Convert IDE progress numbers to enums
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (5 preceding siblings ...)
  2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 06/15] bootstage: Convert progress numbers 20-41 " Simon Glass
@ 2011-12-10 21:07 ` Simon Glass
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 08/15] bootstage: Convert NAND " Simon Glass
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:07 UTC (permalink / raw)
  To: u-boot

This changes over the IDE progress numbers to use enums from bootstage.h.

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

 common/cmd_ide.c    |   46 +++++++++++++++++++++++-----------------------
 include/bootstage.h |   14 ++++++++++++++
 2 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index bdfa8db..46fa7d4 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -345,7 +345,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	const void *fit_hdr = NULL;
 #endif
 
-	show_boot_progress(41);
+	show_boot_progress(BOOTSTAGE_ID_IDE_START);
 	switch (argc) {
 	case 1:
 		addr = CONFIG_SYS_LOAD_ADDR;
@@ -360,41 +360,41 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		boot_device = argv[2];
 		break;
 	default:
-		show_boot_error(42);
+		show_boot_error(BOOTSTAGE_ID_IDE_ADDR);
 		return cmd_usage(cmdtp);
 	}
-	show_boot_progress(42);
+	show_boot_progress(BOOTSTAGE_ID_IDE_ADDR);
 
 	if (!boot_device) {
 		puts("\n** No boot device **\n");
-		show_boot_error(43);
+		show_boot_error(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
 		return 1;
 	}
-	show_boot_progress(43);
+	show_boot_progress(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
 
 	dev = simple_strtoul(boot_device, &ep, 16);
 
 	if (ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN) {
 		printf("\n** Device %d not available\n", dev);
-		show_boot_error(44);
+		show_boot_error(BOOTSTAGE_ID_IDE_TYPE);
 		return 1;
 	}
-	show_boot_progress(44);
+	show_boot_progress(BOOTSTAGE_ID_IDE_TYPE);
 
 	if (*ep) {
 		if (*ep != ':') {
 			puts("\n** Invalid boot device, use `dev[:part]' **\n");
-			show_boot_error(45);
+			show_boot_error(BOOTSTAGE_ID_IDE_PART);
 			return 1;
 		}
 		part = simple_strtoul(++ep, NULL, 16);
 	}
-	show_boot_progress(45);
+	show_boot_progress(BOOTSTAGE_ID_IDE_PART);
 	if (get_partition_info(&ide_dev_desc[dev], part, &info)) {
-		show_boot_error(46);
+		show_boot_error(BOOTSTAGE_ID_IDE_PART_INFO);
 		return 1;
 	}
-	show_boot_progress(46);
+	show_boot_progress(BOOTSTAGE_ID_IDE_PART_INFO);
 	if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0)
 	    &&
 	    (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)
@@ -402,10 +402,10 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		printf("\n** Invalid partition type \"%.32s\"" " (expect \""
 			BOOT_PART_TYPE "\")\n",
 			info.type);
-		show_boot_error(47);
+		show_boot_error(BOOTSTAGE_ID_IDE_PART_TYPE);
 		return 1;
 	}
-	show_boot_progress(47);
+	show_boot_progress(BOOTSTAGE_ID_IDE_PART_TYPE);
 
 	printf("\nLoading from IDE device %d, partition %d: "
 	       "Name: %.32s  Type: %.32s\n", dev, part, info.name, info.type);
@@ -416,23 +416,23 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (ide_dev_desc[dev].
 	    block_read(dev, info.start, 1, (ulong *) addr) != 1) {
 		printf("** Read error on %d:%d\n", dev, part);
-		show_boot_error(48);
+		show_boot_error(BOOTSTAGE_ID_IDE_PART_READ);
 		return 1;
 	}
-	show_boot_progress(48);
+	show_boot_progress(BOOTSTAGE_ID_IDE_PART_READ);
 
 	switch (genimg_get_format((void *) addr)) {
 	case IMAGE_FORMAT_LEGACY:
 		hdr = (image_header_t *) addr;
 
-		show_boot_progress(49);
+		show_boot_progress(BOOTSTAGE_ID_IDE_FORMAT);
 
 		if (!image_check_hcrc(hdr)) {
 			puts("\n** Bad Header Checksum **\n");
-			show_boot_error(50);
+			show_boot_error(BOOTSTAGE_ID_IDE_CHECKSUM);
 			return 1;
 		}
-		show_boot_progress(50);
+		show_boot_progress(BOOTSTAGE_ID_IDE_CHECKSUM);
 
 		image_print_contents(hdr);
 
@@ -447,7 +447,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		break;
 #endif
 	default:
-		show_boot_error(49);
+		show_boot_error(BOOTSTAGE_ID_IDE_FORMAT);
 		puts("** Unknown image type\n");
 		return 1;
 	}
@@ -459,20 +459,20 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (ide_dev_desc[dev].block_read(dev, info.start + 1, cnt,
 					 (ulong *)(addr + info.blksz)) != cnt) {
 		printf("** Read error on %d:%d\n", dev, part);
-		show_boot_error(51);
+		show_boot_error(BOOTSTAGE_ID_IDE_READ);
 		return 1;
 	}
-	show_boot_progress(51);
+	show_boot_progress(BOOTSTAGE_ID_IDE_READ);
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
 	if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) {
 		if (!fit_check_format(fit_hdr)) {
-			show_boot_error(140);
+			show_boot_error(BOOTSTAGE_ID_IDE_FIT_READ);
 			puts("** Bad FIT image format\n");
 			return 1;
 		}
-		show_boot_progress(141);
+		show_boot_progress(BOOTSTAGE_ID_IDE_FIT_READ_OK);
 		fit_print_contents(fit_hdr);
 	}
 #endif
diff --git a/include/bootstage.h b/include/bootstage.h
index 4b8d818..676c38e 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -93,6 +93,20 @@ enum bootstage_id {
 	BOOTSTAGE_ID_BOARD_DONE,	/* Board init done, off to main loop */
 	/* ^^^ here ends the x86 sequence */
 
+	/* Boot stages related to loading a kernel from an IDE device */
+	BOOTSTAGE_ID_IDE_START = 41,
+	BOOTSTAGE_ID_IDE_ADDR,
+	BOOTSTAGE_ID_IDE_BOOT_DEVICE,
+	BOOTSTAGE_ID_IDE_TYPE,
+
+	BOOTSTAGE_ID_IDE_PART,
+	BOOTSTAGE_ID_IDE_PART_INFO,
+	BOOTSTAGE_ID_IDE_PART_TYPE,
+	BOOTSTAGE_ID_IDE_PART_READ,
+	BOOTSTAGE_ID_IDE_FORMAT,
+
+	BOOTSTAGE_ID_IDE_CHECKSUM,	/* 50 */
+	BOOTSTAGE_ID_IDE_READ,
 };
 
 /*
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 08/15] bootstage: Convert NAND progress numbers to enums
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (6 preceding siblings ...)
  2011-12-10 21:07 ` [U-Boot] [RFC PATCH v2 07/15] bootstage: Convert IDE progress numbers " Simon Glass
@ 2011-12-10 21:08 ` Simon Glass
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 09/15] bootstage: Convert net " Simon Glass
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:08 UTC (permalink / raw)
  To: u-boot

This changes over the NAND progress numbers to use enums from
bootstage.h.

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

 common/cmd_nand.c   |   34 +++++++++++++++++-----------------
 include/bootstage.h |   15 +++++++++++++++
 2 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index e294b3e..1cfa247 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -787,7 +787,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	if (s != NULL &&
 	    (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {
 		printf("Unknown nand load suffix '%s'\n", s);
-		show_boot_error(53);
+		show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
 		return 1;
 	}
 
@@ -797,16 +797,16 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
 	if (r) {
 		puts("** Read error\n");
-		show_boot_error(56);
+		show_boot_error(BOOTSTAGE_ID_NAND_HDR_READ);
 		return 1;
 	}
-	show_boot_progress (56);
+	show_boot_progress(BOOTSTAGE_ID_NAND_HDR_READ);
 
 	switch (genimg_get_format ((void *)addr)) {
 	case IMAGE_FORMAT_LEGACY:
 		hdr = (image_header_t *)addr;
 
-		show_boot_progress (57);
+		show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
 		image_print_contents (hdr);
 
 		cnt = image_get_image_size (hdr);
@@ -820,29 +820,29 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 		break;
 #endif
 	default:
-		show_boot_error(57);
+		show_boot_error(BOOTSTAGE_ID_NAND_TYPE);
 		puts ("** Unknown image type\n");
 		return 1;
 	}
-	show_boot_progress (57);
+	show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
 
 	r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
 	if (r) {
 		puts("** Read error\n");
-		show_boot_error(58);
+		show_boot_error(BOOTSTAGE_ID_NAND_READ);
 		return 1;
 	}
-	show_boot_progress (58);
+	show_boot_progress(BOOTSTAGE_ID_NAND_READ);
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
 	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
 		if (!fit_check_format (fit_hdr)) {
-			show_boot_error(150);
+			show_boot_error(BOOTSTAGE_ID_NAND_FIT_READ);
 			puts ("** Bad FIT image format\n");
 			return 1;
 		}
-		show_boot_progress (151);
+		show_boot_progress(BOOTSTAGE_ID_NAND_FIT_READ_OK);
 		fit_print_contents (fit_hdr);
 	}
 #endif
@@ -884,7 +884,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 	}
 #endif
 
-	show_boot_progress(52);
+	show_boot_progress(BOOTSTAGE_ID_NAND_PART);
 	switch (argc) {
 	case 1:
 		addr = CONFIG_SYS_LOAD_ADDR;
@@ -907,26 +907,26 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 #if defined(CONFIG_CMD_MTDPARTS)
 usage:
 #endif
-		show_boot_error(53);
+		show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
 		return cmd_usage(cmdtp);
 	}
 
-	show_boot_progress(53);
+	show_boot_progress(BOOTSTAGE_ID_NAND_SUFFIX);
 	if (!boot_device) {
 		puts("\n** No boot device **\n");
-		show_boot_error(54);
+		show_boot_error(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
 		return 1;
 	}
-	show_boot_progress(54);
+	show_boot_progress(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
 
 	idx = simple_strtoul(boot_device, NULL, 16);
 
 	if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) {
 		printf("\n** Device %d not available\n", idx);
-		show_boot_error(55);
+		show_boot_error(BOOTSTAGE_ID_NAND_AVAILABLE);
 		return 1;
 	}
-	show_boot_progress(55);
+	show_boot_progress(BOOTSTAGE_ID_NAND_AVAILABLE);
 
 	return nand_load_image(cmdtp, &nand_info[idx], offset, addr, argv[0]);
 }
diff --git a/include/bootstage.h b/include/bootstage.h
index 676c38e..6e0cb39 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -107,6 +107,21 @@ enum bootstage_id {
 
 	BOOTSTAGE_ID_IDE_CHECKSUM,	/* 50 */
 	BOOTSTAGE_ID_IDE_READ,
+
+	/* Boot stages related to loading a kernel from an NAND device */
+	BOOTSTAGE_ID_NAND_PART,
+	BOOTSTAGE_ID_NAND_SUFFIX,
+	BOOTSTAGE_ID_NAND_BOOT_DEVICE,
+	BOOTSTAGE_ID_NAND_HDR_READ = 55,
+	BOOTSTAGE_ID_NAND_AVAILABLE = 55,
+	BOOTSTAGE_ID_NAND_TYPE = 57,
+	BOOTSTAGE_ID_NAND_READ,
+
+	BOOTSTAGE_ID_IDE_FIT_READ = 140,
+	BOOTSTAGE_ID_IDE_FIT_READ_OK,
+
+	BOOTSTAGE_ID_NAND_FIT_READ = 150,
+	BOOTSTAGE_ID_NAND_FIT_READ_OK,
 };
 
 /*
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 09/15] bootstage: Convert net progress numbers to enums
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (7 preceding siblings ...)
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 08/15] bootstage: Convert NAND " Simon Glass
@ 2011-12-10 21:08 ` Simon Glass
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 10/15] bootstage: Convert FIT " Simon Glass
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:08 UTC (permalink / raw)
  To: u-boot

This changes over the network-related progress numbers to use enums
from bootstage.h.

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

 board/Seagate/dockstar/dockstar.c   |    2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c |    2 +-
 board/pcs440ep/pcs440ep.c           |   24 ++++++++++++------------
 common/cmd_net.c                    |   16 ++++++++--------
 common/env_common.c                 |    2 +-
 include/bootstage.h                 |   11 +++++++++++
 net/eth.c                           |    6 +++---
 7 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/board/Seagate/dockstar/dockstar.c b/board/Seagate/dockstar/dockstar.c
index 8cbfb02..38473e5 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -172,7 +172,7 @@ void show_boot_progress(int val)
 	case BOOTSTAGE_ID_RUN_OS:		/* booting Linux */
 		set_leds(BOTH_LEDS, NEITHER_LED);
 		break;
-	case 64:		/* Ethernet initialization */
+	case BOOTSTAGE_ID_NET_ETH_START:	/* Ethernet initialization */
 		set_leds(GREEN_LED, GREEN_LED);
 		break;
 	default:
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c b/board/matrix_vision/mvbc_p/mvbc_p.c
index 7e06d6c..4b48a3c 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -244,7 +244,7 @@ void show_boot_progress(int val)
 	case BOOTSTAGE_ID_START: /* FPGA ok */
 		setbits_be32(&gpio->simple_dvo, LED_G0);
 		break;
-	case 65:
+	case BOOTSTAGE_ID_NET_ETH_INIT:
 		setbits_be32(&gpio->simple_dvo, LED_G1);
 		break;
 	case BOOTSTAGE_ID_COPY_RAMDISK:
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index f67eedd..746a54c 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -117,19 +117,19 @@ void show_boot_progress (int val)
 		status_led_set(2, STATUS_LED_ON);
 		break;
 #if 0
-		case 64:
-			/* starting Ethernet configuration */
-			status_led_set (0, STATUS_LED_OFF);
-			status_led_set (1, STATUS_LED_OFF);
-			status_led_set (2, STATUS_LED_ON);
-			break;
+	case BOOTSTAGE_ID_NET_ETH_START:
+		/* starting Ethernet configuration */
+		status_led_set(0, STATUS_LED_OFF);
+		status_led_set(1, STATUS_LED_OFF);
+		status_led_set(2, STATUS_LED_ON);
+		break;
 #endif
-		case 80:
-			/* loading Image */
-			status_led_set (0, STATUS_LED_ON);
-			status_led_set (1, STATUS_LED_OFF);
-			status_led_set (2, STATUS_LED_ON);
-			break;
+	case BOOTSTAGE_ID_NET_START:
+		/* loading Image */
+		status_led_set(0, STATUS_LED_ON);
+		status_led_set(1, STATUS_LED_OFF);
+		status_led_set(2, STATUS_LED_ON);
+		break;
 	}
 }
 #endif
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 6798b89..72595fd 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -227,36 +227,36 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 		break;
 #endif
 	default:
-		show_boot_error(80);
+		show_boot_error(BOOTSTAGE_ID_NET_START);
 		return cmd_usage(cmdtp);
 	}
 
-	show_boot_progress (80);
+	show_boot_progress(BOOTSTAGE_ID_NET_START);
 	if ((size = NetLoop(proto)) < 0) {
-		show_boot_error(81);
+		show_boot_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
 		return 1;
 	}
 
-	show_boot_progress (81);
+	show_boot_progress(BOOTSTAGE_ID_NET_NETLOOP_OK);
 	/* NetLoop ok, update environment */
 	netboot_update_env();
 
 	/* done if no file was loaded (no errors though) */
 	if (size == 0) {
-		show_boot_error(82);
+		show_boot_error(BOOTSTAGE_ID_NET_LOADED);
 		return 0;
 	}
 
 	/* flush cache */
 	flush_cache(load_addr, size);
 
-	show_boot_progress(82);
+	show_boot_progress(BOOTSTAGE_ID_NET_LOADED);
 	rcode = bootm_maybe_autostart(cmdtp, argv[0]);
 
 	if (rcode < 0)
-		show_boot_error(83);
+		show_boot_error(BOOTSTAGE_ID_NET_DONE_ERR);
 	else
-		show_boot_progress (84);
+		show_boot_progress(BOOTSTAGE_ID_NET_DONE);
 	return rcode;
 }
 
diff --git a/common/env_common.c b/common/env_common.c
index 4060c63..bb33220 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -221,7 +221,7 @@ void env_relocate(void)
 #if defined(CONFIG_ENV_IS_NOWHERE)	/* Environment not changable */
 		set_default_env(NULL);
 #else
-		show_boot_error(60);
+		show_boot_error(BOOTSTAGE_ID_NET_CHECKSUM);
 		set_default_env("!bad CRC");
 #endif
 	} else {
diff --git a/include/bootstage.h b/include/bootstage.h
index 6e0cb39..474de21 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -117,6 +117,17 @@ enum bootstage_id {
 	BOOTSTAGE_ID_NAND_TYPE = 57,
 	BOOTSTAGE_ID_NAND_READ,
 
+	/* Boot stages related to loading a kernel from an network device */
+	BOOTSTAGE_ID_NET_CHECKSUM = 60,
+	BOOTSTAGE_ID_NET_ETH_START = 64,
+	BOOTSTAGE_ID_NET_ETH_INIT,
+
+	BOOTSTAGE_ID_NET_START = 80,
+	BOOTSTAGE_ID_NET_NETLOOP_OK,
+	BOOTSTAGE_ID_NET_LOADED,
+	BOOTSTAGE_ID_NET_DONE_ERR,
+	BOOTSTAGE_ID_NET_DONE,
+
 	BOOTSTAGE_ID_IDE_FIT_READ = 140,
 	BOOTSTAGE_ID_IDE_FIT_READ_OK,
 
diff --git a/net/eth.c b/net/eth.c
index e9a0f46..07e7534 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -244,7 +244,7 @@ int eth_initialize(bd_t *bis)
 	eth_devices = NULL;
 	eth_current = NULL;
 
-	show_boot_progress (64);
+	show_boot_progress(BOOTSTAGE_ID_NET_ETH_START);
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
 	miiphy_init();
 #endif
@@ -274,12 +274,12 @@ int eth_initialize(bd_t *bis)
 #endif
 	if (!eth_devices) {
 		puts ("No ethernet found.\n");
-		show_boot_error(64);
+		show_boot_error(BOOTSTAGE_ID_NET_ETH_START);
 	} else {
 		struct eth_device *dev = eth_devices;
 		char *ethprime = getenv ("ethprime");
 
-		show_boot_progress (65);
+		show_boot_progress(BOOTSTAGE_ID_NET_ETH_INIT);
 		do {
 			if (eth_number)
 				puts (", ");
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 10/15] bootstage: Convert FIT progress numbers to enums
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (8 preceding siblings ...)
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 09/15] bootstage: Convert net " Simon Glass
@ 2011-12-10 21:08 ` Simon Glass
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer Simon Glass
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:08 UTC (permalink / raw)
  To: u-boot

This changes over all the FIT image progress numbers to use enums
from bootstage.h.

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

 common/cmd_bootm.c  |   44 ++++++++++++++++++++++----------------------
 common/image.c      |   36 ++++++++++++++++++++----------------
 include/bootstage.h |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 38 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 9ab1c61..44a9ded 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -222,21 +222,21 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 		if (fit_image_get_type(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.type)) {
 			puts("Can't get image type!\n");
-			show_boot_error(109);
+			show_boot_error(BOOTSTAGE_ID_FIT_TYPE);
 			return 1;
 		}
 
 		if (fit_image_get_comp(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.comp)) {
 			puts("Can't get image compression!\n");
-			show_boot_error(110);
+			show_boot_error(BOOTSTAGE_ID_FIT_COMPRESSION);
 			return 1;
 		}
 
 		if (fit_image_get_os(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.os)) {
 			puts("Can't get image OS!\n");
-			show_boot_error(111);
+			show_boot_error(BOOTSTAGE_ID_FIT_OS);
 			return 1;
 		}
 
@@ -245,7 +245,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 		if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
 					&images.os.load)) {
 			puts("Can't get image load address!\n");
-			show_boot_error(112);
+			show_boot_error(BOOTSTAGE_ID_FIT_LOADADDR);
 			return 1;
 		}
 		break;
@@ -648,7 +648,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			} else {
 				puts("ERROR: new format image overwritten - "
 					"must RESET the board to recover\n");
-				show_boot_error(113);
+				show_boot_error(BOOTSTAGE_ID_OVERWRITTEN);
 				do_reset(cmdtp, flag, argc, argv);
 			}
 		}
@@ -789,28 +789,28 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
 		puts("   Verifying Hash Integrity ... ");
 		if (!fit_image_check_hashes(fit, os_noffset)) {
 			puts("Bad Data Hash\n");
-			show_boot_error(104);
+			show_boot_error(BOOTSTAGE_ID_FIT_CHECK_HASH);
 			return 0;
 		}
 		puts("OK\n");
 	}
-	show_boot_progress(105);
+	show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_ARCH);
 
 	if (!fit_image_check_target_arch(fit, os_noffset)) {
 		puts("Unsupported Architecture\n");
-		show_boot_error(105);
+		show_boot_error(BOOTSTAGE_ID_FIT_CHECK_ARCH);
 		return 0;
 	}
 
-	show_boot_progress(106);
+	show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
 	if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) &&
 	    !fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
 		puts("Not a kernel image\n");
-		show_boot_error(106);
+		show_boot_error(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
 		return 0;
 	}
 
-	show_boot_progress(107);
+	show_boot_progress(BOOTSTAGE_ID_FIT_CHECKED);
 	return 1;
 }
 #endif /* CONFIG_FIT */
@@ -921,10 +921,10 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 
 		if (!fit_check_format(fit_hdr)) {
 			puts("Bad FIT kernel image format!\n");
-			show_boot_error(100);
+			show_boot_error(BOOTSTAGE_ID_FIT_FORMAT);
 			return NULL;
 		}
-		show_boot_progress(100);
+		show_boot_progress(BOOTSTAGE_ID_FIT_FORMAT);
 
 		if (!fit_uname_kernel) {
 			/*
@@ -933,11 +933,11 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 			 * fit_conf_get_node() will try to find default config
 			 * node
 			 */
-			show_boot_progress(101);
+			show_boot_progress(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);
 			cfg_noffset = fit_conf_get_node(fit_hdr,
 							fit_uname_config);
 			if (cfg_noffset < 0) {
-				show_boot_error(101);
+				show_boot_error(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);
 				return NULL;
 			}
 			/* save configuration uname provided in the first
@@ -948,7 +948,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 								NULL);
 			printf("   Using '%s' configuration\n",
 				images->fit_uname_cfg);
-			show_boot_progress(103);
+			show_boot_progress(BOOTSTAGE_ID_FIT_CONFIG);
 
 			os_noffset = fit_conf_get_kernel_node(fit_hdr,
 								cfg_noffset);
@@ -956,28 +956,28 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 							NULL);
 		} else {
 			/* get kernel component image node offset */
-			show_boot_progress(102);
+			show_boot_progress(BOOTSTAGE_ID_FIT_UNIT_NAME);
 			os_noffset = fit_image_get_node(fit_hdr,
 							fit_uname_kernel);
 		}
 		if (os_noffset < 0) {
-			show_boot_error(103);
+			show_boot_error(BOOTSTAGE_ID_FIT_CONFIG);
 			return NULL;
 		}
 
 		printf("   Trying '%s' kernel subimage\n", fit_uname_kernel);
 
-		show_boot_progress(104);
+		show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_SUBIMAGE);
 		if (!fit_check_kernel(fit_hdr, os_noffset, images->verify))
 			return NULL;
 
 		/* get kernel image data address and length */
 		if (fit_image_get_data(fit_hdr, os_noffset, &data, &len)) {
 			puts("Could not find kernel subimage data!\n");
-			show_boot_error(107);
+			show_boot_error(BOOTSTAGE_ID_FIT_KERNEL_INFO_ERR);
 			return NULL;
 		}
-		show_boot_progress(108);
+		show_boot_progress(BOOTSTAGE_ID_FIT_KERNEL_INFO);
 
 		*os_len = len;
 		*os_data = (ulong)data;
@@ -988,7 +988,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 #endif
 	default:
 		printf("Wrong Image Format for %s command\n", cmdtp->name);
-		show_boot_error(108);
+		show_boot_error(BOOTSTAGE_ID_FIT_KERNEL_INFO);
 		return NULL;
 	}
 
diff --git a/common/image.c b/common/image.c
index 20f3f82..d569070 100644
--- a/common/image.c
+++ b/common/image.c
@@ -911,13 +911,14 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			printf("## Loading init Ramdisk from FIT "
 					"Image at %08lx ...\n", rd_addr);
 
-			show_boot_progress(120);
+			show_boot_progress(BOOTSTAGE_ID_FIT_RD_FORMAT);
 			if (!fit_check_format(fit_hdr)) {
 				puts("Bad FIT ramdisk image format!\n");
-				show_boot_error(120);
+				show_boot_error(
+					BOOTSTAGE_ID_FIT_RD_FORMAT);
 				return 1;
 			}
-			show_boot_progress(121);
+			show_boot_progress(BOOTSTAGE_ID_FIT_RD_FORMAT_OK);
 
 			if (!fit_uname_ramdisk) {
 				/*
@@ -925,13 +926,15 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 				 * node first. If config unit node name is NULL
 				 * fit_conf_get_node() will try to find default config node
 				 */
-				show_boot_progress(122);
+				show_boot_progress(
+					BOOTSTAGE_ID_FIT_RD_NO_UNIT_NAME);
 				cfg_noffset = fit_conf_get_node(fit_hdr,
 							fit_uname_config);
 				if (cfg_noffset < 0) {
 					puts("Could not find configuration "
 						"node\n");
-					show_boot_error(122);
+					show_boot_error(
+					BOOTSTAGE_ID_FIT_RD_NO_UNIT_NAME);
 					return 1;
 				}
 				fit_uname_config = fdt_get_name(fit_hdr,
@@ -945,20 +948,21 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 							rd_noffset, NULL);
 			} else {
 				/* get ramdisk component image node offset */
-				show_boot_progress(123);
+				show_boot_progress(
+					BOOTSTAGE_ID_FIT_RD_UNIT_NAME);
 				rd_noffset = fit_image_get_node(fit_hdr,
 						fit_uname_ramdisk);
 			}
 			if (rd_noffset < 0) {
 				puts("Could not find subimage node\n");
-				show_boot_error(124);
+				show_boot_error(BOOTSTAGE_ID_FIT_RD_SUBNODE);
 				return 1;
 			}
 
 			printf("   Trying '%s' ramdisk subimage\n",
 				fit_uname_ramdisk);
 
-			show_boot_progress(125);
+			show_boot_progress(BOOTSTAGE_ID_FIT_RD_CHECK);
 			if (!fit_check_ramdisk(fit_hdr, rd_noffset, arch,
 						images->verify))
 				return 1;
@@ -967,10 +971,10 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			if (fit_image_get_data(fit_hdr, rd_noffset, &data,
 						&size)) {
 				puts("Could not find ramdisk subimage data!\n");
-				show_boot_error(127);
+				show_boot_error(BOOTSTAGE_ID_FIT_RD_GET_DATA);
 				return 1;
 			}
-			show_boot_progress(128);
+			show_boot_progress(BOOTSTAGE_ID_FIT_RD_GET_DATA_OK);
 
 			rd_data = (ulong)data;
 			rd_len = size;
@@ -978,10 +982,10 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			if (fit_image_get_load(fit_hdr, rd_noffset, &rd_load)) {
 				puts("Can't get ramdisk subimage load "
 					"address!\n");
-				show_boot_error(129);
+				show_boot_error(BOOTSTAGE_ID_FIT_RD_LOAD);
 				return 1;
 			}
-			show_boot_progress(129);
+			show_boot_progress(BOOTSTAGE_ID_FIT_RD_LOAD);
 
 			images->fit_hdr_rd = fit_hdr;
 			images->fit_uname_rd = fit_uname_ramdisk;
@@ -3162,23 +3166,23 @@ static int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
 		puts("   Verifying Hash Integrity ... ");
 		if (!fit_image_check_hashes(fit, rd_noffset)) {
 			puts("Bad Data Hash\n");
-			show_boot_error(125);
+			show_boot_error(BOOTSTAGE_ID_FIT_RD_HASH);
 			return 0;
 		}
 		puts("OK\n");
 	}
 
-	show_boot_progress(126);
+	show_boot_progress(BOOTSTAGE_ID_FIT_RD_CHECK_ALL);
 	if (!fit_image_check_os(fit, rd_noffset, IH_OS_LINUX) ||
 	    !fit_image_check_arch(fit, rd_noffset, arch) ||
 	    !fit_image_check_type(fit, rd_noffset, IH_TYPE_RAMDISK)) {
 		printf("No Linux %s Ramdisk Image\n",
 				genimg_get_arch_name(arch));
-		show_boot_error(126);
+		show_boot_error(BOOTSTAGE_ID_FIT_RD_CHECK_ALL);
 		return 0;
 	}
 
-	show_boot_progress(127);
+	show_boot_progress(BOOTSTAGE_ID_FIT_RD_CHECK_ALL_OK);
 	return 1;
 }
 #endif /* USE_HOSTCC */
diff --git a/include/bootstage.h b/include/bootstage.h
index 474de21..882af20 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -128,6 +128,44 @@ enum bootstage_id {
 	BOOTSTAGE_ID_NET_DONE_ERR,
 	BOOTSTAGE_ID_NET_DONE,
 
+	/*
+	 * Boot stages related to loading a FIT image. Some of these are a
+	 * bit wonky.
+	 */
+	BOOTSTAGE_ID_FIT_FORMAT = 100,
+	BOOTSTAGE_ID_FIT_NO_UNIT_NAME,
+	BOOTSTAGE_ID_FIT_UNIT_NAME,
+	BOOTSTAGE_ID_FIT_CONFIG,
+	BOOTSTAGE_ID_FIT_CHECK_SUBIMAGE,
+	BOOTSTAGE_ID_FIT_CHECK_HASH = 104,
+
+	BOOTSTAGE_ID_FIT_CHECK_ARCH,
+	BOOTSTAGE_ID_FIT_CHECK_KERNEL,
+	BOOTSTAGE_ID_FIT_CHECKED,
+
+	BOOTSTAGE_ID_FIT_KERNEL_INFO_ERR = 107,
+	BOOTSTAGE_ID_FIT_KERNEL_INFO,
+	BOOTSTAGE_ID_FIT_TYPE,
+
+	BOOTSTAGE_ID_FIT_COMPRESSION,
+	BOOTSTAGE_ID_FIT_OS,
+	BOOTSTAGE_ID_FIT_LOADADDR,
+	BOOTSTAGE_ID_OVERWRITTEN,
+
+	BOOTSTAGE_ID_FIT_RD_FORMAT = 120,
+	BOOTSTAGE_ID_FIT_RD_FORMAT_OK,
+	BOOTSTAGE_ID_FIT_RD_NO_UNIT_NAME,
+	BOOTSTAGE_ID_FIT_RD_UNIT_NAME,
+	BOOTSTAGE_ID_FIT_RD_SUBNODE,
+
+	BOOTSTAGE_ID_FIT_RD_CHECK,
+	BOOTSTAGE_ID_FIT_RD_HASH = 125,
+	BOOTSTAGE_ID_FIT_RD_CHECK_ALL,
+	BOOTSTAGE_ID_FIT_RD_GET_DATA,
+	BOOTSTAGE_ID_FIT_RD_CHECK_ALL_OK = 127,
+	BOOTSTAGE_ID_FIT_RD_GET_DATA_OK,
+	BOOTSTAGE_ID_FIT_RD_LOAD,
+
 	BOOTSTAGE_ID_IDE_FIT_READ = 140,
 	BOOTSTAGE_ID_IDE_FIT_READ_OK,
 
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (9 preceding siblings ...)
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 10/15] bootstage: Convert FIT " Simon Glass
@ 2011-12-10 21:08 ` Simon Glass
  2012-01-08  8:30   ` Mike Frysinger
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Simon Glass
                   ` (4 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:08 UTC (permalink / raw)
  To: u-boot

Define timer_get_boot_us() which returns the number of microseconds
since boot. If undefined then we use get_timer() * 1000.

We can fit this in a 32-bit register which keeps everyone happy on
the efficiency side. It will wrap around after about an hour. If we
are still looking at it after an hour then we had better not be
timing the boot.

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

 include/common.h |    7 +++++++
 lib/time.c       |   17 +++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/common.h b/include/common.h
index e918ca0..af41c8f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -207,6 +207,13 @@ typedef void (interrupt_handler_t)(void *);
 #endif /* CONFIG_SERIAL_MULTI */
 
 /*
+ * Return the time since boot in microseconds, This is needed for bootstage
+ * and should be defined in CPU- or board-specific code. If undefined then
+ * millisecond resolution will be used (the standard get_timer()).
+ */
+ulong timer_get_boot_us(void);
+
+/*
  * General Purpose Utilities
  */
 #define min(X, Y)				\
diff --git a/lib/time.c b/lib/time.c
index 6e2937b..69edc3d 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -47,3 +47,20 @@ void mdelay(unsigned long msec)
 	while (msec--)
 		udelay(1000);
 }
+
+ulong __timer_get_boot_us(void)
+{
+	static ulong base_time;
+
+	/*
+	 * We can't implement this properly. Return 0 on the first call and
+	 * larger values after that.
+	 */
+	if (base_time)
+		return get_timer(base_time) * 1000;
+	base_time = get_timer(0);
+	return 0;
+}
+
+ulong timer_get_boot_us(void)
+	__attribute__((weak, alias("__timer_get_boot_us")));
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...()
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (10 preceding siblings ...)
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer Simon Glass
@ 2011-12-10 21:08 ` Simon Glass
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement Simon Glass
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:08 UTC (permalink / raw)
  To: u-boot

These calls should not be made directly any more, since bootstage
will call the show_boot_...() functions as needed.

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

 arch/arm/lib/bootm.c                   |    2 +-
 arch/avr32/lib/bootm.c                 |    2 +-
 arch/m68k/lib/bootm.c                  |    2 +-
 arch/microblaze/lib/bootm.c            |    2 +-
 arch/mips/lib/bootm.c                  |    2 +-
 arch/mips/lib/bootm_qemu_mips.c        |    2 +-
 arch/nds32/lib/bootm.c                 |    2 +-
 arch/powerpc/lib/board.c               |    2 +-
 arch/powerpc/lib/bootm.c               |    2 +-
 arch/sparc/lib/board.c                 |    2 +-
 arch/x86/lib/board.c                   |   19 +++----
 board/hermes/hermes.c                  |    2 +-
 board/matrix_vision/common/mv_common.c |    2 +-
 board/scb9328/scb9328.c                |    6 --
 common/cmd_bootm.c                     |   92 ++++++++++++++++----------------
 common/cmd_ide.c                       |   46 ++++++++--------
 common/cmd_nand.c                      |   34 ++++++------
 common/cmd_net.c                       |   16 +++---
 common/env_common.c                    |    2 +-
 common/image.c                         |   52 +++++++++---------
 net/eth.c                              |    6 +-
 post/post.c                            |    4 +-
 22 files changed, 147 insertions(+), 154 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 2751f44..c400a50 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -113,7 +113,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 		printf ("Using machid 0x%x from environment\n", machid);
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef CONFIG_OF_LIBFDT
 	if (images->ft_len)
diff --git a/arch/avr32/lib/bootm.c b/arch/avr32/lib/bootm.c
index f180737..74ebeca 100644
--- a/arch/avr32/lib/bootm.c
+++ b/arch/avr32/lib/bootm.c
@@ -192,7 +192,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 
 	theKernel = (void *)images->ep;
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	params = params_start = (struct tag *)gd->bd->bi_boot_params;
 	params = setup_start_tag(params);
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 233782b..d506d0c 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -104,7 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	debug("## Transferring control to Linux (at address %08lx) ...\n",
 	      (ulong) kernel);
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * Linux Kernel Parameters (passing board info data):
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 24b9e09..95cee50 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -59,7 +59,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	if (ret)
 		return 1;
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	if (!of_flat_tree && argc > 3)
 		of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16);
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 5b7e74f..9930abf 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -56,7 +56,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	/* find kernel entry point */
 	theKernel = (void (*)(int, char **, char **, int *))images->ep;
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef DEBUG
 	printf ("## Transferring control to Linux (at address %08lx) ...\n",
diff --git a/arch/mips/lib/bootm_qemu_mips.c b/arch/mips/lib/bootm_qemu_mips.c
index 47f5310..bb6442a 100644
--- a/arch/mips/lib/bootm_qemu_mips.c
+++ b/arch/mips/lib/bootm_qemu_mips.c
@@ -39,7 +39,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	/* find kernel entry point */
 	theKernel = (void (*)(int, char **, char **, int *))images->ep;
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong) theKernel);
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index 5ae90fb..03f58bf 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -69,7 +69,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 		printf("Using machid 0x%x from environment\n", machid);
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	debug("## Transferring control to Linux (at address %08lx) ...\n",
 	       (ulong)theKernel);
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 837c82d..fc63b2c 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(BOOTSTAGE_ID_NEED_RESET);
+	bootstage_error(BOOTSTAGE_ID_NEED_RESET);
 	for (;;)
 		;
 }
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index e448f6c..32292a4 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -69,7 +69,7 @@ static void boot_jump_linux(bootm_headers_t *images)
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong)kernel);
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && !defined(CONFIG_E500)
 	unlock_ram_in_cache();
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
index 770136b..c0d2608 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(BOOTSTAGE_ID_NEED_RESET);
+	bootstage_error(BOOTSTAGE_ID_NEED_RESET);
 #endif
 	for (;;) ;
 }
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 1f677cc..4c117a3 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(BOOTSTAGE_ID_BOARD_INIT_R);
+	bootstage_mark(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(BOOTSTAGE_ID_BOARD_GLOBAL_DATA);
+	bootstage_mark(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(BOOTSTAGE_ID_BOARD_INIT_SEQ);
+	bootstage_mark(BOOTSTAGE_ID_BOARD_INIT_SEQ);
 
 #ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
@@ -312,15 +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(BOOTSTAGE_ID_BOARD_FLASH);
+	bootstage_mark(BOOTSTAGE_ID_BOARD_FLASH);
 #endif
 
-	show_boot_progress(BOOTSTAGE_ID_BOARD_FLASH_37);
+	bootstage_mark(BOOTSTAGE_ID_BOARD_FLASH_37);
 
 	/* initialize environment */
 	env_relocate();
-	show_boot_progress(BOOTSTAGE_ID_BOARD_ENV);
-
+	bootstage_mark(BOOTSTAGE_ID_BOARD_ENV);
 
 #ifdef CONFIG_CMD_NET
 	/* IP Address */
@@ -334,7 +333,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	pci_init();
 #endif
 
-	show_boot_progress(BOOTSTAGE_ID_BOARD_PCI);
+	bootstage_mark(BOOTSTAGE_ID_BOARD_PCI);
 
 
 	stdio_init();
@@ -363,7 +362,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	/* enable exceptions */
 	enable_interrupts();
-	show_boot_progress(BOOTSTAGE_ID_BOARD_INTERRUPTS);
+	bootstage_mark(BOOTSTAGE_ID_BOARD_INTERRUPTS);
 
 #ifdef CONFIG_STATUS_LED
 	status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
@@ -432,7 +431,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
-	show_boot_progress(BOOTSTAGE_ID_BOARD_DONE);
+	bootstage_mark(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 38bab03..a3bf4bb 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -27,7 +27,7 @@
 
 #ifdef CONFIG_SHOW_BOOT_PROGRESS
 # include <status_led.h>
-# define SHOW_BOOT_PROGRESS(arg)	show_boot_progress(arg)
+# define SHOW_BOOT_PROGRESS(arg)	bootstage_mark(arg)
 #else
 # define SHOW_BOOT_PROGRESS(arg)
 #endif
diff --git a/board/matrix_vision/common/mv_common.c b/board/matrix_vision/common/mv_common.c
index 7fde4ac..b9330f9 100644
--- a/board/matrix_vision/common/mv_common.c
+++ b/board/matrix_vision/common/mv_common.c
@@ -95,7 +95,7 @@ int mv_load_fpga(void)
 
 	result = fpga_load(0, fpga_data, data_size);
 	if (!result)
-		show_boot_progress(BOOTSTAGE_ID_START);
+		bootstage_mark(BOOTSTAGE_ID_START);
 
 	return result;
 }
diff --git a/board/scb9328/scb9328.c b/board/scb9328/scb9328.c
index 076c046..1ec2044 100644
--- a/board/scb9328/scb9328.c
+++ b/board/scb9328/scb9328.c
@@ -23,12 +23,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
-# define SHOW_BOOT_PROGRESS(arg)        show_boot_progress(arg)
-#else
-# define SHOW_BOOT_PROGRESS(arg)
-#endif
-
 int board_init (void)
 {
 	gd->bd->bi_arch_number = MACH_TYPE_SCB9328;
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 44a9ded..7e780fb 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -222,21 +222,21 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 		if (fit_image_get_type(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.type)) {
 			puts("Can't get image type!\n");
-			show_boot_error(BOOTSTAGE_ID_FIT_TYPE);
+			bootstage_error(BOOTSTAGE_ID_FIT_TYPE);
 			return 1;
 		}
 
 		if (fit_image_get_comp(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.comp)) {
 			puts("Can't get image compression!\n");
-			show_boot_error(BOOTSTAGE_ID_FIT_COMPRESSION);
+			bootstage_error(BOOTSTAGE_ID_FIT_COMPRESSION);
 			return 1;
 		}
 
 		if (fit_image_get_os(images.fit_hdr_os,
 					images.fit_noffset_os, &images.os.os)) {
 			puts("Can't get image OS!\n");
-			show_boot_error(BOOTSTAGE_ID_FIT_OS);
+			bootstage_error(BOOTSTAGE_ID_FIT_OS);
 			return 1;
 		}
 
@@ -245,7 +245,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 		if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
 					&images.os.load)) {
 			puts("Can't get image load address!\n");
-			show_boot_error(BOOTSTAGE_ID_FIT_LOADADDR);
+			bootstage_error(BOOTSTAGE_ID_FIT_LOADADDR);
 			return 1;
 		}
 		break;
@@ -348,7 +348,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			puts("GUNZIP: uncompress, out-of-mem or overwrite "
 				"error - must RESET board to recover\n");
 			if (boot_progress)
-				show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
+				bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -370,7 +370,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			printf("BUNZIP2: uncompress or overwrite error %d "
 				"- must RESET board to recover\n", i);
 			if (boot_progress)
-				show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
+				bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -389,7 +389,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 		if (ret != SZ_OK) {
 			printf("LZMA: uncompress or overwrite error %d "
 				"- must RESET board to recover\n", ret);
-			show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
+			bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 			return BOOTM_ERR_RESET;
 		}
 		*load_end = load + unc_len;
@@ -407,7 +407,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 			printf("LZO: uncompress or overwrite error %d "
 			      "- must RESET board to recover\n", ret);
 			if (boot_progress)
-				show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
+				bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 			return BOOTM_ERR_RESET;
 		}
 
@@ -423,7 +423,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 
 	puts("OK\n");
 	debug("   kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end);
-	show_boot_progress(BOOTSTAGE_ID_KERNEL_LOADED);
+	bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);
 
 	if (!no_overlap && (load < blob_end) && (*load_end > blob_start)) {
 		debug("images.os.start = 0x%lX, images.os.end = 0x%lx\n",
@@ -648,14 +648,14 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			} else {
 				puts("ERROR: new format image overwritten - "
 					"must RESET the board to recover\n");
-				show_boot_error(BOOTSTAGE_ID_OVERWRITTEN);
+				bootstage_error(BOOTSTAGE_ID_OVERWRITTEN);
 				do_reset(cmdtp, flag, argc, argv);
 			}
 		}
 		if (ret == BOOTM_ERR_UNIMPLEMENTED) {
 			if (iflag)
 				enable_interrupts();
-			show_boot_error(BOOTSTAGE_ID_DECOMP_UNIMPL);
+			bootstage_error(BOOTSTAGE_ID_DECOMP_UNIMPL);
 			return 1;
 		}
 	}
@@ -670,7 +670,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 0;
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_CHECK_BOOT_OS);
+	bootstage_mark(BOOTSTAGE_ID_CHECK_BOOT_OS);
 
 #ifdef CONFIG_SILENT_CONSOLE
 	if (images.os.os == IH_OS_LINUX)
@@ -684,7 +684,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			enable_interrupts();
 		printf("ERROR: booting os '%s' (%d) is not supported\n",
 			genimg_get_os_name(images.os.os), images.os.os);
-		show_boot_error(BOOTSTAGE_ID_CHECK_BOOT_OS);
+		bootstage_error(BOOTSTAGE_ID_CHECK_BOOT_OS);
 		return 1;
 	}
 
@@ -692,7 +692,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	boot_fn(0, argc, argv, &images);
 
-	show_boot_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);
+	bootstage_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);
 #ifdef DEBUG
 	puts("\n## Control returned to monitor - resetting...\n");
 #endif
@@ -734,34 +734,34 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
 
 	if (!image_check_magic(hdr)) {
 		puts("Bad Magic Number\n");
-		show_boot_error(BOOTSTAGE_ID_CHECK_MAGIC);
+		bootstage_error(BOOTSTAGE_ID_CHECK_MAGIC);
 		return NULL;
 	}
-	show_boot_progress(BOOTSTAGE_ID_CHECK_HEADER);
+	bootstage_mark(BOOTSTAGE_ID_CHECK_HEADER);
 
 	if (!image_check_hcrc(hdr)) {
 		puts("Bad Header Checksum\n");
-		show_boot_error(BOOTSTAGE_ID_CHECK_HEADER);
+		bootstage_error(BOOTSTAGE_ID_CHECK_HEADER);
 		return NULL;
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_CHECK_CHECKSUM);
+	bootstage_mark(BOOTSTAGE_ID_CHECK_CHECKSUM);
 	image_print_contents(hdr);
 
 	if (verify) {
 		puts("   Verifying Checksum ... ");
 		if (!image_check_dcrc(hdr)) {
 			printf("Bad Data CRC\n");
-			show_boot_error(BOOTSTAGE_ID_CHECK_CHECKSUM);
+			bootstage_error(BOOTSTAGE_ID_CHECK_CHECKSUM);
 			return NULL;
 		}
 		puts("OK\n");
 	}
-	show_boot_progress(BOOTSTAGE_ID_CHECK_ARCH);
+	bootstage_mark(BOOTSTAGE_ID_CHECK_ARCH);
 
 	if (!image_check_target_arch(hdr)) {
 		printf("Unsupported Architecture 0x%x\n", image_get_arch(hdr));
-		show_boot_error(BOOTSTAGE_ID_CHECK_ARCH);
+		bootstage_error(BOOTSTAGE_ID_CHECK_ARCH);
 		return NULL;
 	}
 	return hdr;
@@ -789,28 +789,28 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
 		puts("   Verifying Hash Integrity ... ");
 		if (!fit_image_check_hashes(fit, os_noffset)) {
 			puts("Bad Data Hash\n");
-			show_boot_error(BOOTSTAGE_ID_FIT_CHECK_HASH);
+			bootstage_error(BOOTSTAGE_ID_FIT_CHECK_HASH);
 			return 0;
 		}
 		puts("OK\n");
 	}
-	show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_ARCH);
+	bootstage_mark(BOOTSTAGE_ID_FIT_CHECK_ARCH);
 
 	if (!fit_image_check_target_arch(fit, os_noffset)) {
 		puts("Unsupported Architecture\n");
-		show_boot_error(BOOTSTAGE_ID_FIT_CHECK_ARCH);
+		bootstage_error(BOOTSTAGE_ID_FIT_CHECK_ARCH);
 		return 0;
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
+	bootstage_mark(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
 	if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) &&
 	    !fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
 		puts("Not a kernel image\n");
-		show_boot_error(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
+		bootstage_error(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
 		return 0;
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_FIT_CHECKED);
+	bootstage_mark(BOOTSTAGE_ID_FIT_CHECKED);
 	return 1;
 }
 #endif /* CONFIG_FIT */
@@ -863,7 +863,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		debug("*  kernel: cmdline image address = 0x%08lx\n", img_addr);
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_CHECK_MAGIC);
+	bootstage_mark(BOOTSTAGE_ID_CHECK_MAGIC);
 
 	/* copy from dataflash if needed */
 	img_addr = genimg_get_image(img_addr);
@@ -877,7 +877,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		hdr = image_get_kernel(img_addr, images->verify);
 		if (!hdr)
 			return NULL;
-		show_boot_progress(BOOTSTAGE_ID_CHECK_IMAGETYPE);
+		bootstage_mark(BOOTSTAGE_ID_CHECK_IMAGETYPE);
 
 		/* get os_data and os_len */
 		switch (image_get_type(hdr)) {
@@ -896,7 +896,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		default:
 			printf("Wrong Image Type for %s command\n",
 				cmdtp->name);
-			show_boot_error(BOOTSTAGE_ID_CHECK_IMAGETYPE);
+			bootstage_error(BOOTSTAGE_ID_CHECK_IMAGETYPE);
 			return NULL;
 		}
 
@@ -911,7 +911,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 		images->legacy_hdr_os = hdr;
 
 		images->legacy_hdr_valid = 1;
-		show_boot_progress(BOOTSTAGE_ID_DECOMP_IMAGE);
+		bootstage_mark(BOOTSTAGE_ID_DECOMP_IMAGE);
 		break;
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
@@ -921,10 +921,10 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 
 		if (!fit_check_format(fit_hdr)) {
 			puts("Bad FIT kernel image format!\n");
-			show_boot_error(BOOTSTAGE_ID_FIT_FORMAT);
+			bootstage_error(BOOTSTAGE_ID_FIT_FORMAT);
 			return NULL;
 		}
-		show_boot_progress(BOOTSTAGE_ID_FIT_FORMAT);
+		bootstage_mark(BOOTSTAGE_ID_FIT_FORMAT);
 
 		if (!fit_uname_kernel) {
 			/*
@@ -933,11 +933,11 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 			 * fit_conf_get_node() will try to find default config
 			 * node
 			 */
-			show_boot_progress(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);
+			bootstage_mark(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);
 			cfg_noffset = fit_conf_get_node(fit_hdr,
 							fit_uname_config);
 			if (cfg_noffset < 0) {
-				show_boot_error(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);
+				bootstage_error(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);
 				return NULL;
 			}
 			/* save configuration uname provided in the first
@@ -948,7 +948,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 								NULL);
 			printf("   Using '%s' configuration\n",
 				images->fit_uname_cfg);
-			show_boot_progress(BOOTSTAGE_ID_FIT_CONFIG);
+			bootstage_mark(BOOTSTAGE_ID_FIT_CONFIG);
 
 			os_noffset = fit_conf_get_kernel_node(fit_hdr,
 								cfg_noffset);
@@ -956,28 +956,28 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 							NULL);
 		} else {
 			/* get kernel component image node offset */
-			show_boot_progress(BOOTSTAGE_ID_FIT_UNIT_NAME);
+			bootstage_mark(BOOTSTAGE_ID_FIT_UNIT_NAME);
 			os_noffset = fit_image_get_node(fit_hdr,
 							fit_uname_kernel);
 		}
 		if (os_noffset < 0) {
-			show_boot_error(BOOTSTAGE_ID_FIT_CONFIG);
+			bootstage_error(BOOTSTAGE_ID_FIT_CONFIG);
 			return NULL;
 		}
 
 		printf("   Trying '%s' kernel subimage\n", fit_uname_kernel);
 
-		show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_SUBIMAGE);
+		bootstage_mark(BOOTSTAGE_ID_FIT_CHECK_SUBIMAGE);
 		if (!fit_check_kernel(fit_hdr, os_noffset, images->verify))
 			return NULL;
 
 		/* get kernel image data address and length */
 		if (fit_image_get_data(fit_hdr, os_noffset, &data, &len)) {
 			puts("Could not find kernel subimage data!\n");
-			show_boot_error(BOOTSTAGE_ID_FIT_KERNEL_INFO_ERR);
+			bootstage_error(BOOTSTAGE_ID_FIT_KERNEL_INFO_ERR);
 			return NULL;
 		}
-		show_boot_progress(BOOTSTAGE_ID_FIT_KERNEL_INFO);
+		bootstage_mark(BOOTSTAGE_ID_FIT_KERNEL_INFO);
 
 		*os_len = len;
 		*os_data = (ulong)data;
@@ -988,7 +988,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 #endif
 	default:
 		printf("Wrong Image Format for %s command\n", cmdtp->name);
-		show_boot_error(BOOTSTAGE_ID_FIT_KERNEL_INFO);
+		bootstage_error(BOOTSTAGE_ID_FIT_KERNEL_INFO);
 		return NULL;
 	}
 
@@ -1339,7 +1339,7 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
 		"(at address %08lx) ...\n",
 		(ulong)loader);
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * NetBSD Stage-2 Loader Parameters:
@@ -1397,7 +1397,7 @@ static int do_bootm_rtems(int flag, int argc, char * const argv[],
 	printf("## Transferring control to RTEMS (at address %08lx) ...\n",
 		(ulong)entry_point);
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * RTEMS Parameters:
@@ -1430,7 +1430,7 @@ static int do_bootm_ose(int flag, int argc, char * const argv[],
 	printf("## Transferring control to OSE (at address %08lx) ...\n",
 		(ulong)entry_point);
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * OSE Parameters:
@@ -1511,7 +1511,7 @@ static int do_bootm_integrity(int flag, int argc, char * const argv[],
 	printf("## Transferring control to INTEGRITY (at address %08lx) ...\n",
 		(ulong)entry_point);
 
-	show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 	/*
 	 * INTEGRITY Parameters:
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 46fa7d4..b1aa50f 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -345,7 +345,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	const void *fit_hdr = NULL;
 #endif
 
-	show_boot_progress(BOOTSTAGE_ID_IDE_START);
+	bootstage_mark(BOOTSTAGE_ID_IDE_START);
 	switch (argc) {
 	case 1:
 		addr = CONFIG_SYS_LOAD_ADDR;
@@ -360,41 +360,41 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		boot_device = argv[2];
 		break;
 	default:
-		show_boot_error(BOOTSTAGE_ID_IDE_ADDR);
+		bootstage_error(BOOTSTAGE_ID_IDE_ADDR);
 		return cmd_usage(cmdtp);
 	}
-	show_boot_progress(BOOTSTAGE_ID_IDE_ADDR);
+	bootstage_mark(BOOTSTAGE_ID_IDE_ADDR);
 
 	if (!boot_device) {
 		puts("\n** No boot device **\n");
-		show_boot_error(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
+		bootstage_error(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
+	bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
 
 	dev = simple_strtoul(boot_device, &ep, 16);
 
 	if (ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN) {
 		printf("\n** Device %d not available\n", dev);
-		show_boot_error(BOOTSTAGE_ID_IDE_TYPE);
+		bootstage_error(BOOTSTAGE_ID_IDE_TYPE);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_IDE_TYPE);
+	bootstage_mark(BOOTSTAGE_ID_IDE_TYPE);
 
 	if (*ep) {
 		if (*ep != ':') {
 			puts("\n** Invalid boot device, use `dev[:part]' **\n");
-			show_boot_error(BOOTSTAGE_ID_IDE_PART);
+			bootstage_error(BOOTSTAGE_ID_IDE_PART);
 			return 1;
 		}
 		part = simple_strtoul(++ep, NULL, 16);
 	}
-	show_boot_progress(BOOTSTAGE_ID_IDE_PART);
+	bootstage_mark(BOOTSTAGE_ID_IDE_PART);
 	if (get_partition_info(&ide_dev_desc[dev], part, &info)) {
-		show_boot_error(BOOTSTAGE_ID_IDE_PART_INFO);
+		bootstage_error(BOOTSTAGE_ID_IDE_PART_INFO);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_IDE_PART_INFO);
+	bootstage_mark(BOOTSTAGE_ID_IDE_PART_INFO);
 	if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0)
 	    &&
 	    (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)
@@ -402,10 +402,10 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		printf("\n** Invalid partition type \"%.32s\"" " (expect \""
 			BOOT_PART_TYPE "\")\n",
 			info.type);
-		show_boot_error(BOOTSTAGE_ID_IDE_PART_TYPE);
+		bootstage_error(BOOTSTAGE_ID_IDE_PART_TYPE);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_IDE_PART_TYPE);
+	bootstage_mark(BOOTSTAGE_ID_IDE_PART_TYPE);
 
 	printf("\nLoading from IDE device %d, partition %d: "
 	       "Name: %.32s  Type: %.32s\n", dev, part, info.name, info.type);
@@ -416,23 +416,23 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (ide_dev_desc[dev].
 	    block_read(dev, info.start, 1, (ulong *) addr) != 1) {
 		printf("** Read error on %d:%d\n", dev, part);
-		show_boot_error(BOOTSTAGE_ID_IDE_PART_READ);
+		bootstage_error(BOOTSTAGE_ID_IDE_PART_READ);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_IDE_PART_READ);
+	bootstage_mark(BOOTSTAGE_ID_IDE_PART_READ);
 
 	switch (genimg_get_format((void *) addr)) {
 	case IMAGE_FORMAT_LEGACY:
 		hdr = (image_header_t *) addr;
 
-		show_boot_progress(BOOTSTAGE_ID_IDE_FORMAT);
+		bootstage_mark(BOOTSTAGE_ID_IDE_FORMAT);
 
 		if (!image_check_hcrc(hdr)) {
 			puts("\n** Bad Header Checksum **\n");
-			show_boot_error(BOOTSTAGE_ID_IDE_CHECKSUM);
+			bootstage_error(BOOTSTAGE_ID_IDE_CHECKSUM);
 			return 1;
 		}
-		show_boot_progress(BOOTSTAGE_ID_IDE_CHECKSUM);
+		bootstage_mark(BOOTSTAGE_ID_IDE_CHECKSUM);
 
 		image_print_contents(hdr);
 
@@ -447,7 +447,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		break;
 #endif
 	default:
-		show_boot_error(BOOTSTAGE_ID_IDE_FORMAT);
+		bootstage_error(BOOTSTAGE_ID_IDE_FORMAT);
 		puts("** Unknown image type\n");
 		return 1;
 	}
@@ -459,20 +459,20 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (ide_dev_desc[dev].block_read(dev, info.start + 1, cnt,
 					 (ulong *)(addr + info.blksz)) != cnt) {
 		printf("** Read error on %d:%d\n", dev, part);
-		show_boot_error(BOOTSTAGE_ID_IDE_READ);
+		bootstage_error(BOOTSTAGE_ID_IDE_READ);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_IDE_READ);
+	bootstage_mark(BOOTSTAGE_ID_IDE_READ);
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
 	if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) {
 		if (!fit_check_format(fit_hdr)) {
-			show_boot_error(BOOTSTAGE_ID_IDE_FIT_READ);
+			bootstage_error(BOOTSTAGE_ID_IDE_FIT_READ);
 			puts("** Bad FIT image format\n");
 			return 1;
 		}
-		show_boot_progress(BOOTSTAGE_ID_IDE_FIT_READ_OK);
+		bootstage_mark(BOOTSTAGE_ID_IDE_FIT_READ_OK);
 		fit_print_contents(fit_hdr);
 	}
 #endif
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 1cfa247..52d721e 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -787,7 +787,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	if (s != NULL &&
 	    (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {
 		printf("Unknown nand load suffix '%s'\n", s);
-		show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
+		bootstage_error(BOOTSTAGE_ID_NAND_SUFFIX);
 		return 1;
 	}
 
@@ -797,16 +797,16 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
 	if (r) {
 		puts("** Read error\n");
-		show_boot_error(BOOTSTAGE_ID_NAND_HDR_READ);
+		bootstage_error(BOOTSTAGE_ID_NAND_HDR_READ);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_NAND_HDR_READ);
+	bootstage_mark(BOOTSTAGE_ID_NAND_HDR_READ);
 
 	switch (genimg_get_format ((void *)addr)) {
 	case IMAGE_FORMAT_LEGACY:
 		hdr = (image_header_t *)addr;
 
-		show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
+		bootstage_mark(BOOTSTAGE_ID_NAND_TYPE);
 		image_print_contents (hdr);
 
 		cnt = image_get_image_size (hdr);
@@ -820,29 +820,29 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 		break;
 #endif
 	default:
-		show_boot_error(BOOTSTAGE_ID_NAND_TYPE);
+		bootstage_error(BOOTSTAGE_ID_NAND_TYPE);
 		puts ("** Unknown image type\n");
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
+	bootstage_mark(BOOTSTAGE_ID_NAND_TYPE);
 
 	r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
 	if (r) {
 		puts("** Read error\n");
-		show_boot_error(BOOTSTAGE_ID_NAND_READ);
+		bootstage_error(BOOTSTAGE_ID_NAND_READ);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_NAND_READ);
+	bootstage_mark(BOOTSTAGE_ID_NAND_READ);
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
 	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
 		if (!fit_check_format (fit_hdr)) {
-			show_boot_error(BOOTSTAGE_ID_NAND_FIT_READ);
+			bootstage_error(BOOTSTAGE_ID_NAND_FIT_READ);
 			puts ("** Bad FIT image format\n");
 			return 1;
 		}
-		show_boot_progress(BOOTSTAGE_ID_NAND_FIT_READ_OK);
+		bootstage_mark(BOOTSTAGE_ID_NAND_FIT_READ_OK);
 		fit_print_contents (fit_hdr);
 	}
 #endif
@@ -884,7 +884,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 	}
 #endif
 
-	show_boot_progress(BOOTSTAGE_ID_NAND_PART);
+	bootstage_mark(BOOTSTAGE_ID_NAND_PART);
 	switch (argc) {
 	case 1:
 		addr = CONFIG_SYS_LOAD_ADDR;
@@ -907,26 +907,26 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 #if defined(CONFIG_CMD_MTDPARTS)
 usage:
 #endif
-		show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
+		bootstage_error(BOOTSTAGE_ID_NAND_SUFFIX);
 		return cmd_usage(cmdtp);
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_NAND_SUFFIX);
+	bootstage_mark(BOOTSTAGE_ID_NAND_SUFFIX);
 	if (!boot_device) {
 		puts("\n** No boot device **\n");
-		show_boot_error(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
+		bootstage_error(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
+	bootstage_mark(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
 
 	idx = simple_strtoul(boot_device, NULL, 16);
 
 	if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) {
 		printf("\n** Device %d not available\n", idx);
-		show_boot_error(BOOTSTAGE_ID_NAND_AVAILABLE);
+		bootstage_error(BOOTSTAGE_ID_NAND_AVAILABLE);
 		return 1;
 	}
-	show_boot_progress(BOOTSTAGE_ID_NAND_AVAILABLE);
+	bootstage_mark(BOOTSTAGE_ID_NAND_AVAILABLE);
 
 	return nand_load_image(cmdtp, &nand_info[idx], offset, addr, argv[0]);
 }
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 72595fd..71b5b20 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -227,36 +227,36 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 		break;
 #endif
 	default:
-		show_boot_error(BOOTSTAGE_ID_NET_START);
+		bootstage_error(BOOTSTAGE_ID_NET_START);
 		return cmd_usage(cmdtp);
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_NET_START);
+	bootstage_mark(BOOTSTAGE_ID_NET_START);
 	if ((size = NetLoop(proto)) < 0) {
-		show_boot_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
+		bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
 		return 1;
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_NET_NETLOOP_OK);
+	bootstage_mark(BOOTSTAGE_ID_NET_NETLOOP_OK);
 	/* NetLoop ok, update environment */
 	netboot_update_env();
 
 	/* done if no file was loaded (no errors though) */
 	if (size == 0) {
-		show_boot_error(BOOTSTAGE_ID_NET_LOADED);
+		bootstage_error(BOOTSTAGE_ID_NET_LOADED);
 		return 0;
 	}
 
 	/* flush cache */
 	flush_cache(load_addr, size);
 
-	show_boot_progress(BOOTSTAGE_ID_NET_LOADED);
+	bootstage_mark(BOOTSTAGE_ID_NET_LOADED);
 	rcode = bootm_maybe_autostart(cmdtp, argv[0]);
 
 	if (rcode < 0)
-		show_boot_error(BOOTSTAGE_ID_NET_DONE_ERR);
+		bootstage_error(BOOTSTAGE_ID_NET_DONE_ERR);
 	else
-		show_boot_progress(BOOTSTAGE_ID_NET_DONE);
+		bootstage_mark(BOOTSTAGE_ID_NET_DONE);
 	return rcode;
 }
 
diff --git a/common/env_common.c b/common/env_common.c
index bb33220..1cd6a82 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -221,7 +221,7 @@ void env_relocate(void)
 #if defined(CONFIG_ENV_IS_NOWHERE)	/* Environment not changable */
 		set_default_env(NULL);
 #else
-		show_boot_error(BOOTSTAGE_ID_NET_CHECKSUM);
+		bootstage_error(BOOTSTAGE_ID_NET_CHECKSUM);
 		set_default_env("!bad CRC");
 #endif
 	} else {
diff --git a/common/image.c b/common/image.c
index d569070..0c63e3d 100644
--- a/common/image.c
+++ b/common/image.c
@@ -372,37 +372,37 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 
 	if (!image_check_magic(rd_hdr)) {
 		puts("Bad Magic Number\n");
-		show_boot_error(BOOTSTAGE_ID_RD_MAGIC);
+		bootstage_error(BOOTSTAGE_ID_RD_MAGIC);
 		return NULL;
 	}
 
 	if (!image_check_hcrc(rd_hdr)) {
 		puts("Bad Header Checksum\n");
-		show_boot_error(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
+		bootstage_error(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
 		return NULL;
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_RD_MAGIC);
+	bootstage_mark(BOOTSTAGE_ID_RD_MAGIC);
 	image_print_contents(rd_hdr);
 
 	if (verify) {
 		puts("   Verifying Checksum ... ");
 		if (!image_check_dcrc(rd_hdr)) {
 			puts("Bad Data CRC\n");
-			show_boot_error(BOOTSTAGE_ID_RD_CHECKSUM);
+			bootstage_error(BOOTSTAGE_ID_RD_CHECKSUM);
 			return NULL;
 		}
 		puts("OK\n");
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
+	bootstage_mark(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
 
 	if (!image_check_os(rd_hdr, IH_OS_LINUX) ||
 	    !image_check_arch(rd_hdr, arch) ||
 	    !image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
 		printf("No Linux %s Ramdisk Image\n",
 				genimg_get_arch_name(arch));
-		show_boot_error(BOOTSTAGE_ID_RAMDISK);
+		bootstage_error(BOOTSTAGE_ID_RAMDISK);
 		return NULL;
 	}
 
@@ -894,7 +894,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			printf("## Loading init Ramdisk from Legacy "
 					"Image@%08lx ...\n", rd_addr);
 
-			show_boot_progress(BOOTSTAGE_ID_CHECK_RAMDISK);
+			bootstage_mark(BOOTSTAGE_ID_CHECK_RAMDISK);
 			rd_hdr = image_get_ramdisk(rd_addr, arch,
 							images->verify);
 
@@ -911,14 +911,14 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			printf("## Loading init Ramdisk from FIT "
 					"Image at %08lx ...\n", rd_addr);
 
-			show_boot_progress(BOOTSTAGE_ID_FIT_RD_FORMAT);
+			bootstage_mark(BOOTSTAGE_ID_FIT_RD_FORMAT);
 			if (!fit_check_format(fit_hdr)) {
 				puts("Bad FIT ramdisk image format!\n");
-				show_boot_error(
+				bootstage_error(
 					BOOTSTAGE_ID_FIT_RD_FORMAT);
 				return 1;
 			}
-			show_boot_progress(BOOTSTAGE_ID_FIT_RD_FORMAT_OK);
+			bootstage_mark(BOOTSTAGE_ID_FIT_RD_FORMAT_OK);
 
 			if (!fit_uname_ramdisk) {
 				/*
@@ -926,14 +926,14 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 				 * node first. If config unit node name is NULL
 				 * fit_conf_get_node() will try to find default config node
 				 */
-				show_boot_progress(
+				bootstage_mark(
 					BOOTSTAGE_ID_FIT_RD_NO_UNIT_NAME);
 				cfg_noffset = fit_conf_get_node(fit_hdr,
 							fit_uname_config);
 				if (cfg_noffset < 0) {
 					puts("Could not find configuration "
 						"node\n");
-					show_boot_error(
+					bootstage_error(
 					BOOTSTAGE_ID_FIT_RD_NO_UNIT_NAME);
 					return 1;
 				}
@@ -948,21 +948,21 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 							rd_noffset, NULL);
 			} else {
 				/* get ramdisk component image node offset */
-				show_boot_progress(
+				bootstage_mark(
 					BOOTSTAGE_ID_FIT_RD_UNIT_NAME);
 				rd_noffset = fit_image_get_node(fit_hdr,
 						fit_uname_ramdisk);
 			}
 			if (rd_noffset < 0) {
 				puts("Could not find subimage node\n");
-				show_boot_error(BOOTSTAGE_ID_FIT_RD_SUBNODE);
+				bootstage_error(BOOTSTAGE_ID_FIT_RD_SUBNODE);
 				return 1;
 			}
 
 			printf("   Trying '%s' ramdisk subimage\n",
 				fit_uname_ramdisk);
 
-			show_boot_progress(BOOTSTAGE_ID_FIT_RD_CHECK);
+			bootstage_mark(BOOTSTAGE_ID_FIT_RD_CHECK);
 			if (!fit_check_ramdisk(fit_hdr, rd_noffset, arch,
 						images->verify))
 				return 1;
@@ -971,10 +971,10 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			if (fit_image_get_data(fit_hdr, rd_noffset, &data,
 						&size)) {
 				puts("Could not find ramdisk subimage data!\n");
-				show_boot_error(BOOTSTAGE_ID_FIT_RD_GET_DATA);
+				bootstage_error(BOOTSTAGE_ID_FIT_RD_GET_DATA);
 				return 1;
 			}
-			show_boot_progress(BOOTSTAGE_ID_FIT_RD_GET_DATA_OK);
+			bootstage_mark(BOOTSTAGE_ID_FIT_RD_GET_DATA_OK);
 
 			rd_data = (ulong)data;
 			rd_len = size;
@@ -982,10 +982,10 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			if (fit_image_get_load(fit_hdr, rd_noffset, &rd_load)) {
 				puts("Can't get ramdisk subimage load "
 					"address!\n");
-				show_boot_error(BOOTSTAGE_ID_FIT_RD_LOAD);
+				bootstage_error(BOOTSTAGE_ID_FIT_RD_LOAD);
 				return 1;
 			}
-			show_boot_progress(BOOTSTAGE_ID_FIT_RD_LOAD);
+			bootstage_mark(BOOTSTAGE_ID_FIT_RD_LOAD);
 
 			images->fit_hdr_rd = fit_hdr;
 			images->fit_uname_rd = fit_uname_ramdisk;
@@ -1005,7 +1005,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 		 * Now check if we have a legacy mult-component image,
 		 * get second entry data start address and len.
 		 */
-		show_boot_progress(BOOTSTAGE_ID_RAMDISK);
+		bootstage_mark(BOOTSTAGE_ID_RAMDISK);
 		printf("## Loading init Ramdisk from multi component "
 				"Legacy Image at %08lx ...\n",
 				(ulong)images->legacy_hdr_os);
@@ -1015,7 +1015,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 		/*
 		 * no initrd image
 		 */
-		show_boot_progress(BOOTSTAGE_ID_NO_RAMDISK);
+		bootstage_mark(BOOTSTAGE_ID_NO_RAMDISK);
 		rd_len = rd_data = 0;
 	}
 
@@ -1099,7 +1099,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
 				puts("ramdisk - allocation error\n");
 				goto error;
 			}
-			show_boot_progress(BOOTSTAGE_ID_COPY_RAMDISK);
+			bootstage_mark(BOOTSTAGE_ID_COPY_RAMDISK);
 
 			*initrd_end = *initrd_start + rd_len;
 			printf("   Loading Ramdisk to %08lx, end %08lx ... ",
@@ -3166,23 +3166,23 @@ static int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
 		puts("   Verifying Hash Integrity ... ");
 		if (!fit_image_check_hashes(fit, rd_noffset)) {
 			puts("Bad Data Hash\n");
-			show_boot_error(BOOTSTAGE_ID_FIT_RD_HASH);
+			bootstage_error(BOOTSTAGE_ID_FIT_RD_HASH);
 			return 0;
 		}
 		puts("OK\n");
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_FIT_RD_CHECK_ALL);
+	bootstage_mark(BOOTSTAGE_ID_FIT_RD_CHECK_ALL);
 	if (!fit_image_check_os(fit, rd_noffset, IH_OS_LINUX) ||
 	    !fit_image_check_arch(fit, rd_noffset, arch) ||
 	    !fit_image_check_type(fit, rd_noffset, IH_TYPE_RAMDISK)) {
 		printf("No Linux %s Ramdisk Image\n",
 				genimg_get_arch_name(arch));
-		show_boot_error(BOOTSTAGE_ID_FIT_RD_CHECK_ALL);
+		bootstage_error(BOOTSTAGE_ID_FIT_RD_CHECK_ALL);
 		return 0;
 	}
 
-	show_boot_progress(BOOTSTAGE_ID_FIT_RD_CHECK_ALL_OK);
+	bootstage_mark(BOOTSTAGE_ID_FIT_RD_CHECK_ALL_OK);
 	return 1;
 }
 #endif /* USE_HOSTCC */
diff --git a/net/eth.c b/net/eth.c
index 07e7534..de1f6b4 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -244,7 +244,7 @@ int eth_initialize(bd_t *bis)
 	eth_devices = NULL;
 	eth_current = NULL;
 
-	show_boot_progress(BOOTSTAGE_ID_NET_ETH_START);
+	bootstage_mark(BOOTSTAGE_ID_NET_ETH_START);
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
 	miiphy_init();
 #endif
@@ -274,12 +274,12 @@ int eth_initialize(bd_t *bis)
 #endif
 	if (!eth_devices) {
 		puts ("No ethernet found.\n");
-		show_boot_error(BOOTSTAGE_ID_NET_ETH_START);
+		bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
 	} else {
 		struct eth_device *dev = eth_devices;
 		char *ethprime = getenv ("ethprime");
 
-		show_boot_progress(BOOTSTAGE_ID_NET_ETH_INIT);
+		bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT);
 		do {
 			if (eth_number)
 				puts (", ");
diff --git a/post/post.c b/post/post.c
index 3a91020..b8c7e33 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(BOOTSTAGE_ID_POST_FAIL_R);
+				bootstage_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(BOOTSTAGE_ID_POST_FAIL_R);
+				bootstage_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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (11 preceding siblings ...)
  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 ` Simon Glass
  2012-01-08  8:35   ` Mike Frysinger
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 14/15] bootstage: Plumb in bootstage calls for basic operations Simon Glass
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:08 UTC (permalink / raw)
  To: u-boot

This defines the basics of a new boot time measurement feature. This allows
logging of very accurate time measurements as the boot proceeds, by using
an available microsecond counter.

To enable the feature, define CONFIG_BOOTSTAGE in your board config file.
Also available is CONFIG_BOOTSTAGE_REPORT which will cause a report to be
printed just before handing off to the OS.

Most IDs are not named at this stage. For that I would first like to
renumber them all.

Timer summary in microseconds:
       Mark    Elapsed  Stage
          0          0  reset
    205,000    205,000  board_init_f
  6,053,000  5,848,000  bootm_start
  6,053,000          0  id=1
  6,058,000      5,000  id=101
  6,058,000          0  id=100
  6,061,000      3,000  id=103
  6,064,000      3,000  id=104
  6,093,000     29,000  id=107
  6,093,000          0  id=106
  6,093,000          0  id=105
  6,093,000          0  id=108
  7,089,000    996,000  id=7
  7,089,000          0  id=15
  7,089,000          0  id=8
  7,097,000      8,000  start_kernel

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

 README              |   25 ++++++++
 common/Makefile     |    1 +
 common/bootstage.c  |  160 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/bootstage.h |   75 +++++++++++++++++++++++-
 4 files changed, 259 insertions(+), 2 deletions(-)
 create mode 100644 common/bootstage.c

diff --git a/README b/README
index e9d1891..20c09e6 100644
--- a/README
+++ b/README
@@ -2198,6 +2198,31 @@ The following options need to be configured:
 		example, some LED's) on your board. At the moment,
 		the following checkpoints are implemented:
 
+- Detailed boot stage timing
+		CONFIG_BOOTSTAGE
+		Define this option to get detailed timing of each stage
+		of the boot process.
+
+		CONFIG_BOOTSTAGE_USER_COUNT
+		This is the number of available user bootstage records.
+		Each time you call bootstage_mark(BOOTSTAGE_ID_ALLOC, ...)
+		a new ID will be allocated from this stash. If you exceed
+		the limit, recording will stop.
+
+		CONFIG_BOOTSTAGE_REPORT
+		Define this to print a report before boot, similar to this:
+
+		Timer summary in microseconds:
+		       Mark    Elapsed  Stage
+			  0          0  reset
+		  3,575,678  3,575,678  board_init_f start
+		  3,575,695         17  arch_cpu_init A9
+		  3,575,777         82  arch_cpu_init done
+		  3,659,598     83,821  board_init_r start
+		  3,910,375    250,777  main_loop
+		 29,916,167 26,005,792  bootm_start
+		 30,361,327    445,160  start_kernel
+
 Legacy uImage format:
 
   Arg	Where			When
diff --git a/common/Makefile b/common/Makefile
index 1be7236..5530f2c 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -175,6 +175,7 @@ SPD := y
 endif
 COBJS-$(SPD) += ddr_spd.o
 COBJS-$(CONFIG_HWCONFIG) += hwconfig.o
+COBJS-$(CONFIG_BOOTSTAGE) += bootstage.o
 COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o
 COBJS-y += flash.o
 COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
diff --git a/common/bootstage.c b/common/bootstage.c
new file mode 100644
index 0000000..358e1ca
--- /dev/null
+++ b/common/bootstage.c
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2011, Google Inc. All rights reserved.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+
+/*
+ * This module records the progress of boot and arbitrary commands, and
+ * permits accurate timestamping of each.
+ *
+ * TBD: Pass timings to kernel in the FDT
+ */
+
+#include <common.h>
+#include <libfdt.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+enum bootstage_flags {
+	BOOTSTAGEF_ERROR	= 1 << 0,	/* Error record */
+	BOOTSTAGEF_ALLOC	= 1 << 1,	/* Allocate an id */
+};
+
+struct bootstage_record {
+	ulong time_us;
+	const char *name;
+	int flags;		/* see enum bootstage_flags */
+	enum bootstage_id id;
+};
+
+static struct bootstage_record record[BOOTSTAGE_ID_COUNT] = { {1} };
+static int next_id = BOOTSTAGE_ID_USER;
+
+ulong bootstage_add_record(enum bootstage_id id, const char *name,
+			   int flags)
+{
+	struct bootstage_record *rec;
+	ulong mark = timer_get_boot_us();
+
+	if (flags & BOOTSTAGEF_ALLOC)
+		id = next_id++;
+
+	if (id < BOOTSTAGE_ID_COUNT) {
+		rec = &record[id];
+
+		/* Only record the first event for each */
+		if (!rec->time_us) {
+			rec->time_us = mark;
+			rec->name = name;
+			rec->flags = flags;
+			rec->id = id;
+		}
+	}
+
+	/* Tell the board about this progress */
+#ifdef CONFIG_SHOW_BOOT_PROGRESS
+	show_boot_progress(flags & BOOTSTAGE_ERROR ? -id : id);
+#endif
+	return mark;
+}
+
+
+ulong bootstage_mark(enum bootstage_id id)
+{
+	return bootstage_add_record(id, NULL, 0);
+}
+
+ulong bootstage_error(enum bootstage_id id)
+{
+	return bootstage_add_record(id, NULL, BOOTSTAGEF_ERROR);
+}
+
+ulong bootstage_mark_name(enum bootstage_id id, const char *name)
+{
+	int flags = 0;
+
+	if (id == BOOTSTAGE_ID_ALLOC)
+		flags = BOOTSTAGEF_ALLOC;
+	return bootstage_add_record(id, name, flags);
+}
+
+static void print_time(unsigned long us_time)
+{
+	char str[12], *s;
+	int grab = 3;
+
+	/* We don't seem to have %'d in U-Boot */
+	sprintf(str, "%9ld", us_time);
+	for (s = str; *s; s += grab) {
+		if (s != str)
+			putc(s[-1] != ' ' ? ',' : ' ');
+		printf("%.*s", grab, s);
+		grab = 3;
+	}
+}
+
+static uint32_t print_time_record(enum bootstage_id id,
+			struct bootstage_record *rec, uint32_t prev)
+{
+	print_time(rec->time_us);
+	print_time(rec->time_us - prev);
+	if (rec->name)
+		printf("  %s\n", rec->name);
+	else if (id >= BOOTSTAGE_ID_USER)
+		printf("  user_%d\n", id - BOOTSTAGE_ID_USER);
+	else
+		printf("  id=%d\n", id);
+	return rec->time_us;
+}
+
+static int h_compare_record(const void *r1, const void *r2)
+{
+	const struct bootstage_record *rec1 = r1, *rec2 = r2;
+
+	return rec1->time_us - rec2->time_us;
+}
+
+void bootstage_report(void)
+{
+	struct bootstage_record *rec = record;
+	int id;
+	uint32_t prev;
+
+	puts("Timer summary in microseconds:\n");
+	printf("%11s%11s  %s\n", "Mark", "Elapsed", "Stage");
+
+	/* Fake the first record - we could get it from early boot */
+	rec->name = "reset";
+	rec->time_us = 0;
+	prev = print_time_record(BOOTSTAGE_ID_AWAKE, rec, 0);
+
+	/* Sort records by increasing time */
+	qsort(record, ARRAY_SIZE(record), sizeof(*rec), h_compare_record);
+
+	for (id = 0; id < BOOTSTAGE_ID_COUNT; id++, rec++) {
+		if (rec->time_us != 0)
+			prev = print_time_record(rec->id, rec, prev);
+	}
+	if (next_id > BOOTSTAGE_ID_COUNT)
+		printf("(Overflowed internal boot id table by %d entries\n"
+			"- please increase CONFIG_BOOTSTAGE_USER_COUNT\n",
+		       next_id - BOOTSTAGE_ID_COUNT);
+}
diff --git a/include/bootstage.h b/include/bootstage.h
index 882af20..fee686a 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -28,6 +28,11 @@
  * to the user and passing it to the OS for logging / further analysis.
  */
 
+/* The number of boot stage records available for the user */
+#ifndef CONFIG_BOOTSTAGE_USER_COUNT
+#define CONFIG_BOOTSTAGE_USER_COUNT	20
+#endif
+
 /*
  * A list of boot stages that we know about. Each of these indicates the
  * state that we are at, and the action that we are about to perform. For
@@ -171,8 +176,56 @@ enum bootstage_id {
 
 	BOOTSTAGE_ID_NAND_FIT_READ = 150,
 	BOOTSTAGE_ID_NAND_FIT_READ_OK,
+
+	/*
+	 * These boot stages are new, higher level, and not directly related
+	 * to the old boot progress numbers. They are useful for recording
+	 * rough boot timing information.
+	 */
+	BOOTSTAGE_ID_AWAKE,
+	BOOTSTAGE_ID_START_UBOOT_F,
+	BOOTSTAGE_ID_START_UBOOT_R,
+	BOOTSTAGE_ID_USB_START,
+	BOOTSTAGE_ID_ETH_START,
+	BOOTSTAGE_ID_BOOTP_START,
+	BOOTSTAGE_ID_BOOTP_STOP,
+	BOOTSTAGE_ID_BOOTM_START,
+	BOOTSTAGE_ID_BOOTM_HANDOFF,
+	BOOTSTAGE_ID_MAIN_LOOP,
+	BOOTSTAGE_KERNELREAD_START,
+	BOOTSTAGE_KERNELREAD_STOP,
+
+	BOOTSTAGE_ID_CPU_AWAKE,
+	BOOTSTAGE_ID_MAIN_CPU_AWAKE,
+	BOOTSTAGE_ID_MAIN_CPU_READY,
+
+	/* a few spare for the user, from here */
+	BOOTSTAGE_ID_USER,
+	BOOTSTAGE_ID_COUNT = BOOTSTAGE_ID_USER + CONFIG_BOOTSTAGE_USER_COUNT,
+	BOOTSTAGE_ID_ALLOC,
 };
 
+#ifdef CONFIG_BOOTSTAGE
+/* This is the full bootstage implementation */
+
+/*
+ * Mark a time stamp for the current boot stage.
+ */
+ulong bootstage_mark(enum bootstage_id id);
+
+ulong bootstage_error(enum bootstage_id id);
+
+ulong bootstage_mark_name(enum bootstage_id id, const char *name);
+
+/* Print a report about boot time */
+void bootstage_report(void);
+
+#else
+/*
+ * This is a dummy implementation which just calls show_boot_progress(),
+ * and won't even do that unless CONFIG_SHOW_BOOT_PROGRESS is defined
+ */
+
 /*
  * Board-specific platform code can implement show_boot_progress () if
  * needed.
@@ -181,9 +234,27 @@ enum bootstage_id {
  *		has occurred.
  */
 void show_boot_progress(int val);
-static inline void show_boot_error(int val)
+
+static inline ulong bootstage_mark(enum bootstage_id id)
 {
-	show_boot_progress(-val);
+#ifdef CONFIG_SHOW_BOOT_PROGRESS
+	show_boot_progress(id);
+#endif
+	return 0;
 }
 
+static inline ulong bootstage_error(enum bootstage_id id)
+{
+#ifdef CONFIG_SHOW_BOOT_PROGRESS
+	show_boot_progress(-id);
+#endif
+	return 0;
+}
+
+static inline ulong bootstage_mark_name(enum bootstage_id id, const char *name)
+{ return 0; }
+
+
+#endif /* CONFIG_BOOTSTAGE */
+
 #endif
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 14/15] bootstage: Plumb in bootstage calls for basic operations
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (12 preceding siblings ...)
  2011-12-10 21:08 ` [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement Simon Glass
@ 2011-12-10 21:08 ` 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-03 22:33 ` [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
  15 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:08 UTC (permalink / raw)
  To: u-boot

This inserts bootstage calls into tftp, usb start and bootm. We
could go further, but this is a reasonable start to illustrate
the concept.

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

 common/cmd_bootm.c |    2 ++
 common/cmd_net.c   |    7 ++++++-
 common/cmd_usb.c   |    1 +
 net/bootp.c        |    4 ++++
 net/net.c          |    1 +
 5 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 7e780fb..7536f34 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -199,6 +199,8 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 
 	bootm_start_lmb();
 
+	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_START, "bootm_start");
+
 	/* get kernel image header, start address and length */
 	os_hdr = boot_get_kernel(cmdtp, flag, argc, argv,
 			&images, &images.os.image_start, &images.os.image_len);
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 71b5b20..23340d4 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -43,7 +43,12 @@ U_BOOT_CMD(
 
 int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	return netboot_common(TFTPGET, cmdtp, argc, argv);
+	int ret;
+
+	bootstage_mark_name(BOOTSTAGE_KERNELREAD_START, "tftp_start");
+	ret = netboot_common(TFTPGET, cmdtp, argc, argv);
+	bootstage_mark_name(BOOTSTAGE_KERNELREAD_STOP, "tftp_done");
+	return ret;
 }
 
 U_BOOT_CMD(
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 8c87265..d33992b 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -512,6 +512,7 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	if ((strncmp(argv[1], "reset", 5) == 0) ||
 		 (strncmp(argv[1], "start", 5) == 0)) {
+		bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
 		usb_stop();
 		printf("(Re)start USB...\n");
 		i = usb_init();
diff --git a/net/bootp.c b/net/bootp.c
index 34124b8..9e32476 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -322,6 +322,7 @@ BootpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 		BootpVendorProcess((uchar *)&bp->bp_vend[4], len);
 
 	NetSetTimeout(0, (thand_f *)0);
+	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, "bootp_stop");
 
 	debug("Got good BOOTP\n");
 
@@ -589,6 +590,7 @@ BootpRequest (void)
 	Bootp_t *bp;
 	int ext_len, pktlen, iplen;
 
+	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_START, "bootp_start");
 #if defined(CONFIG_CMD_DHCP)
 	dhcp_state = INIT;
 #endif
@@ -949,6 +951,8 @@ DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 			BootpCopyNetParams(bp); /* Store net params from reply */
 			dhcp_state = BOUND;
 			printf ("DHCP client bound to address %pI4\n", &NetOurIP);
+			bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP,
+					    "bootp_stop");
 
 			net_auto_load();
 			return;
diff --git a/net/net.c b/net/net.c
index 045405b..c5acf8f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -402,6 +402,7 @@ int NetLoop(enum proto_t protocol)
 		NetArpWaitTxPacketSize = 0;
 	}
 
+	bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
 	eth_halt();
 	eth_set_current();
 	if (eth_init(bd) < 0) {
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (13 preceding siblings ...)
  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 ` Simon Glass
  2012-01-08  8:36   ` Mike Frysinger
  2012-01-03 22:33 ` [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
  15 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2011-12-10 21:08 UTC (permalink / raw)
  To: u-boot

Add calls to bootstage before and after relocation, and just
before jumping to the OS.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Unify show_boot_progress() into this series

 arch/arm/lib/board.c |    3 +++
 arch/arm/lib/bootm.c |    4 ++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 3d78274..e4b243b 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -266,6 +266,8 @@ void board_init_f(ulong bootflag)
 	ulong reg;
 #endif
 
+	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
+
 	/* Pointer is writable since we allocated a register for it */
 	gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
 	/* compiler optimization barrier needed for GCC >= 3.4 */
@@ -455,6 +457,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	gd = id;
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
+	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
 
 	monitor_flash_len = _end_ofs;
 
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index c400a50..4cd37e9 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -83,6 +83,10 @@ void arch_lmb_reserve(struct lmb *lmb)
 static void announce_and_cleanup(void)
 {
 	printf("\nStarting kernel ...\n\n");
+	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+#ifdef CONFIG_BOOTSTAGE_REPORT
+	bootstage_report();
+#endif
 
 #ifdef CONFIG_USB_DEVICE
 	{
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing
  2011-12-10 21:07 [U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing Simon Glass
                   ` (14 preceding siblings ...)
  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-03 22:33 ` Simon Glass
  15 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2012-01-03 22:33 UTC (permalink / raw)
  To: u-boot

Hi,

On Sat, Dec 10, 2011 at 1:07 PM, Simon Glass <sjg@chromium.org> wrote:
> This series creates a simple boot progress timing feature in U-Boot.
>
> Previous discussion on this is here:
>
> http://lists.denx.de/pipermail/u-boot/2011-May/thread.html#92584
>
> A request was made to unify this with show_boot_progress(). As discussed
> in the v1 RFC patch, this series addresses this the following way:

Are there comments / objections on this series at this stage? I am
wanting to build it on with a new series.

Regards,
Simon

>
> 1. Create bootstage.h with the intent of replacing integers with enums. This
> will allow the values to be easily changed or rationalised later as required.
> It also makes it more explicit that (for example) 15 means we are about to
> run an OS.
>
> 2. Change show_boot_progress() to use these enums. This first patch just
> shows doing this with one (commonly used) integer value.
>
> 3. Create bootstage.c file which permits recording of bootstage timestamps.
>
> 4. Change the existing show_boot_progress() handlers within board files to
> use a provided bootstage progress handler instead. This is easy enough as
> there are few users.
>
> 5. Change show_boot_progress() to call into bootstage, which in turns calls
> the board-provided progress handler, if defined, after recording a timestamp.
> The function signature will stay the same for now.
>
> Ultimately I would like boot timing available from before U-Boot to user
> space in Linux. See RFC patch for Linux here:
>
> http://lwn.net/Articles/460432/
>
> and discussion here:
>
> http://comments.gmane.org/gmane.linux.kernel/1194861
>
> Still to do: change the microsecond time printout to use the Linux
> seconds.microseconds format.
>
> Changes in v2:
> - Unify show_boot_progress() into this series
>
> Simon Glass (15):
> ?bootstage: Create an initial header for boot progress integers
> ?bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
> ?bootstage: Use show_boot_error() for -ve progress numbers
> ?bootstage: Convert progress numbers 1-9 into enums
> ?bootstage: Convert progress numbers 10-19 to enums
> ?bootstage: Convert progress numbers 20-41 to enums
> ?bootstage: Convert IDE progress numbers to enums
> ?bootstage: Convert NAND progress numbers to enums
> ?bootstage: Convert net progress numbers to enums
> ?bootstage: Convert FIT progress numbers to enums
> ?bootstage: Define an optional microsecond timer
> ?bootstage: Replace show_boot_progress/error() with bootstage_...()
> ?bootstage: Add microsecond boot time measurement
> ?bootstage: Plumb in bootstage calls for basic operations
> ?bootstage: arm: Add bootstage calls in board and bootm
>
> ?README ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 25 +++
> ?arch/arm/lib/board.c ? ? ? ? ? ? ? ? ? | ? ?3 +
> ?arch/arm/lib/bootm.c ? ? ? ? ? ? ? ? ? | ? ?6 +-
> ?arch/avr32/lib/bootm.c ? ? ? ? ? ? ? ? | ? ?2 +-
> ?arch/m68k/lib/bootm.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?arch/microblaze/lib/bootm.c ? ? ? ? ? ?| ? ?2 +-
> ?arch/mips/lib/bootm.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?arch/mips/lib/bootm_qemu_mips.c ? ? ? ?| ? ?2 +-
> ?arch/nds32/lib/bootm.c ? ? ? ? ? ? ? ? | ? ?2 +-
> ?arch/powerpc/lib/board.c ? ? ? ? ? ? ? | ? ?2 +-
> ?arch/powerpc/lib/bootm.c ? ? ? ? ? ? ? | ? ?2 +-
> ?arch/sparc/lib/board.c ? ? ? ? ? ? ? ? | ? ?2 +-
> ?arch/x86/lib/board.c ? ? ? ? ? ? ? ? ? | ? 19 +--
> ?board/Seagate/dockstar/dockstar.c ? ? ?| ? ?4 +-
> ?board/a4m072/a4m072.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?board/bf533-stamp/bf533-stamp.c ? ? ? ?| ? 30 ++--
> ?board/hermes/hermes.c ? ? ? ? ? ? ? ? ?| ? ?8 +-
> ?board/ivm/ivm.c ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?board/matrix_vision/common/mv_common.c | ? ?2 +-
> ?board/matrix_vision/mvbc_p/mvbc_p.c ? ?| ? ?8 +-
> ?board/pcs440ep/pcs440ep.c ? ? ? ? ? ? ?| ? 50 +++---
> ?board/scb9328/scb9328.c ? ? ? ? ? ? ? ?| ? ?6 -
> ?board/sixnet/sixnet.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?board/ti/beagle/beagle.c ? ? ? ? ? ? ? | ? ?2 +-
> ?common/Makefile ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
> ?common/bootstage.c ? ? ? ? ? ? ? ? ? ? | ?160 ++++++++++++++++++++
> ?common/cmd_bootm.c ? ? ? ? ? ? ? ? ? ? | ? 95 ++++++------
> ?common/cmd_ide.c ? ? ? ? ? ? ? ? ? ? ? | ? 46 +++---
> ?common/cmd_nand.c ? ? ? ? ? ? ? ? ? ? ?| ? 34 ++--
> ?common/cmd_net.c ? ? ? ? ? ? ? ? ? ? ? | ? 23 ++-
> ?common/cmd_usb.c ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +
> ?common/env_common.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?common/image.c ? ? ? ? ? ? ? ? ? ? ? ? | ? 56 ++++---
> ?include/bootstage.h ? ? ? ? ? ? ? ? ? ?| ?260 ++++++++++++++++++++++++++++++++
> ?include/common.h ? ? ? ? ? ? ? ? ? ? ? | ? 13 +-
> ?lib/time.c ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 17 ++
> ?net/bootp.c ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?4 +
> ?net/eth.c ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?6 +-
> ?net/net.c ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
> ?post/post.c ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?4 +-
> ?40 files changed, 698 insertions(+), 212 deletions(-)
> ?create mode 100644 common/bootstage.c
> ?create mode 100644 include/bootstage.h
>
> --
> 1.7.3.1
>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 02/15] bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
  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
  0 siblings, 0 replies; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08  8:26 UTC (permalink / raw)
  To: u-boot

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/e8bb21bb/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 01/15] bootstage: Create an initial header for boot progress integers
  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
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08  8:26 UTC (permalink / raw)
  To: u-boot

On Saturday 10 December 2011 16:07:53 Simon Glass wrote:
> --- /dev/null
> +++ b/include/bootstage.h
>
> +/*
> + * This file implements recording of each stage of the boot process. It is
> + * intended to implement timing of each stage, reporting this information
> + * to the user and passing it to the OS for logging / further analysis.
> + */

maybe it's me, but i'd expect this at the top of the file before the 
copyright/license notice

>
> + * progres action1

typo ?  shows up a few times ...

> +enum bootstage_id {
> +	BOOTSTAGE_ID_RUN_OS	= 15,	/* Exiting U-Boot, entering OS */
> +};

what relevance does this # have ?  since it gets passed to Linux, it becomes 
part of the ABI and cannot be changed, so that should be mentioned in the 
comment.

> +/*
> + * Board-specific platform code can implement show_boot_progress () if

"board-specific platform" is kind of redundant

also, no space before "()"

> --- a/include/common.h
> +++ b/include/common.h
> @@ -801,10 +801,8 @@ int	pcmcia_init (void);
>  #ifdef CONFIG_STATUS_LED
>  # include <status_led.h>
>  #endif
> -/*
> - * Board-specific Platform code can reimplement show_boot_progress () if
> needed - */
> -void show_boot_progress(int val);
> +
> +#include <bootstage.h>
> 
>  /* Multicore arch functions */
>  #ifdef CONFIG_MP
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/678e9d1a/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 03/15] bootstage: Use show_boot_error() for -ve progress numbers
  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
  0 siblings, 0 replies; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08  8:27 UTC (permalink / raw)
  To: u-boot

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/5c42c3a0/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 04/15] bootstage: Convert progress numbers 1-9 into enums
  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
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08  8:27 UTC (permalink / raw)
  To: u-boot

On Saturday 10 December 2011 16:07:56 Simon Glass wrote:
> --- a/include/bootstage.h
> +++ b/include/bootstage.h
>
>  enum bootstage_id {
> +	BOOTSTAGE_ID_START,
> +	BOOTSTAGE_ID_CHECK_MAGIC,	/* Checking image magic */
> +	BOOTSTAGE_ID_CHECK_HEADER,	/* Checking image header */
> +	BOOTSTAGE_ID_CHECK_CHECKSUM,	/* Checking image checksum */
> +	BOOTSTAGE_ID_CHECK_ARCH,	/* Checking architecture */

i know it's unlikely to ever change, but this would be good to be explicit:
	BOOTSTAGE_ID_START = 0,
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/233213f4/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 05/15] bootstage: Convert progress numbers 10-19 to enums
  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
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08  8:28 UTC (permalink / raw)
  To: u-boot

not sure why this isn't just squashed into 04/15, but whatever

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/c67d4679/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer
  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
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08  8:30 UTC (permalink / raw)
  To: u-boot

On Saturday 10 December 2011 16:08:03 Simon Glass wrote:
> --- a/lib/time.c
> +++ b/lib/time.c
>
> +ulong __timer_get_boot_us(void)
> +{
> +	static ulong base_time;
> +
> +	/*
> +	 * We can't implement this properly. Return 0 on the first call and
> +	 * larger values after that.
> +	 */
> +	if (base_time)
> +		return get_timer(base_time) * 1000;
> +	base_time = get_timer(0);
> +	return 0;
> +}
> +
> +ulong timer_get_boot_us(void)
> +	__attribute__((weak, alias("__timer_get_boot_us")));

isn't this duplicating existing post_time_ms() ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/9b9e83e2/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  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
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08  8:35 UTC (permalink / raw)
  To: u-boot

On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
> This defines the basics of a new boot time measurement feature. This allows
> logging of very accurate time measurements as the boot proceeds, by using
> an available microsecond counter.
> 
> To enable the feature, define CONFIG_BOOTSTAGE in your board config file.
> Also available is CONFIG_BOOTSTAGE_REPORT which will cause a report to be
> printed just before handing off to the OS.

the summary says "Add microsecond boot time measurement".  that sounds like 
extending existing functionality.  in reality, this is the core of the new 
CONFIG_BOOTSTAGE logic right ?

also, this logging framework seems to overlap the existing POST logging 
framework functionality ...

> --- a/include/bootstage.h
> +++ b/include/bootstage.h
>
> +static inline ulong bootstage_mark(enum bootstage_id id)
>  {
> -	show_boot_progress(-val);
> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
> +	show_boot_progress(id);
> +#endif
> +	return 0;
>  }
> 
> +static inline ulong bootstage_error(enum bootstage_id id)
> +{
> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
> +	show_boot_progress(-id);
> +#endif
> +	return 0;
> +}

why isn't show_boot_progress() just a stub when CONFIG_SHOW_BOOT_PROGRESS 
isn't defined ?  then you don't have to protect the call sites.

> +static inline ulong bootstage_mark_name(enum bootstage_id id, const char
> *name)
> +{ return 0; }

please unroll this
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/d2a99901/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm
  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
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08  8:36 UTC (permalink / raw)
  To: u-boot

On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
> --- a/arch/arm/lib/bootm.c
> +++ b/arch/arm/lib/bootm.c
>
>  static void announce_and_cleanup(void)
>  {
>  	printf("\nStarting kernel ...\n\n");
> +	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
> +#ifdef CONFIG_BOOTSTAGE_REPORT
> +	bootstage_report();
> +#endif

shouldn't the header make bootstage_report() into a stub when 
CONFIG_BOOTSTAGE_REPORT isn't defined ?  then you won't need the ifdef 
protection here.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/8bd632a9/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 01/15] bootstage: Create an initial header for boot progress integers
  2012-01-08  8:26   ` Mike Frysinger
@ 2012-01-08 17:22     ` Simon Glass
  2012-01-08 19:46       ` Mike Frysinger
  0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2012-01-08 17:22 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 12:26 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 10 December 2011 16:07:53 Simon Glass wrote:
>> --- /dev/null
>> +++ b/include/bootstage.h

Thanks for looking at this.

>>
>> +/*
>> + * This file implements recording of each stage of the boot process. It is
>> + * intended to implement timing of each stage, reporting this information
>> + * to the user and passing it to the OS for logging / further analysis.
>> + */
>
> maybe it's me, but i'd expect this at the top of the file before the
> copyright/license notice

done

>
>>
>> + * progres action1
>
> typo ? ?shows up a few times ...

done

>
>> +enum bootstage_id {
>> + ? ? BOOTSTAGE_ID_RUN_OS ? ? = 15, ? /* Exiting U-Boot, entering OS */
>> +};
>
> what relevance does this # have ? ?since it gets passed to Linux, it becomes
> part of the ABI and cannot be changed, so that should be mentioned in the
> comment.

The number is currently open-coded in U-Boot but this series turns all
these occurrences into a global enum. Actually I don't plan that the
number be passed to Linux, or at least that Linux can rely on it being
anything in particular.

I haven't done it in this series (which is large enough already) as
this is a code translation exercise and I want it to be easy to see
whether I have treated each site correctly.

But I want to remove all the numbers later, so that we can add new
stages easily and everything is numbered from 0 to n with no gaps.

>
>> +/*
>> + * Board-specific platform code can implement show_boot_progress () if
>
> "board-specific platform" is kind of redundant
>
> also, no space before "()"

done

>
>> --- a/include/common.h
>> +++ b/include/common.h
>> @@ -801,10 +801,8 @@ int ? ? ?pcmcia_init (void);
>> ?#ifdef CONFIG_STATUS_LED
>> ?# include <status_led.h>
>> ?#endif
>> -/*
>> - * Board-specific Platform code can reimplement show_boot_progress () if
>> needed - */
>> -void show_boot_progress(int val);
>> +
>> +#include <bootstage.h>
>>
>> ?/* Multicore arch functions */
>> ?#ifdef CONFIG_MP

Regards,
Simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 04/15] bootstage: Convert progress numbers 1-9 into enums
  2012-01-08  8:27   ` Mike Frysinger
@ 2012-01-08 17:27     ` Simon Glass
  0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2012-01-08 17:27 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 12:27 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 10 December 2011 16:07:56 Simon Glass wrote:
>> --- a/include/bootstage.h
>> +++ b/include/bootstage.h
>>
>> ?enum bootstage_id {
>> + ? ? BOOTSTAGE_ID_START,
>> + ? ? BOOTSTAGE_ID_CHECK_MAGIC, ? ? ? /* Checking image magic */
>> + ? ? BOOTSTAGE_ID_CHECK_HEADER, ? ? ?/* Checking image header */
>> + ? ? BOOTSTAGE_ID_CHECK_CHECKSUM, ? ?/* Checking image checksum */
>> + ? ? BOOTSTAGE_ID_CHECK_ARCH, ? ? ? ?/* Checking architecture */
>
> i know it's unlikely to ever change, but this would be good to be explicit:
> ? ? ? ?BOOTSTAGE_ID_START = 0,
> -mike

done

Regards,
Simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 05/15] bootstage: Convert progress numbers 10-19 to enums
  2012-01-08  8:28   ` Mike Frysinger
@ 2012-01-08 17:29     ` Simon Glass
  0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2012-01-08 17:29 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 12:28 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> not sure why this isn't just squashed into 04/15, but whatever
>
Only that I wanted to make it easier to review in chunks.

> Acked-by: Mike Frysinger <vapier@gentoo.org>
> -mike

Thanks

Regards,
Simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer
  2012-01-08  8:30   ` Mike Frysinger
@ 2012-01-08 17:33     ` Simon Glass
  2012-01-08 19:57       ` Mike Frysinger
  0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2012-01-08 17:33 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 12:30 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 10 December 2011 16:08:03 Simon Glass wrote:
>> --- a/lib/time.c
>> +++ b/lib/time.c
>>
>> +ulong __timer_get_boot_us(void)
>> +{
>> + ? ? static ulong base_time;
>> +
>> + ? ? /*
>> + ? ? ?* We can't implement this properly. Return 0 on the first call and
>> + ? ? ?* larger values after that.
>> + ? ? ?*/
>> + ? ? if (base_time)
>> + ? ? ? ? ? ? return get_timer(base_time) * 1000;
>> + ? ? base_time = get_timer(0);
>> + ? ? return 0;
>> +}
>> +
>> +ulong timer_get_boot_us(void)
>> + ? ? __attribute__((weak, alias("__timer_get_boot_us")));
>
> isn't this duplicating existing post_time_ms() ?
> -mike

Yes I am aware of the post stuff, but I have already expended great
effort integrating the boot progress stuff and I don't want to do
everything at once!

There is some scope to join bootstage and post, but for now they are
separate things with separate CONFIGs, and you don't have to enable
one to get the other.

Regards,
Simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2012-01-08  8:35   ` Mike Frysinger
@ 2012-01-08 17:42     ` Simon Glass
  2012-01-09 17:33       ` Mike Frysinger
  0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2012-01-08 17:42 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 12:35 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
>> This defines the basics of a new boot time measurement feature. This allows
>> logging of very accurate time measurements as the boot proceeds, by using
>> an available microsecond counter.
>>
>> To enable the feature, define CONFIG_BOOTSTAGE in your board config file.
>> Also available is CONFIG_BOOTSTAGE_REPORT which will cause a report to be
>> printed just before handing off to the OS.
>
> the summary says "Add microsecond boot time measurement". ?that sounds like
> extending existing functionality. ?in reality, this is the core of the new
> CONFIG_BOOTSTAGE logic right ?

Yes - I will update the commit title.

>
> also, this logging framework seems to overlap the existing POST logging
> framework functionality ...

Please see previous message - I have integrated show_boot_progress()
as per previous comments, But power-on self test has some separate
functionality. It does call show_boot_progress() on failure.

This series is about the U-Boot side of supporting boot timing from
reset to Linux user space.

>
>> --- a/include/bootstage.h
>> +++ b/include/bootstage.h
>>
>> +static inline ulong bootstage_mark(enum bootstage_id id)
>> ?{
>> - ? ? show_boot_progress(-val);
>> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
>> + ? ? show_boot_progress(id);
>> +#endif
>> + ? ? return 0;
>> ?}
>>
>> +static inline ulong bootstage_error(enum bootstage_id id)
>> +{
>> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
>> + ? ? show_boot_progress(-id);
>> +#endif
>> + ? ? return 0;
>> +}
>
> why isn't show_boot_progress() just a stub when CONFIG_SHOW_BOOT_PROGRESS
> isn't defined ? ?then you don't have to protect the call sites.

show_boot_progress() has been part of U-Boot for a while. Quite a lot
of boards define this function with the expectation that they can turn
CONFIG_SHOW_BOOT_PROGRESS on and off independently. So If I do what
you suggest I will break that expectation.

One fix would be to bracket all show_boot_progress() function
implementations in the boards with CONFIG_SHOW_BOOT_PROGRESS, but I
haven't done that.

>
>> +static inline ulong bootstage_mark_name(enum bootstage_id id, const char
>> *name)
>> +{ return 0; }
>
> please unroll this

done

> -mike

Regards,
Simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm
  2012-01-08  8:36   ` Mike Frysinger
@ 2012-01-08 17:43     ` Simon Glass
  2012-01-08 19:58       ` Mike Frysinger
  0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2012-01-08 17:43 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 12:36 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
>> --- a/arch/arm/lib/bootm.c
>> +++ b/arch/arm/lib/bootm.c
>>
>> ?static void announce_and_cleanup(void)
>> ?{
>> ? ? ? printf("\nStarting kernel ...\n\n");
>> + ? ? bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
>> +#ifdef CONFIG_BOOTSTAGE_REPORT
>> + ? ? bootstage_report();
>> +#endif
>
> shouldn't the header make bootstage_report() into a stub when
> CONFIG_BOOTSTAGE_REPORT isn't defined ? ?then you won't need the ifdef
> protection here.

Well maybe. I am hoping for a link error if someone calls it without
defining that CONFIG. Otherwise it could be very confusing for people
that they can't get a report!

Regards
Simon

> -mike

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 01/15] bootstage: Create an initial header for boot progress integers
  2012-01-08 17:22     ` Simon Glass
@ 2012-01-08 19:46       ` Mike Frysinger
  2012-01-08 23:43         ` Simon Glass
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08 19:46 UTC (permalink / raw)
  To: u-boot

On Sunday 08 January 2012 12:22:54 Simon Glass wrote:
> On Sun, Jan 8, 2012 at 12:26 AM, Mike Frysinger wrote:
> > On Saturday 10 December 2011 16:07:53 Simon Glass wrote:
> >> +enum bootstage_id {
> >> +     BOOTSTAGE_ID_RUN_OS     = 15,   /* Exiting U-Boot, entering OS */
> >> +};
> > 
> > what relevance does this # have ?  since it gets passed to Linux, it
> > becomes part of the ABI and cannot be changed, so that should be
> > mentioned in the comment.
> 
> The number is currently open-coded in U-Boot but this series turns all
> these occurrences into a global enum.

yes, but the enum's have a numeric value :)

> Actually I don't plan that the
> number be passed to Linux, or at least that Linux can rely on it being
> anything in particular.

ok, as long as the end goal has the # not being part of the ABI, that's good
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/f1a80eee/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer
  2012-01-08 17:33     ` Simon Glass
@ 2012-01-08 19:57       ` Mike Frysinger
  2012-01-08 23:49         ` Simon Glass
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08 19:57 UTC (permalink / raw)
  To: u-boot

On Sunday 08 January 2012 12:33:34 Simon Glass wrote:
> On Sun, Jan 8, 2012 at 12:30 AM, Mike Frysinger wrote:
> > On Saturday 10 December 2011 16:08:03 Simon Glass wrote:
> >> --- a/lib/time.c
> >> +++ b/lib/time.c
> >> 
> >> +ulong __timer_get_boot_us(void)
> >> +{
> >> +     static ulong base_time;
> >> +
> >> +     /*
> >> +      * We can't implement this properly. Return 0 on the first call
> >> and +      * larger values after that.
> >> +      */
> >> +     if (base_time)
> >> +             return get_timer(base_time) * 1000;
> >> +     base_time = get_timer(0);
> >> +     return 0;
> >> +}
> >> +
> >> +ulong timer_get_boot_us(void)
> >> +     __attribute__((weak, alias("__timer_get_boot_us")));
> > 
> > isn't this duplicating existing post_time_ms() ?
> 
> Yes I am aware of the post stuff, but I have already expended great
> effort integrating the boot progress stuff and I don't want to do
> everything at once!
> 
> There is some scope to join bootstage and post, but for now they are
> separate things with separate CONFIGs, and you don't have to enable
> one to get the other.

ok.  i'd change the "bootstage:" part of your commit message though to 
something like "timer: add microsecond boot func".
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/145e909a/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm
  2012-01-08 17:43     ` Simon Glass
@ 2012-01-08 19:58       ` Mike Frysinger
  2012-01-08 23:48         ` Simon Glass
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-08 19:58 UTC (permalink / raw)
  To: u-boot

On Sunday 08 January 2012 12:43:09 Simon Glass wrote:
> On Sun, Jan 8, 2012 at 12:36 AM, Mike Frysinger wrote:
> > On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
> >> --- a/arch/arm/lib/bootm.c
> >> +++ b/arch/arm/lib/bootm.c
> >> 
> >>  static void announce_and_cleanup(void)
> >>  {
> >>       printf("\nStarting kernel ...\n\n");
> >> +     bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
> >> +#ifdef CONFIG_BOOTSTAGE_REPORT
> >> +     bootstage_report();
> >> +#endif
> > 
> > shouldn't the header make bootstage_report() into a stub when
> > CONFIG_BOOTSTAGE_REPORT isn't defined ?  then you won't need the ifdef
> > protection here.
> 
> Well maybe. I am hoping for a link error if someone calls it without
> defining that CONFIG. Otherwise it could be very confusing for people
> that they can't get a report!

i'm not sure we need worry about that
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/66750e8b/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 01/15] bootstage: Create an initial header for boot progress integers
  2012-01-08 19:46       ` Mike Frysinger
@ 2012-01-08 23:43         ` Simon Glass
  0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2012-01-08 23:43 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 11:46 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Sunday 08 January 2012 12:22:54 Simon Glass wrote:
>> On Sun, Jan 8, 2012 at 12:26 AM, Mike Frysinger wrote:
>> > On Saturday 10 December 2011 16:07:53 Simon Glass wrote:
>> >> +enum bootstage_id {
>> >> + ? ? BOOTSTAGE_ID_RUN_OS ? ? = 15, ? /* Exiting U-Boot, entering OS */
>> >> +};
>> >
>> > what relevance does this # have ? ?since it gets passed to Linux, it
>> > becomes part of the ABI and cannot be changed, so that should be
>> > mentioned in the comment.
>>
>> The number is currently open-coded in U-Boot but this series turns all
>> these occurrences into a global enum.
>
> yes, but the enum's have a numeric value :)
>

Yes for now - see my other message. I would like to remove the numbers
eventually.

>> Actually I don't plan that the
>> number be passed to Linux, or at least that Linux can rely on it being
>> anything in particular.
>
> ok, as long as the end goal has the # not being part of the ABI, that's good

That's right.

Regards,
Simon

> -mike

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm
  2012-01-08 19:58       ` Mike Frysinger
@ 2012-01-08 23:48         ` Simon Glass
  2012-01-09 17:31           ` Mike Frysinger
  0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2012-01-08 23:48 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 11:58 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Sunday 08 January 2012 12:43:09 Simon Glass wrote:
>> On Sun, Jan 8, 2012 at 12:36 AM, Mike Frysinger wrote:
>> > On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
>> >> --- a/arch/arm/lib/bootm.c
>> >> +++ b/arch/arm/lib/bootm.c
>> >>
>> >> ?static void announce_and_cleanup(void)
>> >> ?{
>> >> ? ? ? printf("\nStarting kernel ...\n\n");
>> >> + ? ? bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
>> >> +#ifdef CONFIG_BOOTSTAGE_REPORT
>> >> + ? ? bootstage_report();
>> >> +#endif
>> >
>> > shouldn't the header make bootstage_report() into a stub when
>> > CONFIG_BOOTSTAGE_REPORT isn't defined ? ?then you won't need the ifdef
>> > protection here.
>>
>> Well maybe. I am hoping for a link error if someone calls it without
>> defining that CONFIG. Otherwise it could be very confusing for people
>> that they can't get a report!
>
> i'm not sure we need worry about that

I have had another look at this. The idea is that anyone can call
bootstage_report() to get a report, but if they define
CONFIG_BOOTSTAGE_REPORT then one is printing automatically by U-Boot
just before jumping to the kernel.

So I don't want this define to remove the ability to print a report,
just to enable printing a report at a time which is hopefully
suitable.

Does that make sense?

Regards,
Simon

> -mike

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer
  2012-01-08 19:57       ` Mike Frysinger
@ 2012-01-08 23:49         ` Simon Glass
  0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2012-01-08 23:49 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sun, Jan 8, 2012 at 11:57 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Sunday 08 January 2012 12:33:34 Simon Glass wrote:
>> On Sun, Jan 8, 2012 at 12:30 AM, Mike Frysinger wrote:
>> > On Saturday 10 December 2011 16:08:03 Simon Glass wrote:
>> >> --- a/lib/time.c
>> >> +++ b/lib/time.c
>> >>
>> >> +ulong __timer_get_boot_us(void)
>> >> +{
>> >> + ? ? static ulong base_time;
>> >> +
>> >> + ? ? /*
>> >> + ? ? ?* We can't implement this properly. Return 0 on the first call
>> >> and + ? ? ?* larger values after that.
>> >> + ? ? ?*/
>> >> + ? ? if (base_time)
>> >> + ? ? ? ? ? ? return get_timer(base_time) * 1000;
>> >> + ? ? base_time = get_timer(0);
>> >> + ? ? return 0;
>> >> +}
>> >> +
>> >> +ulong timer_get_boot_us(void)
>> >> + ? ? __attribute__((weak, alias("__timer_get_boot_us")));
>> >
>> > isn't this duplicating existing post_time_ms() ?
>>
>> Yes I am aware of the post stuff, but I have already expended great
>> effort integrating the boot progress stuff and I don't want to do
>> everything at once!
>>
>> There is some scope to join bootstage and post, but for now they are
>> separate things with separate CONFIGs, and you don't have to enable
>> one to get the other.
>
> ok. ?i'd change the "bootstage:" part of your commit message though to
> something like "timer: add microsecond boot func".

OK done.

Regards,
Simon

> -mike

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm
  2012-01-08 23:48         ` Simon Glass
@ 2012-01-09 17:31           ` Mike Frysinger
  2012-01-12  5:38             ` Simon Glass
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-09 17:31 UTC (permalink / raw)
  To: u-boot

On Sunday 08 January 2012 18:48:18 Simon Glass wrote:
> On Sun, Jan 8, 2012 at 11:58 AM, Mike Frysinger wrote:
> > On Sunday 08 January 2012 12:43:09 Simon Glass wrote:
> >> On Sun, Jan 8, 2012 at 12:36 AM, Mike Frysinger wrote:
> >> > On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
> >> >> --- a/arch/arm/lib/bootm.c
> >> >> +++ b/arch/arm/lib/bootm.c
> >> >> 
> >> >>  static void announce_and_cleanup(void)
> >> >>  {
> >> >>       printf("\nStarting kernel ...\n\n");
> >> >> +     bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF,
> >> >> "start_kernel"); +#ifdef CONFIG_BOOTSTAGE_REPORT
> >> >> +     bootstage_report();
> >> >> +#endif
> >> > 
> >> > shouldn't the header make bootstage_report() into a stub when
> >> > CONFIG_BOOTSTAGE_REPORT isn't defined ?  then you won't need the ifdef
> >> > protection here.
> >> 
> >> Well maybe. I am hoping for a link error if someone calls it without
> >> defining that CONFIG. Otherwise it could be very confusing for people
> >> that they can't get a report!
> > 
> > i'm not sure we need worry about that
> 
> I have had another look at this. The idea is that anyone can call
> bootstage_report() to get a report, but if they define
> CONFIG_BOOTSTAGE_REPORT then one is printing automatically by U-Boot
> just before jumping to the kernel.
> 
> So I don't want this define to remove the ability to print a report,
> just to enable printing a report at a time which is hopefully
> suitable.
> 
> Does that make sense?

ok, so we have:
#ifdef CONFIG_BOOTSTAGE
extern void bootstage_report(void);
#else
#define bootstage_report()
#endif

and CONFIG_BOOTSTAGE_REPORT controls the automatic calls to the report func

is the arm-specific bootm hooks the best place for this ?  wouldn't putting 
this into the common bootm code be better ?
-mike 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120109/0804d153/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2012-01-08 17:42     ` Simon Glass
@ 2012-01-09 17:33       ` Mike Frysinger
  2012-01-12  5:41         ` Simon Glass
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-09 17:33 UTC (permalink / raw)
  To: u-boot

On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
> On Sun, Jan 8, 2012 at 12:35 AM, Mike Frysinger wrote:
> > On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
> >> --- a/include/bootstage.h
> >> +++ b/include/bootstage.h
> >> 
> >> +static inline ulong bootstage_mark(enum bootstage_id id)
> >>  {
> >> -     show_boot_progress(-val);
> >> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
> >> +     show_boot_progress(id);
> >> +#endif
> >> +     return 0;
> >>  }
> >> 
> >> +static inline ulong bootstage_error(enum bootstage_id id)
> >> +{
> >> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
> >> +     show_boot_progress(-id);
> >> +#endif
> >> +     return 0;
> >> +}
> > 
> > why isn't show_boot_progress() just a stub when CONFIG_SHOW_BOOT_PROGRESS
> > isn't defined ?  then you don't have to protect the call sites.
> 
> show_boot_progress() has been part of U-Boot for a while. Quite a lot
> of boards define this function with the expectation that they can turn
> CONFIG_SHOW_BOOT_PROGRESS on and off independently. So If I do what
> you suggest I will break that expectation.
> 
> One fix would be to bracket all show_boot_progress() function
> implementations in the boards with CONFIG_SHOW_BOOT_PROGRESS, but I
> haven't done that.

it seemed like part of your clean up series was to merge show_boot_progress() 
into your new bootstage framework.  in which case, we have full control over 
it now, and ifdef bracketing for it should go away ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120109/c8377936/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm
  2012-01-09 17:31           ` Mike Frysinger
@ 2012-01-12  5:38             ` Simon Glass
  0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2012-01-12  5:38 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Mon, Jan 9, 2012 at 9:31 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Sunday 08 January 2012 18:48:18 Simon Glass wrote:
>> On Sun, Jan 8, 2012 at 11:58 AM, Mike Frysinger wrote:
>> > On Sunday 08 January 2012 12:43:09 Simon Glass wrote:
>> >> On Sun, Jan 8, 2012 at 12:36 AM, Mike Frysinger wrote:
>> >> > On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
>> >> >> --- a/arch/arm/lib/bootm.c
>> >> >> +++ b/arch/arm/lib/bootm.c
>> >> >>
>> >> >> ?static void announce_and_cleanup(void)
>> >> >> ?{
>> >> >> ? ? ? printf("\nStarting kernel ...\n\n");
>> >> >> + ? ? bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF,
>> >> >> "start_kernel"); +#ifdef CONFIG_BOOTSTAGE_REPORT
>> >> >> + ? ? bootstage_report();
>> >> >> +#endif
>> >> >
>> >> > shouldn't the header make bootstage_report() into a stub when
>> >> > CONFIG_BOOTSTAGE_REPORT isn't defined ? ?then you won't need the ifdef
>> >> > protection here.
>> >>
>> >> Well maybe. I am hoping for a link error if someone calls it without
>> >> defining that CONFIG. Otherwise it could be very confusing for people
>> >> that they can't get a report!
>> >
>> > i'm not sure we need worry about that
>>
>> I have had another look at this. The idea is that anyone can call
>> bootstage_report() to get a report, but if they define
>> CONFIG_BOOTSTAGE_REPORT then one is printing automatically by U-Boot
>> just before jumping to the kernel.
>>
>> So I don't want this define to remove the ability to print a report,
>> just to enable printing a report at a time which is hopefully
>> suitable.
>>
>> Does that make sense?
>
> ok, so we have:
> #ifdef CONFIG_BOOTSTAGE
> extern void bootstage_report(void);
> #else
> #define bootstage_report()
> #endif
>
> and CONFIG_BOOTSTAGE_REPORT controls the automatic calls to the report func
>
> is the arm-specific bootm hooks the best place for this ? ?wouldn't putting
> this into the common bootm code be better ?

Well the intent is to do this at the last moment. I actually have a
patch which does a 'fake' run through all the bootm code and does the
report after that, so we see everything that is happening before we
settle on and print out our timings.

announce_and_cleanup() is about as close to the end as I can get :-)

Regards,
Simon


> -mike

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2012-01-09 17:33       ` Mike Frysinger
@ 2012-01-12  5:41         ` Simon Glass
  2012-01-15  1:09           ` Mike Frysinger
  0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2012-01-12  5:41 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Mon, Jan 9, 2012 at 9:33 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
>> On Sun, Jan 8, 2012 at 12:35 AM, Mike Frysinger wrote:
>> > On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
>> >> --- a/include/bootstage.h
>> >> +++ b/include/bootstage.h
>> >>
>> >> +static inline ulong bootstage_mark(enum bootstage_id id)
>> >> ?{
>> >> - ? ? show_boot_progress(-val);
>> >> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
>> >> + ? ? show_boot_progress(id);
>> >> +#endif
>> >> + ? ? return 0;
>> >> ?}
>> >>
>> >> +static inline ulong bootstage_error(enum bootstage_id id)
>> >> +{
>> >> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
>> >> + ? ? show_boot_progress(-id);
>> >> +#endif
>> >> + ? ? return 0;
>> >> +}
>> >
>> > why isn't show_boot_progress() just a stub when CONFIG_SHOW_BOOT_PROGRESS
>> > isn't defined ? ?then you don't have to protect the call sites.
>>
>> show_boot_progress() has been part of U-Boot for a while. Quite a lot
>> of boards define this function with the expectation that they can turn
>> CONFIG_SHOW_BOOT_PROGRESS on and off independently. So If I do what
>> you suggest I will break that expectation.
>>
>> One fix would be to bracket all show_boot_progress() function
>> implementations in the boards with CONFIG_SHOW_BOOT_PROGRESS, but I
>> haven't done that.
>
> it seemed like part of your clean up series was to merge show_boot_progress()
> into your new bootstage framework. ?in which case, we have full control over
> it now, and ifdef bracketing for it should go away ...

Still don't quite get it though. For example, the beagle board defines
show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
wouldn't that break that board?

The series as is was tested MAKEALL clean.

Regards,
Simon

> -mike

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2012-01-12  5:41         ` Simon Glass
@ 2012-01-15  1:09           ` Mike Frysinger
  2012-01-15  1:16             ` Simon Glass
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-15  1:09 UTC (permalink / raw)
  To: u-boot

On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
> On Mon, Jan 9, 2012 at 9:33 AM, Mike Frysinger wrote:
> > On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
> >> On Sun, Jan 8, 2012 at 12:35 AM, Mike Frysinger wrote:
> >> > On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
> >> >> --- a/include/bootstage.h
> >> >> +++ b/include/bootstage.h
> >> >> 
> >> >> +static inline ulong bootstage_mark(enum bootstage_id id)
> >> >>  {
> >> >> -     show_boot_progress(-val);
> >> >> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
> >> >> +     show_boot_progress(id);
> >> >> +#endif
> >> >> +     return 0;
> >> >>  }
> >> >> 
> >> >> +static inline ulong bootstage_error(enum bootstage_id id)
> >> >> +{
> >> >> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
> >> >> +     show_boot_progress(-id);
> >> >> +#endif
> >> >> +     return 0;
> >> >> +}
> >> > 
> >> > why isn't show_boot_progress() just a stub when
> >> > CONFIG_SHOW_BOOT_PROGRESS isn't defined ?  then you don't have to
> >> > protect the call sites.
> >> 
> >> show_boot_progress() has been part of U-Boot for a while. Quite a lot
> >> of boards define this function with the expectation that they can turn
> >> CONFIG_SHOW_BOOT_PROGRESS on and off independently. So If I do what
> >> you suggest I will break that expectation.
> >> 
> >> One fix would be to bracket all show_boot_progress() function
> >> implementations in the boards with CONFIG_SHOW_BOOT_PROGRESS, but I
> >> haven't done that.
> > 
> > it seemed like part of your clean up series was to merge
> > show_boot_progress() into your new bootstage framework.  in which case,
> > we have full control over it now, and ifdef bracketing for it should go
> > away ...
> 
> Still don't quite get it though. For example, the beagle board defines
> show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
> wouldn't that break that board?

that sounds like an odd-man-out that needs fixing rather than allowing to live
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120114/b5f56ed5/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2012-01-15  1:09           ` Mike Frysinger
@ 2012-01-15  1:16             ` Simon Glass
  2012-01-15  1:22               ` Mike Frysinger
  0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2012-01-15  1:16 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sat, Jan 14, 2012 at 5:09 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
>> On Mon, Jan 9, 2012 at 9:33 AM, Mike Frysinger wrote:
>> > On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
>> >> On Sun, Jan 8, 2012 at 12:35 AM, Mike Frysinger wrote:
>> >> > On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
>> >> >> --- a/include/bootstage.h
>> >> >> +++ b/include/bootstage.h
>> >> >>
>> >> >> +static inline ulong bootstage_mark(enum bootstage_id id)
>> >> >> ?{
>> >> >> - ? ? show_boot_progress(-val);
>> >> >> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
>> >> >> + ? ? show_boot_progress(id);
>> >> >> +#endif
>> >> >> + ? ? return 0;
>> >> >> ?}
>> >> >>
>> >> >> +static inline ulong bootstage_error(enum bootstage_id id)
>> >> >> +{
>> >> >> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
>> >> >> + ? ? show_boot_progress(-id);
>> >> >> +#endif
>> >> >> + ? ? return 0;
>> >> >> +}
>> >> >
>> >> > why isn't show_boot_progress() just a stub when
>> >> > CONFIG_SHOW_BOOT_PROGRESS isn't defined ? ?then you don't have to
>> >> > protect the call sites.
>> >>
>> >> show_boot_progress() has been part of U-Boot for a while. Quite a lot
>> >> of boards define this function with the expectation that they can turn
>> >> CONFIG_SHOW_BOOT_PROGRESS on and off independently. So If I do what
>> >> you suggest I will break that expectation.
>> >>
>> >> One fix would be to bracket all show_boot_progress() function
>> >> implementations in the boards with CONFIG_SHOW_BOOT_PROGRESS, but I
>> >> haven't done that.
>> >
>> > it seemed like part of your clean up series was to merge
>> > show_boot_progress() into your new bootstage framework. ?in which case,
>> > we have full control over it now, and ifdef bracketing for it should go
>> > away ...
>>
>> Still don't quite get it though. For example, the beagle board defines
>> show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
>> wouldn't that break that board?
>
> that sounds like an odd-man-out that needs fixing rather than allowing to live

Fair enough. although I suspect there will be many. If I could
actually get a MAKEALL to run without producing 100s of broken boards
then it would be easier to do this sort of thing. At the moment it's
like looking for a needle in a haystack. My warnings series aimed to
improve things slightly, but I don't think others have these problems.

Regards,
Simon

> -mike

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2012-01-15  1:16             ` Simon Glass
@ 2012-01-15  1:22               ` Mike Frysinger
  2012-01-15  1:27                 ` Simon Glass
  0 siblings, 1 reply; 46+ messages in thread
From: Mike Frysinger @ 2012-01-15  1:22 UTC (permalink / raw)
  To: u-boot

On Saturday 14 January 2012 20:16:35 Simon Glass wrote:
> On Sat, Jan 14, 2012 at 5:09 PM, Mike Frysinger wrote:
> > On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
> >> Still don't quite get it though. For example, the beagle board defines
> >> show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
> >> wouldn't that break that board?
> > 
> > that sounds like an odd-man-out that needs fixing rather than allowing to
> > live
> 
> Fair enough. although I suspect there will be many. If I could
> actually get a MAKEALL to run without producing 100s of broken boards
> then it would be easier to do this sort of thing. At the moment it's
> like looking for a needle in a haystack. My warnings series aimed to
> improve things slightly, but I don't think others have these problems.

that's fair.  if it's a small # of boards, i'd prefer to migrate them.  if 
it's a lot more, we can punt for now (add to the TODO?) and add comments to 
the code why we have these checks.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120114/bceb37f4/attachment.pgp>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2012-01-15  1:22               ` Mike Frysinger
@ 2012-01-15  1:27                 ` Simon Glass
  2012-02-13 23:27                   ` Simon Glass
  0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2012-01-15  1:27 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sat, Jan 14, 2012 at 5:22 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 14 January 2012 20:16:35 Simon Glass wrote:
>> On Sat, Jan 14, 2012 at 5:09 PM, Mike Frysinger wrote:
>> > On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
>> >> Still don't quite get it though. For example, the beagle board defines
>> >> show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
>> >> wouldn't that break that board?
>> >
>> > that sounds like an odd-man-out that needs fixing rather than allowing to
>> > live
>>
>> Fair enough. although I suspect there will be many. If I could
>> actually get a MAKEALL to run without producing 100s of broken boards
>> then it would be easier to do this sort of thing. At the moment it's
>> like looking for a needle in a haystack. My warnings series aimed to
>> improve things slightly, but I don't think others have these problems.
>
> that's fair. ?if it's a small # of boards, i'd prefer to migrate them. ?if
> it's a lot more, we can punt for now (add to the TODO?) and add comments to
> the code why we have these checks.

OK, I don't know the answer to that but will try it out, and adjust
that patch as needed.

Regards,
Simon

> -mike

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement
  2012-01-15  1:27                 ` Simon Glass
@ 2012-02-13 23:27                   ` Simon Glass
  0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2012-02-13 23:27 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sat, Jan 14, 2012 at 5:27 PM, Simon Glass <sjg@chromium.org> wrote:

> Hi Mike,
>
> On Sat, Jan 14, 2012 at 5:22 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On Saturday 14 January 2012 20:16:35 Simon Glass wrote:
> >> On Sat, Jan 14, 2012 at 5:09 PM, Mike Frysinger wrote:
> >> > On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
> >> >> Still don't quite get it though. For example, the beagle board
> defines
> >> >> show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS,
> so
> >> >> wouldn't that break that board?
> >> >
> >> > that sounds like an odd-man-out that needs fixing rather than
> allowing to
> >> > live
> >>
> >> Fair enough. although I suspect there will be many. If I could
> >> actually get a MAKEALL to run without producing 100s of broken boards
> >> then it would be easier to do this sort of thing. At the moment it's
> >> like looking for a needle in a haystack. My warnings series aimed to
> >> improve things slightly, but I don't think others have these problems.
> >
> > that's fair.  if it's a small # of boards, i'd prefer to migrate them.
>  if
> > it's a lot more, we can punt for now (add to the TODO?) and add comments
> to
> > the code why we have these checks.
>
> OK, I don't know the answer to that but will try it out, and adjust
> that patch as needed.
>

I have got back to this now - it seem that I can rely on the existing weak
function, so I will do so.

I only want to update two of the patches, so will just send those ones. The
rest should be fine as is.

Regards,
SImon

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2012-02-13 23:27 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [U-Boot] [RFC PATCH v2 06/15] bootstage: Convert progress numbers 20-41 " Simon Glass
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

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.