[coreboot-gerrit] New patch to review for coreboot: 757c1cd cbmem: print timestamp names

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Tue Dec 3 20:26:37 CET 2013


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4314

-gerrit

commit 757c1cd13ec2688474dd982b59fe22064212bbdc
Author: Stefan Reinauer <reinauer at chromium.org>
Date:   Fri Aug 9 11:06:11 2013 -0700

    cbmem: print timestamp names
    
    The numbers alone are hard to parse, so add
    some timestamp names to make it easier to read.
    
    Change-Id: Ie32d3e7ca759bd15e7c160bdd829dec19943e6cb
    Signed-off-by: Stefan Reinauer <reinauer at google.com>
    Reviewed-on: https://gerrit.chromium.org/gerrit/65333
    Reviewed-by: David Hendricks <dhendrix at chromium.org>
    Reviewed-by: Ronald G. Minnich <rminnich at chromium.org>
    Reviewed-by: Marc Jones <marc.jones at se-eng.com>
    Commit-Queue: Stefan Reinauer <reinauer at chromium.org>
---
 util/cbmem/cbmem.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 78 insertions(+), 10 deletions(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 520a486..dd80c08 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -331,6 +331,82 @@ static void print_norm(u64 v, int comma)
 		printf(",");
 }
 
+enum additional_timestamp_id {
+	// Depthcharge entry IDs start at 1000.
+	TS_DC_START = 1000,
+
+	TS_RO_PARAMS_INIT = 1001,
+	TS_RO_VB_INIT = 1002,
+	TS_RO_VB_SELECT_FIRMWARE = 1003,
+	TS_RO_VB_SELECT_AND_LOAD_KERNEL = 1004,
+
+	TS_RW_VB_SELECT_AND_LOAD_KERNEL = 1010,
+
+	TS_VB_SELECT_AND_LOAD_KERNEL = 1020,
+
+	TS_CROSSYSTEM_DATA = 1100,
+	TS_START_KERNEL = 1101
+};
+
+static const struct timestamp_id_to_name {
+	u32 id;
+	const char *name;
+} timestamp_ids[] = {
+	{ TS_START_ROMSTAGE,	"start of rom stage" },
+	{ TS_BEFORE_INITRAM,	"before ram initialization" },
+	{ TS_AFTER_INITRAM,	"after ram initialization" },
+	{ TS_END_ROMSTAGE,	"end of romstage" },
+	{ TS_START_VBOOT,	"start of verified boot" },
+	{ TS_END_VBOOT,		"end of verified boot" },
+	{ TS_START_COPYRAM,	"start of copying ram stage" },
+	{ TS_END_COPYRAM,	"end of copying ram stage" },
+	{ TS_START_RAMSTAGE,	"start of ramstage" },
+	{ TS_DEVICE_ENUMERATE,	"device enumeration" },
+	{ TS_DEVICE_CONFIGURE,	"device configuration" },
+	{ TS_DEVICE_ENABLE,	"device enable" },
+	{ TS_DEVICE_INITIALIZE,	"device initialization" },
+	{ TS_DEVICE_DONE,	"device setup done" },
+	{ TS_CBMEM_POST,	"cbmem post" },
+	{ TS_WRITE_TABLES,	"write tables" },
+	{ TS_LOAD_PAYLOAD,	"load payload" },
+	{ TS_ACPI_WAKE_JUMP,	"ACPI wake jump" },
+	{ TS_SELFBOOT_JUMP,	"selfboot jump" },
+	{ TS_DC_START,		"depthcharge start" },
+	{ TS_RO_PARAMS_INIT,	"RO parameter init" },
+	{ TS_RO_VB_INIT,	"RO vboot init" },
+	{ TS_RO_VB_SELECT_FIRMWARE,		"RO vboot select firmware" },
+	{ TS_RO_VB_SELECT_AND_LOAD_KERNEL,	"RO vboot select&load kernel" },
+	{ TS_RW_VB_SELECT_AND_LOAD_KERNEL,	"RW vboot select&load kernel" },
+	{ TS_VB_SELECT_AND_LOAD_KERNEL,		"vboot select&load kernel" },
+	{ TS_CROSSYSTEM_DATA,	"crossystem data" },
+	{ TS_START_KERNEL,	"start kernel" }
+};
+
+void timestamp_print_entry(uint32_t id, uint64_t stamp, uint64_t prev_stamp)
+{
+	int i;
+	const char *name;
+
+	name = "<unknown>";
+	for (i = 0; i < ARRAY_SIZE(timestamp_ids); i++) {
+		if (timestamp_ids[i].id == id) {
+			name = timestamp_ids[i].name;
+			break;
+		}
+	}
+
+	printf("%4d:", id);
+	printf("%-30s", name);
+	print_norm(arch_convert_raw_ts_entry(stamp), 0);
+	if (prev_stamp) {
+		printf(" (");
+		print_norm(arch_convert_raw_ts_entry(stamp
+				- prev_stamp), 0);
+		printf(")");
+	}
+	printf("\n");
+}
+
 /* dump the timestamp table */
 static void dump_timestamps(void)
 {
@@ -348,16 +424,8 @@ static void dump_timestamps(void)
 	printf("%d entries total:\n\n", tst_p->num_entries);
 	for (i = 0; i < tst_p->num_entries; i++) {
 		const struct timestamp_entry *tse_p = tst_p->entries + i;
-
-		printf("%4d:", tse_p->entry_id);
-		print_norm(arch_convert_raw_ts_entry(tse_p->entry_stamp), 0);
-		if (i) {
-			printf(" (");
-			print_norm(arch_convert_raw_ts_entry(tse_p->entry_stamp
-					- tse_p[-1].entry_stamp), 0);
-			printf(")");
-		}
-		printf("\n");
+		timestamp_print_entry(tse_p->entry_id, tse_p->entry_stamp,
+			i ? tse_p[-1].entry_stamp : 0);
 	}
 
 	unmap_memory();



More information about the coreboot-gerrit mailing list