diff options
author | njl <njl@FreeBSD.org> | 2004-06-13 17:29:35 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2004-06-13 17:29:35 +0000 |
commit | 7e9a9e6ebc036a4e156d11dc9845613b90b31bb8 (patch) | |
tree | e5db236c19f66c3731822da55f8a7a6fa3283d38 /sys/dev/acpica | |
parent | 977d97b004a1ae5bbd9d42eae28386f8e2372068 (diff) | |
download | FreeBSD-src-7e9a9e6ebc036a4e156d11dc9845613b90b31bb8.zip FreeBSD-src-7e9a9e6ebc036a4e156d11dc9845613b90b31bb8.tar.gz |
Associate a device_t with an ACPI_HANDLE. This make AcpiWalkNamespace more
useful. If ACPI-CA allowed null object handlers, we wouldn't need the
placeholder function.
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r-- | sys/dev/acpica/acpi.c | 12 | ||||
-rw-r--r-- | sys/dev/acpica/acpivar.h | 9 |
2 files changed, 21 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 2bfc27c..4f88cd5 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1125,7 +1125,10 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status) child = BUS_ADD_CHILD(bus, level * 10, NULL, -1); if (child == NULL) break; + + /* Associate the handle with the device_t and vice versa. */ acpi_set_handle(child, handle); + AcpiAttachData(handle, acpi_fake_objhandler, child); /* Check if the device can generate wake events. */ if (ACPI_SUCCESS(AcpiEvaluateObject(handle, "_PRW", NULL, NULL))) @@ -1159,6 +1162,15 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status) return_ACPI_STATUS (AE_OK); } +/* + * AcpiAttachData() requires an object handler but never uses it. This is a + * placeholder object handler so we can store a device_t in an ACPI_HANDLE. + */ +void +acpi_fake_objhandler(ACPI_HANDLE h, UINT32 fn, void *data) +{ +} + static void acpi_shutdown_pre_sync(void *arg, int howto) { diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 9120216..69b84af 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -174,6 +174,15 @@ __ACPI_BUS_ACCESSOR(acpi, handle, ACPI, HANDLE, ACPI_HANDLE) __ACPI_BUS_ACCESSOR(acpi, magic, ACPI, MAGIC, int) __ACPI_BUS_ACCESSOR(acpi, private, ACPI, PRIVATE, void *) +void acpi_fake_objhandler(ACPI_HANDLE h, UINT32 fn, void *data); +static __inline device_t +acpi_get_device(ACPI_HANDLE handle) +{ + void *dev = NULL; + AcpiGetData(handle, acpi_fake_objhandler, &dev); + return ((device_t)dev); +} + static __inline ACPI_OBJECT_TYPE acpi_get_type(device_t dev) { |