summaryrefslogtreecommitdiff
path: root/src/acpi
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2021-02-25 13:14:49 -0700
committerPatrick Georgi <pgeorgi@google.com>2021-03-01 08:26:23 +0000
commitd40a4c2bb4d237c174ef11ad73afc5a67ed555e7 (patch)
treedccf1a43deddc32ece6f1c9db63acd3a136a26e3 /src/acpi
parent740cd31858275b25fb7d0d224720739967f4e06e (diff)
downloadcoreboot-d40a4c2bb4d237c174ef11ad73afc5a67ed555e7.tar.xz
acpi: Move PCI functions to separate file
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Change-Id: Idc96b99da9f9037267c0bec2c839014b13ceb8cc Reviewed-on: https://review.coreboot.org/c/coreboot/+/51106 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Lance Zhao Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/acpi')
-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
4 files changed, 28 insertions, 19 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>