| 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 |  | 
|---|
| 19 | extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, | 
|---|
| 20 | int nents, int mapped_ents, int direction, | 
|---|
| 21 | unsigned long attrs); | 
|---|
| 22 |  | 
|---|
| 23 | extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, | 
|---|
| 24 | int nelems, int dir); | 
|---|
| 25 |  | 
|---|
| 26 | extern void debug_dma_alloc_coherent(struct device *dev, size_t size, | 
|---|
| 27 | dma_addr_t dma_addr, void *virt, | 
|---|
| 28 | unsigned long attrs); | 
|---|
| 29 |  | 
|---|
| 30 | extern void debug_dma_free_coherent(struct device *dev, size_t size, | 
|---|
| 31 | void *virt, dma_addr_t addr); | 
|---|
| 32 |  | 
|---|
| 33 | extern void debug_dma_sync_single_for_cpu(struct device *dev, | 
|---|
| 34 | dma_addr_t dma_handle, size_t size, | 
|---|
| 35 | int direction); | 
|---|
| 36 |  | 
|---|
| 37 | extern void debug_dma_sync_single_for_device(struct device *dev, | 
|---|
| 38 | dma_addr_t dma_handle, | 
|---|
| 39 | size_t size, int direction); | 
|---|
| 40 |  | 
|---|
| 41 | extern void debug_dma_sync_sg_for_cpu(struct device *dev, | 
|---|
| 42 | struct scatterlist *sg, | 
|---|
| 43 | int nelems, int direction); | 
|---|
| 44 |  | 
|---|
| 45 | extern void debug_dma_sync_sg_for_device(struct device *dev, | 
|---|
| 46 | struct scatterlist *sg, | 
|---|
| 47 | int nelems, int direction); | 
|---|
| 48 | extern 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); | 
|---|
| 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 | { | 
|---|
| 65 | } | 
|---|
| 66 |  | 
|---|
| 67 | static 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 |  | 
|---|
| 73 | static inline void debug_dma_unmap_sg(struct device *dev, | 
|---|
| 74 | struct scatterlist *sglist, | 
|---|
| 75 | int nelems, int dir) | 
|---|
| 76 | { | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | static 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 |  | 
|---|
| 85 | static inline void debug_dma_free_coherent(struct device *dev, size_t size, | 
|---|
| 86 | void *virt, dma_addr_t addr) | 
|---|
| 87 | { | 
|---|
| 88 | } | 
|---|
| 89 |  | 
|---|
| 90 | static 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 |  | 
|---|
| 96 | static 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 |  | 
|---|
| 102 | static inline void debug_dma_sync_sg_for_cpu(struct device *dev, | 
|---|
| 103 | struct scatterlist *sg, | 
|---|
| 104 | int nelems, int direction) | 
|---|
| 105 | { | 
|---|
| 106 | } | 
|---|
| 107 |  | 
|---|
| 108 | static inline void debug_dma_sync_sg_for_device(struct device *dev, | 
|---|
| 109 | struct scatterlist *sg, | 
|---|
| 110 | int nelems, int direction) | 
|---|
| 111 | { | 
|---|
| 112 | } | 
|---|
| 113 |  | 
|---|
| 114 | static 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 |  | 
|---|
| 121 | static 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 |  | 
|---|