diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/agp/intel-agp.c | 195 | ||||
-rw-r--r-- | drivers/char/agp/intel-gtt.c | 124 |
2 files changed, 147 insertions, 172 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index eab58db5f91c..c818a4d50eab 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -703,177 +703,37 @@ static const struct agp_bridge_driver intel_7505_driver = { | |||
703 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, | 703 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
704 | }; | 704 | }; |
705 | 705 | ||
706 | static int find_gmch(u16 device) | ||
707 | { | ||
708 | struct pci_dev *gmch_device; | ||
709 | |||
710 | gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); | ||
711 | if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) { | ||
712 | gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
713 | device, gmch_device); | ||
714 | } | ||
715 | |||
716 | if (!gmch_device) | ||
717 | return 0; | ||
718 | |||
719 | intel_private.pcidev = gmch_device; | ||
720 | return 1; | ||
721 | } | ||
722 | |||
723 | /* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of | 706 | /* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of |
724 | * driver and gmch_driver must be non-null, and find_gmch will determine | 707 | * driver and gmch_driver must be non-null, and find_gmch will determine |
725 | * which one should be used if a gmch_chip_id is present. | 708 | * which one should be used if a gmch_chip_id is present. |
726 | */ | 709 | */ |
727 | static const struct intel_driver_description { | 710 | static const struct intel_agp_driver_description { |
728 | unsigned int chip_id; | 711 | unsigned int chip_id; |
729 | unsigned int gmch_chip_id; | ||
730 | char *name; | 712 | char *name; |
731 | const struct agp_bridge_driver *driver; | 713 | const struct agp_bridge_driver *driver; |
732 | const struct agp_bridge_driver *gmch_driver; | ||
733 | } intel_agp_chipsets[] = { | 714 | } intel_agp_chipsets[] = { |
734 | { PCI_DEVICE_ID_INTEL_82443LX_0, 0, "440LX", &intel_generic_driver, NULL }, | 715 | { PCI_DEVICE_ID_INTEL_82443LX_0, "440LX", &intel_generic_driver }, |
735 | { PCI_DEVICE_ID_INTEL_82443BX_0, 0, "440BX", &intel_generic_driver, NULL }, | 716 | { PCI_DEVICE_ID_INTEL_82443BX_0, "440BX", &intel_generic_driver }, |
736 | { PCI_DEVICE_ID_INTEL_82443GX_0, 0, "440GX", &intel_generic_driver, NULL }, | 717 | { PCI_DEVICE_ID_INTEL_82443GX_0, "440GX", &intel_generic_driver }, |
737 | { PCI_DEVICE_ID_INTEL_82810_MC1, PCI_DEVICE_ID_INTEL_82810_IG1, "i810", | 718 | { PCI_DEVICE_ID_INTEL_82815_MC, "i815", &intel_815_driver }, |
738 | NULL, &intel_810_driver }, | 719 | { PCI_DEVICE_ID_INTEL_82820_HB, "i820", &intel_820_driver }, |
739 | { PCI_DEVICE_ID_INTEL_82810_MC3, PCI_DEVICE_ID_INTEL_82810_IG3, "i810", | 720 | { PCI_DEVICE_ID_INTEL_82820_UP_HB, "i820", &intel_820_driver }, |
740 | NULL, &intel_810_driver }, | 721 | { PCI_DEVICE_ID_INTEL_82830_HB, "830M", &intel_830mp_driver }, |
741 | { PCI_DEVICE_ID_INTEL_82810E_MC, PCI_DEVICE_ID_INTEL_82810E_IG, "i810", | 722 | { PCI_DEVICE_ID_INTEL_82840_HB, "i840", &intel_840_driver }, |
742 | NULL, &intel_810_driver }, | 723 | { PCI_DEVICE_ID_INTEL_82845_HB, "845G", &intel_845_driver }, |
743 | { PCI_DEVICE_ID_INTEL_82815_MC, PCI_DEVICE_ID_INTEL_82815_CGC, "i815", | 724 | { PCI_DEVICE_ID_INTEL_82845G_HB, "830M", &intel_845_driver }, |
744 | &intel_815_driver, &intel_810_driver }, | 725 | { PCI_DEVICE_ID_INTEL_82850_HB, "i850", &intel_850_driver }, |
745 | { PCI_DEVICE_ID_INTEL_82820_HB, 0, "i820", &intel_820_driver, NULL }, | 726 | { PCI_DEVICE_ID_INTEL_82854_HB, "854", &intel_845_driver }, |
746 | { PCI_DEVICE_ID_INTEL_82820_UP_HB, 0, "i820", &intel_820_driver, NULL }, | 727 | { PCI_DEVICE_ID_INTEL_82855PM_HB, "855PM", &intel_845_driver }, |
747 | { PCI_DEVICE_ID_INTEL_82830_HB, PCI_DEVICE_ID_INTEL_82830_CGC, "830M", | 728 | { PCI_DEVICE_ID_INTEL_82855GM_HB, "855GM", &intel_845_driver }, |
748 | &intel_830mp_driver, &intel_830_driver }, | 729 | { PCI_DEVICE_ID_INTEL_82860_HB, "i860", &intel_860_driver }, |
749 | { PCI_DEVICE_ID_INTEL_82840_HB, 0, "i840", &intel_840_driver, NULL }, | 730 | { PCI_DEVICE_ID_INTEL_82865_HB, "865", &intel_845_driver }, |
750 | { PCI_DEVICE_ID_INTEL_82845_HB, 0, "845G", &intel_845_driver, NULL }, | 731 | { PCI_DEVICE_ID_INTEL_82875_HB, "i875", &intel_845_driver }, |
751 | { PCI_DEVICE_ID_INTEL_82845G_HB, PCI_DEVICE_ID_INTEL_82845G_IG, "830M", | 732 | { PCI_DEVICE_ID_INTEL_7505_0, "E7505", &intel_7505_driver }, |
752 | &intel_845_driver, &intel_830_driver }, | 733 | { PCI_DEVICE_ID_INTEL_7205_0, "E7205", &intel_7505_driver }, |
753 | { PCI_DEVICE_ID_INTEL_82850_HB, 0, "i850", &intel_850_driver, NULL }, | 734 | { 0, NULL, NULL } |
754 | { PCI_DEVICE_ID_INTEL_82854_HB, PCI_DEVICE_ID_INTEL_82854_IG, "854", | ||
755 | &intel_845_driver, &intel_830_driver }, | ||
756 | { PCI_DEVICE_ID_INTEL_82855PM_HB, 0, "855PM", &intel_845_driver, NULL }, | ||
757 | { PCI_DEVICE_ID_INTEL_82855GM_HB, PCI_DEVICE_ID_INTEL_82855GM_IG, "855GM", | ||
758 | &intel_845_driver, &intel_830_driver }, | ||
759 | { PCI_DEVICE_ID_INTEL_82860_HB, 0, "i860", &intel_860_driver, NULL }, | ||
760 | { PCI_DEVICE_ID_INTEL_82865_HB, PCI_DEVICE_ID_INTEL_82865_IG, "865", | ||
761 | &intel_845_driver, &intel_830_driver }, | ||
762 | { PCI_DEVICE_ID_INTEL_82875_HB, 0, "i875", &intel_845_driver, NULL }, | ||
763 | { PCI_DEVICE_ID_INTEL_E7221_HB, PCI_DEVICE_ID_INTEL_E7221_IG, "E7221 (i915)", | ||
764 | NULL, &intel_915_driver }, | ||
765 | { PCI_DEVICE_ID_INTEL_82915G_HB, PCI_DEVICE_ID_INTEL_82915G_IG, "915G", | ||
766 | NULL, &intel_915_driver }, | ||
767 | { PCI_DEVICE_ID_INTEL_82915GM_HB, PCI_DEVICE_ID_INTEL_82915GM_IG, "915GM", | ||
768 | NULL, &intel_915_driver }, | ||
769 | { PCI_DEVICE_ID_INTEL_82945G_HB, PCI_DEVICE_ID_INTEL_82945G_IG, "945G", | ||
770 | NULL, &intel_915_driver }, | ||
771 | { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, "945GM", | ||
772 | NULL, &intel_915_driver }, | ||
773 | { PCI_DEVICE_ID_INTEL_82945GME_HB, PCI_DEVICE_ID_INTEL_82945GME_IG, "945GME", | ||
774 | NULL, &intel_915_driver }, | ||
775 | { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, "946GZ", | ||
776 | NULL, &intel_i965_driver }, | ||
777 | { PCI_DEVICE_ID_INTEL_82G35_HB, PCI_DEVICE_ID_INTEL_82G35_IG, "G35", | ||
778 | NULL, &intel_i965_driver }, | ||
779 | { PCI_DEVICE_ID_INTEL_82965Q_HB, PCI_DEVICE_ID_INTEL_82965Q_IG, "965Q", | ||
780 | NULL, &intel_i965_driver }, | ||
781 | { PCI_DEVICE_ID_INTEL_82965G_HB, PCI_DEVICE_ID_INTEL_82965G_IG, "965G", | ||
782 | NULL, &intel_i965_driver }, | ||
783 | { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, "965GM", | ||
784 | NULL, &intel_i965_driver }, | ||
785 | { PCI_DEVICE_ID_INTEL_82965GME_HB, PCI_DEVICE_ID_INTEL_82965GME_IG, "965GME/GLE", | ||
786 | NULL, &intel_i965_driver }, | ||
787 | { PCI_DEVICE_ID_INTEL_7505_0, 0, "E7505", &intel_7505_driver, NULL }, | ||
788 | { PCI_DEVICE_ID_INTEL_7205_0, 0, "E7205", &intel_7505_driver, NULL }, | ||
789 | { PCI_DEVICE_ID_INTEL_G33_HB, PCI_DEVICE_ID_INTEL_G33_IG, "G33", | ||
790 | NULL, &intel_g33_driver }, | ||
791 | { PCI_DEVICE_ID_INTEL_Q35_HB, PCI_DEVICE_ID_INTEL_Q35_IG, "Q35", | ||
792 | NULL, &intel_g33_driver }, | ||
793 | { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, "Q33", | ||
794 | NULL, &intel_g33_driver }, | ||
795 | { PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB, PCI_DEVICE_ID_INTEL_PINEVIEW_M_IG, "GMA3150", | ||
796 | NULL, &intel_g33_driver }, | ||
797 | { PCI_DEVICE_ID_INTEL_PINEVIEW_HB, PCI_DEVICE_ID_INTEL_PINEVIEW_IG, "GMA3150", | ||
798 | NULL, &intel_g33_driver }, | ||
799 | { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, | ||
800 | "GM45", NULL, &intel_i965_driver }, | ||
801 | { PCI_DEVICE_ID_INTEL_EAGLELAKE_HB, PCI_DEVICE_ID_INTEL_EAGLELAKE_IG, | ||
802 | "Eaglelake", NULL, &intel_i965_driver }, | ||
803 | { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, | ||
804 | "Q45/Q43", NULL, &intel_i965_driver }, | ||
805 | { PCI_DEVICE_ID_INTEL_G45_HB, PCI_DEVICE_ID_INTEL_G45_IG, | ||
806 | "G45/G43", NULL, &intel_i965_driver }, | ||
807 | { PCI_DEVICE_ID_INTEL_B43_HB, PCI_DEVICE_ID_INTEL_B43_IG, | ||
808 | "B43", NULL, &intel_i965_driver }, | ||
809 | { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, | ||
810 | "G41", NULL, &intel_i965_driver }, | ||
811 | { PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG, | ||
812 | "HD Graphics", NULL, &intel_i965_driver }, | ||
813 | { PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, | ||
814 | "HD Graphics", NULL, &intel_i965_driver }, | ||
815 | { PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, | ||
816 | "HD Graphics", NULL, &intel_i965_driver }, | ||
817 | { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, | ||
818 | "HD Graphics", NULL, &intel_i965_driver }, | ||
819 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG, | ||
820 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
821 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG, | ||
822 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
823 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG, | ||
824 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
825 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG, | ||
826 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
827 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG, | ||
828 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
829 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG, | ||
830 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
831 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG, | ||
832 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
833 | { 0, 0, NULL, NULL, NULL } | ||
834 | }; | 735 | }; |
835 | 736 | ||
836 | static int __devinit intel_gmch_probe(struct pci_dev *pdev, | ||
837 | struct agp_bridge_data *bridge) | ||
838 | { | ||
839 | int i, mask; | ||
840 | |||
841 | bridge->driver = NULL; | ||
842 | |||
843 | for (i = 0; intel_agp_chipsets[i].name != NULL; i++) { | ||
844 | if ((intel_agp_chipsets[i].gmch_chip_id != 0) && | ||
845 | find_gmch(intel_agp_chipsets[i].gmch_chip_id)) { | ||
846 | bridge->driver = | ||
847 | intel_agp_chipsets[i].gmch_driver; | ||
848 | break; | ||
849 | } | ||
850 | } | ||
851 | |||
852 | if (!bridge->driver) | ||
853 | return 0; | ||
854 | |||
855 | bridge->dev_private_data = &intel_private; | ||
856 | bridge->dev = pdev; | ||
857 | |||
858 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); | ||
859 | |||
860 | if (bridge->driver->mask_memory == intel_gen6_mask_memory) | ||
861 | mask = 40; | ||
862 | else if (bridge->driver->mask_memory == intel_i965_mask_memory) | ||
863 | mask = 36; | ||
864 | else | ||
865 | mask = 32; | ||
866 | |||
867 | if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(mask))) | ||
868 | dev_err(&intel_private.pcidev->dev, | ||
869 | "set gfx device dma mask %d-bit failed!\n", mask); | ||
870 | else | ||
871 | pci_set_consistent_dma_mask(intel_private.pcidev, | ||
872 | DMA_BIT_MASK(mask)); | ||
873 | |||
874 | return 1; | ||
875 | } | ||
876 | |||
877 | static int __devinit agp_intel_probe(struct pci_dev *pdev, | 737 | static int __devinit agp_intel_probe(struct pci_dev *pdev, |
878 | const struct pci_device_id *ent) | 738 | const struct pci_device_id *ent) |
879 | { | 739 | { |
@@ -903,7 +763,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
903 | } | 763 | } |
904 | } | 764 | } |
905 | 765 | ||
906 | if (intel_agp_chipsets[i].name == NULL) { | 766 | if (!bridge->driver) { |
907 | if (cap_ptr) | 767 | if (cap_ptr) |
908 | dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n", | 768 | dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n", |
909 | pdev->vendor, pdev->device); | 769 | pdev->vendor, pdev->device); |
@@ -911,14 +771,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
911 | return -ENODEV; | 771 | return -ENODEV; |
912 | } | 772 | } |
913 | 773 | ||
914 | if (!bridge->driver) { | ||
915 | if (cap_ptr) | ||
916 | dev_warn(&pdev->dev, "can't find bridge device (chip_id: %04x)\n", | ||
917 | intel_agp_chipsets[i].gmch_chip_id); | ||
918 | agp_put_bridge(bridge); | ||
919 | return -ENODEV; | ||
920 | } | ||
921 | |||
922 | bridge->dev = pdev; | 774 | bridge->dev = pdev; |
923 | bridge->dev_private_data = NULL; | 775 | bridge->dev_private_data = NULL; |
924 | 776 | ||
@@ -970,8 +822,7 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev) | |||
970 | 822 | ||
971 | agp_remove_bridge(bridge); | 823 | agp_remove_bridge(bridge); |
972 | 824 | ||
973 | if (intel_private.pcidev) | 825 | intel_gmch_remove(pdev); |
974 | pci_dev_put(intel_private.pcidev); | ||
975 | 826 | ||
976 | agp_put_bridge(bridge); | 827 | agp_put_bridge(bridge); |
977 | } | 828 | } |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 75e0a3497888..6a89ab8fe605 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -1648,3 +1648,127 @@ static const struct agp_bridge_driver intel_g33_driver = { | |||
1648 | .agp_unmap_memory = intel_agp_unmap_memory, | 1648 | .agp_unmap_memory = intel_agp_unmap_memory, |
1649 | #endif | 1649 | #endif |
1650 | }; | 1650 | }; |
1651 | |||
1652 | /* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of | ||
1653 | * driver and gmch_driver must be non-null, and find_gmch will determine | ||
1654 | * which one should be used if a gmch_chip_id is present. | ||
1655 | */ | ||
1656 | static const struct intel_gtt_driver_description { | ||
1657 | unsigned int gmch_chip_id; | ||
1658 | char *name; | ||
1659 | const struct agp_bridge_driver *gmch_driver; | ||
1660 | } intel_gtt_chipsets[] = { | ||
1661 | { PCI_DEVICE_ID_INTEL_82810_IG1, "i810", &intel_810_driver }, | ||
1662 | { PCI_DEVICE_ID_INTEL_82810_IG3, "i810", &intel_810_driver }, | ||
1663 | { PCI_DEVICE_ID_INTEL_82810E_IG, "i810", &intel_810_driver }, | ||
1664 | { PCI_DEVICE_ID_INTEL_82815_CGC, "i815", &intel_810_driver }, | ||
1665 | { PCI_DEVICE_ID_INTEL_82830_CGC, "830M", &intel_830_driver }, | ||
1666 | { PCI_DEVICE_ID_INTEL_82845G_IG, "830M", &intel_830_driver }, | ||
1667 | { PCI_DEVICE_ID_INTEL_82854_IG, "854", &intel_830_driver }, | ||
1668 | { PCI_DEVICE_ID_INTEL_82855GM_IG, "855GM", &intel_830_driver }, | ||
1669 | { PCI_DEVICE_ID_INTEL_82865_IG, "865", &intel_830_driver }, | ||
1670 | { PCI_DEVICE_ID_INTEL_E7221_IG, "E7221 (i915)", &intel_915_driver }, | ||
1671 | { PCI_DEVICE_ID_INTEL_82915G_IG, "915G", &intel_915_driver }, | ||
1672 | { PCI_DEVICE_ID_INTEL_82915GM_IG, "915GM", &intel_915_driver }, | ||
1673 | { PCI_DEVICE_ID_INTEL_82945G_IG, "945G", &intel_915_driver }, | ||
1674 | { PCI_DEVICE_ID_INTEL_82945GM_IG, "945GM", &intel_915_driver }, | ||
1675 | { PCI_DEVICE_ID_INTEL_82945GME_IG, "945GME", &intel_915_driver }, | ||
1676 | { PCI_DEVICE_ID_INTEL_82946GZ_IG, "946GZ", &intel_i965_driver }, | ||
1677 | { PCI_DEVICE_ID_INTEL_82G35_IG, "G35", &intel_i965_driver }, | ||
1678 | { PCI_DEVICE_ID_INTEL_82965Q_IG, "965Q", &intel_i965_driver }, | ||
1679 | { PCI_DEVICE_ID_INTEL_82965G_IG, "965G", &intel_i965_driver }, | ||
1680 | { PCI_DEVICE_ID_INTEL_82965GM_IG, "965GM", &intel_i965_driver }, | ||
1681 | { PCI_DEVICE_ID_INTEL_82965GME_IG, "965GME/GLE", &intel_i965_driver }, | ||
1682 | { PCI_DEVICE_ID_INTEL_G33_IG, "G33", &intel_g33_driver }, | ||
1683 | { PCI_DEVICE_ID_INTEL_Q35_IG, "Q35", &intel_g33_driver }, | ||
1684 | { PCI_DEVICE_ID_INTEL_Q33_IG, "Q33", &intel_g33_driver }, | ||
1685 | { PCI_DEVICE_ID_INTEL_PINEVIEW_M_IG, "GMA3150", &intel_g33_driver }, | ||
1686 | { PCI_DEVICE_ID_INTEL_PINEVIEW_IG, "GMA3150", &intel_g33_driver }, | ||
1687 | { PCI_DEVICE_ID_INTEL_GM45_IG, "GM45", &intel_i965_driver }, | ||
1688 | { PCI_DEVICE_ID_INTEL_EAGLELAKE_IG, "Eaglelake", &intel_i965_driver }, | ||
1689 | { PCI_DEVICE_ID_INTEL_Q45_IG, "Q45/Q43", &intel_i965_driver }, | ||
1690 | { PCI_DEVICE_ID_INTEL_G45_IG, "G45/G43", &intel_i965_driver }, | ||
1691 | { PCI_DEVICE_ID_INTEL_B43_IG, "B43", &intel_i965_driver }, | ||
1692 | { PCI_DEVICE_ID_INTEL_G41_IG, "G41", &intel_i965_driver }, | ||
1693 | { PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG, | ||
1694 | "HD Graphics", &intel_i965_driver }, | ||
1695 | { PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, | ||
1696 | "HD Graphics", &intel_i965_driver }, | ||
1697 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG, | ||
1698 | "Sandybridge", &intel_gen6_driver }, | ||
1699 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG, | ||
1700 | "Sandybridge", &intel_gen6_driver }, | ||
1701 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG, | ||
1702 | "Sandybridge", &intel_gen6_driver }, | ||
1703 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG, | ||
1704 | "Sandybridge", &intel_gen6_driver }, | ||
1705 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG, | ||
1706 | "Sandybridge", &intel_gen6_driver }, | ||
1707 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG, | ||
1708 | "Sandybridge", &intel_gen6_driver }, | ||
1709 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG, | ||
1710 | "Sandybridge", &intel_gen6_driver }, | ||
1711 | { 0, NULL, NULL } | ||
1712 | }; | ||
1713 | |||
1714 | static int find_gmch(u16 device) | ||
1715 | { | ||
1716 | struct pci_dev *gmch_device; | ||
1717 | |||
1718 | gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); | ||
1719 | if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) { | ||
1720 | gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
1721 | device, gmch_device); | ||
1722 | } | ||
1723 | |||
1724 | if (!gmch_device) | ||
1725 | return 0; | ||
1726 | |||
1727 | intel_private.pcidev = gmch_device; | ||
1728 | return 1; | ||
1729 | } | ||
1730 | |||
1731 | int __devinit intel_gmch_probe(struct pci_dev *pdev, | ||
1732 | struct agp_bridge_data *bridge) | ||
1733 | { | ||
1734 | int i, mask; | ||
1735 | bridge->driver = NULL; | ||
1736 | |||
1737 | for (i = 0; intel_gtt_chipsets[i].name != NULL; i++) { | ||
1738 | if (find_gmch(intel_gtt_chipsets[i].gmch_chip_id)) { | ||
1739 | bridge->driver = | ||
1740 | intel_gtt_chipsets[i].gmch_driver; | ||
1741 | break; | ||
1742 | } | ||
1743 | } | ||
1744 | |||
1745 | if (!bridge->driver) | ||
1746 | return 0; | ||
1747 | |||
1748 | bridge->dev_private_data = &intel_private; | ||
1749 | bridge->dev = pdev; | ||
1750 | |||
1751 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_gtt_chipsets[i].name); | ||
1752 | |||
1753 | if (bridge->driver->mask_memory == intel_gen6_mask_memory) | ||
1754 | mask = 40; | ||
1755 | else if (bridge->driver->mask_memory == intel_i965_mask_memory) | ||
1756 | mask = 36; | ||
1757 | else | ||
1758 | mask = 32; | ||
1759 | |||
1760 | if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(mask))) | ||
1761 | dev_err(&intel_private.pcidev->dev, | ||
1762 | "set gfx device dma mask %d-bit failed!\n", mask); | ||
1763 | else | ||
1764 | pci_set_consistent_dma_mask(intel_private.pcidev, | ||
1765 | DMA_BIT_MASK(mask)); | ||
1766 | |||
1767 | return 1; | ||
1768 | } | ||
1769 | |||
1770 | void __devexit intel_gmch_remove(struct pci_dev *pdev) | ||
1771 | { | ||
1772 | if (intel_private.pcidev) | ||
1773 | pci_dev_put(intel_private.pcidev); | ||
1774 | } | ||