aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/agp/intel-agp.c300
1 files changed, 98 insertions, 202 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index e12f579ecf46..dcb6d4f73348 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -1717,41 +1717,92 @@ static const struct agp_bridge_driver intel_7505_driver = {
1717 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1717 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1718}; 1718};
1719 1719
1720static int find_i810(u16 device)
1721{
1722 struct pci_dev *i810_dev;
1723 1720
1724 i810_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); 1721static int find_gmch(u16 device)
1725 if (!i810_dev)
1726 return 0;
1727 intel_private.pcidev = i810_dev;
1728 return 1;
1729}
1730
1731static int find_i830(u16 device)
1732{ 1722{
1733 struct pci_dev *i830_dev; 1723 struct pci_dev *gmch_device;
1734 1724
1735 i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); 1725 gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL);
1736 if (i830_dev && PCI_FUNC(i830_dev->devfn) != 0) { 1726 if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) {
1737 i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 1727 gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL,
1738 device, i830_dev); 1728 device, gmch_device);
1739 } 1729 }
1740 1730
1741 if (!i830_dev) 1731 if (!gmch_device)
1742 return 0; 1732 return 0;
1743 1733
1744 intel_private.pcidev = i830_dev; 1734 intel_private.pcidev = gmch_device;
1745 return 1; 1735 return 1;
1746} 1736}
1747 1737
1738/* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of
1739 * driver and gmch_driver must be non-null, and find_gmch will determine
1740 * which one should be used if a gmch_chip_id is present.
1741 */
1742static const struct intel_driver_description {
1743 unsigned int chip_id;
1744 unsigned int gmch_chip_id;
1745 char *name;
1746 const struct agp_bridge_driver *driver;
1747 const struct agp_bridge_driver *gmch_driver;
1748} intel_agp_chipsets[] = {
1749 { PCI_DEVICE_ID_INTEL_82443LX_0, 0, "440LX", &intel_generic_driver, NULL },
1750 { PCI_DEVICE_ID_INTEL_82443BX_0, 0, "440BX", &intel_generic_driver, NULL },
1751 { PCI_DEVICE_ID_INTEL_82443GX_0, 0, "440GX", &intel_generic_driver, NULL },
1752 { PCI_DEVICE_ID_INTEL_82810_MC1, PCI_DEVICE_ID_INTEL_82810_IG1, "i810",
1753 NULL, &intel_810_driver },
1754 { PCI_DEVICE_ID_INTEL_82810_MC3, PCI_DEVICE_ID_INTEL_82810_IG3, "i810",
1755 NULL, &intel_810_driver },
1756 { PCI_DEVICE_ID_INTEL_82810E_MC, PCI_DEVICE_ID_INTEL_82810E_IG, "i810",
1757 NULL, &intel_810_driver },
1758 { PCI_DEVICE_ID_INTEL_82815_MC, PCI_DEVICE_ID_INTEL_82815_CGC, "i815",
1759 &intel_810_driver, &intel_815_driver },
1760 { PCI_DEVICE_ID_INTEL_82820_HB, 0, "i820", &intel_820_driver, NULL },
1761 { PCI_DEVICE_ID_INTEL_82820_UP_HB, 0, "i820", &intel_820_driver, NULL },
1762 { PCI_DEVICE_ID_INTEL_82830_HB, PCI_DEVICE_ID_INTEL_82830_CGC, "830M",
1763 &intel_830mp_driver, &intel_830_driver },
1764 { PCI_DEVICE_ID_INTEL_82840_HB, 0, "i840", &intel_840_driver, NULL },
1765 { PCI_DEVICE_ID_INTEL_82845_HB, 0, "845G", &intel_845_driver, NULL },
1766 { PCI_DEVICE_ID_INTEL_82845G_HB, PCI_DEVICE_ID_INTEL_82845G_IG, "830M",
1767 &intel_845_driver, &intel_830_driver },
1768 { PCI_DEVICE_ID_INTEL_82850_HB, 0, "i850", &intel_850_driver, NULL },
1769 { PCI_DEVICE_ID_INTEL_82855PM_HB, 0, "855PM", &intel_845_driver, NULL },
1770 { PCI_DEVICE_ID_INTEL_82855GM_HB, PCI_DEVICE_ID_INTEL_82855GM_IG, "855GM",
1771 &intel_845_driver, &intel_830_driver },
1772 { PCI_DEVICE_ID_INTEL_82860_HB, 0, "i860", &intel_860_driver, NULL },
1773 { PCI_DEVICE_ID_INTEL_82865_HB, PCI_DEVICE_ID_INTEL_82865_IG, "865",
1774 &intel_845_driver, &intel_830_driver },
1775 { PCI_DEVICE_ID_INTEL_82875_HB, 0, "i875", &intel_845_driver, NULL },
1776 { PCI_DEVICE_ID_INTEL_82915G_HB, PCI_DEVICE_ID_INTEL_82915G_IG, "915G",
1777 &intel_845_driver, &intel_915_driver },
1778 { PCI_DEVICE_ID_INTEL_82915GM_HB, PCI_DEVICE_ID_INTEL_82915GM_IG, "915GM",
1779 &intel_845_driver, &intel_915_driver },
1780 { PCI_DEVICE_ID_INTEL_82945G_HB, PCI_DEVICE_ID_INTEL_82945G_IG, "945G",
1781 &intel_845_driver, &intel_915_driver },
1782 { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, "945GM",
1783 &intel_845_driver, &intel_915_driver },
1784 { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, "946GZ",
1785 &intel_845_driver, &intel_i965_driver },
1786 { PCI_DEVICE_ID_INTEL_82965G_1_HB, PCI_DEVICE_ID_INTEL_82965G_1_IG, "965G",
1787 &intel_845_driver, &intel_i965_driver },
1788 { PCI_DEVICE_ID_INTEL_82965Q_HB, PCI_DEVICE_ID_INTEL_82965Q_IG, "965Q",
1789 &intel_845_driver, &intel_i965_driver },
1790 { PCI_DEVICE_ID_INTEL_82965G_HB, PCI_DEVICE_ID_INTEL_82965G_IG, "965G",
1791 &intel_845_driver, &intel_i965_driver },
1792 { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, "965GM",
1793 &intel_845_driver, &intel_i965_driver },
1794 { PCI_DEVICE_ID_INTEL_7505_0, 0, "E7505", &intel_7505_driver, NULL },
1795 { PCI_DEVICE_ID_INTEL_7205_0, 0, "E7205", &intel_7505_driver, NULL },
1796 { 0, 0, NULL, NULL, NULL }
1797};
1798
1748static int __devinit agp_intel_probe(struct pci_dev *pdev, 1799static int __devinit agp_intel_probe(struct pci_dev *pdev,
1749 const struct pci_device_id *ent) 1800 const struct pci_device_id *ent)
1750{ 1801{
1751 struct agp_bridge_data *bridge; 1802 struct agp_bridge_data *bridge;
1752 char *name = "(unknown)";
1753 u8 cap_ptr = 0; 1803 u8 cap_ptr = 0;
1754 struct resource *r; 1804 struct resource *r;
1805 int i;
1755 1806
1756 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); 1807 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
1757 1808
@@ -1759,191 +1810,42 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1759 if (!bridge) 1810 if (!bridge)
1760 return -ENOMEM; 1811 return -ENOMEM;
1761 1812
1762 switch (pdev->device) { 1813 for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
1763 case PCI_DEVICE_ID_INTEL_82443LX_0: 1814 /* In case that multiple models of gfx chip may
1764 bridge->driver = &intel_generic_driver; 1815 stand on same host bridge type, this can be
1765 name = "440LX"; 1816 sure we detect the right IGD. */
1766 break; 1817 if ((pdev->device == intel_agp_chipsets[i].chip_id) &&
1767 case PCI_DEVICE_ID_INTEL_82443BX_0: 1818 ((intel_agp_chipsets[i].gmch_chip_id == 0) ||
1768 bridge->driver = &intel_generic_driver; 1819 find_gmch(intel_agp_chipsets[i].gmch_chip_id)))
1769 name = "440BX"; 1820 break;
1770 break; 1821 }
1771 case PCI_DEVICE_ID_INTEL_82443GX_0: 1822
1772 bridge->driver = &intel_generic_driver; 1823 if (intel_agp_chipsets[i].name == NULL) {
1773 name = "440GX";
1774 break;
1775 case PCI_DEVICE_ID_INTEL_82810_MC1:
1776 name = "i810";
1777 if (!find_i810(PCI_DEVICE_ID_INTEL_82810_IG1))
1778 goto fail;
1779 bridge->driver = &intel_810_driver;
1780 break;
1781 case PCI_DEVICE_ID_INTEL_82810_MC3:
1782 name = "i810 DC100";
1783 if (!find_i810(PCI_DEVICE_ID_INTEL_82810_IG3))
1784 goto fail;
1785 bridge->driver = &intel_810_driver;
1786 break;
1787 case PCI_DEVICE_ID_INTEL_82810E_MC:
1788 name = "i810 E";
1789 if (!find_i810(PCI_DEVICE_ID_INTEL_82810E_IG))
1790 goto fail;
1791 bridge->driver = &intel_810_driver;
1792 break;
1793 case PCI_DEVICE_ID_INTEL_82815_MC:
1794 /*
1795 * The i815 can operate either as an i810 style
1796 * integrated device, or as an AGP4X motherboard.
1797 */
1798 if (find_i810(PCI_DEVICE_ID_INTEL_82815_CGC))
1799 bridge->driver = &intel_810_driver;
1800 else
1801 bridge->driver = &intel_815_driver;
1802 name = "i815";
1803 break;
1804 case PCI_DEVICE_ID_INTEL_82820_HB:
1805 case PCI_DEVICE_ID_INTEL_82820_UP_HB:
1806 bridge->driver = &intel_820_driver;
1807 name = "i820";
1808 break;
1809 case PCI_DEVICE_ID_INTEL_82830_HB:
1810 if (find_i830(PCI_DEVICE_ID_INTEL_82830_CGC))
1811 bridge->driver = &intel_830_driver;
1812 else
1813 bridge->driver = &intel_830mp_driver;
1814 name = "830M";
1815 break;
1816 case PCI_DEVICE_ID_INTEL_82840_HB:
1817 bridge->driver = &intel_840_driver;
1818 name = "i840";
1819 break;
1820 case PCI_DEVICE_ID_INTEL_82845_HB:
1821 bridge->driver = &intel_845_driver;
1822 name = "i845";
1823 break;
1824 case PCI_DEVICE_ID_INTEL_82845G_HB:
1825 if (find_i830(PCI_DEVICE_ID_INTEL_82845G_IG))
1826 bridge->driver = &intel_830_driver;
1827 else
1828 bridge->driver = &intel_845_driver;
1829 name = "845G";
1830 break;
1831 case PCI_DEVICE_ID_INTEL_82850_HB:
1832 bridge->driver = &intel_850_driver;
1833 name = "i850";
1834 break;
1835 case PCI_DEVICE_ID_INTEL_82855PM_HB:
1836 bridge->driver = &intel_845_driver;
1837 name = "855PM";
1838 break;
1839 case PCI_DEVICE_ID_INTEL_82855GM_HB:
1840 if (find_i830(PCI_DEVICE_ID_INTEL_82855GM_IG)) {
1841 bridge->driver = &intel_830_driver;
1842 name = "855";
1843 } else {
1844 bridge->driver = &intel_845_driver;
1845 name = "855GM";
1846 }
1847 break;
1848 case PCI_DEVICE_ID_INTEL_82860_HB:
1849 bridge->driver = &intel_860_driver;
1850 name = "i860";
1851 break;
1852 case PCI_DEVICE_ID_INTEL_82865_HB:
1853 if (find_i830(PCI_DEVICE_ID_INTEL_82865_IG))
1854 bridge->driver = &intel_830_driver;
1855 else
1856 bridge->driver = &intel_845_driver;
1857 name = "865";
1858 break;
1859 case PCI_DEVICE_ID_INTEL_82875_HB:
1860 bridge->driver = &intel_845_driver;
1861 name = "i875";
1862 break;
1863 case PCI_DEVICE_ID_INTEL_82915G_HB:
1864 if (find_i830(PCI_DEVICE_ID_INTEL_82915G_IG))
1865 bridge->driver = &intel_915_driver;
1866 else
1867 bridge->driver = &intel_845_driver;
1868 name = "915G";
1869 break;
1870 case PCI_DEVICE_ID_INTEL_82915GM_HB:
1871 if (find_i830(PCI_DEVICE_ID_INTEL_82915GM_IG))
1872 bridge->driver = &intel_915_driver;
1873 else
1874 bridge->driver = &intel_845_driver;
1875 name = "915GM";
1876 break;
1877 case PCI_DEVICE_ID_INTEL_82945G_HB:
1878 if (find_i830(PCI_DEVICE_ID_INTEL_82945G_IG))
1879 bridge->driver = &intel_915_driver;
1880 else
1881 bridge->driver = &intel_845_driver;
1882 name = "945G";
1883 break;
1884 case PCI_DEVICE_ID_INTEL_82945GM_HB:
1885 if (find_i830(PCI_DEVICE_ID_INTEL_82945GM_IG))
1886 bridge->driver = &intel_915_driver;
1887 else
1888 bridge->driver = &intel_845_driver;
1889 name = "945GM";
1890 break;
1891 case PCI_DEVICE_ID_INTEL_82946GZ_HB:
1892 if (find_i830(PCI_DEVICE_ID_INTEL_82946GZ_IG))
1893 bridge->driver = &intel_i965_driver;
1894 else
1895 bridge->driver = &intel_845_driver;
1896 name = "946GZ";
1897 break;
1898 case PCI_DEVICE_ID_INTEL_82965G_1_HB:
1899 if (find_i830(PCI_DEVICE_ID_INTEL_82965G_1_IG))
1900 bridge->driver = &intel_i965_driver;
1901 else
1902 bridge->driver = &intel_845_driver;
1903 name = "965G";
1904 break;
1905 case PCI_DEVICE_ID_INTEL_82965Q_HB:
1906 if (find_i830(PCI_DEVICE_ID_INTEL_82965Q_IG))
1907 bridge->driver = &intel_i965_driver;
1908 else
1909 bridge->driver = &intel_845_driver;
1910 name = "965Q";
1911 break;
1912 case PCI_DEVICE_ID_INTEL_82965G_HB:
1913 if (find_i830(PCI_DEVICE_ID_INTEL_82965G_IG))
1914 bridge->driver = &intel_i965_driver;
1915 else
1916 bridge->driver = &intel_845_driver;
1917 name = "965G";
1918 break;
1919 case PCI_DEVICE_ID_INTEL_82965GM_HB:
1920 if (find_i830(PCI_DEVICE_ID_INTEL_82965GM_IG))
1921 bridge->driver = &intel_i965_driver;
1922 else
1923 bridge->driver = &intel_845_driver;
1924 name = "965GM";
1925 break;
1926 case PCI_DEVICE_ID_INTEL_7505_0:
1927 bridge->driver = &intel_7505_driver;
1928 name = "E7505";
1929 break;
1930 case PCI_DEVICE_ID_INTEL_7205_0:
1931 bridge->driver = &intel_7505_driver;
1932 name = "E7205";
1933 break;
1934 default:
1935 if (cap_ptr) 1824 if (cap_ptr)
1936 printk(KERN_WARNING PFX "Unsupported Intel chipset (device id: %04x)\n", 1825 printk(KERN_WARNING PFX "Unsupported Intel chipset"
1937 pdev->device); 1826 "(device id: %04x)\n", pdev->device);
1938 agp_put_bridge(bridge); 1827 agp_put_bridge(bridge);
1939 return -ENODEV; 1828 return -ENODEV;
1940 }; 1829 }
1830
1831 if (intel_agp_chipsets[i].gmch_chip_id != 0)
1832 bridge->driver = intel_agp_chipsets[i].gmch_driver;
1833 else
1834 bridge->driver = intel_agp_chipsets[i].driver;
1835
1836 if (bridge->driver == NULL) {
1837 printk(KERN_WARNING PFX "Failed to find bridge device "
1838 "(chip_id: %04x)\n", intel_agp_chipsets[i].gmch_chip_id);
1839 agp_put_bridge(bridge);
1840 return -ENODEV;
1841 }
1941 1842
1942 bridge->dev = pdev; 1843 bridge->dev = pdev;
1943 bridge->capndx = cap_ptr; 1844 bridge->capndx = cap_ptr;
1944 bridge->dev_private_data = &intel_private; 1845 bridge->dev_private_data = &intel_private;
1945 1846
1946 printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n", name); 1847 printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n",
1848 intel_agp_chipsets[i].name);
1947 1849
1948 /* 1850 /*
1949 * The following fixes the case where the BIOS has "forgotten" to 1851 * The following fixes the case where the BIOS has "forgotten" to
@@ -1979,12 +1881,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1979 1881
1980 pci_set_drvdata(pdev, bridge); 1882 pci_set_drvdata(pdev, bridge);
1981 return agp_add_bridge(bridge); 1883 return agp_add_bridge(bridge);
1982
1983fail:
1984 printk(KERN_ERR PFX "Detected an Intel %s chipset, "
1985 "but could not find the secondary device.\n", name);
1986 agp_put_bridge(bridge);
1987 return -ENODEV;
1988} 1884}
1989 1885
1990static void __devexit agp_intel_remove(struct pci_dev *pdev) 1886static void __devexit agp_intel_remove(struct pci_dev *pdev)