Commit | Line | Data |
---|---|---|
f2f45e5f JR |
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 | ||
6bf07871 JR |
23 | #include <linux/types.h> |
24 | ||
f2f45e5f | 25 | struct device; |
972aa45c | 26 | struct scatterlist; |
41531c8f | 27 | struct bus_type; |
f2f45e5f | 28 | |
6bf07871 JR |
29 | #ifdef CONFIG_DMA_API_DEBUG |
30 | ||
41531c8f JR |
31 | extern void dma_debug_add_bus(struct bus_type *bus); |
32 | ||
e6a1a89d FT |
33 | extern int dma_debug_resize_entries(u32 num_entries); |
34 | ||
99c65fa7 SB |
35 | extern void debug_dma_map_single(struct device *dev, const void *addr, |
36 | unsigned long len); | |
37 | ||
f62bc980 JR |
38 | extern void debug_dma_map_page(struct device *dev, struct page *page, |
39 | size_t offset, size_t size, | |
40 | int direction, dma_addr_t dma_addr, | |
41 | bool map_single); | |
42 | ||
6c9c6d63 SK |
43 | extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr); |
44 | ||
f62bc980 JR |
45 | extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, |
46 | size_t size, int direction, bool map_single); | |
47 | ||
972aa45c JR |
48 | extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, |
49 | int nents, int mapped_ents, int direction); | |
50 | ||
51 | extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, | |
52 | int nelems, int dir); | |
f62bc980 | 53 | |
6bfd4498 JR |
54 | extern void debug_dma_alloc_coherent(struct device *dev, size_t size, |
55 | dma_addr_t dma_addr, void *virt); | |
56 | ||
57 | extern void debug_dma_free_coherent(struct device *dev, size_t size, | |
58 | void *virt, dma_addr_t addr); | |
59 | ||
0e74b34d NS |
60 | extern void debug_dma_map_resource(struct device *dev, phys_addr_t addr, |
61 | size_t size, int direction, | |
62 | dma_addr_t dma_addr); | |
63 | ||
64 | extern void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr, | |
65 | size_t size, int direction); | |
66 | ||
b9d2317e JR |
67 | extern void debug_dma_sync_single_for_cpu(struct device *dev, |
68 | dma_addr_t dma_handle, size_t size, | |
69 | int direction); | |
70 | ||
71 | extern void debug_dma_sync_single_for_device(struct device *dev, | |
72 | dma_addr_t dma_handle, | |
73 | size_t size, int direction); | |
74 | ||
948408ba JR |
75 | extern void debug_dma_sync_single_range_for_cpu(struct device *dev, |
76 | dma_addr_t dma_handle, | |
77 | unsigned long offset, | |
78 | size_t size, | |
79 | int direction); | |
80 | ||
81 | extern void debug_dma_sync_single_range_for_device(struct device *dev, | |
82 | dma_addr_t dma_handle, | |
83 | unsigned long offset, | |
84 | size_t size, int direction); | |
85 | ||
a31fba5d JR |
86 | extern void debug_dma_sync_sg_for_cpu(struct device *dev, |
87 | struct scatterlist *sg, | |
88 | int nelems, int direction); | |
89 | ||
90 | extern void debug_dma_sync_sg_for_device(struct device *dev, | |
91 | struct scatterlist *sg, | |
92 | int nelems, int direction); | |
93 | ||
ac26c18b DW |
94 | extern void debug_dma_dump_mappings(struct device *dev); |
95 | ||
0abdd7a8 DW |
96 | extern void debug_dma_assert_idle(struct page *page); |
97 | ||
6bf07871 JR |
98 | #else /* CONFIG_DMA_API_DEBUG */ |
99 | ||
84be58d4 | 100 | static inline void dma_debug_add_bus(struct bus_type *bus) |
41531c8f JR |
101 | { |
102 | } | |
103 | ||
e6a1a89d FT |
104 | static inline int dma_debug_resize_entries(u32 num_entries) |
105 | { | |
106 | return 0; | |
107 | } | |
108 | ||
99c65fa7 SB |
109 | static inline void debug_dma_map_single(struct device *dev, const void *addr, |
110 | unsigned long len) | |
111 | { | |
112 | } | |
113 | ||
f62bc980 JR |
114 | static inline void debug_dma_map_page(struct device *dev, struct page *page, |
115 | size_t offset, size_t size, | |
116 | int direction, dma_addr_t dma_addr, | |
117 | bool map_single) | |
118 | { | |
119 | } | |
120 | ||
6c9c6d63 SK |
121 | static inline void debug_dma_mapping_error(struct device *dev, |
122 | dma_addr_t dma_addr) | |
123 | { | |
124 | } | |
125 | ||
f62bc980 JR |
126 | static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, |
127 | size_t size, int direction, | |
128 | bool map_single) | |
129 | { | |
130 | } | |
131 | ||
972aa45c JR |
132 | static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, |
133 | int nents, int mapped_ents, int direction) | |
134 | { | |
135 | } | |
136 | ||
137 | static inline void debug_dma_unmap_sg(struct device *dev, | |
138 | struct scatterlist *sglist, | |
139 | int nelems, int dir) | |
140 | { | |
141 | } | |
f62bc980 | 142 | |
6bfd4498 JR |
143 | static inline void debug_dma_alloc_coherent(struct device *dev, size_t size, |
144 | dma_addr_t dma_addr, void *virt) | |
145 | { | |
146 | } | |
147 | ||
148 | static inline void debug_dma_free_coherent(struct device *dev, size_t size, | |
149 | void *virt, dma_addr_t addr) | |
150 | { | |
151 | } | |
152 | ||
0e74b34d NS |
153 | static inline void debug_dma_map_resource(struct device *dev, phys_addr_t addr, |
154 | size_t size, int direction, | |
155 | dma_addr_t dma_addr) | |
156 | { | |
157 | } | |
158 | ||
159 | static inline void debug_dma_unmap_resource(struct device *dev, | |
160 | dma_addr_t dma_addr, size_t size, | |
161 | int direction) | |
162 | { | |
163 | } | |
164 | ||
b9d2317e JR |
165 | static inline void debug_dma_sync_single_for_cpu(struct device *dev, |
166 | dma_addr_t dma_handle, | |
167 | size_t size, int direction) | |
168 | { | |
169 | } | |
170 | ||
171 | static inline void debug_dma_sync_single_for_device(struct device *dev, | |
172 | dma_addr_t dma_handle, | |
173 | size_t size, int direction) | |
174 | { | |
175 | } | |
176 | ||
948408ba JR |
177 | static inline void debug_dma_sync_single_range_for_cpu(struct device *dev, |
178 | dma_addr_t dma_handle, | |
179 | unsigned long offset, | |
180 | size_t size, | |
181 | int direction) | |
182 | { | |
183 | } | |
184 | ||
185 | static inline void debug_dma_sync_single_range_for_device(struct device *dev, | |
186 | dma_addr_t dma_handle, | |
187 | unsigned long offset, | |
188 | size_t size, | |
189 | int direction) | |
190 | { | |
191 | } | |
192 | ||
a31fba5d JR |
193 | static inline void debug_dma_sync_sg_for_cpu(struct device *dev, |
194 | struct scatterlist *sg, | |
195 | int nelems, int direction) | |
196 | { | |
197 | } | |
198 | ||
199 | static inline void debug_dma_sync_sg_for_device(struct device *dev, | |
200 | struct scatterlist *sg, | |
201 | int nelems, int direction) | |
202 | { | |
203 | } | |
204 | ||
ac26c18b DW |
205 | static inline void debug_dma_dump_mappings(struct device *dev) |
206 | { | |
207 | } | |
208 | ||
0abdd7a8 DW |
209 | static inline void debug_dma_assert_idle(struct page *page) |
210 | { | |
211 | } | |
212 | ||
6bf07871 JR |
213 | #endif /* CONFIG_DMA_API_DEBUG */ |
214 | ||
f2f45e5f | 215 | #endif /* __DMA_DEBUG_H */ |