dma-mapping.h 2.9 KB

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