Shuo Liu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81566?usp=email )
Change subject: device/device_util: Add is_pci_bridge ......................................................................
device/device_util: Add is_pci_bridge
Change-Id: Ied4921f7dc7e144e580d05d4f2262777aa59d895 Signed-off-by: Shuo Liu shuo.liu@intel.com --- M src/device/device_util.c M src/include/device/device.h M src/soc/intel/xeon_sp/uncore_acpi.c 3 files changed, 8 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/66/81566/1
diff --git a/src/device/device_util.c b/src/device/device_util.c index 53cd915..c9da805 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -933,3 +933,8 @@ return is_pci(pci) && pci->upstream->segment_group == 0 && pci->upstream->secondary == bus; } + +bool is_pci_bridge(const struct device *pci) +{ + return (is_pci(pci) && ((pci->hdr_type & 0x7f) == PCI_HEADER_TYPE_BRIDGE)); +} diff --git a/src/include/device/device.h b/src/include/device/device.h index 7e5ebde..c8b51fe 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -193,6 +193,7 @@ bool is_pci(const struct device *pci); bool is_enabled_pci(const struct device *pci); bool is_pci_dev_on_bus(const struct device *pci, unsigned int bus); +bool is_pci_bridge(const struct device *pci);
/* Returns whether there is a hotplug port on the path to the given device. */ bool dev_path_hotplug(const struct device *); diff --git a/src/soc/intel/xeon_sp/uncore_acpi.c b/src/soc/intel/xeon_sp/uncore_acpi.c index 90cc108..c2c5008 100644 --- a/src/soc/intel/xeon_sp/uncore_acpi.c +++ b/src/soc/intel/xeon_sp/uncore_acpi.c @@ -318,7 +318,7 @@ const struct device *domain = dev_get_domain(iommu); struct device *dev = NULL; while ((dev = dev_bus_each_child(domain->downstream, dev))) - if ((dev->hdr_type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) + if (is_pci_bridge(dev)) current += acpi_create_dmar_ds_pci_br_for_port( current, dev, pcie_seg, false, NULL); @@ -422,7 +422,7 @@ continue;
for (child = dev->upstream->children; child; child = child->sibling) { - if ((child->hdr_type & 0x7f) != PCI_HEADER_TYPE_BRIDGE) + if (!is_pci_bridge(child)) continue; current += acpi_create_dmar_ds_pci_br_for_port(