From 0a37db8b2cc242fd1e0713b1be4a7ef24d273a96 Mon Sep 17 00:00:00 2001 From: Jordan Hargrave Date: Fri, 30 Jun 2006 04:16:16 +0000 Subject: Support for calling Embedded Controller via new GPE interface ok marco@ --- sys/dev/acpi/acpi.c | 7 +++---- sys/dev/acpi/acpiec.c | 20 ++++++++++++++++---- sys/dev/acpi/acpivar.h | 5 ++++- 3 files changed, 23 insertions(+), 9 deletions(-) (limited to 'sys') diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index c5cb6ad60da..f366867e720 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.53 2006/06/30 04:03:13 jordan Exp $ */ +/* $OpenBSD: acpi.c,v 1.54 2006/06/30 04:16:15 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -55,8 +55,6 @@ int acpi_print(void *, const char *); void acpi_map_pmregs(struct acpi_softc *); void acpi_unmap_pmregs(struct acpi_softc *); -int acpi_read_pmreg(struct acpi_softc *, int, int); -void acpi_write_pmreg(struct acpi_softc *, int, int, int); void acpi_foundpss(struct aml_node *, void *); void acpi_foundhid(struct aml_node *, void *); @@ -1080,7 +1078,7 @@ acpi_interrupt(void *arg) sc->sc_sleepbtn = 1; processed = 1; } - +#if 0 if (ec) { if (acpiec_intr(sc->sc_ec)) processed = 1; @@ -1092,6 +1090,7 @@ acpi_interrupt(void *arg) acpi_write_pmreg(sc, ACPIREG_GPE0_STS, 0, sts); acpi_write_pmreg(sc, ACPIREG_GPE0_EN, 0, en | sts); } +#endif if (processed) { sc->sc_wakeup = 0; diff --git a/sys/dev/acpi/acpiec.c b/sys/dev/acpi/acpiec.c index afdf7e819fb..c87f4ad1aaa 100644 --- a/sys/dev/acpi/acpiec.c +++ b/sys/dev/acpi/acpiec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiec.c,v 1.2 2006/06/30 04:03:13 jordan Exp $ */ +/* $OpenBSD: acpiec.c,v 1.3 2006/06/30 04:16:15 jordan Exp $ */ /* * Copyright (c) 2006 Can Erkin Acar * @@ -336,8 +336,10 @@ acpiec_attach(struct device *parent, struct device *self, void *aux) acpi_set_gpehandler(sc->sc_acpi, sc->sc_gpe, acpiec_gpehandler, sc, "acpiec"); +#if 0 /* Enable EC interrupt */ acpi_enable_gpe(sc->sc_acpi, sc->sc_acpi->sc_ec_gpemask); +#endif printf(": %s\n", sc->sc_devnode->parent->name); } @@ -358,10 +360,20 @@ acpiec_get_events(struct acpiec_softc *sc) } int -acpiec_gpehandler(struct acpi_softc *sc, int gpe, void *arg) +acpiec_gpehandler(struct acpi_softc *acpi_sc, int gpe, void *arg) { - dnprintf(10, "ACPIEC: got gpe\n"); - return (0); + struct acpiec_softc *sc = arg; + uint8_t mask; + + dnprintf(10, "ACPIEC: got gpe\n"); + printf("ACPIEC: got gpe: %x\n", gpe); + acpiec_intr(sc); + + /* 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); + return (0); } void diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index 3e4fd899f32..80ad71f64b8 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.25 2006/06/30 04:03:13 jordan Exp $ */ +/* $OpenBSD: acpivar.h,v 1.26 2006/06/30 04:16:15 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -218,6 +218,9 @@ int acpiec_intr(struct acpiec_softc *); void acpiec_read(struct acpiec_softc *, u_int8_t, int, u_int8_t *); void acpiec_write(struct acpiec_softc *, u_int8_t, int, u_int8_t *); void acpiec_handle_events(struct acpiec_softc *); + +int acpi_read_pmreg(struct acpi_softc *, int, int); +void acpi_write_pmreg(struct acpi_softc *, int, int, int); #endif #endif /* !_DEV_ACPI_ACPIVAR_H_ */ -- cgit v1.2.3