From b6b13c9f2943a0f61a92d87127551ea8dc39a829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Thu, 12 Sep 2019 12:58:50 +0300 Subject: [PATCH] timestamps: Further simplify timestamp_reinit() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allocation of new table always happens in romstage. Change-Id: I089a84b372893fb3018a796fb1e16cd58753bdf4 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/35374 Reviewed-by: Aaron Durbin Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/lib/timestamp.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index db73f15a34..b647ca276c 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -265,21 +265,14 @@ static void timestamp_reinit(int is_recovery) if (!timestamp_should_run()) return; - /* cbmem is being recovered. */ - if (is_recovery) { - /* x86 resume path expects timestamps to be reset. */ - if (CONFIG(ARCH_ROMSTAGE_X86_32) && ENV_ROMSTAGE) - ts_cbmem_table = timestamp_alloc_cbmem_table(); - else { - /* Find existing table in cbmem. */ - ts_cbmem_table = cbmem_find(CBMEM_ID_TIMESTAMP); - /* No existing timestamp table. */ - if (ts_cbmem_table == NULL) - ts_cbmem_table = timestamp_alloc_cbmem_table(); - } - } else - /* First time sync. Add new table. */ + /* First time into romstage we make a clean new table. For platforms that travel + through this path on resume, ARCH_X86 S3, timestamps are also reset. */ + if (ENV_ROMSTAGE) { ts_cbmem_table = timestamp_alloc_cbmem_table(); + } else { + /* Find existing table in cbmem. */ + ts_cbmem_table = cbmem_find(CBMEM_ID_TIMESTAMP); + } if (ts_cbmem_table == NULL) { printk(BIOS_ERR, "ERROR: No timestamp table allocated\n");