diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-08-30 21:19:55 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-08-31 13:55:28 +0000 |
commit | c49014e7507b02c5f5ca249e7ab86a65394d12b0 (patch) | |
tree | 537a90aaf5ecdbd57532305bf02545f692f40e55 /src/lib/timestamp.c | |
parent | 60391b65fdaca3a365cb16d891f0541c74e866b4 (diff) | |
download | coreboot-c49014e7507b02c5f5ca249e7ab86a65394d12b0.tar.xz |
timestamp: add tick frequency to exported table
Add the timestamp tick frequency within the timestamp table so
the cbmem utility doesn't try to figure it out on its own. Those
paths still exist for x86 systems which don't provide tsc_freq_mhz().
All other non-x86 systems use the monotonic timer which has a 1us
granularity or 1MHz.
One of the main reasons is that Linux is reporting
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq as the true
turbo frequency on turbo enables machines. This change also fixes
the p-state values honored in cpufreq for turbo machines in that
turbo p-pstates were reported as 100MHz greater than nominal.
BUG=chrome-os-partner:44669
BRANCH=firmware-strago-7287.B
TEST=Built and booted on glados. Confirmed table frequency honored.
Change-Id: I763fe2d9a7b01d0ef5556e5abff36032062f5801
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/11470
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/lib/timestamp.c')
-rw-r--r-- | src/lib/timestamp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index ca25093423..21b3d29a53 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -278,6 +278,10 @@ static void timestamp_sync_cache_to_cbmem(int is_recovery) if (ts_cbmem_table->base_time == 0) ts_cbmem_table->base_time = ts_cache_table->base_time; + /* Seed the timestamp tick frequency in ramstage. */ + if (ENV_RAMSTAGE) + ts_cbmem_table->tick_freq_mhz = timestamp_tick_freq_mhz(); + /* Cache no longer required. */ ts_cache_table->num_entries = 0; ts_cache->cache_state = TIMESTAMP_CACHE_NOT_NEEDED; @@ -299,3 +303,9 @@ uint64_t __attribute__((weak)) timestamp_get(void) return mono_time_diff_microseconds(&t1, &t2); } + +/* Like timestamp_get() above this matches up with microsecond granularity. */ +int __attribute__((weak)) timestamp_tick_freq_mhz(void) +{ + return 1; +} |