timestamps: Stash early timestamps in CAR_GLOBAL

Change-Id: I87b454c748cf885491d5b38bfe53a2ec0e9f38c5
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3910
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
Kyösti Mälkki 2013-09-07 20:26:36 +03:00
parent b766b1c76a
commit 3d45c40776
14 changed files with 74 additions and 244 deletions

View File

@ -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)

View File

@ -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();
}

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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. */

View File

@ -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. */

View File

@ -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();

View File

@ -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();