Attention is currently required from: Patrick Rudolph.

Felix Held would like Patrick Rudolph to review this change.

View Change

device/device_const: add pcidev_path_on_segbus

Add pcidev_path_on_segbus which is pcidev_path_on_bus that takes the PCI
segment group number as argument instead of only using segment group 0.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Change-Id: Ibbbee9966abc997ded6389e72912e621c1f0bdbf
---
M src/device/device_const.c
M src/include/device/device.h
2 files changed, 12 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/80/79980/1
diff --git a/src/device/device_const.c b/src/device/device_const.c
index c91c009..3a6233b 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -225,8 +225,16 @@

DEVTREE_CONST struct device *pcidev_path_on_bus(unsigned int bus, pci_devfn_t devfn)
{
+ return pcidev_path_on_segbus(0, bus, devfn);
+}
+
+DEVTREE_CONST struct device *pcidev_path_on_segbus(unsigned int segment_group,
+ unsigned int bus,
+ pci_devfn_t devfn)
+{
DEVTREE_CONST struct bus *parent = pci_root_bus();
DEVTREE_CONST struct device *dev = parent->children;
+ assert(segment_group < (CONFIG(ECAM_MMCONF_SUPPORT) ? PCI_SEGMENT_GROUP_COUNT : 1));

/* FIXME: Write the loop with topology links. */
while (dev) {
@@ -234,7 +242,7 @@
dev = dev->next;
continue;
}
- if (dev->bus->secondary == bus && dev->bus->segment_group == 0)
+ if (dev->bus->secondary == bus && dev->bus->segment_group == segment_group)
return pcidev_path_behind(dev->bus, devfn);
dev = dev->next;
}
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 50307e6..c8e45ef 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -426,6 +426,9 @@
pci_devfn_t devfn);
DEVTREE_CONST struct device *pcidev_path_on_root(pci_devfn_t devfn);
DEVTREE_CONST struct device *pcidev_path_on_bus(unsigned int bus, pci_devfn_t devfn);
+DEVTREE_CONST struct device *pcidev_path_on_segbus(unsigned int segment,
+ unsigned int bus,
+ pci_devfn_t devfn);
DEVTREE_CONST struct device *pcidev_on_root(uint8_t dev, uint8_t fn);
DEVTREE_CONST struct bus *pci_root_bus(void);
/* Find PCI device with given D#:F# sitting behind the given PCI-to-PCI bridge device. */

To view, visit change 79980. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Ibbbee9966abc997ded6389e72912e621c1f0bdbf
Gerrit-Change-Number: 79980
Gerrit-PatchSet: 1
Gerrit-Owner: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Attention: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-MessageType: newchange