Lines Matching refs:ctx

152 	struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req);  in bfin_crypto_crc_init()  local
155 dev_dbg(ctx->crc->dev, "crc_init\n"); in bfin_crypto_crc_init()
164 dev_dbg(ctx->crc->dev, "init: requested sg list is too big > %d\n", in bfin_crypto_crc_init()
169 ctx->crc = crc; in bfin_crypto_crc_init()
170 ctx->bufnext_len = 0; in bfin_crypto_crc_init()
171 ctx->buflast_len = 0; in bfin_crypto_crc_init()
172 ctx->sg_buflen = 0; in bfin_crypto_crc_init()
173 ctx->total = 0; in bfin_crypto_crc_init()
174 ctx->flag = 0; in bfin_crypto_crc_init()
179 dev_dbg(ctx->crc->dev, "init: digest size: %d\n", in bfin_crypto_crc_init()
188 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(crc->req); in bfin_crypto_crc_config_dma() local
196 dma_map_sg(crc->dev, ctx->sg, ctx->sg_nents, DMA_TO_DEVICE); in bfin_crypto_crc_config_dma()
198 for_each_sg(ctx->sg, sg, ctx->sg_nents, j) { in bfin_crypto_crc_config_dma()
202 dma_count = sg_dma_len(sg) - ctx->bufnext_len; in bfin_crypto_crc_config_dma()
272 if (ctx->bufnext_len && (ctx->flag == CRC_CRYPTO_STATE_FINALUPDATE || in bfin_crypto_crc_config_dma()
273 ctx->flag == CRC_CRYPTO_STATE_FINISH)) { in bfin_crypto_crc_config_dma()
274 crc->sg_cpu[i].start_addr = dma_map_single(crc->dev, ctx->bufnext, in bfin_crypto_crc_config_dma()
303 struct bfin_crypto_crc_reqctx *ctx; in bfin_crypto_crc_handle_queue() local
332 ctx = ahash_request_ctx(req); in bfin_crypto_crc_handle_queue()
333 ctx->sg = NULL; in bfin_crypto_crc_handle_queue()
334 ctx->sg_buflen = 0; in bfin_crypto_crc_handle_queue()
335 ctx->sg_nents = 0; in bfin_crypto_crc_handle_queue()
338 ctx->flag, req->nbytes); in bfin_crypto_crc_handle_queue()
340 if (ctx->flag == CRC_CRYPTO_STATE_FINISH) { in bfin_crypto_crc_handle_queue()
341 if (ctx->bufnext_len == 0) { in bfin_crypto_crc_handle_queue()
347 memset(ctx->bufnext + ctx->bufnext_len, 0, in bfin_crypto_crc_handle_queue()
348 CHKSUM_DIGEST_SIZE - ctx->bufnext_len); in bfin_crypto_crc_handle_queue()
351 if (ctx->bufnext_len + req->nbytes < CHKSUM_DIGEST_SIZE) { in bfin_crypto_crc_handle_queue()
352 memcpy(ctx->bufnext + ctx->bufnext_len, in bfin_crypto_crc_handle_queue()
354 ctx->bufnext_len += req->nbytes; in bfin_crypto_crc_handle_queue()
355 if (ctx->flag == CRC_CRYPTO_STATE_FINALUPDATE && in bfin_crypto_crc_handle_queue()
356 ctx->bufnext_len) { in bfin_crypto_crc_handle_queue()
364 if (ctx->bufnext_len) { in bfin_crypto_crc_handle_queue()
366 ctx->buflast_len = ctx->bufnext_len; in bfin_crypto_crc_handle_queue()
367 memcpy(ctx->buflast, ctx->bufnext, ctx->buflast_len); in bfin_crypto_crc_handle_queue()
369 nsg = ctx->sg_buflen ? 2 : 1; in bfin_crypto_crc_handle_queue()
370 sg_init_table(ctx->bufsl, nsg); in bfin_crypto_crc_handle_queue()
371 sg_set_buf(ctx->bufsl, ctx->buflast, ctx->buflast_len); in bfin_crypto_crc_handle_queue()
373 scatterwalk_sg_chain(ctx->bufsl, nsg, in bfin_crypto_crc_handle_queue()
375 ctx->sg = ctx->bufsl; in bfin_crypto_crc_handle_queue()
377 ctx->sg = req->src; in bfin_crypto_crc_handle_queue()
380 nsg = ctx->sg_nents = sg_count(ctx->sg); in bfin_crypto_crc_handle_queue()
381 ctx->sg_buflen = ctx->buflast_len + req->nbytes; in bfin_crypto_crc_handle_queue()
382 ctx->bufnext_len = ctx->sg_buflen % 4; in bfin_crypto_crc_handle_queue()
383 ctx->sg_buflen &= ~0x3; in bfin_crypto_crc_handle_queue()
385 if (ctx->bufnext_len) { in bfin_crypto_crc_handle_queue()
387 memset(ctx->bufnext, 0, CHKSUM_DIGEST_SIZE); in bfin_crypto_crc_handle_queue()
388 nextlen = ctx->bufnext_len; in bfin_crypto_crc_handle_queue()
390 sg = sg_get(ctx->sg, nsg, i); in bfin_crypto_crc_handle_queue()
392 memcpy(ctx->bufnext + nextlen - j, in bfin_crypto_crc_handle_queue()
395 ctx->sg_nents--; in bfin_crypto_crc_handle_queue()
404 if (ctx->bufnext_len && (ctx->flag == CRC_CRYPTO_STATE_FINALUPDATE || in bfin_crypto_crc_handle_queue()
405 ctx->flag == CRC_CRYPTO_STATE_FINISH)) in bfin_crypto_crc_handle_queue()
406 ctx->sg_buflen += CHKSUM_DIGEST_SIZE; in bfin_crypto_crc_handle_queue()
409 writel(ctx->sg_buflen >> 2, &crc->regs->datacnt); in bfin_crypto_crc_handle_queue()
423 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req); in bfin_crypto_crc_update() local
428 dev_dbg(ctx->crc->dev, "crc_update\n"); in bfin_crypto_crc_update()
429 ctx->total += req->nbytes; in bfin_crypto_crc_update()
430 ctx->flag = CRC_CRYPTO_STATE_UPDATE; in bfin_crypto_crc_update()
432 return bfin_crypto_crc_handle_queue(ctx->crc, req); in bfin_crypto_crc_update()
439 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req); in bfin_crypto_crc_final() local
441 dev_dbg(ctx->crc->dev, "crc_final\n"); in bfin_crypto_crc_final()
442 ctx->flag = CRC_CRYPTO_STATE_FINISH; in bfin_crypto_crc_final()
445 return bfin_crypto_crc_handle_queue(ctx->crc, req); in bfin_crypto_crc_final()
452 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req); in bfin_crypto_crc_finup() local
454 dev_dbg(ctx->crc->dev, "crc_finishupdate\n"); in bfin_crypto_crc_finup()
455 ctx->total += req->nbytes; in bfin_crypto_crc_finup()
456 ctx->flag = CRC_CRYPTO_STATE_FINALUPDATE; in bfin_crypto_crc_finup()
459 return bfin_crypto_crc_handle_queue(ctx->crc, req); in bfin_crypto_crc_finup()