1 /* Public domain. */ 2 3 #ifndef _LINUX_DMA_MAPPING_H 4 #define _LINUX_DMA_MAPPING_H 5 6 #include <linux/sizes.h> 7 #include <linux/scatterlist.h> 8 #include <linux/dma-direction.h> 9 10 struct device; 11 12 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) -1) 13 14 #define DMA_MAPPING_ERROR (dma_addr_t)-1 15 16 static inline int 17 dma_set_coherent_mask(struct device *dev, uint64_t m) 18 { 19 return 0; 20 } 21 22 static inline int 23 dma_set_max_seg_size(struct device *dev, unsigned int sz) 24 { 25 return 0; 26 } 27 28 static inline int 29 dma_set_mask(struct device *dev, uint64_t m) 30 { 31 return 0; 32 } 33 34 static inline int 35 dma_set_mask_and_coherent(void *dev, uint64_t m) 36 { 37 return 0; 38 } 39 40 static inline bool 41 dma_addressing_limited(void *dev) 42 { 43 return false; 44 } 45 46 static inline dma_addr_t 47 dma_map_page(void *dev, struct vm_page *page, size_t offset, 48 size_t size, enum dma_data_direction dir) 49 { 50 return VM_PAGE_TO_PHYS(page); 51 } 52 53 static inline void 54 dma_unmap_page(void *dev, dma_addr_t addr, size_t size, 55 enum dma_data_direction dir) 56 { 57 } 58 59 static inline int 60 dma_mapping_error(void *dev, dma_addr_t addr) 61 { 62 return 0; 63 } 64 65 void *dma_alloc_coherent(struct device *, size_t, dma_addr_t *, int); 66 void dma_free_coherent(struct device *, size_t, void *, dma_addr_t); 67 68 static inline void * 69 dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dva, int gfp) 70 { 71 return dma_alloc_coherent(dev, size, dva, gfp); 72 } 73 74 int dma_get_sgtable(struct device *, struct sg_table *, void *, 75 dma_addr_t, size_t); 76 int dma_map_sgtable(struct device *, struct sg_table *, 77 enum dma_data_direction, u_long); 78 void dma_unmap_sgtable(struct device *, struct sg_table *, 79 enum dma_data_direction, u_long); 80 81 dma_addr_t dma_map_resource(struct device *, phys_addr_t, size_t, 82 enum dma_data_direction, u_long); 83 84 #endif 85