Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_DMA_MAPPING_H
0003 #define _LINUX_DMA_MAPPING_H
0004 
0005 #ifdef CONFIG_HAS_DMA
0006 # error Virtio userspace code does not support CONFIG_HAS_DMA
0007 #endif
0008 
0009 enum dma_data_direction {
0010     DMA_BIDIRECTIONAL = 0,
0011     DMA_TO_DEVICE = 1,
0012     DMA_FROM_DEVICE = 2,
0013     DMA_NONE = 3,
0014 };
0015 
0016 #define dma_alloc_coherent(d, s, hp, f) ({ \
0017     void *__dma_alloc_coherent_p = kmalloc((s), (f)); \
0018     *(hp) = (unsigned long)__dma_alloc_coherent_p; \
0019     __dma_alloc_coherent_p; \
0020 })
0021 
0022 #define dma_free_coherent(d, s, p, h) kfree(p)
0023 
0024 #define dma_map_page(d, p, o, s, dir) (page_to_phys(p) + (o))
0025 
0026 #define dma_map_single(d, p, s, dir) (virt_to_phys(p))
0027 #define dma_mapping_error(...) (0)
0028 
0029 #define dma_unmap_single(d, a, s, r) do { (void)(d); (void)(a); (void)(s); (void)(r); } while (0)
0030 #define dma_unmap_page(d, a, s, r) do { (void)(d); (void)(a); (void)(s); (void)(r); } while (0)
0031 
0032 #define dma_max_mapping_size(...) SIZE_MAX
0033 
0034 #endif