diff options
author | Gary R Hook <gary.hook@amd.com> | 2016-09-28 12:53:56 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-10-02 10:33:45 -0400 |
commit | 81422badb39078fde1ffcecda3caac555226fc7b (patch) | |
tree | fa0be17bd054e8f24a576d7fac8ce19bc0273e43 | |
parent | 9ddb9dc6be095ebe393f7eb582df09cc4847c5e9 (diff) |
crypto: ccp - Make syslog errors human-readable
Add human-readable strings to log messages about CCP errors
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/ccp/ccp-dev-v3.c | 3 | ||||
-rw-r--r-- | drivers/crypto/ccp/ccp-dev-v5.c | 3 | ||||
-rw-r--r-- | drivers/crypto/ccp/ccp-dev.c | 53 | ||||
-rw-r--r-- | drivers/crypto/ccp/ccp-dev.h | 2 |
4 files changed, 61 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/ccp-dev-v3.c b/drivers/crypto/ccp/ccp-dev-v3.c index b6615b15a3c2..8d2dbacc6161 100644 --- a/drivers/crypto/ccp/ccp-dev-v3.c +++ b/drivers/crypto/ccp/ccp-dev-v3.c | |||
@@ -124,6 +124,9 @@ static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count) | |||
124 | /* On error delete all related jobs from the queue */ | 124 | /* On error delete all related jobs from the queue */ |
125 | cmd = (cmd_q->id << DEL_Q_ID_SHIFT) | 125 | cmd = (cmd_q->id << DEL_Q_ID_SHIFT) |
126 | | op->jobid; | 126 | | op->jobid; |
127 | if (cmd_q->cmd_error) | ||
128 | ccp_log_error(cmd_q->ccp, | ||
129 | cmd_q->cmd_error); | ||
127 | 130 | ||
128 | iowrite32(cmd, ccp->io_regs + DEL_CMD_Q_JOB); | 131 | iowrite32(cmd, ccp->io_regs + DEL_CMD_Q_JOB); |
129 | 132 | ||
diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c index a90ca9e67ade..faf3cb3ddce2 100644 --- a/drivers/crypto/ccp/ccp-dev-v5.c +++ b/drivers/crypto/ccp/ccp-dev-v5.c | |||
@@ -243,6 +243,9 @@ static int ccp5_do_cmd(struct ccp5_desc *desc, | |||
243 | ret = wait_event_interruptible(cmd_q->int_queue, | 243 | ret = wait_event_interruptible(cmd_q->int_queue, |
244 | cmd_q->int_rcvd); | 244 | cmd_q->int_rcvd); |
245 | if (ret || cmd_q->cmd_error) { | 245 | if (ret || cmd_q->cmd_error) { |
246 | if (cmd_q->cmd_error) | ||
247 | ccp_log_error(cmd_q->ccp, | ||
248 | cmd_q->cmd_error); | ||
246 | /* A version 5 device doesn't use Job IDs... */ | 249 | /* A version 5 device doesn't use Job IDs... */ |
247 | if (!ret) | 250 | if (!ret) |
248 | ret = -EIO; | 251 | ret = -EIO; |
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 5d36eeff6d26..cafa633aae10 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c | |||
@@ -40,6 +40,59 @@ struct ccp_tasklet_data { | |||
40 | struct ccp_cmd *cmd; | 40 | struct ccp_cmd *cmd; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | /* Human-readable error strings */ | ||
44 | char *ccp_error_codes[] = { | ||
45 | "", | ||
46 | "ERR 01: ILLEGAL_ENGINE", | ||
47 | "ERR 02: ILLEGAL_KEY_ID", | ||
48 | "ERR 03: ILLEGAL_FUNCTION_TYPE", | ||
49 | "ERR 04: ILLEGAL_FUNCTION_MODE", | ||
50 | "ERR 05: ILLEGAL_FUNCTION_ENCRYPT", | ||
51 | "ERR 06: ILLEGAL_FUNCTION_SIZE", | ||
52 | "ERR 07: Zlib_MISSING_INIT_EOM", | ||
53 | "ERR 08: ILLEGAL_FUNCTION_RSVD", | ||
54 | "ERR 09: ILLEGAL_BUFFER_LENGTH", | ||
55 | "ERR 10: VLSB_FAULT", | ||
56 | "ERR 11: ILLEGAL_MEM_ADDR", | ||
57 | "ERR 12: ILLEGAL_MEM_SEL", | ||
58 | "ERR 13: ILLEGAL_CONTEXT_ID", | ||
59 | "ERR 14: ILLEGAL_KEY_ADDR", | ||
60 | "ERR 15: 0xF Reserved", | ||
61 | "ERR 16: Zlib_ILLEGAL_MULTI_QUEUE", | ||
62 | "ERR 17: Zlib_ILLEGAL_JOBID_CHANGE", | ||
63 | "ERR 18: CMD_TIMEOUT", | ||
64 | "ERR 19: IDMA0_AXI_SLVERR", | ||
65 | "ERR 20: IDMA0_AXI_DECERR", | ||
66 | "ERR 21: 0x15 Reserved", | ||
67 | "ERR 22: IDMA1_AXI_SLAVE_FAULT", | ||
68 | "ERR 23: IDMA1_AIXI_DECERR", | ||
69 | "ERR 24: 0x18 Reserved", | ||
70 | "ERR 25: ZLIBVHB_AXI_SLVERR", | ||
71 | "ERR 26: ZLIBVHB_AXI_DECERR", | ||
72 | "ERR 27: 0x1B Reserved", | ||
73 | "ERR 27: ZLIB_UNEXPECTED_EOM", | ||
74 | "ERR 27: ZLIB_EXTRA_DATA", | ||
75 | "ERR 30: ZLIB_BTYPE", | ||
76 | "ERR 31: ZLIB_UNDEFINED_SYMBOL", | ||
77 | "ERR 32: ZLIB_UNDEFINED_DISTANCE_S", | ||
78 | "ERR 33: ZLIB_CODE_LENGTH_SYMBOL", | ||
79 | "ERR 34: ZLIB _VHB_ILLEGAL_FETCH", | ||
80 | "ERR 35: ZLIB_UNCOMPRESSED_LEN", | ||
81 | "ERR 36: ZLIB_LIMIT_REACHED", | ||
82 | "ERR 37: ZLIB_CHECKSUM_MISMATCH0", | ||
83 | "ERR 38: ODMA0_AXI_SLVERR", | ||
84 | "ERR 39: ODMA0_AXI_DECERR", | ||
85 | "ERR 40: 0x28 Reserved", | ||
86 | "ERR 41: ODMA1_AXI_SLVERR", | ||
87 | "ERR 42: ODMA1_AXI_DECERR", | ||
88 | "ERR 43: LSB_PARITY_ERR", | ||
89 | }; | ||
90 | |||
91 | void ccp_log_error(struct ccp_device *d, int e) | ||
92 | { | ||
93 | dev_err(d->dev, "CCP error: %s (0x%x)\n", ccp_error_codes[e], e); | ||
94 | } | ||
95 | |||
43 | /* List of CCPs, CCP count, read-write access lock, and access functions | 96 | /* List of CCPs, CCP count, read-write access lock, and access functions |
44 | * | 97 | * |
45 | * Lock structure: get ccp_unit_lock for reading whenever we need to | 98 | * Lock structure: get ccp_unit_lock for reading whenever we need to |
diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index 08f58b0d4271..da5f4a678083 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h | |||
@@ -601,6 +601,8 @@ void ccp_platform_exit(void); | |||
601 | void ccp_add_device(struct ccp_device *ccp); | 601 | void ccp_add_device(struct ccp_device *ccp); |
602 | void ccp_del_device(struct ccp_device *ccp); | 602 | void ccp_del_device(struct ccp_device *ccp); |
603 | 603 | ||
604 | extern void ccp_log_error(struct ccp_device *, int); | ||
605 | |||
604 | struct ccp_device *ccp_alloc_struct(struct device *dev); | 606 | struct ccp_device *ccp_alloc_struct(struct device *dev); |
605 | bool ccp_queues_suspended(struct ccp_device *ccp); | 607 | bool ccp_queues_suspended(struct ccp_device *ccp); |
606 | int ccp_cmd_queue_thread(void *data); | 608 | int ccp_cmd_queue_thread(void *data); |