soc/amd/*/data_fabric: Use common device ops

Use the common device ops instead of an soc-specific device ops.

TEST=builds for each soc

Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com>
Change-Id: I1804200c3c3f5ab492d237f4b03484c383862caf
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69174
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 15:26:47 -04:00
parent 1a9ac34721
commit aab7f04904
16 changed files with 48 additions and 260 deletions

View File

@ -31,7 +31,6 @@ ramstage-y += acpi.c
ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += data_fabric.c
ramstage-y += fch.c
ramstage-y += fsp_s_params.c
ramstage-y += gpio.c

View File

@ -97,14 +97,14 @@ chip soc/amd/cezanne
device pci 14.0 alias smbus on ops amd_smbus_ops end # primary FCH function
device pci 14.3 alias lpc_bridge on ops amd_lpc_ops end
device pci 18.0 alias data_fabric_0 on ops cezanne_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops cezanne_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops cezanne_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops cezanne_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops cezanne_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops cezanne_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops cezanne_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops cezanne_data_fabric_ops end
device pci 18.0 alias data_fabric_0 on ops amd_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops amd_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops amd_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops amd_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops amd_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops amd_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops amd_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops amd_data_fabric_ops end
end
device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end

View File

@ -1,48 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi_device.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
static const char *data_fabric_acpi_name(const struct device *dev)
{
switch (dev->device) {
case PCI_DID_AMD_FAM17H_MODEL60H_DF0:
case PCI_DID_AMD_FAM19H_MODEL51H_DF0:
return "DFD0";
case PCI_DID_AMD_FAM17H_MODEL60H_DF1:
case PCI_DID_AMD_FAM19H_MODEL51H_DF1:
return "DFD1";
case PCI_DID_AMD_FAM17H_MODEL60H_DF2:
case PCI_DID_AMD_FAM19H_MODEL51H_DF2:
return "DFD2";
case PCI_DID_AMD_FAM17H_MODEL60H_DF3:
case PCI_DID_AMD_FAM19H_MODEL51H_DF3:
return "DFD3";
case PCI_DID_AMD_FAM17H_MODEL60H_DF4:
case PCI_DID_AMD_FAM19H_MODEL51H_DF4:
return "DFD4";
case PCI_DID_AMD_FAM17H_MODEL60H_DF5:
case PCI_DID_AMD_FAM19H_MODEL51H_DF5:
return "DFD5";
case PCI_DID_AMD_FAM17H_MODEL60H_DF6:
case PCI_DID_AMD_FAM19H_MODEL51H_DF6:
return "DFD6";
case PCI_DID_AMD_FAM17H_MODEL60H_DF7:
case PCI_DID_AMD_FAM19H_MODEL51H_DF7:
return "DFD7";
default:
printk(BIOS_ERR, "%s: Unhandled device id 0x%x\n", __func__, dev->device);
}
return NULL;
}
struct device_operations cezanne_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,
};

View File

@ -35,7 +35,6 @@ ramstage-y += acpi.c
ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += data_fabric.c
ramstage-y += fch.c
ramstage-y += fsp_s_params.c
ramstage-y += gpio.c

View File

@ -76,14 +76,14 @@ chip soc/amd/glinda
device pci 14.0 alias smbus on ops amd_smbus_ops end # primary FCH function
device pci 14.3 alias lpc_bridge on ops amd_lpc_ops end
device pci 18.0 alias data_fabric_0 on ops glinda_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops glinda_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops glinda_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops glinda_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops glinda_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops glinda_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops glinda_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops glinda_data_fabric_ops end
device pci 18.0 alias data_fabric_0 on ops amd_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops amd_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops amd_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops amd_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops amd_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops amd_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops amd_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops amd_data_fabric_ops end
end
device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end

View File

@ -1,42 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* TODO: Update for Glinda */
#include <acpi/acpi_device.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.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);
}
return NULL;
}
struct device_operations glinda_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,
};

View File

@ -34,7 +34,6 @@ ramstage-y += acpi.c
ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += data_fabric.c
ramstage-y += fch.c
ramstage-y += fsp_s_params.c
ramstage-y += gpio.c

View File

@ -74,14 +74,14 @@ chip soc/amd/mendocino
device pci 14.0 alias smbus on ops amd_smbus_ops end # primary FCH function
device pci 14.3 alias lpc_bridge on ops amd_lpc_ops end
device pci 18.0 alias data_fabric_0 on ops mendocino_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops mendocino_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops mendocino_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops mendocino_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops mendocino_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops mendocino_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops mendocino_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops mendocino_data_fabric_ops end
device pci 18.0 alias data_fabric_0 on ops amd_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops amd_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops amd_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops amd_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops amd_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops amd_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops amd_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops amd_data_fabric_ops end
end
device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end

View File

@ -74,14 +74,14 @@ chip soc/amd/mendocino
device pci 14.0 alias smbus on ops amd_smbus_ops end # primary FCH function
device pci 14.3 alias lpc_bridge on ops amd_lpc_ops end
device pci 18.0 alias data_fabric_0 on ops mendocino_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops mendocino_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops mendocino_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops mendocino_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops mendocino_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops mendocino_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops mendocino_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops mendocino_data_fabric_ops end
device pci 18.0 alias data_fabric_0 on ops amd_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops amd_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops amd_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops amd_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops amd_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops amd_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops amd_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops amd_data_fabric_ops end
end
device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end

View File

@ -1,35 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi_device.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <soc/pci_devs.h>
static const char *data_fabric_acpi_name(const struct device *dev)
{
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;
}
struct device_operations mendocino_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,
};

View File

@ -35,7 +35,6 @@ ramstage-y += acpi.c
ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += data_fabric.c
ramstage-y += fch.c
ramstage-y += fsp_s_params.c
ramstage-y += gpio.c

View File

@ -76,14 +76,14 @@ chip soc/amd/morgana
device pci 14.0 alias smbus on ops amd_smbus_ops end # primary FCH function
device pci 14.3 alias lpc_bridge on ops amd_lpc_ops end
device pci 18.0 alias data_fabric_0 on ops morgana_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops morgana_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops morgana_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops morgana_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops morgana_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops morgana_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops morgana_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops morgana_data_fabric_ops end
device pci 18.0 alias data_fabric_0 on ops amd_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops amd_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops amd_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops amd_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops amd_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops amd_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops amd_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops amd_data_fabric_ops end
end
device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end

View File

@ -1,42 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* TODO: Update for Morgana */
#include <acpi/acpi_device.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.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);
}
return NULL;
}
struct device_operations morgana_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,
};

View File

@ -31,7 +31,6 @@ ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += data_fabric.c
ramstage-y += fch.c
ramstage-y += fsp_s_params.c
ramstage-y += gpio.c

View File

@ -37,14 +37,14 @@ chip soc/amd/picasso
device pci 14.0 alias smbus on ops amd_smbus_ops end # primary FCH function
device pci 14.3 alias lpc_bridge on ops amd_lpc_ops end
device pci 14.6 alias sdhci off end
device pci 18.0 alias data_fabric_0 on ops picasso_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops picasso_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops picasso_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops picasso_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops picasso_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops picasso_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops picasso_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops picasso_data_fabric_ops end
device pci 18.0 alias data_fabric_0 on ops amd_data_fabric_ops end
device pci 18.1 alias data_fabric_1 on ops amd_data_fabric_ops end
device pci 18.2 alias data_fabric_2 on ops amd_data_fabric_ops end
device pci 18.3 alias data_fabric_3 on ops amd_data_fabric_ops end
device pci 18.4 alias data_fabric_4 on ops amd_data_fabric_ops end
device pci 18.5 alias data_fabric_5 on ops amd_data_fabric_ops end
device pci 18.6 alias data_fabric_6 on ops amd_data_fabric_ops end
device pci 18.7 alias data_fabric_7 on ops amd_data_fabric_ops end
end
device mmio 0xfedc4000 alias i2c_2 off ops soc_amd_i2c_mmio_ops end

View File

@ -1,40 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi_device.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
static const char *data_fabric_acpi_name(const struct device *dev)
{
switch (dev->device) {
case PCI_DID_AMD_FAM17H_MODEL18H_DF0:
return "DFD0";
case PCI_DID_AMD_FAM17H_MODEL18H_DF1:
return "DFD1";
case PCI_DID_AMD_FAM17H_MODEL18H_DF2:
return "DFD2";
case PCI_DID_AMD_FAM17H_MODEL18H_DF3:
return "DFD3";
case PCI_DID_AMD_FAM17H_MODEL18H_DF4:
return "DFD4";
case PCI_DID_AMD_FAM17H_MODEL18H_DF5:
return "DFD5";
case PCI_DID_AMD_FAM17H_MODEL18H_DF6:
return "DFD6";
case PCI_DID_AMD_FAM17H_MODEL18H_DF7:
return "DFD7";
default:
printk(BIOS_ERR, "%s: Unhandled device id 0x%x\n", __func__, dev->device);
}
return NULL;
}
struct device_operations picasso_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,
};