1 #ifndef _M68K_DMA_MAPPING_H
2 #define _M68K_DMA_MAPPING_H
8 #ifndef CONFIG_MMU_SUN3
9 static inline int dma_supported(struct device *dev, u64 mask)
14 static inline int dma_set_mask(struct device *dev, u64 mask)
19 extern void *dma_alloc_coherent(struct device *, size_t,
21 extern void dma_free_coherent(struct device *, size_t,
24 static inline void *dma_alloc_attrs(struct device *dev, size_t size,
25 dma_addr_t *dma_handle, gfp_t flag,
26 struct dma_attrs *attrs)
28 /* attrs is not supported and ignored */
29 return dma_alloc_coherent(dev, size, dma_handle, flag);
32 static inline void dma_free_attrs(struct device *dev, size_t size,
33 void *cpu_addr, dma_addr_t dma_handle,
34 struct dma_attrs *attrs)
36 /* attrs is not supported and ignored */
37 dma_free_coherent(dev, size, cpu_addr, dma_handle);
40 static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
41 dma_addr_t *handle, gfp_t flag)
43 return dma_alloc_coherent(dev, size, handle, flag);
45 static inline void dma_free_noncoherent(struct device *dev, size_t size,
46 void *addr, dma_addr_t handle)
48 dma_free_coherent(dev, size, addr, handle);
50 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
51 enum dma_data_direction dir)
53 /* we use coherent allocation, so not much to do here. */
56 extern dma_addr_t dma_map_single(struct device *, void *, size_t,
57 enum dma_data_direction);
58 static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
59 size_t size, enum dma_data_direction dir)
63 extern dma_addr_t dma_map_page(struct device *, struct page *,
64 unsigned long, size_t size,
65 enum dma_data_direction);
66 static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
67 size_t size, enum dma_data_direction dir)
71 extern int dma_map_sg(struct device *, struct scatterlist *, int,
72 enum dma_data_direction);
73 static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
74 int nhwentries, enum dma_data_direction dir)
78 extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
79 enum dma_data_direction);
80 extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
81 enum dma_data_direction);
83 static inline void dma_sync_single_range_for_device(struct device *dev,
84 dma_addr_t dma_handle, unsigned long offset, size_t size,
85 enum dma_data_direction direction)
87 /* just sync everything for now */
88 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
91 static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
92 size_t size, enum dma_data_direction dir)
96 static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
97 int nents, enum dma_data_direction dir)
101 static inline void dma_sync_single_range_for_cpu(struct device *dev,
102 dma_addr_t dma_handle, unsigned long offset, size_t size,
103 enum dma_data_direction direction)
105 /* just sync everything for now */
106 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
109 static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
115 #include <asm-generic/dma-mapping-broken.h>
118 /* drivers/base/dma-mapping.c */
119 extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
120 void *cpu_addr, dma_addr_t dma_addr, size_t size);
121 extern int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
122 void *cpu_addr, dma_addr_t dma_addr,
125 #define dma_mmap_coherent(d, v, c, h, s) dma_common_mmap(d, v, c, h, s)
126 #define dma_get_sgtable(d, t, v, h, s) dma_common_get_sgtable(d, t, v, h, s)
128 #endif /* _M68K_DMA_MAPPING_H */