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>
This commit is contained in:
Furquan Shaikh 2019-05-18 13:47:39 -07:00 committed by Duncan Laurie
parent aa2157430f
commit ef179ab07b
1 changed files with 7 additions and 4 deletions

View File

@ -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;