|
81 | 81 | #define debug(format, arg...)
|
82 | 82 | #endif
|
83 | 83 |
|
84 |
| -#ifdef DEBUG |
85 |
| -#include <linux/highmem.h> |
86 |
| - |
87 |
| -static void dbg_dump_sg(const char *level, const char *prefix_str, |
88 |
| - int prefix_type, int rowsize, int groupsize, |
89 |
| - struct scatterlist *sg, size_t tlen, bool ascii) |
90 |
| -{ |
91 |
| - struct scatterlist *it; |
92 |
| - void *it_page; |
93 |
| - size_t len; |
94 |
| - void *buf; |
95 |
| - |
96 |
| - for (it = sg; it != NULL && tlen > 0 ; it = sg_next(sg)) { |
97 |
| - /* |
98 |
| - * make sure the scatterlist's page |
99 |
| - * has a valid virtual memory mapping |
100 |
| - */ |
101 |
| - it_page = kmap_atomic(sg_page(it)); |
102 |
| - if (unlikely(!it_page)) { |
103 |
| - printk(KERN_ERR "dbg_dump_sg: kmap failed\n"); |
104 |
| - return; |
105 |
| - } |
106 |
| - |
107 |
| - buf = it_page + it->offset; |
108 |
| - len = min_t(size_t, tlen, it->length); |
109 |
| - print_hex_dump(level, prefix_str, prefix_type, rowsize, |
110 |
| - groupsize, buf, len, ascii); |
111 |
| - tlen -= len; |
112 |
| - |
113 |
| - kunmap_atomic(it_page); |
114 |
| - } |
115 |
| -} |
116 |
| -#endif |
117 |
| - |
118 | 84 | static struct list_head alg_list;
|
119 | 85 |
|
120 | 86 | struct caam_alg_entry {
|
@@ -898,10 +864,10 @@ static void ablkcipher_encrypt_done(struct device *jrdev, u32 *desc, u32 err,
|
898 | 864 | print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ",
|
899 | 865 | DUMP_PREFIX_ADDRESS, 16, 4, req->info,
|
900 | 866 | edesc->src_nents > 1 ? 100 : ivsize, 1);
|
901 |
| - dbg_dump_sg(KERN_ERR, "dst @"__stringify(__LINE__)": ", |
902 |
| - DUMP_PREFIX_ADDRESS, 16, 4, req->dst, |
903 |
| - edesc->dst_nents > 1 ? 100 : req->nbytes, 1); |
904 | 867 | #endif
|
| 868 | + caam_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ", |
| 869 | + DUMP_PREFIX_ADDRESS, 16, 4, req->dst, |
| 870 | + edesc->dst_nents > 1 ? 100 : req->nbytes, 1); |
905 | 871 |
|
906 | 872 | ablkcipher_unmap(jrdev, edesc, req);
|
907 | 873 |
|
@@ -937,10 +903,10 @@ static void ablkcipher_decrypt_done(struct device *jrdev, u32 *desc, u32 err,
|
937 | 903 | print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ",
|
938 | 904 | DUMP_PREFIX_ADDRESS, 16, 4, req->info,
|
939 | 905 | ivsize, 1);
|
940 |
| - dbg_dump_sg(KERN_ERR, "dst @"__stringify(__LINE__)": ", |
941 |
| - DUMP_PREFIX_ADDRESS, 16, 4, req->dst, |
942 |
| - edesc->dst_nents > 1 ? 100 : req->nbytes, 1); |
943 | 906 | #endif
|
| 907 | + caam_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ", |
| 908 | + DUMP_PREFIX_ADDRESS, 16, 4, req->dst, |
| 909 | + edesc->dst_nents > 1 ? 100 : req->nbytes, 1); |
944 | 910 |
|
945 | 911 | ablkcipher_unmap(jrdev, edesc, req);
|
946 | 912 |
|
@@ -1107,10 +1073,10 @@ static void init_ablkcipher_job(u32 *sh_desc, dma_addr_t ptr,
|
1107 | 1073 | ivsize, 1);
|
1108 | 1074 | pr_err("asked=%d, nbytes%d\n",
|
1109 | 1075 | (int)edesc->src_nents > 1 ? 100 : req->nbytes, req->nbytes);
|
1110 |
| - dbg_dump_sg(KERN_ERR, "src @"__stringify(__LINE__)": ", |
1111 |
| - DUMP_PREFIX_ADDRESS, 16, 4, req->src, |
1112 |
| - edesc->src_nents > 1 ? 100 : req->nbytes, 1); |
1113 | 1076 | #endif
|
| 1077 | + caam_dump_sg(KERN_ERR, "src @" __stringify(__LINE__)": ", |
| 1078 | + DUMP_PREFIX_ADDRESS, 16, 4, req->src, |
| 1079 | + edesc->src_nents > 1 ? 100 : req->nbytes, 1); |
1114 | 1080 |
|
1115 | 1081 | len = desc_len(sh_desc);
|
1116 | 1082 | init_job_desc_shared(desc, ptr, len, HDR_SHARE_DEFER | HDR_REVERSE);
|
@@ -1164,10 +1130,10 @@ static void init_ablkcipher_giv_job(u32 *sh_desc, dma_addr_t ptr,
|
1164 | 1130 | print_hex_dump(KERN_ERR, "presciv@" __stringify(__LINE__) ": ",
|
1165 | 1131 | DUMP_PREFIX_ADDRESS, 16, 4, req->info,
|
1166 | 1132 | ivsize, 1);
|
1167 |
| - dbg_dump_sg(KERN_ERR, "src @" __stringify(__LINE__) ": ", |
1168 |
| - DUMP_PREFIX_ADDRESS, 16, 4, req->src, |
1169 |
| - edesc->src_nents > 1 ? 100 : req->nbytes, 1); |
1170 | 1133 | #endif
|
| 1134 | + caam_dump_sg(KERN_ERR, "src @" __stringify(__LINE__) ": ", |
| 1135 | + DUMP_PREFIX_ADDRESS, 16, 4, req->src, |
| 1136 | + edesc->src_nents > 1 ? 100 : req->nbytes, 1); |
1171 | 1137 |
|
1172 | 1138 | len = desc_len(sh_desc);
|
1173 | 1139 | init_job_desc_shared(desc, ptr, len, HDR_SHARE_DEFER | HDR_REVERSE);
|
@@ -1449,11 +1415,9 @@ static int aead_decrypt(struct aead_request *req)
|
1449 | 1415 | u32 *desc;
|
1450 | 1416 | int ret = 0;
|
1451 | 1417 |
|
1452 |
| -#ifdef DEBUG |
1453 |
| - dbg_dump_sg(KERN_ERR, "dec src@"__stringify(__LINE__)": ", |
1454 |
| - DUMP_PREFIX_ADDRESS, 16, 4, req->src, |
1455 |
| - req->assoclen + req->cryptlen, 1); |
1456 |
| -#endif |
| 1418 | + caam_dump_sg(KERN_ERR, "dec src@" __stringify(__LINE__)": ", |
| 1419 | + DUMP_PREFIX_ADDRESS, 16, 4, req->src, |
| 1420 | + req->assoclen + req->cryptlen, 1); |
1457 | 1421 |
|
1458 | 1422 | /* allocate extended descriptor */
|
1459 | 1423 | edesc = aead_edesc_alloc(req, AUTHENC_DESC_JOB_IO_LEN,
|
|
0 commit comments