From e761ecdbb83e3151ffea5b531523256c57e62527 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:36 +0000 Subject: x86: Add TSC timer This timer runs at a rate that can be calculated, well over 100MHz. It is ideal for accurate timing and does not need interrupt servicing. Tidy up some old broken and unneeded implementations at the same time. To provide a consistent view of boot time, we use the same time base as coreboot. Use the base timestamp supplied by coreboot as U-Boot's base time. Signed-off-by: Simon Glass base Signed-off-by: Simon Glass --- include/configs/coreboot.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include') diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index 5bacc77..99408dc 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -38,7 +38,6 @@ #define CONFIG_SHOW_BOOT_PROGRESS #define CONFIG_LAST_STAGE_INIT #define CONFIG_SYS_VSNPRINTF -#define CONFIG_INTEL_CORE_ARCH /* Sandy bridge and ivy bridge chipsets. */ #define CONFIG_ZBOOT_32 #define CONFIG_PHYSMEM #define CONFIG_SYS_EARLY_PCI_INIT @@ -218,7 +217,6 @@ #define CONFIG_SYS_MEMTEST_END 0x01000000 #define CONFIG_SYS_LOAD_ADDR 0x100000 #define CONFIG_SYS_HZ 1000 -#define CONFIG_SYS_X86_ISR_TIMER /*----------------------------------------------------------------------- * SDRAM Configuration @@ -235,7 +233,7 @@ * CPU Features */ -#define CONFIG_SYS_GENERIC_TIMER +#define CONFIG_SYS_X86_TSC_TIMER #define CONFIG_SYS_PCAT_INTERRUPTS #define CONFIG_SYS_NUM_IRQS 16 -- cgit v1.1 From d0b6f247a1e7ffd06d931ca4088426134dc4e546 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:39 +0000 Subject: x86: Re-enable PCAT timer 2 for beeping While we don't want PCAT timers for timing, we want timer 2 so that we can still make a beep. Re-purpose the PCAT driver for this, and enable it in coreboot. Signed-off-by: Simon Glass --- include/configs/coreboot.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index 99408dc..7953ec6 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -235,6 +235,7 @@ #define CONFIG_SYS_X86_TSC_TIMER #define CONFIG_SYS_PCAT_INTERRUPTS +#define CONFIG_SYS_PCAT_TIMER #define CONFIG_SYS_NUM_IRQS 16 /*----------------------------------------------------------------------- -- cgit v1.1 From e802ee0f990b634138d55844ee36e4125a0fa0fc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:40 +0000 Subject: bootstage: Add stubs for new bootstage functions Some functions don't have a stub for when CONFIG_BOOTSTAGE is not defined. Add one to avoid #ifdefs in the code when this is used in U-Boot. Signed-off-by: Simon Glass Reviewed-by: Che-Liang Chiou Reviewed-by: Tom Wai-Hong Tam --- include/bootstage.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') diff --git a/include/bootstage.h b/include/bootstage.h index 3b2216b..bdda768 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -315,6 +315,12 @@ int bootstage_stash(void *base, int size); int bootstage_unstash(void *base, int size); #else +static inline ulong bootstage_add_record(enum bootstage_id id, + const char *name, int flags, ulong mark) +{ + return 0; +} + /* * This is a dummy implementation which just calls show_boot_progress(), * and won't even do that unless CONFIG_SHOW_BOOT_PROGRESS is defined @@ -337,6 +343,16 @@ static inline ulong bootstage_mark_name(enum bootstage_id id, const char *name) return 0; } +static inline uint32_t bootstage_start(enum bootstage_id id, const char *name) +{ + return 0; +} + +static inline uint32_t bootstage_accum(enum bootstage_id id) +{ + return 0; +} + static inline int bootstage_stash(void *base, int size) { return 0; /* Pretend to succeed */ -- cgit v1.1 From 150678a5820bed338c1c8de570c451bc77c15900 Mon Sep 17 00:00:00 2001 From: Doug Anderson Date: Wed, 17 Apr 2013 16:13:41 +0000 Subject: bootstage: Copy bootstage strings post-relocation Any pointers to name strings that were passed to bootstage_mark_name() pre-relocation should be copied post-relocation so that they don't get trashed as the original location of U-Boot is re-used for other purposes. This change introduces a new API call that should be called from board_init_r() after malloc has been initted on any board that uses bootstage. Signed-off-by: Doug Anderson Signed-off-by: Simon Glass Reviewed-by: Simon Glass --- include/bootstage.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/bootstage.h b/include/bootstage.h index bdda768..c8235e8 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -237,6 +237,16 @@ void show_boot_progress(int val); /* This is the full bootstage implementation */ /** + * Relocate existing bootstage records + * + * Call this after relocation has happened and after malloc has been initted. + * We need to copy any pointers in bootstage records that were added pre- + * relocation, since memory can be overritten later. + * @return Always returns 0, to indicate success + */ +int bootstage_relocate(void); + +/** * Add a new bootstage record * * @param id Bootstage ID to use (ignored if flags & BOOTSTAGEF_ALLOC) @@ -326,6 +336,11 @@ static inline ulong bootstage_add_record(enum bootstage_id id, * and won't even do that unless CONFIG_SHOW_BOOT_PROGRESS is defined */ +static inline int bootstage_relocate(void) +{ + return 0; +} + static inline ulong bootstage_mark(enum bootstage_id id) { show_boot_progress(id); -- cgit v1.1 From 2e65959be679a2401b0f0fc02934f6b6d48f9fd8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:43 +0000 Subject: x86: Enable bootstage for coreboot This is a convenient way of finding out where boottime is going. Enable it for coreboot. Signed-off-by: Simon Glass --- include/configs/coreboot.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index 7953ec6..743fb95 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -48,6 +48,15 @@ #define CONFIG_OF_SEPARATE #define CONFIG_DEFAULT_DEVICE_TREE link +#define CONFIG_BOOTSTAGE +#define CONFIG_BOOTSTAGE_REPORT +#define CONFIG_BOOTSTAGE_FDT +#define CONFIG_CMD_BOOTSTAGE +/* Place to stash bootstage data from first-stage U-Boot */ +#define CONFIG_BOOTSTAGE_STASH 0x0110f000 +#define CONFIG_BOOTSTAGE_STASH_SIZE 0x7fc +#define CONFIG_BOOTSTAGE_USER_COUNT 60 + /*----------------------------------------------------------------------- * Watchdog Configuration */ -- cgit v1.1 From fb7db41cd46e96621fd97b827622668ee2c6b845 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:44 +0000 Subject: bootstage: Allow marking a particular line of code Add a function which allows a (file, function, line number) to be marked in bootstage. Signed-off-by: Simon Glass Reviewed-by: Che-Liang Chiou --- include/bootstage.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include') diff --git a/include/bootstage.h b/include/bootstage.h index c8235e8..0f44e71 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -267,6 +267,19 @@ ulong bootstage_error(enum bootstage_id id); ulong bootstage_mark_name(enum bootstage_id id, const char *name); /** + * Mark a time stamp in the given function and line number + * + * See BOOTSTAGE_MARKER() for a convenient macro. + * + * @param file Filename to record (NULL if none) + * @param func Function name to record + * @param linenum Line number to record + * @return recorded time stamp + */ +ulong bootstage_mark_code(const char *file, const char *func, + int linenum); + +/** * Mark the start of a bootstage activity. The end will be marked later with * bootstage_accum() and at that point we accumulate the time taken. Calling * this function turns the given id into a accumulator rather than and @@ -358,6 +371,12 @@ static inline ulong bootstage_mark_name(enum bootstage_id id, const char *name) return 0; } +static inline ulong bootstage_mark_code(const char *file, const char *func, + int linenum) +{ + return 0; +} + static inline uint32_t bootstage_start(enum bootstage_id id, const char *name) { return 0; @@ -379,4 +398,8 @@ static inline int bootstage_unstash(void *base, int size) } #endif /* CONFIG_BOOTSTAGE */ +/* Helper macro for adding a bootstage to a line of code */ +#define BOOTSTAGE_MARKER() \ + bootstage_mark_code(__FILE__, __func__, __LINE__) + #endif -- cgit v1.1 From 04dbf77d6275ce7bfba748c603957b0ebbb07b64 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:46 +0000 Subject: x86: config: Enable LZO for coreboot, remove zlib, gzip We don't use zlib and gzip but do use lzo, so enable this. Signed-off-by: Simon Glass --- include/configs/coreboot.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index 743fb95..be04a75 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -57,6 +57,10 @@ #define CONFIG_BOOTSTAGE_STASH_SIZE 0x7fc #define CONFIG_BOOTSTAGE_USER_COUNT 60 +#define CONFIG_LZO +#undef CONFIG_ZLIB +#undef CONFIG_GZIP + /*----------------------------------------------------------------------- * Watchdog Configuration */ -- cgit v1.1