aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/powermac/pci.c61
-rw-r--r--include/linux/pci_ids.h1
2 files changed, 62 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 04cdd32624d4..e81403b245b5 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1286,3 +1286,64 @@ static void fixup_k2_sata(struct pci_dev* dev)
1286} 1286}
1287DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, 0x0240, fixup_k2_sata); 1287DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, 0x0240, fixup_k2_sata);
1288 1288
1289/*
1290 * On U4 (aka CPC945) the PCIe root complex "P2P" bridge resource ranges aren't
1291 * configured by the firmware. The bridge itself seems to ignore them but it
1292 * causes problems with Linux which then re-assigns devices below the bridge,
1293 * thus changing addresses of those devices from what was in the device-tree,
1294 * which sucks when those are video cards using offb
1295 *
1296 * We could just mark it transparent but I prefer fixing up the resources to
1297 * properly show what's going on here, as I have some doubts about having them
1298 * badly configured potentially being an issue for DMA.
1299 *
1300 * We leave PIO alone, it seems to be fine
1301 *
1302 * Oh and there's another funny bug. The OF properties advertize the region
1303 * 0xf1000000..0xf1ffffff as being forwarded as memory space. But that's
1304 * actually not true, this region is the memory mapped config space. So we
1305 * also need to filter it out or we'll map things in the wrong place.
1306 */
1307static void fixup_u4_pcie(struct pci_dev* dev)
1308{
1309 struct pci_controller *host = pci_bus_to_host(dev->bus);
1310 struct resource *region = NULL;
1311 u32 reg;
1312 int i;
1313
1314 /* Only do that on PowerMac */
1315 if (!machine_is(powermac))
1316 return;
1317
1318 /* Find the largest MMIO region */
1319 for (i = 0; i < 3; i++) {
1320 struct resource *r = &host->mem_resources[i];
1321 if (!(r->flags & IORESOURCE_MEM))
1322 continue;
1323 /* Skip the 0xf0xxxxxx..f2xxxxxx regions, we know they
1324 * are reserved by HW for other things
1325 */
1326 if (r->start >= 0xf0000000 && r->start < 0xf3000000)
1327 continue;
1328 if (!region || (r->end - r->start) >
1329 (region->end - region->start))
1330 region = r;
1331 }
1332 /* Nothing found, bail */
1333 if (region == 0)
1334 return;
1335
1336 /* Print things out */
1337 printk(KERN_INFO "PCI: Fixup U4 PCIe bridge range: %pR\n", region);
1338
1339 /* Fixup bridge config space. We know it's a Mac, resource aren't
1340 * offset so let's just blast them as-is. We also know that they
1341 * fit in 32 bits
1342 */
1343 reg = ((region->start >> 16) & 0xfff0) | (region->end & 0xfff00000);
1344 pci_write_config_dword(dev, PCI_MEMORY_BASE, reg);
1345 pci_write_config_dword(dev, PCI_PREF_BASE_UPPER32, 0);
1346 pci_write_config_dword(dev, PCI_PREF_LIMIT_UPPER32, 0);
1347 pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0);
1348}
1349DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 73b46b6b904f..c86bb6e3dfcc 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -877,6 +877,7 @@
877#define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051 877#define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051
878#define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058 878#define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058
879#define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059 879#define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059
880#define PCI_DEVICE_ID_APPLE_U4_PCIE 0x005b
880#define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066 881#define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066
881#define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069 882#define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069
882#define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a 883#define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a