summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2019-09-07 13:25:47 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2019-09-12 10:17:57 +0000
commit3c559e791f2003f1807e78ee7c52174a5f7854b3 (patch)
tree3781725e7ab84bd341179611182fac08b3a42a36
parent72e634fa73834987e5ec1a2b368af01bc59cab71 (diff)
downloadcoreboot-3c559e791f2003f1807e78ee7c52174a5f7854b3.tar.xz
timestamps: Mostly remove struct timestamp_cache
Change-Id: Ifcd75630e562af302312f93bdf180aa90f18d21d Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35290 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/lib/timestamp.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 4983885195..db73f15a34 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -58,25 +58,25 @@ static struct timestamp_cache timestamp_cache;
as CBMEM comes available. */
static struct timestamp_table *glob_ts_table CAR_GLOBAL;
-static void timestamp_cache_init(struct timestamp_cache *ts_cache,
+static void timestamp_cache_init(struct timestamp_table *ts_cache,
uint64_t base)
{
- ts_cache->table.num_entries = 0;
- ts_cache->table.max_entries = MAX_BSS_TIMESTAMP_CACHE;
- ts_cache->table.base_time = 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->table.max_entries = (REGION_SIZE(timestamp) -
- offsetof(struct timestamp_cache, entries))
+ ts_cache->max_entries = (REGION_SIZE(timestamp) -
+ offsetof(struct timestamp_table, entries))
/ sizeof(struct timestamp_entry);
}
-static struct timestamp_cache *timestamp_cache_get(void)
+static struct timestamp_table *timestamp_cache_get(void)
{
- struct timestamp_cache *ts_cache = NULL;
+ struct timestamp_table *ts_cache = NULL;
if (TIMESTAMP_CACHE_IN_BSS) {
- ts_cache = &timestamp_cache;
+ ts_cache = &timestamp_cache.table;
} else if (USE_TIMESTAMP_REGION) {
if (REGION_SIZE(timestamp) < sizeof(*ts_cache))
BUG();
@@ -122,17 +122,14 @@ static int timestamp_should_run(void)
static struct timestamp_table *timestamp_table_get(void)
{
struct timestamp_table *ts_table;
- struct timestamp_cache *ts_cache;
ts_table = car_get_ptr(glob_ts_table);
if (ts_table)
return ts_table;
- ts_cache = timestamp_cache_get();
- if (ts_cache)
- ts_table = &ts_cache->table;
-
+ ts_table = timestamp_cache_get();
car_set_ptr(glob_ts_table, ts_table);
+
return ts_table;
}
@@ -196,7 +193,7 @@ void timestamp_add_now(enum timestamp_id id)
void timestamp_init(uint64_t base)
{
- struct timestamp_cache *ts_cache;
+ struct timestamp_table *ts_cache;
assert(ENV_ROMSTAGE_OR_BEFORE);
@@ -211,7 +208,7 @@ void timestamp_init(uint64_t base)
}
timestamp_cache_init(ts_cache, base);
- timestamp_table_set(&ts_cache->table);
+ timestamp_table_set(ts_cache);
}
static void timestamp_sync_cache_to_cbmem(struct timestamp_table *ts_cbmem_table)