summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2023-04-18 00:31:10 +0200
committerPali Rohár <pali@kernel.org>2023-04-29 14:14:58 +0200
commitc3c2e3cb3e5aa9882c5a7a76a482565990532e81 (patch)
tree0801dc3c358fdf1258758abb3bb3085bbb9a41ce
parentf0aa3a466bc73d24d71dae7811cb673297fda752 (diff)
downloadpciutils-c3c2e3cb3e5aa9882c5a7a76a482565990532e81.tar.gz
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.
-rw-r--r--ls-tree.c3
1 files changed, 1 insertions, 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);
}