diff options
Diffstat (limited to 'drivers/char/agp/intel-agp.c')
-rw-r--r-- | drivers/char/agp/intel-agp.c | 200 |
1 files changed, 23 insertions, 177 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index cd18493c9527..5cd2221ab472 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -12,9 +12,6 @@ | |||
12 | #include <asm/smp.h> | 12 | #include <asm/smp.h> |
13 | #include "agp.h" | 13 | #include "agp.h" |
14 | #include "intel-agp.h" | 14 | #include "intel-agp.h" |
15 | #include <linux/intel-gtt.h> | ||
16 | |||
17 | #include "intel-gtt.c" | ||
18 | 15 | ||
19 | int intel_agp_enabled; | 16 | int intel_agp_enabled; |
20 | EXPORT_SYMBOL(intel_agp_enabled); | 17 | EXPORT_SYMBOL(intel_agp_enabled); |
@@ -703,179 +700,37 @@ static const struct agp_bridge_driver intel_7505_driver = { | |||
703 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, | 700 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
704 | }; | 701 | }; |
705 | 702 | ||
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 | 703 | /* 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 | 704 | * 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. | 705 | * which one should be used if a gmch_chip_id is present. |
726 | */ | 706 | */ |
727 | static const struct intel_driver_description { | 707 | static const struct intel_agp_driver_description { |
728 | unsigned int chip_id; | 708 | unsigned int chip_id; |
729 | unsigned int gmch_chip_id; | ||
730 | char *name; | 709 | char *name; |
731 | const struct agp_bridge_driver *driver; | 710 | const struct agp_bridge_driver *driver; |
732 | const struct agp_bridge_driver *gmch_driver; | ||
733 | } intel_agp_chipsets[] = { | 711 | } intel_agp_chipsets[] = { |
734 | { PCI_DEVICE_ID_INTEL_82443LX_0, 0, "440LX", &intel_generic_driver, NULL }, | 712 | { PCI_DEVICE_ID_INTEL_82443LX_0, "440LX", &intel_generic_driver }, |
735 | { PCI_DEVICE_ID_INTEL_82443BX_0, 0, "440BX", &intel_generic_driver, NULL }, | 713 | { PCI_DEVICE_ID_INTEL_82443BX_0, "440BX", &intel_generic_driver }, |
736 | { PCI_DEVICE_ID_INTEL_82443GX_0, 0, "440GX", &intel_generic_driver, NULL }, | 714 | { PCI_DEVICE_ID_INTEL_82443GX_0, "440GX", &intel_generic_driver }, |
737 | { PCI_DEVICE_ID_INTEL_82810_MC1, PCI_DEVICE_ID_INTEL_82810_IG1, "i810", | 715 | { PCI_DEVICE_ID_INTEL_82815_MC, "i815", &intel_815_driver }, |
738 | NULL, &intel_810_driver }, | 716 | { PCI_DEVICE_ID_INTEL_82820_HB, "i820", &intel_820_driver }, |
739 | { PCI_DEVICE_ID_INTEL_82810_MC3, PCI_DEVICE_ID_INTEL_82810_IG3, "i810", | 717 | { PCI_DEVICE_ID_INTEL_82820_UP_HB, "i820", &intel_820_driver }, |
740 | NULL, &intel_810_driver }, | 718 | { PCI_DEVICE_ID_INTEL_82830_HB, "830M", &intel_830mp_driver }, |
741 | { PCI_DEVICE_ID_INTEL_82810E_MC, PCI_DEVICE_ID_INTEL_82810E_IG, "i810", | 719 | { PCI_DEVICE_ID_INTEL_82840_HB, "i840", &intel_840_driver }, |
742 | NULL, &intel_810_driver }, | 720 | { PCI_DEVICE_ID_INTEL_82845_HB, "845G", &intel_845_driver }, |
743 | { PCI_DEVICE_ID_INTEL_82815_MC, PCI_DEVICE_ID_INTEL_82815_CGC, "i815", | 721 | { PCI_DEVICE_ID_INTEL_82845G_HB, "830M", &intel_845_driver }, |
744 | &intel_815_driver, &intel_810_driver }, | 722 | { PCI_DEVICE_ID_INTEL_82850_HB, "i850", &intel_850_driver }, |
745 | { PCI_DEVICE_ID_INTEL_82820_HB, 0, "i820", &intel_820_driver, NULL }, | 723 | { PCI_DEVICE_ID_INTEL_82854_HB, "854", &intel_845_driver }, |
746 | { PCI_DEVICE_ID_INTEL_82820_UP_HB, 0, "i820", &intel_820_driver, NULL }, | 724 | { PCI_DEVICE_ID_INTEL_82855PM_HB, "855PM", &intel_845_driver }, |
747 | { PCI_DEVICE_ID_INTEL_82830_HB, PCI_DEVICE_ID_INTEL_82830_CGC, "830M", | 725 | { PCI_DEVICE_ID_INTEL_82855GM_HB, "855GM", &intel_845_driver }, |
748 | &intel_830mp_driver, &intel_830_driver }, | 726 | { PCI_DEVICE_ID_INTEL_82860_HB, "i860", &intel_860_driver }, |
749 | { PCI_DEVICE_ID_INTEL_82840_HB, 0, "i840", &intel_840_driver, NULL }, | 727 | { PCI_DEVICE_ID_INTEL_82865_HB, "865", &intel_845_driver }, |
750 | { PCI_DEVICE_ID_INTEL_82845_HB, 0, "845G", &intel_845_driver, NULL }, | 728 | { PCI_DEVICE_ID_INTEL_82875_HB, "i875", &intel_845_driver }, |
751 | { PCI_DEVICE_ID_INTEL_82845G_HB, PCI_DEVICE_ID_INTEL_82845G_IG, "830M", | 729 | { PCI_DEVICE_ID_INTEL_7505_0, "E7505", &intel_7505_driver }, |
752 | &intel_845_driver, &intel_830_driver }, | 730 | { PCI_DEVICE_ID_INTEL_7205_0, "E7205", &intel_7505_driver }, |
753 | { PCI_DEVICE_ID_INTEL_82850_HB, 0, "i850", &intel_850_driver, NULL }, | 731 | { 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_B43_1_HB, PCI_DEVICE_ID_INTEL_B43_1_IG, | ||
810 | "B43", NULL, &intel_i965_driver }, | ||
811 | { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, | ||
812 | "G41", NULL, &intel_i965_driver }, | ||
813 | { PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG, | ||
814 | "HD Graphics", NULL, &intel_i965_driver }, | ||
815 | { PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, | ||
816 | "HD Graphics", NULL, &intel_i965_driver }, | ||
817 | { PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, | ||
818 | "HD Graphics", NULL, &intel_i965_driver }, | ||
819 | { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, | ||
820 | "HD Graphics", NULL, &intel_i965_driver }, | ||
821 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG, | ||
822 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
823 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG, | ||
824 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
825 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG, | ||
826 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
827 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG, | ||
828 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
829 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG, | ||
830 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
831 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG, | ||
832 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
833 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG, | ||
834 | "Sandybridge", NULL, &intel_gen6_driver }, | ||
835 | { 0, 0, NULL, NULL, NULL } | ||
836 | }; | 732 | }; |
837 | 733 | ||
838 | static int __devinit intel_gmch_probe(struct pci_dev *pdev, | ||
839 | struct agp_bridge_data *bridge) | ||
840 | { | ||
841 | int i, mask; | ||
842 | |||
843 | bridge->driver = NULL; | ||
844 | |||
845 | for (i = 0; intel_agp_chipsets[i].name != NULL; i++) { | ||
846 | if ((intel_agp_chipsets[i].gmch_chip_id != 0) && | ||
847 | find_gmch(intel_agp_chipsets[i].gmch_chip_id)) { | ||
848 | bridge->driver = | ||
849 | intel_agp_chipsets[i].gmch_driver; | ||
850 | break; | ||
851 | } | ||
852 | } | ||
853 | |||
854 | if (!bridge->driver) | ||
855 | return 0; | ||
856 | |||
857 | bridge->dev_private_data = &intel_private; | ||
858 | bridge->dev = pdev; | ||
859 | |||
860 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); | ||
861 | |||
862 | if (bridge->driver->mask_memory == intel_gen6_mask_memory) | ||
863 | mask = 40; | ||
864 | else if (bridge->driver->mask_memory == intel_i965_mask_memory) | ||
865 | mask = 36; | ||
866 | else | ||
867 | mask = 32; | ||
868 | |||
869 | if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(mask))) | ||
870 | dev_err(&intel_private.pcidev->dev, | ||
871 | "set gfx device dma mask %d-bit failed!\n", mask); | ||
872 | else | ||
873 | pci_set_consistent_dma_mask(intel_private.pcidev, | ||
874 | DMA_BIT_MASK(mask)); | ||
875 | |||
876 | return 1; | ||
877 | } | ||
878 | |||
879 | static int __devinit agp_intel_probe(struct pci_dev *pdev, | 734 | static int __devinit agp_intel_probe(struct pci_dev *pdev, |
880 | const struct pci_device_id *ent) | 735 | const struct pci_device_id *ent) |
881 | { | 736 | { |
@@ -905,7 +760,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
905 | } | 760 | } |
906 | } | 761 | } |
907 | 762 | ||
908 | if (intel_agp_chipsets[i].name == NULL) { | 763 | if (!bridge->driver) { |
909 | if (cap_ptr) | 764 | if (cap_ptr) |
910 | dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n", | 765 | dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n", |
911 | pdev->vendor, pdev->device); | 766 | pdev->vendor, pdev->device); |
@@ -913,14 +768,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
913 | return -ENODEV; | 768 | return -ENODEV; |
914 | } | 769 | } |
915 | 770 | ||
916 | if (!bridge->driver) { | ||
917 | if (cap_ptr) | ||
918 | dev_warn(&pdev->dev, "can't find bridge device (chip_id: %04x)\n", | ||
919 | intel_agp_chipsets[i].gmch_chip_id); | ||
920 | agp_put_bridge(bridge); | ||
921 | return -ENODEV; | ||
922 | } | ||
923 | |||
924 | bridge->dev = pdev; | 771 | bridge->dev = pdev; |
925 | bridge->dev_private_data = NULL; | 772 | bridge->dev_private_data = NULL; |
926 | 773 | ||
@@ -972,8 +819,7 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev) | |||
972 | 819 | ||
973 | agp_remove_bridge(bridge); | 820 | agp_remove_bridge(bridge); |
974 | 821 | ||
975 | if (intel_private.pcidev) | 822 | intel_gmch_remove(pdev); |
976 | pci_dev_put(intel_private.pcidev); | ||
977 | 823 | ||
978 | agp_put_bridge(bridge); | 824 | agp_put_bridge(bridge); |
979 | } | 825 | } |