summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2012-10-15 15:23:20 -0700
committerRonald G. Minnich <rminnich@gmail.com>2012-11-13 18:24:53 +0100
commit4221a195745837b05725d7ffeda415516ac44a7f (patch)
tree6d0c641d636d3cb576daf49ba57c3c94cea081f5 /src/boot
parent7004b7c9e61640f1e7e7bf9043bf7b2a8603d956 (diff)
downloadcoreboot-4221a195745837b05725d7ffeda415516ac44a7f.tar.xz
Add method for delaying adding of timestamps
In hardwaremain() we can't add timestamps before we actually reinitialized the cbmem area. Hence we kept the timestamps in an array and added them later. This is ugly and intrusive and helped hiding a bug that prevented any timestamps to be logged in hardwaremain() when coming out of an S3 resume. The problem is solved by moving the logic to keep a few timestamps around into the timestamp code. This also gets rid of a lot of ugly ifdefs in hardwaremain.c Change-Id: I945fc4c77e990f620c18cbd054ccd87e746706ef Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/1785 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/hardwaremain.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/boot/hardwaremain.c b/src/boot/hardwaremain.c
index b08fe79d0a..c90742e190 100644
--- a/src/boot/hardwaremain.c
+++ b/src/boot/hardwaremain.c
@@ -58,10 +58,8 @@ void hardwaremain(int boot_complete);
void hardwaremain(int boot_complete)
{
struct lb_memory *lb_mem;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t timestamps[6];
- timestamps[0] = rdtsc();
-#endif
+
+ timestamp_stash(TS_START_RAMSTAGE);
post_code(POST_ENTRY_RAMSTAGE);
/* console_init() MUST PRECEDE ALL printk()! */
@@ -83,37 +81,27 @@ void hardwaremain(int boot_complete)
/* FIXME: Is there a better way to handle this? */
init_timer();
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamps[1] = rdtsc();
-#endif
+ timestamp_stash(TS_DEVICE_ENUMERATE);
/* Find the devices we don't have hard coded knowledge about. */
dev_enumerate();
post_code(POST_DEVICE_ENUMERATION_COMPLETE);
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamps[2] = rdtsc();
-#endif
+ timestamp_stash(TS_DEVICE_CONFIGURE);
/* Now compute and assign the bus resources. */
dev_configure();
post_code(POST_DEVICE_CONFIGURATION_COMPLETE);
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamps[3] = rdtsc();
-#endif
+ timestamp_stash(TS_DEVICE_ENABLE);
/* Now actually enable devices on the bus */
dev_enable();
post_code(POST_DEVICES_ENABLED);
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamps[4] = rdtsc();
-#endif
+ timestamp_stash(TS_DEVICE_INITIALIZE);
/* And of course initialize devices on the bus */
dev_initialize();
post_code(POST_DEVICES_INITIALIZED);
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamps[5] = rdtsc();
-#endif
+ timestamp_stash(TS_DEVICE_DONE);
#if CONFIG_WRITE_HIGH_TABLES
cbmem_initialize();
@@ -121,13 +109,7 @@ void hardwaremain(int boot_complete)
cbmemc_reinit();
#endif
#endif
-
- timestamp_add(TS_START_RAMSTAGE, timestamps[0]);
- timestamp_add(TS_DEVICE_ENUMERATE, timestamps[1]);
- timestamp_add(TS_DEVICE_CONFIGURE, timestamps[2]);
- timestamp_add(TS_DEVICE_ENABLE, timestamps[3]);
- timestamp_add(TS_DEVICE_INITIALIZE, timestamps[4]);
- timestamp_add(TS_DEVICE_DONE, timestamps[5]);
+ timestamp_sync();
#if CONFIG_HAVE_ACPI_RESUME
suspend_resume();