at v5.9-rc2 4.2 kB view raw
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 __DMA_DEBUG_H 9#define __DMA_DEBUG_H 10 11#include <linux/types.h> 12 13struct device; 14struct scatterlist; 15struct bus_type; 16 17#ifdef CONFIG_DMA_API_DEBUG 18 19extern void dma_debug_add_bus(struct bus_type *bus); 20 21extern void debug_dma_map_single(struct device *dev, const void *addr, 22 unsigned long len); 23 24extern void debug_dma_map_page(struct device *dev, struct page *page, 25 size_t offset, size_t size, 26 int direction, dma_addr_t dma_addr); 27 28extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr); 29 30extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, 31 size_t size, int direction); 32 33extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, 34 int nents, int mapped_ents, int direction); 35 36extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, 37 int nelems, int dir); 38 39extern void debug_dma_alloc_coherent(struct device *dev, size_t size, 40 dma_addr_t dma_addr, void *virt); 41 42extern void debug_dma_free_coherent(struct device *dev, size_t size, 43 void *virt, dma_addr_t addr); 44 45extern void debug_dma_map_resource(struct device *dev, phys_addr_t addr, 46 size_t size, int direction, 47 dma_addr_t dma_addr); 48 49extern void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr, 50 size_t size, int direction); 51 52extern void debug_dma_sync_single_for_cpu(struct device *dev, 53 dma_addr_t dma_handle, size_t size, 54 int direction); 55 56extern void debug_dma_sync_single_for_device(struct device *dev, 57 dma_addr_t dma_handle, 58 size_t size, int direction); 59 60extern void debug_dma_sync_sg_for_cpu(struct device *dev, 61 struct scatterlist *sg, 62 int nelems, int direction); 63 64extern void debug_dma_sync_sg_for_device(struct device *dev, 65 struct scatterlist *sg, 66 int nelems, int direction); 67 68extern void debug_dma_dump_mappings(struct device *dev); 69 70#else /* CONFIG_DMA_API_DEBUG */ 71 72static inline void dma_debug_add_bus(struct bus_type *bus) 73{ 74} 75 76static inline void debug_dma_map_single(struct device *dev, const void *addr, 77 unsigned long len) 78{ 79} 80 81static inline void debug_dma_map_page(struct device *dev, struct page *page, 82 size_t offset, size_t size, 83 int direction, dma_addr_t dma_addr) 84{ 85} 86 87static inline void debug_dma_mapping_error(struct device *dev, 88 dma_addr_t dma_addr) 89{ 90} 91 92static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, 93 size_t size, int direction) 94{ 95} 96 97static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, 98 int nents, int mapped_ents, int direction) 99{ 100} 101 102static inline void debug_dma_unmap_sg(struct device *dev, 103 struct scatterlist *sglist, 104 int nelems, int dir) 105{ 106} 107 108static inline void debug_dma_alloc_coherent(struct device *dev, size_t size, 109 dma_addr_t dma_addr, void *virt) 110{ 111} 112 113static inline void debug_dma_free_coherent(struct device *dev, size_t size, 114 void *virt, dma_addr_t addr) 115{ 116} 117 118static inline void debug_dma_map_resource(struct device *dev, phys_addr_t addr, 119 size_t size, int direction, 120 dma_addr_t dma_addr) 121{ 122} 123 124static inline void debug_dma_unmap_resource(struct device *dev, 125 dma_addr_t dma_addr, size_t size, 126 int direction) 127{ 128} 129 130static inline void debug_dma_sync_single_for_cpu(struct device *dev, 131 dma_addr_t dma_handle, 132 size_t size, int direction) 133{ 134} 135 136static inline void debug_dma_sync_single_for_device(struct device *dev, 137 dma_addr_t dma_handle, 138 size_t size, int direction) 139{ 140} 141 142static inline void debug_dma_sync_sg_for_cpu(struct device *dev, 143 struct scatterlist *sg, 144 int nelems, int direction) 145{ 146} 147 148static inline void debug_dma_sync_sg_for_device(struct device *dev, 149 struct scatterlist *sg, 150 int nelems, int direction) 151{ 152} 153 154static inline void debug_dma_dump_mappings(struct device *dev) 155{ 156} 157 158#endif /* CONFIG_DMA_API_DEBUG */ 159 160#endif /* __DMA_DEBUG_H */