PCI: Supply bridge device, not secondary bus, to read window details
authorBjorn Helgaas <bhelgaas@google.com>
Wed, 22 Nov 2023 16:13:03 +0000 (10:13 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 15 Dec 2023 23:28:43 +0000 (17:28 -0600)
commit281e1f137a97dae4fe47a7d30635c5b83def790b
tree86602d512cfc8d0474b723ee160ac0a0890c619a
parent6f32099a91720b6d91da961858d48173f01a729d
PCI: Supply bridge device, not secondary bus, to read window details

Previously we logged information about devices *below* the bridge before
logging information about the bridge itself, e.g.,

  pci 0000:00:01.0: [8086:1901] type 01 class 0x060400
  pci 0000:01:00.0: [10de:13b6] type 00 class 0x030200
  pci 0000:01:00.0: reg 0x10: [mem 0xec000000-0xecffffff]
  pci 0000:00:01.0: PCI bridge to [bus 01]
  pci 0000:00:01.0:   bridge window [io  0xe000-0xefff]

This is partly because the bridge windows are read in this path:

  pci_scan_child_bus_extend
    for (devfn = 0; devfn < 256; devfn += 8)
      pci_scan_slot(bus, devfn)       # scan below bridge
    pcibios_fixup_bus(bus)
      pci_read_bridge_bases(bus)      # read bridge windows
        pci_read_bridge_io(bus)

Remove the assumption that the secondary (child) pci_bus already exists by
passing in the bridge device (instead of the pci_bus) and a resource
pointer when reading bridge windows.  A future change can use this to log
the bridge details before we enumerate the devices below the bridge.

No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/probe.c