dma-debug.h 4.4 KB

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