| .. | .. |
|---|
| 35 | 35 | sec4_sg_ptr->bpid_offset = cpu_to_caam32(offset & |
|---|
| 36 | 36 | SEC4_SG_OFFSET_MASK); |
|---|
| 37 | 37 | } |
|---|
| 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); |
|---|
| 43 | 41 | } |
|---|
| 44 | 42 | |
|---|
| 45 | 43 | /* |
|---|
| .. | .. |
|---|
| 47 | 45 | * but does not have final bit; instead, returns last entry |
|---|
| 48 | 46 | */ |
|---|
| 49 | 47 | 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, |
|---|
| 51 | 49 | struct sec4_sg_entry *sec4_sg_ptr, u16 offset) |
|---|
| 52 | 50 | { |
|---|
| 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); |
|---|
| 56 | 58 | sec4_sg_ptr++; |
|---|
| 57 | 59 | sg = sg_next(sg); |
|---|
| 58 | | - sg_count--; |
|---|
| 60 | + len -= ent_len; |
|---|
| 59 | 61 | } |
|---|
| 60 | 62 | return sec4_sg_ptr - 1; |
|---|
| 61 | 63 | } |
|---|
| .. | .. |
|---|
| 72 | 74 | * convert scatterlist to h/w link table format |
|---|
| 73 | 75 | * scatterlist must have been previously dma mapped |
|---|
| 74 | 76 | */ |
|---|
| 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, |
|---|
| 76 | 78 | struct sec4_sg_entry *sec4_sg_ptr, |
|---|
| 77 | 79 | u16 offset) |
|---|
| 78 | 80 | { |
|---|
| 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); |
|---|
| 80 | 82 | sg_to_sec4_set_last(sec4_sg_ptr); |
|---|
| 81 | 83 | } |
|---|
| 82 | 84 | |
|---|