Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / drivers / acpi / acpica / evgpeblk.c
index 341a38c..020add3 100644 (file)
@@ -363,6 +363,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
        gpe_block->gpe_count = (u16)(register_count * ACPI_GPE_REGISTER_WIDTH);
        gpe_block->register_count = register_count;
        gpe_block->block_base_number = gpe_block_base_number;
+       gpe_block->initialized = FALSE;
 
        ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address,
                    sizeof(struct acpi_generic_address));
@@ -385,11 +386,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
                return_ACPI_STATUS(status);
        }
 
+       acpi_all_gpes_initialized = FALSE;
+
        /* Find all GPE methods (_Lxx or_Exx) for this block */
 
        walk_info.gpe_block = gpe_block;
        walk_info.gpe_device = gpe_device;
-       walk_info.enable_this_gpe = FALSE;
        walk_info.execute_by_owner_id = FALSE;
 
        status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device,
@@ -434,65 +436,34 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
  ******************************************************************************/
 
 acpi_status
-acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
-                            struct acpi_gpe_block_info *gpe_block)
+acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                            struct acpi_gpe_block_info *gpe_block,
+                            void *ignored)
 {
        acpi_status status;
        struct acpi_gpe_event_info *gpe_event_info;
-       struct acpi_gpe_walk_info walk_info;
-       u32 wake_gpe_count;
        u32 gpe_enabled_count;
        u32 gpe_index;
-       u32 gpe_number;
        u32 i;
        u32 j;
 
        ACPI_FUNCTION_TRACE(ev_initialize_gpe_block);
 
-       /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
-
-       if (!gpe_block) {
-               return_ACPI_STATUS(AE_OK);
-       }
-
        /*
-        * Runtime option: Should wake GPEs be enabled at runtime?  The default
-        * is no, they should only be enabled just as the machine goes to sleep.
+        * Ignore a null GPE block (e.g., if no GPE block 1 exists) and
+        * GPE blocks that have been initialized already.
         */
-       if (acpi_gbl_leave_wake_gpes_disabled) {
-               /*
-                * Differentiate runtime vs wake GPEs, via the _PRW control methods.
-                * Each GPE that has one or more _PRWs that reference it is by
-                * definition a wake GPE and will not be enabled while the machine
-                * is running.
-                */
-               walk_info.gpe_block = gpe_block;
-               walk_info.gpe_device = gpe_device;
-               walk_info.execute_by_owner_id = FALSE;
-
-               status =
-                   acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-                                          ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
-                                          acpi_ev_match_prw_and_gpe, NULL,
-                                          &walk_info, NULL);
-               if (ACPI_FAILURE(status)) {
-                       ACPI_EXCEPTION((AE_INFO, status,
-                                       "While executing _PRW methods"));
-               }
+       if (!gpe_block || gpe_block->initialized) {
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
-        * Enable all GPEs that have a corresponding method and are not
-        * capable of generating wakeups. Any other GPEs within this block
-        * must be enabled via the acpi_enable_gpe interface.
+        * Enable all GPEs that have a corresponding method and have the
+        * ACPI_GPE_CAN_WAKE flag unset.  Any other GPEs within this block must
+        * be enabled via the acpi_enable_gpe() interface.
         */
-       wake_gpe_count = 0;
        gpe_enabled_count = 0;
 
-       if (gpe_device == acpi_gbl_fadt_gpe_device) {
-               gpe_device = NULL;
-       }
-
        for (i = 0; i < gpe_block->register_count; i++) {
                for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
 
@@ -500,41 +471,19 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
 
                        gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j;
                        gpe_event_info = &gpe_block->event_info[gpe_index];
-                       gpe_number = gpe_index + gpe_block->block_base_number;
-
-                       /*
-                        * If the GPE has already been enabled for runtime
-                        * signaling, make sure it remains enabled, but do not
-                        * increment its reference counter.
-                        */
-                       if (gpe_event_info->runtime_count) {
-                               acpi_set_gpe(gpe_device, gpe_number,
-                                               ACPI_GPE_ENABLE);
-                               gpe_enabled_count++;
-                               continue;
-                       }
-
-                       if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
-                               wake_gpe_count++;
-                               if (acpi_gbl_leave_wake_gpes_disabled) {
-                                       continue;
-                               }
-                       }
 
                        /* Ignore GPEs that have no corresponding _Lxx/_Exx method */
 
-                       if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) {
+                       if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)
+                           || (gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
                                continue;
                        }
 
-                       /* Enable this GPE */
-
-                       status = acpi_enable_gpe(gpe_device, gpe_number,
-                                                ACPI_GPE_TYPE_RUNTIME);
+                       status = acpi_raw_enable_gpe(gpe_event_info);
                        if (ACPI_FAILURE(status)) {
                                ACPI_EXCEPTION((AE_INFO, status,
-                                               "Could not enable GPE 0x%02X",
-                                               gpe_number));
+                                       "Could not enable GPE 0x%02X",
+                                       gpe_index + gpe_block->block_base_number));
                                continue;
                        }
 
@@ -542,11 +491,13 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
                }
        }
 
-       if (gpe_enabled_count || wake_gpe_count) {
+       if (gpe_enabled_count) {
                ACPI_DEBUG_PRINT((ACPI_DB_INIT,
-                                 "Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n",
-                                 gpe_enabled_count, wake_gpe_count));
+                                 "Enabled %u GPEs in this block\n",
+                                 gpe_enabled_count));
        }
 
+       gpe_block->initialized = TRUE;
+
        return_ACPI_STATUS(AE_OK);
 }