1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _ASYNC_TX_H_
19#define _ASYNC_TX_H_
20#include <linux/dmaengine.h>
21#include <linux/spinlock.h>
22#include <linux/interrupt.h>
23
24
25
26
27#ifdef CONFIG_HAS_DMA
28#define __async_inline
29#else
30#define __async_inline __always_inline
31#endif
32
33
34
35
36
37
38
39
40
41
42struct dma_chan_ref {
43 struct dma_chan *chan;
44 struct list_head node;
45 struct rcu_head rcu;
46 atomic_t count;
47};
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63enum async_tx_flags {
64 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
65 ASYNC_TX_XOR_DROP_DST = (1 << 1),
66 ASYNC_TX_ACK = (1 << 3),
67 ASYNC_TX_DEP_ACK = (1 << 4),
68};
69
70#ifdef CONFIG_DMA_ENGINE
71#define async_tx_issue_pending_all dma_issue_pending_all
72#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
73#include <asm/async_tx.h>
74#else
75#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \
76 __async_tx_find_channel(dep, type)
77struct dma_chan *
78__async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
79 enum dma_transaction_type tx_type);
80#endif
81#else
82static inline void async_tx_issue_pending_all(void)
83{
84 do { } while (0);
85}
86
87static inline struct dma_chan *
88async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
89 enum dma_transaction_type tx_type, struct page **dst, int dst_count,
90 struct page **src, int src_count, size_t len)
91{
92 return NULL;
93}
94#endif
95
96
97
98
99
100
101static inline void
102async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param)
103{
104 if (cb_fn)
105 cb_fn(cb_fn_param);
106}
107
108void
109async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx,
110 enum async_tx_flags flags, struct dma_async_tx_descriptor *depend_tx,
111 dma_async_tx_callback cb_fn, void *cb_fn_param);
112
113struct dma_async_tx_descriptor *
114async_xor(struct page *dest, struct page **src_list, unsigned int offset,
115 int src_cnt, size_t len, enum async_tx_flags flags,
116 struct dma_async_tx_descriptor *depend_tx,
117 dma_async_tx_callback cb_fn, void *cb_fn_param);
118
119struct dma_async_tx_descriptor *
120async_xor_zero_sum(struct page *dest, struct page **src_list,
121 unsigned int offset, int src_cnt, size_t len,
122 u32 *result, enum async_tx_flags flags,
123 struct dma_async_tx_descriptor *depend_tx,
124 dma_async_tx_callback cb_fn, void *cb_fn_param);
125
126struct dma_async_tx_descriptor *
127async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
128 unsigned int src_offset, size_t len, enum async_tx_flags flags,
129 struct dma_async_tx_descriptor *depend_tx,
130 dma_async_tx_callback cb_fn, void *cb_fn_param);
131
132struct dma_async_tx_descriptor *
133async_memset(struct page *dest, int val, unsigned int offset,
134 size_t len, enum async_tx_flags flags,
135 struct dma_async_tx_descriptor *depend_tx,
136 dma_async_tx_callback cb_fn, void *cb_fn_param);
137
138struct dma_async_tx_descriptor *
139async_trigger_callback(enum async_tx_flags flags,
140 struct dma_async_tx_descriptor *depend_tx,
141 dma_async_tx_callback cb_fn, void *cb_fn_param);
142
143void async_tx_quiesce(struct dma_async_tx_descriptor **tx);
144#endif
145