Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / m68k / include / asm / dma-mapping.h
blob17f7a45948eac7473b3afb16e86b5512d58a2c4d
1 #ifndef _M68K_DMA_MAPPING_H
2 #define _M68K_DMA_MAPPING_H
4 #include <asm/cache.h>
6 struct scatterlist;
8 #ifndef CONFIG_MMU_SUN3
9 static inline int dma_supported(struct device *dev, u64 mask)
11 return 1;
14 static inline int dma_set_mask(struct device *dev, u64 mask)
16 return 0;
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);
24 static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
25 dma_addr_t *handle, gfp_t flag)
27 return dma_alloc_coherent(dev, size, handle, flag);
29 static inline void dma_free_noncoherent(struct device *dev, size_t size,
30 void *addr, dma_addr_t handle)
32 dma_free_coherent(dev, size, addr, handle);
34 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
35 enum dma_data_direction dir)
37 /* we use coherent allocation, so not much to do here. */
40 extern dma_addr_t dma_map_single(struct device *, void *, size_t,
41 enum dma_data_direction);
42 static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
43 size_t size, enum dma_data_direction dir)
47 extern dma_addr_t dma_map_page(struct device *, struct page *,
48 unsigned long, size_t size,
49 enum dma_data_direction);
50 static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
51 size_t size, enum dma_data_direction dir)
55 extern int dma_map_sg(struct device *, struct scatterlist *, int,
56 enum dma_data_direction);
57 static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
58 int nhwentries, enum dma_data_direction dir)
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);
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)
71 /* just sync everything for now */
72 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
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)
80 static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
81 int nents, enum dma_data_direction dir)
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)
89 /* just sync everything for now */
90 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
93 static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
95 return 0;
98 #else
99 #include <asm-generic/dma-mapping-broken.h>
100 #endif
102 #endif /* _M68K_DMA_MAPPING_H */