diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 19:21:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 19:21:26 -0500 |
commit | 0356dbb7fe87ba59558902e536d9f960e87353c1 (patch) | |
tree | 2cb23f809c838f0bd7406845ea0a8e7cb5875c99 /arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | |
parent | e28cc71572da38a5a12c1cfe4d7032017adccf69 (diff) | |
parent | 95235ca2c20ac0b31a8eb39e2d599bcc3e9c9a10 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
Diffstat (limited to 'arch/i386/kernel/cpu/cpufreq/speedstep-ich.c')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c index 5b7d18a06afa..b425cd3d1838 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | |||
@@ -40,6 +40,7 @@ static struct pci_dev *speedstep_chipset_dev; | |||
40 | */ | 40 | */ |
41 | static unsigned int speedstep_processor = 0; | 41 | static unsigned int speedstep_processor = 0; |
42 | 42 | ||
43 | static u32 pmbase; | ||
43 | 44 | ||
44 | /* | 45 | /* |
45 | * There are only two frequency states for each processor. Values | 46 | * There are only two frequency states for each processor. Values |
@@ -56,34 +57,47 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { | |||
56 | 57 | ||
57 | 58 | ||
58 | /** | 59 | /** |
59 | * speedstep_set_state - set the SpeedStep state | 60 | * speedstep_find_register - read the PMBASE address |
60 | * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) | ||
61 | * | 61 | * |
62 | * Tries to change the SpeedStep state. | 62 | * Returns: -ENODEV if no register could be found |
63 | */ | 63 | */ |
64 | static void speedstep_set_state (unsigned int state) | 64 | static int speedstep_find_register (void) |
65 | { | 65 | { |
66 | u32 pmbase; | 66 | if (!speedstep_chipset_dev) |
67 | u8 pm2_blk; | 67 | return -ENODEV; |
68 | u8 value; | ||
69 | unsigned long flags; | ||
70 | |||
71 | if (!speedstep_chipset_dev || (state > 0x1)) | ||
72 | return; | ||
73 | 68 | ||
74 | /* get PMBASE */ | 69 | /* get PMBASE */ |
75 | pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); | 70 | pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); |
76 | if (!(pmbase & 0x01)) { | 71 | if (!(pmbase & 0x01)) { |
77 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); | 72 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); |
78 | return; | 73 | return -ENODEV; |
79 | } | 74 | } |
80 | 75 | ||
81 | pmbase &= 0xFFFFFFFE; | 76 | pmbase &= 0xFFFFFFFE; |
82 | if (!pmbase) { | 77 | if (!pmbase) { |
83 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); | 78 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); |
84 | return; | 79 | return -ENODEV; |
85 | } | 80 | } |
86 | 81 | ||
82 | dprintk("pmbase is 0x%x\n", pmbase); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * speedstep_set_state - set the SpeedStep state | ||
88 | * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) | ||
89 | * | ||
90 | * Tries to change the SpeedStep state. | ||
91 | */ | ||
92 | static void speedstep_set_state (unsigned int state) | ||
93 | { | ||
94 | u8 pm2_blk; | ||
95 | u8 value; | ||
96 | unsigned long flags; | ||
97 | |||
98 | if (state > 0x1) | ||
99 | return; | ||
100 | |||
87 | /* Disable IRQs */ | 101 | /* Disable IRQs */ |
88 | local_irq_save(flags); | 102 | local_irq_save(flags); |
89 | 103 | ||
@@ -315,10 +329,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
315 | cpus_allowed = current->cpus_allowed; | 329 | cpus_allowed = current->cpus_allowed; |
316 | set_cpus_allowed(current, policy->cpus); | 330 | set_cpus_allowed(current, policy->cpus); |
317 | 331 | ||
318 | /* detect low and high frequency */ | 332 | /* detect low and high frequency and transition latency */ |
319 | result = speedstep_get_freqs(speedstep_processor, | 333 | result = speedstep_get_freqs(speedstep_processor, |
320 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, | 334 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, |
321 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, | 335 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, |
336 | &policy->cpuinfo.transition_latency, | ||
322 | &speedstep_set_state); | 337 | &speedstep_set_state); |
323 | set_cpus_allowed(current, cpus_allowed); | 338 | set_cpus_allowed(current, cpus_allowed); |
324 | if (result) | 339 | if (result) |
@@ -335,7 +350,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
335 | 350 | ||
336 | /* cpuinfo and default policy values */ | 351 | /* cpuinfo and default policy values */ |
337 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 352 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
338 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | ||
339 | policy->cur = speed; | 353 | policy->cur = speed; |
340 | 354 | ||
341 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); | 355 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); |
@@ -400,6 +414,9 @@ static int __init speedstep_init(void) | |||
400 | return -EINVAL; | 414 | return -EINVAL; |
401 | } | 415 | } |
402 | 416 | ||
417 | if (speedstep_find_register()) | ||
418 | return -ENODEV; | ||
419 | |||
403 | return cpufreq_register_driver(&speedstep_driver); | 420 | return cpufreq_register_driver(&speedstep_driver); |
404 | } | 421 | } |
405 | 422 | ||