dma-mapping.h 826 B

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