Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132678
b: refs/heads/master
c: 199785e
h: refs/heads/master
v: v3
  • Loading branch information
Matthias-Christian Ott authored and Dave Jones committed Feb 25, 2009
1 parent a0d1d25 commit f06719a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0cb8bc256093e716d2a0a4a721f36c625a3f7634
refs/heads/master: 199785eac892a1fa1b71cc22bec58e8b156d9311
2 changes: 1 addition & 1 deletion trunk/arch/x86/include/asm/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ unsigned long native_calibrate_tsc(void);

#ifdef CONFIG_X86_32
extern int timer_ack;
#endif
extern int recalibrate_cpu_khz(void);
#endif /* CONFIG_X86_32 */

extern int no_timer_check;

Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <asm/processor.h>
#include <asm/msr.h>
#include <asm/timer.h>

#include "speedstep-lib.h"

Expand Down Expand Up @@ -224,6 +225,12 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
dprintk("has errata -- disabling low frequencies\n");
}

if (speedstep_detect_processor() == SPEEDSTEP_CPU_P4D &&
c->x86_model < 2) {
/* switch to maximum frequency and measure result */
cpufreq_p4_setdc(policy->cpu, DC_DISABLE);
recalibrate_cpu_khz();
}
/* get max frequency */
stock_freq = cpufreq_p4_get_frequency(c);
if (!stock_freq)
Expand Down
34 changes: 20 additions & 14 deletions trunk/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/slab.h>

#include <asm/msr.h>
#include <asm/tsc.h>
#include "speedstep-lib.h"

#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
Expand Down Expand Up @@ -178,6 +179,15 @@ static unsigned int pentium4_get_frequency(void)
u32 msr_lo, msr_hi, mult;
unsigned int fsb = 0;
unsigned int ret;
u8 fsb_code;

/* Pentium 4 Model 0 and 1 do not have the Core Clock Frequency
* to System Bus Frequency Ratio Field in the Processor Frequency
* Configuration Register of the MSR. Therefore the current
* frequency cannot be calculated and has to be measured.
*/
if (c->x86_model < 2)
return cpu_khz;

rdmsr(0x2c, msr_lo, msr_hi);

Expand All @@ -188,21 +198,17 @@ static unsigned int pentium4_get_frequency(void)
* revision #12 in Table B-1: MSRs in the Pentium 4 and
* Intel Xeon Processors, on page B-4 and B-5.
*/
if (c->x86_model < 2)
fsb_code = (msr_lo >> 16) & 0x7;
switch (fsb_code) {
case 0:
fsb = 100 * 1000;
else {
u8 fsb_code = (msr_lo >> 16) & 0x7;
switch (fsb_code) {
case 0:
fsb = 100 * 1000;
break;
case 1:
fsb = 13333 * 10;
break;
case 2:
fsb = 200 * 1000;
break;
}
break;
case 1:
fsb = 13333 * 10;
break;
case 2:
fsb = 200 * 1000;
break;
}

if (!fsb)
Expand Down
3 changes: 0 additions & 3 deletions trunk/arch/x86/kernel/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,6 @@ unsigned long native_calibrate_tsc(void)
return tsc_pit_min;
}

#ifdef CONFIG_X86_32
/* Only called from the Powernow K7 cpu freq driver */
int recalibrate_cpu_khz(void)
{
#ifndef CONFIG_SMP
Expand All @@ -546,7 +544,6 @@ int recalibrate_cpu_khz(void)

EXPORT_SYMBOL(recalibrate_cpu_khz);

#endif /* CONFIG_X86_32 */

/* Accelerators for sched_clock()
* convert from cycles(64bits) => nanoseconds (64bits)
Expand Down

0 comments on commit f06719a

Please sign in to comment.