summaryrefslogtreecommitdiff
path: root/ls-tree.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2018-08-12 11:13:05 +0200
committerMartin Mares <mj@ucw.cz>2018-08-12 12:46:16 +0200
commitf558905d0b843dbb67104f8c2cb17eb40ffe9c7e (patch)
treedf236889fee8e3e1a10059ab3ac8f2f81814f9f5 /ls-tree.c
parent62e78fa6995169946082f6209304eaa024c69822 (diff)
downloadpciutils-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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ls-tree.c b/ls-tree.c
index dbb65eb..8ce9b4f 100644
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -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;