blob: 18601f6689b9e13de81f4926423c7b88cdc44bdf [file] [log] [blame]
Andy Lutomirski780bc792016-02-02 21:46:36 -08001#ifndef _LINUX_DMA_MAPPING_H
2#define _LINUX_DMA_MAPPING_H
3
4#ifdef CONFIG_HAS_DMA
5# error Virtio userspace code does not support CONFIG_HAS_DMA
6#endif
7
8#define PCI_DMA_BUS_IS_PHYS 1
9
10enum dma_data_direction {
11 DMA_BIDIRECTIONAL = 0,
12 DMA_TO_DEVICE = 1,
13 DMA_FROM_DEVICE = 2,
14 DMA_NONE = 3,
15};
16
Michael S. Tsirkin6be3ffa2016-08-15 04:50:55 +030017#define dma_alloc_coherent(d, s, hp, f) ({ \
18 void *__dma_alloc_coherent_p = kmalloc((s), (f)); \
19 *(hp) = (unsigned long)__dma_alloc_coherent_p; \
20 __dma_alloc_coherent_p; \
21})
22
23#define dma_free_coherent(d, s, p, h) kfree(p)
24
25#define dma_map_page(d, p, o, s, dir) (page_to_phys(p) + (o))
26
27#define dma_map_single(d, p, s, dir) (virt_to_phys(p))
28#define dma_mapping_error(...) (0)
29
30#define dma_unmap_single(...) do { } while (0)
31#define dma_unmap_page(...) do { } while (0)
32
Andy Lutomirski780bc792016-02-02 21:46:36 -080033#endif