aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-07-29 03:39:26 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-08-03 04:04:54 -0400
commitc2980d8c2961113f24863f70d8ad016f55224c81 (patch)
tree642962c363fe11d2ead4caffeaaf712629259dfa /drivers/char/agp
parent56ec4c1e72865c6d99f643b6574e6e074c3e8823 (diff)
agp: Switch agp_{un,}map_page() to take struct page * argument
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/char/agp')
-rw-r--r--drivers/char/agp/agp.h6
-rw-r--r--drivers/char/agp/backend.c17
-rw-r--r--drivers/char/agp/intel-agp.c12
3 files changed, 17 insertions, 18 deletions
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 17e6d0d3ba36..4c6e5079d870 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -122,8 +122,8 @@ struct agp_bridge_driver {
122 int (*agp_type_to_mask_type) (struct agp_bridge_data *, int); 122 int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
123 void (*chipset_flush)(struct agp_bridge_data *); 123 void (*chipset_flush)(struct agp_bridge_data *);
124 124
125 int (*agp_map_page)(void *addr, dma_addr_t *ret); 125 int (*agp_map_page)(struct page *page, dma_addr_t *ret);
126 void (*agp_unmap_page)(void *addr, dma_addr_t dma); 126 void (*agp_unmap_page)(struct page *page, dma_addr_t dma);
127 int (*agp_map_memory)(struct agp_memory *mem); 127 int (*agp_map_memory)(struct agp_memory *mem);
128 void (*agp_unmap_memory)(struct agp_memory *mem); 128 void (*agp_unmap_memory)(struct agp_memory *mem);
129}; 129};
@@ -139,7 +139,7 @@ struct agp_bridge_data {
139 u32 __iomem *gatt_table; 139 u32 __iomem *gatt_table;
140 u32 *gatt_table_real; 140 u32 *gatt_table_real;
141 unsigned long scratch_page; 141 unsigned long scratch_page;
142 unsigned long scratch_page_real; 142 struct page *scratch_page_page;
143 dma_addr_t scratch_page_dma; 143 dma_addr_t scratch_page_dma;
144 unsigned long gart_bus_addr; 144 unsigned long gart_bus_addr;
145 unsigned long gatt_bus_addr; 145 unsigned long gatt_bus_addr;
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index 3c3a487f7b9d..343f102090a0 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -149,9 +149,9 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)
149 return -ENOMEM; 149 return -ENOMEM;
150 } 150 }
151 151
152 bridge->scratch_page_real = phys_to_gart(page_to_phys(page)); 152 bridge->scratch_page_page = page;
153 if (bridge->driver->agp_map_page) { 153 if (bridge->driver->agp_map_page) {
154 if (bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)), 154 if (bridge->driver->agp_map_page(page,
155 &bridge->scratch_page_dma)) { 155 &bridge->scratch_page_dma)) {
156 dev_err(&bridge->dev->dev, 156 dev_err(&bridge->dev->dev,
157 "unable to dma-map scratch page\n"); 157 "unable to dma-map scratch page\n");
@@ -205,13 +205,12 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)
205err_out: 205err_out:
206 if (bridge->driver->needs_scratch_page && 206 if (bridge->driver->needs_scratch_page &&
207 bridge->driver->agp_unmap_page) { 207 bridge->driver->agp_unmap_page) {
208 void *va = gart_to_virt(bridge->scratch_page_real); 208 bridge->driver->agp_unmap_page(bridge->scratch_page_page,
209 209 bridge->scratch_page_dma);
210 bridge->driver->agp_unmap_page(va, bridge->scratch_page_dma);
211 } 210 }
212err_out_nounmap: 211err_out_nounmap:
213 if (bridge->driver->needs_scratch_page) { 212 if (bridge->driver->needs_scratch_page) {
214 void *va = gart_to_virt(bridge->scratch_page_real); 213 void *va = page_address(bridge->scratch_page_page);
215 214
216 bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP); 215 bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP);
217 bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE); 216 bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE);
@@ -238,11 +237,11 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge)
238 237
239 if (bridge->driver->agp_destroy_page && 238 if (bridge->driver->agp_destroy_page &&
240 bridge->driver->needs_scratch_page) { 239 bridge->driver->needs_scratch_page) {
241 void *va = gart_to_virt(bridge->scratch_page_real); 240 void *va = page_address(bridge->scratch_page_page);
242 241
243 if (bridge->driver->agp_unmap_page) 242 if (bridge->driver->agp_unmap_page)
244 bridge->driver->agp_unmap_page(va, 243 bridge->driver->agp_unmap_page(bridge->scratch_page_page,
245 bridge->scratch_page_dma); 244 bridge->scratch_page_dma);
246 245
247 bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP); 246 bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP);
248 bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE); 247 bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE);
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index b8f2c75b98d1..148d7e38fddf 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -181,19 +181,19 @@ static struct _intel_private {
181} intel_private; 181} intel_private;
182 182
183#ifdef USE_PCI_DMA_API 183#ifdef USE_PCI_DMA_API
184static int intel_agp_map_page(void *addr, dma_addr_t *ret) 184static int intel_agp_map_page(struct page *page, dma_addr_t *ret)
185{ 185{
186 *ret = pci_map_single(intel_private.pcidev, addr, 186 *ret = pci_map_page(intel_private.pcidev, page, 0,
187 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); 187 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
188 if (pci_dma_mapping_error(intel_private.pcidev, *ret)) 188 if (pci_dma_mapping_error(intel_private.pcidev, *ret))
189 return -EINVAL; 189 return -EINVAL;
190 return 0; 190 return 0;
191} 191}
192 192
193static void intel_agp_unmap_page(void *addr, dma_addr_t dma) 193static void intel_agp_unmap_page(struct page *page, dma_addr_t dma)
194{ 194{
195 pci_unmap_single(intel_private.pcidev, dma, 195 pci_unmap_page(intel_private.pcidev, dma,
196 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); 196 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
197} 197}
198 198
199static int intel_agp_map_memory(struct agp_memory *mem) 199static int intel_agp_map_memory(struct agp_memory *mem)