include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / x86 / kernel / cpu / cpufreq / speedstep-lib.c
index 55c696d..a94ec6b 100644 (file)
@@ -13,9 +13,9 @@
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
-#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, \
@@ -33,7 +33,7 @@ static int relaxed_check;
  *                   GET PROCESSOR CORE SPEED IN KHZ                 *
  *********************************************************************/
 
-static unsigned int pentium3_get_frequency(unsigned int processor)
+static unsigned int pentium3_get_frequency(enum speedstep_processor processor)
 {
        /* See table 14 of p3_ds.pdf and table 22 of 29834003.pdf */
        struct {
@@ -178,6 +178,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);
 
@@ -188,21 +197,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)
@@ -220,7 +225,8 @@ static unsigned int pentium4_get_frequency(void)
 }
 
 
-unsigned int speedstep_get_frequency(unsigned int processor)
+/* Warning: may get called from smp_call_function_single. */
+unsigned int speedstep_get_frequency(enum speedstep_processor processor)
 {
        switch (processor) {
        case SPEEDSTEP_CPU_PCORE:
@@ -373,7 +379,7 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor);
  *                     DETECT SPEEDSTEP SPEEDS                       *
  *********************************************************************/
 
-unsigned int speedstep_get_freqs(unsigned int processor,
+unsigned int speedstep_get_freqs(enum speedstep_processor processor,
                                  unsigned int *low_speed,
                                  unsigned int *high_speed,
                                  unsigned int *transition_latency,