Lines Matching refs:sgl

23 /* use default sgl head size 64B */
37 struct hisi_acc_hw_sgl *sgl;
49 * hisi_acc_create_sgl_pool() - Create a hw sgl pool.
50 * @dev: The device which hw sgl pool belongs to.
54 * This function creates a hw sgl pool, after this user can get hw sgl memory
92 block[i].sgl = dma_alloc_coherent(dev, block_size,
95 if (!block[i].sgl) {
104 block[i].sgl = dma_alloc_coherent(dev, remain_sgl * sgl_size,
107 if (!block[i].sgl) {
125 dma_free_coherent(dev, block_size, block[j].sgl,
134 * hisi_acc_free_sgl_pool() - Free a hw sgl pool.
135 * @dev: The device which hw sgl pool belongs to.
138 * This function frees memory of a hw sgl pool.
151 dma_free_coherent(dev, block[i].size, block[i].sgl,
172 return (void *)block[block_index].sgl + pool->sgl_size * offset;
175 static void sg_map_to_hw_sg(struct scatterlist *sgl,
178 hw_sge->buf = sg_dma_address(sgl);
179 hw_sge->len = cpu_to_le32(sg_dma_len(sgl));
180 hw_sge->page_ctrl = sg_virt(sgl);
210 * hisi_acc_sg_buf_map_to_hw_sgl - Map a scatterlist to a hw sgl.
211 * @dev: The device which hw sgl belongs to.
212 * @sgl: Scatterlist which will be mapped to hw sgl.
213 * @pool: Pool which hw sgl memory will be allocated in.
215 * @hw_sgl_dma: The dma address of allocated hw sgl.
217 * This function builds hw sgl according input sgl, user can use hw_sgl_dma
218 * as src/dst in its BD. Only support single hw sgl currently.
222 struct scatterlist *sgl,
233 if (!dev || !sgl || !pool || !hw_sgl_dma)
236 sg_n = sg_nents(sgl);
238 sg_n_mapped = dma_map_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
252 dma_unmap_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
258 for_each_sg(sgl, sg, sg_n_mapped, i) {
272 * hisi_acc_sg_buf_unmap() - Unmap allocated hw sgl.
273 * @dev: The device which hw sgl belongs to.
274 * @sgl: Related scatterlist.
275 * @hw_sgl: Virtual address of hw sgl.
277 * This function unmaps allocated hw sgl.
279 void hisi_acc_sg_buf_unmap(struct device *dev, struct scatterlist *sgl,
282 if (!dev || !sgl || !hw_sgl)
285 dma_unmap_sg(dev, sgl, sg_nents(sgl), DMA_BIDIRECTIONAL);