diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2009-07-27 11:44:32 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-08-03 04:04:52 -0400 |
commit | 56ec4c1e72865c6d99f643b6574e6e074c3e8823 (patch) | |
tree | 92b34c18f1d5d343d5997ee01cc786016d7f1785 /drivers | |
parent | 176616814d700f19914d8509d9f65dec51a6ebf7 (diff) |
agp: tidy up handling of scratch pages w.r.t. DMA API
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/agp/backend.c | 23 | ||||
-rw-r--r-- | drivers/char/agp/intel-agp.c | 8 |
2 files changed, 15 insertions, 16 deletions
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 19ac3663acdc..3c3a487f7b9d 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -150,17 +150,20 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) | |||
150 | } | 150 | } |
151 | 151 | ||
152 | bridge->scratch_page_real = phys_to_gart(page_to_phys(page)); | 152 | bridge->scratch_page_real = phys_to_gart(page_to_phys(page)); |
153 | bridge->scratch_page = bridge->driver->mask_memory(bridge, | 153 | if (bridge->driver->agp_map_page) { |
154 | phys_to_gart(page_to_phys(page)), 0); | 154 | if (bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)), |
155 | 155 | &bridge->scratch_page_dma)) { | |
156 | if (bridge->driver->agp_map_page && | 156 | dev_err(&bridge->dev->dev, |
157 | bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)), | 157 | "unable to dma-map scratch page\n"); |
158 | &bridge->scratch_page_dma)) { | 158 | rc = -ENOMEM; |
159 | dev_err(&bridge->dev->dev, | 159 | goto err_out_nounmap; |
160 | "unable to dma-map scratch page\n"); | 160 | } |
161 | rc = -ENOMEM; | 161 | } else { |
162 | goto err_out_nounmap; | 162 | bridge->scratch_page_dma = phys_to_gart(page_to_phys(page)); |
163 | } | 163 | } |
164 | |||
165 | bridge->scratch_page = bridge->driver->mask_memory(bridge, | ||
166 | bridge->scratch_page_dma, 0); | ||
164 | } | 167 | } |
165 | 168 | ||
166 | size_value = bridge->driver->fetch_size(); | 169 | size_value = bridge->driver->fetch_size(); |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 20fe82b99fdb..b8f2c75b98d1 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -1138,13 +1138,9 @@ static int intel_i915_configure(void) | |||
1138 | writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); | 1138 | writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); |
1139 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ | 1139 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ |
1140 | 1140 | ||
1141 | #ifndef USE_PCI_DMA_API | ||
1142 | agp_bridge->scratch_page_dma = agp_bridge->scratch_page; | ||
1143 | #endif | ||
1144 | |||
1145 | if (agp_bridge->driver->needs_scratch_page) { | 1141 | if (agp_bridge->driver->needs_scratch_page) { |
1146 | for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { | 1142 | for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { |
1147 | writel(agp_bridge->scratch_page_dma, intel_private.gtt+i); | 1143 | writel(agp_bridge->scratch_page, intel_private.gtt+i); |
1148 | } | 1144 | } |
1149 | readl(intel_private.gtt+i-1); /* PCI Posting. */ | 1145 | readl(intel_private.gtt+i-1); /* PCI Posting. */ |
1150 | } | 1146 | } |
@@ -1242,7 +1238,7 @@ static int intel_i915_remove_entries(struct agp_memory *mem, off_t pg_start, | |||
1242 | } | 1238 | } |
1243 | 1239 | ||
1244 | for (i = pg_start; i < (mem->page_count + pg_start); i++) | 1240 | for (i = pg_start; i < (mem->page_count + pg_start); i++) |
1245 | writel(agp_bridge->scratch_page_dma, intel_private.gtt+i); | 1241 | writel(agp_bridge->scratch_page, intel_private.gtt+i); |
1246 | 1242 | ||
1247 | readl(intel_private.gtt+i-1); | 1243 | readl(intel_private.gtt+i-1); |
1248 | 1244 | ||