summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuo Liu <shuo.liu@intel.com>2024-03-30 00:37:55 +0800
committerLean Sheng Tan <sheng.tan@9elements.com>2024-05-07 10:20:11 +0000
commit0f3316bc71aab50dbd8464ee2fb5b680947f2ca5 (patch)
tree171b21354e0fc94c7a2acca3a8dd64e8da6ba6ad
parent775c0e6de28390ac0d5688bfce1d7437878eb55f (diff)
device/device_util: Add and use is_pci_bridge()
TEST=Build and boot on intel/archercity CRB Change-Id: Ied4921f7dc7e144e580d05d4f2262777aa59d895 Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81566 Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/device/device_util.c5
-rw-r--r--src/include/device/device.h1
-rw-r--r--src/soc/intel/xeon_sp/uncore_acpi.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 7dcf081820..d91df76cee 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -930,3 +930,8 @@ bool is_pci_dev_on_bus(const struct device *pci, unsigned int bus)
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 ac7e86917e..48e539f8dc 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -193,6 +193,7 @@ bool is_enabled_cpu(const struct device *cpu);
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 95f1492775..6b6363d8ec 100644
--- a/src/soc/intel/xeon_sp/uncore_acpi.c
+++ b/src/soc/intel/xeon_sp/uncore_acpi.c
@@ -317,7 +317,7 @@ static unsigned long acpi_create_drhd(unsigned long current, struct device *iomm
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);
@@ -421,7 +421,7 @@ static unsigned long acpi_create_atsr(unsigned long current)
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(