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