diff options
-rw-r--r-- | sys/dev/acpica/acpi_ec.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index 54a1602..cbef0d7 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -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); } |