diff options
author | Kapil Porwal <kapilporwal@google.com> | 2022-11-26 19:10:57 +0530 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2022-11-29 19:48:27 +0000 |
commit | ddc52a6481f2529c6f7a676f20f9f35853aac48b (patch) | |
tree | b3f56839c629e803ece641449d78d2a9c5b3c831 /src | |
parent | 3fd1174e768b440640f0f1b398bbb85ab6d926e1 (diff) |
acpi: Create a common method to add DmaProperty
Create a common method to add DmaProperty.
BUG=b:259716145
TEST=Verified SSDT on google/osiris.
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Change-Id: I75b3f22ad29f90f3c3b251bd0d70bae9d75f71fe
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70022
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/acpi/device.c | 16 | ||||
-rw-r--r-- | src/include/acpi/acpi_device.h | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/acpi/device.c b/src/acpi/device.c index 2b085b61a6..b732b8f36a 100644 --- a/src/acpi/device.c +++ b/src/acpi/device.c @@ -1183,3 +1183,19 @@ void acpi_device_write_pci_dev(const struct device *dev) acpigen_pop_len(); /* Device */ acpigen_pop_len(); /* Scope */ } + +/* ID for the DmaProperty _DSD */ +#define ACPI_DSD_DMA_PROPERTY_UUID "70D24161-6DD5-4C9E-8070-705531292865" + +/* _DSD with DmaProperty */ +void acpi_device_add_dma_property(struct acpi_dp *dsd) +{ + struct acpi_dp *prev_dsd = dsd, *pkg; + if (prev_dsd == NULL) + dsd = acpi_dp_new_table("_DSD"); + pkg = acpi_dp_new_table(ACPI_DSD_DMA_PROPERTY_UUID); + acpi_dp_add_integer(pkg, "DmaProperty", 1); + acpi_dp_add_package(dsd, pkg); + if (prev_dsd == NULL) + acpi_dp_write(dsd); +} diff --git a/src/include/acpi/acpi_device.h b/src/include/acpi/acpi_device.h index 71809eb6d4..1493cb4cc9 100644 --- a/src/include/acpi/acpi_device.h +++ b/src/include/acpi/acpi_device.h @@ -588,4 +588,13 @@ void acpi_dp_write(struct acpi_dp *table); */ void acpi_device_write_pci_dev(const struct device *dev); +/* + * Helper function to add DmaProperty to _DSD in the current scope. + * + * dsd - Pointer to a _DSD object. + * Append to existing _DSD object if not NULL. + * Create new _DSD object and flush it if NULL. + */ +void acpi_device_add_dma_property(struct acpi_dp *dsd); + #endif /* __ACPI_ACPI_DEVICE_H__ */ |