Lines Matching refs:sg

14 #define sg_is_chain(sg)		((sg)->page_link & 0x01)  argument
15 #define sg_is_last(sg) ((sg)->page_link & 0x02) argument
16 #define sg_chain_ptr(sg) \ argument
17 ((struct scatterlist *) ((sg)->page_link & ~0x03))
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()
39 BUG_ON(sg_is_chain(sg)); in sg_assign_page()
41 sg->page_link = page_link | (unsigned long) page; in sg_assign_page()
58 static inline void sg_set_page(struct scatterlist *sg, struct page *page, 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() argument
69 BUG_ON(sg_is_chain(sg)); in sg_page()
71 return (struct page *)((sg)->page_link & ~0x3); in sg_page()
77 #define for_each_sg(sglist, sg, nr, __i) \ argument
78 for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg))
115 static inline void sg_mark_end(struct scatterlist *sg) in sg_mark_end() argument
120 sg->page_link |= 0x02; in sg_mark_end()
121 sg->page_link &= ~0x01; in sg_mark_end()
132 static inline void sg_unmark_end(struct scatterlist *sg) in sg_unmark_end() argument
134 sg->page_link &= ~0x02; in sg_unmark_end()
137 static inline struct scatterlist *sg_next(struct scatterlist *sg) in sg_next() argument
139 if (sg_is_last(sg)) in sg_next()
142 sg++; in sg_next()
143 if (unlikely(sg_is_chain(sg))) in sg_next()
144 sg = sg_chain_ptr(sg); in sg_next()
146 return sg; in sg_next()
155 static inline dma_addr_t sg_phys(struct scatterlist *sg) in sg_phys() argument
157 return page_to_phys(sg_page(sg)) + sg->offset; in sg_phys()
160 static inline void sg_set_buf(struct scatterlist *sg, const void *buf, in sg_set_buf() argument
163 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); in sg_set_buf()
166 static inline void sg_init_one(struct scatterlist *sg, in sg_init_one() argument
169 sg_init_table(sg, 1); in sg_init_one()
170 sg_set_buf(sg, buf, buflen); in sg_init_one()