Lines Matching +full:non +full:- +full:contiguous

1 // SPDX-License-Identifier: GPL-2.0
20 * struct itcw - incremental tcw helper data type
23 * tcw and associated tccb, tsb, data tidaw-list plus an optional interrogate
25 * contiguous buffer provided by the user.
28 * - reset unused fields to zero
29 * - fill in required pointers
30 * - ensure required alignment for data structures
31 * - prevent data structures to cross 4k-byte boundary where required
32 * - calculate tccb-related length fields
33 * - optionally provide ready-made interrogate tcw and associated structures
36 * - tida only supported for data address, not for tccb
37 * - only contiguous tidaw-lists (no ttic)
38 * - total number of bytes required per itcw may not exceed 4k bytes
39 * - either read or write operation (may not work with r=0 and w=0)
49 * return -ENOMEM;
69 * itcw_get_tcw - return pointer to tcw associated with the itcw
76 return itcw->tcw; in itcw_get_tcw()
81 * itcw_calc_size - return the size of an itcw with the given parameters
82 * @intrg: if non-zero, add an interrogate tcw
93 * 4k-boundary where required.
123 cross_count = 1 + ((max_tidaws * sizeof(struct tidaw) - 1) in itcw_calc_size()
128 cross_count = 1 + ((intrg_max_tidaws * sizeof(struct tidaw) - 1) in itcw_calc_size()
149 return ERR_PTR(-ENOSPC); in fit_chunk()
155 * itcw_init - initialize incremental tcw data structure
160 * @intrg: if non-zero, add and initialize an interrogate tcw
171 * - no tccb tidal
172 * - input/output tidal is contiguous (no ttic)
173 * - total data should not exceed 4k
174 * - tcw specifies either read or write operation
192 return ERR_PTR(-EINVAL); in itcw_init()
202 cross_count = 1 + ((max_tidaws * sizeof(struct tidaw) - 1) in itcw_init()
204 itcw->max_tidaws = max_tidaws + cross_count; in itcw_init()
207 cross_count = 1 + ((intrg_max_tidaws * sizeof(struct tidaw) - 1) in itcw_init()
209 itcw->intrg_max_tidaws = intrg_max_tidaws + cross_count; in itcw_init()
214 itcw->tcw = chunk; in itcw_init()
215 tcw_init(itcw->tcw, (op == ITCW_OP_READ) ? 1 : 0, in itcw_init()
222 itcw->intrg_tcw = chunk; in itcw_init()
223 tcw_init(itcw->intrg_tcw, 1, 0); in itcw_init()
224 tcw_set_intrg(itcw->tcw, itcw->intrg_tcw); in itcw_init()
229 itcw->max_tidaws, 16, 0); in itcw_init()
232 tcw_set_data(itcw->tcw, chunk, 1); in itcw_init()
237 itcw->intrg_max_tidaws, 16, 0); in itcw_init()
240 tcw_set_data(itcw->intrg_tcw, chunk, 1); in itcw_init()
247 tcw_set_tsb(itcw->tcw, chunk); in itcw_init()
254 tcw_set_tsb(itcw->intrg_tcw, chunk); in itcw_init()
261 tcw_set_tccb(itcw->tcw, chunk); in itcw_init()
268 tcw_set_tccb(itcw->intrg_tcw, chunk); in itcw_init()
271 tcw_finalize(itcw->intrg_tcw, 0); in itcw_init()
278 * itcw_add_dcw - add a dcw to the itcw
288 * a pointer to the newly added dcw on success or -%ENOSPC if the new dcw
297 return tccb_add_dcw(tcw_get_tccb(itcw->tcw), TCCB_MAX_SIZE, cmd, in itcw_add_dcw()
303 * itcw_add_tidaw - add a tidaw to the itcw
309 * Add a new tidaw to the input/output data tidaw-list of the specified itcw
310 * (depending on the value of the r-flag and w-flag). Return a pointer to
311 * the new tidaw on success or -%ENOSPC if the new tidaw would exceed the
315 * this interface with the TTIC flag is not supported. The last-tidaw flag
322 if (itcw->num_tidaws >= itcw->max_tidaws) in itcw_add_tidaw()
323 return ERR_PTR(-ENOSPC); in itcw_add_tidaw()
329 following = ((struct tidaw *) tcw_get_data(itcw->tcw)) in itcw_add_tidaw()
330 + itcw->num_tidaws + 1; in itcw_add_tidaw()
331 if (itcw->num_tidaws && !((unsigned long) following & ~PAGE_MASK)) { in itcw_add_tidaw()
332 tcw_add_tidaw(itcw->tcw, itcw->num_tidaws++, in itcw_add_tidaw()
334 if (itcw->num_tidaws >= itcw->max_tidaws) in itcw_add_tidaw()
335 return ERR_PTR(-ENOSPC); in itcw_add_tidaw()
337 return tcw_add_tidaw(itcw->tcw, itcw->num_tidaws++, flags, addr, count); in itcw_add_tidaw()
342 * itcw_set_data - set data address and tida flag of the itcw
345 * @use_tidal: zero of the data address specifies a contiguous block of data,
346 * non-zero if it specifies a list if tidaws.
349 * r-flag and w-flag). If @use_tidal is non-zero, the corresponding tida flag
354 tcw_set_data(itcw->tcw, addr, use_tidal); in itcw_set_data()
359 * itcw_finalize - calculate length and count fields of the itcw
362 * Calculate tcw input-/output-count and tccbl fields and add a tcat the tccb.
363 * In case input- or output-tida is used, the tidaw-list must be stored in
365 * up-to-date.
369 tcw_finalize(itcw->tcw, itcw->num_tidaws); in itcw_finalize()