From 644c3265c7a9b968ee688fbb1d4f468ed141db39 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Wed, 31 Jul 2013 15:47:36 -0700 Subject: [PATCH] Enable timestamps ARM boards' romstage This is needed for timestamps to actually show up in CBMEM. Signed-off-by: Stefan Reinauer BRANCH=none TEST=cbmem -t shows timestamps BUG=chrome-os-partner:18637 Change-Id: Ia6499cbb7c07d15b5c5210eb3911e494efbd5127 Reviewed-on: https://gerrit.chromium.org/gerrit/63992 Reviewed-by: David Hendricks Commit-Queue: Stefan Reinauer Tested-by: Stefan Reinauer --- src/mainboard/google/kirby/romstage.c | 28 +++++++++++++++++++++++++++ src/mainboard/google/pit/romstage.c | 28 +++++++++++++++++++++++++++ src/mainboard/google/snow/romstage.c | 27 ++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/src/mainboard/google/kirby/romstage.c b/src/mainboard/google/kirby/romstage.c index c11f712e65..c277ad4d15 100644 --- a/src/mainboard/google/kirby/romstage.c +++ b/src/mainboard/google/kirby/romstage.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -244,6 +245,14 @@ void main(void) extern struct mem_timings mem_timings; void *entry; int is_resume = (get_wakeup_state() != IS_NOT_WAKEUP); +#if CONFIG_COLLECT_TIMESTAMPS + uint64_t start_romstage_time; + uint64_t before_dram_time; + uint64_t after_dram_time; + uint64_t base_time = timestamp_get(); + + start_romstage_time = timestamp_get(); +#endif /* Clock must be initialized before console_init, otherwise you may need * to re-initialize serial console drivers again. */ @@ -252,8 +261,15 @@ void main(void) console_init(); setup_power(is_resume); +#if CONFIG_COLLECT_TIMESTAMPS + before_dram_time = timestamp_get(); +#endif setup_memory(&mem_timings, is_resume); +#if CONFIG_COLLECT_TIMESTAMPS + after_dram_time = timestamp_get(); +#endif + primitive_mem_test(); if (is_resume) { @@ -272,7 +288,19 @@ void main(void) cbmem_initialize_empty(); +#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 ); +#endif + entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram"); simple_spi_test(); + +#if CONFIG_COLLECT_TIMESTAMPS + timestamp_add_now(TS_END_ROMSTAGE); +#endif + stage_exit(entry); } diff --git a/src/mainboard/google/pit/romstage.c b/src/mainboard/google/pit/romstage.c index 853e24dd70..495110eec5 100644 --- a/src/mainboard/google/pit/romstage.c +++ b/src/mainboard/google/pit/romstage.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -245,6 +246,14 @@ void main(void) extern struct mem_timings mem_timings; void *entry; int is_resume = (get_wakeup_state() != IS_NOT_WAKEUP); +#if CONFIG_COLLECT_TIMESTAMPS + uint64_t start_romstage_time; + uint64_t before_dram_time; + uint64_t after_dram_time; + uint64_t base_time = timestamp_get(); + + start_romstage_time = timestamp_get(); +#endif /* Clock must be initialized before console_init, otherwise you may need * to re-initialize serial console drivers again. */ @@ -253,8 +262,15 @@ void main(void) console_init(); setup_power(is_resume); +#if CONFIG_COLLECT_TIMESTAMPS + before_dram_time = timestamp_get(); +#endif setup_memory(&mem_timings, is_resume); +#if CONFIG_COLLECT_TIMESTAMPS + after_dram_time = timestamp_get(); +#endif + primitive_mem_test(); if (is_resume) { @@ -273,7 +289,19 @@ void main(void) cbmem_initialize_empty(); +#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 ); +#endif + entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram"); simple_spi_test(); + +#if CONFIG_COLLECT_TIMESTAMPS + timestamp_add_now(TS_END_ROMSTAGE); +#endif + stage_exit(entry); } diff --git a/src/mainboard/google/snow/romstage.c b/src/mainboard/google/snow/romstage.c index f69fb1f7eb..e9c3fe3828 100644 --- a/src/mainboard/google/snow/romstage.c +++ b/src/mainboard/google/snow/romstage.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -169,6 +170,14 @@ void main(void) struct mem_timings *mem; void *entry; int is_resume = (get_wakeup_state() != IS_NOT_WAKEUP); +#if CONFIG_COLLECT_TIMESTAMPS + uint64_t start_romstage_time; + uint64_t before_dram_time; + uint64_t after_dram_time; + uint64_t base_time = timestamp_get(); + + start_romstage_time = timestamp_get(); +#endif /* Clock must be initialized before console_init, otherwise you may need * to re-initialize serial console drivers again. */ @@ -177,8 +186,14 @@ void main(void) console_init(); setup_power(is_resume); +#if CONFIG_COLLECT_TIMESTAMPS + before_dram_time = timestamp_get(); +#endif setup_memory(mem, is_resume); +#if CONFIG_COLLECT_TIMESTAMPS + after_dram_time = timestamp_get(); +#endif if (is_resume) { wakeup(); } @@ -192,6 +207,18 @@ void main(void) cbmem_initialize_empty(); +#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 ); +#endif + entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram"); + +#if CONFIG_COLLECT_TIMESTAMPS + timestamp_add_now(TS_END_ROMSTAGE); +#endif + stage_exit(entry); }