diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2006-01-05 22:58:43 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2006-01-05 22:58:43 +0000 |
commit | 4462cf04475be7561faae0c4f4342d74e5322a7b (patch) | |
tree | 09181ccbdfb9b9ef60520ce2f327b86c2f81897f /sys/dev/acpi/acpi.c | |
parent | 4622d990fc75f94b0b2afec537ee2a43d4843914 (diff) |
Find SLP_TYPx values and store them for future use in
acpi_enter_sleep_state().
Diffstat (limited to 'sys/dev/acpi/acpi.c')
-rw-r--r-- | sys/dev/acpi/acpi.c | 24 |
1 files changed, 23 insertions, 1 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 |