Lines Matching +full:address +full:- +full:data
1 // SPDX-License-Identifier: GPL-2.0
21 * tcw_get_intrg - return pointer to associated interrogate tcw
29 return dma32_to_virt(tcw->intrg); in tcw_get_intrg()
34 * tcw_get_data - return pointer to input/output data associated with tcw
37 * Return the input or output data address specified in the tcw depending
38 * on whether the r-bit or the w-bit is set. If neither bit is set, return
43 if (tcw->r) in tcw_get_data()
44 return dma64_to_virt(tcw->input); in tcw_get_data()
45 if (tcw->w) in tcw_get_data()
46 return dma64_to_virt(tcw->output); in tcw_get_data()
52 * tcw_get_tccb - return pointer to tccb associated with tcw
59 return dma64_to_virt(tcw->tccb); in tcw_get_tccb()
64 * tcw_get_tsb - return pointer to tsb associated with tcw
71 return dma64_to_virt(tcw->tsb); in tcw_get_tsb()
76 * tcw_init - initialize tcw data structure
78 * @r: initial value of the r-bit
79 * @w: initial value of the w-bit
81 * Initialize all fields of the specified tcw data structure with zero and
87 tcw->format = TCW_FORMAT_DEFAULT; in tcw_init()
88 tcw->flags = TCW_FLAGS_TIDAW_FORMAT(TCW_TIDAW_FORMAT_DEFAULT); in tcw_init()
90 tcw->r = 1; in tcw_init()
92 tcw->w = 1; in tcw_init()
98 return tccb->tcah.tcal - 12; in tca_size()
110 dcw = (struct dcw *) &tccb->tca[offset]; in calc_dcw_count()
111 count += dcw->count; in calc_dcw_count()
112 if (!(dcw->flags & DCW_FLAGS_CC)) in calc_dcw_count()
114 offset += sizeof(struct dcw) + ALIGN((int) dcw->cd_count, 4); in calc_dcw_count()
129 /* TODO: find out if padding applies to total of data in calc_cbc_size()
130 * transferred or data transferred by this tidaw. Assumption: in calc_cbc_size()
134 cbc_data = 4 + ALIGN(data_count, 4) - data_count; in calc_cbc_size()
143 * tcw_finalize - finalize tcw length fields and tidaw list
145 * @num_tidaws: the number of tidaws used to address input/output data or zero
148 * Calculate the input-/output-count and tccbl field in the tcw, add a
149 * tcat the tccb and terminate the data tidaw list if used.
151 * Note: in case input- or output-tida is used, the tidaw-list must be stored
153 * up-to-date.
165 tidaw[num_tidaws - 1].flags |= TIDAW_FLAGS_LAST; in tcw_finalize()
168 tcat = (struct tccb_tcat *) &tccb->tca[tca_size(tccb)]; in tcw_finalize()
172 if (tcw->w && (tcw->flags & TCW_FLAGS_OUTPUT_TIDA)) in tcw_finalize()
174 if (tcw->r) in tcw_finalize()
175 tcw->input_count = count; in tcw_finalize()
176 else if (tcw->w) in tcw_finalize()
177 tcw->output_count = count; in tcw_finalize()
178 tcat->count = ALIGN(count, 4) + 4; in tcw_finalize()
180 tcw->tccbl = (sizeof(struct tccb) + tca_size(tccb) + in tcw_finalize()
181 sizeof(struct tccb_tcat) - 20) >> 2; in tcw_finalize()
186 * tcw_set_intrg - set the interrogate tcw address of a tcw
187 * @tcw: the tcw address
188 * @intrg_tcw: the address of the interrogate tcw
190 * Set the address of the interrogate tcw in the specified tcw.
194 tcw->intrg = virt_to_dma32(intrg_tcw); in tcw_set_intrg()
199 * tcw_set_data - set data address and tida flag of a tcw
200 * @tcw: the tcw address
201 * @data: the data address
202 * @use_tidal: zero of the data address specifies a contiguous block of data,
203 * non-zero if it specifies a list if tidaws.
205 * Set the input/output data address of a tcw (depending on the value of the
206 * r-flag and w-flag). If @use_tidal is non-zero, the corresponding tida flag
209 void tcw_set_data(struct tcw *tcw, void *data, int use_tidal) in tcw_set_data() argument
211 if (tcw->r) { in tcw_set_data()
212 tcw->input = virt_to_dma64(data); in tcw_set_data()
214 tcw->flags |= TCW_FLAGS_INPUT_TIDA; in tcw_set_data()
215 } else if (tcw->w) { in tcw_set_data()
216 tcw->output = virt_to_dma64(data); in tcw_set_data()
218 tcw->flags |= TCW_FLAGS_OUTPUT_TIDA; in tcw_set_data()
224 * tcw_set_tccb - set tccb address of a tcw
225 * @tcw: the tcw address
226 * @tccb: the tccb address
228 * Set the address of the tccb in the specified tcw.
232 tcw->tccb = virt_to_dma64(tccb); in tcw_set_tccb()
237 * tcw_set_tsb - set tsb address of a tcw
238 * @tcw: the tcw address
239 * @tsb: the tsb address
241 * Set the address of the tsb in the specified tcw.
245 tcw->tsb = virt_to_dma64(tsb); in tcw_set_tsb()
250 * tccb_init - initialize tccb
251 * @tccb: the tccb address
253 * @sac: the service-action-code to be user
261 tccb->tcah.format = TCCB_FORMAT_DEFAULT; in tccb_init()
262 tccb->tcah.sac = sac; in tccb_init()
263 tccb->tcah.tcal = 12; in tccb_init()
268 * tsb_init - initialize tsb
269 * @tsb: the tsb address
280 * tccb_add_dcw - add a dcw to the tccb
281 * @tccb: the tccb address
285 * @cd: pointer to control data for this dcw or NULL if none is required
286 * @cd_count: number of control data bytes for this dcw
287 * @count: number of data bytes for this dcw
291 * a pointer to the newly added dcw on success or -%ENOSPC if the new dcw
309 return ERR_PTR(-ENOSPC); in tccb_add_dcw()
311 dcw = (struct dcw *) &tccb->tca[tca_offset]; in tccb_add_dcw()
313 dcw->cmd = cmd; in tccb_add_dcw()
314 dcw->flags = flags; in tccb_add_dcw()
315 dcw->count = count; in tccb_add_dcw()
316 dcw->cd_count = cd_count; in tccb_add_dcw()
318 memcpy(&dcw->cd[0], cd, cd_count); in tccb_add_dcw()
319 tccb->tcah.tcal += size; in tccb_add_dcw()
325 * tcw_add_tidaw - add a tidaw to a tcw
326 * @tcw: the tcw address
329 * @addr: address value for the new tidaw
332 * Add a new tidaw to the input/output data tidaw-list of the specified tcw
333 * (depending on the value of the r-flag and w-flag) and return a pointer to
336 * Note: the tidaw-list is assumed to be contiguous with no ttics. The caller
337 * must ensure that there is enough space for the new tidaw. The last-tidaw
345 /* Add tidaw to tidaw-list. */ in tcw_add_tidaw()
348 tidaw->flags = flags; in tcw_add_tidaw()
349 tidaw->count = count; in tcw_add_tidaw()
350 tidaw->addr = virt_to_dma64(addr); in tcw_add_tidaw()