timestamp: Move timestamp_should_run() call
Old location caused spurious error messages when
called from APs, where timestamp_add_now() should
do nothing.
Moving the test also makes get_us_from_boot() usable
from APs (assuming cache coherency).
Change-Id: Ice9ece11b15bbe1a58a038cda3d299862e6f822b
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/31524
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 6885e7b..f84b9d5 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -125,9 +125,6 @@
MAYBE_STATIC struct timestamp_table *ts_table = NULL;
struct timestamp_cache *ts_cache;
- if (!timestamp_should_run())
- return NULL;
-
if (ts_table != NULL)
return ts_table;
@@ -188,6 +185,9 @@
{
struct timestamp_table *ts_table;
+ if (!timestamp_should_run())
+ return;
+
ts_table = timestamp_table_get();
if (!ts_table) {