diff options
author | Darren Smith <darren.smith@juno.com> | 2009-04-14 10:46:26 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-04-14 10:46:26 -0400 |
commit | 9ba94caf57e3a8c3e9c6f3f5f068f4a7a7b3ff9d (patch) | |
tree | 230c7f4d7ab04a9902909f6d494d83224a675e81 /src | |
parent | 72e75b00e4f3f7df3badb10c916126253204ae45 (diff) |
Be more paranoid about reading bridge info (#20786)
Diffstat (limited to 'src')
-rw-r--r-- | src/common_bridge.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/common_bridge.c b/src/common_bridge.c index ec1eddd..2480ba8 100644 --- a/src/common_bridge.c +++ b/src/common_bridge.c @@ -270,10 +270,6 @@ pci_device_get_bridge_buses(struct pci_device * dev, int *primary_bus, return ENODEV; } - if (priv->bridge.pci == NULL) { - read_bridge_info(priv); - } - switch ((dev->device_class >> 8) & 0x0ff) { case 0x00: /* What to do for host bridges? I'm pretty sure this isn't right. @@ -292,15 +288,31 @@ pci_device_get_bridge_buses(struct pci_device * dev, int *primary_bus, break; case 0x04: + if (priv->bridge.pci == NULL) + read_bridge_info(priv); + if (priv->header_type == 0x01) { *primary_bus = priv->bridge.pci->primary_bus; *secondary_bus = priv->bridge.pci->secondary_bus; *subordinate_bus = priv->bridge.pci->subordinate_bus; + } else { + *primary_bus = dev->bus; + *secondary_bus = -1; + *subordinate_bus = -1; + } break; case 0x07: + if (priv->bridge.pcmcia == NULL) + read_bridge_info(priv); + if (priv->header_type == 0x02) { *primary_bus = priv->bridge.pcmcia->primary_bus; *secondary_bus = priv->bridge.pcmcia->card_bus; *subordinate_bus = priv->bridge.pcmcia->subordinate_bus; + } else { + *primary_bus = dev->bus; + *secondary_bus = -1; + *subordinate_bus = -1; + } break; } |