diff options
Diffstat (limited to 'include/linux/dma-mapping.h')
| -rw-r--r-- | include/linux/dma-mapping.h | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 91b761846061..ba8319ae5fcc 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
| @@ -40,16 +40,6 @@ struct dma_map_ops { | |||
| 40 | void (*sync_single_for_device)(struct device *dev, | 40 | void (*sync_single_for_device)(struct device *dev, |
| 41 | dma_addr_t dma_handle, size_t size, | 41 | dma_addr_t dma_handle, size_t size, |
| 42 | enum dma_data_direction dir); | 42 | enum dma_data_direction dir); |
| 43 | void (*sync_single_range_for_cpu)(struct device *dev, | ||
| 44 | dma_addr_t dma_handle, | ||
| 45 | unsigned long offset, | ||
| 46 | size_t size, | ||
| 47 | enum dma_data_direction dir); | ||
| 48 | void (*sync_single_range_for_device)(struct device *dev, | ||
| 49 | dma_addr_t dma_handle, | ||
| 50 | unsigned long offset, | ||
| 51 | size_t size, | ||
| 52 | enum dma_data_direction dir); | ||
| 53 | void (*sync_sg_for_cpu)(struct device *dev, | 43 | void (*sync_sg_for_cpu)(struct device *dev, |
| 54 | struct scatterlist *sg, int nents, | 44 | struct scatterlist *sg, int nents, |
| 55 | enum dma_data_direction dir); | 45 | enum dma_data_direction dir); |
| @@ -105,21 +95,6 @@ static inline int is_device_dma_capable(struct device *dev) | |||
| 105 | #include <asm-generic/dma-mapping-broken.h> | 95 | #include <asm-generic/dma-mapping-broken.h> |
| 106 | #endif | 96 | #endif |
| 107 | 97 | ||
| 108 | /* for backwards compatibility, removed soon */ | ||
| 109 | static inline void __deprecated dma_sync_single(struct device *dev, | ||
| 110 | dma_addr_t addr, size_t size, | ||
| 111 | enum dma_data_direction dir) | ||
| 112 | { | ||
| 113 | dma_sync_single_for_cpu(dev, addr, size, dir); | ||
| 114 | } | ||
| 115 | |||
| 116 | static inline void __deprecated dma_sync_sg(struct device *dev, | ||
| 117 | struct scatterlist *sg, int nelems, | ||
| 118 | enum dma_data_direction dir) | ||
| 119 | { | ||
| 120 | dma_sync_sg_for_cpu(dev, sg, nelems, dir); | ||
| 121 | } | ||
| 122 | |||
| 123 | static inline u64 dma_get_mask(struct device *dev) | 98 | static inline u64 dma_get_mask(struct device *dev) |
| 124 | { | 99 | { |
| 125 | if (dev && dev->dma_mask && *dev->dma_mask) | 100 | if (dev && dev->dma_mask && *dev->dma_mask) |
| @@ -127,6 +102,18 @@ static inline u64 dma_get_mask(struct device *dev) | |||
| 127 | return DMA_BIT_MASK(32); | 102 | return DMA_BIT_MASK(32); |
| 128 | } | 103 | } |
| 129 | 104 | ||
| 105 | #ifdef ARCH_HAS_DMA_SET_COHERENT_MASK | ||
| 106 | int dma_set_coherent_mask(struct device *dev, u64 mask); | ||
| 107 | #else | ||
| 108 | static inline int dma_set_coherent_mask(struct device *dev, u64 mask) | ||
| 109 | { | ||
| 110 | if (!dma_supported(dev, mask)) | ||
| 111 | return -EIO; | ||
| 112 | dev->coherent_dma_mask = mask; | ||
| 113 | return 0; | ||
| 114 | } | ||
| 115 | #endif | ||
| 116 | |||
| 130 | extern u64 dma_get_required_mask(struct device *dev); | 117 | extern u64 dma_get_required_mask(struct device *dev); |
| 131 | 118 | ||
| 132 | static inline unsigned int dma_get_max_seg_size(struct device *dev) | 119 | static inline unsigned int dma_get_max_seg_size(struct device *dev) |
| @@ -159,6 +146,16 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) | |||
| 159 | return -EIO; | 146 | return -EIO; |
| 160 | } | 147 | } |
| 161 | 148 | ||
| 149 | #ifdef CONFIG_HAS_DMA | ||
| 150 | static inline int dma_get_cache_alignment(void) | ||
| 151 | { | ||
| 152 | #ifdef ARCH_DMA_MINALIGN | ||
| 153 | return ARCH_DMA_MINALIGN; | ||
| 154 | #endif | ||
| 155 | return 1; | ||
| 156 | } | ||
| 157 | #endif | ||
| 158 | |||
| 162 | /* flags for the coherent memory api */ | 159 | /* flags for the coherent memory api */ |
| 163 | #define DMA_MEMORY_MAP 0x01 | 160 | #define DMA_MEMORY_MAP 0x01 |
| 164 | #define DMA_MEMORY_IO 0x02 | 161 | #define DMA_MEMORY_IO 0x02 |
| @@ -232,4 +229,20 @@ struct dma_attrs; | |||
| 232 | 229 | ||
| 233 | #endif /* CONFIG_HAVE_DMA_ATTRS */ | 230 | #endif /* CONFIG_HAVE_DMA_ATTRS */ |
| 234 | 231 | ||
| 232 | #ifdef CONFIG_NEED_DMA_MAP_STATE | ||
| 233 | #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME | ||
| 234 | #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME | ||
| 235 | #define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) | ||
| 236 | #define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL)) | ||
| 237 | #define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) | ||
| 238 | #define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) | ||
| 239 | #else | ||
| 240 | #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) | ||
| 241 | #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) | ||
| 242 | #define dma_unmap_addr(PTR, ADDR_NAME) (0) | ||
| 243 | #define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
| 244 | #define dma_unmap_len(PTR, LEN_NAME) (0) | ||
| 245 | #define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
| 246 | #endif | ||
| 247 | |||
| 235 | #endif | 248 | #endif |
