diff options
author | Furquan Shaikh <furquan@google.com> | 2020-07-08 16:54:40 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2020-07-10 16:00:20 +0000 |
commit | 0c707d4dbc0753b5e40559b8940c6cb2afd80e4d (patch) | |
tree | 425262673c7993034f76137bfc89ccb545646d93 /src | |
parent | cff479e930c20d56312c8f041d1e4f3318293b03 (diff) | |
download | coreboot-0c707d4dbc0753b5e40559b8940c6cb2afd80e4d.tar.xz |
soc/amd/picasso: Add PCI driver for data fabric devices
Data fabric devices are PCI devices which support PCI configuration
space but do not require any MMIO/IO resources. This change adds a PCI
driver for the data fabric devices which only provides device
operations for adding node to SSDT and returning the ACPI name for the
device.
Signed-off-by: Furquan Shaikh <furquan@google.com>
Change-Id: I3da9287db5febf1a1d7eb1dfbed9f1348f80a588
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43314
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-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, +}; |