bootblock: Allow more timestamps in bootblock_main_with_timestamp()
This patch adds more parameters to bootblock_main_with_timestamp() to
give callers the opportunity to add additional timestamps that were
recorded in the platform-specific initialization phase.
Change-Id: Idf3a0fcf5aee88a33747afc69e055b95bd38750c
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/26339
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/src/include/bootblock_common.h b/src/include/bootblock_common.h
index 6ede77c..fa67098 100644
--- a/src/include/bootblock_common.h
+++ b/src/include/bootblock_common.h
@@ -18,7 +18,8 @@
#include <arch/cpu.h>
#include <main_decl.h>
-#include <stdint.h>
+#include <timestamp.h>
+#include <types.h>
/*
* These are defined as weak no-ops that can be overridden by mainboard/SoC.
@@ -37,12 +38,13 @@
/*
* This is a the same as the bootblock main(), with the difference that it does
- * not collect a timestamp. Instead it accepts the first timestamp as an
- * argument. This can be used in cases where an earlier stamp is available
- * Note that this function is designed to be entered from C code.
- * This function assumes that the timer has already been initialized, so it
- * does not call init_timer().
+ * not collect a timestamp. Instead it accepts the initial timestamp and
+ * possibly additional timestamp entries as arguments. This can be used in cases
+ * where earlier stamps are available. Note that this function is designed to be
+ * entered from C code. This function assumes that the timer has already been
+ * initialized, so it does not call init_timer().
*/
-asmlinkage void bootblock_main_with_timestamp(uint64_t base_timestamp);
+asmlinkage void bootblock_main_with_timestamp(uint64_t base_timestamp,
+ struct timestamp_entry *timestamps, size_t num_timestamps);
#endif /* __BOOTBLOCK_COMMON_H */
diff --git a/src/lib/bootblock.c b/src/lib/bootblock.c
index bee2845..867f1b1 100644
--- a/src/lib/bootblock.c
+++ b/src/lib/bootblock.c
@@ -22,7 +22,6 @@
#include <pc80/mc146818rtc.h>
#include <program_loading.h>
#include <symbols.h>
-#include <timestamp.h>
DECLARE_OPTIONAL_REGION(timestamp);
@@ -31,11 +30,17 @@
__weak void bootblock_soc_init(void) { /* do nothing */ }
__weak void bootblock_mainboard_init(void) { /* do nothing */ }
-asmlinkage void bootblock_main_with_timestamp(uint64_t base_timestamp)
+asmlinkage void bootblock_main_with_timestamp(uint64_t base_timestamp,
+ struct timestamp_entry *timestamps, size_t num_timestamps)
{
/* Initialize timestamps if we have TIMESTAMP region in memlayout.ld. */
- if (IS_ENABLED(CONFIG_COLLECT_TIMESTAMPS) && _timestamp_size > 0)
+ if (IS_ENABLED(CONFIG_COLLECT_TIMESTAMPS) && _timestamp_size > 0) {
+ int i;
timestamp_init(base_timestamp);
+ for (i = 0; i < num_timestamps; i++)
+ timestamp_add(timestamps[i].entry_id,
+ timestamps[i].entry_stamp);
+ }
sanitize_cmos();
cmos_post_init();
@@ -63,5 +68,5 @@
if (IS_ENABLED(CONFIG_COLLECT_TIMESTAMPS))
base_timestamp = timestamp_get();
- bootblock_main_with_timestamp(base_timestamp);
+ bootblock_main_with_timestamp(base_timestamp, NULL, 0);
}
diff --git a/src/soc/amd/stoneyridge/bootblock/bootblock.c b/src/soc/amd/stoneyridge/bootblock/bootblock.c
index 6ee2095..9cfbae3 100644
--- a/src/soc/amd/stoneyridge/bootblock/bootblock.c
+++ b/src/soc/amd/stoneyridge/bootblock/bootblock.c
@@ -88,7 +88,7 @@
}
/* TSC cannot be relied upon. Override the TSC value passed in. */
- bootblock_main_with_timestamp(timestamp_get());
+ bootblock_main_with_timestamp(timestamp_get(), NULL, 0);
}
void bootblock_soc_early_init(void)
diff --git a/src/soc/intel/apollolake/bootblock/bootblock.c b/src/soc/intel/apollolake/bootblock/bootblock.c
index 2e51d48..81843a4 100644
--- a/src/soc/intel/apollolake/bootblock/bootblock.c
+++ b/src/soc/intel/apollolake/bootblock/bootblock.c
@@ -70,7 +70,7 @@
enable_rtc_upper_bank();
/* Call lib/bootblock.c main */
- bootblock_main_with_timestamp(base_timestamp);
+ bootblock_main_with_timestamp(base_timestamp, NULL, 0);
}
static void enable_pmcbar(void)
diff --git a/src/soc/intel/cannonlake/bootblock/bootblock.c b/src/soc/intel/cannonlake/bootblock/bootblock.c
index 9db9a0f..b7e7797 100644
--- a/src/soc/intel/cannonlake/bootblock/bootblock.c
+++ b/src/soc/intel/cannonlake/bootblock/bootblock.c
@@ -22,7 +22,7 @@
asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
{
/* Call lib/bootblock.c main */
- bootblock_main_with_timestamp(base_timestamp);
+ bootblock_main_with_timestamp(base_timestamp, NULL, 0);
}
void bootblock_soc_early_init(void)
diff --git a/src/soc/intel/denverton_ns/bootblock/bootblock.c b/src/soc/intel/denverton_ns/bootblock/bootblock.c
index 6179bf7..8b0c356 100644
--- a/src/soc/intel/denverton_ns/bootblock/bootblock.c
+++ b/src/soc/intel/denverton_ns/bootblock/bootblock.c
@@ -54,7 +54,7 @@
asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
{
/* Call lib/bootblock.c main */
- bootblock_main_with_timestamp(base_timestamp);
+ bootblock_main_with_timestamp(base_timestamp, NULL, 0);
};
void bootblock_soc_early_init(void)
diff --git a/src/soc/intel/quark/bootblock/bootblock.c b/src/soc/intel/quark/bootblock/bootblock.c
index 2bcc3f0..38730ea 100644
--- a/src/soc/intel/quark/bootblock/bootblock.c
+++ b/src/soc/intel/quark/bootblock/bootblock.c
@@ -82,7 +82,7 @@
if (IS_ENABLED(CONFIG_ENABLE_DEBUG_LED_BOOTBLOCK_ENTRY))
light_sd_led();
- bootblock_main_with_timestamp(base_timestamp);
+ bootblock_main_with_timestamp(base_timestamp, NULL, 0);
}
void bootblock_soc_early_init(void)
diff --git a/src/soc/intel/skylake/bootblock/bootblock.c b/src/soc/intel/skylake/bootblock/bootblock.c
index 57b0196..1803694 100644
--- a/src/soc/intel/skylake/bootblock/bootblock.c
+++ b/src/soc/intel/skylake/bootblock/bootblock.c
@@ -21,7 +21,7 @@
asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
{
/* Call lib/bootblock.c main */
- bootblock_main_with_timestamp(base_timestamp);
+ bootblock_main_with_timestamp(base_timestamp, NULL, 0);
}
void bootblock_soc_early_init(void)