Lines Matching +full:over +full:- +full:current
1 /* SPDX-License-Identifier: GPL-2.0 */
28 #define sg_dma_address(sg) ((sg)->dma_address)
31 #define sg_dma_len(sg) ((sg)->dma_length)
33 #define sg_dma_len(sg) ((sg)->length)
70 * Those low bits are there for everyone! (thanks mason :-)
72 #define sg_is_chain(sg) ((sg)->page_link & SG_CHAIN)
73 #define sg_is_last(sg) ((sg)->page_link & SG_END)
75 ((struct scatterlist *) ((sg)->page_link & ~(SG_CHAIN | SG_END)))
78 * sg_assign_page - Assign a given page to an SG entry
89 unsigned long page_link = sg->page_link & (SG_CHAIN | SG_END); in sg_assign_page()
93 * must be aligned at a 32-bit boundary as a minimum. in sg_assign_page()
99 sg->page_link = page_link | (unsigned long) page; in sg_assign_page()
103 * sg_set_page - Set sg entry to point at given page
120 sg->offset = offset; in sg_set_page()
121 sg->length = len; in sg_set_page()
129 return (struct page *)((sg)->page_link & ~(SG_CHAIN | SG_END)); in sg_page()
133 * sg_set_buf - Set sg entry to point at given data
149 * Loop over each sg element, following the pointer to a new list if necessary
155 * Loop over each sg element in the given sg_table object.
158 for_each_sg((sgt)->sgl, sg, (sgt)->orig_nents, i)
161 * Loop over each sg element in the given *DMA mapped* sg_table object.
166 for_each_sg((sgt)->sgl, sg, (sgt)->nents, i)
174 chain_sg->offset = 0; in __sg_chain()
175 chain_sg->length = 0; in __sg_chain()
181 chain_sg->page_link = ((unsigned long) sgl | SG_CHAIN) & ~SG_END; in __sg_chain()
185 * sg_chain - Chain two sglists together
197 __sg_chain(&prv[prv_nents - 1], sgl); in sg_chain()
201 * sg_mark_end - Mark the end of the scatterlist
214 sg->page_link |= SG_END; in sg_mark_end()
215 sg->page_link &= ~SG_CHAIN; in sg_mark_end()
219 * sg_unmark_end - Undo setting the end of the scatterlist
228 sg->page_link &= ~SG_END; in sg_unmark_end()
232 * sg_phys - Return physical address of an sg entry
243 return page_to_phys(sg_page(sg)) + sg->offset; in sg_phys()
247 * sg_virt - Return virtual address of an sg entry
258 return page_address(sg_page(sg)) + sg->offset; in sg_virt()
262 * sg_init_marker - Initialize markers in sg table
270 sg_mark_end(&sgl[nents - 1]); in sg_init_marker()
306 * sg_alloc_table_from_pages - Allocate and initialize an sg table from
397 * Iterates over sg entries page-by-page. On each successful iteration, you
398 * can call sg_page_iter_page(@piter) to get the current page.
399 * @piter->sg will point to the sg holding this page and @piter->sg_pgoffset to
431 * sg_page_iter_page - get the current page held by the page iterator
436 return nth_page(sg_page(piter->sg), piter->sg_pgoffset); in sg_page_iter_page()
440 * sg_page_iter_dma_address - get the dma address of the current page held by
447 return sg_dma_address(dma_iter->base.sg) + in sg_page_iter_dma_address()
448 (dma_iter->base.sg_pgoffset << PAGE_SHIFT); in sg_page_iter_dma_address()
452 * for_each_sg_page - iterate over the pages of the given sg list
453 * @sglist: sglist to iterate over
454 * @piter: page iterator to hold current page, sg, sg_pgoffset
455 * @nents: maximum number of sg entries to iterate over
466 * for_each_sg_dma_page - iterate over the pages of the given sg list
467 * @sglist: sglist to iterate over
468 * @dma_iter: DMA page iterator to hold current page
469 * @dma_nents: maximum number of sg entries to iterate over, this is the value
477 for (__sg_page_iter_start(&(dma_iter)->base, sglist, dma_nents, \
482 * for_each_sgtable_page - iterate over all pages in the sg_table object
483 * @sgt: sg_table object to iterate over
484 * @piter: page iterator to hold current page
487 * Iterates over the all memory pages in the buffer described by
492 for_each_sg_page((sgt)->sgl, piter, (sgt)->orig_nents, pgoffset)
495 * for_each_sgtable_dma_page - iterate over the DMA mapped sg_table object
496 * @sgt: sg_table object to iterate over
497 * @dma_iter: DMA page iterator to hold current page
500 * Iterates over the all DMA mapped pages in the buffer described by
506 for_each_sg_dma_page((sgt)->sgl, dma_iter, (sgt)->nents, pgoffset)
512 * Iterates over sg entries mapping page-by-page. On each successful
513 * iteration, @miter->page points to the mapped page and
514 * @miter->length bytes of data can be accessed at @miter->addr. As
518 * @miter->consumed is set to @miter->length on each iteration. It