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 12 extern 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 16 extern void debug_dma_unmap_phys(struct device *dev, dma_addr_t addr, 17 size_t size, int direction, 18 unsigned long attrs); 19 20 extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, 21 int nents, int mapped_ents, int direction, 22 unsigned long attrs); 23 24 extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, 25 int nelems, int dir, unsigned long attrs); 26 27 extern void debug_dma_alloc_coherent(struct device *dev, size_t size, 28 dma_addr_t dma_addr, void *virt, 29 unsigned long attrs); 30 31 extern void debug_dma_free_coherent(struct device *dev, size_t size, void *virt, 32 dma_addr_t addr, unsigned long attrs); 33 34 extern void debug_dma_sync_single_for_cpu(struct device *dev, 35 dma_addr_t dma_handle, size_t size, 36 int direction); 37 38 extern void debug_dma_sync_single_for_device(struct device *dev, 39 dma_addr_t dma_handle, 40 size_t size, int direction); 41 42 extern void debug_dma_sync_sg_for_cpu(struct device *dev, 43 struct scatterlist *sg, 44 int nelems, int direction); 45 46 extern void debug_dma_sync_sg_for_device(struct device *dev, 47 struct scatterlist *sg, 48 int nelems, int direction); 49 extern void debug_dma_alloc_pages(struct device *dev, struct page *page, 50 size_t size, int direction, 51 dma_addr_t dma_addr); 52 extern 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 */ 56 static 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 62 static inline void debug_dma_unmap_phys(struct device *dev, dma_addr_t addr, 63 size_t size, int direction, 64 unsigned long attrs) 65 { 66 } 67 68 static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, 69 int nents, int mapped_ents, int direction, 70 unsigned long attrs) 71 { 72 } 73 74 static inline void debug_dma_unmap_sg(struct device *dev, 75 struct scatterlist *sglist, int nelems, 76 int dir, unsigned long attrs) 77 { 78 } 79 80 static inline void debug_dma_alloc_coherent(struct device *dev, size_t size, 81 dma_addr_t dma_addr, void *virt, 82 unsigned long attrs) 83 { 84 } 85 86 static inline void debug_dma_free_coherent(struct device *dev, size_t size, 87 void *virt, dma_addr_t addr, 88 unsigned long attrs) 89 { 90 } 91 92 static inline void debug_dma_sync_single_for_cpu(struct device *dev, 93 dma_addr_t dma_handle, 94 size_t size, int direction) 95 { 96 } 97 98 static inline void debug_dma_sync_single_for_device(struct device *dev, 99 dma_addr_t dma_handle, 100 size_t size, int direction) 101 { 102 } 103 104 static inline void debug_dma_sync_sg_for_cpu(struct device *dev, 105 struct scatterlist *sg, 106 int nelems, int direction) 107 { 108 } 109 110 static inline void debug_dma_sync_sg_for_device(struct device *dev, 111 struct scatterlist *sg, 112 int nelems, int direction) 113 { 114 } 115 116 static inline void debug_dma_alloc_pages(struct device *dev, struct page *page, 117 size_t size, int direction, 118 dma_addr_t dma_addr) 119 { 120 } 121 122 static inline void debug_dma_free_pages(struct device *dev, struct page *page, 123 size_t size, int direction, 124 dma_addr_t dma_addr) 125 { 126 } 127 #endif /* CONFIG_DMA_API_DEBUG */ 128 #endif /* _KERNEL_DMA_DEBUG_H */ 129