Lines Matching +full:page +full:- +full:offset
1 /* SPDX-License-Identifier: GPL-2.0 */
9 unsigned int offset; member
15 #define sg_is_chain(sg) ((sg)->page_link & 0x01)
16 #define sg_is_last(sg) ((sg)->page_link & 0x02)
18 ((struct scatterlist *) ((sg)->page_link & ~0x03))
21 * sg_assign_page - Assign a given page to an SG entry
23 * @page: The page
26 * Assign page to sg entry. Also see sg_set_page(), the most commonly used
30 static inline void sg_assign_page(struct scatterlist *sg, struct page *page) in sg_assign_page() argument
32 unsigned long page_link = sg->page_link & 0x3; in sg_assign_page()
36 * must be aligned at a 32-bit boundary as a minimum. in sg_assign_page()
38 BUG_ON((unsigned long) page & 0x03); in sg_assign_page()
42 sg->page_link = page_link | (unsigned long) page; in sg_assign_page()
46 * sg_set_page - Set sg entry to point at given page
48 * @page: The page
50 * @offset: Offset into page
53 * Use this function to set an sg entry pointing at a page, never assign
54 * the page directly. We encode sg table information in the lower bits
55 * of the page pointer. See sg_page() for looking up the page belonging
59 static inline void sg_set_page(struct scatterlist *sg, struct page *page, in sg_set_page() argument
60 unsigned int len, unsigned int offset) in sg_set_page() argument
62 sg_assign_page(sg, page); in sg_set_page()
63 sg->offset = offset; in sg_set_page()
64 sg->length = len; in sg_set_page()
67 static inline struct page *sg_page(struct scatterlist *sg) in sg_page()
72 return (struct page *)((sg)->page_link & ~0x3); in sg_page()
82 * sg_chain - Chain two sglists together
95 * offset and length are unused for chain entry. Clear them. in sg_chain()
97 prv[prv_nents - 1].offset = 0; in sg_chain()
98 prv[prv_nents - 1].length = 0; in sg_chain()
104 prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02; in sg_chain()
108 * sg_mark_end - Mark the end of the scatterlist
121 sg->page_link |= 0x02; in sg_mark_end()
122 sg->page_link &= ~0x01; in sg_mark_end()
126 * sg_unmark_end - Undo setting the end of the scatterlist
135 sg->page_link &= ~0x02; in sg_unmark_end()
153 sg_mark_end(&sgl[nents - 1]); in sg_init_table()
158 return page_to_phys(sg_page(sg)) + sg->offset; in sg_phys()