debug.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. #ifndef _KERNEL_DMA_DEBUG_H
  8. #define _KERNEL_DMA_DEBUG_H
  9. #ifdef CONFIG_DMA_API_DEBUG
  10. extern void debug_dma_map_page(struct device *dev, struct page *page,
  11. size_t offset, size_t size,
  12. int direction, dma_addr_t dma_addr,
  13. unsigned long attrs);
  14. extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  15. size_t size, int direction);
  16. extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
  17. int nents, int mapped_ents, int direction,
  18. unsigned long attrs);
  19. extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
  20. int nelems, int dir);
  21. extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
  22. dma_addr_t dma_addr, void *virt,
  23. unsigned long attrs);
  24. extern void debug_dma_free_coherent(struct device *dev, size_t size,
  25. void *virt, dma_addr_t addr);
  26. extern void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
  27. size_t size, int direction,
  28. dma_addr_t dma_addr,
  29. unsigned long attrs);
  30. extern void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
  31. size_t size, int direction);
  32. extern void debug_dma_sync_single_for_cpu(struct device *dev,
  33. dma_addr_t dma_handle, size_t size,
  34. int direction);
  35. extern void debug_dma_sync_single_for_device(struct device *dev,
  36. dma_addr_t dma_handle,
  37. size_t size, int direction);
  38. extern void debug_dma_sync_sg_for_cpu(struct device *dev,
  39. struct scatterlist *sg,
  40. int nelems, int direction);
  41. extern void debug_dma_sync_sg_for_device(struct device *dev,
  42. struct scatterlist *sg,
  43. int nelems, int direction);
  44. extern void debug_dma_alloc_pages(struct device *dev, struct page *page,
  45. size_t size, int direction,
  46. dma_addr_t dma_addr,
  47. unsigned long attrs);
  48. extern void debug_dma_free_pages(struct device *dev, struct page *page,
  49. size_t size, int direction,
  50. dma_addr_t dma_addr);
  51. #else /* CONFIG_DMA_API_DEBUG */
  52. static inline void debug_dma_map_page(struct device *dev, struct page *page,
  53. size_t offset, size_t size,
  54. int direction, dma_addr_t dma_addr,
  55. unsigned long attrs)
  56. {
  57. }
  58. static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  59. size_t size, int direction)
  60. {
  61. }
  62. static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
  63. int nents, int mapped_ents, int direction,
  64. unsigned long attrs)
  65. {
  66. }
  67. static inline void debug_dma_unmap_sg(struct device *dev,
  68. struct scatterlist *sglist,
  69. int nelems, int dir)
  70. {
  71. }
  72. static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
  73. dma_addr_t dma_addr, void *virt,
  74. unsigned long attrs)
  75. {
  76. }
  77. static inline void debug_dma_free_coherent(struct device *dev, size_t size,
  78. void *virt, dma_addr_t addr)
  79. {
  80. }
  81. static inline void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
  82. size_t size, int direction,
  83. dma_addr_t dma_addr,
  84. unsigned long attrs)
  85. {
  86. }
  87. static inline void debug_dma_unmap_resource(struct device *dev,
  88. dma_addr_t dma_addr, size_t size,
  89. int direction)
  90. {
  91. }
  92. static inline void debug_dma_sync_single_for_cpu(struct device *dev,
  93. dma_addr_t dma_handle,
  94. size_t size, int direction)
  95. {
  96. }
  97. static inline void debug_dma_sync_single_for_device(struct device *dev,
  98. dma_addr_t dma_handle,
  99. size_t size, int direction)
  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. static inline void debug_dma_sync_sg_for_device(struct device *dev,
  108. struct scatterlist *sg,
  109. int nelems, int direction)
  110. {
  111. }
  112. static inline void debug_dma_alloc_pages(struct device *dev, struct page *page,
  113. size_t size, int direction,
  114. dma_addr_t dma_addr,
  115. unsigned long attrs)
  116. {
  117. }
  118. static inline void debug_dma_free_pages(struct device *dev, struct page *page,
  119. size_t size, int direction,
  120. dma_addr_t dma_addr)
  121. {
  122. }
  123. #endif /* CONFIG_DMA_API_DEBUG */
  124. #endif /* _KERNEL_DMA_DEBUG_H */