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>
This commit is contained in:
Fred Reitberger
2022-11-03 14:48:28 -04:00
parent f72c090b7f
commit 63c5a0d516

View File

@@ -4,31 +4,26 @@
#include <console/console.h> #include <console/console.h>
#include <device/device.h> #include <device/device.h>
#include <device/pci.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) static const char *data_fabric_acpi_name(const struct device *dev)
{ {
switch (dev->device) { const char *df_acpi_names[8] = {
case PCI_DID_AMD_FAM17H_MODELA0H_DF0: "DFD0",
return "DFD0"; "DFD1",
case PCI_DID_AMD_FAM17H_MODELA0H_DF1: "DFD2",
return "DFD1"; "DFD3",
case PCI_DID_AMD_FAM17H_MODELA0H_DF2: "DFD4",
return "DFD2"; "DFD5",
case PCI_DID_AMD_FAM17H_MODELA0H_DF3: "DFD6",
return "DFD3"; "DFD7"
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);
}
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; return NULL;
} }