Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11540
-gerrit
commit 37fa5de61c1751104e26eb6f7e5143ce1fd7055c Author: Aaron Durbin adurbin@chromium.org Date: Fri Aug 28 01:58:18 2015 -0500
skylake: allow timer_monotonic_get() in all stages
The timer_monotonic_get() function wasn't being compiled for romstage. To simplify the implementation don't keep track of partial microsecond ticks and just return the MSR value divided by 24 (24MHz clock).
BUG=chrome-os-partner:42115 BRANCH=None TEST=Build and booted glados. Used monotonic timers in romstage in subsequent patches.
Change-Id: I8294c74abe09947fb4438bf5c1d0fc5265491694 Signed-off-by: Patrick Georgi pgeorgi@chromium.org Original-Commit-Id: 6d60ef204fc92c26748ab57d4ff37830cd8dc664 Original-Change-Id: Ibdb6b9e20b9f2d48ff0f8a8c782f5c1f7ddde4f7 Original-Signed-off-by: Aaron Durbin adurbin@chromium.org Original-Reviewed-on: https://chromium-review.googlesource.com/295237 Original-Reviewed-by: Duncan Laurie dlaurie@chromium.org --- src/soc/intel/skylake/Makefile.inc | 1 + src/soc/intel/skylake/monotonic_timer.c | 27 ++------------------------- 2 files changed, 3 insertions(+), 25 deletions(-)
diff --git a/src/soc/intel/skylake/Makefile.inc b/src/soc/intel/skylake/Makefile.inc index defb945..3bd9823 100644 --- a/src/soc/intel/skylake/Makefile.inc +++ b/src/soc/intel/skylake/Makefile.inc @@ -13,6 +13,7 @@ subdirs-y += ../../../cpu/x86/tsc romstage-y += flash_controller.c romstage-y += gpio.c romstage-y += memmap.c +romstage-y += monotonic_timer.c romstage-y += pch.c romstage-y += pcr.c romstage-y += pei_data.c diff --git a/src/soc/intel/skylake/monotonic_timer.c b/src/soc/intel/skylake/monotonic_timer.c index 35ad911..55430ef 100644 --- a/src/soc/intel/skylake/monotonic_timer.c +++ b/src/soc/intel/skylake/monotonic_timer.c @@ -23,12 +23,6 @@ #include <timer.h> #include <soc/msr.h>
-static struct monotonic_counter { - int initialized; - struct mono_time time; - uint32_t last_value; -} mono_counter; - static inline uint32_t read_counter_msr(void) { /* @@ -44,23 +38,6 @@ static inline uint32_t read_counter_msr(void)
void timer_monotonic_get(struct mono_time *mt) { - uint32_t current_tick; - uint32_t usecs_elapsed; - - if (!mono_counter.initialized) { - mono_counter.last_value = read_counter_msr(); - mono_counter.initialized = 1; - } - - current_tick = read_counter_msr(); - usecs_elapsed = (current_tick - mono_counter.last_value) / 24; - - /* Update current time and tick values only if a full tick occurred. */ - if (usecs_elapsed) { - mono_time_add_usecs(&mono_counter.time, usecs_elapsed); - mono_counter.last_value = current_tick; - } - - /* Save result. */ - *mt = mono_counter.time; + /* Always increases. Don't normalize to 0 between stages. */ + mono_time_set_usecs(mt, read_counter_msr() / 24); }