[patch 2.5] 2-pass PCI probing, i386 USB quirk

From: Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Date: Thu Jan 09 2003 - 12:51:17 EST


Untested, but it might work. Perhaps this needs to be chip specific (VIA?).

Ivan.

--- 2.5.55/arch/i386/pci/fixup.c Thu Jan 9 07:04:19 2003
+++ linux/arch/i386/pci/fixup.c Thu Jan 9 15:10:34 2003
@@ -187,6 +187,24 @@ static void __devinit pci_fixup_transpar
                 dev->transparent = 1;
 }
 
+/*
+ * On certain systems with legacy USB support, the USB controller does
+ * access the system memory while we boot, so disconnecting the host
+ * bridge (along with system memory) from PCI bus during the PCI window
+ * sizing causes immediate crash.
+ * To avoid this, clear the MASTER bit before we start probing the BARs.
+ */
+static void __devinit pci_fixup_usb_dma(struct pci_dev *dev)
+{
+ u16 cmd;
+
+ if ((dev->class >> 8) == PCI_CLASS_SERIAL_USB) {
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
+ pci_write_config_word(dev, PCI_COMMAND,
+ cmd & ~PCI_COMMAND_MASTER);
+ }
+}
+
 struct pci_fixup pcibios_fixups[] = {
         { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82451NX, pci_fixup_i450nx },
         { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx },
@@ -205,5 +223,6 @@ struct pci_fixup pcibios_fixups[] = {
         { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug },
         { PCI_FIXUP_HEADER, PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, pci_fixup_ncr53c810 },
         { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_fixup_transparent_bridge },
+ { PCI_FIXUP_EARLY, PCI_ANY_ID, PCI_ANY_ID, pci_fixup_usb_dma },
         { 0 }
 };
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jan 15 2003 - 22:00:28 EST