From 69d20c45ecd8d224f1e9cf785f4fa441feb6e0a3 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Mon, 8 Feb 2016 19:48:11 -0800 Subject: timestamp: Bump CBMEM timestamp count, make full use of pre-RAM regions Since we're reaching the timestamp limit on certain platforms (both for the pre-RAM cache and the final CBMEM region), this patch increases the amount of space for both. In the pre-RAM case, it achieves this by always utilizing the full size of the TIMESTAMP() region allocated in memlayout.ld, rather than arbitrarily limiting it to some constant. BRANCH=None BUG=None TEST=Booted Oak and confirmed that I can once again see all pre-RAM timestamps after picking in the LZ4 patch series. Change-Id: Iabb075a48d8d1e3e1811afeaad5ab47e7846c972 Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/13651 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/lib/timestamp.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index 03d9b8abdf..2850fb7509 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -25,17 +25,17 @@ #include #include -#define MAX_TIMESTAMPS 60 +#define MAX_TIMESTAMPS 84 -#define MAX_TIMESTAMP_CACHE 16 +#define MAX_BSS_TIMESTAMP_CACHE 16 struct __attribute__((__packed__)) timestamp_cache { uint32_t cache_state; 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. */ - struct timestamp_entry entries[MAX_TIMESTAMP_CACHE]; + * cache when allocated in the BSS. */ + struct timestamp_entry entries[MAX_BSS_TIMESTAMP_CACHE]; }; #if (IS_ENABLED(CONFIG_HAS_PRECBMEM_TIMESTAMP_REGION) && defined(__PRE_RAM__)) @@ -62,9 +62,14 @@ static void timestamp_cache_init(struct timestamp_cache *ts_cache, uint64_t base) { ts_cache->table.num_entries = 0; - ts_cache->table.max_entries = MAX_TIMESTAMP_CACHE; + ts_cache->table.max_entries = MAX_BSS_TIMESTAMP_CACHE; ts_cache->table.base_time = base; ts_cache->cache_state = TIMESTAMP_CACHE_INITIALIZED; + + if (USE_TIMESTAMP_REGION) + ts_cache->table.max_entries = (_timestamp_size - + offsetof(struct timestamp_cache, entries)) + / sizeof(struct timestamp_entry); } static struct timestamp_cache *timestamp_cache_get(void) -- cgit v1.2.3