2 * Copyright (C) 2008 Advanced Micro Devices, Inc.
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.
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.
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
23 #include <linux/types.h>
29 #ifdef CONFIG_DMA_API_DEBUG
31 extern void dma_debug_add_bus(struct bus_type *bus);
33 extern int dma_debug_resize_entries(u32 num_entries);
35 extern void debug_dma_map_page(struct device *dev, struct page *page,
36 size_t offset, size_t size,
37 int direction, dma_addr_t dma_addr,
40 extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
42 extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
43 size_t size, int direction, bool map_single);
45 extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
46 int nents, int mapped_ents, int direction);
48 extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
51 extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
52 dma_addr_t dma_addr, void *virt);
54 extern void debug_dma_free_coherent(struct device *dev, size_t size,
55 void *virt, dma_addr_t addr);
57 extern void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
58 size_t size, int direction,
61 extern void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
62 size_t size, int direction);
64 extern void debug_dma_sync_single_for_cpu(struct device *dev,
65 dma_addr_t dma_handle, size_t size,
68 extern void debug_dma_sync_single_for_device(struct device *dev,
69 dma_addr_t dma_handle,
70 size_t size, int direction);
72 extern void debug_dma_sync_single_range_for_cpu(struct device *dev,
73 dma_addr_t dma_handle,
78 extern void debug_dma_sync_single_range_for_device(struct device *dev,
79 dma_addr_t dma_handle,
81 size_t size, int direction);
83 extern void debug_dma_sync_sg_for_cpu(struct device *dev,
84 struct scatterlist *sg,
85 int nelems, int direction);
87 extern void debug_dma_sync_sg_for_device(struct device *dev,
88 struct scatterlist *sg,
89 int nelems, int direction);
91 extern void debug_dma_dump_mappings(struct device *dev);
93 extern void debug_dma_assert_idle(struct page *page);
95 #else /* CONFIG_DMA_API_DEBUG */
97 static inline void dma_debug_add_bus(struct bus_type *bus)
101 static inline int dma_debug_resize_entries(u32 num_entries)
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,
113 static inline void debug_dma_mapping_error(struct device *dev,
118 static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
119 size_t size, int direction,
124 static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
125 int nents, int mapped_ents, int direction)
129 static inline void debug_dma_unmap_sg(struct device *dev,
130 struct scatterlist *sglist,
135 static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
136 dma_addr_t dma_addr, void *virt)
140 static inline void debug_dma_free_coherent(struct device *dev, size_t size,
141 void *virt, dma_addr_t addr)
145 static inline void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
146 size_t size, int direction,
151 static inline void debug_dma_unmap_resource(struct device *dev,
152 dma_addr_t dma_addr, size_t size,
157 static inline void debug_dma_sync_single_for_cpu(struct device *dev,
158 dma_addr_t dma_handle,
159 size_t size, int direction)
163 static inline void debug_dma_sync_single_for_device(struct device *dev,
164 dma_addr_t dma_handle,
165 size_t size, int direction)
169 static inline void debug_dma_sync_single_range_for_cpu(struct device *dev,
170 dma_addr_t dma_handle,
171 unsigned long offset,
177 static inline void debug_dma_sync_single_range_for_device(struct device *dev,
178 dma_addr_t dma_handle,
179 unsigned long offset,
185 static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
186 struct scatterlist *sg,
187 int nelems, int direction)
191 static inline void debug_dma_sync_sg_for_device(struct device *dev,
192 struct scatterlist *sg,
193 int nelems, int direction)
197 static inline void debug_dma_dump_mappings(struct device *dev)
201 static inline void debug_dma_assert_idle(struct page *page)
205 #endif /* CONFIG_DMA_API_DEBUG */
207 #endif /* __DMA_DEBUG_H */