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_single(struct device *dev, const void *addr,
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,
43 extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
45 extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
46 size_t size, int direction, bool map_single);
48 extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
49 int nents, int mapped_ents, int direction);
51 extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
54 extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
55 dma_addr_t dma_addr, void *virt);
57 extern void debug_dma_free_coherent(struct device *dev, size_t size,
58 void *virt, dma_addr_t addr);
60 extern void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
61 size_t size, int direction,
64 extern void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
65 size_t size, int direction);
67 extern void debug_dma_sync_single_for_cpu(struct device *dev,
68 dma_addr_t dma_handle, size_t size,
71 extern void debug_dma_sync_single_for_device(struct device *dev,
72 dma_addr_t dma_handle,
73 size_t size, int direction);
75 extern void debug_dma_sync_single_range_for_cpu(struct device *dev,
76 dma_addr_t dma_handle,
81 extern void debug_dma_sync_single_range_for_device(struct device *dev,
82 dma_addr_t dma_handle,
84 size_t size, int direction);
86 extern void debug_dma_sync_sg_for_cpu(struct device *dev,
87 struct scatterlist *sg,
88 int nelems, int direction);
90 extern void debug_dma_sync_sg_for_device(struct device *dev,
91 struct scatterlist *sg,
92 int nelems, int direction);
94 extern void debug_dma_dump_mappings(struct device *dev);
96 extern void debug_dma_assert_idle(struct page *page);
98 #else /* CONFIG_DMA_API_DEBUG */
100 static inline void dma_debug_add_bus(struct bus_type *bus)
104 static inline int dma_debug_resize_entries(u32 num_entries)
109 static inline void debug_dma_map_single(struct device *dev, const void *addr,
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,
121 static inline void debug_dma_mapping_error(struct device *dev,
126 static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
127 size_t size, int direction,
132 static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
133 int nents, int mapped_ents, int direction)
137 static inline void debug_dma_unmap_sg(struct device *dev,
138 struct scatterlist *sglist,
143 static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
144 dma_addr_t dma_addr, void *virt)
148 static inline void debug_dma_free_coherent(struct device *dev, size_t size,
149 void *virt, dma_addr_t addr)
153 static inline void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
154 size_t size, int direction,
159 static inline void debug_dma_unmap_resource(struct device *dev,
160 dma_addr_t dma_addr, size_t size,
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)
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)
177 static inline void debug_dma_sync_single_range_for_cpu(struct device *dev,
178 dma_addr_t dma_handle,
179 unsigned long offset,
185 static inline void debug_dma_sync_single_range_for_device(struct device *dev,
186 dma_addr_t dma_handle,
187 unsigned long offset,
193 static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
194 struct scatterlist *sg,
195 int nelems, int direction)
199 static inline void debug_dma_sync_sg_for_device(struct device *dev,
200 struct scatterlist *sg,
201 int nelems, int direction)
205 static inline void debug_dma_dump_mappings(struct device *dev)
209 static inline void debug_dma_assert_idle(struct page *page)
213 #endif /* CONFIG_DMA_API_DEBUG */
215 #endif /* __DMA_DEBUG_H */