svn commit: r216942 - head/sys/dev/acpica

Jung-uk Kim jkim at FreeBSD.org
Tue Jan 4 00:10:29 UTC 2011


Author: jkim
Date: Tue Jan  4 00:10:29 2011
New Revision: 216942
URL: http://svn.freebsd.org/changeset/base/216942

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

Modified:
  head/sys/dev/acpica/acpi_ec.c

Modified: head/sys/dev/acpica/acpi_ec.c
==============================================================================
--- head/sys/dev/acpica/acpi_ec.c	Tue Jan  4 00:08:39 2011	(r216941)
+++ head/sys/dev/acpica/acpi_ec.c	Tue Jan  4 00:10:29 2011	(r216942)
@@ -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, UINT
     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);
 }
 


More information about the svn-src-head mailing list