Subject: EC fix for ACPI CA 20030512 patch
To: port-i386 <port-i386@netbsd.org>
From: Michael South <msouth@msouth.org>
List: port-i386
Date: 05/26/2003 08:14:07
I found the problem. They split off GPE from AcpiClearEvent() and
AcpiEnableEvent(). For EC devices you now have to call AcpiClearGpe()
and AcpiEnableGpe(). Patch below.
The kernel panicked with ACPI_DEBUG turned on. The debug output calls
AcpiOsGetThreadId() before threads are initialized, and there was an
assert checking that curlwp wasn't null. I just faked it and returned 1
in that case.
Mike
--- src/sys/dev/acpi/acpi_ec.c.patch1 2003-05-25 10:32:46.000000000 -0700
+++ src/sys/dev/acpi/acpi_ec.c 2003-05-25 23:58:08.000000000 -0700
@@ -461,10 +461,11 @@
}
/* I know I request Level trigger cleanup */
- if (AcpiClearEvent(sc->sc_gpebit) != AE_OK)
- printf("%s: AcpiClearEvent failed\n", sc->sc_dev.dv_xname);
- if (AcpiEnableEvent(sc->sc_gpebit, 0) != AE_OK)
- printf("%s: AcpiEnableEvent failed\n", sc->sc_dev.dv_xname);
+ if (AcpiClearGpe(NULL, sc->sc_gpebit, ACPI_NOT_ISR) != AE_OK)
+ printf("%s: AcpiClearGpe failed\n", sc->sc_dev.dv_xname);
+ /* XXXMGS Not enabling for wake events */
+ if (AcpiEnableGpe(NULL, sc->sc_gpebit, ACPI_NOT_ISR) != AE_OK)
+ printf("%s: AcpiEnableGpe failed\n", sc->sc_dev.dv_xname);
return_VOID;
}
@@ -677,7 +678,6 @@
EcTransaction(struct acpi_ec_softc *sc, EC_REQUEST *EcRequest)
{
ACPI_STATUS Status;
- ACPI_STATUS s;
if ((Status = EcLock(sc)) != AE_OK)
return (Status);
@@ -716,12 +716,13 @@
sc->sc_flags &= ~EC_F_PENDQUERY;
}
- if ((s = AcpiClearEvent(sc->sc_gpebit)) != AE_OK)
- printf("%s: EcRequest: unable to clear EC GPE 0x%x\n",
- sc->sc_dev.dv_xname, s);
- if ((s = AcpiEnableEvent(sc->sc_gpebit, 0)) != AE_OK)
- printf("%s: EcRequest: unable to reenable EC GPE 0x%x\n",
- sc->sc_dev.dv_xname, s);
+ if (AcpiClearGpe(NULL, sc->sc_gpebit, ACPI_NOT_ISR) != AE_OK)
+ printf("%s: EcRequest: unable to clear EC GPE\n",
+ sc->sc_dev.dv_xname);
+ /* XXXMGS Not enabling for wake events */
+ if (AcpiEnableGpe(NULL, sc->sc_gpebit, ACPI_NOT_ISR) != AE_OK)
+ printf("%s: EcRequest: unable to reenable EC GPE\n",
+ sc->sc_dev.dv_xname);
EcUnlock(sc);
--- src/sys/dev/acpi/acpica/Osd/OsdSchedule.c 2003/04/20 20:21:30 1.6
+++ src/sys/dev/acpi/acpica/Osd/OsdSchedule.c 2003/05/26 15:03:26
@@ -100,10 +100,12 @@
AcpiOsGetThreadId(void)
{
- KASSERT(curlwp != NULL);
-
- /* XXX Bleh, we're not allowed to return 0 (how stupid!) */
- return (curproc->p_pid + 1);
+ /* XXXMGS Debugger calls GetThreadId() before threads initialized */
+ /* XXX Bleh, we're not allowed to return 0 (how stupid!) */
+ if (curlwp != NULL)
+ return (curproc->p_pid + 1);
+ else
+ return (1);
}
/*
--
Michael South
msouth@msouth.org