diff options
author | Tom Rini <trini@ti.com> | 2012-12-07 06:43:40 -0700 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-12-07 08:47:59 -0700 |
commit | fd4d564b3c80b111f18c93adb14233a6a7ddb0e9 (patch) | |
tree | a42d63aae4f7c07f441321c18098a85cbcc45dee /arch/x86/lib/timer.c | |
parent | 13d43555a9154cf12255023c47e80d947d7d0604 (diff) | |
parent | ac426b7290e3a96c97fbc093f15cd0660e0edaf2 (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-x86
Diffstat (limited to 'arch/x86/lib/timer.c')
-rw-r--r-- | arch/x86/lib/timer.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/lib/timer.c b/arch/x86/lib/timer.c index fd7032e92c9..a13424b3e37 100644 --- a/arch/x86/lib/timer.c +++ b/arch/x86/lib/timer.c @@ -37,6 +37,7 @@ struct timer_isr_function { static struct timer_isr_function *first_timer_isr; static unsigned long system_ticks; +static uint64_t base_value; /* * register_timer_isr() allows multiple architecture and board specific @@ -98,3 +99,19 @@ ulong get_timer(ulong base) { return system_ticks - base; } + +void timer_set_tsc_base(uint64_t new_base) +{ + base_value = new_base; +} + +uint64_t timer_get_tsc(void) +{ + uint64_t time_now; + + time_now = rdtsc(); + if (!base_value) + base_value = time_now; + + return time_now - base_value; +} |