summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/dma-mapping.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-28 14:23:06 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-28 14:23:06 +1000
commit2864697cefb6e7596e39aef933b4131f6c9fa9e1 (patch)
tree2d5ad000593a07e28e506a0a3f581ea242a9ff4b /arch/powerpc/include/asm/dma-mapping.h
parent3c2ee2d9f41ef43a581b26b677d2b4054ccbd200 (diff)
parentc7084b35eb1a4d3353a501508baf9d3d82822c93 (diff)
downloadop-kernel-dev-2864697cefb6e7596e39aef933b4131f6c9fa9e1.zip
op-kernel-dev-2864697cefb6e7596e39aef933b4131f6c9fa9e1.tar.gz
Merge commit 'tip/iommu-for-powerpc' into next
Diffstat (limited to 'arch/powerpc/include/asm/dma-mapping.h')
-rw-r--r--arch/powerpc/include/asm/dma-mapping.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index b44aaab..0c34371 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -424,6 +424,29 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
#endif
}
+static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
+{
+ struct dma_mapping_ops *ops = get_dma_ops(dev);
+
+ if (ops->addr_needs_map && ops->addr_needs_map(dev, addr, size))
+ return 0;
+
+ if (!dev->dma_mask)
+ return 0;
+
+ return addr + size <= *dev->dma_mask;
+}
+
+static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
+{
+ return paddr + get_dma_direct_offset(dev);
+}
+
+static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
+{
+ return daddr - get_dma_direct_offset(dev);
+}
+
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
#ifdef CONFIG_NOT_COHERENT_CACHE
OpenPOWER on IntegriCloud