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