Skip to content

Commit 95140c2

Browse files
committed
PCI: Log bridge info when first enumerating bridge
Log bridge secondary/subordinate bus and window information at the same time we log the bridge BARs, just after discovering the bridge and before scanning the bridge's secondary bus. This logs the bridge and downstream devices in a more logical order: - 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] + pci 0000:00:01.0: [8086:1901] type 01 class 0x060400 + pci 0000:00:01.0: PCI bridge to [bus 01] + pci 0000:00:01.0: bridge window [io 0xe000-0xefff] + pci 0000:01:00.0: [10de:13b6] type 00 class 0x030200 + pci 0000:01:00.0: reg 0x10: [mem 0xec000000-0xecffffff] Note that we read the windows into a temporary struct resource that is thrown away, not into the resources in the struct pci_bus. The windows may be adjusted after we know what downstream devices require, and those adjustments are logged as they are made. Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 63c6ebb commit 95140c2

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

drivers/pci/probe.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,17 +458,30 @@ static void pci_read_bridge_mmio_pref(struct pci_dev *dev, struct resource *res,
458458

459459
static void pci_read_bridge_windows(struct pci_dev *bridge)
460460
{
461+
u32 buses;
461462
u16 io;
462463
u32 pmem, tmp;
464+
struct resource res;
465+
466+
pci_read_config_dword(bridge, PCI_PRIMARY_BUS, &buses);
467+
res.flags = IORESOURCE_BUS;
468+
res.start = (buses >> 8) & 0xff;
469+
res.end = (buses >> 16) & 0xff;
470+
pci_info(bridge, "PCI bridge to %pR%s\n", &res,
471+
bridge->transparent ? " (subtractive decode)" : "");
463472

464473
pci_read_config_word(bridge, PCI_IO_BASE, &io);
465474
if (!io) {
466475
pci_write_config_word(bridge, PCI_IO_BASE, 0xe0f0);
467476
pci_read_config_word(bridge, PCI_IO_BASE, &io);
468477
pci_write_config_word(bridge, PCI_IO_BASE, 0x0);
469478
}
470-
if (io)
479+
if (io) {
471480
bridge->io_window = 1;
481+
pci_read_bridge_io(bridge, &res, true);
482+
}
483+
484+
pci_read_bridge_mmio(bridge, &res, true);
472485

473486
/*
474487
* DECchip 21050 pass 2 errata: the bridge may miss an address
@@ -505,6 +518,8 @@ static void pci_read_bridge_windows(struct pci_dev *bridge)
505518
if (tmp)
506519
bridge->pref_64_window = 1;
507520
}
521+
522+
pci_read_bridge_mmio_pref(bridge, &res, true);
508523
}
509524

510525
void pci_read_bridge_bases(struct pci_bus *child)
@@ -524,9 +539,9 @@ void pci_read_bridge_bases(struct pci_bus *child)
524539
for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++)
525540
child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i];
526541

527-
pci_read_bridge_io(child->self, child->resource[0], true);
528-
pci_read_bridge_mmio(child->self, child->resource[1], true);
529-
pci_read_bridge_mmio_pref(child->self, child->resource[2], true);
542+
pci_read_bridge_io(child->self, child->resource[0], false);
543+
pci_read_bridge_mmio(child->self, child->resource[1], false);
544+
pci_read_bridge_mmio_pref(child->self, child->resource[2], false);
530545

531546
if (dev->transparent) {
532547
pci_bus_for_each_resource(child->parent, res) {

0 commit comments

Comments
 (0)