dma-mapping.h 774 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef _LINUX_DMA_MAPPING_H
  2. #define _LINUX_DMA_MAPPING_H
  3. #ifdef CONFIG_HAS_DMA
  4. # error Virtio userspace code does not support CONFIG_HAS_DMA
  5. #endif
  6. #define PCI_DMA_BUS_IS_PHYS 1
  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. #endif