]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ACPICA: Dispatch active GPEs at init time
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 9 Aug 2017 22:30:09 +0000 (00:30 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 17 Aug 2017 18:54:33 +0000 (20:54 +0200)
In some cases GPEs are already active when they are enabled by
acpi_ev_initialize_gpe_block() and whatever happens next may depend
on the result of handling the events signaled by them, so the
events should not be discarded (which is what happens currently) and
they should be handled as soon as reasonably possible.

For this reason, modify acpi_ev_initialize_gpe_block() to
dispatch GPEs with the status flag set in-band right after
enabling them.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/acpi/acpica/evgpeblk.c

index 9c941947a06381c9f41ac4c7338c87793ec5644d..c27386cca49309855e56ed44924dc8accb597aed 100644 (file)
@@ -440,9 +440,11 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
                             void *ignored)
 {
        acpi_status status;
+       acpi_event_status event_status;
        struct acpi_gpe_event_info *gpe_event_info;
        u32 gpe_enabled_count;
        u32 gpe_index;
+       u32 gpe_number;
        u32 i;
        u32 j;
 
@@ -470,30 +472,38 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 
                        gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j;
                        gpe_event_info = &gpe_block->event_info[gpe_index];
+                       gpe_number = gpe_block->block_base_number + gpe_index;
 
                        /*
                         * Ignore GPEs that have no corresponding _Lxx/_Exx method
-                        * and GPEs that are used to wake the system
+                        * and GPEs that are used for wakeup
                         */
-                       if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
-                            ACPI_GPE_DISPATCH_NONE)
-                           || (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
-                               ACPI_GPE_DISPATCH_HANDLER)
-                           || (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
-                               ACPI_GPE_DISPATCH_RAW_HANDLER)
+                       if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) !=
+                            ACPI_GPE_DISPATCH_METHOD)
                            || (gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
                                continue;
                        }
 
+                       event_status = 0;
+                       (void)acpi_hw_get_gpe_status(gpe_event_info,
+                                                    &event_status);
+
                        status = acpi_ev_add_gpe_reference(gpe_event_info);
                        if (ACPI_FAILURE(status)) {
                                ACPI_EXCEPTION((AE_INFO, status,
                                        "Could not enable GPE 0x%02X",
-                                       gpe_index +
-                                       gpe_block->block_base_number));
+                                       gpe_number));
                                continue;
                        }
 
+                       if (event_status & ACPI_EVENT_FLAG_STATUS_SET) {
+                               ACPI_INFO(("GPE 0x%02X active on init",
+                                          gpe_number));
+                               (void)acpi_ev_gpe_dispatch(gpe_block->node,
+                                                          gpe_event_info,
+                                                          gpe_number);
+                       }
+
                        gpe_enabled_count++;
                }
        }