diff options
-rw-r--r-- | src/soc/amd/picasso/Makefile.inc | 2 | ||||
-rw-r--r-- | src/soc/amd/picasso/data_fabric.c (renamed from src/soc/amd/picasso/data_fabric_util.c) | 52 |
2 files changed, 53 insertions, 1 deletions
diff --git a/src/soc/amd/picasso/Makefile.inc b/src/soc/amd/picasso/Makefile.inc index b6c0ddb915..d19402f79d 100644 --- a/src/soc/amd/picasso/Makefile.inc +++ b/src/soc/amd/picasso/Makefile.inc @@ -52,7 +52,7 @@ verstage_x86-y += reset.c ramstage-y += i2c.c ramstage-y += chip.c ramstage-y += cpu.c -ramstage-y += data_fabric_util.c +ramstage-y += data_fabric.c ramstage-y += root_complex.c ramstage-y += mca.c ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c diff --git a/src/soc/amd/picasso/data_fabric_util.c b/src/soc/amd/picasso/data_fabric.c index a375b84477..23cb94c837 100644 --- a/src/soc/amd/picasso/data_fabric_util.c +++ b/src/soc/amd/picasso/data_fabric.c @@ -1,7 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <acpi/acpi_device.h> #include <console/console.h> #include <cpu/x86/lapic_def.h> +#include <device/device.h> +#include <device/pci.h> +#include <device/pci_ids.h> #include <device/pci_ops.h> #include <soc/data_fabric.h> #include <soc/iomap.h> @@ -115,3 +119,51 @@ void data_fabric_set_mmio_np(void) (IOMS0_FABRIC_ID << MMIO_DST_FABRIC_ID_SHIFT) | MMIO_NP | MMIO_WE | MMIO_RE); } + +static const char *data_fabric_acpi_name(const struct device *dev) +{ + switch (dev->device) { + case PCI_DEVICE_ID_AMD_FAM17H_DF0: + return "DFD0"; + case PCI_DEVICE_ID_AMD_FAM17H_DF1: + return "DFD1"; + case PCI_DEVICE_ID_AMD_FAM17H_DF2: + return "DFD2"; + case PCI_DEVICE_ID_AMD_FAM17H_DF3: + return "DFD3"; + case PCI_DEVICE_ID_AMD_FAM17H_DF4: + return "DFD4"; + case PCI_DEVICE_ID_AMD_FAM17H_DF5: + return "DFD5"; + case PCI_DEVICE_ID_AMD_FAM17H_DF6: + return "DFD6"; + default: + printk(BIOS_ERR, "%s: Unhandled device id 0x%x\n", __func__, dev->device); + } + + return NULL; +} + +static struct device_operations 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, +}; + +static const unsigned short pci_device_ids[] = { + PCI_DEVICE_ID_AMD_FAM17H_DF0, + PCI_DEVICE_ID_AMD_FAM17H_DF1, + PCI_DEVICE_ID_AMD_FAM17H_DF2, + PCI_DEVICE_ID_AMD_FAM17H_DF3, + PCI_DEVICE_ID_AMD_FAM17H_DF4, + PCI_DEVICE_ID_AMD_FAM17H_DF5, + PCI_DEVICE_ID_AMD_FAM17H_DF6, + 0 +}; + +static const struct pci_driver data_fabric_driver __pci_driver = { + .ops = &data_fabric_ops, + .vendor = PCI_VENDOR_ID_AMD, + .devices = pci_device_ids, +}; |