Commit 6e005503 authored by Sascha Hauer's avatar Sascha Hauer Committed by Herbert Xu

crypto: caam - print debug messages at debug level

The CAAM driver used to put its debug messages inside #ifdef DEBUG and
then prints the messages at KERN_ERR level. Replace this with proper
functions printing at KERN_DEBUG level. The #ifdef DEBUG gets
unnecessary when the right functions are used.

This replaces:

- print_hex_dump(KERN_ERR ...) inside #ifdef DEBUG with
  print_hex_dump_debug(...)
- dev_err() inside #ifdef DEBUG with dev_dbg()
- printk(KERN_ERR ...) inside #ifdef DEBUG with dev_dbg()

Some parts of the driver use these functions already, so it is only
consequent to use the debug function consistently.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 32f75e67
This diff is collapsed.
...@@ -115,11 +115,9 @@ void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata, ...@@ -115,11 +115,9 @@ void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata,
append_seq_store(desc, icvsize, LDST_CLASS_2_CCB | append_seq_store(desc, icvsize, LDST_CLASS_2_CCB |
LDST_SRCDST_BYTE_CONTEXT); LDST_SRCDST_BYTE_CONTEXT);
#ifdef DEBUG print_hex_dump_debug("aead null enc shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"aead null enc shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_aead_null_encap); EXPORT_SYMBOL(cnstr_shdsc_aead_null_encap);
...@@ -204,11 +202,9 @@ void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata, ...@@ -204,11 +202,9 @@ void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata,
append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS2 | append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS2 |
FIFOLD_TYPE_LAST2 | FIFOLD_TYPE_ICV); FIFOLD_TYPE_LAST2 | FIFOLD_TYPE_ICV);
#ifdef DEBUG print_hex_dump_debug("aead null dec shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"aead null dec shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_aead_null_decap); EXPORT_SYMBOL(cnstr_shdsc_aead_null_decap);
...@@ -358,10 +354,9 @@ void cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata, ...@@ -358,10 +354,9 @@ void cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata,
append_seq_store(desc, icvsize, LDST_CLASS_2_CCB | append_seq_store(desc, icvsize, LDST_CLASS_2_CCB |
LDST_SRCDST_BYTE_CONTEXT); LDST_SRCDST_BYTE_CONTEXT);
#ifdef DEBUG print_hex_dump_debug("aead enc shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "aead enc shdesc@" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_aead_encap); EXPORT_SYMBOL(cnstr_shdsc_aead_encap);
...@@ -475,10 +470,9 @@ void cnstr_shdsc_aead_decap(u32 * const desc, struct alginfo *cdata, ...@@ -475,10 +470,9 @@ void cnstr_shdsc_aead_decap(u32 * const desc, struct alginfo *cdata,
append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS2 | append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS2 |
FIFOLD_TYPE_LAST2 | FIFOLD_TYPE_ICV); FIFOLD_TYPE_LAST2 | FIFOLD_TYPE_ICV);
#ifdef DEBUG print_hex_dump_debug("aead dec shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "aead dec shdesc@" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_aead_decap); EXPORT_SYMBOL(cnstr_shdsc_aead_decap);
...@@ -613,11 +607,9 @@ void cnstr_shdsc_aead_givencap(u32 * const desc, struct alginfo *cdata, ...@@ -613,11 +607,9 @@ void cnstr_shdsc_aead_givencap(u32 * const desc, struct alginfo *cdata,
append_seq_store(desc, icvsize, LDST_CLASS_2_CCB | append_seq_store(desc, icvsize, LDST_CLASS_2_CCB |
LDST_SRCDST_BYTE_CONTEXT); LDST_SRCDST_BYTE_CONTEXT);
#ifdef DEBUG print_hex_dump_debug("aead givenc shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"aead givenc shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_aead_givencap); EXPORT_SYMBOL(cnstr_shdsc_aead_givencap);
...@@ -742,10 +734,9 @@ void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata, ...@@ -742,10 +734,9 @@ void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata,
append_seq_store(desc, icvsize, LDST_CLASS_1_CCB | append_seq_store(desc, icvsize, LDST_CLASS_1_CCB |
LDST_SRCDST_BYTE_CONTEXT); LDST_SRCDST_BYTE_CONTEXT);
#ifdef DEBUG print_hex_dump_debug("gcm enc shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "gcm enc shdesc@" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_gcm_encap); EXPORT_SYMBOL(cnstr_shdsc_gcm_encap);
...@@ -838,10 +829,9 @@ void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata, ...@@ -838,10 +829,9 @@ void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata,
append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 | append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 |
FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1); FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1);
#ifdef DEBUG print_hex_dump_debug("gcm dec shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "gcm dec shdesc@" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_gcm_decap); EXPORT_SYMBOL(cnstr_shdsc_gcm_decap);
...@@ -933,11 +923,9 @@ void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata, ...@@ -933,11 +923,9 @@ void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata,
append_seq_store(desc, icvsize, LDST_CLASS_1_CCB | append_seq_store(desc, icvsize, LDST_CLASS_1_CCB |
LDST_SRCDST_BYTE_CONTEXT); LDST_SRCDST_BYTE_CONTEXT);
#ifdef DEBUG print_hex_dump_debug("rfc4106 enc shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"rfc4106 enc shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_rfc4106_encap); EXPORT_SYMBOL(cnstr_shdsc_rfc4106_encap);
...@@ -1030,11 +1018,9 @@ void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata, ...@@ -1030,11 +1018,9 @@ void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata,
append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 | append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 |
FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1); FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1);
#ifdef DEBUG print_hex_dump_debug("rfc4106 dec shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"rfc4106 dec shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_rfc4106_decap); EXPORT_SYMBOL(cnstr_shdsc_rfc4106_decap);
...@@ -1115,11 +1101,9 @@ void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata, ...@@ -1115,11 +1101,9 @@ void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata,
append_seq_store(desc, icvsize, LDST_CLASS_1_CCB | append_seq_store(desc, icvsize, LDST_CLASS_1_CCB |
LDST_SRCDST_BYTE_CONTEXT); LDST_SRCDST_BYTE_CONTEXT);
#ifdef DEBUG print_hex_dump_debug("rfc4543 enc shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"rfc4543 enc shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_rfc4543_encap); EXPORT_SYMBOL(cnstr_shdsc_rfc4543_encap);
...@@ -1205,11 +1189,9 @@ void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata, ...@@ -1205,11 +1189,9 @@ void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata,
append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 | append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 |
FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1); FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1);
#ifdef DEBUG print_hex_dump_debug("rfc4543 dec shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"rfc4543 dec shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_rfc4543_decap); EXPORT_SYMBOL(cnstr_shdsc_rfc4543_decap);
...@@ -1416,11 +1398,9 @@ void cnstr_shdsc_skcipher_encap(u32 * const desc, struct alginfo *cdata, ...@@ -1416,11 +1398,9 @@ void cnstr_shdsc_skcipher_encap(u32 * const desc, struct alginfo *cdata,
/* Perform operation */ /* Perform operation */
skcipher_append_src_dst(desc); skcipher_append_src_dst(desc);
#ifdef DEBUG print_hex_dump_debug("skcipher enc shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"skcipher enc shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_skcipher_encap); EXPORT_SYMBOL(cnstr_shdsc_skcipher_encap);
...@@ -1487,11 +1467,9 @@ void cnstr_shdsc_skcipher_decap(u32 * const desc, struct alginfo *cdata, ...@@ -1487,11 +1467,9 @@ void cnstr_shdsc_skcipher_decap(u32 * const desc, struct alginfo *cdata,
/* Perform operation */ /* Perform operation */
skcipher_append_src_dst(desc); skcipher_append_src_dst(desc);
#ifdef DEBUG print_hex_dump_debug("skcipher dec shdesc@" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
"skcipher dec shdesc@" __stringify(__LINE__)": ", 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_skcipher_decap); EXPORT_SYMBOL(cnstr_shdsc_skcipher_decap);
...@@ -1538,11 +1516,9 @@ void cnstr_shdsc_xts_skcipher_encap(u32 * const desc, struct alginfo *cdata) ...@@ -1538,11 +1516,9 @@ void cnstr_shdsc_xts_skcipher_encap(u32 * const desc, struct alginfo *cdata)
/* Perform operation */ /* Perform operation */
skcipher_append_src_dst(desc); skcipher_append_src_dst(desc);
#ifdef DEBUG print_hex_dump_debug("xts skcipher enc shdesc@" __stringify(__LINE__)
print_hex_dump(KERN_ERR, ": ", DUMP_PREFIX_ADDRESS, 16, 4,
"xts skcipher enc shdesc@" __stringify(__LINE__) ": ", desc, desc_bytes(desc), 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_xts_skcipher_encap); EXPORT_SYMBOL(cnstr_shdsc_xts_skcipher_encap);
...@@ -1588,11 +1564,9 @@ void cnstr_shdsc_xts_skcipher_decap(u32 * const desc, struct alginfo *cdata) ...@@ -1588,11 +1564,9 @@ void cnstr_shdsc_xts_skcipher_decap(u32 * const desc, struct alginfo *cdata)
/* Perform operation */ /* Perform operation */
skcipher_append_src_dst(desc); skcipher_append_src_dst(desc);
#ifdef DEBUG print_hex_dump_debug("xts skcipher dec shdesc@" __stringify(__LINE__)
print_hex_dump(KERN_ERR, ": ", DUMP_PREFIX_ADDRESS, 16, 4, desc,
"xts skcipher dec shdesc@" __stringify(__LINE__) ": ", desc_bytes(desc), 1);
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
#endif
} }
EXPORT_SYMBOL(cnstr_shdsc_xts_skcipher_decap); EXPORT_SYMBOL(cnstr_shdsc_xts_skcipher_decap);
......
...@@ -214,13 +214,11 @@ static int aead_setkey(struct crypto_aead *aead, const u8 *key, ...@@ -214,13 +214,11 @@ static int aead_setkey(struct crypto_aead *aead, const u8 *key,
if (crypto_authenc_extractkeys(&keys, key, keylen) != 0) if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
goto badkey; goto badkey;
#ifdef DEBUG dev_dbg(jrdev, "keylen %d enckeylen %d authkeylen %d\n",
dev_err(jrdev, "keylen %d enckeylen %d authkeylen %d\n",
keys.authkeylen + keys.enckeylen, keys.enckeylen, keys.authkeylen + keys.enckeylen, keys.enckeylen,
keys.authkeylen); keys.authkeylen);
print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ", print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1); DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
#endif
/* /*
* If DKP is supported, use it in the shared descriptor to generate * If DKP is supported, use it in the shared descriptor to generate
...@@ -387,10 +385,8 @@ static int gcm_setkey(struct crypto_aead *aead, ...@@ -387,10 +385,8 @@ static int gcm_setkey(struct crypto_aead *aead,
struct device *jrdev = ctx->jrdev; struct device *jrdev = ctx->jrdev;
int ret; int ret;
#ifdef DEBUG print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
#endif
memcpy(ctx->key, key, keylen); memcpy(ctx->key, key, keylen);
dma_sync_single_for_device(jrdev->parent, ctx->key_dma, keylen, dma_sync_single_for_device(jrdev->parent, ctx->key_dma, keylen,
...@@ -487,10 +483,8 @@ static int rfc4106_setkey(struct crypto_aead *aead, ...@@ -487,10 +483,8 @@ static int rfc4106_setkey(struct crypto_aead *aead,
if (keylen < 4) if (keylen < 4)
return -EINVAL; return -EINVAL;
#ifdef DEBUG print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
#endif
memcpy(ctx->key, key, keylen); memcpy(ctx->key, key, keylen);
/* /*
...@@ -591,10 +585,8 @@ static int rfc4543_setkey(struct crypto_aead *aead, ...@@ -591,10 +585,8 @@ static int rfc4543_setkey(struct crypto_aead *aead,
if (keylen < 4) if (keylen < 4)
return -EINVAL; return -EINVAL;
#ifdef DEBUG print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
#endif
memcpy(ctx->key, key, keylen); memcpy(ctx->key, key, keylen);
/* /*
...@@ -646,10 +638,9 @@ static int skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key, ...@@ -646,10 +638,9 @@ static int skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
const bool is_rfc3686 = alg->caam.rfc3686; const bool is_rfc3686 = alg->caam.rfc3686;
int ret = 0; int ret = 0;
#ifdef DEBUG print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
#endif
/* /*
* AES-CTR needs to load IV in CONTEXT1 reg * AES-CTR needs to load IV in CONTEXT1 reg
* at an offset of 128bits (16bytes) * at an offset of 128bits (16bytes)
...@@ -1199,23 +1190,19 @@ static void skcipher_done(struct caam_drv_req *drv_req, u32 status) ...@@ -1199,23 +1190,19 @@ static void skcipher_done(struct caam_drv_req *drv_req, u32 status)
struct device *qidev = caam_ctx->qidev; struct device *qidev = caam_ctx->qidev;
int ivsize = crypto_skcipher_ivsize(skcipher); int ivsize = crypto_skcipher_ivsize(skcipher);
#ifdef DEBUG dev_dbg(qidev, "%s %d: status 0x%x\n", __func__, __LINE__, status);
dev_err(qidev, "%s %d: status 0x%x\n", __func__, __LINE__, status);
#endif
edesc = container_of(drv_req, typeof(*edesc), drv_req); edesc = container_of(drv_req, typeof(*edesc), drv_req);
if (status) if (status)
caam_jr_strstatus(qidev, status); caam_jr_strstatus(qidev, status);
#ifdef DEBUG print_hex_dump_debug("dstiv @" __stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "dstiv @" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, req->iv,
DUMP_PREFIX_ADDRESS, 16, 4, req->iv, edesc->src_nents > 1 ? 100 : ivsize, 1);
edesc->src_nents > 1 ? 100 : ivsize, 1);
caam_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ", caam_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ",
DUMP_PREFIX_ADDRESS, 16, 4, req->dst, DUMP_PREFIX_ADDRESS, 16, 4, req->dst,
edesc->dst_nents > 1 ? 100 : req->cryptlen, 1); edesc->dst_nents > 1 ? 100 : req->cryptlen, 1);
#endif
skcipher_unmap(qidev, edesc, req); skcipher_unmap(qidev, edesc, req);
......
This diff is collapsed.
...@@ -113,10 +113,8 @@ static void rng_done(struct device *jrdev, u32 *desc, u32 err, void *context) ...@@ -113,10 +113,8 @@ static void rng_done(struct device *jrdev, u32 *desc, u32 err, void *context)
/* Buffer refilled, invalidate cache */ /* Buffer refilled, invalidate cache */
dma_sync_single_for_cpu(jrdev, bd->addr, RN_BUF_SIZE, DMA_FROM_DEVICE); dma_sync_single_for_cpu(jrdev, bd->addr, RN_BUF_SIZE, DMA_FROM_DEVICE);
#ifdef DEBUG print_hex_dump_debug("rng refreshed buf@: ", DUMP_PREFIX_ADDRESS, 16, 4,
print_hex_dump(KERN_ERR, "rng refreshed buf@: ", bd->buf, RN_BUF_SIZE, 1);
DUMP_PREFIX_ADDRESS, 16, 4, bd->buf, RN_BUF_SIZE, 1);
#endif
} }
static inline int submit_job(struct caam_rng_ctx *ctx, int to_current) static inline int submit_job(struct caam_rng_ctx *ctx, int to_current)
...@@ -209,10 +207,10 @@ static inline int rng_create_sh_desc(struct caam_rng_ctx *ctx) ...@@ -209,10 +207,10 @@ static inline int rng_create_sh_desc(struct caam_rng_ctx *ctx)
dev_err(jrdev, "unable to map shared descriptor\n"); dev_err(jrdev, "unable to map shared descriptor\n");
return -ENOMEM; return -ENOMEM;
} }
#ifdef DEBUG
print_hex_dump(KERN_ERR, "rng shdesc@: ", DUMP_PREFIX_ADDRESS, 16, 4, print_hex_dump_debug("rng shdesc@: ", DUMP_PREFIX_ADDRESS, 16, 4,
desc, desc_bytes(desc), 1); desc, desc_bytes(desc), 1);
#endif
return 0; return 0;
} }
...@@ -233,10 +231,10 @@ static inline int rng_create_job_desc(struct caam_rng_ctx *ctx, int buf_id) ...@@ -233,10 +231,10 @@ static inline int rng_create_job_desc(struct caam_rng_ctx *ctx, int buf_id)
} }
append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0); append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0);
#ifdef DEBUG
print_hex_dump(KERN_ERR, "rng job desc@: ", DUMP_PREFIX_ADDRESS, 16, 4, print_hex_dump_debug("rng job desc@: ", DUMP_PREFIX_ADDRESS, 16, 4,
desc, desc_bytes(desc), 1); desc, desc_bytes(desc), 1);
#endif
return 0; return 0;
} }
......
...@@ -16,9 +16,7 @@ void split_key_done(struct device *dev, u32 *desc, u32 err, ...@@ -16,9 +16,7 @@ void split_key_done(struct device *dev, u32 *desc, u32 err,
{ {
struct split_key_result *res = context; struct split_key_result *res = context;
#ifdef DEBUG dev_dbg(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
dev_err(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
#endif
if (err) if (err)
caam_jr_strstatus(dev, err); caam_jr_strstatus(dev, err);
...@@ -55,12 +53,10 @@ int gen_split_key(struct device *jrdev, u8 *key_out, ...@@ -55,12 +53,10 @@ int gen_split_key(struct device *jrdev, u8 *key_out,
adata->keylen_pad = split_key_pad_len(adata->algtype & adata->keylen_pad = split_key_pad_len(adata->algtype &
OP_ALG_ALGSEL_MASK); OP_ALG_ALGSEL_MASK);
#ifdef DEBUG dev_dbg(jrdev, "split keylen %d split keylen padded %d\n",
dev_err(jrdev, "split keylen %d split keylen padded %d\n",
adata->keylen, adata->keylen_pad); adata->keylen, adata->keylen_pad);
print_hex_dump(KERN_ERR, "ctx.key@" __stringify(__LINE__)": ", print_hex_dump_debug("ctx.key@" __stringify(__LINE__)": ",
DUMP_PREFIX_ADDRESS, 16, 4, key_in, keylen, 1); DUMP_PREFIX_ADDRESS, 16, 4, key_in, keylen, 1);
#endif
if (adata->keylen_pad > max_keylen) if (adata->keylen_pad > max_keylen)
return -EINVAL; return -EINVAL;
...@@ -102,10 +98,9 @@ int gen_split_key(struct device *jrdev, u8 *key_out, ...@@ -102,10 +98,9 @@ int gen_split_key(struct device *jrdev, u8 *key_out,
append_fifo_store(desc, dma_addr, adata->keylen, append_fifo_store(desc, dma_addr, adata->keylen,
LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK);
#ifdef DEBUG print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1);
#endif
result.err = 0; result.err = 0;
init_completion(&result.completion); init_completion(&result.completion);
...@@ -115,11 +110,10 @@ int gen_split_key(struct device *jrdev, u8 *key_out, ...@@ -115,11 +110,10 @@ int gen_split_key(struct device *jrdev, u8 *key_out,
/* in progress */ /* in progress */
wait_for_completion(&result.completion); wait_for_completion(&result.completion);
ret = result.err; ret = result.err;
#ifdef DEBUG
print_hex_dump(KERN_ERR, "ctx.key@"__stringify(__LINE__)": ", print_hex_dump_debug("ctx.key@"__stringify(__LINE__)": ",
DUMP_PREFIX_ADDRESS, 16, 4, key_out, DUMP_PREFIX_ADDRESS, 16, 4, key_out,
adata->keylen_pad, 1); adata->keylen_pad, 1);
#endif
} }
dma_unmap_single(jrdev, dma_addr, adata->keylen_pad, DMA_BIDIRECTIONAL); dma_unmap_single(jrdev, dma_addr, adata->keylen_pad, DMA_BIDIRECTIONAL);
......
...@@ -35,11 +35,9 @@ static inline void dma_to_sec4_sg_one(struct sec4_sg_entry *sec4_sg_ptr, ...@@ -35,11 +35,9 @@ static inline void dma_to_sec4_sg_one(struct sec4_sg_entry *sec4_sg_ptr,
sec4_sg_ptr->bpid_offset = cpu_to_caam32(offset & sec4_sg_ptr->bpid_offset = cpu_to_caam32(offset &
SEC4_SG_OFFSET_MASK); SEC4_SG_OFFSET_MASK);
} }
#ifdef DEBUG
print_hex_dump(KERN_ERR, "sec4_sg_ptr@: ", print_hex_dump_debug("sec4_sg_ptr@: ", DUMP_PREFIX_ADDRESS, 16, 4,
DUMP_PREFIX_ADDRESS, 16, 4, sec4_sg_ptr, sec4_sg_ptr, sizeof(struct sec4_sg_entry), 1);
sizeof(struct sec4_sg_entry), 1);
#endif
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment