crypto: ccp - Make syslog errors human-readable
[cascardo/linux.git] / drivers / crypto / ccp / ccp-dev.c
index 5d36eef..cafa633 100644 (file)
@@ -40,6 +40,59 @@ struct ccp_tasklet_data {
        struct ccp_cmd *cmd;
 };
 
+/* Human-readable error strings */
+char *ccp_error_codes[] = {
+       "",
+       "ERR 01: ILLEGAL_ENGINE",
+       "ERR 02: ILLEGAL_KEY_ID",
+       "ERR 03: ILLEGAL_FUNCTION_TYPE",
+       "ERR 04: ILLEGAL_FUNCTION_MODE",
+       "ERR 05: ILLEGAL_FUNCTION_ENCRYPT",
+       "ERR 06: ILLEGAL_FUNCTION_SIZE",
+       "ERR 07: Zlib_MISSING_INIT_EOM",
+       "ERR 08: ILLEGAL_FUNCTION_RSVD",
+       "ERR 09: ILLEGAL_BUFFER_LENGTH",
+       "ERR 10: VLSB_FAULT",
+       "ERR 11: ILLEGAL_MEM_ADDR",
+       "ERR 12: ILLEGAL_MEM_SEL",
+       "ERR 13: ILLEGAL_CONTEXT_ID",
+       "ERR 14: ILLEGAL_KEY_ADDR",
+       "ERR 15: 0xF Reserved",
+       "ERR 16: Zlib_ILLEGAL_MULTI_QUEUE",
+       "ERR 17: Zlib_ILLEGAL_JOBID_CHANGE",
+       "ERR 18: CMD_TIMEOUT",
+       "ERR 19: IDMA0_AXI_SLVERR",
+       "ERR 20: IDMA0_AXI_DECERR",
+       "ERR 21: 0x15 Reserved",
+       "ERR 22: IDMA1_AXI_SLAVE_FAULT",
+       "ERR 23: IDMA1_AIXI_DECERR",
+       "ERR 24: 0x18 Reserved",
+       "ERR 25: ZLIBVHB_AXI_SLVERR",
+       "ERR 26: ZLIBVHB_AXI_DECERR",
+       "ERR 27: 0x1B Reserved",
+       "ERR 27: ZLIB_UNEXPECTED_EOM",
+       "ERR 27: ZLIB_EXTRA_DATA",
+       "ERR 30: ZLIB_BTYPE",
+       "ERR 31: ZLIB_UNDEFINED_SYMBOL",
+       "ERR 32: ZLIB_UNDEFINED_DISTANCE_S",
+       "ERR 33: ZLIB_CODE_LENGTH_SYMBOL",
+       "ERR 34: ZLIB _VHB_ILLEGAL_FETCH",
+       "ERR 35: ZLIB_UNCOMPRESSED_LEN",
+       "ERR 36: ZLIB_LIMIT_REACHED",
+       "ERR 37: ZLIB_CHECKSUM_MISMATCH0",
+       "ERR 38: ODMA0_AXI_SLVERR",
+       "ERR 39: ODMA0_AXI_DECERR",
+       "ERR 40: 0x28 Reserved",
+       "ERR 41: ODMA1_AXI_SLVERR",
+       "ERR 42: ODMA1_AXI_DECERR",
+       "ERR 43: LSB_PARITY_ERR",
+};
+
+void ccp_log_error(struct ccp_device *d, int e)
+{
+       dev_err(d->dev, "CCP error: %s (0x%x)\n", ccp_error_codes[e], e);
+}
+
 /* List of CCPs, CCP count, read-write access lock, and access functions
  *
  * Lock structure: get ccp_unit_lock for reading whenever we need to