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>
This commit is contained in:
parent
fba0ad84d1
commit
84fac41d35
2 changed files with 76 additions and 30 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue