pci: Fix ordering of devices when CONFIG_PCI_SCAN_SHOW

Move the printing of PCI device information to before the PCI device is
configured.  This prevents the case where recursive scanning results in
the deepest devices being printed first.

This change also makes PCI lockups during enumeration easier to
diagnose since the device that is being configured is printed out prior
to configuration.  Previously, it was not possible to determine which
device caused the PCI lockup.

Original example:
  PCIE1: connected as Root Complex
        04:01.0 - 8086:1010 - Network controller
        04:01.1 - 8086:1010 - Network controller
        03:00.0 - 10b5:8112 - Bridge device
        02:01.0 - 10b5:8518 - Bridge device
        02:02.0 - 10b5:8518 - Bridge device
        08:00.0 - 1957:0040 - Processor
        07:00.0 - 10b5:8518 - Bridge device
        09:00.0 - 10b5:8112 - Bridge device
        07:01.0 - 10b5:8518 - Bridge device
        07:02.0 - 10b5:8518 - Bridge device
        06:00.0 - 10b5:8518 - Bridge device
        02:03.0 - 10b5:8518 - Bridge device
        01:00.0 - 10b5:8518 - Bridge device
  PCIE1: Bus 00 - 0b

Updated example:
  PCIE1: connected as Root Complex
        01:00.0 - 10b5:8518 - Bridge device
        02:01.0 - 10b5:8518 - Bridge device
        03:00.0 - 10b5:8112 - Bridge device
        04:01.0 - 8086:1010 - Network controller
        04:01.1 - 8086:1010 - Network controller
        02:02.0 - 10b5:8518 - Bridge device
        02:03.0 - 10b5:8518 - Bridge device
        06:00.0 - 10b5:8518 - Bridge device
        07:00.0 - 10b5:8518 - Bridge device
        08:00.0 - 1957:0040 - Processor
        07:01.0 - 10b5:8518 - Bridge device
        09:00.0 - 10b5:8112 - Bridge device
        07:02.0 - 10b5:8518 - Bridge device
  PCIE1: Bus 00 - 0b

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
This commit is contained in:
Peter Tyser 2010-10-29 17:59:28 -05:00 committed by Wolfgang Denk
parent 983eb9d162
commit a38d216eeb

View file

@ -645,6 +645,14 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
pci_hose_read_config_word(hose, dev, PCI_DEVICE_ID, &device); pci_hose_read_config_word(hose, dev, PCI_DEVICE_ID, &device);
pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class); pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class);
#ifdef CONFIG_PCI_SCAN_SHOW
if (pci_print_dev(hose, dev)) {
printf(" %02x:%02x.%x - %04x:%04x - %s\n",
PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev),
vendor, device, pci_class_str(class >> 8));
}
#endif
cfg = pci_find_config(hose, class, vendor, device, cfg = pci_find_config(hose, class, vendor, device,
PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev)); PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev));
if (cfg) { if (cfg) {
@ -657,16 +665,9 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
sub_bus = max(sub_bus, n); sub_bus = max(sub_bus, n);
#endif #endif
} }
if (hose->fixup_irq) if (hose->fixup_irq)
hose->fixup_irq(hose, dev); hose->fixup_irq(hose, dev);
#ifdef CONFIG_PCI_SCAN_SHOW
if (pci_print_dev(hose, dev)) {
printf(" %02x:%02x.%x - %04x:%04x - %s\n",
PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev),
vendor, device, pci_class_str(class >> 8));
}
#endif
} }
return sub_bus; return sub_bus;