dma-mapping.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef _ALPHA_DMA_MAPPING_H
  2. #define _ALPHA_DMA_MAPPING_H
  3. #include <linux/dma-attrs.h>
  4. extern struct dma_map_ops *dma_ops;
  5. static inline struct dma_map_ops *get_dma_ops(struct device *dev)
  6. {
  7. return dma_ops;
  8. }
  9. #include <asm-generic/dma-mapping-common.h>
  10. static inline void *dma_alloc_coherent(struct device *dev, size_t size,
  11. dma_addr_t *dma_handle, gfp_t gfp)
  12. {
  13. return get_dma_ops(dev)->alloc_coherent(dev, size, dma_handle, gfp);
  14. }
  15. static inline void dma_free_coherent(struct device *dev, size_t size,
  16. void *vaddr, dma_addr_t dma_handle)
  17. {
  18. get_dma_ops(dev)->free_coherent(dev, size, vaddr, dma_handle);
  19. }
  20. static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
  21. {
  22. return get_dma_ops(dev)->mapping_error(dev, dma_addr);
  23. }
  24. static inline int dma_supported(struct device *dev, u64 mask)
  25. {
  26. return get_dma_ops(dev)->dma_supported(dev, mask);
  27. }
  28. static inline int dma_set_mask(struct device *dev, u64 mask)
  29. {
  30. return get_dma_ops(dev)->set_dma_mask(dev, mask);
  31. }
  32. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  33. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  34. #define dma_cache_sync(dev, va, size, dir) ((void)0)
  35. #endif /* _ALPHA_DMA_MAPPING_H */