Lines Matching +full:unit +full:- +full:addresses

1 /* SPDX-License-Identifier: GPL-2.0 */
26 * to get bus addresses of each of the SG entries and their lengths.
31 #define sg_dma_address(sg) ((sg)->dma_address)
34 #define sg_dma_len(sg) ((sg)->dma_length)
36 #define sg_dma_len(sg) ((sg)->length)
73 * Those low bits are there for everyone! (thanks mason :-)
79 return sg->page_link & SG_PAGE_LINK_MASK; in __sg_flags()
84 return (struct scatterlist *)(sg->page_link & ~SG_PAGE_LINK_MASK); in sg_chain_ptr()
98 * sg_assign_page - Assign a given page to an SG entry
109 unsigned long page_link = sg->page_link & (SG_CHAIN | SG_END); in sg_assign_page()
113 * must be aligned at a 32-bit boundary as a minimum. in sg_assign_page()
119 sg->page_link = page_link | (unsigned long) page; in sg_assign_page()
123 * sg_set_page - Set sg entry to point at given page
140 sg->offset = offset; in sg_set_page()
141 sg->length = len; in sg_set_page()
149 return (struct page *)((sg)->page_link & ~SG_PAGE_LINK_MASK); in sg_page()
153 * sg_set_buf - Set sg entry to point at given data
178 for_each_sg((sgt)->sgl, sg, (sgt)->orig_nents, i)
182 * Please use sg_dma_address(sg) and sg_dma_len(sg) to extract DMA addresses
186 for_each_sg((sgt)->sgl, sg, (sgt)->nents, i)
194 chain_sg->offset = 0; in __sg_chain()
195 chain_sg->length = 0; in __sg_chain()
201 chain_sg->page_link = ((unsigned long) sgl | SG_CHAIN) & ~SG_END; in __sg_chain()
205 * sg_chain - Chain two sglists together
217 __sg_chain(&prv[prv_nents - 1], sgl); in sg_chain()
221 * sg_mark_end - Mark the end of the scatterlist
234 sg->page_link |= SG_END; in sg_mark_end()
235 sg->page_link &= ~SG_CHAIN; in sg_mark_end()
239 * sg_unmark_end - Undo setting the end of the scatterlist
248 sg->page_link &= ~SG_END; in sg_unmark_end()
262 * sg_dma_is_bus address - Return whether a given segment was marked
272 return sg->dma_flags & SG_DMA_BUS_ADDRESS; in sg_is_dma_bus_address()
276 * sg_dma_mark_bus address - Mark the scatterlist entry as a bus address
282 * used by dma_map_sg() implementations to mark bus addresses
287 sg->dma_flags |= SG_DMA_BUS_ADDRESS; in sg_dma_mark_bus_address()
291 * sg_unmark_bus_address - Unmark the scatterlist entry as a bus address
299 sg->dma_flags &= ~SG_DMA_BUS_ADDRESS; in sg_dma_unmark_bus_address()
318 * sg_phys - Return physical address of an sg entry
329 return page_to_phys(sg_page(sg)) + sg->offset; in sg_phys()
333 * sg_virt - Return virtual address of an sg entry
344 return page_address(sg_page(sg)) + sg->offset; in sg_virt()
348 * sg_init_marker - Initialize markers in sg table
356 sg_mark_end(&sgl[nents - 1]); in sg_init_marker()
392 * sg_alloc_table_from_pages - Allocate and initialize an sg table from
483 * Iterates over sg entries page-by-page. On each successful iteration, you
485 * @piter->sg will point to the sg holding this page and @piter->sg_pgoffset to
501 * sg page iterator for DMA addresses
517 * sg_page_iter_page - get the current page held by the page iterator
522 return nth_page(sg_page(piter->sg), piter->sg_pgoffset); in sg_page_iter_page()
526 * sg_page_iter_dma_address - get the dma address of the current page held by
533 return sg_dma_address(dma_iter->base.sg) + in sg_page_iter_dma_address()
534 (dma_iter->base.sg_pgoffset << PAGE_SHIFT); in sg_page_iter_dma_address()
538 * for_each_sg_page - iterate over the pages of the given sg list
545 * In each loop it operates on PAGE_SIZE unit.
552 * for_each_sg_dma_page - iterate over the pages of the given sg list
560 * In each loop it operates on PAGE_SIZE unit.
563 for (__sg_page_iter_start(&(dma_iter)->base, sglist, dma_nents, \
568 * for_each_sgtable_page - iterate over all pages in the sg_table object
575 * See also for_each_sg_page(). In each loop it operates on PAGE_SIZE unit.
578 for_each_sg_page((sgt)->sgl, piter, (sgt)->orig_nents, pgoffset)
581 * for_each_sgtable_dma_page - iterate over the DMA mapped sg_table object
589 * unit.
592 for_each_sg_dma_page((sgt)->sgl, dma_iter, (sgt)->nents, pgoffset)
598 * Iterates over sg entries mapping page-by-page. On each successful
599 * iteration, @miter->page points to the mapped page and
600 * @miter->length bytes of data can be accessed at @miter->addr. As
604 * @miter->consumed is set to @miter->length on each iteration. It