From b9adf7ba4bf6e8f11bf174973230c5317cbb3b6d Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 12 Nov 2012 10:14:55 -0600 Subject: [PATCH] haswell: use #defines for constants in udelay.c Change the hard coded values in udelay.c to use the #defines for MSRs and BCLK. Change-Id: I2bbeb0b478d2e3ca155e8f82006df86c29a4f018 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/2629 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/northbridge/intel/haswell/udelay.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/northbridge/intel/haswell/udelay.c b/src/northbridge/intel/haswell/udelay.c index 864e83915c..f5d541e8e1 100644 --- a/src/northbridge/intel/haswell/udelay.c +++ b/src/northbridge/intel/haswell/udelay.c @@ -21,10 +21,7 @@ #include #include #include - -/** - * Intel SandyBridge/IvyBridge CPUs always run the TSC at BCLK=100MHz - */ +#include "cpu/intel/haswell/haswell.h" /* Simple 32- to 64-bit multiplication. Uses 16-bit words to avoid overflow. */ static inline void multiply_to_tsc(tsc_t *const tsc, const u32 a, const u32 b) @@ -42,13 +39,13 @@ void udelay(u32 us) u32 dword; tsc_t tsc, tsc1, tscd; msr_t msr; - u32 fsb = 100, divisor; + u32 divisor; u32 d; /* ticks per us */ - msr = rdmsr(0xce); + msr = rdmsr(MSR_PLATFORM_INFO); divisor = (msr.lo >> 8) & 0xff; - d = fsb * divisor; /* On Core/Core2 this is divided by 4 */ + d = HASWELL_BCLK * divisor; multiply_to_tsc(&tscd, us, d); tsc1 = rdtsc();