aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dma-mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r--include/linux/dma-mapping.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 91b761846061..ca32ed78b057 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -127,6 +127,14 @@ static inline u64 dma_get_mask(struct device *dev)
127 return DMA_BIT_MASK(32); 127 return DMA_BIT_MASK(32);
128} 128}
129 129
130static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
131{
132 if (!dma_supported(dev, mask))
133 return -EIO;
134 dev->coherent_dma_mask = mask;
135 return 0;
136}
137
130extern u64 dma_get_required_mask(struct device *dev); 138extern u64 dma_get_required_mask(struct device *dev);
131 139
132static inline unsigned int dma_get_max_seg_size(struct device *dev) 140static inline unsigned int dma_get_max_seg_size(struct device *dev)
@@ -232,4 +240,20 @@ struct dma_attrs;
232 240
233#endif /* CONFIG_HAVE_DMA_ATTRS */ 241#endif /* CONFIG_HAVE_DMA_ATTRS */
234 242
243#ifdef CONFIG_NEED_DMA_MAP_STATE
244#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME
245#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME
246#define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
247#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
248#define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
249#define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
250#else
251#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)
252#define DEFINE_DMA_UNMAP_LEN(LEN_NAME)
253#define dma_unmap_addr(PTR, ADDR_NAME) (0)
254#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
255#define dma_unmap_len(PTR, LEN_NAME) (0)
256#define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
257#endif
258
235#endif 259#endif