blob: 4567aca6fdd6ef32e3730c60fa725b98f299d8aa [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
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080015static inline void *dma_alloc_coherent(struct device *dev, size_t size,
16 dma_addr_t *dma_handle, gfp_t gfp)
17{
18 return get_dma_ops(dev)->alloc_coherent(dev, size, dma_handle, gfp);
19}
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080021static inline void dma_free_coherent(struct device *dev, size_t size,
22 void *vaddr, dma_addr_t dma_handle)
23{
24 get_dma_ops(dev)->free_coherent(dev, size, vaddr, dma_handle);
25}
Ivan Kokshayskyee0c4682009-01-29 14:25:19 -080026
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080027static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
28{
29 return get_dma_ops(dev)->mapping_error(dev, dma_addr);
30}
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080032static inline int dma_supported(struct device *dev, u64 mask)
33{
34 return get_dma_ops(dev)->dma_supported(dev, mask);
35}
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
FUJITA Tomonoric186cac2010-03-10 15:23:37 -080037static inline int dma_set_mask(struct device *dev, u64 mask)
38{
39 return get_dma_ops(dev)->set_dma_mask(dev, mask);
40}
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
43#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Al Virod0a23392007-01-30 13:23:55 +000045#define dma_cache_sync(dev, va, size, dir) ((void)0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47#endif /* _ALPHA_DMA_MAPPING_H */