summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFred Reitberger <reitbergerfred@gmail.com>2022-11-03 15:19:51 -0400
committerFred Reitberger <reitbergerfred@gmail.com>2022-11-04 20:38:55 +0000
commit1a9ac347212f2fd0bbd80a3449ef486e3d643b64 (patch)
treee9836abdf406039f09b857588291f106898d2dc1 /src
parent63c5a0d5160ad9cb75da99f9521591f5d376e314 (diff)
downloadcoreboot-1a9ac347212f2fd0bbd80a3449ef486e3d643b64.tar.gz
coreboot-1a9ac347212f2fd0bbd80a3449ef486e3d643b64.tar.bz2
coreboot-1a9ac347212f2fd0bbd80a3449ef486e3d643b64.zip
soc/amd/common/data_fabric: Make common device ops
Add the generic data_fabric_acpi_name function and device ops to common code. Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com> Change-Id: I12053389a12081ddd81912a647bb532b31062093 Reviewed-on: https://review.coreboot.org/c/coreboot/+/69173 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/block/data_fabric/data_fabric_helper.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/data_fabric/data_fabric_helper.c b/src/soc/amd/common/block/data_fabric/data_fabric_helper.c
index 181c71e57fe4..412daaee6436 100644
--- a/src/soc/amd/common/block/data_fabric/data_fabric_helper.c
+++ b/src/soc/amd/common/block/data_fabric/data_fabric_helper.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <acpi/acpi_device.h>
#include <amdblocks/data_fabric.h>
#include <amdblocks/pci_devs.h>
#include <arch/hpet.h>
@@ -169,3 +170,31 @@ void data_fabric_set_mmio_np(void)
data_fabric_print_mmio_conf();
}
+
+static const char *data_fabric_acpi_name(const struct device *dev)
+{
+ const char *df_acpi_names[8] = {
+ "DFD0",
+ "DFD1",
+ "DFD2",
+ "DFD3",
+ "DFD4",
+ "DFD5",
+ "DFD6",
+ "DFD7"
+ };
+
+ if (dev->path.type == DEVICE_PATH_PCI &&
+ PCI_SLOT(dev->path.pci.devfn) == DF_DEV)
+ return df_acpi_names[PCI_FUNC(dev->path.pci.devfn)];
+
+ printk(BIOS_ERR, "%s: Unhandled device id 0x%x\n", __func__, dev->device);
+ return NULL;
+}
+
+struct device_operations amd_data_fabric_ops = {
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
+ .acpi_name = data_fabric_acpi_name,
+ .acpi_fill_ssdt = acpi_device_write_pci_dev,
+};