blob: 0297e587579813d0977b75fe5613831a22f0246d [file] [log] [blame]
Dmitry Baryshkovee7e5512008-06-29 14:18:46 +04001#ifndef DMA_COHERENT_H
2#define DMA_COHERENT_H
3
4#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
5/*
Marek Szyprowskibca0fa52012-03-23 13:05:14 +01006 * These three functions are only for dma allocator.
Dmitry Baryshkovee7e5512008-06-29 14:18:46 +04007 * Don't use them in device drivers.
8 */
9int dma_alloc_from_coherent(struct device *dev, ssize_t size,
10 dma_addr_t *dma_handle, void **ret);
11int dma_release_from_coherent(struct device *dev, int order, void *vaddr);
12
Marek Szyprowskibca0fa52012-03-23 13:05:14 +010013int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
14 void *cpu_addr, size_t size, int *ret);
Dmitry Baryshkovee7e5512008-06-29 14:18:46 +040015/*
16 * Standard interface
17 */
18#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
Bjorn Helgaas88a984b2014-05-20 16:54:22 -060019int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
20 dma_addr_t device_addr, size_t size, int flags);
Dmitry Baryshkovee7e5512008-06-29 14:18:46 +040021
Bjorn Helgaas88a984b2014-05-20 16:54:22 -060022void dma_release_declared_memory(struct device *dev);
Dmitry Baryshkovee7e5512008-06-29 14:18:46 +040023
Bjorn Helgaas88a984b2014-05-20 16:54:22 -060024void *dma_mark_declared_memory_occupied(struct device *dev,
25 dma_addr_t device_addr, size_t size);
Dmitry Baryshkovee7e5512008-06-29 14:18:46 +040026#else
27#define dma_alloc_from_coherent(dev, size, handle, ret) (0)
28#define dma_release_from_coherent(dev, order, vaddr) (0)
Marek Szyprowski64ccc9c2012-06-14 13:03:04 +020029#define dma_mmap_from_coherent(dev, vma, vaddr, order, ret) (0)
Dmitry Baryshkovee7e5512008-06-29 14:18:46 +040030#endif
31
32#endif