diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2012-03-27 08:28:18 -0400 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-03-28 10:36:31 -0400 |
commit | baa676fcf8d555269bd0a5a2496782beee55824d (patch) | |
tree | b92ef75b5a1bf6ff38222fb5aaeb0c64b2c88dc9 /arch/x86/include/asm/dma-mapping.h | |
parent | 613c4578d4079a14dbee76ef7e0c80f635522fe3 (diff) |
X86 & IA64: adapt for dma_map_ops changes
Adapt core x86 and IA64 architecture code for dma_map_ops changes: replace
alloc/free_coherent with generic alloc/free methods.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
[removed swiotlb related changes and replaced it with wrappers,
merged with IA64 patch to avoid inter-patch dependences in intel-iommu code]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/x86/include/asm/dma-mapping.h')
-rw-r--r-- | arch/x86/include/asm/dma-mapping.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index ed3065fd6314..4b4331d71935 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h | |||
@@ -59,7 +59,8 @@ extern int dma_supported(struct device *hwdev, u64 mask); | |||
59 | extern int dma_set_mask(struct device *dev, u64 mask); | 59 | extern int dma_set_mask(struct device *dev, u64 mask); |
60 | 60 | ||
61 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 61 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
62 | dma_addr_t *dma_addr, gfp_t flag); | 62 | dma_addr_t *dma_addr, gfp_t flag, |
63 | struct dma_attrs *attrs); | ||
63 | 64 | ||
64 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | 65 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
65 | { | 66 | { |
@@ -111,9 +112,11 @@ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) | |||
111 | return gfp; | 112 | return gfp; |
112 | } | 113 | } |
113 | 114 | ||
115 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) | ||
116 | |||
114 | static inline void * | 117 | static inline void * |
115 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | 118 | dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, |
116 | gfp_t gfp) | 119 | gfp_t gfp, struct dma_attrs *attrs) |
117 | { | 120 | { |
118 | struct dma_map_ops *ops = get_dma_ops(dev); | 121 | struct dma_map_ops *ops = get_dma_ops(dev); |
119 | void *memory; | 122 | void *memory; |
@@ -129,18 +132,21 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
129 | if (!is_device_dma_capable(dev)) | 132 | if (!is_device_dma_capable(dev)) |
130 | return NULL; | 133 | return NULL; |
131 | 134 | ||
132 | if (!ops->alloc_coherent) | 135 | if (!ops->alloc) |
133 | return NULL; | 136 | return NULL; |
134 | 137 | ||
135 | memory = ops->alloc_coherent(dev, size, dma_handle, | 138 | memory = ops->alloc(dev, size, dma_handle, |
136 | dma_alloc_coherent_gfp_flags(dev, gfp)); | 139 | dma_alloc_coherent_gfp_flags(dev, gfp), attrs); |
137 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); | 140 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); |
138 | 141 | ||
139 | return memory; | 142 | return memory; |
140 | } | 143 | } |
141 | 144 | ||
142 | static inline void dma_free_coherent(struct device *dev, size_t size, | 145 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
143 | void *vaddr, dma_addr_t bus) | 146 | |
147 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
148 | void *vaddr, dma_addr_t bus, | ||
149 | struct dma_attrs *attrs) | ||
144 | { | 150 | { |
145 | struct dma_map_ops *ops = get_dma_ops(dev); | 151 | struct dma_map_ops *ops = get_dma_ops(dev); |
146 | 152 | ||
@@ -150,8 +156,8 @@ static inline void dma_free_coherent(struct device *dev, size_t size, | |||
150 | return; | 156 | return; |
151 | 157 | ||
152 | debug_dma_free_coherent(dev, size, vaddr, bus); | 158 | debug_dma_free_coherent(dev, size, vaddr, bus); |
153 | if (ops->free_coherent) | 159 | if (ops->free) |
154 | ops->free_coherent(dev, size, vaddr, bus); | 160 | ops->free(dev, size, vaddr, bus, attrs); |
155 | } | 161 | } |
156 | 162 | ||
157 | #endif | 163 | #endif |