diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2007-11-15 04:06:36 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-11-16 21:46:25 -0500 |
commit | f79f06ab9f86d7203006d2ec8992ac80df36a34e (patch) | |
tree | e7436b83e6315c1c28dd6cbe7fac6c0decd4ecea /drivers/acpi/processor_throttling.c | |
parent | 0ac3c571315a53c14d2733564f14ebdb911fe903 (diff) |
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 <yakui.zhao@intel.com>
Signed-off-by: Li Shaohua <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/processor_throttling.c')
-rw-r--r-- | drivers/acpi/processor_throttling.c | 74 |
1 files changed, 70 insertions, 4 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index f4b5f7d5dbe6..c26c61fb36c3 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) | |||
393 | return 0; | 393 | return 0; |
394 | } | 394 | } |
395 | 395 | ||
396 | #ifdef CONFIG_X86 | ||
397 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | ||
398 | acpi_integer * value) | ||
399 | { | ||
400 | struct cpuinfo_x86 *c; | ||
401 | u64 msr_high, msr_low; | ||
402 | unsigned int cpu; | ||
403 | u64 msr = 0; | ||
404 | int ret = -1; | ||
405 | |||
406 | cpu = pr->id; | ||
407 | c = &cpu_data(cpu); | ||
408 | |||
409 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
410 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
411 | printk(KERN_ERR PREFIX | ||
412 | "HARDWARE addr space,NOT supported yet\n"); | ||
413 | } else { | ||
414 | msr_low = 0; | ||
415 | msr_high = 0; | ||
416 | rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | ||
417 | (u32 *)&msr_low , (u32 *) &msr_high); | ||
418 | msr = (msr_high << 32) | msr_low; | ||
419 | *value = (acpi_integer) msr; | ||
420 | ret = 0; | ||
421 | } | ||
422 | return ret; | ||
423 | } | ||
424 | |||
425 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
426 | { | ||
427 | struct cpuinfo_x86 *c; | ||
428 | unsigned int cpu; | ||
429 | int ret = -1; | ||
430 | u64 msr; | ||
431 | |||
432 | cpu = pr->id; | ||
433 | c = &cpu_data(cpu); | ||
434 | |||
435 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
436 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
437 | printk(KERN_ERR PREFIX | ||
438 | "HARDWARE addr space,NOT supported yet\n"); | ||
439 | } else { | ||
440 | msr = value; | ||
441 | wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | ||
442 | msr & 0xffffffff, msr >> 32); | ||
443 | ret = 0; | ||
444 | } | ||
445 | return ret; | ||
446 | } | ||
447 | #else | ||
448 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | ||
449 | acpi_integer * value) | ||
450 | { | ||
451 | printk(KERN_ERR PREFIX | ||
452 | "HARDWARE addr space,NOT supported yet\n"); | ||
453 | return -1; | ||
454 | } | ||
455 | |||
456 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
457 | { | ||
458 | printk(KERN_ERR PREFIX | ||
459 | "HARDWARE addr space,NOT supported yet\n"); | ||
460 | return -1; | ||
461 | } | ||
462 | #endif | ||
463 | |||
396 | static int acpi_read_throttling_status(struct acpi_processor *pr, | 464 | static int acpi_read_throttling_status(struct acpi_processor *pr, |
397 | acpi_integer *value) | 465 | acpi_integer *value) |
398 | { | 466 | { |
@@ -417,8 +485,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr, | |||
417 | ret = 0; | 485 | ret = 0; |
418 | break; | 486 | break; |
419 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 487 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
420 | printk(KERN_ERR PREFIX | 488 | ret = acpi_throttling_rdmsr(pr, value); |
421 | "HARDWARE addr space,NOT supported yet\n"); | ||
422 | break; | 489 | break; |
423 | default: | 490 | default: |
424 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 491 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
@@ -451,8 +518,7 @@ static int acpi_write_throttling_state(struct acpi_processor *pr, | |||
451 | ret = 0; | 518 | ret = 0; |
452 | break; | 519 | break; |
453 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 520 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
454 | printk(KERN_ERR PREFIX | 521 | ret = acpi_throttling_wrmsr(pr, value); |
455 | "HARDWARE addr space,NOT supported yet\n"); | ||
456 | break; | 522 | break; |
457 | default: | 523 | default: |
458 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 524 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |