From 473013a8219176a39cbdabb5caabaf341d8ce44b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 10 Feb 2013 01:13:56 +0000 Subject: [PATCH] Don't calibrate TSC if PMTIMER is already set up Signed-off-by: David Woodhouse --- src/clock.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/clock.c b/src/clock.c index bbcafd7..708d413 100644 --- a/src/clock.c +++ b/src/clock.c @@ -65,10 +65,20 @@ u32 cpu_khz VAR16VISIBLE; u8 no_tsc VAR16VISIBLE; +u16 pmtimer_ioport VAR16VISIBLE; +u32 pmtimer_wraps VARLOW; +u32 pmtimer_last VARLOW; + static void calibrate_tsc(void) { u32 eax, ebx, ecx, edx, cpuid_features = 0; + + if (CONFIG_PMTIMER && GET_GLOBAL(pmtimer_ioport)) { + dprintf(3, "pmtimer already configured; will not calibrate TSC\n"); + return; + } + cpuid(0, &eax, &ebx, &ecx, &edx); if (eax > 0) cpuid(1, &eax, &ebx, &ecx, &cpuid_features); @@ -129,10 +139,6 @@ emulate_tsc(void) return ret; } -u16 pmtimer_ioport VAR16VISIBLE; -u32 pmtimer_wraps VARLOW; -u32 pmtimer_last VARLOW; - void pmtimer_setup(u16 ioport, u32 khz) { if (!CONFIG_PMTIMER) -- 2.39.5