aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-09 13:06:24 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-13 19:35:26 -0400
commit8aa2659009714cf5f9ffe7f3e16ccfa8ff0e0d61 (patch)
tree070526522368d43ab8e0332a849474b44c80e980 /arch/powerpc
parent1263965f298af611d4992165242202eb194db1c1 (diff)
powerpc: Fix DMA offset for non-coherent DMA
After Becky's work we can almost have different DMA offsets between on-chip devices and PCI. Almost because there's a problem with the non-coherent DMA code that basically ignores the programmed offset to use the global one for everything. This fixes it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/dma.c8
-rw-r--r--arch/powerpc/lib/dma-noncoherent.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 41fdd48bf433..1562daf8839a 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -30,11 +30,15 @@ static unsigned long get_dma_direct_offset(struct device *dev)
30void *dma_direct_alloc_coherent(struct device *dev, size_t size, 30void *dma_direct_alloc_coherent(struct device *dev, size_t size,
31 dma_addr_t *dma_handle, gfp_t flag) 31 dma_addr_t *dma_handle, gfp_t flag)
32{ 32{
33 void *ret;
33#ifdef CONFIG_NOT_COHERENT_CACHE 34#ifdef CONFIG_NOT_COHERENT_CACHE
34 return __dma_alloc_coherent(size, dma_handle, flag); 35 ret = __dma_alloc_coherent(size, dma_handle, flag);
36 if (ret == NULL)
37 return NULL;
38 *dma_handle += get_dma_direct_offset(dev);
39 return ret;
35#else 40#else
36 struct page *page; 41 struct page *page;
37 void *ret;
38 int node = dev_to_node(dev); 42 int node = dev_to_node(dev);
39 43
40 /* ignore region specifiers */ 44 /* ignore region specifiers */
diff --git a/arch/powerpc/lib/dma-noncoherent.c b/arch/powerpc/lib/dma-noncoherent.c
index 5d83907f6591..31734c0969cd 100644
--- a/arch/powerpc/lib/dma-noncoherent.c
+++ b/arch/powerpc/lib/dma-noncoherent.c
@@ -203,7 +203,7 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
203 /* 203 /*
204 * Set the "dma handle" 204 * Set the "dma handle"
205 */ 205 */
206 *handle = page_to_bus(page); 206 *handle = page_to_phys(page);
207 207
208 do { 208 do {
209 BUG_ON(!pte_none(*pte)); 209 BUG_ON(!pte_none(*pte));