Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f79f06ab9f86d7203006d2ec8992ac80df36a34e
Commit:     f79f06ab9f86d7203006d2ec8992ac80df36a34e
Parent:     0ac3c571315a53c14d2733564f14ebdb911fe903
Author:     Zhao Yakui <[EMAIL PROTECTED]>
AuthorDate: Thu Nov 15 17:06:36 2007 +0800
Committer:  Len Brown <[EMAIL PROTECTED]>
CommitDate: Fri Nov 16 21:46:25 2007 -0500

    ACPI: Enable MSR (FixedHW) support for T-States
    
    Add throttling control via MSR when T-states uses
    the FixHW Control Status registers.
    
    Signed-off-by: Zhao Yakui <[EMAIL PROTECTED]>
    Signed-off-by: Li Shaohua <[EMAIL PROTECTED]>
    Signed-off-by: Len Brown <[EMAIL PROTECTED]>
---
 arch/x86/kernel/acpi/processor.c    |    3 +
 drivers/acpi/processor_throttling.c |   74 +++++++++++++++++++++++++++++++++--
 2 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index f63e5ff..a25db51 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct 
cpuinfo_x86 *c)
        if (cpu_has(c, X86_FEATURE_EST))
                buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
 
+       if (cpu_has(c, X86_FEATURE_ACPI))
+               buf[2] |= ACPI_PDC_T_FFH;
+
        obj->type = ACPI_TYPE_BUFFER;
        obj->buffer.length = 12;
        obj->buffer.pointer = (u8 *) buf;
diff --git a/drivers/acpi/processor_throttling.c 
b/drivers/acpi/processor_throttling.c
index f4b5f7d..c26c61f 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -393,6 +393,74 @@ static int acpi_processor_get_throttling_fadt(struct 
acpi_processor *pr)
        return 0;
 }
 
+#ifdef CONFIG_X86
+static int acpi_throttling_rdmsr(struct acpi_processor *pr,
+                                       acpi_integer * value)
+{
+       struct cpuinfo_x86 *c;
+       u64 msr_high, msr_low;
+       unsigned int cpu;
+       u64 msr = 0;
+       int ret = -1;
+
+       cpu = pr->id;
+       c = &cpu_data(cpu);
+
+       if ((c->x86_vendor != X86_VENDOR_INTEL) ||
+               !cpu_has(c, X86_FEATURE_ACPI)) {
+               printk(KERN_ERR PREFIX
+                       "HARDWARE addr space,NOT supported yet\n");
+       } else {
+               msr_low = 0;
+               msr_high = 0;
+               rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
+                       (u32 *)&msr_low , (u32 *) &msr_high);
+               msr = (msr_high << 32) | msr_low;
+               *value = (acpi_integer) msr;
+               ret = 0;
+       }
+       return ret;
+}
+
+static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
+{
+       struct cpuinfo_x86 *c;
+       unsigned int cpu;
+       int ret = -1;
+       u64 msr;
+
+       cpu = pr->id;
+       c = &cpu_data(cpu);
+
+       if ((c->x86_vendor != X86_VENDOR_INTEL) ||
+               !cpu_has(c, X86_FEATURE_ACPI)) {
+               printk(KERN_ERR PREFIX
+                       "HARDWARE addr space,NOT supported yet\n");
+       } else {
+               msr = value;
+               wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
+                       msr & 0xffffffff, msr >> 32);
+               ret = 0;
+       }
+       return ret;
+}
+#else
+static int acpi_throttling_rdmsr(struct acpi_processor *pr,
+                               acpi_integer * value)
+{
+       printk(KERN_ERR PREFIX
+               "HARDWARE addr space,NOT supported yet\n");
+       return -1;
+}
+
+static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
+{
+       printk(KERN_ERR PREFIX
+               "HARDWARE addr space,NOT supported yet\n");
+       return -1;
+}
+#endif
+
 static int acpi_read_throttling_status(struct acpi_processor *pr,
                                        acpi_integer *value)
 {
@@ -417,8 +485,7 @@ static int acpi_read_throttling_status(struct 
acpi_processor *pr,
                ret = 0;
                break;
        case ACPI_ADR_SPACE_FIXED_HARDWARE:
-               printk(KERN_ERR PREFIX
-                      "HARDWARE addr space,NOT supported yet\n");
+               ret = acpi_throttling_rdmsr(pr, value);
                break;
        default:
                printk(KERN_ERR PREFIX "Unknown addr space %d\n",
@@ -451,8 +518,7 @@ static int acpi_write_throttling_state(struct 
acpi_processor *pr,
                ret = 0;
                break;
        case ACPI_ADR_SPACE_FIXED_HARDWARE:
-               printk(KERN_ERR PREFIX
-                      "HARDWARE addr space,NOT supported yet\n");
+               ret = acpi_throttling_wrmsr(pr, value);
                break;
        default:
                printk(KERN_ERR PREFIX "Unknown addr space %d\n",
-
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