Lines Matching refs:sg

31 #define sg_dma_address(sg)	((sg)->dma_address)  argument
34 #define sg_dma_len(sg) ((sg)->dma_length) argument
36 #define sg_dma_len(sg) ((sg)->length) argument
77 static inline unsigned int __sg_flags(struct scatterlist *sg) in __sg_flags() argument
79 return sg->page_link & SG_PAGE_LINK_MASK; in __sg_flags()
82 static inline struct scatterlist *sg_chain_ptr(struct scatterlist *sg) in sg_chain_ptr() argument
84 return (struct scatterlist *)(sg->page_link & ~SG_PAGE_LINK_MASK); in sg_chain_ptr()
87 static inline bool sg_is_chain(struct scatterlist *sg) in sg_is_chain() argument
89 return __sg_flags(sg) & SG_CHAIN; in sg_is_chain()
92 static inline bool sg_is_last(struct scatterlist *sg) in sg_is_last() argument
94 return __sg_flags(sg) & SG_END; in sg_is_last()
107 static inline void sg_assign_page(struct scatterlist *sg, struct page *page) in sg_assign_page() argument
109 unsigned long page_link = sg->page_link & (SG_CHAIN | SG_END); in sg_assign_page()
117 BUG_ON(sg_is_chain(sg)); in sg_assign_page()
119 sg->page_link = page_link | (unsigned long) page; in sg_assign_page()
136 static inline void sg_set_page(struct scatterlist *sg, struct page *page, in sg_set_page() argument
139 sg_assign_page(sg, page); in sg_set_page()
140 sg->offset = offset; in sg_set_page()
141 sg->length = len; in sg_set_page()
144 static inline struct page *sg_page(struct scatterlist *sg) in sg_page() argument
147 BUG_ON(sg_is_chain(sg)); in sg_page()
149 return (struct page *)((sg)->page_link & ~SG_PAGE_LINK_MASK); in sg_page()
159 static inline void sg_set_buf(struct scatterlist *sg, const void *buf, in sg_set_buf() argument
165 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); in sg_set_buf()
171 #define for_each_sg(sglist, sg, nr, __i) \ argument
172 for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg))
177 #define for_each_sgtable_sg(sgt, sg, i) \ argument
178 for_each_sg((sgt)->sgl, sg, (sgt)->orig_nents, i)
185 #define for_each_sgtable_dma_sg(sgt, sg, i) \ argument
186 for_each_sg((sgt)->sgl, sg, (sgt)->nents, i)
229 static inline void sg_mark_end(struct scatterlist *sg) in sg_mark_end() argument
234 sg->page_link |= SG_END; in sg_mark_end()
235 sg->page_link &= ~SG_CHAIN; in sg_mark_end()
246 static inline void sg_unmark_end(struct scatterlist *sg) in sg_unmark_end() argument
248 sg->page_link &= ~SG_END; in sg_unmark_end()
270 static inline bool sg_is_dma_bus_address(struct scatterlist *sg) in sg_is_dma_bus_address() argument
272 return sg->dma_flags & SG_DMA_BUS_ADDRESS; in sg_is_dma_bus_address()
285 static inline void sg_dma_mark_bus_address(struct scatterlist *sg) in sg_dma_mark_bus_address() argument
287 sg->dma_flags |= SG_DMA_BUS_ADDRESS; in sg_dma_mark_bus_address()
297 static inline void sg_dma_unmark_bus_address(struct scatterlist *sg) in sg_dma_unmark_bus_address() argument
299 sg->dma_flags &= ~SG_DMA_BUS_ADDRESS; in sg_dma_unmark_bus_address()
304 static inline bool sg_is_dma_bus_address(struct scatterlist *sg) in sg_is_dma_bus_address() argument
308 static inline void sg_dma_mark_bus_address(struct scatterlist *sg) in sg_dma_mark_bus_address() argument
311 static inline void sg_dma_unmark_bus_address(struct scatterlist *sg) in sg_dma_unmark_bus_address() argument
327 static inline dma_addr_t sg_phys(struct scatterlist *sg) in sg_phys() argument
329 return page_to_phys(sg_page(sg)) + sg->offset; in sg_phys()
342 static inline void *sg_virt(struct scatterlist *sg) in sg_virt() argument
344 return page_address(sg_page(sg)) + sg->offset; in sg_virt()
359 int sg_nents(struct scatterlist *sg);
360 int sg_nents_for_len(struct scatterlist *sg, u64 len);
491 struct scatterlist *sg; /* sg holding the page */ member
522 return nth_page(sg_page(piter->sg), piter->sg_pgoffset); in sg_page_iter_page()
533 return sg_dma_address(dma_iter->base.sg) + in sg_page_iter_dma_address()