tools headers UAPI: Sync openat2.h with the kernel sources
[linux-2.6-microblaze.git] / tools / virtio / linux / dma-mapping.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_DMA_MAPPING_H
3 #define _LINUX_DMA_MAPPING_H
4
5 #ifdef CONFIG_HAS_DMA
6 # error Virtio userspace code does not support CONFIG_HAS_DMA
7 #endif
8
9 enum dma_data_direction {
10         DMA_BIDIRECTIONAL = 0,
11         DMA_TO_DEVICE = 1,
12         DMA_FROM_DEVICE = 2,
13         DMA_NONE = 3,
14 };
15
16 #define dma_alloc_coherent(d, s, hp, f) ({ \
17         void *__dma_alloc_coherent_p = kmalloc((s), (f)); \
18         *(hp) = (unsigned long)__dma_alloc_coherent_p; \
19         __dma_alloc_coherent_p; \
20 })
21
22 #define dma_free_coherent(d, s, p, h) kfree(p)
23
24 #define dma_map_page(d, p, o, s, dir) (page_to_phys(p) + (o))
25
26 #define dma_map_single(d, p, s, dir) (virt_to_phys(p))
27 #define dma_mapping_error(...) (0)
28
29 #define dma_unmap_single(...) do { } while (0)
30 #define dma_unmap_page(...) do { } while (0)
31
32 #define dma_max_mapping_size(...) SIZE_MAX
33
34 #endif