dma-mapping.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
  11. static inline void *dma_alloc_attrs(struct device *dev, size_t size,
  12. dma_addr_t *dma_handle, gfp_t gfp,
  13. struct dma_attrs *attrs)
  14. {
  15. return get_dma_ops(dev)->alloc(dev, size, dma_handle, gfp, attrs);
  16. }
  17. #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
  18. static inline void dma_free_attrs(struct device *dev, size_t size,
  19. void *vaddr, dma_addr_t dma_handle,
  20. struct dma_attrs *attrs)
  21. {
  22. get_dma_ops(dev)->free(dev, size, vaddr, dma_handle, attrs);
  23. }
  24. static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
  25. {
  26. return get_dma_ops(dev)->mapping_error(dev, dma_addr);
  27. }
  28. static inline int dma_supported(struct device *dev, u64 mask)
  29. {
  30. return get_dma_ops(dev)->dma_supported(dev, mask);
  31. }
  32. static inline int dma_set_mask(struct device *dev, u64 mask)
  33. {
  34. return get_dma_ops(dev)->set_dma_mask(dev, mask);
  35. }
  36. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  37. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  38. #define dma_cache_sync(dev, va, size, dir) ((void)0)
  39. #endif /* _ALPHA_DMA_MAPPING_H */