2008-06-29 14:18:46 +04:00
|
|
|
#ifndef DMA_COHERENT_H
|
|
|
|
#define DMA_COHERENT_H
|
|
|
|
|
|
|
|
#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
|
|
|
|
/*
|
2012-03-23 16:05:14 +04:00
|
|
|
* These three functions are only for dma allocator.
|
2008-06-29 14:18:46 +04:00
|
|
|
* Don't use them in device drivers.
|
|
|
|
*/
|
|
|
|
int dma_alloc_from_coherent(struct device *dev, ssize_t size,
|
|
|
|
dma_addr_t *dma_handle, void **ret);
|
|
|
|
int dma_release_from_coherent(struct device *dev, int order, void *vaddr);
|
|
|
|
|
2012-03-23 16:05:14 +04:00
|
|
|
int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
|
|
|
|
void *cpu_addr, size_t size, int *ret);
|
2008-06-29 14:18:46 +04:00
|
|
|
/*
|
|
|
|
* Standard interface
|
|
|
|
*/
|
|
|
|
#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
|
2014-05-21 02:54:22 +04:00
|
|
|
int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
|
|
|
|
dma_addr_t device_addr, size_t size, int flags);
|
2008-06-29 14:18:46 +04:00
|
|
|
|
2014-05-21 02:54:22 +04:00
|
|
|
void dma_release_declared_memory(struct device *dev);
|
2008-06-29 14:18:46 +04:00
|
|
|
|
2014-05-21 02:54:22 +04:00
|
|
|
void *dma_mark_declared_memory_occupied(struct device *dev,
|
|
|
|
dma_addr_t device_addr, size_t size);
|
2008-06-29 14:18:46 +04:00
|
|
|
#else
|
|
|
|
#define dma_alloc_from_coherent(dev, size, handle, ret) (0)
|
|
|
|
#define dma_release_from_coherent(dev, order, vaddr) (0)
|
2012-06-14 15:03:04 +04:00
|
|
|
#define dma_mmap_from_coherent(dev, vma, vaddr, order, ret) (0)
|
2008-06-29 14:18:46 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|