diff options
author | Matthias-Christian Ott <ott@mirix.org> | 2009-02-20 20:52:17 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2009-02-24 22:47:32 -0500 |
commit | 199785eac892a1fa1b71cc22bec58e8b156d9311 (patch) | |
tree | 8e200f33cba62afb37a36d297b2a0224c7b8345b /arch/x86/kernel | |
parent | 0cb8bc256093e716d2a0a4a721f36c625a3f7634 (diff) |
[CPUFREQ] p4-clockmod reports wrong frequency.
http://bugzilla.kernel.org/show_bug.cgi?id=10968
[ Updated for current tree, and fixed compile failure
when p4-clockmod was built modular -- davej]
From: Matthias-Christian Ott <ott@mirix.org>
Signed-off-by: Dominik Brodowski <linux@brodo.de>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/p4-clockmod.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/speedstep-lib.c | 34 | ||||
-rw-r--r-- | arch/x86/kernel/tsc.c | 3 |
3 files changed, 27 insertions, 17 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c index 46a2a7a53148..1778402305e0 100644 --- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c +++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include <asm/processor.h> | 32 | #include <asm/processor.h> |
33 | #include <asm/msr.h> | 33 | #include <asm/msr.h> |
34 | #include <asm/timer.h> | ||
34 | 35 | ||
35 | #include "speedstep-lib.h" | 36 | #include "speedstep-lib.h" |
36 | 37 | ||
@@ -224,6 +225,12 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) | |||
224 | dprintk("has errata -- disabling low frequencies\n"); | 225 | dprintk("has errata -- disabling low frequencies\n"); |
225 | } | 226 | } |
226 | 227 | ||
228 | if (speedstep_detect_processor() == SPEEDSTEP_CPU_P4D && | ||
229 | c->x86_model < 2) { | ||
230 | /* switch to maximum frequency and measure result */ | ||
231 | cpufreq_p4_setdc(policy->cpu, DC_DISABLE); | ||
232 | recalibrate_cpu_khz(); | ||
233 | } | ||
227 | /* get max frequency */ | 234 | /* get max frequency */ |
228 | stock_freq = cpufreq_p4_get_frequency(c); | 235 | stock_freq = cpufreq_p4_get_frequency(c); |
229 | if (!stock_freq) | 236 | if (!stock_freq) |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c index 55c696daa05c..2e3c6862657b 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | 17 | ||
18 | #include <asm/msr.h> | 18 | #include <asm/msr.h> |
19 | #include <asm/tsc.h> | ||
19 | #include "speedstep-lib.h" | 20 | #include "speedstep-lib.h" |
20 | 21 | ||
21 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \ | 22 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \ |
@@ -178,6 +179,15 @@ static unsigned int pentium4_get_frequency(void) | |||
178 | u32 msr_lo, msr_hi, mult; | 179 | u32 msr_lo, msr_hi, mult; |
179 | unsigned int fsb = 0; | 180 | unsigned int fsb = 0; |
180 | unsigned int ret; | 181 | unsigned int ret; |
182 | u8 fsb_code; | ||
183 | |||
184 | /* Pentium 4 Model 0 and 1 do not have the Core Clock Frequency | ||
185 | * to System Bus Frequency Ratio Field in the Processor Frequency | ||
186 | * Configuration Register of the MSR. Therefore the current | ||
187 | * frequency cannot be calculated and has to be measured. | ||
188 | */ | ||
189 | if (c->x86_model < 2) | ||
190 | return cpu_khz; | ||
181 | 191 | ||
182 | rdmsr(0x2c, msr_lo, msr_hi); | 192 | rdmsr(0x2c, msr_lo, msr_hi); |
183 | 193 | ||
@@ -188,21 +198,17 @@ static unsigned int pentium4_get_frequency(void) | |||
188 | * revision #12 in Table B-1: MSRs in the Pentium 4 and | 198 | * revision #12 in Table B-1: MSRs in the Pentium 4 and |
189 | * Intel Xeon Processors, on page B-4 and B-5. | 199 | * Intel Xeon Processors, on page B-4 and B-5. |
190 | */ | 200 | */ |
191 | if (c->x86_model < 2) | 201 | fsb_code = (msr_lo >> 16) & 0x7; |
202 | switch (fsb_code) { | ||
203 | case 0: | ||
192 | fsb = 100 * 1000; | 204 | fsb = 100 * 1000; |
193 | else { | 205 | break; |
194 | u8 fsb_code = (msr_lo >> 16) & 0x7; | 206 | case 1: |
195 | switch (fsb_code) { | 207 | fsb = 13333 * 10; |
196 | case 0: | 208 | break; |
197 | fsb = 100 * 1000; | 209 | case 2: |
198 | break; | 210 | fsb = 200 * 1000; |
199 | case 1: | 211 | break; |
200 | fsb = 13333 * 10; | ||
201 | break; | ||
202 | case 2: | ||
203 | fsb = 200 * 1000; | ||
204 | break; | ||
205 | } | ||
206 | } | 212 | } |
207 | 213 | ||
208 | if (!fsb) | 214 | if (!fsb) |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 599e58168631..5ad22f8f5f3a 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -523,8 +523,6 @@ unsigned long native_calibrate_tsc(void) | |||
523 | return tsc_pit_min; | 523 | return tsc_pit_min; |
524 | } | 524 | } |
525 | 525 | ||
526 | #ifdef CONFIG_X86_32 | ||
527 | /* Only called from the Powernow K7 cpu freq driver */ | ||
528 | int recalibrate_cpu_khz(void) | 526 | int recalibrate_cpu_khz(void) |
529 | { | 527 | { |
530 | #ifndef CONFIG_SMP | 528 | #ifndef CONFIG_SMP |
@@ -546,7 +544,6 @@ int recalibrate_cpu_khz(void) | |||
546 | 544 | ||
547 | EXPORT_SYMBOL(recalibrate_cpu_khz); | 545 | EXPORT_SYMBOL(recalibrate_cpu_khz); |
548 | 546 | ||
549 | #endif /* CONFIG_X86_32 */ | ||
550 | 547 | ||
551 | /* Accelerators for sched_clock() | 548 | /* Accelerators for sched_clock() |
552 | * convert from cycles(64bits) => nanoseconds (64bits) | 549 | * convert from cycles(64bits) => nanoseconds (64bits) |