1 #ifndef _M68K_DMA_MAPPING_H
2 #define _M68K_DMA_MAPPING_H
3
4 #include <asm/cache.h>
5
6 struct scatterlist;
7
8 #ifndef CONFIG_MMU_SUN3
dma_supported(struct device * dev,u64 mask)9 static inline int dma_supported(struct device *dev, u64 mask)
10 {
11 return 1;
12 }
13
dma_set_mask(struct device * dev,u64 mask)14 static inline int dma_set_mask(struct device *dev, u64 mask)
15 {
16 return 0;
17 }
18
19 extern void *dma_alloc_coherent(struct device *, size_t,
20 dma_addr_t *, gfp_t);
21 extern void dma_free_coherent(struct device *, size_t,
22 void *, dma_addr_t);
23
dma_alloc_noncoherent(struct device * dev,size_t size,dma_addr_t * handle,gfp_t flag)24 static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
25 dma_addr_t *handle, gfp_t flag)
26 {
27 return dma_alloc_coherent(dev, size, handle, flag);
28 }
dma_free_noncoherent(struct device * dev,size_t size,void * addr,dma_addr_t handle)29 static inline void dma_free_noncoherent(struct device *dev, size_t size,
30 void *addr, dma_addr_t handle)
31 {
32 dma_free_coherent(dev, size, addr, handle);
33 }
dma_cache_sync(struct device * dev,void * vaddr,size_t size,enum dma_data_direction dir)34 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
35 enum dma_data_direction dir)
36 {
37 /* we use coherent allocation, so not much to do here. */
38 }
39
40 extern dma_addr_t dma_map_single(struct device *, void *, size_t,
41 enum dma_data_direction);
dma_unmap_single(struct device * dev,dma_addr_t addr,size_t size,enum dma_data_direction dir)42 static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
43 size_t size, enum dma_data_direction dir)
44 {
45 }
46
47 extern dma_addr_t dma_map_page(struct device *, struct page *,
48 unsigned long, size_t size,
49 enum dma_data_direction);
dma_unmap_page(struct device * dev,dma_addr_t address,size_t size,enum dma_data_direction dir)50 static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
51 size_t size, enum dma_data_direction dir)
52 {
53 }
54
55 extern int dma_map_sg(struct device *, struct scatterlist *, int,
56 enum dma_data_direction);
dma_unmap_sg(struct device * dev,struct scatterlist * sg,int nhwentries,enum dma_data_direction dir)57 static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
58 int nhwentries, enum dma_data_direction dir)
59 {
60 }
61
62 extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
63 enum dma_data_direction);
64 extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
65 enum dma_data_direction);
66
dma_sync_single_range_for_device(struct device * dev,dma_addr_t dma_handle,unsigned long offset,size_t size,enum dma_data_direction direction)67 static inline void dma_sync_single_range_for_device(struct device *dev,
68 dma_addr_t dma_handle, unsigned long offset, size_t size,
69 enum dma_data_direction direction)
70 {
71 /* just sync everything for now */
72 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
73 }
74
dma_sync_single_for_cpu(struct device * dev,dma_addr_t handle,size_t size,enum dma_data_direction dir)75 static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
76 size_t size, enum dma_data_direction dir)
77 {
78 }
79
dma_sync_sg_for_cpu(struct device * dev,struct scatterlist * sg,int nents,enum dma_data_direction dir)80 static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
81 int nents, enum dma_data_direction dir)
82 {
83 }
84
dma_sync_single_range_for_cpu(struct device * dev,dma_addr_t dma_handle,unsigned long offset,size_t size,enum dma_data_direction direction)85 static inline void dma_sync_single_range_for_cpu(struct device *dev,
86 dma_addr_t dma_handle, unsigned long offset, size_t size,
87 enum dma_data_direction direction)
88 {
89 /* just sync everything for now */
90 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
91 }
92
dma_mapping_error(struct device * dev,dma_addr_t handle)93 static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
94 {
95 return 0;
96 }
97
98 #else
99 #include <asm-generic/dma-mapping-broken.h>
100 #endif
101
102 #endif /* _M68K_DMA_MAPPING_H */
103