Path: blob/master/arch/mips/include/asm/dma-mapping.h
17293 views
#ifndef _ASM_DMA_MAPPING_H1#define _ASM_DMA_MAPPING_H23#include <asm/scatterlist.h>4#include <asm/cache.h>5#include <asm-generic/dma-coherent.h>67#ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */8#include <dma-coherence.h>9#endif1011extern struct dma_map_ops *mips_dma_map_ops;1213static inline struct dma_map_ops *get_dma_ops(struct device *dev)14{15if (dev && dev->archdata.dma_ops)16return dev->archdata.dma_ops;17else18return mips_dma_map_ops;19}2021static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)22{23if (!dev->dma_mask)24return 0;2526return addr + size <= *dev->dma_mask;27}2829static inline void dma_mark_clean(void *addr, size_t size) {}3031#include <asm-generic/dma-mapping-common.h>3233static inline int dma_supported(struct device *dev, u64 mask)34{35struct dma_map_ops *ops = get_dma_ops(dev);36return ops->dma_supported(dev, mask);37}3839static inline int dma_mapping_error(struct device *dev, u64 mask)40{41struct dma_map_ops *ops = get_dma_ops(dev);42return ops->mapping_error(dev, mask);43}4445static inline int46dma_set_mask(struct device *dev, u64 mask)47{48if(!dev->dma_mask || !dma_supported(dev, mask))49return -EIO;5051*dev->dma_mask = mask;5253return 0;54}5556extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,57enum dma_data_direction direction);5859static inline void *dma_alloc_coherent(struct device *dev, size_t size,60dma_addr_t *dma_handle, gfp_t gfp)61{62void *ret;63struct dma_map_ops *ops = get_dma_ops(dev);6465ret = ops->alloc_coherent(dev, size, dma_handle, gfp);6667debug_dma_alloc_coherent(dev, size, *dma_handle, ret);6869return ret;70}7172static inline void dma_free_coherent(struct device *dev, size_t size,73void *vaddr, dma_addr_t dma_handle)74{75struct dma_map_ops *ops = get_dma_ops(dev);7677ops->free_coherent(dev, size, vaddr, dma_handle);7879debug_dma_free_coherent(dev, size, vaddr, dma_handle);80}818283void *dma_alloc_noncoherent(struct device *dev, size_t size,84dma_addr_t *dma_handle, gfp_t flag);8586void dma_free_noncoherent(struct device *dev, size_t size,87void *vaddr, dma_addr_t dma_handle);8889#endif /* _ASM_DMA_MAPPING_H */909192