]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
agp: tidy up handling of scratch pages w.r.t. DMA API
authorDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 27 Jul 2009 15:44:32 +0000 (16:44 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 3 Aug 2009 08:04:52 +0000 (09:04 +0100)
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/char/agp/backend.c
drivers/char/agp/intel-agp.c

index 19ac3663acdcce4d5611882ceda98cd063c27d7e..3c3a487f7b9da3f317ffb05dc1d1a9976b36c96d 100644 (file)
@@ -150,17 +150,20 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)
                }
 
                bridge->scratch_page_real = phys_to_gart(page_to_phys(page));
-               bridge->scratch_page = bridge->driver->mask_memory(bridge,
-                                          phys_to_gart(page_to_phys(page)), 0);
-
-               if (bridge->driver->agp_map_page &&
-                   bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)),
-                                               &bridge->scratch_page_dma)) {
-                       dev_err(&bridge->dev->dev,
-                               "unable to dma-map scratch page\n");
-                       rc = -ENOMEM;
-                       goto err_out_nounmap;
+               if (bridge->driver->agp_map_page) {
+                       if (bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)),
+                                                        &bridge->scratch_page_dma)) {
+                               dev_err(&bridge->dev->dev,
+                                       "unable to dma-map scratch page\n");
+                               rc = -ENOMEM;
+                               goto err_out_nounmap;
+                       }
+               } else {
+                       bridge->scratch_page_dma = phys_to_gart(page_to_phys(page));
                }
+
+               bridge->scratch_page = bridge->driver->mask_memory(bridge,
+                                                  bridge->scratch_page_dma, 0);
        }
 
        size_value = bridge->driver->fetch_size();
index 20fe82b99fdb85ac3f6f859761ecf146ebdf861b..b8f2c75b98d1983e4371de05592d23933d015600 100644 (file)
@@ -1138,13 +1138,9 @@ static int intel_i915_configure(void)
        writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL);
        readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */
 
-#ifndef USE_PCI_DMA_API
-       agp_bridge->scratch_page_dma = agp_bridge->scratch_page;
-#endif
-
        if (agp_bridge->driver->needs_scratch_page) {
                for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
-                       writel(agp_bridge->scratch_page_dma, intel_private.gtt+i);
+                       writel(agp_bridge->scratch_page, intel_private.gtt+i);
                }
                readl(intel_private.gtt+i-1);   /* PCI Posting. */
        }
@@ -1242,7 +1238,7 @@ static int intel_i915_remove_entries(struct agp_memory *mem, off_t pg_start,
        }
 
        for (i = pg_start; i < (mem->page_count + pg_start); i++)
-               writel(agp_bridge->scratch_page_dma, intel_private.gtt+i);
+               writel(agp_bridge->scratch_page, intel_private.gtt+i);
 
        readl(intel_private.gtt+i-1);