summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpu/intel/haswell/romstage.c29
-rw-r--r--src/lib/timestamp.c21
-rw-r--r--src/mainboard/emulation/qemu-i440fx/romstage.c4
-rw-r--r--src/mainboard/emulation/qemu-q35/romstage.c4
-rw-r--r--src/mainboard/google/butterfly/romstage.c26
-rw-r--r--src/mainboard/google/link/romstage.c26
-rw-r--r--src/mainboard/google/parrot/romstage.c26
-rw-r--r--src/mainboard/google/stout/romstage.c26
-rw-r--r--src/mainboard/intel/emeraldlake2/romstage.c26
-rw-r--r--src/mainboard/kontron/ktqm77/romstage.c26
-rw-r--r--src/mainboard/lenovo/t60/romstage.c26
-rw-r--r--src/mainboard/lenovo/x60/romstage.c26
-rw-r--r--src/mainboard/samsung/lumpy/romstage.c26
-rw-r--r--src/mainboard/samsung/stumpy/romstage.c26
14 files changed, 74 insertions, 244 deletions
diff --git a/src/cpu/intel/haswell/romstage.c b/src/cpu/intel/haswell/romstage.c
index 06e3a8516a..e62b894bb9 100644
--- a/src/cpu/intel/haswell/romstage.c
+++ b/src/cpu/intel/haswell/romstage.c
@@ -200,16 +200,8 @@ void romstage_common(const struct romstage_params *params)
int wake_from_s3;
struct romstage_handoff *handoff;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
-
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (params->bist == 0)
enable_lapic();
@@ -249,17 +241,15 @@ void romstage_common(const struct romstage_params *params)
post_code(0x3a);
params->pei_data->boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+
+ timestamp_add_now(TS_BEFORE_INITRAM);
report_platform_info();
sdram_initialize(params->pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
+
post_code(0x3b);
intel_early_me_status();
@@ -288,13 +278,8 @@ void romstage_common(const struct romstage_params *params)
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
}
static inline void prepare_for_resume(struct romstage_handoff *handoff)
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 7e2f7011e6..eac33a2aff 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -114,7 +114,10 @@ static void timestamp_do_sync(void)
void timestamp_init(tsc_t base)
{
-#ifndef __PRE_RAM__
+#ifdef __PRE_RAM__
+ /* Copy of basetime, it is too early for CBMEM. */
+ ts_basetime = base;
+#else
struct timestamp_table* tst;
/* Locate and use an already existing table. */
@@ -123,19 +126,21 @@ void timestamp_init(tsc_t base)
ts_table = tst;
return;
}
-#endif
+ /* Copy of basetime, may be too early for CBMEM. */
+ ts_basetime = base;
timestamp_real_init(base);
- if (ts_table)
- timestamp_do_sync();
- else
- ts_basetime = base;
+#endif
}
-#ifndef __PRE_RAM__
void timestamp_sync(void)
{
+#ifdef __PRE_RAM__
+ timestamp_real_init(ts_basetime);
+#else
if (!ts_table)
timestamp_init(ts_basetime);
-}
#endif
+ if (ts_table)
+ timestamp_do_sync();
+}
diff --git a/src/mainboard/emulation/qemu-i440fx/romstage.c b/src/mainboard/emulation/qemu-i440fx/romstage.c
index 413f7451dd..70c720263a 100644
--- a/src/mainboard/emulation/qemu-i440fx/romstage.c
+++ b/src/mainboard/emulation/qemu-i440fx/romstage.c
@@ -49,10 +49,10 @@ void main(unsigned long bist)
//dump_pci_devices();
cbmem_was_initted = !cbmem_initialize();
-#if CONFIG_COLLECT_TIMESTAMPS
+
timestamp_init(rdtsc());
+ timestamp_sync();
timestamp_add_now(TS_START_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/emulation/qemu-q35/romstage.c b/src/mainboard/emulation/qemu-q35/romstage.c
index e9cd801068..abc9474f2c 100644
--- a/src/mainboard/emulation/qemu-q35/romstage.c
+++ b/src/mainboard/emulation/qemu-q35/romstage.c
@@ -51,10 +51,10 @@ void main(unsigned long bist)
//dump_pci_devices();
cbmem_was_initted = !cbmem_initialize();
-#if CONFIG_COLLECT_TIMESTAMPS
+
timestamp_init(rdtsc());
+ timestamp_sync();
timestamp_add_now(TS_START_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/google/butterfly/romstage.c b/src/mainboard/google/butterfly/romstage.c
index 554df8357d..670fc005ee 100644
--- a/src/mainboard/google/butterfly/romstage.c
+++ b/src/mainboard/google/butterfly/romstage.c
@@ -118,12 +118,6 @@ void main(unsigned long bist)
u32 pm1_cnt;
u16 pm1_sts;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
struct pei_data pei_data = {
pei_version: PEI_VERSION,
mchbar: DEFAULT_MCHBAR,
@@ -170,9 +164,8 @@ void main(unsigned long bist)
},
};
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -237,14 +230,10 @@ void main(unsigned long bist)
post_code(0x3a);
pei_data.boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(&pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3c);
rcba_config();
@@ -284,13 +273,8 @@ void main(unsigned long bist)
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/google/link/romstage.c b/src/mainboard/google/link/romstage.c
index ad4da8452b..aaecfc6230 100644
--- a/src/mainboard/google/link/romstage.c
+++ b/src/mainboard/google/link/romstage.c
@@ -154,12 +154,6 @@ void main(unsigned long bist)
u32 pm1_cnt;
u16 pm1_sts;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
struct pei_data pei_data = {
pei_version: PEI_VERSION,
mchbar: DEFAULT_MCHBAR,
@@ -206,9 +200,8 @@ void main(unsigned long bist)
},
};
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -280,14 +273,10 @@ void main(unsigned long bist)
post_code(0x3a);
pei_data.boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(&pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3c);
rcba_config();
@@ -327,13 +316,8 @@ void main(unsigned long bist)
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/google/parrot/romstage.c b/src/mainboard/google/parrot/romstage.c
index 79f9c2a8e5..444386f1fd 100644
--- a/src/mainboard/google/parrot/romstage.c
+++ b/src/mainboard/google/parrot/romstage.c
@@ -119,12 +119,6 @@ void main(unsigned long bist)
u32 pm1_cnt;
u16 pm1_sts;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
struct pei_data pei_data = {
pei_version: PEI_VERSION,
mchbar: DEFAULT_MCHBAR,
@@ -171,9 +165,8 @@ void main(unsigned long bist)
},
};
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -238,14 +231,10 @@ void main(unsigned long bist)
post_code(0x3a);
pei_data.boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(&pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3c);
rcba_config();
@@ -285,13 +274,8 @@ void main(unsigned long bist)
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/google/stout/romstage.c b/src/mainboard/google/stout/romstage.c
index 312483a319..5ace4f6e82 100644
--- a/src/mainboard/google/stout/romstage.c
+++ b/src/mainboard/google/stout/romstage.c
@@ -158,12 +158,6 @@ void main(unsigned long bist)
u32 pm1_cnt;
u16 pm1_sts;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
struct pei_data pei_data = {
pei_version: PEI_VERSION,
mchbar: DEFAULT_MCHBAR,
@@ -215,9 +209,8 @@ void main(unsigned long bist)
},
};
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -287,14 +280,10 @@ void main(unsigned long bist)
post_code(0x3a);
pei_data.boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(&pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3b);
/* Perform some initialization that must run before stage2 */
early_pch_init();
@@ -341,13 +330,8 @@ void main(unsigned long bist)
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/intel/emeraldlake2/romstage.c b/src/mainboard/intel/emeraldlake2/romstage.c
index bb47cb8ff3..09dc60b23b 100644
--- a/src/mainboard/intel/emeraldlake2/romstage.c
+++ b/src/mainboard/intel/emeraldlake2/romstage.c
@@ -170,12 +170,6 @@ void main(unsigned long bist)
u32 pm1_cnt;
u16 pm1_sts;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
struct pei_data pei_data = {
pei_version: PEI_VERSION,
mchbar: DEFAULT_MCHBAR,
@@ -220,9 +214,8 @@ void main(unsigned long bist)
},
};
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -286,14 +279,10 @@ void main(unsigned long bist)
post_code(0x3a);
pei_data.boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(&pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3b);
/* Perform some initialization that must run before stage2 */
early_pch_init();
@@ -339,13 +328,8 @@ void main(unsigned long bist)
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/kontron/ktqm77/romstage.c b/src/mainboard/kontron/ktqm77/romstage.c
index f78e293b81..22fff4201b 100644
--- a/src/mainboard/kontron/ktqm77/romstage.c
+++ b/src/mainboard/kontron/ktqm77/romstage.c
@@ -156,12 +156,6 @@ void main(unsigned long bist)
u32 pm1_cnt;
u16 pm1_sts;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
struct pei_data pei_data = {
pei_version: PEI_VERSION,
mchbar: DEFAULT_MCHBAR,
@@ -216,9 +210,8 @@ void main(unsigned long bist)
pcie_init: 1,
};
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -289,14 +282,10 @@ void main(unsigned long bist)
post_code(0x3a);
pei_data.boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(&pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3c);
rcba_config();
@@ -333,13 +322,8 @@ void main(unsigned long bist)
}
#endif
post_code(0x3f);
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/lenovo/t60/romstage.c b/src/mainboard/lenovo/t60/romstage.c
index 79a2988aa0..42514e3af6 100644
--- a/src/mainboard/lenovo/t60/romstage.c
+++ b/src/mainboard/lenovo/t60/romstage.c
@@ -212,16 +212,9 @@ void main(unsigned long bist)
int cbmem_was_initted;
const u8 spd_addrmap[2 * DIMM_SOCKETS] = { 0x50, 0x52, 0x51, 0x53 };
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -291,13 +284,9 @@ void main(unsigned long bist)
dump_spd_registers();
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(boot_mode, spd_addrmap);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
/* Perform some initialization that must run before stage2 */
early_ich7_init();
@@ -354,13 +343,8 @@ void main(unsigned long bist)
}
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c
index ec4c00c708..97317f8ef5 100644
--- a/src/mainboard/lenovo/x60/romstage.c
+++ b/src/mainboard/lenovo/x60/romstage.c
@@ -219,16 +219,9 @@ void main(unsigned long bist)
int cbmem_was_initted;
const u8 spd_addrmap[2 * DIMM_SOCKETS] = { 0x50, 0x52, 0x51, 0x53 };
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -293,13 +286,9 @@ void main(unsigned long bist)
dump_spd_registers();
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(boot_mode, spd_addrmap);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
/* Perform some initialization that must run before stage2 */
early_ich7_init();
@@ -358,13 +347,8 @@ void main(unsigned long bist)
}
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time);
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time);
- timestamp_add(TS_AFTER_INITRAM, after_dram_time);
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
diff --git a/src/mainboard/samsung/lumpy/romstage.c b/src/mainboard/samsung/lumpy/romstage.c
index 1a17949d2f..d7b165b6d6 100644
--- a/src/mainboard/samsung/lumpy/romstage.c
+++ b/src/mainboard/samsung/lumpy/romstage.c
@@ -137,12 +137,6 @@ void main(unsigned long bist)
u32 pm1_cnt;
u16 pm1_sts;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
struct pei_data pei_data = {
pei_version: PEI_VERSION,
mchbar: DEFAULT_MCHBAR,
@@ -192,9 +186,8 @@ void main(unsigned long bist)
spd_blob *spd_data;
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -307,14 +300,10 @@ void main(unsigned long bist)
post_code(0x39);
pei_data.boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(&pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3a);
/* Perform some initialization that must run before stage2 */
early_pch_init();
@@ -358,13 +347,8 @@ void main(unsigned long bist)
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();
diff --git a/src/mainboard/samsung/stumpy/romstage.c b/src/mainboard/samsung/stumpy/romstage.c
index 1169732a7c..b0ac5a892d 100644
--- a/src/mainboard/samsung/stumpy/romstage.c
+++ b/src/mainboard/samsung/stumpy/romstage.c
@@ -173,12 +173,6 @@ void main(unsigned long bist)
u32 pm1_cnt;
u16 pm1_sts;
-#if CONFIG_COLLECT_TIMESTAMPS
- tsc_t start_romstage_time;
- tsc_t before_dram_time;
- tsc_t after_dram_time;
- tsc_t base_time = get_initial_timestamp();
-#endif
struct pei_data pei_data = {
pei_version: PEI_VERSION,
mchbar: DEFAULT_MCHBAR,
@@ -223,9 +217,8 @@ void main(unsigned long bist)
},
};
-#if CONFIG_COLLECT_TIMESTAMPS
- start_romstage_time = rdtsc();
-#endif
+ timestamp_init(get_initial_timestamp());
+ timestamp_add_now(TS_START_ROMSTAGE);
if (bist == 0)
enable_lapic();
@@ -315,14 +308,10 @@ void main(unsigned long bist)
post_code(0x39);
pei_data.boot_mode = boot_mode;
-#if CONFIG_COLLECT_TIMESTAMPS
- before_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_BEFORE_INITRAM);
sdram_initialize(&pei_data);
-#if CONFIG_COLLECT_TIMESTAMPS
- after_dram_time = rdtsc();
-#endif
+ timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3a);
/* Perform some initialization that must run before stage2 */
early_pch_init();
@@ -365,13 +354,8 @@ void main(unsigned long bist)
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
-#if CONFIG_COLLECT_TIMESTAMPS
- timestamp_init(base_time);
- timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
- timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
- timestamp_add(TS_AFTER_INITRAM, after_dram_time );
+ timestamp_sync();
timestamp_add_now(TS_END_ROMSTAGE);
-#endif
#if CONFIG_CONSOLE_CBMEM
/* Keep this the last thing this function does. */
cbmemc_reinit();