blob: abfb2682de7f33b0dce686447849e9c49b85c0a5 [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
19extern int
20dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
21 dma_addr_t device_addr, size_t size, int flags);
22
23extern void
24dma_release_declared_memory(struct device *dev);
25
26extern void *
27dma_mark_declared_memory_occupied(struct device *dev,
28 dma_addr_t device_addr, size_t size);
29#else
30#define dma_alloc_from_coherent(dev, size, handle, ret) (0)
31#define dma_release_from_coherent(dev, order, vaddr) (0)
32#endif
33
34#endif