1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_DMA_MAPPING_H 3 #define _ASM_DMA_MAPPING_H 4 5 #include <linux/scatterlist.h> 6 #include <asm/dma-coherence.h> 7 #include <asm/cache.h> 8 9 #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */ 10 #include <dma-coherence.h> 11 #endif 12 13 extern const struct dma_map_ops *mips_dma_map_ops; 14 15 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) 16 { 17 return mips_dma_map_ops; 18 } 19 20 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) 21 { 22 if (!dev->dma_mask) 23 return false; 24 25 return addr + size <= *dev->dma_mask; 26 } 27 28 static inline void dma_mark_clean(void *addr, size_t size) {} 29 30 extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 31 enum dma_data_direction direction); 32 33 #define arch_setup_dma_ops arch_setup_dma_ops 34 static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, 35 u64 size, const struct iommu_ops *iommu, 36 bool coherent) 37 { 38 #ifdef CONFIG_DMA_PERDEV_COHERENT 39 dev->archdata.dma_coherent = coherent; 40 #endif 41 } 42 43 #endif /* _ASM_DMA_MAPPING_H */ 44