1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2008 Advanced Micro Devices, Inc.
5 * Author: Joerg Roedel <joerg.roedel@amd.com>
8 #ifndef _KERNEL_DMA_DEBUG_H
9 #define _KERNEL_DMA_DEBUG_H
11 #ifdef CONFIG_DMA_API_DEBUG
12 extern void debug_dma_map_page(struct device *dev, struct page *page,
13 size_t offset, size_t size,
14 int direction, dma_addr_t dma_addr);
16 extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
17 size_t size, int direction);
19 extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
20 int nents, int mapped_ents, int direction);
22 extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
25 extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
26 dma_addr_t dma_addr, void *virt);
28 extern void debug_dma_free_coherent(struct device *dev, size_t size,
29 void *virt, dma_addr_t addr);
31 extern void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
32 size_t size, int direction,
35 extern void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
36 size_t size, int direction);
38 extern void debug_dma_sync_single_for_cpu(struct device *dev,
39 dma_addr_t dma_handle, size_t size,
42 extern void debug_dma_sync_single_for_device(struct device *dev,
43 dma_addr_t dma_handle,
44 size_t size, int direction);
46 extern void debug_dma_sync_sg_for_cpu(struct device *dev,
47 struct scatterlist *sg,
48 int nelems, int direction);
50 extern void debug_dma_sync_sg_for_device(struct device *dev,
51 struct scatterlist *sg,
52 int nelems, int direction);
53 #else /* CONFIG_DMA_API_DEBUG */
54 static inline void debug_dma_map_page(struct device *dev, struct page *page,
55 size_t offset, size_t size,
56 int direction, dma_addr_t dma_addr)
60 static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
61 size_t size, int direction)
65 static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
66 int nents, int mapped_ents, int direction)
70 static inline void debug_dma_unmap_sg(struct device *dev,
71 struct scatterlist *sglist,
76 static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
77 dma_addr_t dma_addr, void *virt)
81 static inline void debug_dma_free_coherent(struct device *dev, size_t size,
82 void *virt, dma_addr_t addr)
86 static inline void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
87 size_t size, int direction,
92 static inline void debug_dma_unmap_resource(struct device *dev,
93 dma_addr_t dma_addr, size_t size,
98 static inline void debug_dma_sync_single_for_cpu(struct device *dev,
99 dma_addr_t dma_handle,
100 size_t size, int direction)
104 static inline void debug_dma_sync_single_for_device(struct device *dev,
105 dma_addr_t dma_handle,
106 size_t size, int direction)
110 static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
111 struct scatterlist *sg,
112 int nelems, int direction)
116 static inline void debug_dma_sync_sg_for_device(struct device *dev,
117 struct scatterlist *sg,
118 int nelems, int direction)
121 #endif /* CONFIG_DMA_API_DEBUG */
122 #endif /* _KERNEL_DMA_DEBUG_H */