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.c107
1 files changed, 42 insertions, 65 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 23b599d6a9d5..5b4483811691 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -453,6 +453,12 @@ static void __devinit quirk_ich6_lpc_acpi(struct pci_dev *dev)
453} 453}
454DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, quirk_ich6_lpc_acpi ); 454DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, quirk_ich6_lpc_acpi );
455DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, quirk_ich6_lpc_acpi ); 455DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, quirk_ich6_lpc_acpi );
456DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, quirk_ich6_lpc_acpi );
457DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, quirk_ich6_lpc_acpi );
458DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk_ich6_lpc_acpi );
459DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi );
460DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi );
461DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi );
456 462
457/* 463/*
458 * VIA ACPI: One IO region pointed to by longword at 464 * VIA ACPI: One IO region pointed to by longword at
@@ -648,11 +654,43 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vi
648 * Some of the on-chip devices are actually '586 devices' so they are 654 * Some of the on-chip devices are actually '586 devices' so they are
649 * listed here. 655 * listed here.
650 */ 656 */
657
658static int via_irq_fixup_needed = -1;
659
660/*
661 * As some VIA hardware is available in PCI-card form, we need to restrict
662 * this quirk to VIA PCI hardware built onto VIA-based motherboards only.
663 * We try to locate a VIA southbridge before deciding whether the quirk
664 * should be applied.
665 */
666static const struct pci_device_id via_irq_fixup_tbl[] = {
667 {
668 .vendor = PCI_VENDOR_ID_VIA,
669 .device = PCI_ANY_ID,
670 .subvendor = PCI_ANY_ID,
671 .subdevice = PCI_ANY_ID,
672 .class = PCI_CLASS_BRIDGE_ISA << 8,
673 .class_mask = 0xffff00,
674 },
675 { 0, },
676};
677
651static void quirk_via_irq(struct pci_dev *dev) 678static void quirk_via_irq(struct pci_dev *dev)
652{ 679{
653 u8 irq, new_irq; 680 u8 irq, new_irq;
654 681
655 new_irq = dev->irq & 0xf; 682 if (via_irq_fixup_needed == -1)
683 via_irq_fixup_needed = pci_dev_present(via_irq_fixup_tbl);
684
685 if (!via_irq_fixup_needed)
686 return;
687
688 new_irq = dev->irq;
689
690 /* Don't quirk interrupts outside the legacy IRQ range */
691 if (!new_irq || new_irq > 15)
692 return;
693
656 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq); 694 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
657 if (new_irq != irq) { 695 if (new_irq != irq) {
658 printk(KERN_INFO "PCI: VIA IRQ fixup for %s, from %d to %d\n", 696 printk(KERN_INFO "PCI: VIA IRQ fixup for %s, from %d to %d\n",
@@ -661,14 +699,7 @@ static void quirk_via_irq(struct pci_dev *dev)
661 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq); 699 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);
662 } 700 }
663} 701}
664DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_via_irq); 702DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_irq);
665DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq);
666DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq);
667DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq);
668DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235_USB_2, quirk_via_irq);
669DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq);
670DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq);
671DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq);
672 703
673/* 704/*
674 * VIA VT82C598 has its device ID settable and many BIOSes 705 * VIA VT82C598 has its device ID settable and many BIOSes
@@ -683,33 +714,6 @@ static void __devinit quirk_vt82c598_id(struct pci_dev *dev)
683} 714}
684DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id ); 715DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id );
685 716
686#ifdef CONFIG_ACPI_SLEEP
687
688/*
689 * Some VIA systems boot with the abnormal status flag set. This can cause
690 * the BIOS to re-POST the system on resume rather than passing control
691 * back to the OS. Clear the flag on boot
692 */
693static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev)
694{
695 u32 reg;
696
697 acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
698 &reg);
699
700 if (reg & 0x800) {
701 printk("Clearing abnormal poweroff flag\n");
702 acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
703 ACPI_REGISTER_PM1_STATUS,
704 (u16)0x800);
705 }
706}
707
708DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff);
709DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff);
710
711#endif
712
713/* 717/*
714 * CardBus controllers have a legacy base address that enables them 718 * CardBus controllers have a legacy base address that enables them
715 * to respond as i82365 pcmcia controllers. We don't want them to 719 * to respond as i82365 pcmcia controllers. We don't want them to
@@ -1456,33 +1460,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2609, quirk_intel_pcie_pm);
1456DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260a, quirk_intel_pcie_pm); 1460DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260a, quirk_intel_pcie_pm);
1457DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260b, quirk_intel_pcie_pm); 1461DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260b, quirk_intel_pcie_pm);
1458 1462
1459/*
1460 * Fixup the cardbus bridges on the IBM Dock II docking station
1461 */
1462static void __devinit quirk_ibm_dock2_cardbus(struct pci_dev *dev)
1463{
1464 u32 val;
1465
1466 /*
1467 * tie the 2 interrupt pins to INTA, and configure the
1468 * multifunction routing register to handle this.
1469 */
1470 if ((dev->subsystem_vendor == PCI_VENDOR_ID_IBM) &&
1471 (dev->subsystem_device == 0x0148)) {
1472 printk(KERN_INFO "PCI: Found IBM Dock II Cardbus Bridge "
1473 "applying quirk\n");
1474 pci_read_config_dword(dev, 0x8c, &val);
1475 val = ((val & 0xffffff00) | 0x1002);
1476 pci_write_config_dword(dev, 0x8c, val);
1477 pci_read_config_dword(dev, 0x80, &val);
1478 val = ((val & 0x00ffff00) | 0x2864c077);
1479 pci_write_config_dword(dev, 0x80, val);
1480 }
1481}
1482
1483DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1420,
1484 quirk_ibm_dock2_cardbus);
1485
1486static void __devinit quirk_netmos(struct pci_dev *dev) 1463static void __devinit quirk_netmos(struct pci_dev *dev)
1487{ 1464{
1488 unsigned int num_parallel = (dev->subsystem_device & 0xf0) >> 4; 1465 unsigned int num_parallel = (dev->subsystem_device & 0xf0) >> 4;
@@ -1588,7 +1565,6 @@ static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
1588} 1565}
1589DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); 1566DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
1590 1567
1591
1592static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) 1568static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end)
1593{ 1569{
1594 while (f < end) { 1570 while (f < end) {
@@ -1764,7 +1740,7 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1764 /* check HT MSI cap on this chipset and the root one. 1740 /* check HT MSI cap on this chipset and the root one.
1765 * a single one having MSI is enough to be sure that MSI are supported. 1741 * a single one having MSI is enough to be sure that MSI are supported.
1766 */ 1742 */
1767 pdev = pci_find_slot(dev->bus->number, 0); 1743 pdev = pci_get_slot(dev->bus, 0);
1768 if (dev->subordinate && !msi_ht_cap_enabled(dev) 1744 if (dev->subordinate && !msi_ht_cap_enabled(dev)
1769 && !msi_ht_cap_enabled(pdev)) { 1745 && !msi_ht_cap_enabled(pdev)) {
1770 printk(KERN_WARNING "PCI: MSI quirk detected. " 1746 printk(KERN_WARNING "PCI: MSI quirk detected. "
@@ -1772,6 +1748,7 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1772 pci_name(dev)); 1748 pci_name(dev));
1773 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; 1749 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
1774 } 1750 }
1751 pci_dev_put(pdev);
1775} 1752}
1776DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, 1753DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1777 quirk_nvidia_ck804_msi_ht_cap); 1754 quirk_nvidia_ck804_msi_ht_cap);