soc/amd/mendocino: Use devicetree ops over pci driver

Mendocino is a SoC so it makes sense to statically use ops instead of
matching them to PCI DID/VID at runtime.

Change-Id: I5619c8ad42cdeb019cb7294da884909df64a2211
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68141
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
This commit is contained in:
Arthur Heymans 2022-10-05 14:41:51 +02:00 committed by Felix Held
parent b65f609bfd
commit 6a5d770536
4 changed files with 20 additions and 45 deletions

View File

@ -4,7 +4,7 @@ chip soc/amd/mendocino
end end
device domain 0 on device domain 0 on
ops mendocino_pci_domain_ops ops mendocino_pci_domain_ops
device pci 00.0 alias gnb on end device pci 00.0 alias gnb on ops mendocino_root_complex_operations end
device pci 00.2 alias iommu off end device pci 00.2 alias iommu off end
device pci 01.0 on end # Dummy Host Bridge device pci 01.0 on end # Dummy Host Bridge
@ -72,14 +72,14 @@ chip soc/amd/mendocino
device pci 14.0 alias smbus on end # primary FCH function device pci 14.0 alias smbus on end # primary FCH function
device pci 14.3 alias lpc_bridge on end device pci 14.3 alias lpc_bridge on end
device pci 18.0 alias data_fabric_0 on 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 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 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 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 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 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 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 end device pci 18.7 alias data_fabric_7 on ops mendocino_data_fabric_ops end
end end
device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end

View File

@ -4,7 +4,7 @@ chip soc/amd/mendocino
end end
device domain 0 on device domain 0 on
ops mendocino_pci_domain_ops ops mendocino_pci_domain_ops
device pci 00.0 alias gnb on end device pci 00.0 alias gnb on ops mendocino_root_complex_operations end
device pci 00.2 alias iommu off end device pci 00.2 alias iommu off end
device pci 01.0 on end # Dummy Host Bridge device pci 01.0 on end # Dummy Host Bridge
@ -72,14 +72,14 @@ chip soc/amd/mendocino
device pci 14.0 alias smbus on end # primary FCH function device pci 14.0 alias smbus on end # primary FCH function
device pci 14.3 alias lpc_bridge on end device pci 14.3 alias lpc_bridge on end
device pci 18.0 alias data_fabric_0 on 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 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 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 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 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 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 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 end device pci 18.7 alias data_fabric_7 on ops mendocino_data_fabric_ops end
end end
device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end device mmio 0xfedc2000 alias i2c_0 off ops soc_amd_i2c_mmio_ops end

View File

@ -127,27 +127,9 @@ static const char *data_fabric_acpi_name(const struct device *dev)
return NULL; return NULL;
} }
static struct device_operations data_fabric_ops = { struct device_operations mendocino_data_fabric_ops = {
.read_resources = noop_read_resources, .read_resources = noop_read_resources,
.set_resources = noop_set_resources, .set_resources = noop_set_resources,
.acpi_name = data_fabric_acpi_name, .acpi_name = data_fabric_acpi_name,
.acpi_fill_ssdt = acpi_device_write_pci_dev, .acpi_fill_ssdt = acpi_device_write_pci_dev,
}; };
static const unsigned short pci_device_ids[] = {
PCI_DID_AMD_FAM17H_MODELA0H_DF0,
PCI_DID_AMD_FAM17H_MODELA0H_DF1,
PCI_DID_AMD_FAM17H_MODELA0H_DF2,
PCI_DID_AMD_FAM17H_MODELA0H_DF3,
PCI_DID_AMD_FAM17H_MODELA0H_DF4,
PCI_DID_AMD_FAM17H_MODELA0H_DF5,
PCI_DID_AMD_FAM17H_MODELA0H_DF6,
PCI_DID_AMD_FAM17H_MODELA0H_DF7,
0
};
static const struct pci_driver data_fabric_driver __pci_driver = {
.ops = &data_fabric_ops,
.vendor = PCI_VID_AMD,
.devices = pci_device_ids,
};

View File

@ -13,7 +13,6 @@
#include <cpu/amd/msr.h> #include <cpu/amd/msr.h>
#include <device/device.h> #include <device/device.h>
#include <device/pci.h> #include <device/pci.h>
#include <device/pci_ids.h>
#include <fsp/util.h> #include <fsp/util.h>
#include <soc/iomap.h> #include <soc/iomap.h>
#include <stdint.h> #include <stdint.h>
@ -236,7 +235,7 @@ static const char *gnb_acpi_name(const struct device *dev)
return "GNB"; return "GNB";
} }
static struct device_operations root_complex_operations = { struct device_operations mendocino_root_complex_operations = {
.read_resources = read_resources, .read_resources = read_resources,
.set_resources = noop_set_resources, .set_resources = noop_set_resources,
.enable_resources = pci_dev_enable_resources, .enable_resources = pci_dev_enable_resources,
@ -244,9 +243,3 @@ static struct device_operations root_complex_operations = {
.acpi_name = gnb_acpi_name, .acpi_name = gnb_acpi_name,
.acpi_fill_ssdt = root_complex_fill_ssdt, .acpi_fill_ssdt = root_complex_fill_ssdt,
}; };
static const struct pci_driver family17_root_complex __pci_driver = {
.ops = &root_complex_operations,
.vendor = PCI_VID_AMD,
.device = PCI_DID_AMD_17H_MODEL_A0AF_NB,
};