debug.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2008 Advanced Micro Devices, Inc.
  4. *
  5. * Author: Joerg Roedel <[email protected]>
  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. #else /* CONFIG_DMA_API_DEBUG */
  45. static inline void debug_dma_map_page(struct device *dev, struct page *page,
  46. size_t offset, size_t size,
  47. int direction, dma_addr_t dma_addr,
  48. unsigned long attrs)
  49. {
  50. }
  51. static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  52. size_t size, int direction)
  53. {
  54. }
  55. static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
  56. int nents, int mapped_ents, int direction,
  57. unsigned long attrs)
  58. {
  59. }
  60. static inline void debug_dma_unmap_sg(struct device *dev,
  61. struct scatterlist *sglist,
  62. int nelems, int dir)
  63. {
  64. }
  65. static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
  66. dma_addr_t dma_addr, void *virt,
  67. unsigned long attrs)
  68. {
  69. }
  70. static inline void debug_dma_free_coherent(struct device *dev, size_t size,
  71. void *virt, dma_addr_t addr)
  72. {
  73. }
  74. static inline void debug_dma_map_resource(struct device *dev, phys_addr_t addr,
  75. size_t size, int direction,
  76. dma_addr_t dma_addr,
  77. unsigned long attrs)
  78. {
  79. }
  80. static inline void debug_dma_unmap_resource(struct device *dev,
  81. dma_addr_t dma_addr, size_t size,
  82. int direction)
  83. {
  84. }
  85. static inline void debug_dma_sync_single_for_cpu(struct device *dev,
  86. dma_addr_t dma_handle,
  87. size_t size, int direction)
  88. {
  89. }
  90. static inline void debug_dma_sync_single_for_device(struct device *dev,
  91. dma_addr_t dma_handle,
  92. size_t size, int direction)
  93. {
  94. }
  95. static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
  96. struct scatterlist *sg,
  97. int nelems, int direction)
  98. {
  99. }
  100. static inline void debug_dma_sync_sg_for_device(struct device *dev,
  101. struct scatterlist *sg,
  102. int nelems, int direction)
  103. {
  104. }
  105. #endif /* CONFIG_DMA_API_DEBUG */
  106. #endif /* _KERNEL_DMA_DEBUG_H */