[U-Boot] [PATCH 3/4] Add bootstage calls in places appropriate for network booting

Simon Glass sjg at chromium.org
Fri May 13 22:52:02 CEST 2011


This adds calls to to the bootstage_mark() function at various places
through the boot process.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 arch/arm/lib/board.c |    2 ++
 arch/arm/lib/bootm.c |    1 +
 common/cmd_bootm.c   |    2 ++
 common/cmd_net.c     |    7 ++++++-
 common/cmd_usb.c     |    1 +
 net/bootp.c          |    3 +++
 net/net.c            |    1 +
 7 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 1a784a1..13a86c3 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -275,6 +275,8 @@ void board_init_f (ulong bootflag)
 	gd_t *id;
 	ulong addr, addr_sp;
 
+	bootstage_mark(BOOTSTAGE_START_UBOOT, "start_armboot");
+
 	/* 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 */
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 802e833..b763403 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -83,6 +83,7 @@ void arch_lmb_reserve(struct lmb *lmb)
 static void announce_and_cleanup(void)
 {
 	printf("\nStarting kernel ...\n\n");
+	bootstage_mark(BOOTSTAGE_BOOTM_HANDOFF, "start_kernel");
 
 #ifdef CONFIG_USB_DEVICE
 	{
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 1966da4..212e510 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -221,6 +221,8 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 
 	bootm_start_lmb();
 
+	bootstage_mark(BOOTSTAGE_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 8c6f5c8..49f8ffd 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 (TFTP, cmdtp, argc, argv);
+	int ret;
+
+	bootstage_mark(BOOTSTAGE_KERNELREAD_START, "tftp start");
+	ret = netboot_common(TFTP, cmdtp, argc, argv);
+	bootstage_mark(BOOTSTAGE_KERNELREAD_STOP, "tftp done");
+	return ret;
 }
 
 U_BOOT_CMD(
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 3ba6fff..c7b30a0 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -522,6 +522,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(BOOTSTAGE_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 4db63cb..043f9e0 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -311,6 +311,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(BOOTSTAGE_BOOTP_STOP, "bootp_stop");
 
 	debug("Got good BOOTP\n");
 
@@ -552,6 +553,7 @@ BootpRequest (void)
 	Bootp_t *bp;
 	int ext_len, pktlen, iplen;
 
+	bootstage_mark(BOOTSTAGE_BOOTP_START, "bootp_start");
 #if defined(CONFIG_CMD_DHCP)
 	dhcp_state = INIT;
 #endif
@@ -914,6 +916,7 @@ 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(BOOTSTAGE_BOOTP_STOP, "bootp_stop");
 
 			/* Obey the 'autoload' setting */
 			if ((s = getenv("autoload")) != NULL) {
diff --git a/net/net.c b/net/net.c
index 2abf879..5ff99b6 100644
--- a/net/net.c
+++ b/net/net.c
@@ -377,6 +377,7 @@ NetLoop(proto_t protocol)
 		NetArpWaitTxPacketSize = 0;
 	}
 
+	bootstage_mark(BOOTSTAGE_ETH_START, "eth_start");
 	eth_halt();
 #ifdef CONFIG_NET_MULTI
 	eth_set_current();
-- 
1.7.3.1



More information about the U-Boot mailing list