debug.h 3.4 KB

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