summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2009-09-04 22:50:12 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2009-09-04 22:50:12 +0000
commitfc28b8935aa496ce905d6b41cd4f1e1f5fd33064 (patch)
tree163899a12c5cf68eee0f7ae2557b33f61fc94ad8 /sys/dev
parent0dbf04da90af2e82aba43252aa4674fea37504bf (diff)
Add common framework for storing device lists
Useful for acpitz, acpipwrres, etc.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpivar.h9
-rw-r--r--sys/dev/acpi/dsdt.c32
-rw-r--r--sys/dev/acpi/dsdt.h6
3 files changed, 44 insertions, 3 deletions
diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h
index 53913740ab4..52a9484b355 100644
--- a/sys/dev/acpi/acpivar.h
+++ b/sys/dev/acpi/acpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpivar.h,v 1.48 2009/06/03 00:36:59 pirofti Exp $ */
+/* $OpenBSD: acpivar.h,v 1.49 2009/09/04 22:50:11 jordan Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -149,6 +149,13 @@ struct gpe_block {
int active;
};
+struct acpi_devlist {
+ struct aml_node *dev_node;
+ TAILQ_ENTRY(acpi_devlist) dev_link;
+};
+
+TAILQ_HEAD(acpi_devlist_head, acpi_devlist);
+
struct acpi_ac {
struct acpiac_softc *aac_softc;
SLIST_ENTRY(acpi_ac) aac_link;
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index bbd6a113360..24dce05d7c0 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.153 2009/07/20 05:13:30 jordan Exp $ */
+/* $OpenBSD: dsdt.c,v 1.154 2009/09/04 22:50:11 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -4202,3 +4202,33 @@ aml_searchrel(struct aml_node *root, const void *vname)
}
return NULL;
}
+
+void acpi_getdevlist(struct acpi_devlist_head *list, struct aml_node *root,
+ struct aml_value *pkg, int off)
+{
+ struct acpi_devlist *dl;
+ struct aml_node *node;
+ int idx;
+
+ for (idx=off; idx<pkg->length; idx++) {
+ node = aml_searchname(root, pkg->v_package[idx]->v_string);
+ if (node) {
+ dl = acpi_os_malloc(sizeof(*dl));
+ if (dl) {
+ dl->dev_node = node;
+ TAILQ_INSERT_TAIL(list, dl, dev_link);
+ }
+ }
+ }
+}
+
+void
+acpi_freedevlist(struct acpi_devlist_head *list)
+{
+ struct acpi_devlist *dl;
+
+ while ((dl = TAILQ_FIRST(list)) != NULL) {
+ TAILQ_REMOVE(list, dl, dev_link);
+ acpi_os_free(dl);
+ }
+}
diff --git a/sys/dev/acpi/dsdt.h b/sys/dev/acpi/dsdt.h
index 2367c464d37..44425bb01ac 100644
--- a/sys/dev/acpi/dsdt.h
+++ b/sys/dev/acpi/dsdt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.h,v 1.45 2009/08/21 22:05:01 jordan Exp $ */
+/* $OpenBSD: dsdt.h,v 1.46 2009/09/04 22:50:11 jordan Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -269,4 +269,8 @@ union amlpci_t
};
int aml_rdpciaddr(struct aml_node *pcidev, union amlpci_t *);
+void acpi_getdevlist(struct acpi_devlist_head *, struct aml_node *,
+ struct aml_value *, int);
+void acpi_freedevlist(struct acpi_devlist_head *);
+
#endif /* __DEV_ACPI_DSDT_H__ */