Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 1 | #ifndef DMA_COHERENT_H |
| 2 | #define DMA_COHERENT_H |
| 3 | |
| 4 | #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT |
| 5 | /* |
Marek Szyprowski | bca0fa5 | 2012-03-23 13:05:14 +0100 | [diff] [blame] | 6 | * These three functions are only for dma allocator. |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 7 | * Don't use them in device drivers. |
| 8 | */ |
| 9 | int dma_alloc_from_coherent(struct device *dev, ssize_t size, |
| 10 | dma_addr_t *dma_handle, void **ret); |
| 11 | int dma_release_from_coherent(struct device *dev, int order, void *vaddr); |
| 12 | |
Marek Szyprowski | bca0fa5 | 2012-03-23 13:05:14 +0100 | [diff] [blame] | 13 | int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, |
| 14 | void *cpu_addr, size_t size, int *ret); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 15 | /* |
| 16 | * Standard interface |
| 17 | */ |
| 18 | #define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY |
Bjorn Helgaas | 88a984b | 2014-05-20 16:54:22 -0600 | [diff] [blame] | 19 | int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, |
| 20 | dma_addr_t device_addr, size_t size, int flags); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 21 | |
Bjorn Helgaas | 88a984b | 2014-05-20 16:54:22 -0600 | [diff] [blame] | 22 | void dma_release_declared_memory(struct device *dev); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 23 | |
Bjorn Helgaas | 88a984b | 2014-05-20 16:54:22 -0600 | [diff] [blame] | 24 | void *dma_mark_declared_memory_occupied(struct device *dev, |
| 25 | dma_addr_t device_addr, size_t size); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 26 | #else |
| 27 | #define dma_alloc_from_coherent(dev, size, handle, ret) (0) |
| 28 | #define dma_release_from_coherent(dev, order, vaddr) (0) |
Marek Szyprowski | 64ccc9c | 2012-06-14 13:03:04 +0200 | [diff] [blame] | 29 | #define dma_mmap_from_coherent(dev, vma, vaddr, order, ret) (0) |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 30 | #endif |
| 31 | |
| 32 | #endif |