dma-mapping.h 936 B

12345678910111213141516171819202122232425262728293031323334353637
  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 mips_default_dma_map_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. #ifdef CONFIG_SWIOTLB
  15. return &mips_swiotlb_ops;
  16. #elif defined(CONFIG_MIPS_DMA_DEFAULT)
  17. return &mips_default_dma_map_ops;
  18. #else
  19. return NULL;
  20. #endif
  21. }
  22. #define arch_setup_dma_ops arch_setup_dma_ops
  23. static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
  24. u64 size, const struct iommu_ops *iommu,
  25. bool coherent)
  26. {
  27. #ifdef CONFIG_DMA_PERDEV_COHERENT
  28. dev->archdata.dma_coherent = coherent;
  29. #endif
  30. }
  31. #endif /* _ASM_DMA_MAPPING_H */