Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e74663c5d7eefc1f953b9b0bdacab09917b4eac
Commit:     4e74663c5d7eefc1f953b9b0bdacab09917b4eac
Parent:     e08f5f5bb5dfaaa28d69ffe37eb774533297657f
Author:     Dominik Brodowski <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 31 12:44:08 2006 -0500
Committer:  Dave Jones <[EMAIL PROTECTED]>
CommitDate: Mon Nov 6 19:17:40 2006 -0500

    [CPUFREQ] p4-clockmod: add more CPUs
    
    Several more Intel CPUs are now capable using the p4-clockmod cpufreq
    driver. As it is of limited use most of the time, print a big bold warning
    if a better cpufreq driver might be available.
    
    Signed-off-by: Dominik Brodowski <[EMAIL PROTECTED]>
    Signed-off-by: Dave Jones <[EMAIL PROTECTED]>
---
 arch/i386/kernel/cpu/cpufreq/p4-clockmod.c   |   38 ++++++++++++-------------
 arch/i386/kernel/cpu/cpufreq/speedstep-lib.c |   32 +++++++++++++++++++++
 arch/i386/kernel/cpu/cpufreq/speedstep-lib.h |    1 +
 include/asm-i386/msr.h                       |    2 +
 4 files changed, 53 insertions(+), 20 deletions(-)

diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 
b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
index 304d2ea..bec5017 100644
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -163,29 +163,27 @@ static int cpufreq_p4_verify(struct cpufreq_policy 
*policy)
 
 static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
 {
-       if ((c->x86 == 0x06) && (c->x86_model == 0x09)) {
-               /* Pentium M (Banias) */
-               printk(KERN_WARNING PFX "Warning: Pentium M detected. "
-                      "The speedstep_centrino module offers voltage scaling"
-                      " in addition of frequency scaling. You should use "
-                      "that instead of p4-clockmod, if possible.\n");
-               return 
speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
-       }
-
-       if ((c->x86 == 0x06) && (c->x86_model == 0x0D)) {
-               /* Pentium M (Dothan) */
-               printk(KERN_WARNING PFX "Warning: Pentium M detected. "
-                      "The speedstep_centrino module offers voltage scaling"
-                      " in addition of frequency scaling. You should use "
-                      "that instead of p4-clockmod, if possible.\n");
-               /* on P-4s, the TSC runs with constant frequency independent 
whether
-                * throttling is active or not. */
-               p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
-               return 
speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
+       if (c->x86 == 0x06) {
+               if (cpu_has(c, X86_FEATURE_EST))
+                       printk(KERN_WARNING PFX "Warning: EST-capable CPU 
detected. "
+                              "The acpi-cpufreq module offers voltage scaling"
+                              " in addition of frequency scaling. You should 
use "
+                              "that instead of p4-clockmod, if possible.\n");
+               switch (c->x86_model) {
+               case 0x0E: /* Core */
+               case 0x0F: /* Core Duo */
+                       p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
+                       return 
speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE);
+               case 0x0D: /* Pentium M (Dothan) */
+                       p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
+                       /* fall through */
+               case 0x09: /* Pentium M (Banias) */
+                       return 
speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
+               }
        }
 
        if (c->x86 != 0xF) {
-               printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. 
Please send an e-mail to <[EMAIL PROTECTED]>\n");
+               printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. 
Please send an e-mail to <[EMAIL PROTECTED]>\n");
                return 0;
        }
 
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c 
b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
index 4f46cac..6623a56 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
@@ -123,6 +123,36 @@ static unsigned int pentiumM_get_frequency(void)
        return (msr_tmp * 100 * 1000);
 }
 
+static unsigned int pentium_core_get_frequency(void)
+{
+       u32 fsb = 0;
+       u32 msr_lo, msr_tmp;
+
+       rdmsr(MSR_FSB_FREQ, msr_lo, msr_tmp);
+       /* see table B-2 of 24547212.pdf */
+       switch (msr_lo & 0x07) {
+       case 5:
+               fsb = 400;
+               break;
+       case 1:
+               fsb = 533;
+               break;
+       case 3:
+               fsb = 667;
+               break;
+       default:
+               printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value");
+       }
+
+       rdmsr(MSR_IA32_EBL_CR_POWERON, msr_lo, msr_tmp);
+       dprintk("PCORE - MSR_IA32_EBL_CR_POWERON: 0x%x 0x%x\n", msr_lo, 
msr_tmp);
+
+       msr_tmp = (msr_lo >> 22) & 0x1f;
+       dprintk("bits 22-26 are 0x%x, speed is %u\n", msr_tmp, (msr_tmp * fsb * 
1000));
+
+       return (msr_tmp * fsb * 1000);
+}
+
 
 static unsigned int pentium4_get_frequency(void)
 {
@@ -174,6 +204,8 @@ static unsigned int pentium4_get_frequency(void)
 unsigned int speedstep_get_processor_frequency(unsigned int processor)
 {
        switch (processor) {
+       case SPEEDSTEP_PROCESSOR_PCORE:
+               return pentium_core_get_frequency();
        case SPEEDSTEP_PROCESSOR_PM:
                return pentiumM_get_frequency();
        case SPEEDSTEP_PROCESSOR_P4D:
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h 
b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
index b735429..b11bcc6 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
@@ -22,6 +22,7 @@
  * the speedstep_get_processor_frequency() call. */
 #define SPEEDSTEP_PROCESSOR_PM                 0xFFFFFF03  /* Pentium M  */
 #define SPEEDSTEP_PROCESSOR_P4D                        0xFFFFFF04  /* desktop 
P4  */
+#define SPEEDSTEP_PROCESSOR_PCORE              0xFFFFFF05  /* Core */
 
 /* speedstep states -- only two of them */
 
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h
index 0aa15fc..8c31887 100644
--- a/include/asm-i386/msr.h
+++ b/include/asm-i386/msr.h
@@ -95,6 +95,8 @@ static inline void wrmsrl (unsigned long msr, unsigned long 
long val)
 
 #define MSR_P6_PERFCTR0                0xc1
 #define MSR_P6_PERFCTR1                0xc2
+#define MSR_FSB_FREQ           0xcd
+
 
 #define MSR_IA32_BBL_CR_CTL            0x119
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to