int acpiec_gpehandler(struct acpi_softc *acpi_sc, int gpe, void *arg) { struct acpiec_softc *sc = arg; u_int8_t mask, stat; dnprintf(10, "ACPIEC: got gpe\n"); /* Reset GPE event */ mask = (1L << (gpe & 7)); acpi_write_pmreg(acpi_sc, ACPIREG_GPE_STS, gpe>>3, mask); acpi_write_pmreg(acpi_sc, ACPIREG_GPE_EN, gpe>>3, mask); do { if (sc->sc_gotsci) acpiec_sci_event(sc); stat = acpiec_status(sc); dnprintf(40, "%s: EC interrupt, stat: %b\n", DEVNAME(sc), (int)stat, "\20\x8IGN\x7SMI\x6SCI\05BURST\04CMD\03IGN\02IBF\01OBF"); if (stat & EC_STAT_SCI_EVT) sc->sc_gotsci = 1; } while (sc->sc_gotsci); return (0); }
int acpiec_gpehandler(struct acpi_softc *acpi_sc, int gpe, void *arg) { struct acpiec_softc *sc = arg; u_int8_t mask, stat, en; int s; KASSERT(sc->sc_ecbusy == 0); dnprintf(10, "ACPIEC: got gpe\n"); do { if (sc->sc_gotsci) acpiec_sci_event(sc); stat = acpiec_status(sc); dnprintf(40, "%s: EC interrupt, stat: %b\n", DEVNAME(sc), (int)stat, "\20\x8IGN\x7SMI\x6SCI\05BURST\04CMD\03IGN\02IBF\01OBF"); if (stat & EC_STAT_SCI_EVT) sc->sc_gotsci = 1; else sc->sc_gotsci = 0; } while (sc->sc_gotsci); /* Unmask the GPE which was blocked at interrupt time */ s = spltty(); mask = (1L << (gpe & 7)); en = acpi_read_pmreg(acpi_sc, ACPIREG_GPE_EN, gpe>>3); acpi_write_pmreg(acpi_sc, ACPIREG_GPE_EN, gpe>>3, en | mask); splx(s); return (0); }