diff options
author | Gary R Hook <gary.hook@amd.com> | 2016-07-26 20:10:13 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-08-09 06:47:10 -0400 |
commit | bb4e89b34d1bf46156b7e880a0f34205fb7ce2a5 (patch) | |
tree | 1fed02203f6f76373e9e88bad677295de5c26745 /drivers/crypto/ccp/ccp-dev-v3.c | |
parent | 8256e683113e659d9bf6bffdd227eeb1881ae9a7 (diff) |
crypto: ccp - Refactor code to enable checks for queue space.
Available queue space is used to decide (by counting free slots)
if we have to put a command on hold or if it can be sent
to the engine immediately.
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/ccp-dev-v3.c')
-rw-r--r-- | drivers/crypto/ccp/ccp-dev-v3.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-dev-v3.c b/drivers/crypto/ccp/ccp-dev-v3.c index 373ac4fa4a47..02c8c95fdc2d 100644 --- a/drivers/crypto/ccp/ccp-dev-v3.c +++ b/drivers/crypto/ccp/ccp-dev-v3.c | |||
@@ -70,6 +70,11 @@ static void ccp_free_ksb(struct ccp_cmd_queue *cmd_q, unsigned int start, | |||
70 | wake_up_interruptible_all(&ccp->sb_queue); | 70 | wake_up_interruptible_all(&ccp->sb_queue); |
71 | } | 71 | } |
72 | 72 | ||
73 | static unsigned int ccp_get_free_slots(struct ccp_cmd_queue *cmd_q) | ||
74 | { | ||
75 | return CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); | ||
76 | } | ||
77 | |||
73 | static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count) | 78 | static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count) |
74 | { | 79 | { |
75 | struct ccp_cmd_queue *cmd_q = op->cmd_q; | 80 | struct ccp_cmd_queue *cmd_q = op->cmd_q; |
@@ -357,7 +362,7 @@ static int ccp_init(struct ccp_device *ccp) | |||
357 | cmd_q->int_ok = 1 << (i * 2); | 362 | cmd_q->int_ok = 1 << (i * 2); |
358 | cmd_q->int_err = 1 << ((i * 2) + 1); | 363 | cmd_q->int_err = 1 << ((i * 2) + 1); |
359 | 364 | ||
360 | cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); | 365 | cmd_q->free_slots = ccp_get_free_slots(cmd_q); |
361 | 366 | ||
362 | init_waitqueue_head(&cmd_q->int_queue); | 367 | init_waitqueue_head(&cmd_q->int_queue); |
363 | 368 | ||
@@ -559,6 +564,7 @@ static const struct ccp_actions ccp3_actions = { | |||
559 | .sbfree = ccp_free_ksb, | 564 | .sbfree = ccp_free_ksb, |
560 | .init = ccp_init, | 565 | .init = ccp_init, |
561 | .destroy = ccp_destroy, | 566 | .destroy = ccp_destroy, |
567 | .get_free_slots = ccp_get_free_slots, | ||
562 | .irqhandler = ccp_irq_handler, | 568 | .irqhandler = ccp_irq_handler, |
563 | }; | 569 | }; |
564 | 570 | ||