aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/cpu
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2007-07-08 17:39:14 -0400
committerDave Jones <davej@redhat.com>2007-07-13 01:29:51 -0400
commit68485695e5a84399da7b48b208ac42623fe22963 (patch)
treed76718f250443ba51eb4c7b2d43dcde44468f595 /arch/i386/kernel/cpu
parent905497c4b2e6715eebde97cbcb313354e14c2489 (diff)
[CPUFREQ] the overdue removal of X86_SPEEDSTEP_CENTRINO_ACPI
This patch contains the overdue removal of X86_SPEEDSTEP_CENTRINO_ACPI. Signed-off-by: Adrian Bunk <bunk@stusta.de> Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch/i386/kernel/cpu')
-rw-r--r--arch/i386/kernel/cpu/cpufreq/Kconfig18
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c276
2 files changed, 18 insertions, 276 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig
index e77754ca94b4..094118ba00da 100644
--- a/arch/i386/kernel/cpu/cpufreq/Kconfig
+++ b/arch/i386/kernel/cpu/cpufreq/Kconfig
@@ -116,7 +116,7 @@ config X86_GX_SUSPMOD
116config X86_SPEEDSTEP_CENTRINO 116config X86_SPEEDSTEP_CENTRINO
117 tristate "Intel Enhanced SpeedStep" 117 tristate "Intel Enhanced SpeedStep"
118 select CPU_FREQ_TABLE 118 select CPU_FREQ_TABLE
119 select X86_SPEEDSTEP_CENTRINO_TABLE if (!X86_SPEEDSTEP_CENTRINO_ACPI) 119 select X86_SPEEDSTEP_CENTRINO_TABLE
120 help 120 help
121 This adds the CPUFreq driver for Enhanced SpeedStep enabled 121 This adds the CPUFreq driver for Enhanced SpeedStep enabled
122 mobile CPUs. This means Intel Pentium M (Centrino) CPUs. However, 122 mobile CPUs. This means Intel Pentium M (Centrino) CPUs. However,
@@ -128,20 +128,6 @@ config X86_SPEEDSTEP_CENTRINO
128 128
129 If in doubt, say N. 129 If in doubt, say N.
130 130
131config X86_SPEEDSTEP_CENTRINO_ACPI
132 bool "Use ACPI tables to decode valid frequency/voltage (deprecated)"
133 depends on X86_SPEEDSTEP_CENTRINO && ACPI_PROCESSOR
134 depends on !(X86_SPEEDSTEP_CENTRINO = y && ACPI_PROCESSOR = m)
135 help
136 This is deprecated and this functionality is now merged into
137 acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
138 speedstep_centrino.
139 Use primarily the information provided in the BIOS ACPI tables
140 to determine valid CPU frequency and voltage pairings. It is
141 required for the driver to work on non-Banias CPUs.
142
143 If in doubt, say Y.
144
145config X86_SPEEDSTEP_CENTRINO_TABLE 131config X86_SPEEDSTEP_CENTRINO_TABLE
146 bool "Built-in tables for Banias CPUs" 132 bool "Built-in tables for Banias CPUs"
147 depends on X86_SPEEDSTEP_CENTRINO 133 depends on X86_SPEEDSTEP_CENTRINO
@@ -237,7 +223,7 @@ comment "shared options"
237config X86_ACPI_CPUFREQ_PROC_INTF 223config X86_ACPI_CPUFREQ_PROC_INTF
238 bool "/proc/acpi/processor/../performance interface (deprecated)" 224 bool "/proc/acpi/processor/../performance interface (deprecated)"
239 depends on PROC_FS 225 depends on PROC_FS
240 depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K7_ACPI || X86_POWERNOW_K8_ACPI 226 depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K7_ACPI || X86_POWERNOW_K8_ACPI
241 help 227 help
242 This enables the deprecated /proc/acpi/processor/../performance 228 This enables the deprecated /proc/acpi/processor/../performance
243 interface. While it is helpful for debugging, the generic, 229 interface. While it is helpful for debugging, the generic,
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index 35489fd68852..6c5dc2c85aeb 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -21,12 +21,6 @@
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/compiler.h> 22#include <linux/compiler.h>
23 23
24#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
25#include <linux/acpi.h>
26#include <linux/dmi.h>
27#include <acpi/processor.h>
28#endif
29
30#include <asm/msr.h> 24#include <asm/msr.h>
31#include <asm/processor.h> 25#include <asm/processor.h>
32#include <asm/cpufeature.h> 26#include <asm/cpufeature.h>
@@ -257,9 +251,7 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
257 /* Matched a non-match */ 251 /* Matched a non-match */
258 dprintk("no table support for CPU model \"%s\"\n", 252 dprintk("no table support for CPU model \"%s\"\n",
259 cpu->x86_model_id); 253 cpu->x86_model_id);
260#ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI 254 dprintk("try using the acpi-cpufreq driver\n");
261 dprintk("try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n");
262#endif
263 return -ENOENT; 255 return -ENOENT;
264 } 256 }
265 257
@@ -346,213 +338,6 @@ static unsigned int get_cur_freq(unsigned int cpu)
346} 338}
347 339
348 340
349#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
350
351static struct acpi_processor_performance *acpi_perf_data[NR_CPUS];
352
353/*
354 * centrino_cpu_early_init_acpi - Do the preregistering with ACPI P-States
355 * library
356 *
357 * Before doing the actual init, we need to do _PSD related setup whenever
358 * supported by the BIOS. These are handled by this early_init routine.
359 */
360static int centrino_cpu_early_init_acpi(void)
361{
362 unsigned int i, j;
363 struct acpi_processor_performance *data;
364
365 for_each_possible_cpu(i) {
366 data = kzalloc(sizeof(struct acpi_processor_performance),
367 GFP_KERNEL);
368 if (!data) {
369 for_each_possible_cpu(j) {
370 kfree(acpi_perf_data[j]);
371 acpi_perf_data[j] = NULL;
372 }
373 return (-ENOMEM);
374 }
375 acpi_perf_data[i] = data;
376 }
377
378 acpi_processor_preregister_performance(acpi_perf_data);
379 return 0;
380}
381
382
383#ifdef CONFIG_SMP
384/*
385 * Some BIOSes do SW_ANY coordination internally, either set it up in hw
386 * or do it in BIOS firmware and won't inform about it to OS. If not
387 * detected, this has a side effect of making CPU run at a different speed
388 * than OS intended it to run at. Detect it and handle it cleanly.
389 */
390static int bios_with_sw_any_bug;
391static int sw_any_bug_found(struct dmi_system_id *d)
392{
393 bios_with_sw_any_bug = 1;
394 return 0;
395}
396
397static struct dmi_system_id sw_any_bug_dmi_table[] = {
398 {
399 .callback = sw_any_bug_found,
400 .ident = "Supermicro Server X6DLP",
401 .matches = {
402 DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"),
403 DMI_MATCH(DMI_BIOS_VERSION, "080010"),
404 DMI_MATCH(DMI_PRODUCT_NAME, "X6DLP"),
405 },
406 },
407 { }
408};
409#endif
410
411/*
412 * centrino_cpu_init_acpi - register with ACPI P-States library
413 *
414 * Register with the ACPI P-States library (part of drivers/acpi/processor.c)
415 * in order to determine correct frequency and voltage pairings by reading
416 * the _PSS of the ACPI DSDT or SSDT tables.
417 */
418static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
419{
420 unsigned long cur_freq;
421 int result = 0, i;
422 unsigned int cpu = policy->cpu;
423 struct acpi_processor_performance *p;
424
425 p = acpi_perf_data[cpu];
426
427 /* register with ACPI core */
428 if (acpi_processor_register_performance(p, cpu)) {
429 dprintk(PFX "obtaining ACPI data failed\n");
430 return -EIO;
431 }
432
433 policy->shared_type = p->shared_type;
434 /*
435 * Will let policy->cpus know about dependency only when software
436 * coordination is required.
437 */
438 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
439 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
440 policy->cpus = p->shared_cpu_map;
441 }
442
443#ifdef CONFIG_SMP
444 dmi_check_system(sw_any_bug_dmi_table);
445 if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) {
446 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL;
447 policy->cpus = cpu_core_map[cpu];
448 }
449#endif
450
451 /* verify the acpi_data */
452 if (p->state_count <= 1) {
453 dprintk("No P-States\n");
454 result = -ENODEV;
455 goto err_unreg;
456 }
457
458 if ((p->control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) ||
459 (p->status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) {
460 dprintk("Invalid control/status registers (%x - %x)\n",
461 p->control_register.space_id, p->status_register.space_id);
462 result = -EIO;
463 goto err_unreg;
464 }
465
466 for (i=0; i<p->state_count; i++) {
467 if ((p->states[i].control & INTEL_MSR_RANGE) !=
468 (p->states[i].status & INTEL_MSR_RANGE)) {
469 dprintk("Different MSR bits in control (%llu) and status (%llu)\n",
470 p->states[i].control, p->states[i].status);
471 result = -EINVAL;
472 goto err_unreg;
473 }
474
475 if (!p->states[i].core_frequency) {
476 dprintk("Zero core frequency for state %u\n", i);
477 result = -EINVAL;
478 goto err_unreg;
479 }
480
481 if (p->states[i].core_frequency > p->states[0].core_frequency) {
482 dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i,
483 p->states[i].core_frequency, p->states[0].core_frequency);
484 p->states[i].core_frequency = 0;
485 continue;
486 }
487 }
488
489 centrino_model[cpu] = kzalloc(sizeof(struct cpu_model), GFP_KERNEL);
490 if (!centrino_model[cpu]) {
491 result = -ENOMEM;
492 goto err_unreg;
493 }
494
495 centrino_model[cpu]->model_name=NULL;
496 centrino_model[cpu]->max_freq = p->states[0].core_frequency * 1000;
497 centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) *
498 (p->state_count + 1), GFP_KERNEL);
499 if (!centrino_model[cpu]->op_points) {
500 result = -ENOMEM;
501 goto err_kfree;
502 }
503
504 for (i=0; i<p->state_count; i++) {
505 centrino_model[cpu]->op_points[i].index = p->states[i].control & INTEL_MSR_RANGE;
506 centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000;
507 dprintk("adding state %i with frequency %u and control value %04x\n",
508 i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index);
509 }
510 centrino_model[cpu]->op_points[p->state_count].frequency = CPUFREQ_TABLE_END;
511
512 cur_freq = get_cur_freq(cpu);
513
514 for (i=0; i<p->state_count; i++) {
515 if (!p->states[i].core_frequency) {
516 dprintk("skipping state %u\n", i);
517 centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID;
518 continue;
519 }
520
521 if (extract_clock(centrino_model[cpu]->op_points[i].index, cpu, 0) !=
522 (centrino_model[cpu]->op_points[i].frequency)) {
523 dprintk("Invalid encoded frequency (%u vs. %u)\n",
524 extract_clock(centrino_model[cpu]->op_points[i].index, cpu, 0),
525 centrino_model[cpu]->op_points[i].frequency);
526 result = -EINVAL;
527 goto err_kfree_all;
528 }
529
530 if (cur_freq == centrino_model[cpu]->op_points[i].frequency)
531 p->state = i;
532 }
533
534 /* notify BIOS that we exist */
535 acpi_processor_notify_smm(THIS_MODULE);
536 printk("speedstep-centrino with X86_SPEEDSTEP_CENTRINO_ACPI "
537 "config is deprecated.\n "
538 "Use X86_ACPI_CPUFREQ (acpi-cpufreq) instead.\n" );
539
540 return 0;
541
542 err_kfree_all:
543 kfree(centrino_model[cpu]->op_points);
544 err_kfree:
545 kfree(centrino_model[cpu]);
546 err_unreg:
547 acpi_processor_unregister_performance(p, cpu);
548 dprintk(PFX "invalid ACPI data\n");
549 return (result);
550}
551#else
552static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; }
553static inline int centrino_cpu_early_init_acpi(void) { return 0; }
554#endif
555
556static int centrino_cpu_init(struct cpufreq_policy *policy) 341static int centrino_cpu_init(struct cpufreq_policy *policy)
557{ 342{
558 struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; 343 struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu];
@@ -568,27 +353,25 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
568 if (cpu_has(cpu, X86_FEATURE_CONSTANT_TSC)) 353 if (cpu_has(cpu, X86_FEATURE_CONSTANT_TSC))
569 centrino_driver.flags |= CPUFREQ_CONST_LOOPS; 354 centrino_driver.flags |= CPUFREQ_CONST_LOOPS;
570 355
571 if (centrino_cpu_init_acpi(policy)) { 356 if (policy->cpu != 0)
572 if (policy->cpu != 0) 357 return -ENODEV;
573 return -ENODEV;
574 358
575 for (i = 0; i < N_IDS; i++) 359 for (i = 0; i < N_IDS; i++)
576 if (centrino_verify_cpu_id(cpu, &cpu_ids[i])) 360 if (centrino_verify_cpu_id(cpu, &cpu_ids[i]))
577 break; 361 break;
578 362
579 if (i != N_IDS) 363 if (i != N_IDS)
580 centrino_cpu[policy->cpu] = &cpu_ids[i]; 364 centrino_cpu[policy->cpu] = &cpu_ids[i];
581 365
582 if (!centrino_cpu[policy->cpu]) { 366 if (!centrino_cpu[policy->cpu]) {
583 dprintk("found unsupported CPU with " 367 dprintk("found unsupported CPU with "
584 "Enhanced SpeedStep: send /proc/cpuinfo to " 368 "Enhanced SpeedStep: send /proc/cpuinfo to "
585 MAINTAINER "\n"); 369 MAINTAINER "\n");
586 return -ENODEV; 370 return -ENODEV;
587 } 371 }
588 372
589 if (centrino_cpu_init_table(policy)) { 373 if (centrino_cpu_init_table(policy)) {
590 return -ENODEV; 374 return -ENODEV;
591 }
592 } 375 }
593 376
594 /* Check to see if Enhanced SpeedStep is enabled, and try to 377 /* Check to see if Enhanced SpeedStep is enabled, and try to
@@ -634,20 +417,6 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy)
634 417
635 cpufreq_frequency_table_put_attr(cpu); 418 cpufreq_frequency_table_put_attr(cpu);
636 419
637#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
638 if (!centrino_model[cpu]->model_name) {
639 static struct acpi_processor_performance *p;
640
641 if (acpi_perf_data[cpu]) {
642 p = acpi_perf_data[cpu];
643 dprintk("unregistering and freeing ACPI data\n");
644 acpi_processor_unregister_performance(p, cpu);
645 kfree(centrino_model[cpu]->op_points);
646 kfree(centrino_model[cpu]);
647 }
648 }
649#endif
650
651 centrino_model[cpu] = NULL; 420 centrino_model[cpu] = NULL;
652 421
653 return 0; 422 return 0;
@@ -849,25 +618,12 @@ static int __init centrino_init(void)
849 if (!cpu_has(cpu, X86_FEATURE_EST)) 618 if (!cpu_has(cpu, X86_FEATURE_EST))
850 return -ENODEV; 619 return -ENODEV;
851 620
852 centrino_cpu_early_init_acpi();
853
854 return cpufreq_register_driver(&centrino_driver); 621 return cpufreq_register_driver(&centrino_driver);
855} 622}
856 623
857static void __exit centrino_exit(void) 624static void __exit centrino_exit(void)
858{ 625{
859#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
860 unsigned int j;
861#endif
862
863 cpufreq_unregister_driver(&centrino_driver); 626 cpufreq_unregister_driver(&centrino_driver);
864
865#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
866 for_each_possible_cpu(j) {
867 kfree(acpi_perf_data[j]);
868 acpi_perf_data[j] = NULL;
869 }
870#endif
871} 627}
872 628
873MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>"); 629MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>");