diff options
Diffstat (limited to 'drivers/acpi/processor_idle.c')
-rw-r--r-- | drivers/acpi/processor_idle.c | 315 |
1 files changed, 159 insertions, 156 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 2c04740c6543..26a3a4016115 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -48,15 +48,12 @@ | |||
48 | #define ACPI_PROCESSOR_CLASS "processor" | 48 | #define ACPI_PROCESSOR_CLASS "processor" |
49 | #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" | 49 | #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" |
50 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 50 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
51 | ACPI_MODULE_NAME ("acpi_processor") | 51 | ACPI_MODULE_NAME("acpi_processor") |
52 | |||
53 | #define ACPI_PROCESSOR_FILE_POWER "power" | 52 | #define ACPI_PROCESSOR_FILE_POWER "power" |
54 | |||
55 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) | 53 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) |
56 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | 54 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ |
57 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | 55 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ |
58 | 56 | static void (*pm_idle_save) (void); | |
59 | static void (*pm_idle_save)(void); | ||
60 | module_param(max_cstate, uint, 0644); | 57 | module_param(max_cstate, uint, 0644); |
61 | 58 | ||
62 | static unsigned int nocst = 0; | 59 | static unsigned int nocst = 0; |
@@ -69,7 +66,8 @@ module_param(nocst, uint, 0000); | |||
69 | * 100 HZ: 0x0000000F: 4 jiffies = 40ms | 66 | * 100 HZ: 0x0000000F: 4 jiffies = 40ms |
70 | * reduce history for more aggressive entry into C3 | 67 | * reduce history for more aggressive entry into C3 |
71 | */ | 68 | */ |
72 | static unsigned int bm_history = (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); | 69 | static unsigned int bm_history = |
70 | (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); | ||
73 | module_param(bm_history, uint, 0644); | 71 | module_param(bm_history, uint, 0644); |
74 | /* -------------------------------------------------------------------------- | 72 | /* -------------------------------------------------------------------------- |
75 | Power Management | 73 | Power Management |
@@ -87,34 +85,36 @@ static int set_max_cstate(struct dmi_system_id *id) | |||
87 | return 0; | 85 | return 0; |
88 | 86 | ||
89 | printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate." | 87 | printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate." |
90 | " Override with \"processor.max_cstate=%d\"\n", id->ident, | 88 | " Override with \"processor.max_cstate=%d\"\n", id->ident, |
91 | (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); | 89 | (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); |
92 | 90 | ||
93 | max_cstate = (long)id->driver_data; | 91 | max_cstate = (long)id->driver_data; |
94 | 92 | ||
95 | return 0; | 93 | return 0; |
96 | } | 94 | } |
97 | 95 | ||
98 | |||
99 | static struct dmi_system_id __initdata processor_power_dmi_table[] = { | 96 | static struct dmi_system_id __initdata processor_power_dmi_table[] = { |
100 | { set_max_cstate, "IBM ThinkPad R40e", { | 97 | {set_max_cstate, "IBM ThinkPad R40e", { |
101 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | 98 | DMI_MATCH(DMI_BIOS_VENDOR, |
102 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1}, | 99 | "IBM"), |
103 | { set_max_cstate, "Medion 41700", { | 100 | DMI_MATCH(DMI_BIOS_VERSION, |
104 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | 101 | "1SET60WW")}, |
105 | DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }, (void*)1}, | 102 | (void *)1}, |
106 | { set_max_cstate, "Clevo 5600D", { | 103 | {set_max_cstate, "Medion 41700", { |
107 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | 104 | DMI_MATCH(DMI_BIOS_VENDOR, |
108 | DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307") }, | 105 | "Phoenix Technologies LTD"), |
109 | (void*)2}, | 106 | DMI_MATCH(DMI_BIOS_VERSION, |
107 | "R01-A1J")}, (void *)1}, | ||
108 | {set_max_cstate, "Clevo 5600D", { | ||
109 | DMI_MATCH(DMI_BIOS_VENDOR, | ||
110 | "Phoenix Technologies LTD"), | ||
111 | DMI_MATCH(DMI_BIOS_VERSION, | ||
112 | "SHE845M0.86C.0013.D.0302131307")}, | ||
113 | (void *)2}, | ||
110 | {}, | 114 | {}, |
111 | }; | 115 | }; |
112 | 116 | ||
113 | 117 | static inline u32 ticks_elapsed(u32 t1, u32 t2) | |
114 | static inline u32 | ||
115 | ticks_elapsed ( | ||
116 | u32 t1, | ||
117 | u32 t2) | ||
118 | { | 118 | { |
119 | if (t2 >= t1) | 119 | if (t2 >= t1) |
120 | return (t2 - t1); | 120 | return (t2 - t1); |
@@ -124,13 +124,11 @@ ticks_elapsed ( | |||
124 | return ((0xFFFFFFFF - t1) + t2); | 124 | return ((0xFFFFFFFF - t1) + t2); |
125 | } | 125 | } |
126 | 126 | ||
127 | |||
128 | static void | 127 | static void |
129 | acpi_processor_power_activate ( | 128 | acpi_processor_power_activate(struct acpi_processor *pr, |
130 | struct acpi_processor *pr, | 129 | struct acpi_processor_cx *new) |
131 | struct acpi_processor_cx *new) | ||
132 | { | 130 | { |
133 | struct acpi_processor_cx *old; | 131 | struct acpi_processor_cx *old; |
134 | 132 | ||
135 | if (!pr || !new) | 133 | if (!pr || !new) |
136 | return; | 134 | return; |
@@ -139,7 +137,7 @@ acpi_processor_power_activate ( | |||
139 | 137 | ||
140 | if (old) | 138 | if (old) |
141 | old->promotion.count = 0; | 139 | old->promotion.count = 0; |
142 | new->demotion.count = 0; | 140 | new->demotion.count = 0; |
143 | 141 | ||
144 | /* Cleanup from old state. */ | 142 | /* Cleanup from old state. */ |
145 | if (old) { | 143 | if (old) { |
@@ -147,7 +145,8 @@ acpi_processor_power_activate ( | |||
147 | case ACPI_STATE_C3: | 145 | case ACPI_STATE_C3: |
148 | /* Disable bus master reload */ | 146 | /* Disable bus master reload */ |
149 | if (new->type != ACPI_STATE_C3 && pr->flags.bm_check) | 147 | if (new->type != ACPI_STATE_C3 && pr->flags.bm_check) |
150 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); | 148 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, |
149 | ACPI_MTX_DO_NOT_LOCK); | ||
151 | break; | 150 | break; |
152 | } | 151 | } |
153 | } | 152 | } |
@@ -157,7 +156,8 @@ acpi_processor_power_activate ( | |||
157 | case ACPI_STATE_C3: | 156 | case ACPI_STATE_C3: |
158 | /* Enable bus master reload */ | 157 | /* Enable bus master reload */ |
159 | if (old->type != ACPI_STATE_C3 && pr->flags.bm_check) | 158 | if (old->type != ACPI_STATE_C3 && pr->flags.bm_check) |
160 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); | 159 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, |
160 | ACPI_MTX_DO_NOT_LOCK); | ||
161 | break; | 161 | break; |
162 | } | 162 | } |
163 | 163 | ||
@@ -166,17 +166,15 @@ acpi_processor_power_activate ( | |||
166 | return; | 166 | return; |
167 | } | 167 | } |
168 | 168 | ||
169 | static atomic_t c3_cpu_count; | ||
169 | 170 | ||
170 | static atomic_t c3_cpu_count; | 171 | static void acpi_processor_idle(void) |
171 | |||
172 | |||
173 | static void acpi_processor_idle (void) | ||
174 | { | 172 | { |
175 | struct acpi_processor *pr = NULL; | 173 | struct acpi_processor *pr = NULL; |
176 | struct acpi_processor_cx *cx = NULL; | 174 | struct acpi_processor_cx *cx = NULL; |
177 | struct acpi_processor_cx *next_state = NULL; | 175 | struct acpi_processor_cx *next_state = NULL; |
178 | int sleep_ticks = 0; | 176 | int sleep_ticks = 0; |
179 | u32 t1, t2 = 0; | 177 | u32 t1, t2 = 0; |
180 | 178 | ||
181 | pr = processors[raw_smp_processor_id()]; | 179 | pr = processors[raw_smp_processor_id()]; |
182 | if (!pr) | 180 | if (!pr) |
@@ -208,8 +206,8 @@ static void acpi_processor_idle (void) | |||
208 | * for demotion. | 206 | * for demotion. |
209 | */ | 207 | */ |
210 | if (pr->flags.bm_check) { | 208 | if (pr->flags.bm_check) { |
211 | u32 bm_status = 0; | 209 | u32 bm_status = 0; |
212 | unsigned long diff = jiffies - pr->power.bm_check_timestamp; | 210 | unsigned long diff = jiffies - pr->power.bm_check_timestamp; |
213 | 211 | ||
214 | if (diff > 32) | 212 | if (diff > 32) |
215 | diff = 32; | 213 | diff = 32; |
@@ -223,11 +221,11 @@ static void acpi_processor_idle (void) | |||
223 | } | 221 | } |
224 | 222 | ||
225 | acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, | 223 | acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, |
226 | &bm_status, ACPI_MTX_DO_NOT_LOCK); | 224 | &bm_status, ACPI_MTX_DO_NOT_LOCK); |
227 | if (bm_status) { | 225 | if (bm_status) { |
228 | pr->power.bm_activity++; | 226 | pr->power.bm_activity++; |
229 | acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, | 227 | acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, |
230 | 1, ACPI_MTX_DO_NOT_LOCK); | 228 | 1, ACPI_MTX_DO_NOT_LOCK); |
231 | } | 229 | } |
232 | /* | 230 | /* |
233 | * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect | 231 | * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect |
@@ -236,7 +234,7 @@ static void acpi_processor_idle (void) | |||
236 | */ | 234 | */ |
237 | else if (errata.piix4.bmisx) { | 235 | else if (errata.piix4.bmisx) { |
238 | if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) | 236 | if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) |
239 | || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) | 237 | || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) |
240 | pr->power.bm_activity++; | 238 | pr->power.bm_activity++; |
241 | } | 239 | } |
242 | 240 | ||
@@ -281,7 +279,7 @@ static void acpi_processor_idle (void) | |||
281 | else | 279 | else |
282 | safe_halt(); | 280 | safe_halt(); |
283 | /* | 281 | /* |
284 | * TBD: Can't get time duration while in C1, as resumes | 282 | * TBD: Can't get time duration while in C1, as resumes |
285 | * go to an ISR rather than here. Need to instrument | 283 | * go to an ISR rather than here. Need to instrument |
286 | * base interrupt handler. | 284 | * base interrupt handler. |
287 | */ | 285 | */ |
@@ -300,26 +298,27 @@ static void acpi_processor_idle (void) | |||
300 | /* Re-enable interrupts */ | 298 | /* Re-enable interrupts */ |
301 | local_irq_enable(); | 299 | local_irq_enable(); |
302 | /* Compute time (ticks) that we were actually asleep */ | 300 | /* Compute time (ticks) that we were actually asleep */ |
303 | sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; | 301 | sleep_ticks = |
302 | ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; | ||
304 | break; | 303 | break; |
305 | 304 | ||
306 | case ACPI_STATE_C3: | 305 | case ACPI_STATE_C3: |
307 | 306 | ||
308 | if (pr->flags.bm_check) { | 307 | if (pr->flags.bm_check) { |
309 | if (atomic_inc_return(&c3_cpu_count) == | 308 | if (atomic_inc_return(&c3_cpu_count) == |
310 | num_online_cpus()) { | 309 | num_online_cpus()) { |
311 | /* | 310 | /* |
312 | * All CPUs are trying to go to C3 | 311 | * All CPUs are trying to go to C3 |
313 | * Disable bus master arbitration | 312 | * Disable bus master arbitration |
314 | */ | 313 | */ |
315 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, | 314 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, |
316 | ACPI_MTX_DO_NOT_LOCK); | 315 | ACPI_MTX_DO_NOT_LOCK); |
317 | } | 316 | } |
318 | } else { | 317 | } else { |
319 | /* SMP with no shared cache... Invalidate cache */ | 318 | /* SMP with no shared cache... Invalidate cache */ |
320 | ACPI_FLUSH_CPU_CACHE(); | 319 | ACPI_FLUSH_CPU_CACHE(); |
321 | } | 320 | } |
322 | 321 | ||
323 | /* Get start time (ticks) */ | 322 | /* Get start time (ticks) */ |
324 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); | 323 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); |
325 | /* Invoke C3 */ | 324 | /* Invoke C3 */ |
@@ -331,13 +330,15 @@ static void acpi_processor_idle (void) | |||
331 | if (pr->flags.bm_check) { | 330 | if (pr->flags.bm_check) { |
332 | /* Enable bus master arbitration */ | 331 | /* Enable bus master arbitration */ |
333 | atomic_dec(&c3_cpu_count); | 332 | atomic_dec(&c3_cpu_count); |
334 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); | 333 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, |
334 | ACPI_MTX_DO_NOT_LOCK); | ||
335 | } | 335 | } |
336 | 336 | ||
337 | /* Re-enable interrupts */ | 337 | /* Re-enable interrupts */ |
338 | local_irq_enable(); | 338 | local_irq_enable(); |
339 | /* Compute time (ticks) that we were actually asleep */ | 339 | /* Compute time (ticks) that we were actually asleep */ |
340 | sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD; | 340 | sleep_ticks = |
341 | ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD; | ||
341 | break; | 342 | break; |
342 | 343 | ||
343 | default: | 344 | default: |
@@ -359,15 +360,18 @@ static void acpi_processor_idle (void) | |||
359 | ((cx->promotion.state - pr->power.states) <= max_cstate)) { | 360 | ((cx->promotion.state - pr->power.states) <= max_cstate)) { |
360 | if (sleep_ticks > cx->promotion.threshold.ticks) { | 361 | if (sleep_ticks > cx->promotion.threshold.ticks) { |
361 | cx->promotion.count++; | 362 | cx->promotion.count++; |
362 | cx->demotion.count = 0; | 363 | cx->demotion.count = 0; |
363 | if (cx->promotion.count >= cx->promotion.threshold.count) { | 364 | if (cx->promotion.count >= |
365 | cx->promotion.threshold.count) { | ||
364 | if (pr->flags.bm_check) { | 366 | if (pr->flags.bm_check) { |
365 | if (!(pr->power.bm_activity & cx->promotion.threshold.bm)) { | 367 | if (! |
366 | next_state = cx->promotion.state; | 368 | (pr->power.bm_activity & cx-> |
369 | promotion.threshold.bm)) { | ||
370 | next_state = | ||
371 | cx->promotion.state; | ||
367 | goto end; | 372 | goto end; |
368 | } | 373 | } |
369 | } | 374 | } else { |
370 | else { | ||
371 | next_state = cx->promotion.state; | 375 | next_state = cx->promotion.state; |
372 | goto end; | 376 | goto end; |
373 | } | 377 | } |
@@ -392,7 +396,7 @@ static void acpi_processor_idle (void) | |||
392 | } | 396 | } |
393 | } | 397 | } |
394 | 398 | ||
395 | end: | 399 | end: |
396 | /* | 400 | /* |
397 | * Demote if current state exceeds max_cstate | 401 | * Demote if current state exceeds max_cstate |
398 | */ | 402 | */ |
@@ -412,7 +416,7 @@ end: | |||
412 | 416 | ||
413 | return; | 417 | return; |
414 | 418 | ||
415 | easy_out: | 419 | easy_out: |
416 | /* do C1 instead of busy loop */ | 420 | /* do C1 instead of busy loop */ |
417 | if (pm_idle_save) | 421 | if (pm_idle_save) |
418 | pm_idle_save(); | 422 | pm_idle_save(); |
@@ -421,10 +425,7 @@ end: | |||
421 | return; | 425 | return; |
422 | } | 426 | } |
423 | 427 | ||
424 | 428 | static int acpi_processor_set_power_policy(struct acpi_processor *pr) | |
425 | static int | ||
426 | acpi_processor_set_power_policy ( | ||
427 | struct acpi_processor *pr) | ||
428 | { | 429 | { |
429 | unsigned int i; | 430 | unsigned int i; |
430 | unsigned int state_is_set = 0; | 431 | unsigned int state_is_set = 0; |
@@ -432,7 +433,7 @@ acpi_processor_set_power_policy ( | |||
432 | struct acpi_processor_cx *higher = NULL; | 433 | struct acpi_processor_cx *higher = NULL; |
433 | struct acpi_processor_cx *cx; | 434 | struct acpi_processor_cx *cx; |
434 | 435 | ||
435 | ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); | 436 | ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); |
436 | 437 | ||
437 | if (!pr) | 438 | if (!pr) |
438 | return_VALUE(-EINVAL); | 439 | return_VALUE(-EINVAL); |
@@ -447,7 +448,7 @@ acpi_processor_set_power_policy ( | |||
447 | */ | 448 | */ |
448 | 449 | ||
449 | /* startup state */ | 450 | /* startup state */ |
450 | for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 451 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
451 | cx = &pr->power.states[i]; | 452 | cx = &pr->power.states[i]; |
452 | if (!cx->valid) | 453 | if (!cx->valid) |
453 | continue; | 454 | continue; |
@@ -456,13 +457,13 @@ acpi_processor_set_power_policy ( | |||
456 | pr->power.state = cx; | 457 | pr->power.state = cx; |
457 | state_is_set++; | 458 | state_is_set++; |
458 | break; | 459 | break; |
459 | } | 460 | } |
460 | 461 | ||
461 | if (!state_is_set) | 462 | if (!state_is_set) |
462 | return_VALUE(-ENODEV); | 463 | return_VALUE(-ENODEV); |
463 | 464 | ||
464 | /* demotion */ | 465 | /* demotion */ |
465 | for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 466 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
466 | cx = &pr->power.states[i]; | 467 | cx = &pr->power.states[i]; |
467 | if (!cx->valid) | 468 | if (!cx->valid) |
468 | continue; | 469 | continue; |
@@ -485,7 +486,7 @@ acpi_processor_set_power_policy ( | |||
485 | continue; | 486 | continue; |
486 | 487 | ||
487 | if (higher) { | 488 | if (higher) { |
488 | cx->promotion.state = higher; | 489 | cx->promotion.state = higher; |
489 | cx->promotion.threshold.ticks = cx->latency_ticks; | 490 | cx->promotion.threshold.ticks = cx->latency_ticks; |
490 | if (cx->type >= ACPI_STATE_C2) | 491 | if (cx->type >= ACPI_STATE_C2) |
491 | cx->promotion.threshold.count = 4; | 492 | cx->promotion.threshold.count = 4; |
@@ -498,11 +499,10 @@ acpi_processor_set_power_policy ( | |||
498 | higher = cx; | 499 | higher = cx; |
499 | } | 500 | } |
500 | 501 | ||
501 | return_VALUE(0); | 502 | return_VALUE(0); |
502 | } | 503 | } |
503 | 504 | ||
504 | 505 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |
505 | static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr) | ||
506 | { | 506 | { |
507 | int i; | 507 | int i; |
508 | 508 | ||
@@ -543,15 +543,14 @@ static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr) | |||
543 | return_VALUE(0); | 543 | return_VALUE(0); |
544 | } | 544 | } |
545 | 545 | ||
546 | 546 | static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) | |
547 | static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr) | ||
548 | { | 547 | { |
549 | int i; | 548 | int i; |
550 | 549 | ||
551 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); | 550 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); |
552 | 551 | ||
553 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | 552 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) |
554 | memset(&(pr->power.states[i]), 0, | 553 | memset(&(pr->power.states[i]), 0, |
555 | sizeof(struct acpi_processor_cx)); | 554 | sizeof(struct acpi_processor_cx)); |
556 | 555 | ||
557 | /* if info is obtained from pblk/fadt, type equals state */ | 556 | /* if info is obtained from pblk/fadt, type equals state */ |
@@ -567,14 +566,13 @@ static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr) | |||
567 | return_VALUE(0); | 566 | return_VALUE(0); |
568 | } | 567 | } |
569 | 568 | ||
570 | 569 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |
571 | static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | ||
572 | { | 570 | { |
573 | acpi_status status = 0; | 571 | acpi_status status = 0; |
574 | acpi_integer count; | 572 | acpi_integer count; |
575 | int i; | 573 | int i; |
576 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 574 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
577 | union acpi_object *cst; | 575 | union acpi_object *cst; |
578 | 576 | ||
579 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); | 577 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); |
580 | 578 | ||
@@ -583,20 +581,21 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | |||
583 | 581 | ||
584 | pr->power.count = 0; | 582 | pr->power.count = 0; |
585 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | 583 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) |
586 | memset(&(pr->power.states[i]), 0, | 584 | memset(&(pr->power.states[i]), 0, |
587 | sizeof(struct acpi_processor_cx)); | 585 | sizeof(struct acpi_processor_cx)); |
588 | 586 | ||
589 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); | 587 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); |
590 | if (ACPI_FAILURE(status)) { | 588 | if (ACPI_FAILURE(status)) { |
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); | 589 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); |
592 | return_VALUE(-ENODEV); | 590 | return_VALUE(-ENODEV); |
593 | } | 591 | } |
594 | 592 | ||
595 | cst = (union acpi_object *) buffer.pointer; | 593 | cst = (union acpi_object *)buffer.pointer; |
596 | 594 | ||
597 | /* There must be at least 2 elements */ | 595 | /* There must be at least 2 elements */ |
598 | if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { | 596 | if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { |
599 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "not enough elements in _CST\n")); | 597 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
598 | "not enough elements in _CST\n")); | ||
600 | status = -EFAULT; | 599 | status = -EFAULT; |
601 | goto end; | 600 | goto end; |
602 | } | 601 | } |
@@ -605,15 +604,19 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | |||
605 | 604 | ||
606 | /* Validate number of power states. */ | 605 | /* Validate number of power states. */ |
607 | if (count < 1 || count != cst->package.count - 1) { | 606 | if (count < 1 || count != cst->package.count - 1) { |
608 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "count given by _CST is not valid\n")); | 607 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
608 | "count given by _CST is not valid\n")); | ||
609 | status = -EFAULT; | 609 | status = -EFAULT; |
610 | goto end; | 610 | goto end; |
611 | } | 611 | } |
612 | 612 | ||
613 | /* We support up to ACPI_PROCESSOR_MAX_POWER. */ | 613 | /* We support up to ACPI_PROCESSOR_MAX_POWER. */ |
614 | if (count > ACPI_PROCESSOR_MAX_POWER) { | 614 | if (count > ACPI_PROCESSOR_MAX_POWER) { |
615 | printk(KERN_WARNING "Limiting number of power states to max (%d)\n", ACPI_PROCESSOR_MAX_POWER); | 615 | printk(KERN_WARNING |
616 | printk(KERN_WARNING "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); | 616 | "Limiting number of power states to max (%d)\n", |
617 | ACPI_PROCESSOR_MAX_POWER); | ||
618 | printk(KERN_WARNING | ||
619 | "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); | ||
617 | count = ACPI_PROCESSOR_MAX_POWER; | 620 | count = ACPI_PROCESSOR_MAX_POWER; |
618 | } | 621 | } |
619 | 622 | ||
@@ -628,29 +631,29 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | |||
628 | 631 | ||
629 | memset(&cx, 0, sizeof(cx)); | 632 | memset(&cx, 0, sizeof(cx)); |
630 | 633 | ||
631 | element = (union acpi_object *) &(cst->package.elements[i]); | 634 | element = (union acpi_object *)&(cst->package.elements[i]); |
632 | if (element->type != ACPI_TYPE_PACKAGE) | 635 | if (element->type != ACPI_TYPE_PACKAGE) |
633 | continue; | 636 | continue; |
634 | 637 | ||
635 | if (element->package.count != 4) | 638 | if (element->package.count != 4) |
636 | continue; | 639 | continue; |
637 | 640 | ||
638 | obj = (union acpi_object *) &(element->package.elements[0]); | 641 | obj = (union acpi_object *)&(element->package.elements[0]); |
639 | 642 | ||
640 | if (obj->type != ACPI_TYPE_BUFFER) | 643 | if (obj->type != ACPI_TYPE_BUFFER) |
641 | continue; | 644 | continue; |
642 | 645 | ||
643 | reg = (struct acpi_power_register *) obj->buffer.pointer; | 646 | reg = (struct acpi_power_register *)obj->buffer.pointer; |
644 | 647 | ||
645 | if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO && | 648 | if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO && |
646 | (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) | 649 | (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) |
647 | continue; | 650 | continue; |
648 | 651 | ||
649 | cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? | 652 | cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? |
650 | 0 : reg->address; | 653 | 0 : reg->address; |
651 | 654 | ||
652 | /* There should be an easy way to extract an integer... */ | 655 | /* There should be an easy way to extract an integer... */ |
653 | obj = (union acpi_object *) &(element->package.elements[1]); | 656 | obj = (union acpi_object *)&(element->package.elements[1]); |
654 | if (obj->type != ACPI_TYPE_INTEGER) | 657 | if (obj->type != ACPI_TYPE_INTEGER) |
655 | continue; | 658 | continue; |
656 | 659 | ||
@@ -660,17 +663,16 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | |||
660 | (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) | 663 | (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) |
661 | continue; | 664 | continue; |
662 | 665 | ||
663 | if ((cx.type < ACPI_STATE_C1) || | 666 | if ((cx.type < ACPI_STATE_C1) || (cx.type > ACPI_STATE_C3)) |
664 | (cx.type > ACPI_STATE_C3)) | ||
665 | continue; | 667 | continue; |
666 | 668 | ||
667 | obj = (union acpi_object *) &(element->package.elements[2]); | 669 | obj = (union acpi_object *)&(element->package.elements[2]); |
668 | if (obj->type != ACPI_TYPE_INTEGER) | 670 | if (obj->type != ACPI_TYPE_INTEGER) |
669 | continue; | 671 | continue; |
670 | 672 | ||
671 | cx.latency = obj->integer.value; | 673 | cx.latency = obj->integer.value; |
672 | 674 | ||
673 | obj = (union acpi_object *) &(element->package.elements[3]); | 675 | obj = (union acpi_object *)&(element->package.elements[3]); |
674 | if (obj->type != ACPI_TYPE_INTEGER) | 676 | if (obj->type != ACPI_TYPE_INTEGER) |
675 | continue; | 677 | continue; |
676 | 678 | ||
@@ -680,19 +682,19 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | |||
680 | memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx)); | 682 | memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx)); |
681 | } | 683 | } |
682 | 684 | ||
683 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", pr->power.count)); | 685 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", |
686 | pr->power.count)); | ||
684 | 687 | ||
685 | /* Validate number of power states discovered */ | 688 | /* Validate number of power states discovered */ |
686 | if (pr->power.count < 2) | 689 | if (pr->power.count < 2) |
687 | status = -ENODEV; | 690 | status = -ENODEV; |
688 | 691 | ||
689 | end: | 692 | end: |
690 | acpi_os_free(buffer.pointer); | 693 | acpi_os_free(buffer.pointer); |
691 | 694 | ||
692 | return_VALUE(status); | 695 | return_VALUE(status); |
693 | } | 696 | } |
694 | 697 | ||
695 | |||
696 | static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | 698 | static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) |
697 | { | 699 | { |
698 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2"); | 700 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2"); |
@@ -706,8 +708,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | |||
706 | */ | 708 | */ |
707 | else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { | 709 | else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { |
708 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 710 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
709 | "latency too large [%d]\n", | 711 | "latency too large [%d]\n", cx->latency)); |
710 | cx->latency)); | ||
711 | return_VOID; | 712 | return_VOID; |
712 | } | 713 | } |
713 | 714 | ||
@@ -721,10 +722,8 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | |||
721 | return_VOID; | 722 | return_VOID; |
722 | } | 723 | } |
723 | 724 | ||
724 | 725 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |
725 | static void acpi_processor_power_verify_c3( | 726 | struct acpi_processor_cx *cx) |
726 | struct acpi_processor *pr, | ||
727 | struct acpi_processor_cx *cx) | ||
728 | { | 727 | { |
729 | static int bm_check_flag; | 728 | static int bm_check_flag; |
730 | 729 | ||
@@ -739,8 +738,7 @@ static void acpi_processor_power_verify_c3( | |||
739 | */ | 738 | */ |
740 | else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { | 739 | else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { |
741 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 740 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
742 | "latency too large [%d]\n", | 741 | "latency too large [%d]\n", cx->latency)); |
743 | cx->latency)); | ||
744 | return_VOID; | 742 | return_VOID; |
745 | } | 743 | } |
746 | 744 | ||
@@ -753,7 +751,7 @@ static void acpi_processor_power_verify_c3( | |||
753 | */ | 751 | */ |
754 | else if (errata.piix4.fdma) { | 752 | else if (errata.piix4.fdma) { |
755 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 753 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
756 | "C3 not supported on PIIX4 with Type-F DMA\n")); | 754 | "C3 not supported on PIIX4 with Type-F DMA\n")); |
757 | return_VOID; | 755 | return_VOID; |
758 | } | 756 | } |
759 | 757 | ||
@@ -770,7 +768,7 @@ static void acpi_processor_power_verify_c3( | |||
770 | /* bus mastering control is necessary */ | 768 | /* bus mastering control is necessary */ |
771 | if (!pr->flags.bm_control) { | 769 | if (!pr->flags.bm_control) { |
772 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 770 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
773 | "C3 support requires bus mastering control\n")); | 771 | "C3 support requires bus mastering control\n")); |
774 | return_VOID; | 772 | return_VOID; |
775 | } | 773 | } |
776 | } else { | 774 | } else { |
@@ -780,12 +778,12 @@ static void acpi_processor_power_verify_c3( | |||
780 | */ | 778 | */ |
781 | if (acpi_fadt.wb_invd != 1) { | 779 | if (acpi_fadt.wb_invd != 1) { |
782 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 780 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
783 | "Cache invalidation should work properly" | 781 | "Cache invalidation should work properly" |
784 | " for C3 to be enabled on SMP systems\n")); | 782 | " for C3 to be enabled on SMP systems\n")); |
785 | return_VOID; | 783 | return_VOID; |
786 | } | 784 | } |
787 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, | 785 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, |
788 | 0, ACPI_MTX_DO_NOT_LOCK); | 786 | 0, ACPI_MTX_DO_NOT_LOCK); |
789 | } | 787 | } |
790 | 788 | ||
791 | /* | 789 | /* |
@@ -800,13 +798,12 @@ static void acpi_processor_power_verify_c3( | |||
800 | return_VOID; | 798 | return_VOID; |
801 | } | 799 | } |
802 | 800 | ||
803 | |||
804 | static int acpi_processor_power_verify(struct acpi_processor *pr) | 801 | static int acpi_processor_power_verify(struct acpi_processor *pr) |
805 | { | 802 | { |
806 | unsigned int i; | 803 | unsigned int i; |
807 | unsigned int working = 0; | 804 | unsigned int working = 0; |
808 | 805 | ||
809 | for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 806 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
810 | struct acpi_processor_cx *cx = &pr->power.states[i]; | 807 | struct acpi_processor_cx *cx = &pr->power.states[i]; |
811 | 808 | ||
812 | switch (cx->type) { | 809 | switch (cx->type) { |
@@ -830,8 +827,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
830 | return (working); | 827 | return (working); |
831 | } | 828 | } |
832 | 829 | ||
833 | static int acpi_processor_get_power_info ( | 830 | static int acpi_processor_get_power_info(struct acpi_processor *pr) |
834 | struct acpi_processor *pr) | ||
835 | { | 831 | { |
836 | unsigned int i; | 832 | unsigned int i; |
837 | int result; | 833 | int result; |
@@ -874,16 +870,16 @@ static int acpi_processor_get_power_info ( | |||
874 | return_VALUE(0); | 870 | return_VALUE(0); |
875 | } | 871 | } |
876 | 872 | ||
877 | int acpi_processor_cst_has_changed (struct acpi_processor *pr) | 873 | int acpi_processor_cst_has_changed(struct acpi_processor *pr) |
878 | { | 874 | { |
879 | int result = 0; | 875 | int result = 0; |
880 | 876 | ||
881 | ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed"); | 877 | ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed"); |
882 | 878 | ||
883 | if (!pr) | 879 | if (!pr) |
884 | return_VALUE(-EINVAL); | 880 | return_VALUE(-EINVAL); |
885 | 881 | ||
886 | if ( nocst) { | 882 | if (nocst) { |
887 | return_VALUE(-ENODEV); | 883 | return_VALUE(-ENODEV); |
888 | } | 884 | } |
889 | 885 | ||
@@ -892,7 +888,7 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr) | |||
892 | 888 | ||
893 | /* Fall back to the default idle loop */ | 889 | /* Fall back to the default idle loop */ |
894 | pm_idle = pm_idle_save; | 890 | pm_idle = pm_idle_save; |
895 | synchronize_sched(); /* Relies on interrupts forcing exit from idle. */ | 891 | synchronize_sched(); /* Relies on interrupts forcing exit from idle. */ |
896 | 892 | ||
897 | pr->flags.power = 0; | 893 | pr->flags.power = 0; |
898 | result = acpi_processor_get_power_info(pr); | 894 | result = acpi_processor_get_power_info(pr); |
@@ -906,8 +902,8 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr) | |||
906 | 902 | ||
907 | static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | 903 | static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) |
908 | { | 904 | { |
909 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; | 905 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; |
910 | unsigned int i; | 906 | unsigned int i; |
911 | 907 | ||
912 | ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show"); | 908 | ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show"); |
913 | 909 | ||
@@ -915,17 +911,17 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
915 | goto end; | 911 | goto end; |
916 | 912 | ||
917 | seq_printf(seq, "active state: C%zd\n" | 913 | seq_printf(seq, "active state: C%zd\n" |
918 | "max_cstate: C%d\n" | 914 | "max_cstate: C%d\n" |
919 | "bus master activity: %08x\n", | 915 | "bus master activity: %08x\n", |
920 | pr->power.state ? pr->power.state - pr->power.states : 0, | 916 | pr->power.state ? pr->power.state - pr->power.states : 0, |
921 | max_cstate, | 917 | max_cstate, (unsigned)pr->power.bm_activity); |
922 | (unsigned)pr->power.bm_activity); | ||
923 | 918 | ||
924 | seq_puts(seq, "states:\n"); | 919 | seq_puts(seq, "states:\n"); |
925 | 920 | ||
926 | for (i = 1; i <= pr->power.count; i++) { | 921 | for (i = 1; i <= pr->power.count; i++) { |
927 | seq_printf(seq, " %cC%d: ", | 922 | seq_printf(seq, " %cC%d: ", |
928 | (&pr->power.states[i] == pr->power.state?'*':' '), i); | 923 | (&pr->power.states[i] == |
924 | pr->power.state ? '*' : ' '), i); | ||
929 | 925 | ||
930 | if (!pr->power.states[i].valid) { | 926 | if (!pr->power.states[i].valid) { |
931 | seq_puts(seq, "<not supported>\n"); | 927 | seq_puts(seq, "<not supported>\n"); |
@@ -949,45 +945,46 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
949 | 945 | ||
950 | if (pr->power.states[i].promotion.state) | 946 | if (pr->power.states[i].promotion.state) |
951 | seq_printf(seq, "promotion[C%zd] ", | 947 | seq_printf(seq, "promotion[C%zd] ", |
952 | (pr->power.states[i].promotion.state - | 948 | (pr->power.states[i].promotion.state - |
953 | pr->power.states)); | 949 | pr->power.states)); |
954 | else | 950 | else |
955 | seq_puts(seq, "promotion[--] "); | 951 | seq_puts(seq, "promotion[--] "); |
956 | 952 | ||
957 | if (pr->power.states[i].demotion.state) | 953 | if (pr->power.states[i].demotion.state) |
958 | seq_printf(seq, "demotion[C%zd] ", | 954 | seq_printf(seq, "demotion[C%zd] ", |
959 | (pr->power.states[i].demotion.state - | 955 | (pr->power.states[i].demotion.state - |
960 | pr->power.states)); | 956 | pr->power.states)); |
961 | else | 957 | else |
962 | seq_puts(seq, "demotion[--] "); | 958 | seq_puts(seq, "demotion[--] "); |
963 | 959 | ||
964 | seq_printf(seq, "latency[%03d] usage[%08d]\n", | 960 | seq_printf(seq, "latency[%03d] usage[%08d]\n", |
965 | pr->power.states[i].latency, | 961 | pr->power.states[i].latency, |
966 | pr->power.states[i].usage); | 962 | pr->power.states[i].usage); |
967 | } | 963 | } |
968 | 964 | ||
969 | end: | 965 | end: |
970 | return_VALUE(0); | 966 | return_VALUE(0); |
971 | } | 967 | } |
972 | 968 | ||
973 | static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) | 969 | static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) |
974 | { | 970 | { |
975 | return single_open(file, acpi_processor_power_seq_show, | 971 | return single_open(file, acpi_processor_power_seq_show, |
976 | PDE(inode)->data); | 972 | PDE(inode)->data); |
977 | } | 973 | } |
978 | 974 | ||
979 | static struct file_operations acpi_processor_power_fops = { | 975 | static struct file_operations acpi_processor_power_fops = { |
980 | .open = acpi_processor_power_open_fs, | 976 | .open = acpi_processor_power_open_fs, |
981 | .read = seq_read, | 977 | .read = seq_read, |
982 | .llseek = seq_lseek, | 978 | .llseek = seq_lseek, |
983 | .release = single_release, | 979 | .release = single_release, |
984 | }; | 980 | }; |
985 | 981 | ||
986 | int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) | 982 | int acpi_processor_power_init(struct acpi_processor *pr, |
983 | struct acpi_device *device) | ||
987 | { | 984 | { |
988 | acpi_status status = 0; | 985 | acpi_status status = 0; |
989 | static int first_run = 0; | 986 | static int first_run = 0; |
990 | struct proc_dir_entry *entry = NULL; | 987 | struct proc_dir_entry *entry = NULL; |
991 | unsigned int i; | 988 | unsigned int i; |
992 | 989 | ||
993 | ACPI_FUNCTION_TRACE("acpi_processor_power_init"); | 990 | ACPI_FUNCTION_TRACE("acpi_processor_power_init"); |
@@ -995,7 +992,9 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
995 | if (!first_run) { | 992 | if (!first_run) { |
996 | dmi_check_system(processor_power_dmi_table); | 993 | dmi_check_system(processor_power_dmi_table); |
997 | if (max_cstate < ACPI_C_STATES_MAX) | 994 | if (max_cstate < ACPI_C_STATES_MAX) |
998 | printk(KERN_NOTICE "ACPI: processor limited to max C-state %d\n", max_cstate); | 995 | printk(KERN_NOTICE |
996 | "ACPI: processor limited to max C-state %d\n", | ||
997 | max_cstate); | ||
999 | first_run++; | 998 | first_run++; |
1000 | } | 999 | } |
1001 | 1000 | ||
@@ -1003,7 +1002,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
1003 | return_VALUE(-EINVAL); | 1002 | return_VALUE(-EINVAL); |
1004 | 1003 | ||
1005 | if (acpi_fadt.cst_cnt && !nocst) { | 1004 | if (acpi_fadt.cst_cnt && !nocst) { |
1006 | status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); | 1005 | status = |
1006 | acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); | ||
1007 | if (ACPI_FAILURE(status)) { | 1007 | if (ACPI_FAILURE(status)) { |
1008 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1008 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1009 | "Notifying BIOS of _CST ability failed\n")); | 1009 | "Notifying BIOS of _CST ability failed\n")); |
@@ -1023,7 +1023,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
1023 | printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); | 1023 | printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); |
1024 | for (i = 1; i <= pr->power.count; i++) | 1024 | for (i = 1; i <= pr->power.count; i++) |
1025 | if (pr->power.states[i].valid) | 1025 | if (pr->power.states[i].valid) |
1026 | printk(" C%d[C%d]", i, pr->power.states[i].type); | 1026 | printk(" C%d[C%d]", i, |
1027 | pr->power.states[i].type); | ||
1027 | printk(")\n"); | 1028 | printk(")\n"); |
1028 | 1029 | ||
1029 | if (pr->id == 0) { | 1030 | if (pr->id == 0) { |
@@ -1034,11 +1035,11 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
1034 | 1035 | ||
1035 | /* 'power' [R] */ | 1036 | /* 'power' [R] */ |
1036 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, | 1037 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, |
1037 | S_IRUGO, acpi_device_dir(device)); | 1038 | S_IRUGO, acpi_device_dir(device)); |
1038 | if (!entry) | 1039 | if (!entry) |
1039 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1040 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1040 | "Unable to create '%s' fs entry\n", | 1041 | "Unable to create '%s' fs entry\n", |
1041 | ACPI_PROCESSOR_FILE_POWER)); | 1042 | ACPI_PROCESSOR_FILE_POWER)); |
1042 | else { | 1043 | else { |
1043 | entry->proc_fops = &acpi_processor_power_fops; | 1044 | entry->proc_fops = &acpi_processor_power_fops; |
1044 | entry->data = acpi_driver_data(device); | 1045 | entry->data = acpi_driver_data(device); |
@@ -1050,14 +1051,16 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
1050 | return_VALUE(0); | 1051 | return_VALUE(0); |
1051 | } | 1052 | } |
1052 | 1053 | ||
1053 | int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device) | 1054 | int acpi_processor_power_exit(struct acpi_processor *pr, |
1055 | struct acpi_device *device) | ||
1054 | { | 1056 | { |
1055 | ACPI_FUNCTION_TRACE("acpi_processor_power_exit"); | 1057 | ACPI_FUNCTION_TRACE("acpi_processor_power_exit"); |
1056 | 1058 | ||
1057 | pr->flags.power_setup_done = 0; | 1059 | pr->flags.power_setup_done = 0; |
1058 | 1060 | ||
1059 | if (acpi_device_dir(device)) | 1061 | if (acpi_device_dir(device)) |
1060 | remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,acpi_device_dir(device)); | 1062 | remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, |
1063 | acpi_device_dir(device)); | ||
1061 | 1064 | ||
1062 | /* Unregister the idle handler when processor #0 is removed. */ | 1065 | /* Unregister the idle handler when processor #0 is removed. */ |
1063 | if (pr->id == 0) { | 1066 | if (pr->id == 0) { |