Lines Matching refs:sgl

22 /* use default sgl head size 64B */
36 struct hisi_acc_hw_sgl *sgl;
48 * hisi_acc_create_sgl_pool() - Create a hw sgl pool.
49 * @dev: The device which hw sgl pool belongs to.
53 * This function creates a hw sgl pool, after this user can get hw sgl memory
85 block[i].sgl = dma_alloc_coherent(dev, block_size,
88 if (!block[i].sgl)
95 block[i].sgl = dma_alloc_coherent(dev, remain_sgl * sgl_size,
98 if (!block[i].sgl)
114 dma_free_coherent(dev, block_size, block[j].sgl,
123 * hisi_acc_free_sgl_pool() - Free a hw sgl pool.
124 * @dev: The device which hw sgl pool belongs to.
127 * This function frees memory of a hw sgl pool.
140 dma_free_coherent(dev, block[i].size, block[i].sgl,
161 return (void *)block[block_index].sgl + pool->sgl_size * offset;
164 static void sg_map_to_hw_sg(struct scatterlist *sgl,
167 hw_sge->buf = sg_dma_address(sgl);
168 hw_sge->len = cpu_to_le32(sg_dma_len(sgl));
185 * hisi_acc_sg_buf_map_to_hw_sgl - Map a scatterlist to a hw sgl.
186 * @dev: The device which hw sgl belongs to.
187 * @sgl: Scatterlist which will be mapped to hw sgl.
188 * @pool: Pool which hw sgl memory will be allocated in.
190 * @hw_sgl_dma: The dma address of allocated hw sgl.
192 * This function builds hw sgl according input sgl, user can use hw_sgl_dma
193 * as src/dst in its BD. Only support single hw sgl currently.
197 struct scatterlist *sgl,
207 if (!dev || !sgl || !pool || !hw_sgl_dma)
210 sg_n = sg_nents(sgl);
212 sg_n_mapped = dma_map_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
217 dma_unmap_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
223 dma_unmap_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
230 for_each_sg(sgl, sg, sg_n_mapped, i) {
244 * hisi_acc_sg_buf_unmap() - Unmap allocated hw sgl.
245 * @dev: The device which hw sgl belongs to.
246 * @sgl: Related scatterlist.
247 * @hw_sgl: Virtual address of hw sgl.
248 * @hw_sgl_dma: DMA address of hw sgl.
249 * @pool: Pool which hw sgl is allocated in.
251 * This function unmaps allocated hw sgl.
253 void hisi_acc_sg_buf_unmap(struct device *dev, struct scatterlist *sgl,
256 if (!dev || !sgl || !hw_sgl)
259 dma_unmap_sg(dev, sgl, sg_nents(sgl), DMA_BIDIRECTIONAL);