diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/dmaengine.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index db23fd583f98..835b9c7bf1c2 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -245,6 +245,10 @@ struct dma_async_tx_descriptor { | |||
| 245 | * @cap_mask: one or more dma_capability flags | 245 | * @cap_mask: one or more dma_capability flags |
| 246 | * @max_xor: maximum number of xor sources, 0 if no capability | 246 | * @max_xor: maximum number of xor sources, 0 if no capability |
| 247 | * @max_pq: maximum number of PQ sources and PQ-continue capability | 247 | * @max_pq: maximum number of PQ sources and PQ-continue capability |
| 248 | * @copy_align: alignment shift for memcpy operations | ||
| 249 | * @xor_align: alignment shift for xor operations | ||
| 250 | * @pq_align: alignment shift for pq operations | ||
| 251 | * @fill_align: alignment shift for memset operations | ||
| 248 | * @dev_id: unique device ID | 252 | * @dev_id: unique device ID |
| 249 | * @dev: struct device reference for dma mapping api | 253 | * @dev: struct device reference for dma mapping api |
| 250 | * @device_alloc_chan_resources: allocate resources and return the | 254 | * @device_alloc_chan_resources: allocate resources and return the |
| @@ -271,6 +275,10 @@ struct dma_device { | |||
| 271 | dma_cap_mask_t cap_mask; | 275 | dma_cap_mask_t cap_mask; |
| 272 | unsigned short max_xor; | 276 | unsigned short max_xor; |
| 273 | unsigned short max_pq; | 277 | unsigned short max_pq; |
| 278 | u8 copy_align; | ||
| 279 | u8 xor_align; | ||
| 280 | u8 pq_align; | ||
| 281 | u8 fill_align; | ||
| 274 | #define DMA_HAS_PQ_CONTINUE (1 << 15) | 282 | #define DMA_HAS_PQ_CONTINUE (1 << 15) |
| 275 | 283 | ||
| 276 | int dev_id; | 284 | int dev_id; |
| @@ -314,6 +322,42 @@ struct dma_device { | |||
| 314 | void (*device_issue_pending)(struct dma_chan *chan); | 322 | void (*device_issue_pending)(struct dma_chan *chan); |
| 315 | }; | 323 | }; |
| 316 | 324 | ||
| 325 | static inline bool dmaengine_check_align(u8 align, size_t off1, size_t off2, size_t len) | ||
| 326 | { | ||
| 327 | size_t mask; | ||
| 328 | |||
| 329 | if (!align) | ||
| 330 | return true; | ||
| 331 | mask = (1 << align) - 1; | ||
| 332 | if (mask & (off1 | off2 | len)) | ||
| 333 | return false; | ||
| 334 | return true; | ||
| 335 | } | ||
| 336 | |||
| 337 | static inline bool is_dma_copy_aligned(struct dma_device *dev, size_t off1, | ||
| 338 | size_t off2, size_t len) | ||
| 339 | { | ||
| 340 | return dmaengine_check_align(dev->copy_align, off1, off2, len); | ||
| 341 | } | ||
| 342 | |||
| 343 | static inline bool is_dma_xor_aligned(struct dma_device *dev, size_t off1, | ||
| 344 | size_t off2, size_t len) | ||
| 345 | { | ||
| 346 | return dmaengine_check_align(dev->xor_align, off1, off2, len); | ||
| 347 | } | ||
| 348 | |||
| 349 | static inline bool is_dma_pq_aligned(struct dma_device *dev, size_t off1, | ||
| 350 | size_t off2, size_t len) | ||
| 351 | { | ||
| 352 | return dmaengine_check_align(dev->pq_align, off1, off2, len); | ||
| 353 | } | ||
| 354 | |||
| 355 | static inline bool is_dma_fill_aligned(struct dma_device *dev, size_t off1, | ||
| 356 | size_t off2, size_t len) | ||
| 357 | { | ||
| 358 | return dmaengine_check_align(dev->fill_align, off1, off2, len); | ||
| 359 | } | ||
| 360 | |||
| 317 | static inline void | 361 | static inline void |
| 318 | dma_set_maxpq(struct dma_device *dma, int maxpq, int has_pq_continue) | 362 | dma_set_maxpq(struct dma_device *dma, int maxpq, int has_pq_continue) |
| 319 | { | 363 | { |
