]> git.karo-electronics.de Git - karo-tx-linux.git/blob - include/linux/dma-debug.h
Merge branch 'akpm-current/current'
[karo-tx-linux.git] / include / linux / dma-debug.h
1 /*
2  * Copyright (C) 2008 Advanced Micro Devices, Inc.
3  *
4  * Author: Joerg Roedel <joerg.roedel@amd.com>
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published
8  * by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18  */
19
20 #ifndef __DMA_DEBUG_H
21 #define __DMA_DEBUG_H
22
23 #include <linux/types.h>
24
25 struct device;
26 struct scatterlist;
27 struct bus_type;
28
29 #ifdef CONFIG_DMA_API_DEBUG
30
31 extern void dma_debug_add_bus(struct bus_type *bus);
32
33 extern void dma_debug_init(u32 num_entries);
34
35 extern int dma_debug_resize_entries(u32 num_entries);
36
37 extern void debug_dma_map_page(struct device *dev, struct page *page,
38                                size_t offset, size_t size,
39                                int direction, dma_addr_t dma_addr,
40                                bool map_single);
41
42 extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
43
44 extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
45                                  size_t size, int direction, bool map_single);
46
47 extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
48                              int nents, int mapped_ents, int direction);
49
50 extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
51                                int nelems, int dir);
52
53 extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
54                                      dma_addr_t dma_addr, void *virt,
55                                      gfp_t flags);
56
57 extern void debug_dma_free_coherent(struct device *dev, size_t size,
58                                     void *virt, dma_addr_t addr);
59
60 extern void debug_dma_sync_single_for_cpu(struct device *dev,
61                                           dma_addr_t dma_handle, size_t size,
62                                           int direction);
63
64 extern void debug_dma_sync_single_for_device(struct device *dev,
65                                              dma_addr_t dma_handle,
66                                              size_t size, int direction);
67
68 extern void debug_dma_sync_single_range_for_cpu(struct device *dev,
69                                                 dma_addr_t dma_handle,
70                                                 unsigned long offset,
71                                                 size_t size,
72                                                 int direction);
73
74 extern void debug_dma_sync_single_range_for_device(struct device *dev,
75                                                    dma_addr_t dma_handle,
76                                                    unsigned long offset,
77                                                    size_t size, int direction);
78
79 extern void debug_dma_sync_sg_for_cpu(struct device *dev,
80                                       struct scatterlist *sg,
81                                       int nelems, int direction);
82
83 extern void debug_dma_sync_sg_for_device(struct device *dev,
84                                          struct scatterlist *sg,
85                                          int nelems, int direction);
86
87 extern void debug_dma_dump_mappings(struct device *dev);
88
89 extern void debug_dma_assert_idle(struct page *page);
90
91 #else /* CONFIG_DMA_API_DEBUG */
92
93 static inline void dma_debug_add_bus(struct bus_type *bus)
94 {
95 }
96
97 static inline void dma_debug_init(u32 num_entries)
98 {
99 }
100
101 static inline int dma_debug_resize_entries(u32 num_entries)
102 {
103         return 0;
104 }
105
106 static inline void debug_dma_map_page(struct device *dev, struct page *page,
107                                       size_t offset, size_t size,
108                                       int direction, dma_addr_t dma_addr,
109                                       bool map_single)
110 {
111 }
112
113 static inline void debug_dma_mapping_error(struct device *dev,
114                                           dma_addr_t dma_addr)
115 {
116 }
117
118 static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
119                                         size_t size, int direction,
120                                         bool map_single)
121 {
122 }
123
124 static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
125                                     int nents, int mapped_ents, int direction)
126 {
127 }
128
129 static inline void debug_dma_unmap_sg(struct device *dev,
130                                       struct scatterlist *sglist,
131                                       int nelems, int dir)
132 {
133 }
134
135 static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
136                                             dma_addr_t dma_addr, void *virt,
137                                             gfp_t flags)
138 {
139 }
140
141 static inline void debug_dma_free_coherent(struct device *dev, size_t size,
142                                            void *virt, dma_addr_t addr)
143 {
144 }
145
146 static inline void debug_dma_sync_single_for_cpu(struct device *dev,
147                                                  dma_addr_t dma_handle,
148                                                  size_t size, int direction)
149 {
150 }
151
152 static inline void debug_dma_sync_single_for_device(struct device *dev,
153                                                     dma_addr_t dma_handle,
154                                                     size_t size, int direction)
155 {
156 }
157
158 static inline void debug_dma_sync_single_range_for_cpu(struct device *dev,
159                                                        dma_addr_t dma_handle,
160                                                        unsigned long offset,
161                                                        size_t size,
162                                                        int direction)
163 {
164 }
165
166 static inline void debug_dma_sync_single_range_for_device(struct device *dev,
167                                                           dma_addr_t dma_handle,
168                                                           unsigned long offset,
169                                                           size_t size,
170                                                           int direction)
171 {
172 }
173
174 static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
175                                              struct scatterlist *sg,
176                                              int nelems, int direction)
177 {
178 }
179
180 static inline void debug_dma_sync_sg_for_device(struct device *dev,
181                                                 struct scatterlist *sg,
182                                                 int nelems, int direction)
183 {
184 }
185
186 static inline void debug_dma_dump_mappings(struct device *dev)
187 {
188 }
189
190 static inline void debug_dma_assert_idle(struct page *page)
191 {
192 }
193
194 #endif /* CONFIG_DMA_API_DEBUG */
195
196 #endif /* __DMA_DEBUG_H */