]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/acpi/processor_idle.c
Merge branches 'acpica', 'bgrt', 'bz-11533', 'cpuidle', 'ec', 'hotplug', 'misc',...
[karo-tx-linux.git] / drivers / acpi / processor_idle.c
index 0e8e2de2ed3e3a6b18ab07d07713a529295f31aa..b3447f63e46b4f77a7e5edc7dc3bd5d0a7b3d33c 100644 (file)
@@ -770,6 +770,35 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
        return index;
 }
 
+
+/**
+ * acpi_idle_play_dead - enters an ACPI state for long-term idle (i.e. off-lining)
+ * @dev: the target CPU
+ * @index: the index of suggested state
+ */
+static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
+{
+       struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
+       struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
+
+       ACPI_FLUSH_CPU_CACHE();
+
+       while (1) {
+
+               if (cx->entry_method == ACPI_CSTATE_HALT)
+                       halt();
+               else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) {
+                       inb(cx->address);
+                       /* See comment in acpi_idle_do_entry() */
+                       inl(acpi_gbl_FADT.xpm_timer_block.address);
+               } else
+                       return -ENODEV;
+       }
+
+       /* Never reached */
+       return 0;
+}
+
 /**
  * acpi_idle_enter_simple - enters an ACPI state without BM handling
  * @dev: the target CPU
@@ -1077,12 +1106,14 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
                                state->flags |= CPUIDLE_FLAG_TIME_VALID;
 
                        state->enter = acpi_idle_enter_c1;
+                       state->enter_dead = acpi_idle_play_dead;
                        drv->safe_state_index = count;
                        break;
 
                        case ACPI_STATE_C2:
                        state->flags |= CPUIDLE_FLAG_TIME_VALID;
                        state->enter = acpi_idle_enter_simple;
+                       state->enter_dead = acpi_idle_play_dead;
                        drv->safe_state_index = count;
                        break;
 
@@ -1159,8 +1190,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
         * to make the code that updates C-States be called once.
         */
 
-       if (smp_processor_id() == 0 &&
-                       cpuidle_get_driver() == &acpi_idle_driver) {
+       if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) {
 
                cpuidle_pause_and_lock();
                /* Protect against cpu-hotplug */