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
,
17 extern void debug_dma_unmap_page(struct device
*dev
, dma_addr_t addr
,
18 size_t size
, int direction
);
20 extern void debug_dma_map_sg(struct device
*dev
, struct scatterlist
*sg
,
21 int nents
, int mapped_ents
, int direction
,
24 extern void debug_dma_unmap_sg(struct device
*dev
, struct scatterlist
*sglist
,
27 extern void debug_dma_alloc_coherent(struct device
*dev
, size_t size
,
28 dma_addr_t dma_addr
, void *virt
,
31 extern void debug_dma_free_coherent(struct device
*dev
, size_t size
,
32 void *virt
, dma_addr_t addr
);
34 extern void debug_dma_map_resource(struct device
*dev
, phys_addr_t addr
,
35 size_t size
, int direction
,
39 extern void debug_dma_unmap_resource(struct device
*dev
, dma_addr_t dma_addr
,
40 size_t size
, int direction
);
42 extern void debug_dma_sync_single_for_cpu(struct device
*dev
,
43 dma_addr_t dma_handle
, size_t size
,
46 extern void debug_dma_sync_single_for_device(struct device
*dev
,
47 dma_addr_t dma_handle
,
48 size_t size
, int direction
);
50 extern void debug_dma_sync_sg_for_cpu(struct device
*dev
,
51 struct scatterlist
*sg
,
52 int nelems
, int direction
);
54 extern void debug_dma_sync_sg_for_device(struct device
*dev
,
55 struct scatterlist
*sg
,
56 int nelems
, int direction
);
57 #else /* CONFIG_DMA_API_DEBUG */
58 static inline void debug_dma_map_page(struct device
*dev
, struct page
*page
,
59 size_t offset
, size_t size
,
60 int direction
, dma_addr_t dma_addr
,
65 static inline void debug_dma_unmap_page(struct device
*dev
, dma_addr_t addr
,
66 size_t size
, int direction
)
70 static inline void debug_dma_map_sg(struct device
*dev
, struct scatterlist
*sg
,
71 int nents
, int mapped_ents
, int direction
,
76 static inline void debug_dma_unmap_sg(struct device
*dev
,
77 struct scatterlist
*sglist
,
82 static inline void debug_dma_alloc_coherent(struct device
*dev
, size_t size
,
83 dma_addr_t dma_addr
, void *virt
,
88 static inline void debug_dma_free_coherent(struct device
*dev
, size_t size
,
89 void *virt
, dma_addr_t addr
)
93 static inline void debug_dma_map_resource(struct device
*dev
, phys_addr_t addr
,
94 size_t size
, int direction
,
100 static inline void debug_dma_unmap_resource(struct device
*dev
,
101 dma_addr_t dma_addr
, size_t size
,
106 static inline void debug_dma_sync_single_for_cpu(struct device
*dev
,
107 dma_addr_t dma_handle
,
108 size_t size
, int direction
)
112 static inline void debug_dma_sync_single_for_device(struct device
*dev
,
113 dma_addr_t dma_handle
,
114 size_t size
, int direction
)
118 static inline void debug_dma_sync_sg_for_cpu(struct device
*dev
,
119 struct scatterlist
*sg
,
120 int nelems
, int direction
)
124 static inline void debug_dma_sync_sg_for_device(struct device
*dev
,
125 struct scatterlist
*sg
,
126 int nelems
, int direction
)
129 #endif /* CONFIG_DMA_API_DEBUG */
130 #endif /* _KERNEL_DMA_DEBUG_H */