patch-2.1.110 linux/drivers/pci/pci.c

Next file: linux/drivers/pnp/parport_probe.c
Previous file: linux/drivers/net/tlan.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.109/linux/drivers/pci/pci.c linux/drivers/pci/pci.c
@@ -1,5 +1,5 @@
 /*
- *	$Id: pci.c,v 1.85 1998/05/12 07:36:01 mj Exp $
+ *	$Id: pci.c,v 1.86 1998/07/15 20:34:47 mj Exp $
  *
  *	PCI Bus Services, see include/linux/pci.h for further explanation.
  *
@@ -161,7 +161,6 @@
 	unsigned char cmd, irq, tmp, hdr_type, is_multi = 0;
 	struct pci_dev *dev, **bus_last;
 	struct pci_bus *child;
-	int reg;
 
 	DBG("pci_scan_bus for bus %d\n", bus->number);
 	bus_last = &bus->devices;
@@ -232,10 +231,7 @@
 		case PCI_HEADER_TYPE_CARDBUS:		    /* CardBus bridge header */
 			if (class != PCI_CLASS_BRIDGE_CARDBUS)
 				goto bad;
-			for (reg = 0; reg < 2; reg++) {
-				pcibios_read_config_dword(bus->number, devfn, PCI_CB_MEMORY_BASE_0 + (reg << 3), &l);
-				dev->base_address[reg] = (l == 0xffffffff) ? 0 : l;
-			}
+			pci_read_bases(dev, 1);
 			break;
 		default:				    /* unknown header */
 		bad:
@@ -274,12 +270,20 @@
 		if (tmp < 32)
 			pcibios_write_config_byte(bus->number, dev->devfn, PCI_LATENCY_TIMER, 32);
 #endif
+	}
 
+	/*
+	 * After performing arch-dependent fixup of the bus, look behind
+	 * all PCI-to-PCI bridges on this bus.
+	 */
+	pcibios_fixup_bus(bus);
+	for(dev=bus->devices; dev; dev=dev->sibling)
 		/*
 		 * If it's a bridge, scan the bus behind it.
 		 */
-		if (class == PCI_CLASS_BRIDGE_PCI) {
+		if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
 			unsigned int buses;
+			unsigned int devfn = dev->devfn;
 			unsigned short cr;
 
 			/*
@@ -350,7 +354,7 @@
 			  }
 			pcibios_write_config_word(bus->number, devfn, PCI_COMMAND, cr);
 		}
-	}
+
 	/*
 	 * We've scanned the bus and so we know all about what's on
 	 * the other side of any bridges that may be on this bus plus

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov