hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/crypto/caam/sg_sw_sec4.h
....@@ -35,11 +35,9 @@
3535 sec4_sg_ptr->bpid_offset = cpu_to_caam32(offset &
3636 SEC4_SG_OFFSET_MASK);
3737 }
38
-#ifdef DEBUG
39
- print_hex_dump(KERN_ERR, "sec4_sg_ptr@: ",
40
- DUMP_PREFIX_ADDRESS, 16, 4, sec4_sg_ptr,
41
- sizeof(struct sec4_sg_entry), 1);
42
-#endif
38
+
39
+ print_hex_dump_debug("sec4_sg_ptr@: ", DUMP_PREFIX_ADDRESS, 16, 4,
40
+ sec4_sg_ptr, sizeof(struct sec4_sg_entry), 1);
4341 }
4442
4543 /*
....@@ -47,15 +45,19 @@
4745 * but does not have final bit; instead, returns last entry
4846 */
4947 static inline struct sec4_sg_entry *
50
-sg_to_sec4_sg(struct scatterlist *sg, int sg_count,
48
+sg_to_sec4_sg(struct scatterlist *sg, int len,
5149 struct sec4_sg_entry *sec4_sg_ptr, u16 offset)
5250 {
53
- while (sg_count) {
54
- dma_to_sec4_sg_one(sec4_sg_ptr, sg_dma_address(sg),
55
- sg_dma_len(sg), offset);
51
+ int ent_len;
52
+
53
+ while (len) {
54
+ ent_len = min_t(int, sg_dma_len(sg), len);
55
+
56
+ dma_to_sec4_sg_one(sec4_sg_ptr, sg_dma_address(sg), ent_len,
57
+ offset);
5658 sec4_sg_ptr++;
5759 sg = sg_next(sg);
58
- sg_count--;
60
+ len -= ent_len;
5961 }
6062 return sec4_sg_ptr - 1;
6163 }
....@@ -72,11 +74,11 @@
7274 * convert scatterlist to h/w link table format
7375 * scatterlist must have been previously dma mapped
7476 */
75
-static inline void sg_to_sec4_sg_last(struct scatterlist *sg, int sg_count,
77
+static inline void sg_to_sec4_sg_last(struct scatterlist *sg, int len,
7678 struct sec4_sg_entry *sec4_sg_ptr,
7779 u16 offset)
7880 {
79
- sec4_sg_ptr = sg_to_sec4_sg(sg, sg_count, sec4_sg_ptr, offset);
81
+ sec4_sg_ptr = sg_to_sec4_sg(sg, len, sec4_sg_ptr, offset);
8082 sg_to_sec4_set_last(sec4_sg_ptr);
8183 }
8284