aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2009-08-09 22:53:12 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-10 03:34:58 -0400
commitbc0a14f154069cc4e42ea903c2c2b9984a94e4b7 (patch)
tree85b1baa32fbb42d094c66b51ee3e576e77298d29 /arch/sparc/include/asm
parentbe02ff9940c0106dea1470462401a07c5d52e086 (diff)
sparc: Use dma_map_ops struct
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Tested-by: Robert Reif <reif@earthlink.net> Acked-by: David S. Miller <davem@davemloft.net> Cc: tony.luck@intel.com Cc: fenghua.yu@intel.com LKML-Reference: <1249872797-1314-4-git-send-email-fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/sparc/include/asm')
-rw-r--r--arch/sparc/include/asm/dma-mapping.h43
1 files changed, 7 insertions, 36 deletions
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 204e4bf64438..893f3ecc9750 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -13,36 +13,7 @@ extern int dma_set_mask(struct device *dev, u64 dma_mask);
13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
14#define dma_is_consistent(d, h) (1) 14#define dma_is_consistent(d, h) (1)
15 15
16struct dma_ops { 16extern const struct dma_map_ops *dma_ops;
17 void *(*alloc_coherent)(struct device *dev, size_t size,
18 dma_addr_t *dma_handle, gfp_t flag);
19 void (*free_coherent)(struct device *dev, size_t size,
20 void *cpu_addr, dma_addr_t dma_handle);
21 dma_addr_t (*map_page)(struct device *dev, struct page *page,
22 unsigned long offset, size_t size,
23 enum dma_data_direction direction);
24 void (*unmap_page)(struct device *dev, dma_addr_t dma_addr,
25 size_t size,
26 enum dma_data_direction direction);
27 int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents,
28 enum dma_data_direction direction);
29 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
30 int nhwentries,
31 enum dma_data_direction direction);
32 void (*sync_single_for_cpu)(struct device *dev,
33 dma_addr_t dma_handle, size_t size,
34 enum dma_data_direction direction);
35 void (*sync_single_for_device)(struct device *dev,
36 dma_addr_t dma_handle, size_t size,
37 enum dma_data_direction direction);
38 void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
39 int nelems,
40 enum dma_data_direction direction);
41 void (*sync_sg_for_device)(struct device *dev,
42 struct scatterlist *sg, int nents,
43 enum dma_data_direction dir);
44};
45extern const struct dma_ops *dma_ops;
46 17
47static inline void *dma_alloc_coherent(struct device *dev, size_t size, 18static inline void *dma_alloc_coherent(struct device *dev, size_t size,
48 dma_addr_t *dma_handle, gfp_t flag) 19 dma_addr_t *dma_handle, gfp_t flag)
@@ -62,40 +33,40 @@ static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
62{ 33{
63 return dma_ops->map_page(dev, virt_to_page(cpu_addr), 34 return dma_ops->map_page(dev, virt_to_page(cpu_addr),
64 (unsigned long)cpu_addr & ~PAGE_MASK, size, 35 (unsigned long)cpu_addr & ~PAGE_MASK, size,
65 direction); 36 direction, NULL);
66} 37}
67 38
68static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, 39static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
69 size_t size, 40 size_t size,
70 enum dma_data_direction direction) 41 enum dma_data_direction direction)
71{ 42{
72 dma_ops->unmap_page(dev, dma_addr, size, direction); 43 dma_ops->unmap_page(dev, dma_addr, size, direction, NULL);
73} 44}
74 45
75static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, 46static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
76 unsigned long offset, size_t size, 47 unsigned long offset, size_t size,
77 enum dma_data_direction direction) 48 enum dma_data_direction direction)
78{ 49{
79 return dma_ops->map_page(dev, page, offset, size, direction); 50 return dma_ops->map_page(dev, page, offset, size, direction, NULL);
80} 51}
81 52
82static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, 53static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
83 size_t size, 54 size_t size,
84 enum dma_data_direction direction) 55 enum dma_data_direction direction)
85{ 56{
86 dma_ops->unmap_page(dev, dma_address, size, direction); 57 dma_ops->unmap_page(dev, dma_address, size, direction, NULL);
87} 58}
88 59
89static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, 60static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
90 int nents, enum dma_data_direction direction) 61 int nents, enum dma_data_direction direction)
91{ 62{
92 return dma_ops->map_sg(dev, sg, nents, direction); 63 return dma_ops->map_sg(dev, sg, nents, direction, NULL);
93} 64}
94 65
95static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 66static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
96 int nents, enum dma_data_direction direction) 67 int nents, enum dma_data_direction direction)
97{ 68{
98 dma_ops->unmap_sg(dev, sg, nents, direction); 69 dma_ops->unmap_sg(dev, sg, nents, direction, NULL);
99} 70}
100 71
101static inline void dma_sync_single_for_cpu(struct device *dev, 72static inline void dma_sync_single_for_cpu(struct device *dev,