summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/acpi/acpigen_pci.c31
-rw-r--r--src/include/acpi/acpigen_pci.h4
2 files changed, 35 insertions, 0 deletions
diff --git a/src/acpi/acpigen_pci.c b/src/acpi/acpigen_pci.c
index 66f8dcd1bd..3edf0d0342 100644
--- a/src/acpi/acpigen_pci.c
+++ b/src/acpi/acpigen_pci.c
@@ -24,3 +24,34 @@ void acpigen_write_ADR_pci_device(const struct device *dev)
assert(dev->path.type == DEVICE_PATH_PCI);
acpigen_write_ADR_pci_devfn(dev->path.pci.devfn);
}
+
+void acpigen_write_PRT_GSI_entry(unsigned int pci_dev, unsigned int acpi_pin, unsigned int gsi)
+{
+ acpigen_write_package(4);
+ acpigen_write_dword((pci_dev << 16) | 0xffff);
+ acpigen_write_byte(acpi_pin);
+
+ /* Source */
+ acpigen_write_byte(0);
+
+ /* Source Index */
+ acpigen_write_dword(gsi);
+
+ acpigen_pop_len(); /* Package */
+}
+
+void acpigen_write_PRT_source_entry(unsigned int pci_dev, unsigned int acpi_pin,
+ const char *source_path, unsigned int index)
+{
+ acpigen_write_package(4);
+ acpigen_write_dword((pci_dev << 16) | 0xffff);
+ acpigen_write_byte(acpi_pin);
+
+ /* Source */
+ acpigen_emit_namestring(source_path);
+
+ /* Source Index */
+ acpigen_write_dword(index);
+
+ acpigen_pop_len(); /* Package */
+}
diff --git a/src/include/acpi/acpigen_pci.h b/src/include/acpi/acpigen_pci.h
index f05057530c..8a96eb3d25 100644
--- a/src/include/acpi/acpigen_pci.h
+++ b/src/include/acpi/acpigen_pci.h
@@ -10,4 +10,8 @@
void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn);
void acpigen_write_ADR_pci_device(const struct device *dev);
+void acpigen_write_PRT_GSI_entry(unsigned int pci_dev, unsigned int acpi_pin, unsigned int gsi);
+void acpigen_write_PRT_source_entry(unsigned int pci_dev, unsigned int acpi_pin,
+ const char *source_path, unsigned int index);
+
#endif /* ACPIGEN_PCI_H */