From: Pali Rohár Date: Mon, 17 Apr 2023 22:31:10 +0000 (+0200) Subject: ls-tree: Do not read Primary Bus Number for PCI Bridges from PCI config space X-Git-Tag: v3.10.0~1^2~4 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=c3c2e3cb3e5aa9882c5a7a76a482565990532e81;p=pciutils.git ls-tree: Do not read Primary Bus Number for PCI Bridges from PCI config space For PCIe devices of PCI Bridge type is Primary Bus Number not used and the default value is 0. PCIe devices capture their Bus and Device numbers automatically from PCIe TLP packets. Instead of Primary Bus Number use Device Number because zero value confuse tree building algorithm. Existing code already expects that Device Number of PCI Bridge is already set to Primary Bus Number. --- diff --git a/ls-tree.c b/ls-tree.c index 72ac390..8e01dea 100644 --- a/ls-tree.c +++ b/ls-tree.c @@ -113,15 +113,14 @@ grow_tree(void) { b = xmalloc(sizeof(struct bridge)); b->domain = dd->domain; + b->primary = dd->bus; if (ht == PCI_HEADER_TYPE_BRIDGE) { - b->primary = get_conf_byte(d, PCI_PRIMARY_BUS); b->secondary = get_conf_byte(d, PCI_SECONDARY_BUS); b->subordinate = get_conf_byte(d, PCI_SUBORDINATE_BUS); } else { - b->primary = get_conf_byte(d, PCI_CB_PRIMARY_BUS); b->secondary = get_conf_byte(d, PCI_CB_CARD_BUS); b->subordinate = get_conf_byte(d, PCI_CB_SUBORDINATE_BUS); }