diff options
author | Len Brown <len.brown@intel.com> | 2006-06-15 21:39:25 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-06-15 21:39:25 -0400 |
commit | d42510a0f58c2583c37c8e9b7548e3a68545863a (patch) | |
tree | 9d44b95405b9f0083e911a66cc5512860293f95a /arch/i386/kernel/cpu | |
parent | 8f2ddb37e564a9616c05fa0d5652e0049072a730 (diff) | |
parent | 193de0c79da580eb33a66113b62e2378fc1fb629 (diff) |
Pull bugzilla-5737 into release branch
Conflicts:
arch/x86_64/kernel/acpi/processor.c
Diffstat (limited to 'arch/i386/kernel/cpu')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 289 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | 250 |
2 files changed, 385 insertions, 154 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 3852d0a4c1b5..11da3ca237e3 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -48,12 +48,13 @@ MODULE_LICENSE("GPL"); | |||
48 | 48 | ||
49 | 49 | ||
50 | struct cpufreq_acpi_io { | 50 | struct cpufreq_acpi_io { |
51 | struct acpi_processor_performance acpi_data; | 51 | struct acpi_processor_performance *acpi_data; |
52 | struct cpufreq_frequency_table *freq_table; | 52 | struct cpufreq_frequency_table *freq_table; |
53 | unsigned int resume; | 53 | unsigned int resume; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; | 56 | static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; |
57 | static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; | ||
57 | 58 | ||
58 | static struct cpufreq_driver acpi_cpufreq_driver; | 59 | static struct cpufreq_driver acpi_cpufreq_driver; |
59 | 60 | ||
@@ -104,64 +105,43 @@ acpi_processor_set_performance ( | |||
104 | { | 105 | { |
105 | u16 port = 0; | 106 | u16 port = 0; |
106 | u8 bit_width = 0; | 107 | u8 bit_width = 0; |
108 | int i = 0; | ||
107 | int ret = 0; | 109 | int ret = 0; |
108 | u32 value = 0; | 110 | u32 value = 0; |
109 | int i = 0; | ||
110 | struct cpufreq_freqs cpufreq_freqs; | ||
111 | cpumask_t saved_mask; | ||
112 | int retval; | 111 | int retval; |
112 | struct acpi_processor_performance *perf; | ||
113 | 113 | ||
114 | dprintk("acpi_processor_set_performance\n"); | 114 | dprintk("acpi_processor_set_performance\n"); |
115 | 115 | ||
116 | /* | 116 | retval = 0; |
117 | * TBD: Use something other than set_cpus_allowed. | 117 | perf = data->acpi_data; |
118 | * As set_cpus_allowed is a bit racy, | 118 | if (state == perf->state) { |
119 | * with any other set_cpus_allowed for this process. | ||
120 | */ | ||
121 | saved_mask = current->cpus_allowed; | ||
122 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | ||
123 | if (smp_processor_id() != cpu) { | ||
124 | return (-EAGAIN); | ||
125 | } | ||
126 | |||
127 | if (state == data->acpi_data.state) { | ||
128 | if (unlikely(data->resume)) { | 119 | if (unlikely(data->resume)) { |
129 | dprintk("Called after resume, resetting to P%d\n", state); | 120 | dprintk("Called after resume, resetting to P%d\n", state); |
130 | data->resume = 0; | 121 | data->resume = 0; |
131 | } else { | 122 | } else { |
132 | dprintk("Already at target state (P%d)\n", state); | 123 | dprintk("Already at target state (P%d)\n", state); |
133 | retval = 0; | 124 | return (retval); |
134 | goto migrate_end; | ||
135 | } | 125 | } |
136 | } | 126 | } |
137 | 127 | ||
138 | dprintk("Transitioning from P%d to P%d\n", | 128 | dprintk("Transitioning from P%d to P%d\n", perf->state, state); |
139 | data->acpi_data.state, state); | ||
140 | |||
141 | /* cpufreq frequency struct */ | ||
142 | cpufreq_freqs.cpu = cpu; | ||
143 | cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency; | ||
144 | cpufreq_freqs.new = data->freq_table[state].frequency; | ||
145 | |||
146 | /* notify cpufreq */ | ||
147 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); | ||
148 | 129 | ||
149 | /* | 130 | /* |
150 | * First we write the target state's 'control' value to the | 131 | * First we write the target state's 'control' value to the |
151 | * control_register. | 132 | * control_register. |
152 | */ | 133 | */ |
153 | 134 | ||
154 | port = data->acpi_data.control_register.address; | 135 | port = perf->control_register.address; |
155 | bit_width = data->acpi_data.control_register.bit_width; | 136 | bit_width = perf->control_register.bit_width; |
156 | value = (u32) data->acpi_data.states[state].control; | 137 | value = (u32) perf->states[state].control; |
157 | 138 | ||
158 | dprintk("Writing 0x%08x to port 0x%04x\n", value, port); | 139 | dprintk("Writing 0x%08x to port 0x%04x\n", value, port); |
159 | 140 | ||
160 | ret = acpi_processor_write_port(port, bit_width, value); | 141 | ret = acpi_processor_write_port(port, bit_width, value); |
161 | if (ret) { | 142 | if (ret) { |
162 | dprintk("Invalid port width 0x%04x\n", bit_width); | 143 | dprintk("Invalid port width 0x%04x\n", bit_width); |
163 | retval = ret; | 144 | return (ret); |
164 | goto migrate_end; | ||
165 | } | 145 | } |
166 | 146 | ||
167 | /* | 147 | /* |
@@ -177,49 +157,36 @@ acpi_processor_set_performance ( | |||
177 | * before giving up. | 157 | * before giving up. |
178 | */ | 158 | */ |
179 | 159 | ||
180 | port = data->acpi_data.status_register.address; | 160 | port = perf->status_register.address; |
181 | bit_width = data->acpi_data.status_register.bit_width; | 161 | bit_width = perf->status_register.bit_width; |
182 | 162 | ||
183 | dprintk("Looking for 0x%08x from port 0x%04x\n", | 163 | dprintk("Looking for 0x%08x from port 0x%04x\n", |
184 | (u32) data->acpi_data.states[state].status, port); | 164 | (u32) perf->states[state].status, port); |
185 | 165 | ||
186 | for (i=0; i<100; i++) { | 166 | for (i = 0; i < 100; i++) { |
187 | ret = acpi_processor_read_port(port, bit_width, &value); | 167 | ret = acpi_processor_read_port(port, bit_width, &value); |
188 | if (ret) { | 168 | if (ret) { |
189 | dprintk("Invalid port width 0x%04x\n", bit_width); | 169 | dprintk("Invalid port width 0x%04x\n", bit_width); |
190 | retval = ret; | 170 | return (ret); |
191 | goto migrate_end; | ||
192 | } | 171 | } |
193 | if (value == (u32) data->acpi_data.states[state].status) | 172 | if (value == (u32) perf->states[state].status) |
194 | break; | 173 | break; |
195 | udelay(10); | 174 | udelay(10); |
196 | } | 175 | } |
197 | } else { | 176 | } else { |
198 | i = 0; | 177 | i = 0; |
199 | value = (u32) data->acpi_data.states[state].status; | 178 | value = (u32) perf->states[state].status; |
200 | } | 179 | } |
201 | 180 | ||
202 | /* notify cpufreq */ | 181 | if (unlikely(value != (u32) perf->states[state].status)) { |
203 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | ||
204 | |||
205 | if (unlikely(value != (u32) data->acpi_data.states[state].status)) { | ||
206 | unsigned int tmp = cpufreq_freqs.new; | ||
207 | cpufreq_freqs.new = cpufreq_freqs.old; | ||
208 | cpufreq_freqs.old = tmp; | ||
209 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); | ||
210 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | ||
211 | printk(KERN_WARNING "acpi-cpufreq: Transition failed\n"); | 182 | printk(KERN_WARNING "acpi-cpufreq: Transition failed\n"); |
212 | retval = -ENODEV; | 183 | retval = -ENODEV; |
213 | goto migrate_end; | 184 | return (retval); |
214 | } | 185 | } |
215 | 186 | ||
216 | dprintk("Transition successful after %d microseconds\n", i * 10); | 187 | dprintk("Transition successful after %d microseconds\n", i * 10); |
217 | 188 | ||
218 | data->acpi_data.state = state; | 189 | perf->state = state; |
219 | |||
220 | retval = 0; | ||
221 | migrate_end: | ||
222 | set_cpus_allowed(current, saved_mask); | ||
223 | return (retval); | 190 | return (retval); |
224 | } | 191 | } |
225 | 192 | ||
@@ -231,8 +198,17 @@ acpi_cpufreq_target ( | |||
231 | unsigned int relation) | 198 | unsigned int relation) |
232 | { | 199 | { |
233 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | 200 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; |
201 | struct acpi_processor_performance *perf; | ||
202 | struct cpufreq_freqs freqs; | ||
203 | cpumask_t online_policy_cpus; | ||
204 | cpumask_t saved_mask; | ||
205 | cpumask_t set_mask; | ||
206 | cpumask_t covered_cpus; | ||
207 | unsigned int cur_state = 0; | ||
234 | unsigned int next_state = 0; | 208 | unsigned int next_state = 0; |
235 | unsigned int result = 0; | 209 | unsigned int result = 0; |
210 | unsigned int j; | ||
211 | unsigned int tmp; | ||
236 | 212 | ||
237 | dprintk("acpi_cpufreq_setpolicy\n"); | 213 | dprintk("acpi_cpufreq_setpolicy\n"); |
238 | 214 | ||
@@ -241,11 +217,95 @@ acpi_cpufreq_target ( | |||
241 | target_freq, | 217 | target_freq, |
242 | relation, | 218 | relation, |
243 | &next_state); | 219 | &next_state); |
244 | if (result) | 220 | if (unlikely(result)) |
245 | return (result); | 221 | return (result); |
246 | 222 | ||
247 | result = acpi_processor_set_performance (data, policy->cpu, next_state); | 223 | perf = data->acpi_data; |
224 | cur_state = perf->state; | ||
225 | freqs.old = data->freq_table[cur_state].frequency; | ||
226 | freqs.new = data->freq_table[next_state].frequency; | ||
227 | |||
228 | #ifdef CONFIG_HOTPLUG_CPU | ||
229 | /* cpufreq holds the hotplug lock, so we are safe from here on */ | ||
230 | cpus_and(online_policy_cpus, cpu_online_map, policy->cpus); | ||
231 | #else | ||
232 | online_policy_cpus = policy->cpus; | ||
233 | #endif | ||
234 | |||
235 | for_each_cpu_mask(j, online_policy_cpus) { | ||
236 | freqs.cpu = j; | ||
237 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * We need to call driver->target() on all or any CPU in | ||
242 | * policy->cpus, depending on policy->shared_type. | ||
243 | */ | ||
244 | saved_mask = current->cpus_allowed; | ||
245 | cpus_clear(covered_cpus); | ||
246 | for_each_cpu_mask(j, online_policy_cpus) { | ||
247 | /* | ||
248 | * Support for SMP systems. | ||
249 | * Make sure we are running on CPU that wants to change freq | ||
250 | */ | ||
251 | cpus_clear(set_mask); | ||
252 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | ||
253 | cpus_or(set_mask, set_mask, online_policy_cpus); | ||
254 | else | ||
255 | cpu_set(j, set_mask); | ||
256 | |||
257 | set_cpus_allowed(current, set_mask); | ||
258 | if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { | ||
259 | dprintk("couldn't limit to CPUs in this domain\n"); | ||
260 | result = -EAGAIN; | ||
261 | break; | ||
262 | } | ||
263 | |||
264 | result = acpi_processor_set_performance (data, j, next_state); | ||
265 | if (result) { | ||
266 | result = -EAGAIN; | ||
267 | break; | ||
268 | } | ||
269 | |||
270 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | ||
271 | break; | ||
272 | |||
273 | cpu_set(j, covered_cpus); | ||
274 | } | ||
275 | |||
276 | for_each_cpu_mask(j, online_policy_cpus) { | ||
277 | freqs.cpu = j; | ||
278 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
279 | } | ||
248 | 280 | ||
281 | if (unlikely(result)) { | ||
282 | /* | ||
283 | * We have failed halfway through the frequency change. | ||
284 | * We have sent callbacks to online_policy_cpus and | ||
285 | * acpi_processor_set_performance() has been called on | ||
286 | * coverd_cpus. Best effort undo.. | ||
287 | */ | ||
288 | |||
289 | if (!cpus_empty(covered_cpus)) { | ||
290 | for_each_cpu_mask(j, covered_cpus) { | ||
291 | policy->cpu = j; | ||
292 | acpi_processor_set_performance (data, | ||
293 | j, | ||
294 | cur_state); | ||
295 | } | ||
296 | } | ||
297 | |||
298 | tmp = freqs.new; | ||
299 | freqs.new = freqs.old; | ||
300 | freqs.old = tmp; | ||
301 | for_each_cpu_mask(j, online_policy_cpus) { | ||
302 | freqs.cpu = j; | ||
303 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
304 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
305 | } | ||
306 | } | ||
307 | |||
308 | set_cpus_allowed(current, saved_mask); | ||
249 | return (result); | 309 | return (result); |
250 | } | 310 | } |
251 | 311 | ||
@@ -271,30 +331,65 @@ acpi_cpufreq_guess_freq ( | |||
271 | struct cpufreq_acpi_io *data, | 331 | struct cpufreq_acpi_io *data, |
272 | unsigned int cpu) | 332 | unsigned int cpu) |
273 | { | 333 | { |
334 | struct acpi_processor_performance *perf = data->acpi_data; | ||
335 | |||
274 | if (cpu_khz) { | 336 | if (cpu_khz) { |
275 | /* search the closest match to cpu_khz */ | 337 | /* search the closest match to cpu_khz */ |
276 | unsigned int i; | 338 | unsigned int i; |
277 | unsigned long freq; | 339 | unsigned long freq; |
278 | unsigned long freqn = data->acpi_data.states[0].core_frequency * 1000; | 340 | unsigned long freqn = perf->states[0].core_frequency * 1000; |
279 | 341 | ||
280 | for (i=0; i < (data->acpi_data.state_count - 1); i++) { | 342 | for (i = 0; i < (perf->state_count - 1); i++) { |
281 | freq = freqn; | 343 | freq = freqn; |
282 | freqn = data->acpi_data.states[i+1].core_frequency * 1000; | 344 | freqn = perf->states[i+1].core_frequency * 1000; |
283 | if ((2 * cpu_khz) > (freqn + freq)) { | 345 | if ((2 * cpu_khz) > (freqn + freq)) { |
284 | data->acpi_data.state = i; | 346 | perf->state = i; |
285 | return (freq); | 347 | return (freq); |
286 | } | 348 | } |
287 | } | 349 | } |
288 | data->acpi_data.state = data->acpi_data.state_count - 1; | 350 | perf->state = perf->state_count - 1; |
289 | return (freqn); | 351 | return (freqn); |
290 | } else | 352 | } else { |
291 | /* assume CPU is at P0... */ | 353 | /* assume CPU is at P0... */ |
292 | data->acpi_data.state = 0; | 354 | perf->state = 0; |
293 | return data->acpi_data.states[0].core_frequency * 1000; | 355 | return perf->states[0].core_frequency * 1000; |
294 | 356 | } | |
295 | } | 357 | } |
296 | 358 | ||
297 | 359 | ||
360 | /* | ||
361 | * acpi_cpufreq_early_init - initialize ACPI P-States library | ||
362 | * | ||
363 | * Initialize the ACPI P-States library (drivers/acpi/processor_perflib.c) | ||
364 | * in order to determine correct frequency and voltage pairings. We can | ||
365 | * do _PDC and _PSD and find out the processor dependency for the | ||
366 | * actual init that will happen later... | ||
367 | */ | ||
368 | static int acpi_cpufreq_early_init_acpi(void) | ||
369 | { | ||
370 | struct acpi_processor_performance *data; | ||
371 | unsigned int i, j; | ||
372 | |||
373 | dprintk("acpi_cpufreq_early_init\n"); | ||
374 | |||
375 | for_each_cpu(i) { | ||
376 | data = kzalloc(sizeof(struct acpi_processor_performance), | ||
377 | GFP_KERNEL); | ||
378 | if (!data) { | ||
379 | for_each_cpu(j) { | ||
380 | kfree(acpi_perf_data[j]); | ||
381 | acpi_perf_data[j] = NULL; | ||
382 | } | ||
383 | return (-ENOMEM); | ||
384 | } | ||
385 | acpi_perf_data[i] = data; | ||
386 | } | ||
387 | |||
388 | /* Do initialization in ACPI core */ | ||
389 | acpi_processor_preregister_performance(acpi_perf_data); | ||
390 | return 0; | ||
391 | } | ||
392 | |||
298 | static int | 393 | static int |
299 | acpi_cpufreq_cpu_init ( | 394 | acpi_cpufreq_cpu_init ( |
300 | struct cpufreq_policy *policy) | 395 | struct cpufreq_policy *policy) |
@@ -304,41 +399,51 @@ acpi_cpufreq_cpu_init ( | |||
304 | struct cpufreq_acpi_io *data; | 399 | struct cpufreq_acpi_io *data; |
305 | unsigned int result = 0; | 400 | unsigned int result = 0; |
306 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | 401 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; |
402 | struct acpi_processor_performance *perf; | ||
307 | 403 | ||
308 | dprintk("acpi_cpufreq_cpu_init\n"); | 404 | dprintk("acpi_cpufreq_cpu_init\n"); |
309 | 405 | ||
406 | if (!acpi_perf_data[cpu]) | ||
407 | return (-ENODEV); | ||
408 | |||
310 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); | 409 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); |
311 | if (!data) | 410 | if (!data) |
312 | return (-ENOMEM); | 411 | return (-ENOMEM); |
313 | 412 | ||
413 | data->acpi_data = acpi_perf_data[cpu]; | ||
314 | acpi_io_data[cpu] = data; | 414 | acpi_io_data[cpu] = data; |
315 | 415 | ||
316 | result = acpi_processor_register_performance(&data->acpi_data, cpu); | 416 | result = acpi_processor_register_performance(data->acpi_data, cpu); |
317 | 417 | ||
318 | if (result) | 418 | if (result) |
319 | goto err_free; | 419 | goto err_free; |
320 | 420 | ||
421 | perf = data->acpi_data; | ||
422 | policy->cpus = perf->shared_cpu_map; | ||
423 | policy->shared_type = perf->shared_type; | ||
424 | |||
321 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { | 425 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { |
322 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; | 426 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; |
323 | } | 427 | } |
324 | 428 | ||
325 | /* capability check */ | 429 | /* capability check */ |
326 | if (data->acpi_data.state_count <= 1) { | 430 | if (perf->state_count <= 1) { |
327 | dprintk("No P-States\n"); | 431 | dprintk("No P-States\n"); |
328 | result = -ENODEV; | 432 | result = -ENODEV; |
329 | goto err_unreg; | 433 | goto err_unreg; |
330 | } | 434 | } |
331 | if ((data->acpi_data.control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || | 435 | |
332 | (data->acpi_data.status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { | 436 | if ((perf->control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || |
437 | (perf->status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { | ||
333 | dprintk("Unsupported address space [%d, %d]\n", | 438 | dprintk("Unsupported address space [%d, %d]\n", |
334 | (u32) (data->acpi_data.control_register.space_id), | 439 | (u32) (perf->control_register.space_id), |
335 | (u32) (data->acpi_data.status_register.space_id)); | 440 | (u32) (perf->status_register.space_id)); |
336 | result = -ENODEV; | 441 | result = -ENODEV; |
337 | goto err_unreg; | 442 | goto err_unreg; |
338 | } | 443 | } |
339 | 444 | ||
340 | /* alloc freq_table */ | 445 | /* alloc freq_table */ |
341 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (data->acpi_data.state_count + 1), GFP_KERNEL); | 446 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count + 1), GFP_KERNEL); |
342 | if (!data->freq_table) { | 447 | if (!data->freq_table) { |
343 | result = -ENOMEM; | 448 | result = -ENOMEM; |
344 | goto err_unreg; | 449 | goto err_unreg; |
@@ -346,9 +451,9 @@ acpi_cpufreq_cpu_init ( | |||
346 | 451 | ||
347 | /* detect transition latency */ | 452 | /* detect transition latency */ |
348 | policy->cpuinfo.transition_latency = 0; | 453 | policy->cpuinfo.transition_latency = 0; |
349 | for (i=0; i<data->acpi_data.state_count; i++) { | 454 | for (i=0; i<perf->state_count; i++) { |
350 | if ((data->acpi_data.states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) | 455 | if ((perf->states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) |
351 | policy->cpuinfo.transition_latency = data->acpi_data.states[i].transition_latency * 1000; | 456 | policy->cpuinfo.transition_latency = perf->states[i].transition_latency * 1000; |
352 | } | 457 | } |
353 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 458 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
354 | 459 | ||
@@ -356,11 +461,11 @@ acpi_cpufreq_cpu_init ( | |||
356 | policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); | 461 | policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); |
357 | 462 | ||
358 | /* table init */ | 463 | /* table init */ |
359 | for (i=0; i<=data->acpi_data.state_count; i++) | 464 | for (i=0; i<=perf->state_count; i++) |
360 | { | 465 | { |
361 | data->freq_table[i].index = i; | 466 | data->freq_table[i].index = i; |
362 | if (i<data->acpi_data.state_count) | 467 | if (i<perf->state_count) |
363 | data->freq_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000; | 468 | data->freq_table[i].frequency = perf->states[i].core_frequency * 1000; |
364 | else | 469 | else |
365 | data->freq_table[i].frequency = CPUFREQ_TABLE_END; | 470 | data->freq_table[i].frequency = CPUFREQ_TABLE_END; |
366 | } | 471 | } |
@@ -375,12 +480,12 @@ acpi_cpufreq_cpu_init ( | |||
375 | 480 | ||
376 | printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n", | 481 | printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n", |
377 | cpu); | 482 | cpu); |
378 | for (i = 0; i < data->acpi_data.state_count; i++) | 483 | for (i = 0; i < perf->state_count; i++) |
379 | dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", | 484 | dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", |
380 | (i == data->acpi_data.state?'*':' '), i, | 485 | (i == perf->state?'*':' '), i, |
381 | (u32) data->acpi_data.states[i].core_frequency, | 486 | (u32) perf->states[i].core_frequency, |
382 | (u32) data->acpi_data.states[i].power, | 487 | (u32) perf->states[i].power, |
383 | (u32) data->acpi_data.states[i].transition_latency); | 488 | (u32) perf->states[i].transition_latency); |
384 | 489 | ||
385 | cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); | 490 | cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); |
386 | 491 | ||
@@ -395,7 +500,7 @@ acpi_cpufreq_cpu_init ( | |||
395 | err_freqfree: | 500 | err_freqfree: |
396 | kfree(data->freq_table); | 501 | kfree(data->freq_table); |
397 | err_unreg: | 502 | err_unreg: |
398 | acpi_processor_unregister_performance(&data->acpi_data, cpu); | 503 | acpi_processor_unregister_performance(perf, cpu); |
399 | err_free: | 504 | err_free: |
400 | kfree(data); | 505 | kfree(data); |
401 | acpi_io_data[cpu] = NULL; | 506 | acpi_io_data[cpu] = NULL; |
@@ -416,7 +521,7 @@ acpi_cpufreq_cpu_exit ( | |||
416 | if (data) { | 521 | if (data) { |
417 | cpufreq_frequency_table_put_attr(policy->cpu); | 522 | cpufreq_frequency_table_put_attr(policy->cpu); |
418 | acpi_io_data[policy->cpu] = NULL; | 523 | acpi_io_data[policy->cpu] = NULL; |
419 | acpi_processor_unregister_performance(&data->acpi_data, policy->cpu); | 524 | acpi_processor_unregister_performance(data->acpi_data, policy->cpu); |
420 | kfree(data); | 525 | kfree(data); |
421 | } | 526 | } |
422 | 527 | ||
@@ -462,7 +567,10 @@ acpi_cpufreq_init (void) | |||
462 | 567 | ||
463 | dprintk("acpi_cpufreq_init\n"); | 568 | dprintk("acpi_cpufreq_init\n"); |
464 | 569 | ||
465 | result = cpufreq_register_driver(&acpi_cpufreq_driver); | 570 | result = acpi_cpufreq_early_init_acpi(); |
571 | |||
572 | if (!result) | ||
573 | result = cpufreq_register_driver(&acpi_cpufreq_driver); | ||
466 | 574 | ||
467 | return (result); | 575 | return (result); |
468 | } | 576 | } |
@@ -471,10 +579,15 @@ acpi_cpufreq_init (void) | |||
471 | static void __exit | 579 | static void __exit |
472 | acpi_cpufreq_exit (void) | 580 | acpi_cpufreq_exit (void) |
473 | { | 581 | { |
582 | unsigned int i; | ||
474 | dprintk("acpi_cpufreq_exit\n"); | 583 | dprintk("acpi_cpufreq_exit\n"); |
475 | 584 | ||
476 | cpufreq_unregister_driver(&acpi_cpufreq_driver); | 585 | cpufreq_unregister_driver(&acpi_cpufreq_driver); |
477 | 586 | ||
587 | for_each_cpu(i) { | ||
588 | kfree(acpi_perf_data[i]); | ||
589 | acpi_perf_data[i] = NULL; | ||
590 | } | ||
478 | return; | 591 | return; |
479 | } | 592 | } |
480 | 593 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index b0ff9075708c..4535ca0fe0cf 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -351,7 +351,36 @@ static unsigned int get_cur_freq(unsigned int cpu) | |||
351 | 351 | ||
352 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | 352 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI |
353 | 353 | ||
354 | static struct acpi_processor_performance p; | 354 | static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; |
355 | |||
356 | /* | ||
357 | * centrino_cpu_early_init_acpi - Do the preregistering with ACPI P-States | ||
358 | * library | ||
359 | * | ||
360 | * Before doing the actual init, we need to do _PSD related setup whenever | ||
361 | * supported by the BIOS. These are handled by this early_init routine. | ||
362 | */ | ||
363 | static int centrino_cpu_early_init_acpi(void) | ||
364 | { | ||
365 | unsigned int i, j; | ||
366 | struct acpi_processor_performance *data; | ||
367 | |||
368 | for_each_cpu(i) { | ||
369 | data = kzalloc(sizeof(struct acpi_processor_performance), | ||
370 | GFP_KERNEL); | ||
371 | if (!data) { | ||
372 | for_each_cpu(j) { | ||
373 | kfree(acpi_perf_data[j]); | ||
374 | acpi_perf_data[j] = NULL; | ||
375 | } | ||
376 | return (-ENOMEM); | ||
377 | } | ||
378 | acpi_perf_data[i] = data; | ||
379 | } | ||
380 | |||
381 | acpi_processor_preregister_performance(acpi_perf_data); | ||
382 | return 0; | ||
383 | } | ||
355 | 384 | ||
356 | /* | 385 | /* |
357 | * centrino_cpu_init_acpi - register with ACPI P-States library | 386 | * centrino_cpu_init_acpi - register with ACPI P-States library |
@@ -365,46 +394,51 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
365 | unsigned long cur_freq; | 394 | unsigned long cur_freq; |
366 | int result = 0, i; | 395 | int result = 0, i; |
367 | unsigned int cpu = policy->cpu; | 396 | unsigned int cpu = policy->cpu; |
397 | struct acpi_processor_performance *p; | ||
398 | |||
399 | p = acpi_perf_data[cpu]; | ||
368 | 400 | ||
369 | /* register with ACPI core */ | 401 | /* register with ACPI core */ |
370 | if (acpi_processor_register_performance(&p, cpu)) { | 402 | if (acpi_processor_register_performance(p, cpu)) { |
371 | dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); | 403 | dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); |
372 | return -EIO; | 404 | return -EIO; |
373 | } | 405 | } |
406 | policy->cpus = p->shared_cpu_map; | ||
407 | policy->shared_type = p->shared_type; | ||
374 | 408 | ||
375 | /* verify the acpi_data */ | 409 | /* verify the acpi_data */ |
376 | if (p.state_count <= 1) { | 410 | if (p->state_count <= 1) { |
377 | dprintk("No P-States\n"); | 411 | dprintk("No P-States\n"); |
378 | result = -ENODEV; | 412 | result = -ENODEV; |
379 | goto err_unreg; | 413 | goto err_unreg; |
380 | } | 414 | } |
381 | 415 | ||
382 | if ((p.control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || | 416 | if ((p->control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || |
383 | (p.status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { | 417 | (p->status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { |
384 | dprintk("Invalid control/status registers (%x - %x)\n", | 418 | dprintk("Invalid control/status registers (%x - %x)\n", |
385 | p.control_register.space_id, p.status_register.space_id); | 419 | p->control_register.space_id, p->status_register.space_id); |
386 | result = -EIO; | 420 | result = -EIO; |
387 | goto err_unreg; | 421 | goto err_unreg; |
388 | } | 422 | } |
389 | 423 | ||
390 | for (i=0; i<p.state_count; i++) { | 424 | for (i=0; i<p->state_count; i++) { |
391 | if (p.states[i].control != p.states[i].status) { | 425 | if (p->states[i].control != p->states[i].status) { |
392 | dprintk("Different control (%llu) and status values (%llu)\n", | 426 | dprintk("Different control (%llu) and status values (%llu)\n", |
393 | p.states[i].control, p.states[i].status); | 427 | p->states[i].control, p->states[i].status); |
394 | result = -EINVAL; | 428 | result = -EINVAL; |
395 | goto err_unreg; | 429 | goto err_unreg; |
396 | } | 430 | } |
397 | 431 | ||
398 | if (!p.states[i].core_frequency) { | 432 | if (!p->states[i].core_frequency) { |
399 | dprintk("Zero core frequency for state %u\n", i); | 433 | dprintk("Zero core frequency for state %u\n", i); |
400 | result = -EINVAL; | 434 | result = -EINVAL; |
401 | goto err_unreg; | 435 | goto err_unreg; |
402 | } | 436 | } |
403 | 437 | ||
404 | if (p.states[i].core_frequency > p.states[0].core_frequency) { | 438 | if (p->states[i].core_frequency > p->states[0].core_frequency) { |
405 | dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i, | 439 | dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i, |
406 | p.states[i].core_frequency, p.states[0].core_frequency); | 440 | p->states[i].core_frequency, p->states[0].core_frequency); |
407 | p.states[i].core_frequency = 0; | 441 | p->states[i].core_frequency = 0; |
408 | continue; | 442 | continue; |
409 | } | 443 | } |
410 | } | 444 | } |
@@ -416,26 +450,26 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
416 | } | 450 | } |
417 | 451 | ||
418 | centrino_model[cpu]->model_name=NULL; | 452 | centrino_model[cpu]->model_name=NULL; |
419 | centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000; | 453 | centrino_model[cpu]->max_freq = p->states[0].core_frequency * 1000; |
420 | centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) * | 454 | centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) * |
421 | (p.state_count + 1), GFP_KERNEL); | 455 | (p->state_count + 1), GFP_KERNEL); |
422 | if (!centrino_model[cpu]->op_points) { | 456 | if (!centrino_model[cpu]->op_points) { |
423 | result = -ENOMEM; | 457 | result = -ENOMEM; |
424 | goto err_kfree; | 458 | goto err_kfree; |
425 | } | 459 | } |
426 | 460 | ||
427 | for (i=0; i<p.state_count; i++) { | 461 | for (i=0; i<p->state_count; i++) { |
428 | centrino_model[cpu]->op_points[i].index = p.states[i].control; | 462 | centrino_model[cpu]->op_points[i].index = p->states[i].control; |
429 | centrino_model[cpu]->op_points[i].frequency = p.states[i].core_frequency * 1000; | 463 | centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000; |
430 | dprintk("adding state %i with frequency %u and control value %04x\n", | 464 | dprintk("adding state %i with frequency %u and control value %04x\n", |
431 | i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); | 465 | i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); |
432 | } | 466 | } |
433 | centrino_model[cpu]->op_points[p.state_count].frequency = CPUFREQ_TABLE_END; | 467 | centrino_model[cpu]->op_points[p->state_count].frequency = CPUFREQ_TABLE_END; |
434 | 468 | ||
435 | cur_freq = get_cur_freq(cpu); | 469 | cur_freq = get_cur_freq(cpu); |
436 | 470 | ||
437 | for (i=0; i<p.state_count; i++) { | 471 | for (i=0; i<p->state_count; i++) { |
438 | if (!p.states[i].core_frequency) { | 472 | if (!p->states[i].core_frequency) { |
439 | dprintk("skipping state %u\n", i); | 473 | dprintk("skipping state %u\n", i); |
440 | centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID; | 474 | centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID; |
441 | continue; | 475 | continue; |
@@ -451,7 +485,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
451 | } | 485 | } |
452 | 486 | ||
453 | if (cur_freq == centrino_model[cpu]->op_points[i].frequency) | 487 | if (cur_freq == centrino_model[cpu]->op_points[i].frequency) |
454 | p.state = i; | 488 | p->state = i; |
455 | } | 489 | } |
456 | 490 | ||
457 | /* notify BIOS that we exist */ | 491 | /* notify BIOS that we exist */ |
@@ -464,12 +498,13 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
464 | err_kfree: | 498 | err_kfree: |
465 | kfree(centrino_model[cpu]); | 499 | kfree(centrino_model[cpu]); |
466 | err_unreg: | 500 | err_unreg: |
467 | acpi_processor_unregister_performance(&p, cpu); | 501 | acpi_processor_unregister_performance(p, cpu); |
468 | dprintk(KERN_INFO PFX "invalid ACPI data\n"); | 502 | dprintk(KERN_INFO PFX "invalid ACPI data\n"); |
469 | return (result); | 503 | return (result); |
470 | } | 504 | } |
471 | #else | 505 | #else |
472 | static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; } | 506 | static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; } |
507 | static inline int centrino_cpu_early_init_acpi(void) { return 0; } | ||
473 | #endif | 508 | #endif |
474 | 509 | ||
475 | static int centrino_cpu_init(struct cpufreq_policy *policy) | 510 | static int centrino_cpu_init(struct cpufreq_policy *policy) |
@@ -555,10 +590,15 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy) | |||
555 | 590 | ||
556 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | 591 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI |
557 | if (!centrino_model[cpu]->model_name) { | 592 | if (!centrino_model[cpu]->model_name) { |
558 | dprintk("unregistering and freeing ACPI data\n"); | 593 | static struct acpi_processor_performance *p; |
559 | acpi_processor_unregister_performance(&p, cpu); | 594 | |
560 | kfree(centrino_model[cpu]->op_points); | 595 | if (acpi_perf_data[cpu]) { |
561 | kfree(centrino_model[cpu]); | 596 | p = acpi_perf_data[cpu]; |
597 | dprintk("unregistering and freeing ACPI data\n"); | ||
598 | acpi_processor_unregister_performance(p, cpu); | ||
599 | kfree(centrino_model[cpu]->op_points); | ||
600 | kfree(centrino_model[cpu]); | ||
601 | } | ||
562 | } | 602 | } |
563 | #endif | 603 | #endif |
564 | 604 | ||
@@ -592,63 +632,128 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
592 | unsigned int relation) | 632 | unsigned int relation) |
593 | { | 633 | { |
594 | unsigned int newstate = 0; | 634 | unsigned int newstate = 0; |
595 | unsigned int msr, oldmsr, h, cpu = policy->cpu; | 635 | unsigned int msr, oldmsr = 0, h = 0, cpu = policy->cpu; |
596 | struct cpufreq_freqs freqs; | 636 | struct cpufreq_freqs freqs; |
637 | cpumask_t online_policy_cpus; | ||
597 | cpumask_t saved_mask; | 638 | cpumask_t saved_mask; |
598 | int retval; | 639 | cpumask_t set_mask; |
640 | cpumask_t covered_cpus; | ||
641 | int retval = 0; | ||
642 | unsigned int j, k, first_cpu, tmp; | ||
599 | 643 | ||
600 | if (centrino_model[cpu] == NULL) | 644 | if (unlikely(centrino_model[cpu] == NULL)) |
601 | return -ENODEV; | 645 | return -ENODEV; |
602 | 646 | ||
603 | /* | 647 | if (unlikely(cpufreq_frequency_table_target(policy, |
604 | * Support for SMP systems. | 648 | centrino_model[cpu]->op_points, |
605 | * Make sure we are running on the CPU that wants to change frequency | 649 | target_freq, |
606 | */ | 650 | relation, |
607 | saved_mask = current->cpus_allowed; | 651 | &newstate))) { |
608 | set_cpus_allowed(current, policy->cpus); | 652 | return -EINVAL; |
609 | if (!cpu_isset(smp_processor_id(), policy->cpus)) { | ||
610 | dprintk("couldn't limit to CPUs in this domain\n"); | ||
611 | return(-EAGAIN); | ||
612 | } | 653 | } |
613 | 654 | ||
614 | if (cpufreq_frequency_table_target(policy, centrino_model[cpu]->op_points, target_freq, | 655 | #ifdef CONFIG_HOTPLUG_CPU |
615 | relation, &newstate)) { | 656 | /* cpufreq holds the hotplug lock, so we are safe from here on */ |
616 | retval = -EINVAL; | 657 | cpus_and(online_policy_cpus, cpu_online_map, policy->cpus); |
617 | goto migrate_end; | 658 | #else |
618 | } | 659 | online_policy_cpus = policy->cpus; |
660 | #endif | ||
619 | 661 | ||
620 | msr = centrino_model[cpu]->op_points[newstate].index; | 662 | saved_mask = current->cpus_allowed; |
621 | rdmsr(MSR_IA32_PERF_CTL, oldmsr, h); | 663 | first_cpu = 1; |
664 | cpus_clear(covered_cpus); | ||
665 | for_each_cpu_mask(j, online_policy_cpus) { | ||
666 | /* | ||
667 | * Support for SMP systems. | ||
668 | * Make sure we are running on CPU that wants to change freq | ||
669 | */ | ||
670 | cpus_clear(set_mask); | ||
671 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | ||
672 | cpus_or(set_mask, set_mask, online_policy_cpus); | ||
673 | else | ||
674 | cpu_set(j, set_mask); | ||
675 | |||
676 | set_cpus_allowed(current, set_mask); | ||
677 | if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { | ||
678 | dprintk("couldn't limit to CPUs in this domain\n"); | ||
679 | retval = -EAGAIN; | ||
680 | if (first_cpu) { | ||
681 | /* We haven't started the transition yet. */ | ||
682 | goto migrate_end; | ||
683 | } | ||
684 | break; | ||
685 | } | ||
622 | 686 | ||
623 | if (msr == (oldmsr & 0xffff)) { | 687 | msr = centrino_model[cpu]->op_points[newstate].index; |
624 | retval = 0; | 688 | |
625 | dprintk("no change needed - msr was and needs to be %x\n", oldmsr); | 689 | if (first_cpu) { |
626 | goto migrate_end; | 690 | rdmsr(MSR_IA32_PERF_CTL, oldmsr, h); |
627 | } | 691 | if (msr == (oldmsr & 0xffff)) { |
692 | dprintk("no change needed - msr was and needs " | ||
693 | "to be %x\n", oldmsr); | ||
694 | retval = 0; | ||
695 | goto migrate_end; | ||
696 | } | ||
697 | |||
698 | freqs.old = extract_clock(oldmsr, cpu, 0); | ||
699 | freqs.new = extract_clock(msr, cpu, 0); | ||
700 | |||
701 | dprintk("target=%dkHz old=%d new=%d msr=%04x\n", | ||
702 | target_freq, freqs.old, freqs.new, msr); | ||
703 | |||
704 | for_each_cpu_mask(k, online_policy_cpus) { | ||
705 | freqs.cpu = k; | ||
706 | cpufreq_notify_transition(&freqs, | ||
707 | CPUFREQ_PRECHANGE); | ||
708 | } | ||
709 | |||
710 | first_cpu = 0; | ||
711 | /* all but 16 LSB are reserved, treat them with care */ | ||
712 | oldmsr &= ~0xffff; | ||
713 | msr &= 0xffff; | ||
714 | oldmsr |= msr; | ||
715 | } | ||
628 | 716 | ||
629 | freqs.cpu = cpu; | 717 | wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); |
630 | freqs.old = extract_clock(oldmsr, cpu, 0); | 718 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) |
631 | freqs.new = extract_clock(msr, cpu, 0); | 719 | break; |
632 | 720 | ||
633 | dprintk("target=%dkHz old=%d new=%d msr=%04x\n", | 721 | cpu_set(j, covered_cpus); |
634 | target_freq, freqs.old, freqs.new, msr); | 722 | } |
635 | 723 | ||
636 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 724 | for_each_cpu_mask(k, online_policy_cpus) { |
725 | freqs.cpu = k; | ||
726 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
727 | } | ||
637 | 728 | ||
638 | /* all but 16 LSB are "reserved", so treat them with | 729 | if (unlikely(retval)) { |
639 | care */ | 730 | /* |
640 | oldmsr &= ~0xffff; | 731 | * We have failed halfway through the frequency change. |
641 | msr &= 0xffff; | 732 | * We have sent callbacks to policy->cpus and |
642 | oldmsr |= msr; | 733 | * MSRs have already been written on coverd_cpus. |
734 | * Best effort undo.. | ||
735 | */ | ||
643 | 736 | ||
644 | wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); | 737 | if (!cpus_empty(covered_cpus)) { |
738 | for_each_cpu_mask(j, covered_cpus) { | ||
739 | set_cpus_allowed(current, cpumask_of_cpu(j)); | ||
740 | wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); | ||
741 | } | ||
742 | } | ||
645 | 743 | ||
646 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 744 | tmp = freqs.new; |
745 | freqs.new = freqs.old; | ||
746 | freqs.old = tmp; | ||
747 | for_each_cpu_mask(j, online_policy_cpus) { | ||
748 | freqs.cpu = j; | ||
749 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
750 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
751 | } | ||
752 | } | ||
647 | 753 | ||
648 | retval = 0; | ||
649 | migrate_end: | 754 | migrate_end: |
650 | set_cpus_allowed(current, saved_mask); | 755 | set_cpus_allowed(current, saved_mask); |
651 | return (retval); | 756 | return 0; |
652 | } | 757 | } |
653 | 758 | ||
654 | static struct freq_attr* centrino_attr[] = { | 759 | static struct freq_attr* centrino_attr[] = { |
@@ -690,12 +795,25 @@ static int __init centrino_init(void) | |||
690 | if (!cpu_has(cpu, X86_FEATURE_EST)) | 795 | if (!cpu_has(cpu, X86_FEATURE_EST)) |
691 | return -ENODEV; | 796 | return -ENODEV; |
692 | 797 | ||
798 | centrino_cpu_early_init_acpi(); | ||
799 | |||
693 | return cpufreq_register_driver(¢rino_driver); | 800 | return cpufreq_register_driver(¢rino_driver); |
694 | } | 801 | } |
695 | 802 | ||
696 | static void __exit centrino_exit(void) | 803 | static void __exit centrino_exit(void) |
697 | { | 804 | { |
805 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
806 | unsigned int j; | ||
807 | #endif | ||
808 | |||
698 | cpufreq_unregister_driver(¢rino_driver); | 809 | cpufreq_unregister_driver(¢rino_driver); |
810 | |||
811 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
812 | for_each_cpu(j) { | ||
813 | kfree(acpi_perf_data[j]); | ||
814 | acpi_perf_data[j] = NULL; | ||
815 | } | ||
816 | #endif | ||
699 | } | 817 | } |
700 | 818 | ||
701 | MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>"); | 819 | MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>"); |