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

Next file: linux/drivers/scsi/BusLogic.c
Previous file: linux/drivers/pci/oldproc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.94/linux/drivers/pci/pci.c linux/drivers/pci/pci.c
@@ -20,6 +20,7 @@
 struct pci_bus pci_root;
 struct pci_dev *pci_devices = NULL;
 static struct pci_dev **pci_last_dev_p = &pci_devices;
+static int pci_reverse __initdata = 0;
 
 #undef DEBUG
 
@@ -193,8 +194,13 @@
 		 * Put it into the global PCI device chain. It's used to
 		 * find devices once everything is set up.
 		 */
-		*pci_last_dev_p = dev;
-		pci_last_dev_p = &dev->next;
+		if (!pci_reverse) {
+			*pci_last_dev_p = dev;
+			pci_last_dev_p = &dev->next;
+		} else {
+			dev->next = pci_devices;
+			pci_devices = dev;
+		}
 
 		/*
 		 * Now insert it into the list of devices held
@@ -204,6 +210,17 @@
 		bus->devices = dev;
 
 		/*
+		 * In case the latency timer value is less than 32,
+		 * which makes everything very sllooowww, set it to
+		 * 32. Pciutils should be used to fine-tune it later.
+		 * Note that we don't check if the device is a bus-master:
+		 * if it isn't, write to the latency timer should be ignored.
+		 */
+		pcibios_read_config_byte(bus->number, dev->devfn, PCI_LATENCY_TIMER, &tmp);
+		if (tmp < 32)
+			pcibios_write_config_byte(bus->number, dev->devfn, PCI_LATENCY_TIMER, 32);
+
+		/*
 		 * If it's a bridge, scan the bus behind it.
 		 */
 		if (class >> 8 == PCI_CLASS_BRIDGE_PCI) {
@@ -299,6 +316,7 @@
 
 	if (!pci_present()) {
 		printk("PCI: No PCI bus detected\n");
+		return;
 	}
 
 	printk("PCI: Probing PCI hardware.\n");
@@ -312,12 +330,30 @@
 #ifdef CONFIG_PCI_OPTIMIZE
 	pci_quirks_init();
 #endif
+
+#ifdef CONFIG_PROC_FS
+	proc_bus_pci_init();
+#ifdef CONFIG_PCI_OLD_PROC
+	proc_old_pci_init();
+#endif
+#endif
 }
 
 
 __initfunc(void pci_setup (char *str, int *ints))
 {
 	str = pcibios_setup(str);
-	if (*str)
-		printk(KERN_ERR "PCI: Unknown option `%s'\n", str);
+	while (str) {
+		char *k = strchr(str, ',');
+		if (k)
+			*k++ = 0;
+		if (*str) {
+			if (!(str = pcibios_setup(str)) || !*str)
+				continue;
+			if (!strcmp(str, "reverse"))
+				pci_reverse = 1;
+			else printk(KERN_ERR "PCI: Unknown option `%s'\n", str);
+		}
+		str = k;
+	}
 }

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