summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce Harrington <bryce@canonical.com>2010-12-14 12:03:48 -0500
committerAdam Jackson <ajax@redhat.com>2010-12-14 12:03:48 -0500
commit066032e08407311cfc24dbc1db3245cf8133ad94 (patch)
treee2a3b4dfe308d20c00cce62efc287b4a538485da
parent6220537628fb5e55c94d7dbe1ec190bf38d3b01b (diff)
downloadlibpciaccess-066032e08407311cfc24dbc1db3245cf8133ad94.tar.gz
libpciaccess-066032e08407311cfc24dbc1db3245cf8133ad94.tar.bz2
libpciaccess-066032e08407311cfc24dbc1db3245cf8133ad94.zip
Fix detection of multi-function cards
Bit 7 of the pci device header type is an indicator of multi-function devices, so needs to be masked when examining the bridge type. Thanks go to Chih-Pin Wu for finding the bug and its fix. https://bugs.launchpad.net/ubuntu/+source/libpciaccess/+bug/681207 Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Bryce Harrington <bryce@canonical.com>
-rw-r--r--src/common_bridge.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common_bridge.c b/src/common_bridge.c
index 2609d7c..871c1f6 100644
--- a/src/common_bridge.c
+++ b/src/common_bridge.c
@@ -290,7 +290,7 @@ pci_device_get_bridge_buses(struct pci_device * dev, int *primary_bus,
case 0x04:
if (priv->bridge.pci == NULL)
read_bridge_info(priv);
- if (priv->header_type == 0x01) {
+ if ((priv->header_type & 0x7f) == 0x01) {
*primary_bus = priv->bridge.pci->primary_bus;
*secondary_bus = priv->bridge.pci->secondary_bus;
*subordinate_bus = priv->bridge.pci->subordinate_bus;
@@ -304,7 +304,7 @@ pci_device_get_bridge_buses(struct pci_device * dev, int *primary_bus,
case 0x07:
if (priv->bridge.pcmcia == NULL)
read_bridge_info(priv);
- if (priv->header_type == 0x02) {
+ if ((priv->header_type & 0x7f) == 0x02) {
*primary_bus = priv->bridge.pcmcia->primary_bus;
*secondary_bus = priv->bridge.pcmcia->card_bus;
*subordinate_bus = priv->bridge.pcmcia->subordinate_bus;