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