1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_DMA_MAPPING_H
3 #define _LINUX_DMA_MAPPING_H
6 # error Virtio userspace code does not support CONFIG_HAS_DMA
9 enum dma_data_direction {
10 DMA_BIDIRECTIONAL = 0,
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; \
22 #define dma_free_coherent(d, s, p, h) kfree(p)
24 #define dma_map_page(d, p, o, s, dir) (page_to_phys(p) + (o))
26 #define dma_map_single(d, p, s, dir) (virt_to_phys(p))
27 #define dma_map_single_attrs(d, p, s, dir, a) (virt_to_phys(p))
28 #define dma_mapping_error(...) (0)
30 #define dma_unmap_single(d, a, s, r) do { (void)(d); (void)(a); (void)(s); (void)(r); } while (0)
31 #define dma_unmap_page(d, a, s, r) do { (void)(d); (void)(a); (void)(s); (void)(r); } while (0)
33 #define sg_dma_address(sg) (0)
34 #define dma_need_sync(v, a) (0)
35 #define dma_unmap_single_attrs(d, a, s, r, t) do { \
36 (void)(d); (void)(a); (void)(s); (void)(r); (void)(t); \
38 #define dma_sync_single_range_for_cpu(d, a, o, s, r) do { \
39 (void)(d); (void)(a); (void)(o); (void)(s); (void)(r); \
41 #define dma_sync_single_range_for_device(d, a, o, s, r) do { \
42 (void)(d); (void)(a); (void)(o); (void)(s); (void)(r); \
44 #define dma_max_mapping_size(...) SIZE_MAX