diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/acpi/acpidev.h | 5 | ||||
-rw-r--r-- | sys/dev/acpi/acpidock.c | 40 |
2 files changed, 43 insertions, 2 deletions
diff --git a/sys/dev/acpi/acpidev.h b/sys/dev/acpi/acpidev.h index 0193bf8c03c..5f91459af96 100644 --- a/sys/dev/acpi/acpidev.h +++ b/sys/dev/acpi/acpidev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpidev.h,v 1.21 2007/03/22 16:55:31 deraadt Exp $ */ +/* $OpenBSD: acpidev.h,v 1.22 2007/04/22 20:52:27 mk Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> @@ -294,6 +294,9 @@ struct acpidock_softc { struct acpi_softc *sc_acpi; struct aml_node *sc_devnode; + TAILQ_HEAD(, aml_nodelist) sc_deps_h; + struct aml_nodelist *sc_deps; + struct ksensor sc_sens[1]; struct ksensordev sc_sensdev; diff --git a/sys/dev/acpi/acpidock.c b/sys/dev/acpi/acpidock.c index 697ad81cfd3..d6783caa8a6 100644 --- a/sys/dev/acpi/acpidock.c +++ b/sys/dev/acpi/acpidock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpidock.c,v 1.20 2007/04/17 16:04:00 mk Exp $ */ +/* $OpenBSD: acpidock.c,v 1.21 2007/04/22 20:52:27 mk Exp $ */ /* * Copyright (c) 2006,2007 Michael Knudsen <mk@openbsd.org> * @@ -29,6 +29,11 @@ #include <dev/acpi/amltypes.h> #include <dev/acpi/dsdt.h> +struct aml_nodelist { + struct aml_node *node; + TAILQ_ENTRY(aml_nodelist) entries; +}; + int acpidock_match(struct device *, void *, void *); void acpidock_attach(struct device *, struct device *, void *); @@ -47,6 +52,8 @@ int acpidock_eject(struct acpidock_softc *, struct aml_node *); int acpidock_notify(struct aml_node *, int, void *); int acpidock_status(struct acpidock_softc *); +void acpidock_foundejd(struct aml_node *, void *); + int acpidock_match(struct device *parent, void *match, void *aux) { @@ -67,6 +74,7 @@ acpidock_attach(struct device *parent, struct device *self, void *aux) { struct acpidock_softc *sc = (struct acpidock_softc *)self; struct acpi_attach_args *aa = aux; + extern struct aml_node aml_root; sc->sc_acpi = (struct acpi_softc *)parent; sc->sc_devnode = aa->aaa_node->child; @@ -101,6 +109,9 @@ acpidock_attach(struct device *parent, struct device *self, void *aux) sensor_attach(&sc->sc_sensdev, &sc->sc_sens[0]); sensordev_install(&sc->sc_sensdev); + TAILQ_INIT(&sc->sc_deps_h); + aml_find_node(aml_root.child, "_EJD", acpidock_foundejd, sc); + aml_register_notify(sc->sc_devnode->parent, aa->aaa_dev, acpidock_notify, sc, ACPIDEV_NOPOLL); @@ -251,3 +262,30 @@ acpidock_notify(struct aml_node *node, int notify_type, void *arg) return (0); } +void +acpidock_foundejd(struct aml_node *node, void *arg) +{ + struct acpidock_softc *sc = (struct acpidock_softc *)arg; + struct aml_value res; + + dnprintf(15, "%s: %s", DEVNAME(sc), node->parent->name); + + if (aml_evalnode(sc->sc_acpi, node, 0, NULL, &res) == -1) { + printf(": error\n"); + } else { + struct aml_nodelist *n; + + /* XXX debug */ + dnprintf(10, "%s: %s depends on %s\n", DEVNAME(sc), + node->parent->name, res.v_string); + + /* XXX more than one dock? */ + + n = malloc(sizeof(struct aml_nodelist), M_DEVBUF, M_WAITOK); + n->node = node; + + TAILQ_INSERT_TAIL(&sc->sc_deps_h, n, entries); + } + + aml_freevalue(&res); +} |