Lines Matching refs:ctx

132 	struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req);  in bfin_crypto_crc_init()  local
135 dev_dbg(ctx->crc->dev, "crc_init\n"); in bfin_crypto_crc_init()
144 dev_dbg(ctx->crc->dev, "init: requested sg list is too big > %d\n", in bfin_crypto_crc_init()
149 ctx->crc = crc; in bfin_crypto_crc_init()
150 ctx->bufnext_len = 0; in bfin_crypto_crc_init()
151 ctx->buflast_len = 0; in bfin_crypto_crc_init()
152 ctx->sg_buflen = 0; in bfin_crypto_crc_init()
153 ctx->total = 0; in bfin_crypto_crc_init()
154 ctx->flag = 0; in bfin_crypto_crc_init()
159 dev_dbg(ctx->crc->dev, "init: digest size: %d\n", in bfin_crypto_crc_init()
168 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(crc->req); in bfin_crypto_crc_config_dma() local
176 dma_map_sg(crc->dev, ctx->sg, ctx->sg_nents, DMA_TO_DEVICE); in bfin_crypto_crc_config_dma()
178 for_each_sg(ctx->sg, sg, ctx->sg_nents, j) { in bfin_crypto_crc_config_dma()
182 dma_count = sg_dma_len(sg) - ctx->bufnext_len; in bfin_crypto_crc_config_dma()
252 if (ctx->bufnext_len && (ctx->flag == CRC_CRYPTO_STATE_FINALUPDATE || in bfin_crypto_crc_config_dma()
253 ctx->flag == CRC_CRYPTO_STATE_FINISH)) { in bfin_crypto_crc_config_dma()
254 crc->sg_cpu[i].start_addr = dma_map_single(crc->dev, ctx->bufnext, in bfin_crypto_crc_config_dma()
283 struct bfin_crypto_crc_reqctx *ctx; in bfin_crypto_crc_handle_queue() local
312 ctx = ahash_request_ctx(req); in bfin_crypto_crc_handle_queue()
313 ctx->sg = NULL; in bfin_crypto_crc_handle_queue()
314 ctx->sg_buflen = 0; in bfin_crypto_crc_handle_queue()
315 ctx->sg_nents = 0; in bfin_crypto_crc_handle_queue()
318 ctx->flag, req->nbytes); in bfin_crypto_crc_handle_queue()
320 if (ctx->flag == CRC_CRYPTO_STATE_FINISH) { in bfin_crypto_crc_handle_queue()
321 if (ctx->bufnext_len == 0) { in bfin_crypto_crc_handle_queue()
327 memset(ctx->bufnext + ctx->bufnext_len, 0, in bfin_crypto_crc_handle_queue()
328 CHKSUM_DIGEST_SIZE - ctx->bufnext_len); in bfin_crypto_crc_handle_queue()
331 if (ctx->bufnext_len + req->nbytes < CHKSUM_DIGEST_SIZE) { in bfin_crypto_crc_handle_queue()
332 memcpy(ctx->bufnext + ctx->bufnext_len, in bfin_crypto_crc_handle_queue()
334 ctx->bufnext_len += req->nbytes; in bfin_crypto_crc_handle_queue()
335 if (ctx->flag == CRC_CRYPTO_STATE_FINALUPDATE && in bfin_crypto_crc_handle_queue()
336 ctx->bufnext_len) { in bfin_crypto_crc_handle_queue()
344 if (ctx->bufnext_len) { in bfin_crypto_crc_handle_queue()
346 ctx->buflast_len = ctx->bufnext_len; in bfin_crypto_crc_handle_queue()
347 memcpy(ctx->buflast, ctx->bufnext, ctx->buflast_len); in bfin_crypto_crc_handle_queue()
349 nsg = ctx->sg_buflen ? 2 : 1; in bfin_crypto_crc_handle_queue()
350 sg_init_table(ctx->bufsl, nsg); in bfin_crypto_crc_handle_queue()
351 sg_set_buf(ctx->bufsl, ctx->buflast, ctx->buflast_len); in bfin_crypto_crc_handle_queue()
353 sg_chain(ctx->bufsl, nsg, req->src); in bfin_crypto_crc_handle_queue()
354 ctx->sg = ctx->bufsl; in bfin_crypto_crc_handle_queue()
356 ctx->sg = req->src; in bfin_crypto_crc_handle_queue()
359 nsg = sg_nents(ctx->sg); in bfin_crypto_crc_handle_queue()
360 ctx->sg_nents = nsg; in bfin_crypto_crc_handle_queue()
361 ctx->sg_buflen = ctx->buflast_len + req->nbytes; in bfin_crypto_crc_handle_queue()
362 ctx->bufnext_len = ctx->sg_buflen % 4; in bfin_crypto_crc_handle_queue()
363 ctx->sg_buflen &= ~0x3; in bfin_crypto_crc_handle_queue()
365 if (ctx->bufnext_len) { in bfin_crypto_crc_handle_queue()
367 memset(ctx->bufnext, 0, CHKSUM_DIGEST_SIZE); in bfin_crypto_crc_handle_queue()
368 nextlen = ctx->bufnext_len; in bfin_crypto_crc_handle_queue()
370 sg = sg_get(ctx->sg, nsg, i); in bfin_crypto_crc_handle_queue()
372 memcpy(ctx->bufnext + nextlen - j, in bfin_crypto_crc_handle_queue()
375 ctx->sg_nents--; in bfin_crypto_crc_handle_queue()
384 if (ctx->bufnext_len && (ctx->flag == CRC_CRYPTO_STATE_FINALUPDATE || in bfin_crypto_crc_handle_queue()
385 ctx->flag == CRC_CRYPTO_STATE_FINISH)) in bfin_crypto_crc_handle_queue()
386 ctx->sg_buflen += CHKSUM_DIGEST_SIZE; in bfin_crypto_crc_handle_queue()
389 writel(ctx->sg_buflen >> 2, &crc->regs->datacnt); in bfin_crypto_crc_handle_queue()
403 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req); in bfin_crypto_crc_update() local
408 dev_dbg(ctx->crc->dev, "crc_update\n"); in bfin_crypto_crc_update()
409 ctx->total += req->nbytes; in bfin_crypto_crc_update()
410 ctx->flag = CRC_CRYPTO_STATE_UPDATE; in bfin_crypto_crc_update()
412 return bfin_crypto_crc_handle_queue(ctx->crc, req); in bfin_crypto_crc_update()
419 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req); in bfin_crypto_crc_final() local
421 dev_dbg(ctx->crc->dev, "crc_final\n"); in bfin_crypto_crc_final()
422 ctx->flag = CRC_CRYPTO_STATE_FINISH; in bfin_crypto_crc_final()
425 return bfin_crypto_crc_handle_queue(ctx->crc, req); in bfin_crypto_crc_final()
432 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req); in bfin_crypto_crc_finup() local
434 dev_dbg(ctx->crc->dev, "crc_finishupdate\n"); in bfin_crypto_crc_finup()
435 ctx->total += req->nbytes; in bfin_crypto_crc_finup()
436 ctx->flag = CRC_CRYPTO_STATE_FINALUPDATE; in bfin_crypto_crc_finup()
439 return bfin_crypto_crc_handle_queue(ctx->crc, req); in bfin_crypto_crc_finup()