diff options
author | des <des@FreeBSD.org> | 2009-09-25 22:45:59 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2009-09-25 22:45:59 +0000 |
commit | bf5117185e83a178d672946c3f7053d0ef92be27 (patch) | |
tree | 394fcfe01b613c0b5b5edbfc414a17c73481ad5d /sys/dev/acpica/acpi.c | |
parent | b79ff8160af6fa640e29ce784e59acd49cd1e7fc (diff) | |
parent | 5c2742e3dae3ef549329b770ec44b16ca930dc1f (diff) | |
download | FreeBSD-src-bf5117185e83a178d672946c3f7053d0ef92be27.zip FreeBSD-src-bf5117185e83a178d672946c3f7053d0ef92be27.tar.gz |
Sync with head
Diffstat (limited to 'sys/dev/acpica/acpi.c')
-rw-r--r-- | sys/dev/acpica/acpi.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index d402274..b31f1e7 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -2244,6 +2244,28 @@ acpi_SetIntrModel(int model) } /* + * Walk subtables of a table and call a callback routine for each + * subtable. The caller should provide the first subtable and a + * pointer to the end of the table. This can be used to walk tables + * such as MADT and SRAT that use subtable entries. + */ +void +acpi_walk_subtables(void *first, void *end, acpi_subtable_handler *handler, + void *arg) +{ + ACPI_SUBTABLE_HEADER *entry; + + for (entry = first; (void *)entry < end; ) { + /* Avoid an infinite loop if we hit a bogus entry. */ + if (entry->Length < sizeof(ACPI_SUBTABLE_HEADER)) + return; + + handler(entry, arg); + entry = ACPI_ADD_PTR(ACPI_SUBTABLE_HEADER, entry, entry->Length); + } +} + +/* * DEPRECATED. This interface has serious deficiencies and will be * removed. * |