Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dma-mapping.h
Go to the documentation of this file.
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
9 static inline int dma_supported(struct device *dev, u64 mask)
10 {
11  return 1;
12 }
13 
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 
24 static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
26 {
27  return dma_alloc_coherent(dev, size, handle, flag);
28 }
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 }
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);
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);
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);
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 
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,
70 {
71  /* just sync everything for now */
72  dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
73 }
74 
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 
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 
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,
88 {
89  /* just sync everything for now */
90  dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
91 }
92 
93 static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
94 {
95  return 0;
96 }
97 
98 #else
100 #endif
101 
102 #endif /* _M68K_DMA_MAPPING_H */