diff options
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 |
