diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-09-12 13:45:15 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-09-13 19:48:26 +0000 |
commit | 8b93689a358b0a65a334cc3adf6141e79fab032f (patch) | |
tree | 6d81db4b2ef72d0fc900f53ac175730afdb49a64 | |
parent | b6b13c9f2943a0f61a92d87127551ea8dc39a829 (diff) |
timestamps: Remove TIMESTAMP_CACHE_IN_BSS
This was implemented for LATE_CBMEM_INIT support which
has already been deprecated.
Change-Id: I39225ba675bc3389e051e15b400a905431969715
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35375
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/arch/x86/postcar.c | 5 | ||||
-rw-r--r-- | src/include/timestamp.h | 5 | ||||
-rw-r--r-- | src/lib/timestamp.c | 47 |
3 files changed, 17 insertions, 40 deletions
diff --git a/src/arch/x86/postcar.c b/src/arch/x86/postcar.c index 155c41336b..add72c2cda 100644 --- a/src/arch/x86/postcar.c +++ b/src/arch/x86/postcar.c @@ -31,7 +31,10 @@ void main(void) console_init(); - /* Recover cbmem so infrastruture using it is functional. */ + /* + * CBMEM needs to be recovered because timestamps rely on + * the cbmem infrastructure being around. Explicitly recover it. + */ cbmem_initialize(); timestamp_add_now(TS_START_POSTCAR); diff --git a/src/include/timestamp.h b/src/include/timestamp.h index 951032c1e7..f20fc6800a 100644 --- a/src/include/timestamp.h +++ b/src/include/timestamp.h @@ -28,8 +28,9 @@ */ void timestamp_init(uint64_t base); /* - * Add a new timestamp. Depending on cbmem is available or not, this timestamp - * will be stored to cbmem / timestamp cache. + * Add a new timestamp. For ENV_ROMSTAGE_OR_BEFORE, this timestamp will be stored + * inside REGION(timestamp) before cbmem comes online. For later stages, timestamps + * added before cbmem_[recovery|initialize] calls will be lost. */ void timestamp_add(enum timestamp_id id, uint64_t ts_time); /* Calls timestamp_add with current timestamp. */ diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index b647ca276c..dcb3124567 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -27,34 +27,9 @@ #define MAX_TIMESTAMPS 192 -/* When changing this number, adjust TIMESTAMP() size ASSERT() in memlayout.h */ -#define MAX_BSS_TIMESTAMP_CACHE 16 - -struct __packed timestamp_cache { - struct timestamp_table table; - /* The struct timestamp_table has a 0 length array as its last field. - * The following 'entries' array serves as the storage space for the - * cache when allocated in the BSS. */ - struct timestamp_entry entries[MAX_BSS_TIMESTAMP_CACHE]; -}; - DECLARE_OPTIONAL_REGION(timestamp); -#if ENV_ROMSTAGE_OR_BEFORE -#define USE_TIMESTAMP_REGION (REGION_SIZE(timestamp) > 0) -#else -#define USE_TIMESTAMP_REGION 0 -#endif - -/* Currently we never store timestamp cache in .bss. */ -#define TIMESTAMP_CACHE_IN_BSS 0 - -/* - * Storage of cache entries prior to cbmem coming online. - */ -static struct timestamp_cache timestamp_cache; - -/* This points to the active timestamp_table and can change within a stage. +/* This points to the active timestamp_table and can change within a stage as CBMEM comes available. */ static struct timestamp_table *glob_ts_table CAR_GLOBAL; @@ -62,24 +37,22 @@ static void timestamp_cache_init(struct timestamp_table *ts_cache, uint64_t base) { ts_cache->num_entries = 0; - ts_cache->max_entries = MAX_BSS_TIMESTAMP_CACHE; ts_cache->base_time = base; - - if (USE_TIMESTAMP_REGION) - ts_cache->max_entries = (REGION_SIZE(timestamp) - - offsetof(struct timestamp_table, entries)) - / sizeof(struct timestamp_entry); + ts_cache->max_entries = (REGION_SIZE(timestamp) - + offsetof(struct timestamp_table, entries)) + / sizeof(struct timestamp_entry); } static struct timestamp_table *timestamp_cache_get(void) { struct timestamp_table *ts_cache = NULL; - if (TIMESTAMP_CACHE_IN_BSS) { - ts_cache = ×tamp_cache.table; - } else if (USE_TIMESTAMP_REGION) { - if (REGION_SIZE(timestamp) < sizeof(*ts_cache)) - BUG(); + if (!ENV_ROMSTAGE_OR_BEFORE) + return NULL; + + if (REGION_SIZE(timestamp) < sizeof(*ts_cache)) { + BUG(); + } else { ts_cache = (void *)_timestamp; } |