summaryrefslogtreecommitdiff
path: root/src/device/pci_device.c
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2024-01-11 22:26:18 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-01-16 22:59:55 +0000
commit3b5b66d82954e026a91a1eff833fa7f652fed629 (patch)
treec7ff2cb87807e204d6f9e04e1cae14516eae0801 /src/device/pci_device.c
parent090ea7ab8fceae54488620160aa95da4292d663f (diff)
device: Add support for multiple PCI segment groups
Add initial support for multiple PCI segment groups. Instead of modifying secondary in the bus struct introduce a new segment_group struct element and keep existing common code. Since all platforms currently only use 1 segment this is not a functional change. On platforms that support more than 1 segment the segment has to be set when creating the PCI domain. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ied3313c41896362dd989ee2ab1b1bcdced840aa8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/79927 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Diffstat (limited to 'src/device/pci_device.c')
-rw-r--r--src/device/pci_device.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/device/pci_device.c b/src/device/pci_device.c
index b356c2695b..acdad421c5 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -846,6 +846,12 @@ static int should_run_oprom(struct device *dev, struct rom_header *rom)
{
static int should_run = -1;
+ if (dev->bus->segment_group) {
+ printk(BIOS_ERR, "Only option ROMs of devices in first PCI segment group can "
+ "be run.\n");
+ return 0;
+ }
+
if (CONFIG(VENDORCODE_ELTAN_VBOOT))
if (rom != NULL)
if (!verified_boot_should_run_oprom(rom))
@@ -1314,7 +1320,8 @@ struct device *pci_probe_dev(struct device *dev, struct bus *bus,
*/
unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev)
{
- return dev->bus->secondary == PCI_DEV2SEGBUS(sdev) &&
+ return dev->bus->secondary == PCI_DEV2BUS(sdev) &&
+ dev->bus->segment_group == PCI_DEV2SEG(sdev) &&
dev->path.pci.devfn == PCI_DEV2DEVFN(sdev);
}
@@ -1428,7 +1435,8 @@ void pci_scan_bus(struct bus *bus, unsigned int min_devfn,
struct device *dev, **prev;
int once = 0;
- printk(BIOS_DEBUG, "PCI: %s for bus %02x\n", __func__, bus->secondary);
+ printk(BIOS_DEBUG, "PCI: %s for segment group %02x bus %02x\n", __func__,
+ bus->segment_group, bus->secondary);
/* Maximum sane devfn is 0xFF. */
if (max_devfn > 0xff) {
@@ -1549,7 +1557,8 @@ static void pci_bridge_route(struct bus *link, scan_state state)
link->subordinate = link->secondary + dev->hotplug_buses;
link->max_subordinate = parent->max_subordinate
? parent->max_subordinate
- : (CONFIG_ECAM_MMCONF_BUS_NUMBER - 1);
+ : (PCI_BUSES_PER_SEGMENT_GROUP - 1);
+ link->segment_group = parent->segment_group;
}
if (link->secondary > link->max_subordinate)