aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/quirks.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r--drivers/pci/quirks.c216
1 files changed, 150 insertions, 66 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 857ae01734a6..02145e9697a9 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -226,6 +226,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82439TX, quir
226 * VIA Apollo KT133 needs PCI latency patch 226 * VIA Apollo KT133 needs PCI latency patch
227 * Made according to a windows driver based patch by George E. Breese 227 * Made according to a windows driver based patch by George E. Breese
228 * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm 228 * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
229 * and http://www.georgebreese.com/net/software/#PCI
229 * Also see http://www.au-ja.org/review-kt133a-1-en.phtml for 230 * Also see http://www.au-ja.org/review-kt133a-1-en.phtml for
230 * the info on which Mr Breese based his work. 231 * the info on which Mr Breese based his work.
231 * 232 *
@@ -262,7 +263,7 @@ static void quirk_vialatency(struct pci_dev *dev)
262 * This happens to include the IDE controllers.... 263 * This happens to include the IDE controllers....
263 * 264 *
264 * VIA only apply this fix when an SB Live! is present but under 265 * VIA only apply this fix when an SB Live! is present but under
265 * both Linux and Windows this isnt enough, and we have seen 266 * both Linux and Windows this isn't enough, and we have seen
266 * corruption without SB Live! but with things like 3 UDMA IDE 267 * corruption without SB Live! but with things like 3 UDMA IDE
267 * controllers. So we ignore that bit of the VIA recommendation.. 268 * controllers. So we ignore that bit of the VIA recommendation..
268 */ 269 */
@@ -532,6 +533,17 @@ static void __devinit quirk_piix4_acpi(struct pci_dev *dev)
532DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi); 533DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi);
533DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quirk_piix4_acpi); 534DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quirk_piix4_acpi);
534 535
536#define ICH_PMBASE 0x40
537#define ICH_ACPI_CNTL 0x44
538#define ICH4_ACPI_EN 0x10
539#define ICH6_ACPI_EN 0x80
540#define ICH4_GPIOBASE 0x58
541#define ICH4_GPIO_CNTL 0x5c
542#define ICH4_GPIO_EN 0x10
543#define ICH6_GPIOBASE 0x48
544#define ICH6_GPIO_CNTL 0x4c
545#define ICH6_GPIO_EN 0x10
546
535/* 547/*
536 * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at 548 * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at
537 * 0x40 (128 bytes of ACPI, GPIO & TCO registers) 549 * 0x40 (128 bytes of ACPI, GPIO & TCO registers)
@@ -540,12 +552,33 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, qui
540static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev) 552static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev)
541{ 553{
542 u32 region; 554 u32 region;
555 u8 enable;
543 556
544 pci_read_config_dword(dev, 0x40, &region); 557 /*
545 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH4 ACPI/GPIO/TCO"); 558 * The check for PCIBIOS_MIN_IO is to ensure we won't create a conflict
559 * with low legacy (and fixed) ports. We don't know the decoding
560 * priority and can't tell whether the legacy device or the one created
561 * here is really at that address. This happens on boards with broken
562 * BIOSes.
563 */
564
565 pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
566 if (enable & ICH4_ACPI_EN) {
567 pci_read_config_dword(dev, ICH_PMBASE, &region);
568 region &= PCI_BASE_ADDRESS_IO_MASK;
569 if (region >= PCIBIOS_MIN_IO)
570 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
571 "ICH4 ACPI/GPIO/TCO");
572 }
546 573
547 pci_read_config_dword(dev, 0x58, &region); 574 pci_read_config_byte(dev, ICH4_GPIO_CNTL, &enable);
548 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH4 GPIO"); 575 if (enable & ICH4_GPIO_EN) {
576 pci_read_config_dword(dev, ICH4_GPIOBASE, &region);
577 region &= PCI_BASE_ADDRESS_IO_MASK;
578 if (region >= PCIBIOS_MIN_IO)
579 quirk_io_region(dev, region, 64,
580 PCI_BRIDGE_RESOURCES + 1, "ICH4 GPIO");
581 }
549} 582}
550DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi); 583DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi);
551DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi); 584DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi);
@@ -561,12 +594,25 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, qui
561static void __devinit ich6_lpc_acpi_gpio(struct pci_dev *dev) 594static void __devinit ich6_lpc_acpi_gpio(struct pci_dev *dev)
562{ 595{
563 u32 region; 596 u32 region;
597 u8 enable;
564 598
565 pci_read_config_dword(dev, 0x40, &region); 599 pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
566 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH6 ACPI/GPIO/TCO"); 600 if (enable & ICH6_ACPI_EN) {
601 pci_read_config_dword(dev, ICH_PMBASE, &region);
602 region &= PCI_BASE_ADDRESS_IO_MASK;
603 if (region >= PCIBIOS_MIN_IO)
604 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
605 "ICH6 ACPI/GPIO/TCO");
606 }
567 607
568 pci_read_config_dword(dev, 0x48, &region); 608 pci_read_config_byte(dev, ICH6_GPIO_CNTL, &enable);
569 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH6 GPIO"); 609 if (enable & ICH6_GPIO_EN) {
610 pci_read_config_dword(dev, ICH6_GPIOBASE, &region);
611 region &= PCI_BASE_ADDRESS_IO_MASK;
612 if (region >= PCIBIOS_MIN_IO)
613 quirk_io_region(dev, region, 64,
614 PCI_BRIDGE_RESOURCES + 1, "ICH6 GPIO");
615 }
570} 616}
571 617
572static void __devinit ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize) 618static void __devinit ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize)
@@ -635,7 +681,7 @@ static void __devinit ich7_lpc_generic_decode(struct pci_dev *dev, unsigned reg,
635/* ICH7-10 has the same common LPC generic IO decode registers */ 681/* ICH7-10 has the same common LPC generic IO decode registers */
636static void __devinit quirk_ich7_lpc(struct pci_dev *dev) 682static void __devinit quirk_ich7_lpc(struct pci_dev *dev)
637{ 683{
638 /* We share the common ACPI/DPIO decode with ICH6 */ 684 /* We share the common ACPI/GPIO decode with ICH6 */
639 ich6_lpc_acpi_gpio(dev); 685 ich6_lpc_acpi_gpio(dev);
640 686
641 /* And have 4 ICH7+ generic decodes */ 687 /* And have 4 ICH7+ generic decodes */
@@ -1016,7 +1062,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA, 0x605, quirk_transparent_bridge)
1016/* 1062/*
1017 * Common misconfiguration of the MediaGX/Geode PCI master that will 1063 * Common misconfiguration of the MediaGX/Geode PCI master that will
1018 * reduce PCI bandwidth from 70MB/s to 25MB/s. See the GXM/GXLV/GX1 1064 * reduce PCI bandwidth from 70MB/s to 25MB/s. See the GXM/GXLV/GX1
1019 * datasheets found at http://www.national.com/ds/GX for info on what 1065 * datasheets found at http://www.national.com/analog for info on what
1020 * these bits do. <christer@weinigel.se> 1066 * these bits do. <christer@weinigel.se>
1021 */ 1067 */
1022static void quirk_mediagx_master(struct pci_dev *dev) 1068static void quirk_mediagx_master(struct pci_dev *dev)
@@ -2135,6 +2181,24 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82865_HB,
2135DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82875_HB, 2181DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82875_HB,
2136 quirk_unhide_mch_dev6); 2182 quirk_unhide_mch_dev6);
2137 2183
2184#ifdef CONFIG_TILE
2185/*
2186 * The Tilera TILEmpower platform needs to set the link speed
2187 * to 2.5GT(Giga-Transfers)/s (Gen 1). The default link speed
2188 * setting is 5GT/s (Gen 2). 0x98 is the Link Control2 PCIe
2189 * capability register of the PEX8624 PCIe switch. The switch
2190 * supports link speed auto negotiation, but falsely sets
2191 * the link speed to 5GT/s.
2192 */
2193static void __devinit quirk_tile_plx_gen1(struct pci_dev *dev)
2194{
2195 if (tile_plx_gen1) {
2196 pci_write_config_dword(dev, 0x98, 0x1);
2197 mdelay(50);
2198 }
2199}
2200DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8624, quirk_tile_plx_gen1);
2201#endif /* CONFIG_TILE */
2138 2202
2139#ifdef CONFIG_PCI_MSI 2203#ifdef CONFIG_PCI_MSI
2140/* Some chipsets do not support MSI. We cannot easily rely on setting 2204/* Some chipsets do not support MSI. We cannot easily rely on setting
@@ -2285,8 +2349,11 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE,
2285 */ 2349 */
2286static void __devinit nvenet_msi_disable(struct pci_dev *dev) 2350static void __devinit nvenet_msi_disable(struct pci_dev *dev)
2287{ 2351{
2288 if (dmi_name_in_vendors("P5N32-SLI PREMIUM") || 2352 const char *board_name = dmi_get_system_info(DMI_BOARD_NAME);
2289 dmi_name_in_vendors("P5N32-E SLI")) { 2353
2354 if (board_name &&
2355 (strstr(board_name, "P5N32-SLI PREMIUM") ||
2356 strstr(board_name, "P5N32-E SLI"))) {
2290 dev_info(&dev->dev, 2357 dev_info(&dev->dev,
2291 "Disabling msi for MCP55 NIC on P5N32-SLI\n"); 2358 "Disabling msi for MCP55 NIC on P5N32-SLI\n");
2292 dev->no_msi = 1; 2359 dev->no_msi = 1;
@@ -2296,6 +2363,40 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA,
2296 PCI_DEVICE_ID_NVIDIA_NVENET_15, 2363 PCI_DEVICE_ID_NVIDIA_NVENET_15,
2297 nvenet_msi_disable); 2364 nvenet_msi_disable);
2298 2365
2366/*
2367 * Some versions of the MCP55 bridge from nvidia have a legacy irq routing
2368 * config register. This register controls the routing of legacy interrupts
2369 * from devices that route through the MCP55. If this register is misprogramed
2370 * interrupts are only sent to the bsp, unlike conventional systems where the
2371 * irq is broadxast to all online cpus. Not having this register set
2372 * properly prevents kdump from booting up properly, so lets make sure that
2373 * we have it set correctly.
2374 * Note this is an undocumented register.
2375 */
2376static void __devinit nvbridge_check_legacy_irq_routing(struct pci_dev *dev)
2377{
2378 u32 cfg;
2379
2380 if (!pci_find_capability(dev, PCI_CAP_ID_HT))
2381 return;
2382
2383 pci_read_config_dword(dev, 0x74, &cfg);
2384
2385 if (cfg & ((1 << 2) | (1 << 15))) {
2386 printk(KERN_INFO "Rewriting irq routing register on MCP55\n");
2387 cfg &= ~((1 << 2) | (1 << 15));
2388 pci_write_config_dword(dev, 0x74, cfg);
2389 }
2390}
2391
2392DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA,
2393 PCI_DEVICE_ID_NVIDIA_MCP55_BRIDGE_V0,
2394 nvbridge_check_legacy_irq_routing);
2395
2396DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA,
2397 PCI_DEVICE_ID_NVIDIA_MCP55_BRIDGE_V4,
2398 nvbridge_check_legacy_irq_routing);
2399
2299static int __devinit ht_check_msi_mapping(struct pci_dev *dev) 2400static int __devinit ht_check_msi_mapping(struct pci_dev *dev)
2300{ 2401{
2301 int pos, ttl = 48; 2402 int pos, ttl = 48;
@@ -2565,58 +2666,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375,
2565 2666
2566#endif /* CONFIG_PCI_MSI */ 2667#endif /* CONFIG_PCI_MSI */
2567 2668
2568#ifdef CONFIG_PCI_IOV
2569
2570/*
2571 * For Intel 82576 SR-IOV NIC, if BIOS doesn't allocate resources for the
2572 * SR-IOV BARs, zero the Flash BAR and program the SR-IOV BARs to use the
2573 * old Flash Memory Space.
2574 */
2575static void __devinit quirk_i82576_sriov(struct pci_dev *dev)
2576{
2577 int pos, flags;
2578 u32 bar, start, size;
2579
2580 if (PAGE_SIZE > 0x10000)
2581 return;
2582
2583 flags = pci_resource_flags(dev, 0);
2584 if ((flags & PCI_BASE_ADDRESS_SPACE) !=
2585 PCI_BASE_ADDRESS_SPACE_MEMORY ||
2586 (flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) !=
2587 PCI_BASE_ADDRESS_MEM_TYPE_32)
2588 return;
2589
2590 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV);
2591 if (!pos)
2592 return;
2593
2594 pci_read_config_dword(dev, pos + PCI_SRIOV_BAR, &bar);
2595 if (bar & PCI_BASE_ADDRESS_MEM_MASK)
2596 return;
2597
2598 start = pci_resource_start(dev, 1);
2599 size = pci_resource_len(dev, 1);
2600 if (!start || size != 0x400000 || start & (size - 1))
2601 return;
2602
2603 pci_resource_flags(dev, 1) = 0;
2604 pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0);
2605 pci_write_config_dword(dev, pos + PCI_SRIOV_BAR, start);
2606 pci_write_config_dword(dev, pos + PCI_SRIOV_BAR + 12, start + size / 2);
2607
2608 dev_info(&dev->dev, "use Flash Memory Space for SR-IOV BARs\n");
2609}
2610DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10c9, quirk_i82576_sriov);
2611DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e6, quirk_i82576_sriov);
2612DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e7, quirk_i82576_sriov);
2613DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e8, quirk_i82576_sriov);
2614DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x150a, quirk_i82576_sriov);
2615DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x150d, quirk_i82576_sriov);
2616DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1518, quirk_i82576_sriov);
2617
2618#endif /* CONFIG_PCI_IOV */
2619
2620/* Allow manual resource allocation for PCI hotplug bridges 2669/* Allow manual resource allocation for PCI hotplug bridges
2621 * via pci=hpmemsize=nnM and pci=hpiosize=nnM parameters. For 2670 * via pci=hpmemsize=nnM and pci=hpiosize=nnM parameters. For
2622 * some PCI-PCI hotplug bridges, like PLX 6254 (former HINT HB6), 2671 * some PCI-PCI hotplug bridges, like PLX 6254 (former HINT HB6),
@@ -2634,7 +2683,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
2634 * This is a quirk for the Ricoh MMC controller found as a part of 2683 * This is a quirk for the Ricoh MMC controller found as a part of
2635 * some mulifunction chips. 2684 * some mulifunction chips.
2636 2685
2637 * This is very similiar and based on the ricoh_mmc driver written by 2686 * This is very similar and based on the ricoh_mmc driver written by
2638 * Philip Langdale. Thank you for these magic sequences. 2687 * Philip Langdale. Thank you for these magic sequences.
2639 * 2688 *
2640 * These chips implement the four main memory card controllers (SD, MMC, MS, xD) 2689 * These chips implement the four main memory card controllers (SD, MMC, MS, xD)
@@ -2712,8 +2761,43 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2712} 2761}
2713DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2762DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2714DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2763DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2764DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2765DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2715#endif /*CONFIG_MMC_RICOH_MMC*/ 2766#endif /*CONFIG_MMC_RICOH_MMC*/
2716 2767
2768#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
2769#define VTUNCERRMSK_REG 0x1ac
2770#define VTD_MSK_SPEC_ERRORS (1 << 31)
2771/*
2772 * This is a quirk for masking vt-d spec defined errors to platform error
2773 * handling logic. With out this, platforms using Intel 7500, 5500 chipsets
2774 * (and the derivative chipsets like X58 etc) seem to generate NMI/SMI (based
2775 * on the RAS config settings of the platform) when a vt-d fault happens.
2776 * The resulting SMI caused the system to hang.
2777 *
2778 * VT-d spec related errors are already handled by the VT-d OS code, so no
2779 * need to report the same error through other channels.
2780 */
2781static void vtd_mask_spec_errors(struct pci_dev *dev)
2782{
2783 u32 word;
2784
2785 pci_read_config_dword(dev, VTUNCERRMSK_REG, &word);
2786 pci_write_config_dword(dev, VTUNCERRMSK_REG, word | VTD_MSK_SPEC_ERRORS);
2787}
2788DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x342e, vtd_mask_spec_errors);
2789DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors);
2790#endif
2791
2792static void __devinit fixup_ti816x_class(struct pci_dev* dev)
2793{
2794 /* TI 816x devices do not have class code set when in PCIe boot mode */
2795 if (dev->class == PCI_CLASS_NOT_DEFINED) {
2796 dev_info(&dev->dev, "Setting PCI class for 816x PCIe device\n");
2797 dev->class = PCI_CLASS_MULTIMEDIA_VIDEO;
2798 }
2799}
2800DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_TI, 0xb800, fixup_ti816x_class);
2717 2801
2718static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, 2802static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
2719 struct pci_fixup *end) 2803 struct pci_fixup *end)