dma-debug.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. #ifndef __DMA_DEBUG_H
  20. #define __DMA_DEBUG_H
  21. #include <linux/types.h>
  22. struct device;
  23. struct scatterlist;
  24. struct bus_type;
  25. #ifdef CONFIG_DMA_API_DEBUG
  26. extern void dma_debug_add_bus(struct bus_type *bus);
  27. extern void dma_debug_init(u32 num_entries);
  28. extern int dma_debug_resize_entries(u32 num_entries);
  29. extern void debug_dma_map_page(struct device *dev, struct page *page,
  30. size_t offset, size_t size,
  31. int direction, dma_addr_t dma_addr,
  32. bool map_single);
  33. extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  34. size_t size, int direction, bool map_single);
  35. extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
  36. int nents, int mapped_ents, int direction);
  37. extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
  38. int nelems, int dir);
  39. extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
  40. dma_addr_t dma_addr, void *virt);
  41. extern void debug_dma_free_coherent(struct device *dev, size_t size,
  42. void *virt, dma_addr_t addr);
  43. extern void debug_dma_sync_single_for_cpu(struct device *dev,
  44. dma_addr_t dma_handle, size_t size,
  45. int direction);
  46. extern void debug_dma_sync_single_for_device(struct device *dev,
  47. dma_addr_t dma_handle,
  48. size_t size, int direction);
  49. extern void debug_dma_sync_single_range_for_cpu(struct device *dev,
  50. dma_addr_t dma_handle,
  51. unsigned long offset,
  52. size_t size,
  53. int direction);
  54. extern void debug_dma_sync_single_range_for_device(struct device *dev,
  55. dma_addr_t dma_handle,
  56. unsigned long offset,
  57. size_t size, int direction);
  58. extern void debug_dma_sync_sg_for_cpu(struct device *dev,
  59. struct scatterlist *sg,
  60. int nelems, int direction);
  61. extern void debug_dma_sync_sg_for_device(struct device *dev,
  62. struct scatterlist *sg,
  63. int nelems, int direction);
  64. extern void debug_dma_dump_mappings(struct device *dev);
  65. #else /* CONFIG_DMA_API_DEBUG */
  66. static inline void dma_debug_add_bus(struct bus_type *bus)
  67. {
  68. }
  69. static inline void dma_debug_init(u32 num_entries)
  70. {
  71. }
  72. static inline int dma_debug_resize_entries(u32 num_entries)
  73. {
  74. return 0;
  75. }
  76. static inline void debug_dma_map_page(struct device *dev, struct page *page,
  77. size_t offset, size_t size,
  78. int direction, dma_addr_t dma_addr,
  79. bool map_single)
  80. {
  81. }
  82. static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  83. size_t size, int direction,
  84. bool map_single)
  85. {
  86. }
  87. static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
  88. int nents, int mapped_ents, int direction)
  89. {
  90. }
  91. static inline void debug_dma_unmap_sg(struct device *dev,
  92. struct scatterlist *sglist,
  93. int nelems, int dir)
  94. {
  95. }
  96. static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
  97. dma_addr_t dma_addr, void *virt)
  98. {
  99. }
  100. static inline void debug_dma_free_coherent(struct device *dev, size_t size,
  101. void *virt, dma_addr_t addr)
  102. {
  103. }
  104. static inline void debug_dma_sync_single_for_cpu(struct device *dev,
  105. dma_addr_t dma_handle,
  106. size_t size, int direction)
  107. {
  108. }
  109. static inline void debug_dma_sync_single_for_device(struct device *dev,
  110. dma_addr_t dma_handle,
  111. size_t size, int direction)
  112. {
  113. }
  114. static inline void debug_dma_sync_single_range_for_cpu(struct device *dev,
  115. dma_addr_t dma_handle,
  116. unsigned long offset,
  117. size_t size,
  118. int direction)
  119. {
  120. }
  121. static inline void debug_dma_sync_single_range_for_device(struct device *dev,
  122. dma_addr_t dma_handle,
  123. unsigned long offset,
  124. size_t size,
  125. int direction)
  126. {
  127. }
  128. static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
  129. struct scatterlist *sg,
  130. int nelems, int direction)
  131. {
  132. }
  133. static inline void debug_dma_sync_sg_for_device(struct device *dev,
  134. struct scatterlist *sg,
  135. int nelems, int direction)
  136. {
  137. }
  138. static inline void debug_dma_dump_mappings(struct device *dev)
  139. {
  140. }
  141. #endif /* CONFIG_DMA_API_DEBUG */
  142. #endif /* __DMA_DEBUG_H */