diff options
author | Mattia Dongili <malattia@linux.it> | 2005-11-30 16:00:59 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2005-12-06 22:27:15 -0500 |
commit | 9a7d82a89a8bf55b112f2a5c3b3f405eb95a4303 (patch) | |
tree | 099473309484900e0b0d5263fbadf1c446088e46 /arch/i386/kernel/cpu | |
parent | 1a10760c91c394dfe4adfefeeaf85cd8098c4894 (diff) |
[CPUFREQ] Move PMBASE reading away and do it only once at initialization time
This patch moves away PMBASE reading and only performs it at
cpufreq_register_driver time by exiting with -ENODEV if unable to read
the value.
Signed-off-by: Mattia Dongili <malattia@linux.it>
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch/i386/kernel/cpu')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c index 862e0b5656b9..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 | ||
@@ -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 | ||