diff options
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r-- | drivers/pci/quirks.c | 79 |
1 files changed, 72 insertions, 7 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 0a953d43b9a2..bbad4a9f264f 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -867,13 +867,13 @@ static void quirk_disable_pxb(struct pci_dev *pdev) | |||
867 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb); | 867 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb); |
868 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb); | 868 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb); |
869 | 869 | ||
870 | 870 | static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev) | |
871 | static void __devinit quirk_sb600_sata(struct pci_dev *pdev) | ||
872 | { | 871 | { |
873 | /* set sb600 sata to ahci mode */ | 872 | /* set sb600/sb700/sb800 sata to ahci mode */ |
874 | if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { | 873 | u8 tmp; |
875 | u8 tmp; | ||
876 | 874 | ||
875 | pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp); | ||
876 | if (tmp == 0x01) { | ||
877 | pci_read_config_byte(pdev, 0x40, &tmp); | 877 | pci_read_config_byte(pdev, 0x40, &tmp); |
878 | pci_write_config_byte(pdev, 0x40, tmp|1); | 878 | pci_write_config_byte(pdev, 0x40, tmp|1); |
879 | pci_write_config_byte(pdev, 0x9, 1); | 879 | pci_write_config_byte(pdev, 0x9, 1); |
@@ -881,10 +881,13 @@ static void __devinit quirk_sb600_sata(struct pci_dev *pdev) | |||
881 | pci_write_config_byte(pdev, 0x40, tmp); | 881 | pci_write_config_byte(pdev, 0x40, tmp); |
882 | 882 | ||
883 | pdev->class = PCI_CLASS_STORAGE_SATA_AHCI; | 883 | pdev->class = PCI_CLASS_STORAGE_SATA_AHCI; |
884 | dev_info(&pdev->dev, "set SATA to AHCI mode\n"); | ||
884 | } | 885 | } |
885 | } | 886 | } |
886 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_sb600_sata); | 887 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode); |
887 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_sb600_sata); | 888 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode); |
889 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); | ||
890 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); | ||
888 | 891 | ||
889 | /* | 892 | /* |
890 | * Serverworks CSB5 IDE does not fully support native mode | 893 | * Serverworks CSB5 IDE does not fully support native mode |
@@ -1775,6 +1778,68 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev) | |||
1775 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | 1778 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, |
1776 | quirk_nvidia_ck804_msi_ht_cap); | 1779 | quirk_nvidia_ck804_msi_ht_cap); |
1777 | 1780 | ||
1781 | /* | ||
1782 | * Force enable MSI mapping capability on HT bridges */ | ||
1783 | static inline void ht_enable_msi_mapping(struct pci_dev *dev) | ||
1784 | { | ||
1785 | int pos, ttl = 48; | ||
1786 | |||
1787 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | ||
1788 | while (pos && ttl--) { | ||
1789 | u8 flags; | ||
1790 | |||
1791 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | ||
1792 | &flags) == 0) { | ||
1793 | dev_info(&dev->dev, "Enabling HT MSI Mapping\n"); | ||
1794 | |||
1795 | pci_write_config_byte(dev, pos + HT_MSI_FLAGS, | ||
1796 | flags | HT_MSI_FLAGS_ENABLE); | ||
1797 | } | ||
1798 | pos = pci_find_next_ht_capability(dev, pos, | ||
1799 | HT_CAPTYPE_MSI_MAPPING); | ||
1800 | } | ||
1801 | } | ||
1802 | |||
1803 | static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | ||
1804 | { | ||
1805 | struct pci_dev *host_bridge; | ||
1806 | int pos, ttl = 48; | ||
1807 | |||
1808 | /* | ||
1809 | * HT MSI mapping should be disabled on devices that are below | ||
1810 | * a non-Hypertransport host bridge. Locate the host bridge... | ||
1811 | */ | ||
1812 | host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); | ||
1813 | if (host_bridge == NULL) { | ||
1814 | dev_warn(&dev->dev, | ||
1815 | "nv_msi_ht_cap_quirk didn't locate host bridge\n"); | ||
1816 | return; | ||
1817 | } | ||
1818 | |||
1819 | pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE); | ||
1820 | if (pos != 0) { | ||
1821 | /* Host bridge is to HT */ | ||
1822 | ht_enable_msi_mapping(dev); | ||
1823 | return; | ||
1824 | } | ||
1825 | |||
1826 | /* Host bridge is not to HT, disable HT MSI mapping on this device */ | ||
1827 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | ||
1828 | while (pos && ttl--) { | ||
1829 | u8 flags; | ||
1830 | |||
1831 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | ||
1832 | &flags) == 0) { | ||
1833 | dev_info(&dev->dev, "Quirk disabling HT MSI mapping"); | ||
1834 | pci_write_config_byte(dev, pos + HT_MSI_FLAGS, | ||
1835 | flags & ~HT_MSI_FLAGS_ENABLE); | ||
1836 | } | ||
1837 | pos = pci_find_next_ht_capability(dev, pos, | ||
1838 | HT_CAPTYPE_MSI_MAPPING); | ||
1839 | } | ||
1840 | } | ||
1841 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk); | ||
1842 | |||
1778 | static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev) | 1843 | static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev) |
1779 | { | 1844 | { |
1780 | dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG; | 1845 | dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG; |