dma-mapping.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef _M68K_DMA_MAPPING_H
  2. #define _M68K_DMA_MAPPING_H
  3. #include <asm/cache.h>
  4. struct scatterlist;
  5. #ifndef CONFIG_MMU_SUN3
  6. static inline int dma_supported(struct device *dev, u64 mask)
  7. {
  8. return 1;
  9. }
  10. static inline int dma_set_mask(struct device *dev, u64 mask)
  11. {
  12. return 0;
  13. }
  14. static inline int dma_get_cache_alignment(void)
  15. {
  16. return 1 << L1_CACHE_SHIFT;
  17. }
  18. static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
  19. {
  20. return 0;
  21. }
  22. extern void *dma_alloc_coherent(struct device *, size_t,
  23. dma_addr_t *, gfp_t);
  24. extern void dma_free_coherent(struct device *, size_t,
  25. void *, dma_addr_t);
  26. static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
  27. dma_addr_t *handle, gfp_t flag)
  28. {
  29. return dma_alloc_coherent(dev, size, handle, flag);
  30. }
  31. static inline void dma_free_noncoherent(struct device *dev, size_t size,
  32. void *addr, dma_addr_t handle)
  33. {
  34. dma_free_coherent(dev, size, addr, handle);
  35. }
  36. static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
  37. enum dma_data_direction dir)
  38. {
  39. /* we use coherent allocation, so not much to do here. */
  40. }
  41. extern dma_addr_t dma_map_single(struct device *, void *, size_t,
  42. enum dma_data_direction);
  43. static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
  44. size_t size, enum dma_data_direction dir)
  45. {
  46. }
  47. extern dma_addr_t dma_map_page(struct device *, struct page *,
  48. unsigned long, size_t size,
  49. enum dma_data_direction);
  50. static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
  51. size_t size, enum dma_data_direction dir)
  52. {
  53. }
  54. extern int dma_map_sg(struct device *, struct scatterlist *, int,
  55. enum dma_data_direction);
  56. static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
  57. int nhwentries, enum dma_data_direction dir)
  58. {
  59. }
  60. extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
  61. enum dma_data_direction);
  62. extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
  63. enum dma_data_direction);
  64. static inline void dma_sync_single_range_for_device(struct device *dev,
  65. dma_addr_t dma_handle, unsigned long offset, size_t size,
  66. enum dma_data_direction direction)
  67. {
  68. /* just sync everything for now */
  69. dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
  70. }
  71. static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
  72. size_t size, enum dma_data_direction dir)
  73. {
  74. }
  75. static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
  76. int nents, enum dma_data_direction dir)
  77. {
  78. }
  79. static inline void dma_sync_single_range_for_cpu(struct device *dev,
  80. dma_addr_t dma_handle, unsigned long offset, size_t size,
  81. enum dma_data_direction direction)
  82. {
  83. /* just sync everything for now */
  84. dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
  85. }
  86. static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
  87. {
  88. return 0;
  89. }
  90. #else
  91. #include <asm-generic/dma-mapping-broken.h>
  92. #endif
  93. #endif /* _M68K_DMA_MAPPING_H */