diff options
Diffstat (limited to 'drivers/char/agp/backend.c')
-rw-r--r-- | drivers/char/agp/backend.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 3bd7e503de41..19ac3663acdc 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -152,6 +152,15 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) | |||
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 | bridge->scratch_page = bridge->driver->mask_memory(bridge, |
154 | phys_to_gart(page_to_phys(page)), 0); | 154 | phys_to_gart(page_to_phys(page)), 0); |
155 | |||
156 | if (bridge->driver->agp_map_page && | ||
157 | bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)), | ||
158 | &bridge->scratch_page_dma)) { | ||
159 | dev_err(&bridge->dev->dev, | ||
160 | "unable to dma-map scratch page\n"); | ||
161 | rc = -ENOMEM; | ||
162 | goto err_out_nounmap; | ||
163 | } | ||
155 | } | 164 | } |
156 | 165 | ||
157 | size_value = bridge->driver->fetch_size(); | 166 | size_value = bridge->driver->fetch_size(); |
@@ -191,6 +200,13 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) | |||
191 | return 0; | 200 | return 0; |
192 | 201 | ||
193 | err_out: | 202 | err_out: |
203 | if (bridge->driver->needs_scratch_page && | ||
204 | bridge->driver->agp_unmap_page) { | ||
205 | void *va = gart_to_virt(bridge->scratch_page_real); | ||
206 | |||
207 | bridge->driver->agp_unmap_page(va, bridge->scratch_page_dma); | ||
208 | } | ||
209 | err_out_nounmap: | ||
194 | if (bridge->driver->needs_scratch_page) { | 210 | if (bridge->driver->needs_scratch_page) { |
195 | void *va = gart_to_virt(bridge->scratch_page_real); | 211 | void *va = gart_to_virt(bridge->scratch_page_real); |
196 | 212 | ||
@@ -221,6 +237,10 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge) | |||
221 | bridge->driver->needs_scratch_page) { | 237 | bridge->driver->needs_scratch_page) { |
222 | void *va = gart_to_virt(bridge->scratch_page_real); | 238 | void *va = gart_to_virt(bridge->scratch_page_real); |
223 | 239 | ||
240 | if (bridge->driver->agp_unmap_page) | ||
241 | bridge->driver->agp_unmap_page(va, | ||
242 | bridge->scratch_page_dma); | ||
243 | |||
224 | bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP); | 244 | bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP); |
225 | bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE); | 245 | bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE); |
226 | } | 246 | } |