diff options
author | Fred Reitberger <reitbergerfred@gmail.com> | 2022-11-03 14:48:28 -0400 |
---|---|---|
committer | Fred Reitberger <reitbergerfred@gmail.com> | 2022-11-04 20:37:50 +0000 |
commit | 63c5a0d5160ad9cb75da99f9521591f5d376e314 (patch) | |
tree | 34585df870a31e93253713709f439fd3fdad6d49 /src/soc | |
parent | f72c090b7f0df83e73711565b9d966aaf83e1b56 (diff) |
soc/amd/mendocino/data_fabric.c: Make function more generic
Make the data_fabric_acpi_name function more generic, in preparation to
move it to common.
TEST=build chausie, dump ACPI tables, and inspect DFD0 to DFD7
Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com>
Change-Id: I77140d8d0d6bf3e048b737de03d18142a6e23c1d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69172
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/amd/mendocino/data_fabric.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/src/soc/amd/mendocino/data_fabric.c b/src/soc/amd/mendocino/data_fabric.c index 2569da8c67..e0942f2ab8 100644 --- a/src/soc/amd/mendocino/data_fabric.c +++ b/src/soc/amd/mendocino/data_fabric.c @@ -4,31 +4,26 @@ #include <console/console.h> #include <device/device.h> #include <device/pci.h> -#include <device/pci_ids.h> +#include <soc/pci_devs.h> static const char *data_fabric_acpi_name(const struct device *dev) { - switch (dev->device) { - case PCI_DID_AMD_FAM17H_MODELA0H_DF0: - return "DFD0"; - case PCI_DID_AMD_FAM17H_MODELA0H_DF1: - return "DFD1"; - case PCI_DID_AMD_FAM17H_MODELA0H_DF2: - return "DFD2"; - case PCI_DID_AMD_FAM17H_MODELA0H_DF3: - return "DFD3"; - case PCI_DID_AMD_FAM17H_MODELA0H_DF4: - return "DFD4"; - case PCI_DID_AMD_FAM17H_MODELA0H_DF5: - return "DFD5"; - case PCI_DID_AMD_FAM17H_MODELA0H_DF6: - return "DFD6"; - case PCI_DID_AMD_FAM17H_MODELA0H_DF7: - return "DFD7"; - default: - printk(BIOS_ERR, "%s: Unhandled device id 0x%x\n", __func__, dev->device); - } + 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; } |