diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/ec.c | 7 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 44 |
2 files changed, 28 insertions, 23 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 874f912962c4..8c5d7df7d343 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -213,7 +213,7 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) | |||
213 | 213 | ||
214 | switch (event) { | 214 | switch (event) { |
215 | case ACPI_EC_EVENT_IBE: | 215 | case ACPI_EC_EVENT_IBE: |
216 | if (~acpi_ec_read_status(ec) & event) { | 216 | if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) { |
217 | ec->intr.expect_event = 0; | 217 | ec->intr.expect_event = 0; |
218 | return 0; | 218 | return 0; |
219 | } | 219 | } |
@@ -782,12 +782,15 @@ static u32 acpi_ec_gpe_intr_handler(void *data) | |||
782 | case ACPI_EC_EVENT_OBF: | 782 | case ACPI_EC_EVENT_OBF: |
783 | if (!(value & ACPI_EC_FLAG_OBF)) | 783 | if (!(value & ACPI_EC_FLAG_OBF)) |
784 | break; | 784 | break; |
785 | ec->intr.expect_event = 0; | ||
786 | wake_up(&ec->intr.wait); | ||
787 | break; | ||
785 | case ACPI_EC_EVENT_IBE: | 788 | case ACPI_EC_EVENT_IBE: |
786 | if ((value & ACPI_EC_FLAG_IBF)) | 789 | if ((value & ACPI_EC_FLAG_IBF)) |
787 | break; | 790 | break; |
788 | ec->intr.expect_event = 0; | 791 | ec->intr.expect_event = 0; |
789 | wake_up(&ec->intr.wait); | 792 | wake_up(&ec->intr.wait); |
790 | return ACPI_INTERRUPT_HANDLED; | 793 | break; |
791 | default: | 794 | default: |
792 | break; | 795 | break; |
793 | } | 796 | } |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 89d3fd4c3cd2..e439eb77d283 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
6 | * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> | 6 | * Copyright (C) 2004, 2005 Dominik Brodowski <linux@brodo.de> |
7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | 7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> |
8 | * - Added processor hotplug support | 8 | * - Added processor hotplug support |
9 | * Copyright (C) 2005 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | 9 | * Copyright (C) 2005 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> |
@@ -99,6 +99,9 @@ static int set_max_cstate(struct dmi_system_id *id) | |||
99 | static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { | 99 | static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { |
100 | { set_max_cstate, "IBM ThinkPad R40e", { | 100 | { set_max_cstate, "IBM ThinkPad R40e", { |
101 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | 101 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
102 | DMI_MATCH(DMI_BIOS_VERSION,"1SET70WW")}, (void *)1}, | ||
103 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
104 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
102 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW")}, (void *)1}, | 105 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW")}, (void *)1}, |
103 | { set_max_cstate, "IBM ThinkPad R40e", { | 106 | { set_max_cstate, "IBM ThinkPad R40e", { |
104 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | 107 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
@@ -261,21 +264,15 @@ static void acpi_processor_idle(void) | |||
261 | u32 bm_status = 0; | 264 | u32 bm_status = 0; |
262 | unsigned long diff = jiffies - pr->power.bm_check_timestamp; | 265 | unsigned long diff = jiffies - pr->power.bm_check_timestamp; |
263 | 266 | ||
264 | if (diff > 32) | 267 | if (diff > 31) |
265 | diff = 32; | 268 | diff = 31; |
266 | 269 | ||
267 | while (diff) { | 270 | pr->power.bm_activity <<= diff; |
268 | /* if we didn't get called, assume there was busmaster activity */ | ||
269 | diff--; | ||
270 | if (diff) | ||
271 | pr->power.bm_activity |= 0x1; | ||
272 | pr->power.bm_activity <<= 1; | ||
273 | } | ||
274 | 271 | ||
275 | acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, | 272 | acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, |
276 | &bm_status, ACPI_MTX_DO_NOT_LOCK); | 273 | &bm_status, ACPI_MTX_DO_NOT_LOCK); |
277 | if (bm_status) { | 274 | if (bm_status) { |
278 | pr->power.bm_activity++; | 275 | pr->power.bm_activity |= 0x1; |
279 | acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, | 276 | acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, |
280 | 1, ACPI_MTX_DO_NOT_LOCK); | 277 | 1, ACPI_MTX_DO_NOT_LOCK); |
281 | } | 278 | } |
@@ -287,16 +284,16 @@ static void acpi_processor_idle(void) | |||
287 | else if (errata.piix4.bmisx) { | 284 | else if (errata.piix4.bmisx) { |
288 | if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) | 285 | if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) |
289 | || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) | 286 | || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) |
290 | pr->power.bm_activity++; | 287 | pr->power.bm_activity |= 0x1; |
291 | } | 288 | } |
292 | 289 | ||
293 | pr->power.bm_check_timestamp = jiffies; | 290 | pr->power.bm_check_timestamp = jiffies; |
294 | 291 | ||
295 | /* | 292 | /* |
296 | * Apply bus mastering demotion policy. Automatically demote | 293 | * If bus mastering is or was active this jiffy, demote |
297 | * to avoid a faulty transition. Note that the processor | 294 | * to avoid a faulty transition. Note that the processor |
298 | * won't enter a low-power state during this call (to this | 295 | * won't enter a low-power state during this call (to this |
299 | * funciton) but should upon the next. | 296 | * function) but should upon the next. |
300 | * | 297 | * |
301 | * TBD: A better policy might be to fallback to the demotion | 298 | * TBD: A better policy might be to fallback to the demotion |
302 | * state (use it for this quantum only) istead of | 299 | * state (use it for this quantum only) istead of |
@@ -304,7 +301,8 @@ static void acpi_processor_idle(void) | |||
304 | * qualification. This may, however, introduce DMA | 301 | * qualification. This may, however, introduce DMA |
305 | * issues (e.g. floppy DMA transfer overrun/underrun). | 302 | * issues (e.g. floppy DMA transfer overrun/underrun). |
306 | */ | 303 | */ |
307 | if (pr->power.bm_activity & cx->demotion.threshold.bm) { | 304 | if ((pr->power.bm_activity & 0x1) && |
305 | cx->demotion.threshold.bm) { | ||
308 | local_irq_enable(); | 306 | local_irq_enable(); |
309 | next_state = cx->demotion.state; | 307 | next_state = cx->demotion.state; |
310 | goto end; | 308 | goto end; |
@@ -322,8 +320,6 @@ static void acpi_processor_idle(void) | |||
322 | cx = &pr->power.states[ACPI_STATE_C1]; | 320 | cx = &pr->power.states[ACPI_STATE_C1]; |
323 | #endif | 321 | #endif |
324 | 322 | ||
325 | cx->usage++; | ||
326 | |||
327 | /* | 323 | /* |
328 | * Sleep: | 324 | * Sleep: |
329 | * ------ | 325 | * ------ |
@@ -365,7 +361,9 @@ static void acpi_processor_idle(void) | |||
365 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); | 361 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); |
366 | /* Invoke C2 */ | 362 | /* Invoke C2 */ |
367 | inb(cx->address); | 363 | inb(cx->address); |
368 | /* Dummy op - must do something useless after P_LVL2 read */ | 364 | /* Dummy wait op - must do something useless after P_LVL2 read |
365 | because chipsets cannot guarantee that STPCLK# signal | ||
366 | gets asserted in time to freeze execution properly. */ | ||
369 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); | 367 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); |
370 | /* Get end time (ticks) */ | 368 | /* Get end time (ticks) */ |
371 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); | 369 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); |
@@ -403,7 +401,7 @@ static void acpi_processor_idle(void) | |||
403 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); | 401 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); |
404 | /* Invoke C3 */ | 402 | /* Invoke C3 */ |
405 | inb(cx->address); | 403 | inb(cx->address); |
406 | /* Dummy op - must do something useless after P_LVL3 read */ | 404 | /* Dummy wait op (see above) */ |
407 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); | 405 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); |
408 | /* Get end time (ticks) */ | 406 | /* Get end time (ticks) */ |
409 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); | 407 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); |
@@ -430,6 +428,9 @@ static void acpi_processor_idle(void) | |||
430 | local_irq_enable(); | 428 | local_irq_enable(); |
431 | return; | 429 | return; |
432 | } | 430 | } |
431 | cx->usage++; | ||
432 | if ((cx->type != ACPI_STATE_C1) && (sleep_ticks > 0)) | ||
433 | cx->time += sleep_ticks; | ||
433 | 434 | ||
434 | next_state = pr->power.state; | 435 | next_state = pr->power.state; |
435 | 436 | ||
@@ -1053,9 +1054,10 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
1053 | else | 1054 | else |
1054 | seq_puts(seq, "demotion[--] "); | 1055 | seq_puts(seq, "demotion[--] "); |
1055 | 1056 | ||
1056 | seq_printf(seq, "latency[%03d] usage[%08d]\n", | 1057 | seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n", |
1057 | pr->power.states[i].latency, | 1058 | pr->power.states[i].latency, |
1058 | pr->power.states[i].usage); | 1059 | pr->power.states[i].usage, |
1060 | pr->power.states[i].time); | ||
1059 | } | 1061 | } |
1060 | 1062 | ||
1061 | end: | 1063 | end: |