cbmem: export base_time in timestamp table

It's helpful to know the base_time (1st timestamp) in the
timestamp table because it provides more information like
the accumulated time before the first timestamp was recorded.

In order to maximize this information report the base time
as an entry that is printed. It's called '1st timestamp'.
The implementation turns all the timestamp entries into absolute
times so one can observe both absolute and relative time for
each marker.

Change-Id: I1334a2d980e3bcc2968a3bd6493c68b9efcca7ae
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/10883
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Aaron Durbin 2015-07-11 12:44:10 -05:00
parent f61b35d5b0
commit 31540fb785
1 changed files with 15 additions and 3 deletions

View File

@ -413,6 +413,8 @@ static const struct timestamp_id_to_name {
u32 id; u32 id;
const char *name; const char *name;
} timestamp_ids[] = { } timestamp_ids[] = {
/* Marker to report base_time. */
{ 0, "1st timestamp" },
{ TS_START_ROMSTAGE, "start of rom stage" }, { TS_START_ROMSTAGE, "start of rom stage" },
{ TS_BEFORE_INITRAM, "before ram initialization" }, { TS_BEFORE_INITRAM, "before ram initialization" },
{ TS_AFTER_INITRAM, "after ram initialization" }, { TS_AFTER_INITRAM, "after ram initialization" },
@ -504,6 +506,7 @@ static void dump_timestamps(void)
int i; int i;
struct timestamp_table *tst_p; struct timestamp_table *tst_p;
size_t size; size_t size;
uint64_t prev_stamp;
if (timestamps.tag != LB_TAG_TIMESTAMPS) { if (timestamps.tag != LB_TAG_TIMESTAMPS) {
fprintf(stderr, "No timestamps found in coreboot table.\n"); fprintf(stderr, "No timestamps found in coreboot table.\n");
@ -519,10 +522,19 @@ static void dump_timestamps(void)
unmap_memory(); unmap_memory();
tst_p = map_memory_size((unsigned long)timestamps.cbmem_addr, size); tst_p = map_memory_size((unsigned long)timestamps.cbmem_addr, size);
/* Report the base time within the table. */
prev_stamp = 0;
timestamp_print_entry(0, tst_p->base_time, prev_stamp);
prev_stamp = tst_p->base_time;
for (i = 0; i < tst_p->num_entries; i++) { for (i = 0; i < tst_p->num_entries; i++) {
const struct timestamp_entry *tse_p = tst_p->entries + i; uint64_t stamp;
timestamp_print_entry(tse_p->entry_id, tse_p->entry_stamp, const struct timestamp_entry *tse = &tst_p->entries[i];
i ? tse_p[-1].entry_stamp : 0);
/* Make all timestamps absolute. */
stamp = tse->entry_stamp + tst_p->base_time;
timestamp_print_entry(tse->entry_id, stamp, prev_stamp);
prev_stamp = stamp;
} }
unmap_memory(); unmap_memory();