All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...()
@ 2012-02-13 23:51 Simon Glass
  2012-02-13 23:51 ` [U-Boot] [PATCH v4 13/15] bootstage: Implement core microsecond boot time measurement Simon Glass
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Simon Glass @ 2012-02-13 23:51 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>
---
Changes in v4:
- Adjust bootstage.h header to fix build warnings (bisect problem)

 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 +++++++++---------
 include/bootstage.h                    |   30 ++++++++++-
 net/eth.c                              |    6 +-
 post/post.c                            |    4 +-
 23 files changed, 175 insertions(+), 156 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 249ac1b..f114cd6 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 37f162a..53dc4df 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 ea3df8f..78b7113 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -230,36 +230,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 41e2f26..c33d22d 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -228,7 +228,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 8b097bf..ff2bb68 100644
--- a/common/image.c
+++ b/common/image.c
@@ -373,37 +373,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;
 	}
 
@@ -895,7 +895,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);
 
@@ -912,14 +912,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) {
 				/*
@@ -927,14 +927,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;
 				}
@@ -949,21 +949,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;
@@ -972,10 +972,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;
@@ -983,10 +983,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;
@@ -1006,7 +1006,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);
@@ -1016,7 +1016,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;
 	}
 
@@ -1100,7 +1100,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 ... ",
@@ -3175,23 +3175,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/include/bootstage.h b/include/bootstage.h
index 8f7fcd7..b56d953 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -178,9 +178,35 @@ enum bootstage_id {
  *		has occurred.
  */
 void show_boot_progress(int val);
-static inline void show_boot_error(int val)
+
+#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);
+
+#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
+ */
+
+static inline ulong bootstage_mark(enum bootstage_id id)
+{
+	show_boot_progress(id);
+	return 0;
+}
+
+static inline ulong bootstage_error(enum bootstage_id id)
 {
-	show_boot_progress(-val);
+	show_boot_progress(-id);
+	return 0;
 }
 
+#endif /* CONFIG_BOOTSTAGE */
+
 #endif
diff --git a/net/eth.c b/net/eth.c
index 8fc84bc..9000fc7 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -230,7 +230,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
@@ -260,12 +260,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 (dev->index)
 				puts (", ");
diff --git a/post/post.c b/post/post.c
index 9764e1d..7100d8b 100644
--- a/post/post.c
+++ b/post/post.c
@@ -158,7 +158,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);
 			}
 		}
 	}
@@ -295,7 +295,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.7.3

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

* [U-Boot] [PATCH v4 13/15] bootstage: Implement core microsecond boot time measurement
  2012-02-13 23:51 [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Simon Glass
@ 2012-02-13 23:51 ` Simon Glass
  2012-03-18 20:42   ` Wolfgang Denk
  2012-02-13 23:51 ` [U-Boot] [PATCH v4 15/15] bootstage: arm: Add bootstage calls in board and bootm Simon Glass
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2012-02-13 23:51 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>
---
Changes in v3:
- Fix code style in bootstage_mark_name()
- Make main bootstage commit title more explicit

Changes in v4:
- Print times in unsigned format, and increase range
- Remove guards around calls to show_boot_progress()
- Sort by unsigned value to account for large time values

 README              |   25 ++++++++
 common/Makefile     |    1 +
 common/bootstage.c  |  158 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/bootstage.h |   43 ++++++++++++++
 4 files changed, 227 insertions(+), 0 deletions(-)
 create mode 100644 common/bootstage.c

diff --git a/README b/README
index b6c9d0b..4c21924 100644
--- a/README
+++ b/README
@@ -2241,6 +2241,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 2d9ae8c..038baf0 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -172,6 +172,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..d2bbe63
--- /dev/null
+++ b/common/bootstage.c
@@ -0,0 +1,158 @@
+/*
+ * 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 */
+	show_boot_progress(flags & BOOTSTAGEF_ERROR ? -id : id);
+	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[15], *s;
+	int grab = 3;
+
+	/* We don't seem to have %'d in U-Boot */
+	sprintf(str, "%12lu", us_time);
+	for (s = str + 3; *s; s += grab) {
+		if (s != str + 3)
+			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 ? 1 : -1;
+}
+
+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 b56d953..06ab2c8 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -26,6 +26,11 @@
 #ifndef _BOOTSTAGE_H
 #define _BOOTSTAGE_H
 
+/* 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
@@ -169,6 +174,33 @@ 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,
 };
 
 /*
@@ -189,6 +221,11 @@ 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(),
@@ -207,6 +244,12 @@ static inline ulong bootstage_error(enum bootstage_id id)
 	return 0;
 }
 
+static inline ulong bootstage_mark_name(enum bootstage_id id, const char *name)
+{
+	return 0;
+}
+
+
 #endif /* CONFIG_BOOTSTAGE */
 
 #endif
-- 
1.7.7.3

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

* [U-Boot] [PATCH v4 15/15] bootstage: arm: Add bootstage calls in board and bootm
  2012-02-13 23:51 [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Simon Glass
  2012-02-13 23:51 ` [U-Boot] [PATCH v4 13/15] bootstage: Implement core microsecond boot time measurement Simon Glass
@ 2012-02-13 23:51 ` Simon Glass
  2012-03-18 20:43   ` Wolfgang Denk
  2012-03-18 20:41 ` [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Wolfgang Denk
  2012-03-19  8:34 ` Wolfgang Denk
  3 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2012-02-13 23:51 UTC (permalink / raw)
  To: u-boot

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

The idea here is you can call bootstage_report() to get a report.
Additionally, if you define CONFIG_BOOTSTAGE_REPORT then a report is
printed automatically by U-Boot just before jumping to the kernel.

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

Changes in v3:
- Update commit message to clarify the purpose of CONFIG_BOOTSTAGE_REPORT

Changes in v4:
- Fix up ARM bootstage calls to use correct names

 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 500e216..b9b35de 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_F, "board_init_f");
+
 	/* 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_R, "board_init_r");
 
 	monitor_flash_len = _end_ofs;
 
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index f114cd6..2961ab2 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.7.3

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

* [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...()
  2012-02-13 23:51 [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Simon Glass
  2012-02-13 23:51 ` [U-Boot] [PATCH v4 13/15] bootstage: Implement core microsecond boot time measurement Simon Glass
  2012-02-13 23:51 ` [U-Boot] [PATCH v4 15/15] bootstage: arm: Add bootstage calls in board and bootm Simon Glass
@ 2012-03-18 20:41 ` Wolfgang Denk
  2012-03-19  8:34 ` Wolfgang Denk
  3 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2012-03-18 20:41 UTC (permalink / raw)
  To: u-boot

Dear Simon Glass,

In message <1329177081-29496-13-git-send-email-sjg@chromium.org> you wrote:
> 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>
> ---
> Changes in v4:
> - Adjust bootstage.h header to fix build warnings (bisect problem)
> 
>  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 +++++++++---------
>  include/bootstage.h                    |   30 ++++++++++-
>  net/eth.c                              |    6 +-
>  post/post.c                            |    4 +-
>  23 files changed, 175 insertions(+), 156 deletions(-)

Applied (with fixes), thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No question is too silly to ask. Of course, some  questions  are  too
silly to to answer...  - L. Wall & R. L. Schwartz, _Programming Perl_

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

* [U-Boot] [PATCH v4 13/15] bootstage: Implement core microsecond boot time measurement
  2012-02-13 23:51 ` [U-Boot] [PATCH v4 13/15] bootstage: Implement core microsecond boot time measurement Simon Glass
@ 2012-03-18 20:42   ` Wolfgang Denk
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2012-03-18 20:42 UTC (permalink / raw)
  To: u-boot

Dear Simon Glass,

In message <1329177081-29496-14-git-send-email-sjg@chromium.org> you 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.
> 
> 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>
> ---
> Changes in v3:
> - Fix code style in bootstage_mark_name()
> - Make main bootstage commit title more explicit
> 
> Changes in v4:
> - Print times in unsigned format, and increase range
> - Remove guards around calls to show_boot_progress()
> - Sort by unsigned value to account for large time values
> 
>  README              |   25 ++++++++
>  common/Makefile     |    1 +
>  common/bootstage.c  |  158 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/bootstage.h |   43 ++++++++++++++
>  4 files changed, 227 insertions(+), 0 deletions(-)
>  create mode 100644 common/bootstage.c

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"In matrimony, to hesitate is sometimes to be saved."        - Butler

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

* [U-Boot] [PATCH v4 15/15] bootstage: arm: Add bootstage calls in board and bootm
  2012-02-13 23:51 ` [U-Boot] [PATCH v4 15/15] bootstage: arm: Add bootstage calls in board and bootm Simon Glass
@ 2012-03-18 20:43   ` Wolfgang Denk
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2012-03-18 20:43 UTC (permalink / raw)
  To: u-boot

Dear Simon Glass,

In message <1329177081-29496-16-git-send-email-sjg@chromium.org> you wrote:
> Add calls to bootstage before and after relocation, and just
> before jumping to the OS.
> 
> The idea here is you can call bootstage_report() to get a report.
> Additionally, if you define CONFIG_BOOTSTAGE_REPORT then a report is
> printed automatically by U-Boot just before jumping to the kernel.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> Changes in v2:
> - Unify show_boot_progress() into this series
> 
> Changes in v3:
> - Update commit message to clarify the purpose of CONFIG_BOOTSTAGE_REPORT
> 
> Changes in v4:
> - Fix up ARM bootstage calls to use correct names
> 
>  arch/arm/lib/board.c |    3 +++
>  arch/arm/lib/bootm.c |    4 ++++
>  2 files changed, 7 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Our universe is a fragile house of atoms, held together by the mortar
of cause-and-effect. One magician would be two too many.
                        - Terry Pratchett, _The Dark Side of the Sun_

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

* [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...()
  2012-02-13 23:51 [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Simon Glass
                   ` (2 preceding siblings ...)
  2012-03-18 20:41 ` [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Wolfgang Denk
@ 2012-03-19  8:34 ` Wolfgang Denk
  2012-03-20  6:17   ` Simon Glass
  3 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2012-03-19  8:34 UTC (permalink / raw)
  To: u-boot

Dear Simon Glass,

In message <1329177081-29496-13-git-send-email-sjg@chromium.org> you wrote:
> 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>
> ---
> Changes in v4:
> - Adjust bootstage.h header to fix build warnings (bisect problem)

Actually not all bisect issues have been fixed.  Commit
5dc8871 bootstage: Convert progress numbers 1-9 into enums
breaks build with this error:

image.c: In function 'boot_get_ramdisk':
image.c:898: error: 'BOOTSTAGE_ID_LOAD_RAMDISK' undeclared (first use in this function)
image.c:898: error: (Each undeclared identifier is reported only once
image.c:898: error: for each function it appears in.)


Also, the v4 12/15 commit breaks the ETX094 board when building with
ELDK 4.2 due to grown code size:

Before (v2011.12-511-g5ff5539)

   text    data     bss     dec     hex filename
  17752    1026    2585   21363    5373 /work/wd/tmp-ppc/net/libnet.o

After (v2011.12-512-g77060e):

   text    data     bss     dec     hex filename
  17788    1026    2585   21399    5397 /work/wd/tmp-ppc/net/libnet.o

Yes, the increase is small, but the linker map for this board is
carefully crafted ;-)


I think I can fix this, though.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Wenn das dann in die Hose geht, nehme ich es auf meine Kappe.
                                         -- Rudi V?ller, 15. Nov 2003

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

* [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...()
  2012-03-19  8:34 ` Wolfgang Denk
@ 2012-03-20  6:17   ` Simon Glass
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2012-03-20  6:17 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

On Mon, Mar 19, 2012 at 1:34 AM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Simon Glass,
>
> In message <1329177081-29496-13-git-send-email-sjg@chromium.org> you wrote:
>> 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>
>> ---
>> Changes in v4:
>> - Adjust bootstage.h header to fix build warnings (bisect problem)
>
> Actually not all bisect issues have been fixed. ?Commit
> 5dc8871 bootstage: Convert progress numbers 1-9 into enums
> breaks build with this error:
>
> image.c: In function 'boot_get_ramdisk':
> image.c:898: error: 'BOOTSTAGE_ID_LOAD_RAMDISK' undeclared (first use in this function)
> image.c:898: error: (Each undeclared identifier is reported only once
> image.c:898: error: for each function it appears in.)

Yes you are right I'm afraid.

>
>
> Also, the v4 12/15 commit breaks the ETX094 board when building with
> ELDK 4.2 due to grown code size:
>
> Before (v2011.12-511-g5ff5539)
>
> ? text ? ?data ? ? bss ? ? dec ? ? hex filename
> ?17752 ? ?1026 ? ?2585 ? 21363 ? ?5373 /work/wd/tmp-ppc/net/libnet.o
>
> After (v2011.12-512-g77060e):
>
> ? text ? ?data ? ? bss ? ? dec ? ? hex filename
> ?17788 ? ?1026 ? ?2585 ? 21399 ? ?5397 /work/wd/tmp-ppc/net/libnet.o
>
> Yes, the increase is small, but the linker map for this board is
> carefully crafted ;-)
>
>
> I think I can fix this, though.

Oh dear. The problem is that for my toolchain both builds fails as the
code is too large. It doesn't show up as a difference. I tried with
ELDK 4.2 - the overflow seems to be only 12 bytes!

Can you fix it by adjusting the bootstage code or is something else required.

Regards,
Simon

>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> Wenn das dann in die Hose geht, nehme ich es auf meine Kappe.
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? -- Rudi V?ller, 15. Nov 2003

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

end of thread, other threads:[~2012-03-20  6:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-13 23:51 [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Simon Glass
2012-02-13 23:51 ` [U-Boot] [PATCH v4 13/15] bootstage: Implement core microsecond boot time measurement Simon Glass
2012-03-18 20:42   ` Wolfgang Denk
2012-02-13 23:51 ` [U-Boot] [PATCH v4 15/15] bootstage: arm: Add bootstage calls in board and bootm Simon Glass
2012-03-18 20:43   ` Wolfgang Denk
2012-03-18 20:41 ` [U-Boot] [PATCH v4 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...() Wolfgang Denk
2012-03-19  8:34 ` Wolfgang Denk
2012-03-20  6:17   ` 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.