dma-mapping.h 994 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_DMA_MAPPING_H
  3. #define _ASM_DMA_MAPPING_H
  4. #include <linux/scatterlist.h>
  5. #include <asm/dma-coherence.h>
  6. #include <asm/cache.h>
  7. #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */
  8. #include <dma-coherence.h>
  9. #endif
  10. extern const struct dma_map_ops jazz_dma_ops;
  11. extern const struct dma_map_ops mips_swiotlb_ops;
  12. static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
  13. {
  14. #if defined(CONFIG_MACH_JAZZ)
  15. return &jazz_dma_ops;
  16. #elif defined(CONFIG_SWIOTLB)
  17. return &mips_swiotlb_ops;
  18. #elif defined(CONFIG_DMA_NONCOHERENT_OPS)
  19. return &dma_noncoherent_ops;
  20. #else
  21. return &dma_direct_ops;
  22. #endif
  23. }
  24. #define arch_setup_dma_ops arch_setup_dma_ops
  25. static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
  26. u64 size, const struct iommu_ops *iommu,
  27. bool coherent)
  28. {
  29. #ifdef CONFIG_DMA_PERDEV_COHERENT
  30. dev->archdata.dma_coherent = coherent;
  31. #endif
  32. }
  33. #endif /* _ASM_DMA_MAPPING_H */