vserver 1.9.3
[linux-2.6.git] / drivers / acpi / hardware / hwsleep.c
index f0c0414..6ffa80b 100644 (file)
@@ -265,19 +265,21 @@ acpi_enter_sleep_state (
        sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
        sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
 
-       if (sleep_state != ACPI_STATE_S5) {
-               /* Clear wake status */
+       /* Clear wake status */
 
-               status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
-               }
+       status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
 
-               status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
-               }
+       /* Clear all fixed and general purpose status bits */
 
+       status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
+
+       if (sleep_state != ACPI_STATE_S5) {
                /* Disable BM arbitration */
 
                status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK);
@@ -287,10 +289,16 @@ acpi_enter_sleep_state (
        }
 
        /*
-        * 1) Disable all runtime GPEs
+        * 1) Disable/Clear all GPEs
         * 2) Enable all wakeup GPEs
         */
-       status = acpi_hw_prepare_gpes_for_sleep ();
+       status = acpi_hw_disable_all_gpes (ACPI_ISR);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
+       acpi_gbl_system_awake_and_running = FALSE;
+
+       status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
@@ -420,10 +428,16 @@ acpi_enter_sleep_state_s4bios (
        }
 
        /*
-        * 1) Disable all runtime GPEs
+        * 1) Disable/Clear all GPEs
         * 2) Enable all wakeup GPEs
         */
-       status = acpi_hw_prepare_gpes_for_sleep ();
+       status = acpi_hw_disable_all_gpes (ACPI_ISR);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
+       acpi_gbl_system_awake_and_running = FALSE;
+
+       status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
@@ -453,6 +467,7 @@ acpi_enter_sleep_state_s4bios (
  * RETURN:      Status
  *
  * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ *              Called with interrupts ENABLED.
  *
  ******************************************************************************/
 
@@ -540,19 +555,25 @@ acpi_leave_sleep_state (
 
        /*
         * Restore the GPEs:
-        * 1) Disable all wakeup GPEs
+        * 1) Disable/Clear all GPEs
         * 2) Enable all runtime GPEs
         */
-       status = acpi_hw_restore_gpes_on_wake ();
+       status = acpi_hw_disable_all_gpes (ACPI_NOT_ISR);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
+       acpi_gbl_system_awake_and_running = TRUE;
+
+       status = acpi_hw_enable_all_runtime_gpes (ACPI_NOT_ISR);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
 
        /* Enable power button */
 
-       acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
+       (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
                        1, ACPI_MTX_DO_NOT_LOCK);
-       acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
+       (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
                        1, ACPI_MTX_DO_NOT_LOCK);
 
        /* Enable BM arbitration */