* [PATCH 1/4] speedstep-centrino: move to per-CPU analyzing of CPUs
@ 2004-02-20 8:44 Dominik Brodowski
2004-02-20 23:37 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Brodowski @ 2004-02-20 8:44 UTC (permalink / raw)
To: davej, jeremy; +Cc: cpufreq
Move the table matching into an own function; only the FEATURE_EST bit is checked
in module_init() directly. As cpufreq drivers aren't sticky any longer (see other
pending patch sent to cpufreq mailing list a few minutes ago), this will not
change user-visible behaviour.
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | 106 ++++++++++++----------
1 files changed, 60 insertions(+), 46 deletions(-)
diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c linux/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
--- linux-original/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c 2004-02-18 10:22:09.000000000 +0100
+++ linux/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c 2004-02-19 16:59:58.093560440 +0100
@@ -187,6 +187,45 @@
};
#undef CPU
+static int centrino_cpu_init_table(struct cpufreq_policy *policy)
+{
+ struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu];
+ const struct cpu_model *model;
+
+ if (!cpu_has(cpu, X86_FEATURE_EST))
+ return -ENODEV;
+
+ /* Only Intel Pentium M stepping 5 for now - add new CPUs as
+ they appear after making sure they use PERF_CTL in the same
+ way. */
+ if (cpu->x86_vendor != X86_VENDOR_INTEL ||
+ cpu->x86 != 6 ||
+ cpu->x86_model != 9 ||
+ cpu->x86_mask != 5) {
+ printk(KERN_INFO PFX "found unsupported CPU with Enhanced SpeedStep: "
+ "send /proc/cpuinfo to " MAINTAINER "\n");
+ return -ENODEV;
+ }
+
+ for(model = models; model->model_name != NULL; model++)
+ if (strcmp(cpu->x86_model_id, model->model_name) == 0)
+ break;
+ if (model->model_name == NULL) {
+ printk(KERN_INFO PFX "no support for CPU model \"%s\": "
+ "send /proc/cpuinfo to " MAINTAINER "\n",
+ cpu->x86_model_id);
+ return -ENOENT;
+ }
+
+ centrino_model = model;
+
+ printk(KERN_INFO PFX "found \"%s\": max frequency: %dkHz\n",
+ model->model_name, model->max_freq);
+
+ return 0;
+}
+
+
/* Extract clock in kHz from PERF_CTL value */
static unsigned extract_clock(unsigned msr)
{
@@ -206,10 +245,30 @@
static int centrino_cpu_init(struct cpufreq_policy *policy)
{
unsigned freq;
+ unsigned l, h;
- if (policy->cpu != 0 || centrino_model == NULL)
+ if (policy->cpu != 0)
return -ENODEV;
+ if (centrino_cpu_init_table(policy))
+ return -ENODEV;
+
+ /* Check to see if Enhanced SpeedStep is enabled, and try to
+ enable it if not. */
+ rdmsr(MSR_IA32_MISC_ENABLE, l, h);
+
+ if (!(l & (1<<16))) {
+ l |= (1<<16);
+ wrmsr(MSR_IA32_MISC_ENABLE, l, h);
+
+ /* check to see if it stuck */
+ rdmsr(MSR_IA32_MISC_ENABLE, l, h);
+ if (!(l & (1<<16))) {
+ printk(KERN_INFO PFX "couldn't enable Enhanced SpeedStep\n");
+ return -ENODEV;
+ }
+ }
+
freq = get_cur_freq();
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
@@ -322,55 +381,10 @@
static int __init centrino_init(void)
{
struct cpuinfo_x86 *cpu = cpu_data;
- const struct cpu_model *model;
- unsigned l, h;
if (!cpu_has(cpu, X86_FEATURE_EST))
return -ENODEV;
- /* Only Intel Pentium M stepping 5 for now - add new CPUs as
- they appear after making sure they use PERF_CTL in the same
- way. */
- if (cpu->x86_vendor != X86_VENDOR_INTEL ||
- cpu->x86 != 6 ||
- cpu->x86_model != 9 ||
- cpu->x86_mask != 5) {
- printk(KERN_INFO PFX "found unsupported CPU with Enhanced SpeedStep: "
- "send /proc/cpuinfo to " MAINTAINER "\n");
- return -ENODEV;
- }
-
- /* Check to see if Enhanced SpeedStep is enabled, and try to
- enable it if not. */
- rdmsr(MSR_IA32_MISC_ENABLE, l, h);
-
- if (!(l & (1<<16))) {
- l |= (1<<16);
- wrmsr(MSR_IA32_MISC_ENABLE, l, h);
-
- /* check to see if it stuck */
- rdmsr(MSR_IA32_MISC_ENABLE, l, h);
- if (!(l & (1<<16))) {
- printk(KERN_INFO PFX "couldn't enable Enhanced SpeedStep\n");
- return -ENODEV;
- }
- }
-
- for(model = models; model->model_name != NULL; model++)
- if (strcmp(cpu->x86_model_id, model->model_name) == 0)
- break;
- if (model->model_name == NULL) {
- printk(KERN_INFO PFX "no support for CPU model \"%s\": "
- "send /proc/cpuinfo to " MAINTAINER "\n",
- cpu->x86_model_id);
- return -ENOENT;
- }
-
- centrino_model = model;
-
- printk(KERN_INFO PFX "found \"%s\": max frequency: %dkHz\n",
- model->model_name, model->max_freq);
-
return cpufreq_register_driver(¢rino_driver);
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 1/4] speedstep-centrino: move to per-CPU analyzing of CPUs
2004-02-20 8:44 [PATCH 1/4] speedstep-centrino: move to per-CPU analyzing of CPUs Dominik Brodowski
@ 2004-02-20 23:37 ` Jeremy Fitzhardinge
0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Fitzhardinge @ 2004-02-20 23:37 UTC (permalink / raw)
To: Dominik Brodowski; +Cc: davej, cpufreq list
On Fri, 2004-02-20 at 00:44, Dominik Brodowski wrote:
> Move the table matching into an own function; only the FEATURE_EST bit is checked
> in module_init() directly. As cpufreq drivers aren't sticky any longer (see other
> pending patch sent to cpufreq mailing list a few minutes ago), this will not
> change user-visible behaviour.
These all look reasonable to me. I tried testing the ACPI table change,
but it isn't obvious about where it gets its frequency table from - it
might be nice to add a hint to the banner.
J
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-20 23:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-20 8:44 [PATCH 1/4] speedstep-centrino: move to per-CPU analyzing of CPUs Dominik Brodowski
2004-02-20 23:37 ` Jeremy Fitzhardinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox