From eeb8e74944488ffbb7aa9a16fb28cc84beb6c353 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 20 Aug 2019 08:20:01 +0200 Subject: arch/x86/acpi: Add acpi_device_hid Allow a driver to return device specific _HID, which will be consumed by acpigen in order to generate proper SSDTs. Change-Id: Ibb79eb00c008a3c3cdc12ad2a48b88a055a9216f Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/35006 Reviewed-by: Philipp Deppenwiese Tested-by: build bot (Jenkins) --- src/arch/x86/acpi_device.c | 18 ++++++++++++++++++ src/arch/x86/include/arch/acpi_device.h | 1 + 2 files changed, 19 insertions(+) (limited to 'src/arch') diff --git a/src/arch/x86/acpi_device.c b/src/arch/x86/acpi_device.c index 47bcc52c1e..57f06498c8 100644 --- a/src/arch/x86/acpi_device.c +++ b/src/arch/x86/acpi_device.c @@ -81,6 +81,24 @@ const char *acpi_device_name(const struct device *dev) return NULL; } +/* Locate and return the ACPI _HID (Hardware ID) for this device */ +const char *acpi_device_hid(const struct device *dev) +{ + if (!dev) + return NULL; + + /* Check for device specific handler */ + if (dev->ops->acpi_hid) + return dev->ops->acpi_hid(dev); + + /* + * Don't walk up the tree to find any parent that can identify this device, as + * PNP devices are hard to identify. + */ + + return NULL; +} + /* Recursive function to find the root device and print a path from there */ static ssize_t acpi_device_path_fill(const struct device *dev, char *buf, size_t buf_len, size_t cur) diff --git a/src/arch/x86/include/arch/acpi_device.h b/src/arch/x86/include/arch/acpi_device.h index d74af9da74..4990df091a 100644 --- a/src/arch/x86/include/arch/acpi_device.h +++ b/src/arch/x86/include/arch/acpi_device.h @@ -63,6 +63,7 @@ struct acpi_dp { struct device; const char *acpi_device_name(const struct device *dev); +const char *acpi_device_hid(const struct device *dev); const char *acpi_device_path(const struct device *dev); const char *acpi_device_scope(const struct device *dev); const char *acpi_device_path_join(const struct device *dev, const char *name); -- cgit v1.2.3