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>
This commit is contained in:
Furquan Shaikh 2020-07-08 16:54:40 -07:00 committed by Aaron Durbin
parent cff479e930
commit 0c707d4dbc
2 changed files with 53 additions and 1 deletions

View File

@ -52,7 +52,7 @@ verstage_x86-y += reset.c
ramstage-y += i2c.c ramstage-y += i2c.c
ramstage-y += chip.c ramstage-y += chip.c
ramstage-y += cpu.c ramstage-y += cpu.c
ramstage-y += data_fabric_util.c ramstage-y += data_fabric.c
ramstage-y += root_complex.c ramstage-y += root_complex.c
ramstage-y += mca.c ramstage-y += mca.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c

View File

@ -1,7 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi_device.h>
#include <console/console.h> #include <console/console.h>
#include <cpu/x86/lapic_def.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 <device/pci_ops.h>
#include <soc/data_fabric.h> #include <soc/data_fabric.h>
#include <soc/iomap.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 (IOMS0_FABRIC_ID << MMIO_DST_FABRIC_ID_SHIFT) | MMIO_NP | MMIO_WE
| MMIO_RE); | 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,
};