pci_device_get_bridge_info() can not work with multi-function bridge
Submitted by Lichao Mu
Assigned to Xorg Project Team
Description
on one SuperMicro X10DRi + Xeon E5-2680 v3 machine, there are multi-function PCI bridges:
# lspci | grep bridge
00:00.0 Host bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 DMI2 (rev 02)
00:01.0 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 1 (rev 02)
00:02.0 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 2 (rev 02)
00:03.0 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 3 (rev 02)
00:03.2 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 3 (rev 02)
00:03.0 and 00:03.2 are multi-function PCI bridges and their header type is 0x81 (the highest bit is 1) when getting from Linux sysfs. In such case, pci_device_get_bridge_info() will return NULL.
following patch will fix the issue.
diff --git a/src/common_bridge.c b/src/common_bridge.c
index b4b5d7e..84cc57b 100644
--- a/src/common_bridge.c
+++ b/src/common_bridge.c
@@ -216,7 +216,7 @@ pci_device_get_bridge_info( struct pci_device * dev )
read_bridge_info(priv);
}
- return (priv->header_type == 1) ? priv->bridge.pci : NULL;
+ return ((priv->header_type & 0x7f) == 1) ? priv->bridge.pci : NULL;
}
Version: git
Edited by Adam Jackson