summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-09-23 12:25:43 -0700
committerVadim Bendebury <vbendeb@chromium.org>2011-09-24 10:24:07 -0700
commite57479c1e59afa58a644ece6e578da66427d74cd (patch)
tree80d221b716849a71c6e27e6eab63d026199e624b /board
parent1c823353a5ff505f57ce79e5f9aeace22430b095 (diff)
Refactor hw timer code to accommodate execution tracing.
This CL separates the HW timestamp acquisition into an inline function and provides interface to set the base time (to be retrieved from coreboot table). BUG=chromium-os:20733 TEST=manual . build the new firmaware image . bring up a stumpy with the new image to ChromeOS . examine crossystem reported timer values. Observe that the values start with zero and increase monotonously. Change-Id: I4ede0a55112e061e9d3790f01c8ca41a8539364b Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/8215 Reviewed-by: Stefan Reinauer <reinauer@google.com>
Diffstat (limited to 'board')
-rw-r--r--board/chromebook-x86/vbexport/utility.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/board/chromebook-x86/vbexport/utility.c b/board/chromebook-x86/vbexport/utility.c
index c45d2ff5878..6d178ffe783 100644
--- a/board/chromebook-x86/vbexport/utility.c
+++ b/board/chromebook-x86/vbexport/utility.c
@@ -17,14 +17,16 @@ static uint64_t base_value;
uint64_t VbExGetTimer(void)
{
- uint32_t high, low;
uint64_t time_now;
- __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high));
-
- time_now = ((uint64_t)high << 32) | (uint64_t)low;
+ time_now = rdtsc();
if (!base_value)
base_value = time_now;
return time_now - base_value;
}
+
+void set_base_timer_value(uint64_t new_base)
+{
+ base_value = new_base;
+}