diff options
-rw-r--r-- | sys/dev/acpi/acpi.c | 24 | ||||
-rw-r--r-- | sys/dev/acpi/acpivar.h | 7 |
2 files changed, 29 insertions, 2 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 4826f93af3a..b256993e6e8 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.15 2006/01/05 21:49:09 grange Exp $ */ +/* $OpenBSD: acpi.c,v 1.16 2006/01/05 22:58:42 grange Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -58,6 +58,7 @@ void acpi_load_table(paddr_t, size_t, acpi_qhead_t *); void acpi_load_dsdt(paddr_t, struct acpi_q **); void acpi_softintr(void *); +void acpi_init_states(struct acpi_softc *); void acpi_filtdetach(struct knote *); int acpi_filtread(struct knote *, long); @@ -440,6 +441,9 @@ acpi_attach(struct device *parent, struct device *self, void *aux) acpi_parse_aml(sc, p_dsdt->aml, p_dsdt->hdr_length - sizeof(p_dsdt->hdr)); + /* Find available sleeping states */ + acpi_init_states(sc); + /* * Set up a pointer to the firmware control structure */ @@ -794,6 +798,24 @@ acpi_softintr(void *arg) } void +acpi_init_states(struct acpi_softc *sc) +{ + struct aml_value res, env; + char name[8]; + int i; + + for (i = ACPI_STATE_S0; i <= ACPI_STATE_S5; i++) { + snprintf(name, sizeof(name), "_S%d_", i); + sc->sc_sleeptype[i].slp_typa = -1; + sc->sc_sleeptype[i].slp_typb = -1; + if (aml_eval_name(sc, aml_root.child, name, &res, &env)) + continue; + sc->sc_sleeptype[i].slp_typa = aml_intval(&res.v_package[0]); + sc->sc_sleeptype[i].slp_typb = aml_intval(&res.v_package[1]); + } +} + +void acpi_enter_sleep_state(struct acpi_softc *sc, int state) { #ifdef ACPI_ENABLE diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index 77cc08a83ed..ea8b0949ce9 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.9 2005/12/30 05:59:40 tedu Exp $ */ +/* $OpenBSD: acpivar.h,v 1.10 2006/01/05 22:58:42 grange Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -125,6 +125,11 @@ struct acpi_softc { int sc_sleepbtn; struct acpi_parsestate amlpc; + + struct { + int slp_typa; + int slp_typb; + } sc_sleeptype[5]; }; struct acpi_table { |