transparent pci-pci bridges fix
PATCH 1/1 transparent pci-pci bridges fix
Here is 2.4 version of the stuff included in 2.5.34. This
- fixes resource allocation problems on some laptops;
- fixes problems with incorrectly detected "transparent" bridges which is harmful on ppc32, for example.
Ivan.
include/linux/pci.h +3 -0
@@ -382,6 +382,9 @@ struct pci_dev {int ro;/* ISAPnP: read only */ unsigned short regs;/* ISAPnP: supported registers */ +/* These fields are used by common fixups */ + unsigned short transparent:1; /* Transparent PCI bridge */ +int (*prepare)(struct pci_dev *dev);/* ISAPnP hooks */ int (*activate)(struct pci_dev *dev);int (*deactivate)(struct pci_dev *dev);
drivers/pci/pci.c +11 -15
@@ -1131,6 +1131,13 @@ void __devinit pci_read_bridge_bases(strif (!dev)/* It's a host bus, nothing to read */ return ; +if (dev->transparent) { +printk ("Transparent bridge - %s\n" , dev->name); +for (i =0 ; i <4 ; i++) + child->resource[i] = child->parent->resource[i]; +return ; + } +for (i=0 ; i<3 ; i++) child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES +i];
@@ -1153,13 +1160,6 @@ void __devinit pci_read_bridge_bases(str res->start = base; res->end = limit +0xfff ; res->name = child->name; - }else { -/* -* Ugh. We don't know enough about this bridge. Just assume -* that it's entirely transparent. -*/ -printk (KERN_ERR "Unknown bridge resource %d: assuming transparent\n" ,0 ); - child->resource[0 ] = child->parent->resource[0 ]; } res = child->resource[1 ];
@@ -1172,10 +1172,6 @@ void __devinit pci_read_bridge_bases(str res->start = base; res->end = limit +0xfffff ; res->name = child->name; - }else { -/* See comment above. Same thing */ -printk (KERN_ERR "Unknown bridge resource %d: assuming transparent\n" ,1 ); - child->resource[1 ] = child->parent->resource[1 ]; } res = child->resource[2 ];
@@ -1203,10 +1199,6 @@ void __devinit pci_read_bridge_bases(str res->start = base; res->end = limit +0xfffff ; res->name = child->name; - }else { -/* See comments above */ -printk (KERN_ERR "Unknown bridge resource %d: assuming transparent\n" ,2 ); - child->resource[2 ] = child->parent->resource[2 ]; } }
@@ -1392,6 +1384,10 @@ int pci_setup_device(struct pci_dev * decase PCI_HEADER_TYPE_BRIDGE :/* bridge header */ if (class !=PCI_CLASS_BRIDGE_PCI ) goto bad; +/* The PCI-to-PCI bridge spec requires that subtractive +decoding (i.e. transparent) bridge must have programming +interface code of 0x01. */ + dev->transparent = ((class &0xff ) ==1 );pci_read_bases (dev,2 ,PCI_ROM_ADDRESS1 );break ;
drivers/pci/quirks.c +12 -0
@@ -471,6 +471,11 @@ static void __init quirk_dunord ( struct r -> end =0xffffff ; } +static void __init quirk_transparent_bridge (struct pci_dev *dev) +{ + dev->transparent =1 ; +} +/* * The main table of quirks. */
@@ -525,6 +530,13 @@ static struct pci_fixup pci_fixups[] __i { PCI_FIXUP_FINAL, PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7410, quirk_amd_ioapic }, { PCI_FIXUP_FINAL, PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering }, +/* +* i82380FB mobile docking controller: its PCI-to-PCI bridge +* is subtractive decoding (transparent), and does indicate this +* in the ProgIf. Unfortunately, the ProgIf value is wrong - 0x80 +* instead of 0x01. +*/ + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82380FB, quirk_transparent_bridge }, { 0 } };
arch/i386/kernel/pci-pc.c +17 -0
@@ -1307,6 +1307,22 @@ static void __init pci_fixup_via_northbr } } +/* +* For some reasons Intel decided that certain parts of their +* 815, 845 and some other chipsets must look like PCI-to-PCI bridges +* while they are obviously not. The 82801 family (AA, AB, BAM/CAM, +* BA/CA/DB and E) PCI bridges are actually HUB-to-PCI ones, according +* to Intel terminology. These devices do forward all addresses from +* system to PCI bus no matter what are their window settings, so they are +* "transparent" (or subtractive decoding) from programmers point of view. +*/ +static void __init pci_fixup_transparent_bridge (struct pci_dev *dev) +{ +if ((dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && + (dev->device &0xff00 ) ==0x2400 ) + dev->transparent =1 ; +} +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 },
@@ -1321,6 +1337,7 @@ struct pci_fixup pcibios_fixups[] = { { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug }, { 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 }, { 0 } };