linux/include/linux/dma-debug.h
<<
>>
Prefs
   1/*
   2 * Copyright (C) 2008 Advanced Micro Devices, Inc.
   3 *
   4 * Author: Joerg Roedel <joerg.roedel@amd.com>
   5 *
   6 * This program is free software; you can redistribute it and/or modify it
   7 * under the terms of the GNU General Public License version 2 as published
   8 * by the Free Software Foundation.
   9 *
  10 * This program is distributed in the hope that it will be useful,
  11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 * GNU General Public License for more details.
  14 *
  15 * You should have received a copy of the GNU General Public License
  16 * along with this program; if not, write to the Free Software
  17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  18 */
  19
  20#ifndef __DMA_DEBUG_H
  21#define __DMA_DEBUG_H
  22
  23#include <linux/types.h>
  24
  25struct device;
  26struct scatterlist;
  27struct bus_type;
  28
  29#ifdef CONFIG_DMA_API_DEBUG
  30
  31extern void dma_debug_add_bus(struct bus_type *bus);
  32
  33extern int dma_debug_resize_entries(u32 num_entries);
  34
  35extern void debug_dma_map_single(struct device *dev, const void *addr,
  36                                 unsigned long len);
  37
  38extern void debug_dma_map_page(struct device *dev, struct page *page,
  39                               size_t offset, size_t size,
  40                               int direction, dma_addr_t dma_addr);
  41
  42extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
  43
  44extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  45                                 size_t size, int direction);
  46
  47extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
  48                             int nents, int mapped_ents, int direction);
  49
  50extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
  51                               int nelems, int dir);
  52
  53extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
  54                                     dma_addr_t dma_addr, void *virt);
  55
  56extern void debug_dma_free_coherent(struct device *dev, size_t size,
  57                                    void *virt, dma_addr_t addr);
  58
  59extern void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
  60                                   size_t size, int direction,
  61                                   dma_addr_t dma_addr);
  62
  63extern void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
  64                                     size_t size, int direction);
  65
  66extern void debug_dma_sync_single_for_cpu(struct device *dev,
  67                                          dma_addr_t dma_handle, size_t size,
  68                                          int direction);
  69
  70extern void debug_dma_sync_single_for_device(struct device *dev,
  71                                             dma_addr_t dma_handle,
  72                                             size_t size, int direction);
  73
  74extern void debug_dma_sync_sg_for_cpu(struct device *dev,
  75                                      struct scatterlist *sg,
  76                                      int nelems, int direction);
  77
  78extern void debug_dma_sync_sg_for_device(struct device *dev,
  79                                         struct scatterlist *sg,
  80                                         int nelems, int direction);
  81
  82extern void debug_dma_dump_mappings(struct device *dev);
  83
  84extern void debug_dma_assert_idle(struct page *page);
  85
  86#else /* CONFIG_DMA_API_DEBUG */
  87
  88static inline void dma_debug_add_bus(struct bus_type *bus)
  89{
  90}
  91
  92static inline int dma_debug_resize_entries(u32 num_entries)
  93{
  94        return 0;
  95}
  96
  97static inline void debug_dma_map_single(struct device *dev, const void *addr,
  98                                        unsigned long len)
  99{
 100}
 101
 102static inline void debug_dma_map_page(struct device *dev, struct page *page,
 103                                      size_t offset, size_t size,
 104                                      int direction, dma_addr_t dma_addr)
 105{
 106}
 107
 108static inline void debug_dma_mapping_error(struct device *dev,
 109                                          dma_addr_t dma_addr)
 110{
 111}
 112
 113static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
 114                                        size_t size, int direction)
 115{
 116}
 117
 118static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
 119                                    int nents, int mapped_ents, int direction)
 120{
 121}
 122
 123static inline void debug_dma_unmap_sg(struct device *dev,
 124                                      struct scatterlist *sglist,
 125                                      int nelems, int dir)
 126{
 127}
 128
 129static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
 130                                            dma_addr_t dma_addr, void *virt)
 131{
 132}
 133
 134static inline void debug_dma_free_coherent(struct device *dev, size_t size,
 135                                           void *virt, dma_addr_t addr)
 136{
 137}
 138
 139static inline void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
 140                                          size_t size, int direction,
 141                                          dma_addr_t dma_addr)
 142{
 143}
 144
 145static inline void debug_dma_unmap_resource(struct device *dev,
 146                                            dma_addr_t dma_addr, size_t size,
 147                                            int direction)
 148{
 149}
 150
 151static inline void debug_dma_sync_single_for_cpu(struct device *dev,
 152                                                 dma_addr_t dma_handle,
 153                                                 size_t size, int direction)
 154{
 155}
 156
 157static inline void debug_dma_sync_single_for_device(struct device *dev,
 158                                                    dma_addr_t dma_handle,
 159                                                    size_t size, int direction)
 160{
 161}
 162
 163static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
 164                                             struct scatterlist *sg,
 165                                             int nelems, int direction)
 166{
 167}
 168
 169static inline void debug_dma_sync_sg_for_device(struct device *dev,
 170                                                struct scatterlist *sg,
 171                                                int nelems, int direction)
 172{
 173}
 174
 175static inline void debug_dma_dump_mappings(struct device *dev)
 176{
 177}
 178
 179static inline void debug_dma_assert_idle(struct page *page)
 180{
 181}
 182
 183#endif /* CONFIG_DMA_API_DEBUG */
 184
 185#endif /* __DMA_DEBUG_H */
 186