Clear GPE from a query handler if the task was deferred.

This commit is contained in:
jkim 2011-01-04 00:10:29 +00:00
parent 27b4b81c81
commit 3e8aab08a5

View File

@ -624,7 +624,7 @@ EcGpeQueryHandler(void *Context)
struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
UINT8 Data;
ACPI_STATUS Status;
int retry;
int retry, sci_enqueued;
char qxx[5];
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@ -645,6 +645,7 @@ EcGpeQueryHandler(void *Context)
* that may arise from running the query from causing another query
* to be queued, we clear the pending flag only after running it.
*/
sci_enqueued = sc->ec_sci_pend;
for (retry = 0; retry < 2; retry++) {
Status = EcCommand(sc, EC_COMMAND_QUERY);
if (ACPI_SUCCESS(Status))
@ -684,6 +685,12 @@ EcGpeQueryHandler(void *Context)
device_printf(sc->ec_dev, "evaluation of query method %s failed: %s\n",
qxx, AcpiFormatException(Status));
}
if (sci_enqueued) {
Status = AcpiFinishGpe(sc->ec_gpehandle, sc->ec_gpebit);
if (ACPI_FAILURE(Status))
device_printf(sc->ec_dev, "clearing GPE failed: %s\n",
AcpiFormatException(Status));
}
}
/*
@ -717,16 +724,12 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT32 GpeNumber, void *Context)
if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) {
CTR0(KTR_ACPI, "ec gpe queueing query handler");
Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context);
if (ACPI_SUCCESS(Status))
if (ACPI_SUCCESS(Status)) {
sc->ec_sci_pend = TRUE;
else
return (0);
} else
printf("EcGpeHandler: queuing GPE query handler failed\n");
}
/*
* XXX jkim
* AcpiFinishGpe() should be used at the necessary places.
*/
return (ACPI_REENABLE_GPE);
}