dma-debug.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #else /* CONFIG_DMA_API_DEBUG */
  41. static inline void dma_debug_init(u32 num_entries)
  42. {
  43. }
  44. static inline void debug_dma_map_page(struct device *dev, struct page *page,
  45. size_t offset, size_t size,
  46. int direction, dma_addr_t dma_addr,
  47. bool map_single)
  48. {
  49. }
  50. static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  51. size_t size, int direction,
  52. bool map_single)
  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. {
  58. }
  59. static inline void debug_dma_unmap_sg(struct device *dev,
  60. struct scatterlist *sglist,
  61. int nelems, int dir)
  62. {
  63. }
  64. static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
  65. dma_addr_t dma_addr, void *virt)
  66. {
  67. }
  68. static inline void debug_dma_free_coherent(struct device *dev, size_t size,
  69. void *virt, dma_addr_t addr)
  70. {
  71. }
  72. #endif /* CONFIG_DMA_API_DEBUG */
  73. #endif /* __DMA_DEBUG_H */