aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-04-13 18:29:55 -0400
committerEric Anholt <eric@anholt.net>2010-04-18 20:37:46 -0400
commit22dd82a3f5ceef72be19e502418823a2f8801ed0 (patch)
tree1b346482859af7ea2128d2fd38d42c8e20a226e5 /drivers/char/agp
parent059efc670d1355d0c6cbf817c811ef1241adeed5 (diff)
agp/intel: split out gmch/gtt probe, part 1
This is essentially the last piece of code that's tying intel-gtt.c to intel-agp.c. Extract the probe code into it's own function so that it can be moved to intel-gtt.c. This requires some slight changes in the ordering of device probe function. This patch just implements that for better bisectability in case this introduces bugs. The biggest change is that the gmch/gtt code doesn't execute a pci resource fixup anymore. I've dug around in historical git trees, and this change is to support the agp port on an old HP server with the i440 intel chipset. So only needed for the agp driver. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/char/agp')
-rw-r--r--drivers/char/agp/intel-agp.c73
1 files changed, 44 insertions, 29 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index b5cb192dc6b6..cc494abe195e 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -812,6 +812,41 @@ static const struct intel_driver_description {
812 { 0, 0, NULL, NULL, NULL } 812 { 0, 0, NULL, NULL, NULL }
813}; 813};
814 814
815static int __devinit intel_gmch_probe(struct pci_dev *pdev,
816 struct agp_bridge_data *bridge)
817{
818 int i;
819 bridge->driver = NULL;
820
821 for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
822 if ((intel_agp_chipsets[i].gmch_chip_id != 0) &&
823 find_gmch(intel_agp_chipsets[i].gmch_chip_id)) {
824 bridge->driver =
825 intel_agp_chipsets[i].gmch_driver;
826 break;
827 }
828 }
829
830 if (!bridge->driver)
831 return 0;
832
833 bridge->dev_private_data = &intel_private;
834 bridge->dev = pdev;
835
836 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
837
838 if (bridge->driver->mask_memory == intel_i965_mask_memory) {
839 if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36)))
840 dev_err(&intel_private.pcidev->dev,
841 "set gfx device dma mask 36bit failed!\n");
842 else
843 pci_set_consistent_dma_mask(intel_private.pcidev,
844 DMA_BIT_MASK(36));
845 }
846
847 return 1;
848}
849
815static int __devinit agp_intel_probe(struct pci_dev *pdev, 850static int __devinit agp_intel_probe(struct pci_dev *pdev,
816 const struct pci_device_id *ent) 851 const struct pci_device_id *ent)
817{ 852{
@@ -826,20 +861,18 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
826 if (!bridge) 861 if (!bridge)
827 return -ENOMEM; 862 return -ENOMEM;
828 863
864 bridge->capndx = cap_ptr;
865
866 if (intel_gmch_probe(pdev, bridge))
867 goto found_gmch;
868
829 for (i = 0; intel_agp_chipsets[i].name != NULL; i++) { 869 for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
830 /* In case that multiple models of gfx chip may 870 /* In case that multiple models of gfx chip may
831 stand on same host bridge type, this can be 871 stand on same host bridge type, this can be
832 sure we detect the right IGD. */ 872 sure we detect the right IGD. */
833 if (pdev->device == intel_agp_chipsets[i].chip_id) { 873 if (pdev->device == intel_agp_chipsets[i].chip_id) {
834 if ((intel_agp_chipsets[i].gmch_chip_id != 0) && 874 bridge->driver = intel_agp_chipsets[i].driver;
835 find_gmch(intel_agp_chipsets[i].gmch_chip_id)) { 875 break;
836 bridge->driver =
837 intel_agp_chipsets[i].gmch_driver;
838 break;
839 } else {
840 bridge->driver = intel_agp_chipsets[i].driver;
841 break;
842 }
843 } 876 }
844 } 877 }
845 878
@@ -851,18 +884,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
851 return -ENODEV; 884 return -ENODEV;
852 } 885 }
853 886
854 if (bridge->driver == NULL) {
855 /* bridge has no AGP and no IGD detected */
856 if (cap_ptr)
857 dev_warn(&pdev->dev, "can't find bridge device (chip_id: %04x)\n",
858 intel_agp_chipsets[i].gmch_chip_id);
859 agp_put_bridge(bridge);
860 return -ENODEV;
861 }
862
863 bridge->dev = pdev; 887 bridge->dev = pdev;
864 bridge->capndx = cap_ptr; 888 bridge->dev_private_data = NULL;
865 bridge->dev_private_data = &intel_private;
866 889
867 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); 890 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
868 891
@@ -898,15 +921,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
898 &bridge->mode); 921 &bridge->mode);
899 } 922 }
900 923
901 if (bridge->driver->mask_memory == intel_i965_mask_memory) { 924found_gmch:
902 if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36)))
903 dev_err(&intel_private.pcidev->dev,
904 "set gfx device dma mask 36bit failed!\n");
905 else
906 pci_set_consistent_dma_mask(intel_private.pcidev,
907 DMA_BIT_MASK(36));
908 }
909
910 pci_set_drvdata(pdev, bridge); 925 pci_set_drvdata(pdev, bridge);
911 err = agp_add_bridge(bridge); 926 err = agp_add_bridge(bridge);
912 if (!err) 927 if (!err)