aboutsummaryrefslogtreecommitdiff
path: root/source/components/events/evxfgpe.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/events/evxfgpe.c')
-rw-r--r--source/components/events/evxfgpe.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c
index 1a76256d8cab..bd2a0e28636f 100644
--- a/source/components/events/evxfgpe.c
+++ b/source/components/events/evxfgpe.c
@@ -188,6 +188,7 @@ AcpiUpdateAllGpes (
void)
{
ACPI_STATUS Status;
+ BOOLEAN IsPollingNeeded = FALSE;
ACPI_FUNCTION_TRACE (AcpiUpdateAllGpes);
@@ -204,7 +205,8 @@ AcpiUpdateAllGpes (
goto UnlockAndExit;
}
- Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock, NULL);
+ Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock,
+ &IsPollingNeeded);
if (ACPI_SUCCESS (Status))
{
AcpiGbl_AllGpesInitialized = TRUE;
@@ -212,6 +214,13 @@ AcpiUpdateAllGpes (
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+
+ if (IsPollingNeeded && AcpiGbl_AllGpesInitialized)
+ {
+ /* Poll GPEs to handle already triggered events */
+
+ AcpiEvGpeDetect (AcpiGbl_GpeXruptListHead);
+ }
return_ACPI_STATUS (Status);
}
@@ -259,6 +268,16 @@ AcpiEnableGpe (
ACPI_GPE_DISPATCH_NONE)
{
Status = AcpiEvAddGpeReference (GpeEventInfo);
+ if (ACPI_SUCCESS (Status) &&
+ ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
+ {
+ /* Poll edge-triggered GPEs to handle existing events */
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ (void) AcpiEvDetectGpe (
+ GpeDevice, GpeEventInfo, GpeNumber);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+ }
}
else
{
@@ -609,6 +628,16 @@ AcpiSetupGpeForWake (
GpeEventInfo->Flags =
(ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED);
}
+ else if (GpeEventInfo->Flags & ACPI_GPE_AUTO_ENABLED)
+ {
+ /*
+ * A reference to this GPE has been added during the GPE block
+ * initialization, so drop it now to prevent the GPE from being
+ * permanently enabled and clear its ACPI_GPE_AUTO_ENABLED flag.
+ */
+ (void) AcpiEvRemoveGpeReference (GpeEventInfo);
+ GpeEventInfo->Flags &= ~~ACPI_GPE_AUTO_ENABLED;
+ }
/*
* If we already have an implicit notify on this GPE, add