Merge tag 'backlight-next-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / crypto / caam / desc_constr.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * caam descriptor construction helper functions
4  *
5  * Copyright 2008-2012 Freescale Semiconductor, Inc.
6  */
7
8 #ifndef DESC_CONSTR_H
9 #define DESC_CONSTR_H
10
11 #include "desc.h"
12 #include "regs.h"
13
14 #define IMMEDIATE (1 << 23)
15 #define CAAM_CMD_SZ sizeof(u32)
16 #define CAAM_PTR_SZ sizeof(dma_addr_t)
17 #define CAAM_DESC_BYTES_MAX (CAAM_CMD_SZ * MAX_CAAM_DESCSIZE)
18 #define DESC_JOB_IO_LEN (CAAM_CMD_SZ * 5 + CAAM_PTR_SZ * 3)
19
20 #ifdef DEBUG
21 #define PRINT_POS do { printk(KERN_DEBUG "%02d: %s\n", desc_len(desc),\
22                               &__func__[sizeof("append")]); } while (0)
23 #else
24 #define PRINT_POS
25 #endif
26
27 #define SET_OK_NO_PROP_ERRORS (IMMEDIATE | LDST_CLASS_DECO | \
28                                LDST_SRCDST_WORD_DECOCTRL | \
29                                (LDOFF_CHG_SHARE_OK_NO_PROP << \
30                                 LDST_OFFSET_SHIFT))
31 #define DISABLE_AUTO_INFO_FIFO (IMMEDIATE | LDST_CLASS_DECO | \
32                                 LDST_SRCDST_WORD_DECOCTRL | \
33                                 (LDOFF_DISABLE_AUTO_NFIFO << LDST_OFFSET_SHIFT))
34 #define ENABLE_AUTO_INFO_FIFO (IMMEDIATE | LDST_CLASS_DECO | \
35                                LDST_SRCDST_WORD_DECOCTRL | \
36                                (LDOFF_ENABLE_AUTO_NFIFO << LDST_OFFSET_SHIFT))
37
38 extern bool caam_little_end;
39
40 static inline int desc_len(u32 * const desc)
41 {
42         return caam32_to_cpu(*desc) & HDR_DESCLEN_MASK;
43 }
44
45 static inline int desc_bytes(void * const desc)
46 {
47         return desc_len(desc) * CAAM_CMD_SZ;
48 }
49
50 static inline u32 *desc_end(u32 * const desc)
51 {
52         return desc + desc_len(desc);
53 }
54
55 static inline void *sh_desc_pdb(u32 * const desc)
56 {
57         return desc + 1;
58 }
59
60 static inline void init_desc(u32 * const desc, u32 options)
61 {
62         *desc = cpu_to_caam32((options | HDR_ONE) + 1);
63 }
64
65 static inline void init_sh_desc(u32 * const desc, u32 options)
66 {
67         PRINT_POS;
68         init_desc(desc, CMD_SHARED_DESC_HDR | options);
69 }
70
71 static inline void init_sh_desc_pdb(u32 * const desc, u32 options,
72                                     size_t pdb_bytes)
73 {
74         u32 pdb_len = (pdb_bytes + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ;
75
76         init_sh_desc(desc, (((pdb_len + 1) << HDR_START_IDX_SHIFT) + pdb_len) |
77                      options);
78 }
79
80 static inline void init_job_desc(u32 * const desc, u32 options)
81 {
82         init_desc(desc, CMD_DESC_HDR | options);
83 }
84
85 static inline void init_job_desc_pdb(u32 * const desc, u32 options,
86                                      size_t pdb_bytes)
87 {
88         u32 pdb_len = (pdb_bytes + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ;
89
90         init_job_desc(desc, (((pdb_len + 1) << HDR_START_IDX_SHIFT)) | options);
91 }
92
93 static inline void append_ptr(u32 * const desc, dma_addr_t ptr)
94 {
95         dma_addr_t *offset = (dma_addr_t *)desc_end(desc);
96
97         *offset = cpu_to_caam_dma(ptr);
98
99         (*desc) = cpu_to_caam32(caam32_to_cpu(*desc) +
100                                 CAAM_PTR_SZ / CAAM_CMD_SZ);
101 }
102
103 static inline void init_job_desc_shared(u32 * const desc, dma_addr_t ptr,
104                                         int len, u32 options)
105 {
106         PRINT_POS;
107         init_job_desc(desc, HDR_SHARED | options |
108                       (len << HDR_START_IDX_SHIFT));
109         append_ptr(desc, ptr);
110 }
111
112 static inline void append_data(u32 * const desc, const void *data, int len)
113 {
114         u32 *offset = desc_end(desc);
115
116         if (len) /* avoid sparse warning: memcpy with byte count of 0 */
117                 memcpy(offset, data, len);
118
119         (*desc) = cpu_to_caam32(caam32_to_cpu(*desc) +
120                                 (len + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ);
121 }
122
123 static inline void append_cmd(u32 * const desc, u32 command)
124 {
125         u32 *cmd = desc_end(desc);
126
127         *cmd = cpu_to_caam32(command);
128
129         (*desc) = cpu_to_caam32(caam32_to_cpu(*desc) + 1);
130 }
131
132 #define append_u32 append_cmd
133
134 static inline void append_u64(u32 * const desc, u64 data)
135 {
136         u32 *offset = desc_end(desc);
137
138         /* Only 32-bit alignment is guaranteed in descriptor buffer */
139         if (caam_little_end) {
140                 *offset = cpu_to_caam32(lower_32_bits(data));
141                 *(++offset) = cpu_to_caam32(upper_32_bits(data));
142         } else {
143                 *offset = cpu_to_caam32(upper_32_bits(data));
144                 *(++offset) = cpu_to_caam32(lower_32_bits(data));
145         }
146
147         (*desc) = cpu_to_caam32(caam32_to_cpu(*desc) + 2);
148 }
149
150 /* Write command without affecting header, and return pointer to next word */
151 static inline u32 *write_cmd(u32 * const desc, u32 command)
152 {
153         *desc = cpu_to_caam32(command);
154
155         return desc + 1;
156 }
157
158 static inline void append_cmd_ptr(u32 * const desc, dma_addr_t ptr, int len,
159                                   u32 command)
160 {
161         append_cmd(desc, command | len);
162         append_ptr(desc, ptr);
163 }
164
165 /* Write length after pointer, rather than inside command */
166 static inline void append_cmd_ptr_extlen(u32 * const desc, dma_addr_t ptr,
167                                          unsigned int len, u32 command)
168 {
169         append_cmd(desc, command);
170         if (!(command & (SQIN_RTO | SQIN_PRE)))
171                 append_ptr(desc, ptr);
172         append_cmd(desc, len);
173 }
174
175 static inline void append_cmd_data(u32 * const desc, const void *data, int len,
176                                    u32 command)
177 {
178         append_cmd(desc, command | IMMEDIATE | len);
179         append_data(desc, data, len);
180 }
181
182 #define APPEND_CMD_RET(cmd, op) \
183 static inline u32 *append_##cmd(u32 * const desc, u32 options) \
184 { \
185         u32 *cmd = desc_end(desc); \
186         PRINT_POS; \
187         append_cmd(desc, CMD_##op | options); \
188         return cmd; \
189 }
190 APPEND_CMD_RET(jump, JUMP)
191 APPEND_CMD_RET(move, MOVE)
192 APPEND_CMD_RET(move_len, MOVE_LEN)
193
194 static inline void set_jump_tgt_here(u32 * const desc, u32 *jump_cmd)
195 {
196         *jump_cmd = cpu_to_caam32(caam32_to_cpu(*jump_cmd) |
197                                   (desc_len(desc) - (jump_cmd - desc)));
198 }
199
200 static inline void set_move_tgt_here(u32 * const desc, u32 *move_cmd)
201 {
202         u32 val = caam32_to_cpu(*move_cmd);
203
204         val &= ~MOVE_OFFSET_MASK;
205         val |= (desc_len(desc) << (MOVE_OFFSET_SHIFT + 2)) & MOVE_OFFSET_MASK;
206         *move_cmd = cpu_to_caam32(val);
207 }
208
209 #define APPEND_CMD(cmd, op) \
210 static inline void append_##cmd(u32 * const desc, u32 options) \
211 { \
212         PRINT_POS; \
213         append_cmd(desc, CMD_##op | options); \
214 }
215 APPEND_CMD(operation, OPERATION)
216
217 #define APPEND_CMD_LEN(cmd, op) \
218 static inline void append_##cmd(u32 * const desc, unsigned int len, \
219                                 u32 options) \
220 { \
221         PRINT_POS; \
222         append_cmd(desc, CMD_##op | len | options); \
223 }
224
225 APPEND_CMD_LEN(seq_load, SEQ_LOAD)
226 APPEND_CMD_LEN(seq_store, SEQ_STORE)
227 APPEND_CMD_LEN(seq_fifo_load, SEQ_FIFO_LOAD)
228 APPEND_CMD_LEN(seq_fifo_store, SEQ_FIFO_STORE)
229
230 #define APPEND_CMD_PTR(cmd, op) \
231 static inline void append_##cmd(u32 * const desc, dma_addr_t ptr, \
232                                 unsigned int len, u32 options) \
233 { \
234         PRINT_POS; \
235         append_cmd_ptr(desc, ptr, len, CMD_##op | options); \
236 }
237 APPEND_CMD_PTR(key, KEY)
238 APPEND_CMD_PTR(load, LOAD)
239 APPEND_CMD_PTR(fifo_load, FIFO_LOAD)
240 APPEND_CMD_PTR(fifo_store, FIFO_STORE)
241
242 static inline void append_store(u32 * const desc, dma_addr_t ptr,
243                                 unsigned int len, u32 options)
244 {
245         u32 cmd_src;
246
247         cmd_src = options & LDST_SRCDST_MASK;
248
249         append_cmd(desc, CMD_STORE | options | len);
250
251         /* The following options do not require pointer */
252         if (!(cmd_src == LDST_SRCDST_WORD_DESCBUF_SHARED ||
253               cmd_src == LDST_SRCDST_WORD_DESCBUF_JOB    ||
254               cmd_src == LDST_SRCDST_WORD_DESCBUF_JOB_WE ||
255               cmd_src == LDST_SRCDST_WORD_DESCBUF_SHARED_WE))
256                 append_ptr(desc, ptr);
257 }
258
259 #define APPEND_SEQ_PTR_INTLEN(cmd, op) \
260 static inline void append_seq_##cmd##_ptr_intlen(u32 * const desc, \
261                                                  dma_addr_t ptr, \
262                                                  unsigned int len, \
263                                                  u32 options) \
264 { \
265         PRINT_POS; \
266         if (options & (SQIN_RTO | SQIN_PRE)) \
267                 append_cmd(desc, CMD_SEQ_##op##_PTR | len | options); \
268         else \
269                 append_cmd_ptr(desc, ptr, len, CMD_SEQ_##op##_PTR | options); \
270 }
271 APPEND_SEQ_PTR_INTLEN(in, IN)
272 APPEND_SEQ_PTR_INTLEN(out, OUT)
273
274 #define APPEND_CMD_PTR_TO_IMM(cmd, op) \
275 static inline void append_##cmd##_as_imm(u32 * const desc, const void *data, \
276                                          unsigned int len, u32 options) \
277 { \
278         PRINT_POS; \
279         append_cmd_data(desc, data, len, CMD_##op | options); \
280 }
281 APPEND_CMD_PTR_TO_IMM(load, LOAD);
282 APPEND_CMD_PTR_TO_IMM(fifo_load, FIFO_LOAD);
283
284 #define APPEND_CMD_PTR_EXTLEN(cmd, op) \
285 static inline void append_##cmd##_extlen(u32 * const desc, dma_addr_t ptr, \
286                                          unsigned int len, u32 options) \
287 { \
288         PRINT_POS; \
289         append_cmd_ptr_extlen(desc, ptr, len, CMD_##op | SQIN_EXT | options); \
290 }
291 APPEND_CMD_PTR_EXTLEN(seq_in_ptr, SEQ_IN_PTR)
292 APPEND_CMD_PTR_EXTLEN(seq_out_ptr, SEQ_OUT_PTR)
293
294 /*
295  * Determine whether to store length internally or externally depending on
296  * the size of its type
297  */
298 #define APPEND_CMD_PTR_LEN(cmd, op, type) \
299 static inline void append_##cmd(u32 * const desc, dma_addr_t ptr, \
300                                 type len, u32 options) \
301 { \
302         PRINT_POS; \
303         if (sizeof(type) > sizeof(u16)) \
304                 append_##cmd##_extlen(desc, ptr, len, options); \
305         else \
306                 append_##cmd##_intlen(desc, ptr, len, options); \
307 }
308 APPEND_CMD_PTR_LEN(seq_in_ptr, SEQ_IN_PTR, u32)
309 APPEND_CMD_PTR_LEN(seq_out_ptr, SEQ_OUT_PTR, u32)
310
311 /*
312  * 2nd variant for commands whose specified immediate length differs
313  * from length of immediate data provided, e.g., split keys
314  */
315 #define APPEND_CMD_PTR_TO_IMM2(cmd, op) \
316 static inline void append_##cmd##_as_imm(u32 * const desc, const void *data, \
317                                          unsigned int data_len, \
318                                          unsigned int len, u32 options) \
319 { \
320         PRINT_POS; \
321         append_cmd(desc, CMD_##op | IMMEDIATE | len | options); \
322         append_data(desc, data, data_len); \
323 }
324 APPEND_CMD_PTR_TO_IMM2(key, KEY);
325
326 #define APPEND_CMD_RAW_IMM(cmd, op, type) \
327 static inline void append_##cmd##_imm_##type(u32 * const desc, type immediate, \
328                                              u32 options) \
329 { \
330         PRINT_POS; \
331         if (options & LDST_LEN_MASK) \
332                 append_cmd(desc, CMD_##op | IMMEDIATE | options); \
333         else \
334                 append_cmd(desc, CMD_##op | IMMEDIATE | options | \
335                            sizeof(type)); \
336         append_cmd(desc, immediate); \
337 }
338 APPEND_CMD_RAW_IMM(load, LOAD, u32);
339
340 /*
341  * ee - endianness
342  * size - size of immediate type in bytes
343  */
344 #define APPEND_CMD_RAW_IMM2(cmd, op, ee, size) \
345 static inline void append_##cmd##_imm_##ee##size(u32 *desc, \
346                                                    u##size immediate, \
347                                                    u32 options) \
348 { \
349         __##ee##size data = cpu_to_##ee##size(immediate); \
350         PRINT_POS; \
351         append_cmd(desc, CMD_##op | IMMEDIATE | options | sizeof(data)); \
352         append_data(desc, &data, sizeof(data)); \
353 }
354
355 APPEND_CMD_RAW_IMM2(load, LOAD, be, 32);
356
357 /*
358  * Append math command. Only the last part of destination and source need to
359  * be specified
360  */
361 #define APPEND_MATH(op, desc, dest, src_0, src_1, len) \
362 append_cmd(desc, CMD_MATH | MATH_FUN_##op | MATH_DEST_##dest | \
363         MATH_SRC0_##src_0 | MATH_SRC1_##src_1 | (u32)len);
364
365 #define append_math_add(desc, dest, src0, src1, len) \
366         APPEND_MATH(ADD, desc, dest, src0, src1, len)
367 #define append_math_sub(desc, dest, src0, src1, len) \
368         APPEND_MATH(SUB, desc, dest, src0, src1, len)
369 #define append_math_add_c(desc, dest, src0, src1, len) \
370         APPEND_MATH(ADDC, desc, dest, src0, src1, len)
371 #define append_math_sub_b(desc, dest, src0, src1, len) \
372         APPEND_MATH(SUBB, desc, dest, src0, src1, len)
373 #define append_math_and(desc, dest, src0, src1, len) \
374         APPEND_MATH(AND, desc, dest, src0, src1, len)
375 #define append_math_or(desc, dest, src0, src1, len) \
376         APPEND_MATH(OR, desc, dest, src0, src1, len)
377 #define append_math_xor(desc, dest, src0, src1, len) \
378         APPEND_MATH(XOR, desc, dest, src0, src1, len)
379 #define append_math_lshift(desc, dest, src0, src1, len) \
380         APPEND_MATH(LSHIFT, desc, dest, src0, src1, len)
381 #define append_math_rshift(desc, dest, src0, src1, len) \
382         APPEND_MATH(RSHIFT, desc, dest, src0, src1, len)
383 #define append_math_ldshift(desc, dest, src0, src1, len) \
384         APPEND_MATH(SHLD, desc, dest, src0, src1, len)
385
386 /* Exactly one source is IMM. Data is passed in as u32 value */
387 #define APPEND_MATH_IMM_u32(op, desc, dest, src_0, src_1, data) \
388 do { \
389         APPEND_MATH(op, desc, dest, src_0, src_1, CAAM_CMD_SZ); \
390         append_cmd(desc, data); \
391 } while (0)
392
393 #define append_math_add_imm_u32(desc, dest, src0, src1, data) \
394         APPEND_MATH_IMM_u32(ADD, desc, dest, src0, src1, data)
395 #define append_math_sub_imm_u32(desc, dest, src0, src1, data) \
396         APPEND_MATH_IMM_u32(SUB, desc, dest, src0, src1, data)
397 #define append_math_add_c_imm_u32(desc, dest, src0, src1, data) \
398         APPEND_MATH_IMM_u32(ADDC, desc, dest, src0, src1, data)
399 #define append_math_sub_b_imm_u32(desc, dest, src0, src1, data) \
400         APPEND_MATH_IMM_u32(SUBB, desc, dest, src0, src1, data)
401 #define append_math_and_imm_u32(desc, dest, src0, src1, data) \
402         APPEND_MATH_IMM_u32(AND, desc, dest, src0, src1, data)
403 #define append_math_or_imm_u32(desc, dest, src0, src1, data) \
404         APPEND_MATH_IMM_u32(OR, desc, dest, src0, src1, data)
405 #define append_math_xor_imm_u32(desc, dest, src0, src1, data) \
406         APPEND_MATH_IMM_u32(XOR, desc, dest, src0, src1, data)
407 #define append_math_lshift_imm_u32(desc, dest, src0, src1, data) \
408         APPEND_MATH_IMM_u32(LSHIFT, desc, dest, src0, src1, data)
409 #define append_math_rshift_imm_u32(desc, dest, src0, src1, data) \
410         APPEND_MATH_IMM_u32(RSHIFT, desc, dest, src0, src1, data)
411
412 /* Exactly one source is IMM. Data is passed in as u64 value */
413 #define APPEND_MATH_IMM_u64(op, desc, dest, src_0, src_1, data) \
414 do { \
415         u32 upper = (data >> 16) >> 16; \
416         APPEND_MATH(op, desc, dest, src_0, src_1, CAAM_CMD_SZ * 2 | \
417                     (upper ? 0 : MATH_IFB)); \
418         if (upper) \
419                 append_u64(desc, data); \
420         else \
421                 append_u32(desc, lower_32_bits(data)); \
422 } while (0)
423
424 #define append_math_add_imm_u64(desc, dest, src0, src1, data) \
425         APPEND_MATH_IMM_u64(ADD, desc, dest, src0, src1, data)
426 #define append_math_sub_imm_u64(desc, dest, src0, src1, data) \
427         APPEND_MATH_IMM_u64(SUB, desc, dest, src0, src1, data)
428 #define append_math_add_c_imm_u64(desc, dest, src0, src1, data) \
429         APPEND_MATH_IMM_u64(ADDC, desc, dest, src0, src1, data)
430 #define append_math_sub_b_imm_u64(desc, dest, src0, src1, data) \
431         APPEND_MATH_IMM_u64(SUBB, desc, dest, src0, src1, data)
432 #define append_math_and_imm_u64(desc, dest, src0, src1, data) \
433         APPEND_MATH_IMM_u64(AND, desc, dest, src0, src1, data)
434 #define append_math_or_imm_u64(desc, dest, src0, src1, data) \
435         APPEND_MATH_IMM_u64(OR, desc, dest, src0, src1, data)
436 #define append_math_xor_imm_u64(desc, dest, src0, src1, data) \
437         APPEND_MATH_IMM_u64(XOR, desc, dest, src0, src1, data)
438 #define append_math_lshift_imm_u64(desc, dest, src0, src1, data) \
439         APPEND_MATH_IMM_u64(LSHIFT, desc, dest, src0, src1, data)
440 #define append_math_rshift_imm_u64(desc, dest, src0, src1, data) \
441         APPEND_MATH_IMM_u64(RSHIFT, desc, dest, src0, src1, data)
442
443 /**
444  * struct alginfo - Container for algorithm details
445  * @algtype: algorithm selector; for valid values, see documentation of the
446  *           functions where it is used.
447  * @keylen: length of the provided algorithm key, in bytes
448  * @keylen_pad: padded length of the provided algorithm key, in bytes
449  * @key: address where algorithm key resides; virtual address if key_inline
450  *       is true, dma (bus) address if key_inline is false.
451  * @key_inline: true - key can be inlined in the descriptor; false - key is
452  *              referenced by the descriptor
453  */
454 struct alginfo {
455         u32 algtype;
456         unsigned int keylen;
457         unsigned int keylen_pad;
458         union {
459                 dma_addr_t key_dma;
460                 const void *key_virt;
461         };
462         bool key_inline;
463 };
464
465 /**
466  * desc_inline_query() - Provide indications on which data items can be inlined
467  *                       and which shall be referenced in a shared descriptor.
468  * @sd_base_len: Shared descriptor base length - bytes consumed by the commands,
469  *               excluding the data items to be inlined (or corresponding
470  *               pointer if an item is not inlined). Each cnstr_* function that
471  *               generates descriptors should have a define mentioning
472  *               corresponding length.
473  * @jd_len: Maximum length of the job descriptor(s) that will be used
474  *          together with the shared descriptor.
475  * @data_len: Array of lengths of the data items trying to be inlined
476  * @inl_mask: 32bit mask with bit x = 1 if data item x can be inlined, 0
477  *            otherwise.
478  * @count: Number of data items (size of @data_len array); must be <= 32
479  *
480  * Return: 0 if data can be inlined / referenced, negative value if not. If 0,
481  *         check @inl_mask for details.
482  */
483 static inline int desc_inline_query(unsigned int sd_base_len,
484                                     unsigned int jd_len, unsigned int *data_len,
485                                     u32 *inl_mask, unsigned int count)
486 {
487         int rem_bytes = (int)(CAAM_DESC_BYTES_MAX - sd_base_len - jd_len);
488         unsigned int i;
489
490         *inl_mask = 0;
491         for (i = 0; (i < count) && (rem_bytes > 0); i++) {
492                 if (rem_bytes - (int)(data_len[i] +
493                         (count - i - 1) * CAAM_PTR_SZ) >= 0) {
494                         rem_bytes -= data_len[i];
495                         *inl_mask |= (1 << i);
496                 } else {
497                         rem_bytes -= CAAM_PTR_SZ;
498                 }
499         }
500
501         return (rem_bytes >= 0) ? 0 : -1;
502 }
503
504 /**
505  * append_proto_dkp - Derived Key Protocol (DKP): key -> split key
506  * @desc: pointer to buffer used for descriptor construction
507  * @adata: pointer to authentication transform definitions.
508  *         keylen should be the length of initial key, while keylen_pad
509  *         the length of the derived (split) key.
510  *         Valid algorithm values - one of OP_ALG_ALGSEL_{MD5, SHA1, SHA224,
511  *         SHA256, SHA384, SHA512}.
512  */
513 static inline void append_proto_dkp(u32 * const desc, struct alginfo *adata)
514 {
515         u32 protid;
516
517         /*
518          * Quick & dirty translation from OP_ALG_ALGSEL_{MD5, SHA*}
519          * to OP_PCLID_DKP_{MD5, SHA*}
520          */
521         protid = (adata->algtype & OP_ALG_ALGSEL_SUBMASK) |
522                  (0x20 << OP_ALG_ALGSEL_SHIFT);
523
524         if (adata->key_inline) {
525                 int words;
526
527                 append_operation(desc, OP_TYPE_UNI_PROTOCOL | protid |
528                                  OP_PCL_DKP_SRC_IMM | OP_PCL_DKP_DST_IMM |
529                                  adata->keylen);
530                 append_data(desc, adata->key_virt, adata->keylen);
531
532                 /* Reserve space in descriptor buffer for the derived key */
533                 words = (ALIGN(adata->keylen_pad, CAAM_CMD_SZ) -
534                          ALIGN(adata->keylen, CAAM_CMD_SZ)) / CAAM_CMD_SZ;
535                 if (words)
536                         (*desc) = cpu_to_caam32(caam32_to_cpu(*desc) + words);
537         } else {
538                 append_operation(desc, OP_TYPE_UNI_PROTOCOL | protid |
539                                  OP_PCL_DKP_SRC_PTR | OP_PCL_DKP_DST_PTR |
540                                  adata->keylen);
541                 append_ptr(desc, adata->key_dma);
542         }
543 }
544
545 #endif /* DESC_CONSTR_H */