Lines Matching +full:address +full:- +full:address +full:- +full:data
1 // SPDX-License-Identifier: GPL-2.0
19 * tcw_get_intrg - return pointer to associated interrogate tcw
27 return (struct tcw *) ((addr_t) tcw->intrg); in tcw_get_intrg()
32 * tcw_get_data - return pointer to input/output data associated with tcw
35 * Return the input or output data address specified in the tcw depending
36 * on whether the r-bit or the w-bit is set. If neither bit is set, return
41 if (tcw->r) in tcw_get_data()
42 return (void *) ((addr_t) tcw->input); in tcw_get_data()
43 if (tcw->w) in tcw_get_data()
44 return (void *) ((addr_t) tcw->output); in tcw_get_data()
50 * tcw_get_tccb - return pointer to tccb associated with tcw
57 return (struct tccb *) ((addr_t) tcw->tccb); in tcw_get_tccb()
62 * tcw_get_tsb - return pointer to tsb associated with tcw
69 return (struct tsb *) ((addr_t) tcw->tsb); in tcw_get_tsb()
74 * tcw_init - initialize tcw data structure
76 * @r: initial value of the r-bit
77 * @w: initial value of the w-bit
79 * Initialize all fields of the specified tcw data structure with zero and
85 tcw->format = TCW_FORMAT_DEFAULT; in tcw_init()
86 tcw->flags = TCW_FLAGS_TIDAW_FORMAT(TCW_TIDAW_FORMAT_DEFAULT); in tcw_init()
88 tcw->r = 1; in tcw_init()
90 tcw->w = 1; in tcw_init()
96 return tccb->tcah.tcal - 12; in tca_size()
108 dcw = (struct dcw *) &tccb->tca[offset]; in calc_dcw_count()
109 count += dcw->count; in calc_dcw_count()
110 if (!(dcw->flags & DCW_FLAGS_CC)) in calc_dcw_count()
112 offset += sizeof(struct dcw) + ALIGN((int) dcw->cd_count, 4); in calc_dcw_count()
127 /* TODO: find out if padding applies to total of data in calc_cbc_size()
128 * transferred or data transferred by this tidaw. Assumption: in calc_cbc_size()
132 cbc_data = 4 + ALIGN(data_count, 4) - data_count; in calc_cbc_size()
141 * tcw_finalize - finalize tcw length fields and tidaw list
143 * @num_tidaws: the number of tidaws used to address input/output data or zero
146 * Calculate the input-/output-count and tccbl field in the tcw, add a
147 * tcat the tccb and terminate the data tidaw list if used.
149 * Note: in case input- or output-tida is used, the tidaw-list must be stored
151 * up-to-date.
163 tidaw[num_tidaws - 1].flags |= TIDAW_FLAGS_LAST; in tcw_finalize()
166 tcat = (struct tccb_tcat *) &tccb->tca[tca_size(tccb)]; in tcw_finalize()
170 if (tcw->w && (tcw->flags & TCW_FLAGS_OUTPUT_TIDA)) in tcw_finalize()
172 if (tcw->r) in tcw_finalize()
173 tcw->input_count = count; in tcw_finalize()
174 else if (tcw->w) in tcw_finalize()
175 tcw->output_count = count; in tcw_finalize()
176 tcat->count = ALIGN(count, 4) + 4; in tcw_finalize()
178 tcw->tccbl = (sizeof(struct tccb) + tca_size(tccb) + in tcw_finalize()
179 sizeof(struct tccb_tcat) - 20) >> 2; in tcw_finalize()
184 * tcw_set_intrg - set the interrogate tcw address of a tcw
185 * @tcw: the tcw address
186 * @intrg_tcw: the address of the interrogate tcw
188 * Set the address of the interrogate tcw in the specified tcw.
192 tcw->intrg = (u32) ((addr_t) intrg_tcw); in tcw_set_intrg()
197 * tcw_set_data - set data address and tida flag of a tcw
198 * @tcw: the tcw address
199 * @data: the data address
200 * @use_tidal: zero of the data address specifies a contiguous block of data,
201 * non-zero if it specifies a list if tidaws.
203 * Set the input/output data address of a tcw (depending on the value of the
204 * r-flag and w-flag). If @use_tidal is non-zero, the corresponding tida flag
207 void tcw_set_data(struct tcw *tcw, void *data, int use_tidal) in tcw_set_data() argument
209 if (tcw->r) { in tcw_set_data()
210 tcw->input = (u64) ((addr_t) data); in tcw_set_data()
212 tcw->flags |= TCW_FLAGS_INPUT_TIDA; in tcw_set_data()
213 } else if (tcw->w) { in tcw_set_data()
214 tcw->output = (u64) ((addr_t) data); in tcw_set_data()
216 tcw->flags |= TCW_FLAGS_OUTPUT_TIDA; in tcw_set_data()
222 * tcw_set_tccb - set tccb address of a tcw
223 * @tcw: the tcw address
224 * @tccb: the tccb address
226 * Set the address of the tccb in the specified tcw.
230 tcw->tccb = (u64) ((addr_t) tccb); in tcw_set_tccb()
235 * tcw_set_tsb - set tsb address of a tcw
236 * @tcw: the tcw address
237 * @tsb: the tsb address
239 * Set the address of the tsb in the specified tcw.
243 tcw->tsb = (u64) ((addr_t) tsb); in tcw_set_tsb()
248 * tccb_init - initialize tccb
249 * @tccb: the tccb address
251 * @sac: the service-action-code to be user
259 tccb->tcah.format = TCCB_FORMAT_DEFAULT; in tccb_init()
260 tccb->tcah.sac = sac; in tccb_init()
261 tccb->tcah.tcal = 12; in tccb_init()
266 * tsb_init - initialize tsb
267 * @tsb: the tsb address
278 * tccb_add_dcw - add a dcw to the tccb
279 * @tccb: the tccb address
283 * @cd: pointer to control data for this dcw or NULL if none is required
284 * @cd_count: number of control data bytes for this dcw
285 * @count: number of data bytes for this dcw
289 * a pointer to the newly added dcw on success or -%ENOSPC if the new dcw
307 return ERR_PTR(-ENOSPC); in tccb_add_dcw()
309 dcw = (struct dcw *) &tccb->tca[tca_offset]; in tccb_add_dcw()
311 dcw->cmd = cmd; in tccb_add_dcw()
312 dcw->flags = flags; in tccb_add_dcw()
313 dcw->count = count; in tccb_add_dcw()
314 dcw->cd_count = cd_count; in tccb_add_dcw()
316 memcpy(&dcw->cd[0], cd, cd_count); in tccb_add_dcw()
317 tccb->tcah.tcal += size; in tccb_add_dcw()
323 * tcw_add_tidaw - add a tidaw to a tcw
324 * @tcw: the tcw address
327 * @addr: address value for the new tidaw
330 * Add a new tidaw to the input/output data tidaw-list of the specified tcw
331 * (depending on the value of the r-flag and w-flag) and return a pointer to
334 * Note: the tidaw-list is assumed to be contiguous with no ttics. The caller
335 * must ensure that there is enough space for the new tidaw. The last-tidaw
343 /* Add tidaw to tidaw-list. */ in tcw_add_tidaw()
346 tidaw->flags = flags; in tcw_add_tidaw()
347 tidaw->count = count; in tcw_add_tidaw()
348 tidaw->addr = (u64) ((addr_t) addr); in tcw_add_tidaw()