summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-05-01 16:48:54 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-05-05 17:49:28 +0200
commit2daadf8f576363c6d215409b4d7899990344f3b5 (patch)
tree337d83d04d9fea2fe528f9ac8880b42ec4bbe64b /src
parentd914412beca76f97fe2f4a5bdbefdfcc398f72c1 (diff)
timestamp: refine boot CPU test
The timestamp code's restriction to run only on the BSP is for AMD systems. No need to run it everywhere, so tighten the test (and only run boot_cpu() when required). Change-Id: I800e817cc89e8688a671672961cab15c7f788ba8 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: http://review.coreboot.org/10102 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src')
-rw-r--r--src/lib/timestamp.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 5846781706..9a0e631b0b 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -21,8 +21,10 @@
#include <stdint.h>
#include <console/console.h>
#include <cbmem.h>
+#include <timer.h>
#include <timestamp.h>
#include <arch/early_variables.h>
+#include <rules.h>
#include <smp/node.h>
#define MAX_TIMESTAMPS 60
@@ -52,12 +54,24 @@ static void timestamp_real_init(uint64_t base)
car_set_var(ts_table_p, tst);
}
+/* Determine if one should proceed into timestamp code. This is for protecting
+ * systems that have multiple processors running in romstage -- namely AMD
+ * based x86 platforms. */
+static int timestamp_should_run(void)
+{
+ /* Only check boot_cpu() in other stages than ramstage on x86. */
+ if ((!ENV_RAMSTAGE && IS_ENABLED(CONFIG_ARCH_X86)) && !boot_cpu())
+ return 0;
+
+ return 1;
+}
+
void timestamp_add(enum timestamp_id id, uint64_t ts_time)
{
struct timestamp_entry *tse;
struct timestamp_table *ts_table = NULL;
- if (!boot_cpu())
+ if (!timestamp_should_run())
return;
ts_table = car_get_var(ts_table_p);
@@ -121,7 +135,7 @@ static void timestamp_do_sync(void)
void timestamp_init(uint64_t base)
{
- if (!boot_cpu())
+ if (!timestamp_should_run())
return;
#ifdef __PRE_RAM__
@@ -145,7 +159,7 @@ void timestamp_init(uint64_t base)
void timestamp_reinit(void)
{
- if (!boot_cpu())
+ if (!timestamp_should_run())
return;
#ifdef __PRE_RAM__