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 <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35006
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Rudolph 2019-08-20 08:20:01 +02:00 committed by Patrick Georgi
parent 3d0df83133
commit eeb8e74944
3 changed files with 21 additions and 0 deletions

View File

@ -81,6 +81,24 @@ const char *acpi_device_name(const struct device *dev)
return NULL; 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 */ /* 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, static ssize_t acpi_device_path_fill(const struct device *dev, char *buf,
size_t buf_len, size_t cur) size_t buf_len, size_t cur)

View File

@ -63,6 +63,7 @@ struct acpi_dp {
struct device; struct device;
const char *acpi_device_name(const struct device *dev); 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_path(const struct device *dev);
const char *acpi_device_scope(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); const char *acpi_device_path_join(const struct device *dev, const char *name);

View File

@ -62,6 +62,8 @@ struct device_operations {
void (*acpi_fill_ssdt_generator)(struct device *dev); void (*acpi_fill_ssdt_generator)(struct device *dev);
void (*acpi_inject_dsdt_generator)(struct device *dev); void (*acpi_inject_dsdt_generator)(struct device *dev);
const char *(*acpi_name)(const struct device *dev); const char *(*acpi_name)(const struct device *dev);
/* Returns the optional _HID (Hardware ID) */
const char *(*acpi_hid)(const struct device *dev);
#endif #endif
const struct pci_operations *ops_pci; const struct pci_operations *ops_pci;
const struct i2c_bus_operations *ops_i2c_bus; const struct i2c_bus_operations *ops_i2c_bus;