diff options
author | Martin Mares <mj@ucw.cz> | 2018-08-12 11:13:05 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2018-08-12 12:46:16 +0200 |
commit | f558905d0b843dbb67104f8c2cb17eb40ffe9c7e (patch) | |
tree | df236889fee8e3e1a10059ab3ac8f2f81814f9f5 /ls-tree.c | |
parent | 62e78fa6995169946082f6209304eaa024c69822 (diff) | |
download | pciutils-f558905d0b843dbb67104f8c2cb17eb40ffe9c7e.tar.gz |
Tree: Detect bridges properly
Previously, only PCI_CLASS_BRIDGE_PCI was considered, which excluded
CardBus bridges. We now accept anything of the base class "bridge"
with the proper header type.
Also added a bunch of debugging messages.
Diffstat (limited to 'ls-tree.c')
-rw-r--r-- | ls-tree.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -76,13 +76,14 @@ grow_tree(void) last_br = &host_bridge.chain; for (d=first_dev; d; d=d->next) { - word class = d->dev->device_class; + struct pci_dev *dd = d->dev; + word class = dd->device_class; byte ht = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f; - if (class == PCI_CLASS_BRIDGE_PCI && + if ((class >> 8) == PCI_BASE_CLASS_BRIDGE && (ht == PCI_HEADER_TYPE_BRIDGE || ht == PCI_HEADER_TYPE_CARDBUS)) { b = xmalloc(sizeof(struct bridge)); - b->domain = d->dev->domain; + b->domain = dd->domain; if (ht == PCI_HEADER_TYPE_BRIDGE) { b->primary = get_conf_byte(d, PCI_PRIMARY_BUS); @@ -101,6 +102,9 @@ grow_tree(void) b->first_bus = NULL; b->br_dev = d; d->bridge = b; + pacc->debug("Tree: bridge %04x:%02x:%02x.%d: %02x -> %02x-%02x\n", + dd->domain, dd->bus, dd->dev, dd->func, + b->primary, b->secondary, b->subordinate); } } *last_br = NULL; |