Skip to content

Commit 81422ba

Browse files
garyrhookherbertx
authored andcommitted
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>
1 parent 9ddb9dc commit 81422ba

4 files changed

Lines changed: 61 additions & 0 deletions

File tree

‎drivers/crypto/ccp/ccp-dev-v3.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count)
124124
/* On error delete all related jobs from the queue */
125125
cmd = (cmd_q->id << DEL_Q_ID_SHIFT)
126126
| op->jobid;
127+
if (cmd_q->cmd_error)
128+
ccp_log_error(cmd_q->ccp,
129+
cmd_q->cmd_error);
127130

128131
iowrite32(cmd, ccp->io_regs + DEL_CMD_Q_JOB);
129132

‎drivers/crypto/ccp/ccp-dev-v5.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ static int ccp5_do_cmd(struct ccp5_desc *desc,
243243
ret = wait_event_interruptible(cmd_q->int_queue,
244244
cmd_q->int_rcvd);
245245
if (ret || cmd_q->cmd_error) {
246+
if (cmd_q->cmd_error)
247+
ccp_log_error(cmd_q->ccp,
248+
cmd_q->cmd_error);
246249
/* A version 5 device doesn't use Job IDs... */
247250
if (!ret)
248251
ret = -EIO;

‎drivers/crypto/ccp/ccp-dev.c‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,59 @@ struct ccp_tasklet_data {
4040
struct ccp_cmd *cmd;
4141
};
4242

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+
4396
/* List of CCPs, CCP count, read-write access lock, and access functions
4497
*
4598
* Lock structure: get ccp_unit_lock for reading whenever we need to

‎drivers/crypto/ccp/ccp-dev.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,8 @@ void ccp_platform_exit(void);
601601
void ccp_add_device(struct ccp_device *ccp);
602602
void ccp_del_device(struct ccp_device *ccp);
603603

604+
extern void ccp_log_error(struct ccp_device *, int);
605+
604606
struct ccp_device *ccp_alloc_struct(struct device *dev);
605607
bool ccp_queues_suspended(struct ccp_device *ccp);
606608
int ccp_cmd_queue_thread(void *data);

0 commit comments

Comments
 (0)