Commit 90b8e1ed authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Linus Torvalds

[PATCH] fix PCI bridge handling in probe.c

As Ben pointed out, disabling the PCI-to-PCI bridge before scanning
its secondary bus is a serious bug.

It can easily crash even on PCs when booting with "pci=assign-busses"
option. For example, that code completely disconnects the AGP bridge
(along with VGA behind it) from the bus and then calls pci_do_scan_bus()
where printks are quite possible.
parent 99a6e15b
......@@ -285,13 +285,12 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
} else {
/*
* We need to assign a number to this bus which we always
* do in the second pass. We also keep all address decoders
* on the bridge disabled during scanning. FIXME: Why?
* do in the second pass.
*/
if (!pass)
return max;
pci_read_config_word(dev, PCI_COMMAND, &cr);
pci_write_config_word(dev, PCI_COMMAND, 0x0000);
/* Clear errors */
pci_write_config_word(dev, PCI_STATUS, 0xffff);
child = pci_add_new_bus(bus, dev, ++max);
......@@ -319,7 +318,6 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
*/
child->subordinate = max;
pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
pci_write_config_word(dev, PCI_COMMAND, cr);
}
sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment