diff options
Diffstat (limited to 'drivers/pci/quirks.c')
| -rw-r--r-- | drivers/pci/quirks.c | 104 |
1 files changed, 89 insertions, 15 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index def78a2a7c15..08cd86a6dd66 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -577,8 +577,6 @@ static void __init quirk_ioapic_rmw(struct pci_dev *dev) | |||
| 577 | } | 577 | } |
| 578 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_ANY_ID, quirk_ioapic_rmw ); | 578 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_ANY_ID, quirk_ioapic_rmw ); |
| 579 | 579 | ||
| 580 | int pci_msi_quirk; | ||
| 581 | |||
| 582 | #define AMD8131_revA0 0x01 | 580 | #define AMD8131_revA0 0x01 |
| 583 | #define AMD8131_revB0 0x11 | 581 | #define AMD8131_revB0 0x11 |
| 584 | #define AMD8131_MISC 0x40 | 582 | #define AMD8131_MISC 0x40 |
| @@ -587,12 +585,6 @@ static void __init quirk_amd_8131_ioapic(struct pci_dev *dev) | |||
| 587 | { | 585 | { |
| 588 | unsigned char revid, tmp; | 586 | unsigned char revid, tmp; |
| 589 | 587 | ||
| 590 | if (dev->subordinate) { | ||
| 591 | printk(KERN_WARNING "PCI: MSI quirk detected. " | ||
| 592 | "PCI_BUS_FLAGS_NO_MSI set for subordinate bus.\n"); | ||
| 593 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; | ||
| 594 | } | ||
| 595 | |||
| 596 | if (nr_ioapics == 0) | 588 | if (nr_ioapics == 0) |
| 597 | return; | 589 | return; |
| 598 | 590 | ||
| @@ -605,13 +597,6 @@ static void __init quirk_amd_8131_ioapic(struct pci_dev *dev) | |||
| 605 | } | 597 | } |
| 606 | } | 598 | } |
| 607 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic); | 599 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic); |
| 608 | |||
| 609 | static void __init quirk_svw_msi(struct pci_dev *dev) | ||
| 610 | { | ||
| 611 | pci_msi_quirk = 1; | ||
| 612 | printk(KERN_WARNING "PCI: MSI quirk detected. pci_msi_quirk set.\n"); | ||
| 613 | } | ||
| 614 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi ); | ||
| 615 | #endif /* CONFIG_X86_IO_APIC */ | 600 | #endif /* CONFIG_X86_IO_APIC */ |
| 616 | 601 | ||
| 617 | 602 | ||
| @@ -1690,6 +1675,95 @@ static void __devinit quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev) | |||
| 1690 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | 1675 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, |
| 1691 | quirk_nvidia_ck804_pcie_aer_ext_cap); | 1676 | quirk_nvidia_ck804_pcie_aer_ext_cap); |
| 1692 | 1677 | ||
| 1678 | #ifdef CONFIG_PCI_MSI | ||
| 1679 | /* To disable MSI globally */ | ||
| 1680 | int pci_msi_quirk; | ||
| 1681 | |||
| 1682 | /* The Serverworks PCI-X chipset does not support MSI. We cannot easily rely | ||
| 1683 | * on setting PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually | ||
| 1684 | * some other busses controlled by the chipset even if Linux is not aware of it. | ||
| 1685 | * Instead of setting the flag on all busses in the machine, simply disable MSI | ||
| 1686 | * globally. | ||
| 1687 | */ | ||
| 1688 | static void __init quirk_svw_msi(struct pci_dev *dev) | ||
| 1689 | { | ||
| 1690 | pci_msi_quirk = 1; | ||
| 1691 | printk(KERN_WARNING "PCI: MSI quirk detected. pci_msi_quirk set.\n"); | ||
| 1692 | } | ||
| 1693 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi); | ||
| 1694 | |||
| 1695 | /* Disable MSI on chipsets that are known to not support it */ | ||
| 1696 | static void __devinit quirk_disable_msi(struct pci_dev *dev) | ||
| 1697 | { | ||
| 1698 | if (dev->subordinate) { | ||
| 1699 | printk(KERN_WARNING "PCI: MSI quirk detected. " | ||
| 1700 | "PCI_BUS_FLAGS_NO_MSI set for %s subordinate bus.\n", | ||
| 1701 | pci_name(dev)); | ||
| 1702 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; | ||
| 1703 | } | ||
| 1704 | } | ||
| 1705 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); | ||
| 1706 | |||
| 1707 | /* Go through the list of Hypertransport capabilities and | ||
| 1708 | * return 1 if a HT MSI capability is found and enabled */ | ||
| 1709 | static int __devinit msi_ht_cap_enabled(struct pci_dev *dev) | ||
| 1710 | { | ||
| 1711 | u8 pos; | ||
| 1712 | int ttl; | ||
| 1713 | for (pos = pci_find_capability(dev, PCI_CAP_ID_HT), ttl = 48; | ||
| 1714 | pos && ttl; | ||
| 1715 | pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_HT), ttl--) { | ||
| 1716 | u32 cap_hdr; | ||
| 1717 | /* MSI mapping section according to Hypertransport spec */ | ||
| 1718 | if (pci_read_config_dword(dev, pos, &cap_hdr) == 0 | ||
| 1719 | && (cap_hdr & 0xf8000000) == 0xa8000000 /* MSI mapping */) { | ||
| 1720 | printk(KERN_INFO "PCI: Found HT MSI mapping on %s with capability %s\n", | ||
| 1721 | pci_name(dev), cap_hdr & 0x10000 ? "enabled" : "disabled"); | ||
| 1722 | return (cap_hdr & 0x10000) != 0; /* MSI mapping cap enabled */ | ||
| 1723 | } | ||
| 1724 | } | ||
| 1725 | return 0; | ||
| 1726 | } | ||
| 1727 | |||
| 1728 | /* Check the hypertransport MSI mapping to know whether MSI is enabled or not */ | ||
| 1729 | static void __devinit quirk_msi_ht_cap(struct pci_dev *dev) | ||
| 1730 | { | ||
| 1731 | if (dev->subordinate && !msi_ht_cap_enabled(dev)) { | ||
| 1732 | printk(KERN_WARNING "PCI: MSI quirk detected. " | ||
| 1733 | "MSI disabled on chipset %s.\n", | ||
| 1734 | pci_name(dev)); | ||
| 1735 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; | ||
| 1736 | } | ||
| 1737 | } | ||
| 1738 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, | ||
| 1739 | quirk_msi_ht_cap); | ||
| 1740 | |||
| 1741 | /* The nVidia CK804 chipset may have 2 HT MSI mappings. | ||
| 1742 | * MSI are supported if the MSI capability set in any of these mappings. | ||
| 1743 | */ | ||
| 1744 | static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev) | ||
| 1745 | { | ||
| 1746 | struct pci_dev *pdev; | ||
| 1747 | |||
| 1748 | if (!dev->subordinate) | ||
| 1749 | return; | ||
| 1750 | |||
| 1751 | /* check HT MSI cap on this chipset and the root one. | ||
| 1752 | * a single one having MSI is enough to be sure that MSI are supported. | ||
| 1753 | */ | ||
| 1754 | pdev = pci_find_slot(dev->bus->number, 0); | ||
| 1755 | if (dev->subordinate && !msi_ht_cap_enabled(dev) | ||
| 1756 | && !msi_ht_cap_enabled(pdev)) { | ||
| 1757 | printk(KERN_WARNING "PCI: MSI quirk detected. " | ||
| 1758 | "MSI disabled on chipset %s.\n", | ||
| 1759 | pci_name(dev)); | ||
| 1760 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; | ||
| 1761 | } | ||
| 1762 | } | ||
| 1763 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | ||
| 1764 | quirk_nvidia_ck804_msi_ht_cap); | ||
| 1765 | #endif /* CONFIG_PCI_MSI */ | ||
| 1766 | |||
| 1693 | EXPORT_SYMBOL(pcie_mch_quirk); | 1767 | EXPORT_SYMBOL(pcie_mch_quirk); |
| 1694 | #ifdef CONFIG_HOTPLUG | 1768 | #ifdef CONFIG_HOTPLUG |
| 1695 | EXPORT_SYMBOL(pci_fixup_device); | 1769 | EXPORT_SYMBOL(pci_fixup_device); |
