Lines Matching +full:page +full:- +full:offset
1 /* SPDX-License-Identifier: GPL-2.0 */
8 unsigned int offset; member
14 #define sg_is_chain(sg) ((sg)->page_link & 0x01)
15 #define sg_is_last(sg) ((sg)->page_link & 0x02)
17 ((struct scatterlist *) ((sg)->page_link & ~0x03))
20 * sg_assign_page - Assign a given page to an SG entry
22 * @page: The page
25 * Assign page to sg entry. Also see sg_set_page(), the most commonly used
29 static inline void sg_assign_page(struct scatterlist *sg, struct page *page) in sg_assign_page() argument
31 unsigned long page_link = sg->page_link & 0x3; in sg_assign_page()
35 * must be aligned at a 32-bit boundary as a minimum. in sg_assign_page()
37 BUG_ON((unsigned long) page & 0x03); in sg_assign_page()
41 sg->page_link = page_link | (unsigned long) page; in sg_assign_page()
45 * sg_set_page - Set sg entry to point at given page
47 * @page: The page
49 * @offset: Offset into page
52 * Use this function to set an sg entry pointing at a page, never assign
53 * the page directly. We encode sg table information in the lower bits
54 * of the page pointer. See sg_page() for looking up the page belonging
58 static inline void sg_set_page(struct scatterlist *sg, struct page *page, in sg_set_page() argument
59 unsigned int len, unsigned int offset) in sg_set_page() argument
61 sg_assign_page(sg, page); in sg_set_page()
62 sg->offset = offset; in sg_set_page()
63 sg->length = len; in sg_set_page()
66 static inline struct page *sg_page(struct scatterlist *sg) in sg_page()
71 return (struct page *)((sg)->page_link & ~0x3); in sg_page()
81 * sg_chain - Chain two sglists together
94 * offset and length are unused for chain entry. Clear them. in sg_chain()
96 prv[prv_nents - 1].offset = 0; in sg_chain()
97 prv[prv_nents - 1].length = 0; in sg_chain()
103 prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02; in sg_chain()
107 * sg_mark_end - Mark the end of the scatterlist
120 sg->page_link |= 0x02; in sg_mark_end()
121 sg->page_link &= ~0x01; in sg_mark_end()
125 * sg_unmark_end - Undo setting the end of the scatterlist
134 sg->page_link &= ~0x02; in sg_unmark_end()
152 sg_mark_end(&sgl[nents - 1]); in sg_init_table()
157 return page_to_phys(sg_page(sg)) + sg->offset; in sg_phys()