[2.5. PATCH] cpufreq: correct initialization on Intel Coppermines

From: Dominik Brodowski (linux@brodo.de)
Date: Fri Nov 08 2002 - 03:22:41 EST


[2.5. PATCH] cpufreq: Intel Coppermines -- the saga continues.

The detection process for speedstep-enabled Pentium III Coppermines is
considered proprietary by Intel. The attempt to detect this
capability using MSRs failed. So, users need to pass the option
"speedstep_coppermine=1" to the kernel (boot option or parameter) if
they own a SpeedStep capable PIII Coppermine processor. Tualatins work
as before.

       Dominik

--- linux-2546original/arch/i386/kernel/cpu/cpufreq/speedstep.c Tue Nov 5 12:27:14 2002
+++ linux/arch/i386/kernel/cpu/cpufreq/speedstep.c Tue Nov 5 13:01:39 2002
@@ -1,5 +1,5 @@
 /*
- * $Id: speedstep.c,v 1.53 2002/09/29 23:43:11 db Exp $
+ * $Id: speedstep.c,v 1.57 2002/11/05 12:01:12 db Exp $
  *
  * (C) 2001 Dave Jones, Arjan van de ven.
  * (C) 2002 Dominik Brodowski <linux@brodo.de>
@@ -46,7 +46,8 @@
 
 /* speedstep_processor
  */
-static unsigned int speedstep_processor;
+static unsigned int speedstep_processor = 0;
+static int speedstep_coppermine = 0;
 
 #define SPEEDSTEP_PROCESSOR_PIII_C 0x00000001 /* Coppermine core */
 #define SPEEDSTEP_PROCESSOR_PIII_T 0x00000002 /* Tualatin core */
@@ -72,7 +73,7 @@
 #ifdef SPEEDSTEP_DEBUG
 #define dprintk(msg...) printk(msg)
 #else
-#define dprintk(msg...) do { } while(0);
+#define dprintk(msg...) do { } while(0)
 #endif
 
 
@@ -429,7 +430,7 @@
 /**
  * speedstep_detect_processor - detect Intel SpeedStep-capable processors.
  *
- * Returns the SPEEDSTEP_PROCESSOR_-number for the detected chipset,
+ * Returns the SPEEDSTEP_PROCESSOR_-number for the detected processor,
  * or zero on failure.
  */
 static unsigned int speedstep_detect_processor (void)
@@ -474,8 +475,6 @@
                 return SPEEDSTEP_PROCESSOR_PIII_T;
 
         case 0x08: /* Intel PIII [Coppermine] */
- /* based on reverse-engineering information and
- * some guessing. HANDLE WITH CARE! */
                  {
                         u32 msr_lo, msr_hi;
 
@@ -487,21 +486,13 @@
                         if (msr_lo != 0x0080000)
                                 return 0;
 
- /* platform ID seems to be 0x00140000 */
- rdmsr(MSR_IA32_PLATFORM_ID, msr_lo, msr_hi);
- dprintk(KERN_DEBUG "cpufreq: Coppermine: MSR_IA32_PLATFORM ID is 0x%x, 0x%x\n", msr_lo, msr_hi);
- msr_hi = msr_lo & 0x001c0000;
- if (msr_hi != 0x00140000)
- return 0;
-
- /* and these bits seem to be either 00_b, 01_b or
- * 10_b but never 11_b */
- msr_lo &= 0x00030000;
- if (msr_lo == 0x0030000)
- return 0;
+ if (speedstep_coppermine)
+ return SPEEDSTEP_PROCESSOR_PIII_C;
 
- /* let's hope this is correct... */
- return SPEEDSTEP_PROCESSOR_PIII_C;
+ printk(KERN_INFO "cpufreq: in case this is a SpeedStep-capable Intel Pentium III Coppermine\n");
+ printk(KERN_INFO "cpufreq: processor, please pass the boot option or module parameter\n");
+ printk(KERN_INFO "cpufreq: `speedstep_coppermine=1` to the kernel. Thanks!\n");
+ return 0;
                 }
 
         default:
@@ -622,6 +613,25 @@
 }
 
 
+#ifndef MODULE
+/**
+ * speedstep_setup speedstep command line parameter parsing
+ *
+ * speedstep command line parameter. Use:
+ * speedstep_coppermine=1
+ * if the CPU in your notebook is a SpeedStep-capable Intel
+ * Pentium III Coppermine. These processors cannot be detected
+ * automatically, as Intel continues to consider the detection
+ * alogrithm as proprietary material.
+ */
+static int __init speedstep_setup(char *str)
+{
+ speedstep_coppermine = simple_strtoul(str, &str, 0);
+ return 1;
+}
+__setup("speedstep_coppermine=", speedstep_setup);
+#endif
+
 /**
  * speedstep_init - initializes the SpeedStep CPUFreq driver
  *
@@ -637,18 +647,19 @@
 
 
         /* detect chipset */
- speedstep_chipset = speedstep_detect_chipset();
+ speedstep_chipset = speedstep_detect_chipset();
 
         /* detect chipset */
         if (speedstep_chipset)
                 speedstep_processor = speedstep_detect_processor();
 
         if ((!speedstep_chipset) || (!speedstep_processor)) {
- dprintk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) for this %s not (yet) available.\n", speedstep_processor ? "chipset" : "processor");
+ printk(KERN_INFO "a 0x%x b 0x%x\n", speedstep_processor, speedstep_chipset);
+ printk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) for this %s not (yet) available.\n", speedstep_chipset ? "processor" : "chipset");
                 return -ENODEV;
         }
 
- dprintk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) support $Revision: 1.53 $\n");
+ dprintk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) support $Revision: 1.57 $\n");
         dprintk(KERN_DEBUG "cpufreq: chipset 0x%x - processor 0x%x\n",
                speedstep_chipset, speedstep_processor);
 
@@ -726,3 +737,5 @@
 MODULE_LICENSE ("GPL");
 module_init(speedstep_init);
 module_exit(speedstep_exit);
+
+MODULE_PARM (speedstep_coppermine, "i");



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 15 2002 - 22:00:15 EST