dma-mapping.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Copyright (C) 2006 Atmark Techno, Inc.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. */
  8. #ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
  9. #define _ASM_MICROBLAZE_DMA_MAPPING_H
  10. #include <asm/cacheflush.h>
  11. #include <linux/io.h>
  12. #include <linux/bug.h>
  13. struct scatterlist;
  14. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  15. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  16. /* FIXME */
  17. static inline int
  18. dma_supported(struct device *dev, u64 mask)
  19. {
  20. return 1;
  21. }
  22. static inline dma_addr_t
  23. dma_map_page(struct device *dev, struct page *page,
  24. unsigned long offset, size_t size,
  25. enum dma_data_direction direction)
  26. {
  27. BUG();
  28. return 0;
  29. }
  30. static inline void
  31. dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
  32. enum dma_data_direction direction)
  33. {
  34. BUG();
  35. }
  36. static inline int
  37. dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
  38. enum dma_data_direction direction)
  39. {
  40. BUG();
  41. return 0;
  42. }
  43. static inline void
  44. dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
  45. enum dma_data_direction direction)
  46. {
  47. BUG();
  48. }
  49. static inline void
  50. dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
  51. enum dma_data_direction direction)
  52. {
  53. BUG();
  54. }
  55. static inline void
  56. dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
  57. size_t size, enum dma_data_direction direction)
  58. {
  59. BUG();
  60. }
  61. static inline void
  62. dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
  63. enum dma_data_direction direction)
  64. {
  65. BUG();
  66. }
  67. static inline void
  68. dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
  69. enum dma_data_direction direction)
  70. {
  71. BUG();
  72. }
  73. static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
  74. {
  75. return 0;
  76. }
  77. static inline void *dma_alloc_coherent(struct device *dev, size_t size,
  78. dma_addr_t *dma_handle, int flag)
  79. {
  80. return NULL; /* consistent_alloc(flag, size, dma_handle); */
  81. }
  82. static inline void dma_free_coherent(struct device *dev, size_t size,
  83. void *vaddr, dma_addr_t dma_handle)
  84. {
  85. BUG();
  86. }
  87. static inline dma_addr_t
  88. dma_map_single(struct device *dev, void *ptr, size_t size,
  89. enum dma_data_direction direction)
  90. {
  91. BUG_ON(direction == DMA_NONE);
  92. return virt_to_bus(ptr);
  93. }
  94. static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
  95. size_t size,
  96. enum dma_data_direction direction)
  97. {
  98. switch (direction) {
  99. case DMA_FROM_DEVICE:
  100. flush_dcache_range((unsigned)dma_addr,
  101. (unsigned)dma_addr + size);
  102. /* Fall through */
  103. case DMA_TO_DEVICE:
  104. break;
  105. default:
  106. BUG();
  107. }
  108. }
  109. #endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */