bootstage: record and publish boot progress timing
Subsystems (9)
v2 cover bootstage: record and publish boot progress timing
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
Signature · 1 line
1.7.3.1
RFC PATCH v2 1/15 bootstage: Create an initial header for boot progress integers
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.
---
include/bootstage.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/common.h | 6 +--- 2 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 include/bootstage.h
include/bootstage.h new file +61 -0
@@ -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
include/common.h +2 -4
@@ -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
Signature · 1 line
1.7.3.1
RFC PATCH v2 1/15 bootstage: Create an initial header for boot progress integers
include/bootstage.h line 29
Quoted 8 lines · On Saturday 10 December 2011 16:07:53 Simon Glass wrote:
include/bootstage.h new file +5
-0+/* +* 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
Quoted 2 lines
+ * progres action1
typo ? shows up a few times ...
include/bootstage.h line 50
Quoted 3 lines
include/bootstage.h new file +3
-0+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.
Quoted 2 lines
+/*
+ * Board-specific platform code can implementshow_boot_progress() if
"board-specific platform" is kind of redundant
also, no space before "()"
Quoted 9 lines
include/common.h +0
-2@@ -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 - */
include/common.h int pcmcia_init (void); · line 808
Quoted 6 lines
include/common.h +2
-1-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>
RFC PATCH v2 1/15 bootstage: Create an initial header for boot progress integers
Hi Mike,
Quoted 3 lines · Mike Frysinger
include/bootstage.h
Quoted 2 lines · On Saturday 10 December 2011 16:07:53 Simon Glass wrote:
include/bootstage.h new file +0
-0
Thanks for looking at this.
Quoted 9 lines
Quoted 6 lines
+/*
+ * 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
Quoted 5 lines
Quoted 3 lines
+ * progres action1
typo ? ?shows up a few times ...
done
Quoted 8 lines
include/bootstage.h line 50
Quoted 4 lines
include/bootstage.h new file +3
-0+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.
Quoted 7 lines
Quoted 3 lines
+/*
+ * Board-specific platform code can implementshow_boot_progress() if"board-specific platform" is kind of redundant
also, no space before "()"
done
Quoted 14 lines
Quoted 14 lines
include/common.h +0
-0@@ -801,10 +801,8 @@ int ? ? ?pcmcia_init (void);?#ifdef
CONFIG_STATUS_LED
?# include <status_led.h>
?#endif
-/*
- * Board-specific Platform code can reimplementshow_boot_progress() if needed - */include/common.h +2
-1-void show_boot_progress (int val); + +#include <bootstage.h>
Quoted 2 lines
Quoted 2 lines
?/* Multicore arch functions */
?#ifdefCONFIG_MP
Regards,
Simon
RFC PATCH v2 1/15 bootstage: Create an initial header for boot progress integers
Quoted 10 lines · On Sunday 08 January 2012 12:22:54 Simon Glass wrote:
Quoted 8 lines · Mike Frysinger
include/bootstage.h line 50
Quoted 3 lines · On Saturday 10 December 2011 16:07:53 Simon Glass wrote:
include/bootstage.h new file +3
-0+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.
Quoted 2 lines
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 :)
Quoted 3 lines
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>
RFC PATCH v2 1/15 bootstage: Create an initial header for boot progress integers
Hi Mike,
Quoted 11 lines · Mike Frysinger
Quoted 10 lines · On Sunday 08 January 2012 12:22:54 Simon Glass wrote:
Quoted 8 lines · Mike Frysinger
include/bootstage.h line 50
Quoted 3 lines · On Saturday 10 December 2011 16:07:53 Simon Glass wrote:
include/bootstage.h new file +3
-0+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.
Quoted 5 lines
Quoted 2 lines
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.
Quoted 5 lines
Quoted 3 lines
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
Quoted 1 line
-mike
RFC PATCH v2 2/15 bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
In reply to Simon GlassThis 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.
---
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(-)
arch/arm/lib/bootm.c +1 -1
@@ -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)
arch/avr32/lib/bootm.c +1 -1
@@ -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);
arch/m68k/lib/bootm.c +1 -1
@@ -104,7 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imadebug ("## 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):
arch/microblaze/lib/bootm.c +1 -1
@@ -59,7 +59,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imaif (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 );
arch/mips/lib/bootm.c +1 -1
@@ -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",
arch/mips/lib/bootm_qemu_mips.c +1 -1
@@ -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);
arch/nds32/lib/bootm.c +1 -1
@@ -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);
arch/powerpc/lib/bootm.c +1 -1
@@ -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 ();
board/Seagate/dockstar/dockstar.c +1 -1
@@ -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 */
board/a4m072/a4m072.c +1 -1
@@ -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
board/bf533-stamp/bf533-stamp.c +1 -1
@@ -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 :
board/matrix_vision/mvbc_p/mvbc_p.c +1 -1
@@ -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 :
board/pcs440ep/pcs440ep.c +1 -2
@@ -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 );
board/sixnet/sixnet.c +1 -1
@@ -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 ); }
board/ti/beagle/beagle.c +1 -1
@@ -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 (); }
common/cmd_bootm.c +4 -4
@@ -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:
Signature · 1 line
1.7.3.1
RFC PATCH v2 2/15 bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
-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>
RFC PATCH v2 3/15 bootstage: Use show_boot_error() for -ve progress numbers
In reply to Simon GlassRather than the caller negating our progress numbers to indicate an error has occurred, which seems hacky, add a function to indicate this.
---
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(-)
arch/powerpc/lib/board.c +1 -1
@@ -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 (;;) ; }
arch/sparc/lib/board.c +1 -1
@@ -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 (;;) ; }
common/cmd_bootm.c +25 -25
200 lines not on this page · raw message
common/cmd_ide.c +11 -11
@@ -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 ; }
common/cmd_nand.c +8 -8
@@ -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 );
common/cmd_net.c +4 -4
@@ -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;
common/env_common.c +1 -1
@@ -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 {
common/image.c +11 -11
@@ -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 ; }
include/bootstage.h +4 -0
@@ -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
net/eth.c +1 -1
@@ -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" );
post/post.c +2 -2
@@ -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 ;
Signature · 1 line
1.7.3.1
RFC PATCH v2 3/15 bootstage: Use show_boot_error() for -ve progress numbers
-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>
RFC PATCH v2 4/15 bootstage: Convert progress numbers 1-9 into enums
In reply to Simon Glass---
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(-)
board/bf533-stamp/bf533-stamp.c +9 -9
@@ -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 :
board/hermes/hermes.c +1 -1
@@ -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 )); }
board/ivm/ivm.c +1 -1
@@ -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 */
board/matrix_vision/common/mv_common.c +1 -1
@@ -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; }
board/matrix_vision/mvbc_p/mvbc_p.c +1 -1
@@ -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 :
board/pcs440ep/pcs440ep.c +11 -11
@@ -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 */
common/cmd_bootm.c +20 -21
146 lines not on this page · raw message
common/image.c +1 -1
@@ -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);
include/bootstage.h +14 -0
@@ -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 */ };
Signature · 1 line
1.7.3.1
RFC PATCH v2 4/15 bootstage: Convert progress numbers 1-9 into enums
include/bootstage.h line 53
Quoted 9 lines · On Saturday 10 December 2011 16:07:56 Simon Glass wrote:
include/bootstage.h +5
-0enum 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>
RFC PATCH v2 4/15 bootstage: Convert progress numbers 1-9 into enums
Hi Mike,
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Saturday 10 December 2011 16:07:56 Simon Glass wrote:
include/bootstage.h +0
-0
Quoted 10 lines
Quoted 6 lines
?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
RFC PATCH v2 5/15 bootstage: Convert progress numbers 10-19 to enums
In reply to Simon Glass---
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(-)
board/bf533-stamp/bf533-stamp.c +5 -5
@@ -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 ;
board/matrix_vision/mvbc_p/mvbc_p.c +1 -1
@@ -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 :
common/image.c +10 -10
@@ -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 ... ",
include/bootstage.h +7 -0
@@ -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 */ };
Signature · 1 line
1.7.3.1
RFC PATCH v2 5/15 bootstage: Convert progress numbers 10-19 to enums
not sure why this isn't just squashed into 04/15, but whatever
-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>
RFC PATCH v2 5/15 bootstage: Convert progress numbers 10-19 to enums
Hi Mike,
Quoted 2 lines · Mike Frysinger
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.
Quoted 2 lines
Acked-by Mike Frysinger <[email protected]>-mike
Thanks
Regards,
Simon
RFC PATCH v2 6/15 bootstage: Convert progress numbers 20-41 to enums
In reply to Simon Glass---
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(-)
arch/powerpc/lib/board.c +1 -1
@@ -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 (;;) ; }
arch/sparc/lib/board.c +1 -1
@@ -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 (;;) ; }
arch/x86/lib/board.c +9 -9
@@ -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 (;;)
board/hermes/hermes.c +3 -1
@@ -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;
board/pcs440ep/pcs440ep.c +2 -1
@@ -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 ();
include/bootstage.h +25 -0
@@ -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 */ + };/*
post/post.c +2 -2
@@ -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 ;
Signature · 1 line
1.7.3.1
RFC PATCH v2 7/15 bootstage: Convert IDE progress numbers to enums
In reply to Simon GlassThis changes over the IDE progress numbers to use enums from bootstage.h.
---
common/cmd_ide.c | 46 +++++++++++++++++++++++----------------------- include/bootstage.h | 14 ++++++++++++++ 2 files changed, 37 insertions(+), 23 deletions(-)
common/cmd_ide.c +23 -23
@@ -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
include/bootstage.h +14 -0
@@ -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, };/*
Signature · 1 line
1.7.3.1
RFC PATCH v2 8/15 bootstage: Convert NAND progress numbers to enums
In reply to Simon GlassThis changes over the NAND progress numbers to use enums from bootstage.h.
---
common/cmd_nand.c | 34 +++++++++++++++++----------------- include/bootstage.h | 15 +++++++++++++++ 2 files changed, 32 insertions(+), 17 deletions(-)
common/cmd_nand.c +17 -17
@@ -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 ]); }
include/bootstage.h +15 -0
@@ -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, };/*
Signature · 1 line
1.7.3.1
RFC PATCH v2 9/15 bootstage: Convert net progress numbers to enums
In reply to Simon GlassThis changes over the network-related progress numbers to use enums from bootstage.h.
---
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(-)
board/Seagate/dockstar/dockstar.c +1 -1
@@ -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 :
board/matrix_vision/mvbc_p/mvbc_p.c +1 -1
@@ -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 :
board/pcs440ep/pcs440ep.c +12 -12
@@ -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
common/cmd_net.c +8 -8
@@ -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; }
common/env_common.c +1 -1
@@ -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 {
include/bootstage.h +11 -0
@@ -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,
net/eth.c +3 -3
@@ -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 (", ");
Signature · 1 line
1.7.3.1
RFC PATCH v2 10/15 bootstage: Convert FIT progress numbers to enums
In reply to Simon GlassThis changes over all the FIT image progress numbers to use enums from bootstage.h.
---
common/cmd_bootm.c | 44 ++++++++++++++++++++++---------------------- common/image.c | 36 ++++++++++++++++++++---------------- include/bootstage.h | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 38 deletions(-)
common/cmd_bootm.c +22 -22
@@ -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 ; }
common/image.c +20 -16
@@ -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 */
include/bootstage.h +38 -0
@@ -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,
Signature · 1 line
1.7.3.1
RFC PATCH v2 11/15 bootstage: Define an optional microsecond timer
In reply to Simon GlassDefine 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.
---
include/common.h | 7 +++++++ lib/time.c | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-)
include/common.h +7 -0
@@ -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 ) \
lib/time.c +17 -0
@@ -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" )));
Signature · 1 line
1.7.3.1
RFC PATCH v2 11/15 bootstage: Define an optional microsecond timer
Quoted 9 lines · On Saturday 10 December 2011 16:08:03 Simon Glass wrote:
lib/time.c +6
-0+ulong __timer_get_boot_us (void ) +{ +static ulong base_time; + +/* +* We can't implement this properly. Return 0 on the first call and
lib/time.c void mdelay(unsigned long msec) · line 66
Quoted 10 lines
lib/time.c +10
-0+* 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>
RFC PATCH v2 11/15 bootstage: Define an optional microsecond timer
Hi Mike,
Quoted 15 lines · Mike Frysinger
Quoted 14 lines · On Saturday 10 December 2011 16:08:03 Simon Glass wrote:
lib/time.c +11
-0+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);
Quoted 8 lines
lib/time.c void mdelay(unsigned long msec)
Quoted 5 lines
+ ? ? return 0;
lib/time.c +4
-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
RFC PATCH v2 11/15 bootstage: Define an optional microsecond timer
Quoted 24 lines · On Sunday 08 January 2012 12:33:34 Simon Glass wrote:
Quoted 14 lines · Mike Frysinger
Quoted 13 lines · On Saturday 10 December 2011 16:08:03 Simon Glass wrote:
lib/time.c +6
-0+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.
lib/time.c +3
-0+*/ +if (base_time) +return get_timer (base_time) *1000 ;Quoted 8 lines
lib/time.c void mdelay(unsigned long msec) · line 66
Quoted 6 lines
lib/time.c +6
-0+ 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()?
Quoted 7 lines
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>
RFC PATCH v2 11/15 bootstage: Define an optional microsecond timer
Hi Mike,
Quoted 29 lines · Mike Frysinger
Quoted 28 lines · On Sunday 08 January 2012 12:33:34 Simon Glass wrote:
Quoted 14 lines · Mike Frysinger
Quoted 13 lines · On Saturday 10 December 2011 16:08:03 Simon Glass wrote:
lib/time.c +6
-0+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)
+ ? ? ? ? ? ? returnget_timer(base_time)* 1000;Quoted 8 lines
lib/time.c void mdelay(unsigned long msec)
Quoted 6 lines
+ ? ?
base_time=get_timer(0);
+ ? ? return 0;lib/time.c +4
-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!
Quoted 6 lines
Quoted 3 lines
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
Quoted 1 line
-mike
RFC PATCH v2 12/15 bootstage: Replace show_boot_progress/error() with bootstage_...()
In reply to Simon GlassThese calls should not be made directly any more, since bootstage will call the show_boot_...() functions as needed.
---
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(-)
arch/arm/lib/bootm.c +1 -1
@@ -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)
arch/avr32/lib/bootm.c +1 -1
@@ -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);
arch/m68k/lib/bootm.c +1 -1
@@ -104,7 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imadebug ("## 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):
arch/microblaze/lib/bootm.c +1 -1
@@ -59,7 +59,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imaif (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 );
arch/mips/lib/bootm.c +1 -1
@@ -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",
arch/mips/lib/bootm_qemu_mips.c +1 -1
@@ -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);
arch/nds32/lib/bootm.c +1 -1
@@ -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);
arch/powerpc/lib/board.c +1 -1
@@ -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 (;;) ; }
arch/powerpc/lib/bootm.c +1 -1
@@ -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 ();
arch/sparc/lib/board.c +1 -1
@@ -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 (;;) ; }
arch/x86/lib/board.c +9 -10
@@ -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 (;;)
board/hermes/hermes.c +1 -1
@@ -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
board/matrix_vision/common/mv_common.c +1 -1
@@ -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; }
board/scb9328/scb9328.c +0 -6
@@ -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 ;
common/cmd_bootm.c +46 -46
325 lines not on this page · raw message
common/cmd_ide.c +23 -23
131 lines not on this page · raw message
common/cmd_nand.c +17 -17
@@ -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 ]); }
common/cmd_net.c +8 -8
@@ -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; }
common/env_common.c +1 -1
@@ -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 {
common/image.c +26 -26
183 lines not on this page · raw message
net/eth.c +3 -3
@@ -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 (", ");
post/post.c +2 -2
@@ -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 ;
Signature · 1 line
1.7.3.1
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
In reply to Simon GlassThis 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---
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
README +25 -0
@@ -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
common/Makefile +1 -0
@@ -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
common/bootstage.c new file +160 -0
160 lines not on this page · raw message
include/bootstage.h +73 -2
96 lines not on this page · raw message
Signature · 1 line
1.7.3.1
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Quoted 7 lines · 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_BOOTSTAGEin your board config file. Also available isCONFIG_BOOTSTAGE_REPORTwhich 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 ...
Quoted 9 lines
include/bootstage.h +4
-1+static inline ulong bootstage_mark (enum bootstage_id id) { -show_boot_progress (-val); +#ifdef CONFIG_SHOW_BOOT_PROGRESS +show_boot_progress (id); +#endif
include/bootstage.h enum bootstage_id { · line 252
Quoted 10 lines
include/bootstage.h +8
-0+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.
Quoted 3 lines
+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>
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Hi Mike,
Quoted 5 lines · Mike Frysinger
Quoted 4 lines · 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.
Quoted 7 lines
Quoted 3 lines
To enable the feature, define
CONFIG_BOOTSTAGEin your board config file. Also available isCONFIG_BOOTSTAGE_REPORTwhich 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_BOOTSTAGElogic right ?
Yes - I will update the commit title.
Quoted 3 lines
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.
Quoted 13 lines
Quoted 13 lines
include/bootstage.h +1
-0+static inline ulong bootstage_mark (enum bootstage_id id)?{
- ? ?show_boot_progress(-val);include/bootstage.h +4
-0+#ifdef CONFIG_SHOW_BOOT_PROGRESS + ? ? show_boot_progress(id); +#endif + ? ? return 0;?}
Quoted 10 lines
include/bootstage.h enum bootstage_id { · line 252
Quoted 7 lines
include/bootstage.h +7
-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 whenCONFIG_SHOW_BOOT_PROGRESSisn'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.
Quoted 6 lines
Quoted 4 lines
+static inline ulong
bootstage_mark_name(enum bootstage_id id, const char *name)
+{ return 0; }please unroll this
done
Quoted 1 line
-mike
Regards,
Simon
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Quoted 25 lines · On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
Quoted 13 lines · Mike Frysinger
Quoted 12 lines · On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
include/bootstage.h +5
-1+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 ; }Quoted 10 lines
include/bootstage.h enum bootstage_id { · line 252
Quoted 7 lines
include/bootstage.h +7
-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 whenCONFIG_SHOW_BOOT_PROGRESSisn't defined ? then you don't have to protect the call sites.
Quoted 8 lines
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 turnCONFIG_SHOW_BOOT_PROGRESSon 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 withCONFIG_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>
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Hi Mike,
Quoted 31 lines · Mike Frysinger
Quoted 30 lines · On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
Quoted 13 lines · Mike Frysinger
Quoted 12 lines · On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
include/bootstage.h +1
-0+static inline ulong bootstage_mark (enum bootstage_id id)?{
- ? ?show_boot_progress(-val);include/bootstage.h +4
-0+#ifdef CONFIG_SHOW_BOOT_PROGRESS + ? ? show_boot_progress(id); +#endif + ? ? return 0;?}
Quoted 10 lines
include/bootstage.h enum bootstage_id { · line 252
Quoted 7 lines
include/bootstage.h +7
-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 whenCONFIG_SHOW_BOOT_PROGRESSisn'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 turnCONFIG_SHOW_BOOT_PROGRESSon and off independently. So If I do what you suggest I will break that expectation.
Quoted 7 lines
Quoted 3 lines
One fix would be to bracket all
show_boot_progress()function implementations in the boards withCONFIG_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
Quoted 1 line
-mike
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Quoted 37 lines · On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
Quoted 36 lines · Mike Frysinger
Quoted 34 lines · On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
Quoted 13 lines · Mike Frysinger
Quoted 12 lines · On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
include/bootstage.h +5
-1+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 ; }Quoted 11 lines
include/bootstage.h enum bootstage_id { · line 252
Quoted 7 lines
include/bootstage.h +7
-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 whenCONFIG_SHOW_BOOT_PROGRESSisn'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 turnCONFIG_SHOW_BOOT_PROGRESSon 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 withCONFIG_SHOW_BOOT_PROGRESS, but I haven't done that.
Quoted 8 lines
Quoted 4 lines
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 defineCONFIG_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>
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Hi Mike,
Quoted 43 lines · Mike Frysinger
Quoted 42 lines · On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
Quoted 40 lines · Mike Frysinger
Quoted 26 lines · On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
Quoted 13 lines · Mike Frysinger
Quoted 12 lines · On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
include/bootstage.h +1
-0+static inline ulong bootstage_mark (enum bootstage_id id)?{
- ? ?show_boot_progress(-val);include/bootstage.h +4
-0+#ifdef CONFIG_SHOW_BOOT_PROGRESS + ? ? show_boot_progress(id); +#endif + ? ? return 0;?}
Quoted 11 lines
include/bootstage.h enum bootstage_id { · line 252
Quoted 7 lines
include/bootstage.h +7
-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 whenCONFIG_SHOW_BOOT_PROGRESSisn't defined ? ?then you don't have to protect the call sites.Quoted 8 lines
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 turnCONFIG_SHOW_BOOT_PROGRESSon 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 withCONFIG_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 ...
Quoted 5 lines
Quoted 3 lines
Still don't quite get it though. For example, the beagle board defines
show_boot_progress()but does not defineCONFIG_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
Quoted 1 line
-mike
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Quoted 6 lines · On Saturday 14 January 2012 20:16:35 Simon Glass wrote:
Quoted 5 lines · Mike Frysinger
Quoted 3 lines · 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 defineCONFIG_SHOW_BOOT_PROGRESS, so wouldn't that break that board?
Quoted 8 lines
Quoted 2 lines
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>
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Hi Mike,
Quoted 16 lines · Mike Frysinger
Quoted 6 lines · On Saturday 14 January 2012 20:16:35 Simon Glass wrote:
Quoted 5 lines · Mike Frysinger
Quoted 3 lines · 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 defineCONFIG_SHOW_BOOT_PROGRESS, so wouldn't that break that board?Quoted 8 lines
Quoted 2 lines
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.
Quoted 3 lines
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
Quoted 1 line
-mike
RFC PATCH v2 13/15 bootstage: Add microsecond boot time measurement
Hi Mike,
Quoted 22 lines · Simon Glass
Hi Mike,
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Saturday 14 January 2012 20:16:35 Simon Glass wrote:
Quoted 2 lines · Mike Frysinger
Quoted 1 line · On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
Still don't quite get it though. For example, the beagle board
defines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
show_boot_progress()but does not defineCONFIG_SHOW_BOOT_PROGRESS,so
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
wouldn't that break that board?
that sounds like an odd-man-out that needs fixing rather than
allowing to
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
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.
Quoted 9 lines
Quoted 1 line
that's fair. if it's a small # of boards, i'd prefer to migrate them.
if
Quoted 1 line
it's a lot more, we can punt for now (add to the TODO?) and add comments
to
Quoted 1 line
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
RFC PATCH v2 14/15 bootstage: Plumb in bootstage calls for basic operations
In reply to Simon GlassThis inserts bootstage calls into tftp, usb start and bootm. We could go further, but this is a reasonable start to illustrate the concept.
---
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(-)
common/cmd_bootm.c +2 -0
@@ -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);
common/cmd_net.c +6 -1
@@ -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(
common/cmd_usb.c +1 -0
@@ -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 ();
net/bootp.c +4 -0
@@ -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 ;
net/net.c +1 -0
@@ -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 ) {
Signature · 1 line
1.7.3.1
RFC PATCH v2 15/15 bootstage: arm: Add bootstage calls in board and bootm
In reply to Simon GlassAdd calls to bootstage before and after relocation, and just before jumping to the OS.
---
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(-)
arch/arm/lib/board.c +3 -0
@@ -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;
arch/arm/lib/bootm.c +4 -0
@@ -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 {
Signature · 1 line
1.7.3.1
RFC PATCH v2 15/15 bootstage: arm: Add bootstage calls in board and bootm
arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 89
Quoted 10 lines · On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
arch/arm/lib/bootm.c +4
-0static 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>
RFC PATCH v2 15/15 bootstage: arm: Add bootstage calls in board and bootm
Hi Mike,
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
arch/arm/lib/bootm.c +0
-0
Quoted 11 lines
arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 89
Quoted 7 lines
?static void
announce_and_cleanup(void)
?{
? ? ?printf("\nStarting kernel ...\n\n");
+ ? ?bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");arch/arm/lib/bootm.c +3
-0+#ifdef CONFIG_BOOTSTAGE_REPORT + ? ? bootstage_report(); +#endif shouldn't the header make
bootstage_report()into a stub whenCONFIG_BOOTSTAGE_REPORTisn'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
Quoted 1 line
-mike
RFC PATCH v2 15/15 bootstage: arm: Add bootstage calls in board and bootm
Quoted 17 lines · On Sunday 08 January 2012 12:43:09 Simon Glass wrote:
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
arch/arm/lib/bootm.c +0
-0Quoted 11 lines
arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 89
Quoted 7 lines
static void
announce_and_cleanup(void){ printf("\nStarting kernel ...\n\n");arch/arm/lib/bootm.c +4
-0+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 whenCONFIG_BOOTSTAGE_REPORTisn't defined ? then you won't need the ifdef protection here.
Quoted 3 lines
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>
RFC PATCH v2 15/15 bootstage: arm: Add bootstage calls in board and bootm
Hi Mike,
Quoted 18 lines · Mike Frysinger
Quoted 17 lines · On Sunday 08 January 2012 12:43:09 Simon Glass wrote:
Quoted 15 lines · Mike Frysinger
arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 89
Quoted 10 lines · On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
arch/arm/lib/bootm.c +0
-0?static void
announce_and_cleanup(void)
?{
? ? ?printf("\nStarting kernel ...\n\n");
+ ? ?bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");arch/arm/lib/bootm.c +3
-0+#ifdef CONFIG_BOOTSTAGE_REPORT + ? ? bootstage_report(); +#endif shouldn't the header make
bootstage_report()into a stub whenCONFIG_BOOTSTAGE_REPORTisn't defined ? ?then you won't need the ifdef protection here.
Quoted 5 lines
Quoted 3 lines
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
Quoted 1 line
-mike
RFC PATCH v2 15/15 bootstage: arm: Add bootstage calls in board and bootm
Quoted 30 lines · On Sunday 08 January 2012 18:48:18 Simon Glass wrote:
Quoted 18 lines · Mike Frysinger
Quoted 17 lines · On Sunday 08 January 2012 12:43:09 Simon Glass wrote:
Quoted 15 lines · Mike Frysinger
arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 89
Quoted 10 lines · On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
arch/arm/lib/bootm.c +1
-0static void announce_and_cleanup (void ) {printf ("\nStarting kernel ...\n\n" ); + bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF,"
start_kernel"); +#ifdefCONFIG_BOOTSTAGE_REPORTarch/arm/lib/bootm.c +2
-0+bootstage_report (); +#endif shouldn't the header make
bootstage_report()into a stub whenCONFIG_BOOTSTAGE_REPORTisn't defined ? then you won't need the ifdef protection here.Quoted 5 lines
Quoted 3 lines
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 defineCONFIG_BOOTSTAGE_REPORTthen one is printing automatically by U-Boot just before jumping to the kernel.
Quoted 5 lines
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>
RFC PATCH v2 15/15 bootstage: arm: Add bootstage calls in board and bootm
Hi Mike,
Quoted 44 lines · Mike Frysinger
Quoted 30 lines · On Sunday 08 January 2012 18:48:18 Simon Glass wrote:
Quoted 18 lines · Mike Frysinger
Quoted 17 lines · On Sunday 08 January 2012 12:43:09 Simon Glass wrote:
Quoted 15 lines · Mike Frysinger
Quoted 10 lines · On Saturday 10 December 2011 16:08:07 Simon Glass wrote:
arch/arm/lib/bootm.c +0
-0?static void
announce_and_cleanup(void)
?{
? ? ?printf("\nStarting kernel ...\n\n");
+ ? ?bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel"); +#ifdefCONFIG_BOOTSTAGE_REPORT
+ ? ?bootstage_report();
+#endifshouldn't the header make
bootstage_report()into a stub whenCONFIG_BOOTSTAGE_REPORTisn't defined ? ?then you won't need the ifdef protection here.Quoted 5 lines
Quoted 3 lines
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 defineCONFIG_BOOTSTAGE_REPORTthen one is printing automatically by U-Boot just before jumping to the kernel.Quoted 5 lines
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:
#ifdefCONFIG_BOOTSTAGE
extern voidbootstage_report(void);
#else
#definebootstage_report()
#endif
Quoted 4 lines
and
CONFIG_BOOTSTAGE_REPORTcontrols the automatic calls to the report funcis 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
Quoted 1 line
-mike
v2 cover bootstage: record and publish boot progress timing
In reply to Simon GlassHi,
Quoted 8 lines · Simon Glass
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
Quoted 98 lines
1. Create
bootstage.hwith 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.cfile 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:
- Unifyshow_boot_progress()into this seriesSimon Glass (15):
?bootstage: Create an initial header for boot progress integers ?bootstage: Make use ofBOOTSTAGE_ID_RUN_OSinshow_boot_progress()?bootstage: Useshow_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 100644include/bootstage.h--
1.7.3.1