summaryrefslogtreecommitdiff
path: root/src/lib/timestamp.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2019-05-18 13:47:39 -0700
committerDuncan Laurie <dlaurie@chromium.org>2019-05-19 18:13:26 +0000
commitef179ab07b73ebe5b7dd33b260402d39daec678b (patch)
treef5b911f5a3a38bf2333bf33d08b47a8d4ce65a7a /src/lib/timestamp.c
parentaa2157430f96c658b9629bf69d507f1f161078a7 (diff)
downloadcoreboot-ef179ab07b73ebe5b7dd33b260402d39daec678b.tar.xz
timestamp: Update TIMESTAMP_CACHE_IN_BSS to include ENV_POSTCAR
With CB:32726 ("lib/timestamp: Make timestamp_sync_cache_to_cbmem() in postcar") timestamps are synced from cache to cbmem in postcar as well. For postcar, the cache lives in BSS just like ramstage. This change updates TIMESTAMP_CACHE_IN_BSS to include both ramstage and postcar and uses this instead of ENV_RAMSTAGE to check for cache location. Ideally, it would be good to get rid of timestamp cache in postcar and ramstage completely since early cbmem init is enabled by default in coreboot and it is guaranteed that cbmem is recovered before timestamps are added in ramstage or postcar. This change is being pushed in as a temporary fix while I make the changes to remove timestamp cache from romstage and postcar completely. BUG=b:132939309 Change-Id: I2d82a96aba954df77c9386b7bd2e2ec0973881be Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32881 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Diffstat (limited to 'src/lib/timestamp.c')
-rw-r--r--src/lib/timestamp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 431bce2703..38d0212845 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -47,12 +47,15 @@ DECLARE_OPTIONAL_REGION(timestamp);
#define USE_TIMESTAMP_REGION 0
#endif
-/* The cache location will sit in BSS when in ramstage. */
-#define TIMESTAMP_CACHE_IN_BSS ENV_RAMSTAGE
+/* The cache location will sit in BSS when in ramstage/postcar. */
+#define TIMESTAMP_CACHE_IN_BSS (ENV_RAMSTAGE || ENV_POSTCAR)
#define HAS_CBMEM (ENV_ROMSTAGE || ENV_RAMSTAGE || ENV_POSTCAR)
-/* Storage of cache entries during ramstage prior to cbmem coming online. */
+/*
+ * Storage of cache entries during ramstage/postcar prior to cbmem coming
+ * online.
+ */
static struct timestamp_cache timestamp_cache;
enum {
@@ -220,7 +223,7 @@ void timestamp_init(uint64_t base)
/* Timestamps could have already been recovered.
* In those circumstances honor the cache which sits in BSS
* as it has already been initialized. */
- if (ENV_RAMSTAGE &&
+ if (TIMESTAMP_CACHE_IN_BSS &&
ts_cache->cache_state != TIMESTAMP_CACHE_UNINITIALIZED)
return;