diff options
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index aaaf0a1fed22..6f1e51d77bce 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -480,19 +480,27 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
480 | int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); | 480 | int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); |
481 | u32 buses, i, j = 0; | 481 | u32 buses, i, j = 0; |
482 | u16 bctl; | 482 | u16 bctl; |
483 | int broken = 0; | ||
483 | 484 | ||
484 | pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); | 485 | pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); |
485 | 486 | ||
486 | dev_dbg(&dev->dev, "scanning behind bridge, config %06x, pass %d\n", | 487 | dev_dbg(&dev->dev, "scanning behind bridge, config %06x, pass %d\n", |
487 | buses & 0xffffff, pass); | 488 | buses & 0xffffff, pass); |
488 | 489 | ||
490 | /* Check if setup is sensible at all */ | ||
491 | if (!pass && | ||
492 | ((buses & 0xff) != bus->number || ((buses >> 8) & 0xff) <= bus->number)) { | ||
493 | dev_dbg(&dev->dev, "bus configuration invalid, reconfiguring\n"); | ||
494 | broken = 1; | ||
495 | } | ||
496 | |||
489 | /* Disable MasterAbortMode during probing to avoid reporting | 497 | /* Disable MasterAbortMode during probing to avoid reporting |
490 | of bus errors (in some architectures) */ | 498 | of bus errors (in some architectures) */ |
491 | pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &bctl); | 499 | pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &bctl); |
492 | pci_write_config_word(dev, PCI_BRIDGE_CONTROL, | 500 | pci_write_config_word(dev, PCI_BRIDGE_CONTROL, |
493 | bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); | 501 | bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); |
494 | 502 | ||
495 | if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) { | 503 | if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus && !broken) { |
496 | unsigned int cmax, busnr; | 504 | unsigned int cmax, busnr; |
497 | /* | 505 | /* |
498 | * Bus already configured by firmware, process it in the first | 506 | * Bus already configured by firmware, process it in the first |
@@ -530,7 +538,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
530 | * do in the second pass. | 538 | * do in the second pass. |
531 | */ | 539 | */ |
532 | if (!pass) { | 540 | if (!pass) { |
533 | if (pcibios_assign_all_busses()) | 541 | if (pcibios_assign_all_busses() || broken) |
534 | /* Temporarily disable forwarding of the | 542 | /* Temporarily disable forwarding of the |
535 | configuration cycles on all bridges in | 543 | configuration cycles on all bridges in |
536 | this bus segment to avoid possible | 544 | this bus segment to avoid possible |