Bora Guvendik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/59554 )
Change subject: timestamp: Allow timestamp_add to accept a negative number ......................................................................
timestamp: Allow timestamp_add to accept a negative number
Change timestamp_add to accept negative values for events that took place before coreboot started executing.
TEST=Boot to OS, check cbmem -t
Signed-off-by: Bora Guvendik bora.guvendik@intel.com Change-Id: I90afc13a8e92693d86e3358f05e0a0cb7cdbca9b --- M src/commonlib/include/commonlib/timestamp_serialized.h M src/include/timestamp.h M src/lib/timestamp.c 3 files changed, 7 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/54/59554/1
diff --git a/src/commonlib/include/commonlib/timestamp_serialized.h b/src/commonlib/include/commonlib/timestamp_serialized.h index 98fe552..913b09a 100644 --- a/src/commonlib/include/commonlib/timestamp_serialized.h +++ b/src/commonlib/include/commonlib/timestamp_serialized.h @@ -7,7 +7,7 @@
struct timestamp_entry { uint32_t entry_id; - uint64_t entry_stamp; + int64_t entry_stamp; } __packed;
struct timestamp_table { diff --git a/src/include/timestamp.h b/src/include/timestamp.h index 647cd13..cbe9934 100644 --- a/src/include/timestamp.h +++ b/src/include/timestamp.h @@ -19,7 +19,7 @@ * 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); +void timestamp_add(enum timestamp_id id, int64_t ts_time); /* Calls timestamp_add with current timestamp. */ void timestamp_add_now(enum timestamp_id id);
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index 7347d07..7bc96c6 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -102,7 +102,7 @@ }
static void timestamp_add_table_entry(struct timestamp_table *ts_table, - enum timestamp_id id, uint64_t ts_time) + enum timestamp_id id, int64_t ts_time) { struct timestamp_entry *tse;
@@ -117,7 +117,7 @@ printk(BIOS_ERR, "ERROR: Timestamp table full\n"); }
-void timestamp_add(enum timestamp_id id, uint64_t ts_time) +void timestamp_add(enum timestamp_id id, int64_t ts_time) { struct timestamp_table *ts_table;
@@ -131,7 +131,9 @@ return; }
- ts_time -= ts_table->base_time; + if (ts_time >= 0) + ts_time -= ts_table->base_time; + timestamp_add_table_entry(ts_table, id, ts_time);
if (CONFIG(TIMESTAMPS_ON_CONSOLE))