summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/acpi/Makefile.inc1
-rw-r--r--src/acpi/acpigen.c19
-rw-r--r--src/acpi/acpigen_pci.c26
-rw-r--r--src/acpi/device.c1
-rw-r--r--src/drivers/intel/dptf/dptf.c1
-rw-r--r--src/drivers/intel/mipi_camera/camera.c1
-rw-r--r--src/drivers/usb/pci_xhci/pci_xhci.c1
-rw-r--r--src/drivers/wifi/generic/acpi.c1
-rw-r--r--src/include/acpi/acpigen.h2
-rw-r--r--src/include/acpi/acpigen_pci.h13
-rw-r--r--src/soc/amd/picasso/pcie_gpp.c1
11 files changed, 46 insertions, 21 deletions
diff --git a/src/acpi/Makefile.inc b/src/acpi/Makefile.inc
index 86f29e4681..b8e44221af 100644
--- a/src/acpi/Makefile.inc
+++ b/src/acpi/Makefile.inc
@@ -6,6 +6,7 @@ ramstage-y += acpi.c
ramstage-y += acpigen.c
ramstage-y += acpigen_dptf.c
ramstage-y += acpigen_dsm.c
+ramstage-$(CONFIG_PCI) += acpigen_pci.c
ramstage-y += acpigen_ps2_keybd.c
ramstage-y += acpigen_usb.c
ramstage-y += device.c
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c
index 4d9395fab7..b3e112d800 100644
--- a/src/acpi/acpigen.c
+++ b/src/acpi/acpigen.c
@@ -18,8 +18,6 @@
#include <assert.h>
#include <console/console.h>
#include <device/device.h>
-#include <device/pci_def.h>
-#include <device/pci_type.h>
#include <device/soundwire.h>
#include <types.h>
@@ -2033,23 +2031,6 @@ void acpigen_write_ADR(uint64_t adr)
acpigen_write_name_qword("_ADR", adr);
}
-void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn)
-{
- /*
- * _ADR for PCI Bus is encoded as follows:
- * [63:32] - unused
- * [31:16] - device #
- * [15:0] - function #
- */
- acpigen_write_ADR(PCI_SLOT(devfn) << 16 | PCI_FUNC(devfn));
-}
-
-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);
-}
-
/**
* acpigen_write_ADR_soundwire_device() - SoundWire ACPI Device Address Encoding.
* @address: SoundWire device address properties.
diff --git a/src/acpi/acpigen_pci.c b/src/acpi/acpigen_pci.c
new file mode 100644
index 0000000000..66f8dcd1bd
--- /dev/null
+++ b/src/acpi/acpigen_pci.c
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
+#include <assert.h>
+#include <device/device.h>
+#include <device/pci_def.h>
+#include <device/pci_type.h>
+#include <types.h>
+
+void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn)
+{
+ /*
+ * _ADR for PCI Bus is encoded as follows:
+ * [63:32] - unused
+ * [31:16] - device #
+ * [15:0] - function #
+ */
+ acpigen_write_ADR(PCI_SLOT(devfn) << 16 | PCI_FUNC(devfn));
+}
+
+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);
+}
diff --git a/src/acpi/device.c b/src/acpi/device.c
index 5de31b7776..5d4d9be4ce 100644
--- a/src/acpi/device.c
+++ b/src/acpi/device.c
@@ -5,6 +5,7 @@
#include <acpi/acpi.h>
#include <acpi/acpi_device.h>
#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
#include <device/device.h>
#include <device/path.h>
#include <stdlib.h>
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c
index 0f1cc9c400..1713e72309 100644
--- a/src/drivers/intel/dptf/dptf.c
+++ b/src/drivers/intel/dptf/dptf.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
#include <console/console.h>
#include <device/device.h>
#include "chip.h"
diff --git a/src/drivers/intel/mipi_camera/camera.c b/src/drivers/intel/mipi_camera/camera.c
index 7dfd6502f5..65eba16cdc 100644
--- a/src/drivers/intel/mipi_camera/camera.c
+++ b/src/drivers/intel/mipi_camera/camera.c
@@ -4,6 +4,7 @@
#include <acpi/acpi.h>
#include <acpi/acpi_device.h>
#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
#include <console/console.h>
#include <device/i2c_simple.h>
#include <device/device.h>
diff --git a/src/drivers/usb/pci_xhci/pci_xhci.c b/src/drivers/usb/pci_xhci/pci_xhci.c
index 6a56ca2293..821cb5f758 100644
--- a/src/drivers/usb/pci_xhci/pci_xhci.c
+++ b/src/drivers/usb/pci_xhci/pci_xhci.c
@@ -2,6 +2,7 @@
#include "pci_xhci.h"
#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
#include <console/console.h>
#include <device/pci.h>
#include <device/pci_ids.h>
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c
index 4440b81b5b..3e3b5c1d8e 100644
--- a/src/drivers/wifi/generic/acpi.c
+++ b/src/drivers/wifi/generic/acpi.c
@@ -2,6 +2,7 @@
#include <acpi/acpi_device.h>
#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
#include <console/console.h>
#include <device/pci_ids.h>
#include <sar.h>
diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h
index 7b1141c908..f7974ebc55 100644
--- a/src/include/acpi/acpigen.h
+++ b/src/include/acpi/acpigen.h
@@ -394,8 +394,6 @@ void acpigen_write_return_byte(uint8_t arg);
void acpigen_write_upc(enum acpi_upc_type type);
void acpigen_write_pld(const struct acpi_pld *pld);
void acpigen_write_ADR(uint64_t adr);
-void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn);
-void acpigen_write_ADR_pci_device(const struct device *dev);
struct soundwire_address;
void acpigen_write_ADR_soundwire_device(const struct soundwire_address *address);
void acpigen_write_create_byte_field(uint8_t op, size_t byte_offset, const char *name);
diff --git a/src/include/acpi/acpigen_pci.h b/src/include/acpi/acpigen_pci.h
new file mode 100644
index 0000000000..f05057530c
--- /dev/null
+++ b/src/include/acpi/acpigen_pci.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ACPIGEN_PCI_H
+#define ACPIGEN_PCI_H
+
+#include <device/device.h>
+#include <device/pci_def.h>
+#include <device/pci_type.h>
+
+void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn);
+void acpigen_write_ADR_pci_device(const struct device *dev);
+
+#endif /* ACPIGEN_PCI_H */
diff --git a/src/soc/amd/picasso/pcie_gpp.c b/src/soc/amd/picasso/pcie_gpp.c
index 00b32a0914..baa9fa3d29 100644
--- a/src/soc/amd/picasso/pcie_gpp.c
+++ b/src/soc/amd/picasso/pcie_gpp.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
#include <arch/ioapic.h>
#include <assert.h>
#include <amdblocks/amd_pci_util.h>