summaryrefslogtreecommitdiffstats
path: root/src/include/acpi/acpi_device.h
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2020-06-03 12:36:51 -0700
committerFurquan Shaikh <furquan@google.com>2020-06-04 20:07:41 +0000
commit84fac41d35b99f2dcb4e0d8c35588c1f1e917a3d (patch)
tree9a1d0bbfd0cac864305c4add51ee5aee4dde75a6 /src/include/acpi/acpi_device.h
parentfba0ad84d18d5509598b7f047a16d038e6cb8f42 (diff)
downloadcoreboot-84fac41d35b99f2dcb4e0d8c35588c1f1e917a3d.tar.gz
coreboot-84fac41d35b99f2dcb4e0d8c35588c1f1e917a3d.tar.bz2
coreboot-84fac41d35b99f2dcb4e0d8c35588c1f1e917a3d.zip
acpi: Accomodate non-standard UUIDs in device properties
There have been changes to the way device properties are supported in Linux[1] and Windows[2] which add flexibilty: - non-standard UUIDs can be used instead of only ACPI_DP_UUID - support for multiple different packages within the _DSD that associate different properties with unique UUIDs. To handle this I extracted the part that does the write of UUID and properties to a separate function and defined a new PACKAGE type which has the custom UUID as a name and can be used the same way that child properties are today. For example a PCIe root port for a USB4 port has a standard property indicating the USB4 reference, and then two custom properties which are defined for different attributes. Example code: /* Create property table */ acpi_dp *dsd = acpi_dp_new_table("_DSD"); acpi_dp_add_reference(dsd, "usb4-port", usb4_path); /* Add package for hotplug */ acpi_dp *pkg = acpi_dp_new_table("6211e2c0-58a3-4af3-90e1-927a4e0c55a4"); acpi_dp_add_integer(pkg, "HotPlugSupportInD3", 1); acpi_dp_add_package(dsd, pkg); /* Add package for external port info */ pkg = acpi_dp_new_table("efcc06cc-73ac-4bc3-bff0-76143807c389"); acpi_dp_add_integer(pkg, "ExternalFacingPort", 1); acpi_dp_add_package(dsd, pkg); /* Write all properties */ acpi_dp_write(dsd); Resulting ACPI: Scope (\_SB.PCI0.TRP0) { Name (_DSD, Package () { ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") Package () { Package () { "usb4-port", \_SB.PCI0.TDM0.RHUB.PRTA } }, ToUUID ("6211e2c0-58a3-4af3-90e1-927a4e0c55a4"), Package () { Package () { "HotPlugSupportInD3", One } }, ToUUID ("efcc06cc-73ac-4bc3-bff0-76143807c389"), Package () { Package () { "ExternalFacingPort", One }, } }) } [1] https://patchwork.kernel.org/patch/10599675/ [2] https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports Change-Id: I75f47825bf4ffc5e9e92af2c45790d1b5945576e Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42047 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/include/acpi/acpi_device.h')
-rw-r--r--src/include/acpi/acpi_device.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/include/acpi/acpi_device.h b/src/include/acpi/acpi_device.h
index 20dd8a4080e5..2c2c67a11932 100644
--- a/src/include/acpi/acpi_device.h
+++ b/src/include/acpi/acpi_device.h
@@ -15,11 +15,13 @@ enum acpi_dp_type {
ACPI_DP_TYPE_TABLE,
ACPI_DP_TYPE_ARRAY,
ACPI_DP_TYPE_CHILD,
+ ACPI_DP_TYPE_PACKAGE,
};
struct acpi_dp {
enum acpi_dp_type type;
const char *name;
+ const char *uuid;
struct acpi_dp *next;
union {
struct acpi_dp *child;
@@ -464,6 +466,9 @@ void acpi_device_add_power_res(const struct acpi_power_res_params *params);
/* Start a new Device Property table with provided ACPI reference */
struct acpi_dp *acpi_dp_new_table(const char *ref);
+/* Add package of device properties with a unique UUID */
+struct acpi_dp *acpi_dp_add_package(struct acpi_dp *dp, struct acpi_dp *package);
+
/* Add integer Device Property */
struct acpi_dp *acpi_dp_add_integer(struct acpi_dp *dp, const char *name,
uint64_t value);