dma-mapping.h 1.1 KB

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