Skip to contentSkip to conversation

master abort on scanning fixes [6/9]

RFC PATCH New Adam Belay 1 participant 1 message Jul 14, 2005 PCI

lore
Share & tools
lore

Adam Belay

author
#0 lore raw

RFC PATCH 1/1 master abort on scanning fixes [6/9]

The PCI bridge driver now checks if changing bridge_ctrl is necessary. It also restores the original bridge_ctl settings when finished scanning for devices. Finally, a pci_bus setup fix is included.

drivers/pci/bus/pci-bridge.c +13 -6
@@ -30,7 +30,7 @@
 	bus->bridge = &dev->dev;
 	bus->ops = bus->parent->ops;
 	bus->sysdata = bus->parent->sysdata;
-	bus->bridge = get_device(&dev->dev);
+	bus->self = dev;
 
 	/* Set up default resource pointers and names.. */
 	for (i = 0; i < 4; i++) {
@@ -82,12 +82,7 @@
 	if (!bus)
 		return NULL;
 
-	/* Disable MasterAbortMode during probing to avoid reporting
-	 * of bus errors (in some architectures)
-	 */ 
 	pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &bctl);
-	pci_write_config_word(dev, PCI_BRIDGE_CONTROL,
-			      bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
 
 	bus->number = bus->secondary = busnr;
 	bus->primary = buses & 0xFF;
@@ -105,10 +100,22 @@
 {
 	unsigned int devfn;
 
+	/* Disable MasterAbortMode during probing to avoid reporting
+	 * of bus errors (in some architectures)
+	 */ 
+	if (!(bus->bridge_ctl & PCI_BRIDGE_CTL_MASTER_ABORT))
+		pci_write_config_word(bus->self, PCI_BRIDGE_CONTROL,
+			bus->bridge_ctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
+
 	/* Go find them, Rover! */
 	for (devfn = 0; devfn < 0x100; devfn += 8)
 		pci_scan_slot(bus, devfn);
 
+	/* restore the original bridge_ctl configuration */
+	if (!(bus->bridge_ctl & PCI_BRIDGE_CTL_MASTER_ABORT))
+		pci_write_config_word(bus->self, PCI_BRIDGE_CONTROL,
+				      bus->bridge_ctl);
+
 	pcibios_fixup_bus(bus);
 	pci_bus_add_devices(bus);
 }