]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/char/agp/intel-agp.c
agp/intel: set 40-bit dma mask on Sandybridge
[net-next-2.6.git] / drivers / char / agp / intel-agp.c
index d836a71bf06db79f5df5b1fb1ddbd6b79e660081..ab1903955ac0728b9e0c1a2edd8c81d507b49264 100644 (file)
@@ -816,16 +816,17 @@ static const struct intel_driver_description {
        { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG,
            "HD Graphics", NULL, &intel_i965_driver },
        { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG,
-           "Sandybridge", NULL, &intel_i965_driver },
+           "Sandybridge", NULL, &intel_gen6_driver },
        { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG,
-           "Sandybridge", NULL, &intel_i965_driver },
+           "Sandybridge", NULL, &intel_gen6_driver },
        { 0, 0, NULL, NULL, NULL }
 };
 
 static int __devinit intel_gmch_probe(struct pci_dev *pdev,
                                      struct agp_bridge_data *bridge)
 {
-       int i;
+       int i, mask;
+
        bridge->driver = NULL;
 
        for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
@@ -845,14 +846,19 @@ static int __devinit intel_gmch_probe(struct pci_dev *pdev,
 
        dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
 
-       if (bridge->driver->mask_memory == intel_i965_mask_memory) {
-               if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36)))
-                       dev_err(&intel_private.pcidev->dev,
-                               "set gfx device dma mask 36bit failed!\n");
-               else
-                       pci_set_consistent_dma_mask(intel_private.pcidev,
-                                                   DMA_BIT_MASK(36));
-       }
+       if (bridge->driver->mask_memory == intel_gen6_mask_memory)
+               mask = 40;
+       else if (bridge->driver->mask_memory == intel_i965_mask_memory)
+               mask = 36;
+       else
+               mask = 32;
+
+       if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(mask)))
+               dev_err(&intel_private.pcidev->dev,
+                       "set gfx device dma mask %d-bit failed!\n", mask);
+       else
+               pci_set_consistent_dma_mask(intel_private.pcidev,
+                                           DMA_BIT_MASK(mask));
 
        return 1;
 }
@@ -907,6 +913,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
 
        dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
 
+       /*
+       * If the device has not been properly setup, the following will catch
+       * the problem and should stop the system from crashing.
+       * 20030610 - hamish@zot.org
+       */
+       if (pci_enable_device(pdev)) {
+               dev_err(&pdev->dev, "can't enable PCI device\n");
+               agp_put_bridge(bridge);
+               return -ENODEV;
+       }
+
        /*
        * The following fixes the case where the BIOS has "forgotten" to
        * provide an address range for the GART.
@@ -921,17 +938,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
                }
        }
 
-       /*
-       * If the device has not been properly setup, the following will catch
-       * the problem and should stop the system from crashing.
-       * 20030610 - hamish@zot.org
-       */
-       if (pci_enable_device(pdev)) {
-               dev_err(&pdev->dev, "can't enable PCI device\n");
-               agp_put_bridge(bridge);
-               return -ENODEV;
-       }
-
        /* Fill in the mode register */
        if (cap_ptr) {
                pci_read_config_dword(pdev,