blob: dfa32f0613201a92c5c6e5bf81443302deff46ac [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ALPHA_DMA_MAPPING_H
2#define _ALPHA_DMA_MAPPING_H
3
FUJITA Tomonoric186cac2010-03-10 15:23:37 -08004#include <linux/dma-attrs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
FUJITA Tomonoric186cac2010-03-10 15:23:37 -08006extern struct dma_map_ops *dma_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
FUJITA Tomonoric186cac2010-03-10 15:23:37 -08008static inline struct dma_map_ops *get_dma_ops(struct device *dev)
9{
10 return dma_ops;
11}
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080013#include <asm-generic/dma-mapping-common.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Andrzej Pietrasiewicz4ce9a912011-12-22 13:58:21 +010015#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
16
17static inline void *dma_alloc_attrs(struct device *dev, size_t size,
18 dma_addr_t *dma_handle, gfp_t gfp,
19 struct dma_attrs *attrs)
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080020{
Andrzej Pietrasiewicz4ce9a912011-12-22 13:58:21 +010021 return get_dma_ops(dev)->alloc(dev, size, dma_handle, gfp, attrs);
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080022}
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Andrzej Pietrasiewicz4ce9a912011-12-22 13:58:21 +010024#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
25
26static inline void dma_free_attrs(struct device *dev, size_t size,
27 void *vaddr, dma_addr_t dma_handle,
28 struct dma_attrs *attrs)
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080029{
Andrzej Pietrasiewicz4ce9a912011-12-22 13:58:21 +010030 get_dma_ops(dev)->free(dev, size, vaddr, dma_handle, attrs);
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080031}
Ivan Kokshayskyee0c4682009-01-29 14:25:19 -080032
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080033static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
34{
35 return get_dma_ops(dev)->mapping_error(dev, dma_addr);
36}
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080038static inline int dma_supported(struct device *dev, u64 mask)
39{
40 return get_dma_ops(dev)->dma_supported(dev, mask);
41}
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080043static inline int dma_set_mask(struct device *dev, u64 mask)
44{
45 return get_dma_ops(dev)->set_dma_mask(dev, mask);
46}
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
49#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Al Virod0a23392007-01-30 13:23:55 +000051#define dma_cache_sync(dev, va, size, dir) ((void)0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53#endif /* _ALPHA_DMA_MAPPING_H */