diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/async_tx.h | 84 |
1 files changed, 54 insertions, 30 deletions
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h index 9f14cd540cd2..00cfb637ddf2 100644 --- a/include/linux/async_tx.h +++ b/include/linux/async_tx.h | |||
@@ -65,6 +65,22 @@ enum async_tx_flags { | |||
65 | ASYNC_TX_ACK = (1 << 2), | 65 | ASYNC_TX_ACK = (1 << 2), |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /** | ||
69 | * struct async_submit_ctl - async_tx submission/completion modifiers | ||
70 | * @flags: submission modifiers | ||
71 | * @depend_tx: parent dependency of the current operation being submitted | ||
72 | * @cb_fn: callback routine to run at operation completion | ||
73 | * @cb_param: parameter for the callback routine | ||
74 | * @scribble: caller provided space for dma/page address conversions | ||
75 | */ | ||
76 | struct async_submit_ctl { | ||
77 | enum async_tx_flags flags; | ||
78 | struct dma_async_tx_descriptor *depend_tx; | ||
79 | dma_async_tx_callback cb_fn; | ||
80 | void *cb_param; | ||
81 | void *scribble; | ||
82 | }; | ||
83 | |||
68 | #ifdef CONFIG_DMA_ENGINE | 84 | #ifdef CONFIG_DMA_ENGINE |
69 | #define async_tx_issue_pending_all dma_issue_pending_all | 85 | #define async_tx_issue_pending_all dma_issue_pending_all |
70 | #ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL | 86 | #ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL |
@@ -73,8 +89,8 @@ enum async_tx_flags { | |||
73 | #define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ | 89 | #define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ |
74 | __async_tx_find_channel(dep, type) | 90 | __async_tx_find_channel(dep, type) |
75 | struct dma_chan * | 91 | struct dma_chan * |
76 | __async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | 92 | __async_tx_find_channel(struct async_submit_ctl *submit, |
77 | enum dma_transaction_type tx_type); | 93 | enum dma_transaction_type tx_type); |
78 | #endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ | 94 | #endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ |
79 | #else | 95 | #else |
80 | static inline void async_tx_issue_pending_all(void) | 96 | static inline void async_tx_issue_pending_all(void) |
@@ -83,9 +99,10 @@ static inline void async_tx_issue_pending_all(void) | |||
83 | } | 99 | } |
84 | 100 | ||
85 | static inline struct dma_chan * | 101 | static inline struct dma_chan * |
86 | async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | 102 | async_tx_find_channel(struct async_submit_ctl *submit, |
87 | enum dma_transaction_type tx_type, struct page **dst, int dst_count, | 103 | enum dma_transaction_type tx_type, struct page **dst, |
88 | struct page **src, int src_count, size_t len) | 104 | int dst_count, struct page **src, int src_count, |
105 | size_t len) | ||
89 | { | 106 | { |
90 | return NULL; | 107 | return NULL; |
91 | } | 108 | } |
@@ -97,46 +114,53 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | |||
97 | * @cb_fn_param: parameter to pass to the callback routine | 114 | * @cb_fn_param: parameter to pass to the callback routine |
98 | */ | 115 | */ |
99 | static inline void | 116 | static inline void |
100 | async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) | 117 | async_tx_sync_epilog(struct async_submit_ctl *submit) |
118 | { | ||
119 | if (submit->cb_fn) | ||
120 | submit->cb_fn(submit->cb_param); | ||
121 | } | ||
122 | |||
123 | typedef union { | ||
124 | unsigned long addr; | ||
125 | struct page *page; | ||
126 | dma_addr_t dma; | ||
127 | } addr_conv_t; | ||
128 | |||
129 | static inline void | ||
130 | init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags, | ||
131 | struct dma_async_tx_descriptor *tx, | ||
132 | dma_async_tx_callback cb_fn, void *cb_param, | ||
133 | addr_conv_t *scribble) | ||
101 | { | 134 | { |
102 | if (cb_fn) | 135 | args->flags = flags; |
103 | cb_fn(cb_fn_param); | 136 | args->depend_tx = tx; |
137 | args->cb_fn = cb_fn; | ||
138 | args->cb_param = cb_param; | ||
139 | args->scribble = scribble; | ||
104 | } | 140 | } |
105 | 141 | ||
106 | void | 142 | void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, |
107 | async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, | 143 | struct async_submit_ctl *submit); |
108 | enum async_tx_flags flags, struct dma_async_tx_descriptor *depend_tx, | ||
109 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
110 | 144 | ||
111 | struct dma_async_tx_descriptor * | 145 | struct dma_async_tx_descriptor * |
112 | async_xor(struct page *dest, struct page **src_list, unsigned int offset, | 146 | async_xor(struct page *dest, struct page **src_list, unsigned int offset, |
113 | int src_cnt, size_t len, enum async_tx_flags flags, | 147 | int src_cnt, size_t len, struct async_submit_ctl *submit); |
114 | struct dma_async_tx_descriptor *depend_tx, | ||
115 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
116 | 148 | ||
117 | struct dma_async_tx_descriptor * | 149 | struct dma_async_tx_descriptor * |
118 | async_xor_val(struct page *dest, struct page **src_list, | 150 | async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, |
119 | unsigned int offset, int src_cnt, size_t len, | 151 | int src_cnt, size_t len, u32 *result, |
120 | u32 *result, enum async_tx_flags flags, | 152 | struct async_submit_ctl *submit); |
121 | struct dma_async_tx_descriptor *depend_tx, | ||
122 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
123 | 153 | ||
124 | struct dma_async_tx_descriptor * | 154 | struct dma_async_tx_descriptor * |
125 | async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, | 155 | async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, |
126 | unsigned int src_offset, size_t len, enum async_tx_flags flags, | 156 | unsigned int src_offset, size_t len, |
127 | struct dma_async_tx_descriptor *depend_tx, | 157 | struct async_submit_ctl *submit); |
128 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
129 | 158 | ||
130 | struct dma_async_tx_descriptor * | 159 | struct dma_async_tx_descriptor * |
131 | async_memset(struct page *dest, int val, unsigned int offset, | 160 | async_memset(struct page *dest, int val, unsigned int offset, |
132 | size_t len, enum async_tx_flags flags, | 161 | size_t len, struct async_submit_ctl *submit); |
133 | struct dma_async_tx_descriptor *depend_tx, | ||
134 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
135 | 162 | ||
136 | struct dma_async_tx_descriptor * | 163 | struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit); |
137 | async_trigger_callback(enum async_tx_flags flags, | ||
138 | struct dma_async_tx_descriptor *depend_tx, | ||
139 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
140 | 164 | ||
141 | void async_tx_quiesce(struct dma_async_tx_descriptor **tx); | 165 | void async_tx_quiesce(struct dma_async_tx_descriptor **tx); |
142 | #endif /* _ASYNC_TX_H_ */ | 166 | #endif /* _ASYNC_TX_H_ */ |