[U-Boot] [PATCH v3 14/15] bootstage: Plumb in bootstage calls for basic operations
Simon Glass
sjg at chromium.org
Sun Jan 15 02:24:57 CET 2012
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 at 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 78b7113..0606096 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 320667f..8115f4e 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -513,6 +513,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.7.3
More information about the U-Boot
mailing list