From c3c2e3cb3e5aa9882c5a7a76a482565990532e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Tue, 18 Apr 2023 00:31:10 +0200 Subject: 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. --- ls-tree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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); } -- cgit v1.2.1