diff options
Diffstat (limited to 'arch/i386/kernel/cpu/cpufreq/speedstep-smi.c')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c index cfc4276e670e..c28333d53646 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | |||
@@ -13,8 +13,8 @@ | |||
13 | *********************************************************************/ | 13 | *********************************************************************/ |
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/cpufreq.h> | 19 | #include <linux/cpufreq.h> |
20 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
@@ -28,21 +28,21 @@ | |||
28 | * | 28 | * |
29 | * These parameters are got from IST-SMI BIOS call. | 29 | * These parameters are got from IST-SMI BIOS call. |
30 | * If user gives it, these are used. | 30 | * If user gives it, these are used. |
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | static int smi_port = 0; | 33 | static int smi_port = 0; |
34 | static int smi_cmd = 0; | 34 | static int smi_cmd = 0; |
35 | static unsigned int smi_sig = 0; | 35 | static unsigned int smi_sig = 0; |
36 | 36 | ||
37 | /* info about the processor */ | 37 | /* info about the processor */ |
38 | static unsigned int speedstep_processor = 0; | 38 | static unsigned int speedstep_processor = 0; |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * There are only two frequency states for each processor. Values | 41 | * There are only two frequency states for each processor. Values |
42 | * are in kHz for the time being. | 42 | * are in kHz for the time being. |
43 | */ | 43 | */ |
44 | static struct cpufreq_frequency_table speedstep_freqs[] = { | 44 | static struct cpufreq_frequency_table speedstep_freqs[] = { |
45 | {SPEEDSTEP_HIGH, 0}, | 45 | {SPEEDSTEP_HIGH, 0}, |
46 | {SPEEDSTEP_LOW, 0}, | 46 | {SPEEDSTEP_LOW, 0}, |
47 | {0, CPUFREQ_TABLE_END}, | 47 | {0, CPUFREQ_TABLE_END}, |
48 | }; | 48 | }; |
@@ -125,7 +125,7 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high) | |||
125 | *low = low_mhz * 1000; | 125 | *low = low_mhz * 1000; |
126 | 126 | ||
127 | return result; | 127 | return result; |
128 | } | 128 | } |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * speedstep_get_state - set the SpeedStep state | 131 | * speedstep_get_state - set the SpeedStep state |
@@ -206,7 +206,7 @@ static void speedstep_set_state (unsigned int state) | |||
206 | * speedstep_target - set a new CPUFreq policy | 206 | * speedstep_target - set a new CPUFreq policy |
207 | * @policy: new policy | 207 | * @policy: new policy |
208 | * @target_freq: new freq | 208 | * @target_freq: new freq |
209 | * @relation: | 209 | * @relation: |
210 | * | 210 | * |
211 | * Sets a new CPUFreq policy/freq. | 211 | * Sets a new CPUFreq policy/freq. |
212 | */ | 212 | */ |
@@ -285,7 +285,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
285 | state = speedstep_get_state(); | 285 | state = speedstep_get_state(); |
286 | speed = speedstep_freqs[state].frequency; | 286 | speed = speedstep_freqs[state].frequency; |
287 | 287 | ||
288 | dprintk("currently at %s speed setting - %i MHz\n", | 288 | dprintk("currently at %s speed setting - %i MHz\n", |
289 | (speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high", | 289 | (speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high", |
290 | (speed / 1000)); | 290 | (speed / 1000)); |
291 | 291 | ||
@@ -298,7 +298,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
298 | if (result) | 298 | if (result) |
299 | return (result); | 299 | return (result); |
300 | 300 | ||
301 | cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu); | 301 | cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu); |
302 | 302 | ||
303 | return 0; | 303 | return 0; |
304 | } | 304 | } |
@@ -334,8 +334,8 @@ static struct freq_attr* speedstep_attr[] = { | |||
334 | 334 | ||
335 | static struct cpufreq_driver speedstep_driver = { | 335 | static struct cpufreq_driver speedstep_driver = { |
336 | .name = "speedstep-smi", | 336 | .name = "speedstep-smi", |
337 | .verify = speedstep_verify, | 337 | .verify = speedstep_verify, |
338 | .target = speedstep_target, | 338 | .target = speedstep_target, |
339 | .init = speedstep_cpu_init, | 339 | .init = speedstep_cpu_init, |
340 | .exit = speedstep_cpu_exit, | 340 | .exit = speedstep_cpu_exit, |
341 | .get = speedstep_get, | 341 | .get = speedstep_get, |
@@ -372,13 +372,12 @@ static int __init speedstep_init(void) | |||
372 | return -ENODEV; | 372 | return -ENODEV; |
373 | } | 373 | } |
374 | 374 | ||
375 | dprintk("signature:0x%.8lx, command:0x%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n", | 375 | dprintk("signature:0x%.8lx, command:0x%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n", |
376 | ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level); | 376 | ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level); |
377 | 377 | ||
378 | 378 | /* Error if no IST-SMI BIOS or no PARM | |
379 | /* Error if no IST-SMI BIOS or no PARM | ||
380 | sig= 'ISGE' aka 'Intel Speedstep Gate E' */ | 379 | sig= 'ISGE' aka 'Intel Speedstep Gate E' */ |
381 | if ((ist_info.signature != 0x47534943) && ( | 380 | if ((ist_info.signature != 0x47534943) && ( |
382 | (smi_port == 0) || (smi_cmd == 0))) | 381 | (smi_port == 0) || (smi_cmd == 0))) |
383 | return -ENODEV; | 382 | return -ENODEV; |
384 | 383 | ||
@@ -388,17 +387,15 @@ static int __init speedstep_init(void) | |||
388 | smi_sig = ist_info.signature; | 387 | smi_sig = ist_info.signature; |
389 | 388 | ||
390 | /* setup smi_port from MODLULE_PARM or BIOS */ | 389 | /* setup smi_port from MODLULE_PARM or BIOS */ |
391 | if ((smi_port > 0xff) || (smi_port < 0)) { | 390 | if ((smi_port > 0xff) || (smi_port < 0)) |
392 | return -EINVAL; | 391 | return -EINVAL; |
393 | } else if (smi_port == 0) { | 392 | else if (smi_port == 0) |
394 | smi_port = ist_info.command & 0xff; | 393 | smi_port = ist_info.command & 0xff; |
395 | } | ||
396 | 394 | ||
397 | if ((smi_cmd > 0xff) || (smi_cmd < 0)) { | 395 | if ((smi_cmd > 0xff) || (smi_cmd < 0)) |
398 | return -EINVAL; | 396 | return -EINVAL; |
399 | } else if (smi_cmd == 0) { | 397 | else if (smi_cmd == 0) |
400 | smi_cmd = (ist_info.command >> 16) & 0xff; | 398 | smi_cmd = (ist_info.command >> 16) & 0xff; |
401 | } | ||
402 | 399 | ||
403 | return cpufreq_register_driver(&speedstep_driver); | 400 | return cpufreq_register_driver(&speedstep_driver); |
404 | } | 401 | } |