]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: Support adding coreboot timestanps to bootstage
authorSimon Glass <sjg@chromium.org>
Wed, 17 Apr 2013 16:13:47 +0000 (16:13 +0000)
committerSimon Glass <sjg@chromium.org>
Mon, 13 May 2013 20:33:22 +0000 (13:33 -0700)
Coreboot provides a lot of useful timing information. Provide a facility
to add this to bootstage on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/coreboot/timestamp.c
arch/x86/include/asm/arch-coreboot/timestamp.h

index d26718e65bfd96c4268d9bbbe0d848c9027deaa7..bd3558a0214930331b91f423da43e7012768cb50 100644 (file)
@@ -61,3 +61,41 @@ void timestamp_add_now(enum timestamp_id id)
 {
        timestamp_add(id, rdtsc());
 }
+
+int timestamp_add_to_bootstage(void)
+{
+       uint i;
+
+       if (!ts_table)
+               return -1;
+
+       for (i = 0; i < ts_table->num_entries; i++) {
+               struct timestamp_entry *tse = &ts_table->entries[i];
+               const char *name = NULL;
+
+               switch (tse->entry_id) {
+               case TS_START_ROMSTAGE:
+                       name = "start-romstage";
+                       break;
+               case TS_BEFORE_INITRAM:
+                       name = "before-initram";
+                       break;
+               case TS_DEVICE_INITIALIZE:
+                       name = "device-initialize";
+                       break;
+               case TS_DEVICE_DONE:
+                       name = "device-done";
+                       break;
+               case TS_SELFBOOT_JUMP:
+                       name = "selfboot-jump";
+                       break;
+               }
+               if (name) {
+                       bootstage_add_record(0, name, BOOTSTAGEF_ALLOC,
+                                            tse->entry_stamp /
+                                                       get_tbclk_mhz());
+               }
+       }
+
+       return 0;
+}
index d104912e06628fe91f88383b428df21ef2dc2845..fcfc1d544253d3bd5f82d31c064e3b09ff855f92 100644 (file)
@@ -49,4 +49,11 @@ void timestamp_init(void);
 void timestamp_add(enum timestamp_id id, uint64_t ts_time);
 void timestamp_add_now(enum timestamp_id id);
 
+/**
+ * timestamp_add_to_bootstage - Add important coreboot timestamps to bootstage
+ *
+ * @return 0 if ok, -1 if no timestamps were found
+ */
+int timestamp_add_to_bootstage(void);
+
 #endif