diff options
author | Thierry Reding <treding@nvidia.com> | 2014-06-27 05:56:58 -0400 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2014-08-26 01:39:13 -0400 |
commit | b4bbb107d73bbc0d92c9ae7fd8e69580aa9381e7 (patch) | |
tree | c631cccdc40abe3d44fc980a739fb20ec4354d3f /include/linux/dma-mapping.h | |
parent | 90114d65feea716eeae0ab51e92c95b140b2e6fc (diff) |
dma-mapping: Provide write-combine allocations
Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
the architecture supports DMA attributes.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r-- | include/linux/dma-mapping.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 931b70986272..d5d388160f42 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -263,6 +263,32 @@ struct dma_attrs; | |||
263 | #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ | 263 | #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ |
264 | dma_unmap_sg(dev, sgl, nents, dir) | 264 | dma_unmap_sg(dev, sgl, nents, dir) |
265 | 265 | ||
266 | #else | ||
267 | static inline void *dma_alloc_writecombine(struct device *dev, size_t size, | ||
268 | dma_addr_t *dma_addr, gfp_t gfp) | ||
269 | { | ||
270 | DEFINE_DMA_ATTRS(attrs); | ||
271 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); | ||
272 | return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs); | ||
273 | } | ||
274 | |||
275 | static inline void dma_free_writecombine(struct device *dev, size_t size, | ||
276 | void *cpu_addr, dma_addr_t dma_addr) | ||
277 | { | ||
278 | DEFINE_DMA_ATTRS(attrs); | ||
279 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); | ||
280 | return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs); | ||
281 | } | ||
282 | |||
283 | static inline int dma_mmap_writecombine(struct device *dev, | ||
284 | struct vm_area_struct *vma, | ||
285 | void *cpu_addr, dma_addr_t dma_addr, | ||
286 | size_t size) | ||
287 | { | ||
288 | DEFINE_DMA_ATTRS(attrs); | ||
289 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); | ||
290 | return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs); | ||
291 | } | ||
266 | #endif /* CONFIG_HAVE_DMA_ATTRS */ | 292 | #endif /* CONFIG_HAVE_DMA_ATTRS */ |
267 | 293 | ||
268 | #ifdef CONFIG_NEED_DMA_MAP_STATE | 294 | #ifdef CONFIG_NEED_DMA_MAP_STATE |