aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/async_tx.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-06-03 14:43:59 -0400
committerDan Williams <dan.j.williams@intel.com>2009-06-03 17:07:35 -0400
commita08abd8ca890a377521d65d493d174bebcaf694b (patch)
tree987c149a2d7d6ab345f426ac28191627b4a02a3e /include/linux/async_tx.h
parent88ba2aa586c874681c072101287e15d40de7e6e2 (diff)
async_tx: structify submission arguments, add scribble
Prepare the api for the arrival of a new parameter, 'scribble'. This will allow callers to identify scratchpad memory for dma address or page address conversions. As this adds yet another parameter, take this opportunity to convert the common submission parameters (flags, dependency, callback, and callback argument) into an object that is passed by reference. Also, take this opportunity to fix up the kerneldoc and add notes about the relevant ASYNC_TX_* flags for each routine. [ Impact: moves api pass-by-value parameters to a pass-by-reference struct ] Signed-off-by: Andre Noll <maan@systemlinux.org> Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'include/linux/async_tx.h')
-rw-r--r--include/linux/async_tx.h84
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 */
76struct 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)
75struct dma_chan * 91struct 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
80static inline void async_tx_issue_pending_all(void) 96static 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
85static inline struct dma_chan * 101static inline struct dma_chan *
86async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 102async_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 */
99static inline void 116static inline void
100async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) 117async_tx_sync_epilog(struct async_submit_ctl *submit)
118{
119 if (submit->cb_fn)
120 submit->cb_fn(submit->cb_param);
121}
122
123typedef union {
124 unsigned long addr;
125 struct page *page;
126 dma_addr_t dma;
127} addr_conv_t;
128
129static inline void
130init_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
106void 142void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx,
107async_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
111struct dma_async_tx_descriptor * 145struct dma_async_tx_descriptor *
112async_xor(struct page *dest, struct page **src_list, unsigned int offset, 146async_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
117struct dma_async_tx_descriptor * 149struct dma_async_tx_descriptor *
118async_xor_val(struct page *dest, struct page **src_list, 150async_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
124struct dma_async_tx_descriptor * 154struct dma_async_tx_descriptor *
125async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, 155async_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
130struct dma_async_tx_descriptor * 159struct dma_async_tx_descriptor *
131async_memset(struct page *dest, int val, unsigned int offset, 160async_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
136struct dma_async_tx_descriptor * 163struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit);
137async_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
141void async_tx_quiesce(struct dma_async_tx_descriptor **tx); 165void async_tx_quiesce(struct dma_async_tx_descriptor **tx);
142#endif /* _ASYNC_TX_H_ */ 166#endif /* _ASYNC_TX_H_ */