Commit 4dac0c1e authored by Len Brown's avatar Len Brown Committed by Len Brown
parent 5049beda
...@@ -104,19 +104,22 @@ acpi_processor_power_activate ( ...@@ -104,19 +104,22 @@ acpi_processor_power_activate (
if (!pr) if (!pr)
return; return;
old = &pr->power.states[pr->power.state]; old = pr->power.state;
new = &pr->power.states[state]; new = &pr->power.states[state];
old->promotion.count = 0; if (old)
old->promotion.count = 0;
new->demotion.count = 0; new->demotion.count = 0;
/* Cleanup from old state. */ /* Cleanup from old state. */
switch (old->type) { if (old) {
case ACPI_STATE_C3: switch (old->type) {
/* Disable bus master reload */ case ACPI_STATE_C3:
if (new->type != ACPI_STATE_C3) /* Disable bus master reload */
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); if (new->type != ACPI_STATE_C3)
break; acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK);
break;
}
} }
/* Prepare to use new state. */ /* Prepare to use new state. */
...@@ -128,7 +131,7 @@ acpi_processor_power_activate ( ...@@ -128,7 +131,7 @@ acpi_processor_power_activate (
break; break;
} }
pr->power.state = state; pr->power.state = new;
return; return;
} }
...@@ -161,7 +164,9 @@ void acpi_processor_idle (void) ...@@ -161,7 +164,9 @@ void acpi_processor_idle (void)
return; return;
} }
cx = &(pr->power.states[pr->power.state]); cx = pr->power.state;
if (!cx)
goto easy_out;
/* /*
* Check BM Activity * Check BM Activity
...@@ -276,7 +281,7 @@ void acpi_processor_idle (void) ...@@ -276,7 +281,7 @@ void acpi_processor_idle (void)
return; return;
} }
next_state = pr->power.state; next_state = pr->power.state - pr->power.states;
/* /*
* Promotion? * Promotion?
...@@ -326,8 +331,9 @@ void acpi_processor_idle (void) ...@@ -326,8 +331,9 @@ void acpi_processor_idle (void)
/* /*
* Demote if current state exceeds max_cstate * Demote if current state exceeds max_cstate
*/ */
if (pr->power.state > max_cstate) { if (pr->power.state->type > max_cstate) {
next_state = max_cstate; if (cx->demotion.state)
next_state = cx->demotion.state;
} }
/* /*
...@@ -336,10 +342,18 @@ void acpi_processor_idle (void) ...@@ -336,10 +342,18 @@ void acpi_processor_idle (void)
* If we're going to start using a new Cx state we must clean up * If we're going to start using a new Cx state we must clean up
* from the previous and prepare to use the new. * from the previous and prepare to use the new.
*/ */
if (next_state != pr->power.state) if (&pr->power.states[next_state] != pr->power.state)
acpi_processor_power_activate(pr, next_state); acpi_processor_power_activate(pr, next_state);
return; return;
easy_out:
/* do C1 instead of busy loop */
if (pm_idle_save)
pm_idle_save();
else
safe_halt();
return;
} }
...@@ -365,7 +379,7 @@ acpi_processor_set_power_policy ( ...@@ -365,7 +379,7 @@ acpi_processor_set_power_policy (
* C0/C1 * C0/C1
* ----- * -----
*/ */
pr->power.state = ACPI_STATE_C1; pr->power.state = &pr->power.states[ACPI_STATE_C1];
/* /*
* C1/C2 * C1/C2
...@@ -636,9 +650,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) ...@@ -636,9 +650,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
goto end; goto end;
seq_printf(seq, "active state: %d\n" seq_printf(seq, "active state: %d\n"
"max_cstate: %d\n" "max_cstate: C%d\n"
"bus master activity: %08x\n", "bus master activity: %08x\n",
pr->power.state, pr->power.state ? pr->power.state - pr->power.states : 0,
max_cstate, max_cstate,
pr->power.bm_activity); pr->power.bm_activity);
...@@ -646,7 +660,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) ...@@ -646,7 +660,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
for (i = 1; i < ACPI_C_STATE_COUNT; i++) { for (i = 1; i < ACPI_C_STATE_COUNT; i++) {
seq_printf(seq, " %c%d: ", seq_printf(seq, " %c%d: ",
(i == pr->power.state?'*':' '), i); (&pr->power.states[i] == pr->power.state?'*':' '), i);
if (!pr->power.states[i].valid) { if (!pr->power.states[i].valid) {
seq_puts(seq, "<not supported>\n"); seq_puts(seq, "<not supported>\n");
......
...@@ -40,7 +40,7 @@ struct acpi_processor_cx { ...@@ -40,7 +40,7 @@ struct acpi_processor_cx {
}; };
struct acpi_processor_power { struct acpi_processor_power {
u32 state; struct acpi_processor_cx *state;
u32 default_state; u32 default_state;
u32 bm_activity; u32 bm_activity;
struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment