2005-04-17 06:20:36 +08:00
|
|
|
#ifndef _ASM_DMA_MAPPING_H
|
|
|
|
#define _ASM_DMA_MAPPING_H
|
|
|
|
|
2015-05-01 18:46:15 +08:00
|
|
|
#include <linux/scatterlist.h>
|
2013-03-26 02:47:29 +08:00
|
|
|
#include <asm/dma-coherence.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/cache.h>
|
|
|
|
|
2013-01-22 19:59:30 +08:00
|
|
|
#ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */
|
2010-10-02 04:27:32 +08:00
|
|
|
#include <dma-coherence.h>
|
2011-05-18 20:14:36 +08:00
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-01-21 05:04:01 +08:00
|
|
|
extern const struct dma_map_ops *mips_dma_map_ops;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-01-21 05:04:04 +08:00
|
|
|
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
|
2010-10-02 04:27:32 +08:00
|
|
|
{
|
2017-01-21 05:04:04 +08:00
|
|
|
return mips_dma_map_ops;
|
2010-10-02 04:27:32 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-10-02 04:27:32 +08:00
|
|
|
static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
|
|
|
|
{
|
|
|
|
if (!dev->dma_mask)
|
2015-03-31 07:46:03 +08:00
|
|
|
return false;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-10-02 04:27:32 +08:00
|
|
|
return addr + size <= *dev->dma_mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void dma_mark_clean(void *addr, size_t size) {}
|
|
|
|
|
2006-12-07 12:38:56 +08:00
|
|
|
extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
|
2005-04-17 06:20:36 +08:00
|
|
|
enum dma_data_direction direction);
|
|
|
|
|
2016-10-06 01:18:16 +08:00
|
|
|
#define arch_setup_dma_ops arch_setup_dma_ops
|
|
|
|
static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
|
|
|
|
u64 size, const struct iommu_ops *iommu,
|
|
|
|
bool coherent)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_DMA_PERDEV_COHERENT
|
|
|
|
dev->archdata.dma_coherent = coherent;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* _ASM_DMA_MAPPING_H */
|