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