lkml.org 
[lkml]   [2010]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 15/23] agp: Make agp_generic_insert_memory use the mem->dma_addr[i].
Date
For platforms that are not using the PCI API the value
of dma_addr[i] is page_to_phys(mem->page[i]), which was
obtained by using the _agp_alloc_page macro.

This does mean that drivers that have their own .agp_create_page
functions and don't populate dma_addr[i] and use this
agp_generic_insert_memory need to have this right. Fortunatly,
all of the previous patches have done so. Just in case we have
a warning and end use the old mechanism to get the DMA address.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
drivers/char/agp/generic.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 65fd7c7..4cf3f94 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -1142,8 +1142,13 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
}

for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
+ dma_addr_t dma_addr = mem->dma_addr[i];
+ if (dma_addr == DMA_ERROR_CODE) {
+ WARN_ONCE(1, "Caller hasn't converted to DMA API!\n");
+ dma_addr = page_to_phys(mem->pages[i]);
+ }
writel(bridge->driver->mask_memory(bridge,
- page_to_phys(mem->pages[i]),
+ dma_addr,
mask_type),
bridge->gatt_table+j);
}
--
1.7.1


\
 
 \ /
  Last update: 2010-12-07 00:29    [from the cache]
©2003-2011 Jasper Spaans