Commit c2980d8c authored by David Woodhouse's avatar David Woodhouse

agp: Switch agp_{un,}map_page() to take struct page * argument

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 56ec4c1e
...@@ -122,8 +122,8 @@ struct agp_bridge_driver { ...@@ -122,8 +122,8 @@ struct agp_bridge_driver {
int (*agp_type_to_mask_type) (struct agp_bridge_data *, int); int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
void (*chipset_flush)(struct agp_bridge_data *); void (*chipset_flush)(struct agp_bridge_data *);
int (*agp_map_page)(void *addr, dma_addr_t *ret); int (*agp_map_page)(struct page *page, dma_addr_t *ret);
void (*agp_unmap_page)(void *addr, dma_addr_t dma); void (*agp_unmap_page)(struct page *page, dma_addr_t dma);
int (*agp_map_memory)(struct agp_memory *mem); int (*agp_map_memory)(struct agp_memory *mem);
void (*agp_unmap_memory)(struct agp_memory *mem); void (*agp_unmap_memory)(struct agp_memory *mem);
}; };
...@@ -139,7 +139,7 @@ struct agp_bridge_data { ...@@ -139,7 +139,7 @@ struct agp_bridge_data {
u32 __iomem *gatt_table; u32 __iomem *gatt_table;
u32 *gatt_table_real; u32 *gatt_table_real;
unsigned long scratch_page; unsigned long scratch_page;
unsigned long scratch_page_real; struct page *scratch_page_page;
dma_addr_t scratch_page_dma; dma_addr_t scratch_page_dma;
unsigned long gart_bus_addr; unsigned long gart_bus_addr;
unsigned long gatt_bus_addr; unsigned long gatt_bus_addr;
......
...@@ -149,9 +149,9 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) ...@@ -149,9 +149,9 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)
return -ENOMEM; return -ENOMEM;
} }
bridge->scratch_page_real = phys_to_gart(page_to_phys(page)); bridge->scratch_page_page = page;
if (bridge->driver->agp_map_page) { if (bridge->driver->agp_map_page) {
if (bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)), if (bridge->driver->agp_map_page(page,
&bridge->scratch_page_dma)) { &bridge->scratch_page_dma)) {
dev_err(&bridge->dev->dev, dev_err(&bridge->dev->dev,
"unable to dma-map scratch page\n"); "unable to dma-map scratch page\n");
...@@ -205,13 +205,12 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) ...@@ -205,13 +205,12 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)
err_out: err_out:
if (bridge->driver->needs_scratch_page && if (bridge->driver->needs_scratch_page &&
bridge->driver->agp_unmap_page) { bridge->driver->agp_unmap_page) {
void *va = gart_to_virt(bridge->scratch_page_real); bridge->driver->agp_unmap_page(bridge->scratch_page_page,
bridge->scratch_page_dma);
bridge->driver->agp_unmap_page(va, bridge->scratch_page_dma);
} }
err_out_nounmap: err_out_nounmap:
if (bridge->driver->needs_scratch_page) { if (bridge->driver->needs_scratch_page) {
void *va = gart_to_virt(bridge->scratch_page_real); void *va = page_address(bridge->scratch_page_page);
bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP); bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP);
bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE); 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,11 +237,11 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge)
if (bridge->driver->agp_destroy_page && if (bridge->driver->agp_destroy_page &&
bridge->driver->needs_scratch_page) { bridge->driver->needs_scratch_page) {
void *va = gart_to_virt(bridge->scratch_page_real); void *va = page_address(bridge->scratch_page_page);
if (bridge->driver->agp_unmap_page) if (bridge->driver->agp_unmap_page)
bridge->driver->agp_unmap_page(va, bridge->driver->agp_unmap_page(bridge->scratch_page_page,
bridge->scratch_page_dma); bridge->scratch_page_dma);
bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP); bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP);
bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE); bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE);
......
...@@ -181,19 +181,19 @@ static struct _intel_private { ...@@ -181,19 +181,19 @@ static struct _intel_private {
} intel_private; } intel_private;
#ifdef USE_PCI_DMA_API #ifdef USE_PCI_DMA_API
static int intel_agp_map_page(void *addr, dma_addr_t *ret) static int intel_agp_map_page(struct page *page, dma_addr_t *ret)
{ {
*ret = pci_map_single(intel_private.pcidev, addr, *ret = pci_map_page(intel_private.pcidev, page, 0,
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
if (pci_dma_mapping_error(intel_private.pcidev, *ret)) if (pci_dma_mapping_error(intel_private.pcidev, *ret))
return -EINVAL; return -EINVAL;
return 0; return 0;
} }
static void intel_agp_unmap_page(void *addr, dma_addr_t dma) static void intel_agp_unmap_page(struct page *page, dma_addr_t dma)
{ {
pci_unmap_single(intel_private.pcidev, dma, pci_unmap_page(intel_private.pcidev, dma,
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
} }
static int intel_agp_map_memory(struct agp_memory *mem) static int intel_agp_map_memory(struct agp_memory *mem)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment