1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2008 Advanced Micro Devices, Inc.
4 *
5 * Author: Joerg Roedel <joerg.roedel@amd.com>
6 */
7
8#ifndef _KERNEL_DMA_DEBUG_H
9#define _KERNEL_DMA_DEBUG_H
10
11#ifdef CONFIG_DMA_API_DEBUG
12extern void debug_dma_map_phys(struct device *dev, phys_addr_t phys,
13 size_t size, int direction, dma_addr_t dma_addr,
14 unsigned long attrs);
15
16extern void debug_dma_unmap_phys(struct device *dev, dma_addr_t addr,
17 size_t size, int direction);
18
19extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
20 int nents, int mapped_ents, int direction,
21 unsigned long attrs);
22
23extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
24 int nelems, int dir);
25
26extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
27 dma_addr_t dma_addr, void *virt,
28 unsigned long attrs);
29
30extern void debug_dma_free_coherent(struct device *dev, size_t size,
31 void *virt, dma_addr_t addr);
32
33extern void debug_dma_sync_single_for_cpu(struct device *dev,
34 dma_addr_t dma_handle, size_t size,
35 int direction);
36
37extern void debug_dma_sync_single_for_device(struct device *dev,
38 dma_addr_t dma_handle,
39 size_t size, int direction);
40
41extern void debug_dma_sync_sg_for_cpu(struct device *dev,
42 struct scatterlist *sg,
43 int nelems, int direction);
44
45extern void debug_dma_sync_sg_for_device(struct device *dev,
46 struct scatterlist *sg,
47 int nelems, int direction);
48extern void debug_dma_alloc_pages(struct device *dev, struct page *page,
49 size_t size, int direction,
50 dma_addr_t dma_addr,
51 unsigned long attrs);
52extern void debug_dma_free_pages(struct device *dev, struct page *page,
53 size_t size, int direction,
54 dma_addr_t dma_addr);
55#else /* CONFIG_DMA_API_DEBUG */
56static inline void debug_dma_map_phys(struct device *dev, phys_addr_t phys,
57 size_t size, int direction,
58 dma_addr_t dma_addr, unsigned long attrs)
59{
60}
61
62static inline void debug_dma_unmap_phys(struct device *dev, dma_addr_t addr,
63 size_t size, int direction)
64{
65}
66
67static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
68 int nents, int mapped_ents, int direction,
69 unsigned long attrs)
70{
71}
72
73static inline void debug_dma_unmap_sg(struct device *dev,
74 struct scatterlist *sglist,
75 int nelems, int dir)
76{
77}
78
79static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
80 dma_addr_t dma_addr, void *virt,
81 unsigned long attrs)
82{
83}
84
85static inline void debug_dma_free_coherent(struct device *dev, size_t size,
86 void *virt, dma_addr_t addr)
87{
88}
89
90static inline void debug_dma_sync_single_for_cpu(struct device *dev,
91 dma_addr_t dma_handle,
92 size_t size, int direction)
93{
94}
95
96static inline void debug_dma_sync_single_for_device(struct device *dev,
97 dma_addr_t dma_handle,
98 size_t size, int direction)
99{
100}
101
102static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
103 struct scatterlist *sg,
104 int nelems, int direction)
105{
106}
107
108static inline void debug_dma_sync_sg_for_device(struct device *dev,
109 struct scatterlist *sg,
110 int nelems, int direction)
111{
112}
113
114static inline void debug_dma_alloc_pages(struct device *dev, struct page *page,
115 size_t size, int direction,
116 dma_addr_t dma_addr,
117 unsigned long attrs)
118{
119}
120
121static inline void debug_dma_free_pages(struct device *dev, struct page *page,
122 size_t size, int direction,
123 dma_addr_t dma_addr)
124{
125}
126#endif /* CONFIG_DMA_API_DEBUG */
127#endif /* _KERNEL_DMA_DEBUG_H */
128