Lines Matching +full:len +full:- +full:or +full:- +full:define

1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Copyright 2008-2012 Freescale Semiconductor, Inc.
10 #define DESC_CONSTR_H
15 #define IMMEDIATE (1 << 23)
16 #define CAAM_CMD_SZ sizeof(u32)
17 #define CAAM_PTR_SZ caam_ptr_sz
18 #define CAAM_PTR_SZ_MAX sizeof(dma_addr_t)
19 #define CAAM_PTR_SZ_MIN sizeof(u32)
20 #define CAAM_DESC_BYTES_MAX (CAAM_CMD_SZ * MAX_CAAM_DESCSIZE)
21 #define __DESC_JOB_IO_LEN(n) (CAAM_CMD_SZ * 5 + (n) * 3)
22 #define DESC_JOB_IO_LEN __DESC_JOB_IO_LEN(CAAM_PTR_SZ)
23 #define DESC_JOB_IO_LEN_MAX __DESC_JOB_IO_LEN(CAAM_PTR_SZ_MAX)
24 #define DESC_JOB_IO_LEN_MIN __DESC_JOB_IO_LEN(CAAM_PTR_SZ_MIN)
31 * deco buffer which is 64 words long (each 32-bit).
36 * Shdesc ptr (1 or 2 words)
38 * Out ptr (1 or 2 words)
41 * In ptr (1 or 2 words)
48 * get loaded in deco buffer are '8' or '11'. The remaining words
51 #define MAX_SDLEN ((CAAM_DESC_BYTES_MAX - DESC_JOB_IO_LEN_MIN) / CAAM_CMD_SZ)
54 #define PRINT_POS do { printk(KERN_DEBUG "%02d: %s\n", desc_len(desc),\
57 #define PRINT_POS
60 #define SET_OK_NO_PROP_ERRORS (IMMEDIATE | LDST_CLASS_DECO | \
64 #define DISABLE_AUTO_INFO_FIFO (IMMEDIATE | LDST_CLASS_DECO | \
67 #define ENABLE_AUTO_INFO_FIFO (IMMEDIATE | LDST_CLASS_DECO | \
118 u32 pdb_len = (pdb_bytes + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ; in init_sh_desc_pdb()
132 u32 pdb_len = (pdb_bytes + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ; in init_job_desc_pdb()
154 int len, u32 options) in init_job_desc_shared() argument
158 (len << HDR_START_IDX_SHIFT)); in init_job_desc_shared()
162 static inline void append_data(u32 * const desc, const void *data, int len) in append_data() argument
168 memcpy(offset, data, len); in append_data()
171 (len + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ); in append_data()
183 #define append_u32 append_cmd
189 /* Only 32-bit alignment is guaranteed in descriptor buffer */ in append_u64()
209 static inline void append_cmd_ptr(u32 * const desc, dma_addr_t ptr, int len, in append_cmd_ptr() argument
212 append_cmd(desc, command | len); in append_cmd_ptr()
218 unsigned int len, u32 command) in append_cmd_ptr_extlen() argument
223 append_cmd(desc, len); in append_cmd_ptr_extlen()
226 static inline void append_cmd_data(u32 * const desc, const void *data, int len, in append_cmd_data() argument
229 append_cmd(desc, command | IMMEDIATE | len); in append_cmd_data()
230 append_data(desc, data, len); in append_cmd_data()
233 #define APPEND_CMD_RET(cmd, op) \
248 (desc_len(desc) - (jump_cmd - desc))); in APPEND_CMD_RET()
260 #define APPEND_CMD(cmd, op) \
268 #define APPEND_CMD_LEN(cmd, op) \ in APPEND_CMD()
269 static inline void append_##cmd(u32 * const desc, unsigned int len, \ in APPEND_CMD()
273 append_cmd(desc, CMD_##op | len | options); \ in APPEND_CMD()
281 #define APPEND_CMD_PTR(cmd, op) \
283 unsigned int len, u32 options) \
286 append_cmd_ptr(desc, ptr, len, CMD_##op | options); \
294 unsigned int len, u32 options)
300 append_cmd(desc, CMD_STORE | options | len);
310 #define APPEND_SEQ_PTR_INTLEN(cmd, op) \
313 unsigned int len, \
318 append_cmd(desc, CMD_SEQ_##op##_PTR | len | options); \
320 append_cmd_ptr(desc, ptr, len, CMD_SEQ_##op##_PTR | options); \
325 #define APPEND_CMD_PTR_TO_IMM(cmd, op) \
327 unsigned int len, u32 options) \
330 append_cmd_data(desc, data, len, CMD_##op | options); \
335 #define APPEND_CMD_PTR_EXTLEN(cmd, op) \
337 unsigned int len, u32 options) \
340 append_cmd_ptr_extlen(desc, ptr, len, CMD_##op | SQIN_EXT | options); \
346 * Determine whether to store length internally or externally depending on
349 #define APPEND_CMD_PTR_LEN(cmd, op, type) \
351 type len, u32 options) \
355 append_##cmd##_extlen(desc, ptr, len, options); \
357 append_##cmd##_intlen(desc, ptr, len, options); \
366 #define APPEND_CMD_PTR_TO_IMM2(cmd, op) \
369 unsigned int len, u32 options) \
372 append_cmd(desc, CMD_##op | IMMEDIATE | len | options); \
377 #define APPEND_CMD_RAW_IMM(cmd, op, type) \
392 * ee - endianness
393 * size - size of immediate type in bytes
395 #define APPEND_CMD_RAW_IMM2(cmd, op, ee, size) \
412 #define APPEND_MATH(op, desc, dest, src_0, src_1, len) \ argument
414 MATH_SRC0_##src_0 | MATH_SRC1_##src_1 | (u32)len);
416 #define append_math_add(desc, dest, src0, src1, len) \ argument
417 APPEND_MATH(ADD, desc, dest, src0, src1, len)
418 #define append_math_sub(desc, dest, src0, src1, len) \ argument
419 APPEND_MATH(SUB, desc, dest, src0, src1, len)
420 #define append_math_add_c(desc, dest, src0, src1, len) \ argument
421 APPEND_MATH(ADDC, desc, dest, src0, src1, len)
422 #define append_math_sub_b(desc, dest, src0, src1, len) \ argument
423 APPEND_MATH(SUBB, desc, dest, src0, src1, len)
424 #define append_math_and(desc, dest, src0, src1, len) \ argument
425 APPEND_MATH(AND, desc, dest, src0, src1, len)
426 #define append_math_or(desc, dest, src0, src1, len) \ argument
427 APPEND_MATH(OR, desc, dest, src0, src1, len)
428 #define append_math_xor(desc, dest, src0, src1, len) \ argument
429 APPEND_MATH(XOR, desc, dest, src0, src1, len)
430 #define append_math_lshift(desc, dest, src0, src1, len) \ argument
431 APPEND_MATH(LSHIFT, desc, dest, src0, src1, len)
432 #define append_math_rshift(desc, dest, src0, src1, len) \ argument
433 APPEND_MATH(RSHIFT, desc, dest, src0, src1, len)
434 #define append_math_ldshift(desc, dest, src0, src1, len) \ argument
435 APPEND_MATH(SHLD, desc, dest, src0, src1, len)
438 #define APPEND_MATH_IMM_u32(op, desc, dest, src_0, src_1, data) \
444 #define append_math_add_imm_u32(desc, dest, src0, src1, data) \
446 #define append_math_sub_imm_u32(desc, dest, src0, src1, data) \
448 #define append_math_add_c_imm_u32(desc, dest, src0, src1, data) \
450 #define append_math_sub_b_imm_u32(desc, dest, src0, src1, data) \
452 #define append_math_and_imm_u32(desc, dest, src0, src1, data) \
454 #define append_math_or_imm_u32(desc, dest, src0, src1, data) \
455 APPEND_MATH_IMM_u32(OR, desc, dest, src0, src1, data)
456 #define append_math_xor_imm_u32(desc, dest, src0, src1, data) \
458 #define append_math_lshift_imm_u32(desc, dest, src0, src1, data) \
460 #define append_math_rshift_imm_u32(desc, dest, src0, src1, data) \
464 #define APPEND_MATH_IMM_u64(op, desc, dest, src_0, src_1, data) \
475 #define append_math_add_imm_u64(desc, dest, src0, src1, data) \
477 #define append_math_sub_imm_u64(desc, dest, src0, src1, data) \
479 #define append_math_add_c_imm_u64(desc, dest, src0, src1, data) \
481 #define append_math_sub_b_imm_u64(desc, dest, src0, src1, data) \
483 #define append_math_and_imm_u64(desc, dest, src0, src1, data) \
485 #define append_math_or_imm_u64(desc, dest, src0, src1, data) \
486 APPEND_MATH_IMM_u64(OR, desc, dest, src0, src1, data)
487 #define append_math_xor_imm_u64(desc, dest, src0, src1, data) \
489 #define append_math_lshift_imm_u64(desc, dest, src0, src1, data) \
491 #define append_math_rshift_imm_u64(desc, dest, src0, src1, data) \
495 * struct alginfo - Container for algorithm details
502 * @key_inline: true - key can be inlined in the descriptor; false - key is
515 * desc_inline_query() - Provide indications on which data items can be inlined
517 * @sd_base_len: Shared descriptor base length - bytes consumed by the commands,
518 * excluding the data items to be inlined (or corresponding
520 * generates descriptors should have a define mentioning
536 int rem_bytes = (int)(CAAM_DESC_BYTES_MAX - sd_base_len - jd_len); in desc_inline_query()
541 if (rem_bytes - (int)(data_len[i] + in desc_inline_query()
542 (count - i - 1) * CAAM_PTR_SZ) >= 0) { in desc_inline_query()
543 rem_bytes -= data_len[i]; in desc_inline_query()
546 rem_bytes -= CAAM_PTR_SZ; in desc_inline_query()
550 return (rem_bytes >= 0) ? 0 : -1; in desc_inline_query()
554 * append_proto_dkp - Derived Key Protocol (DKP): key -> split key
559 * Valid algorithm values - one of OP_ALG_ALGSEL_{MD5, SHA1, SHA224,
570 protid = (adata->algtype & OP_ALG_ALGSEL_SUBMASK) | in append_proto_dkp()
573 if (adata->key_inline) { in append_proto_dkp()
576 if (adata->keylen > adata->keylen_pad) { in append_proto_dkp()
579 OP_PCL_DKP_DST_IMM | adata->keylen); in append_proto_dkp()
580 append_ptr(desc, adata->key_dma); in append_proto_dkp()
582 words = (ALIGN(adata->keylen_pad, CAAM_CMD_SZ) - in append_proto_dkp()
587 OP_PCL_DKP_DST_IMM | adata->keylen); in append_proto_dkp()
588 append_data(desc, adata->key_virt, adata->keylen); in append_proto_dkp()
590 words = (ALIGN(adata->keylen_pad, CAAM_CMD_SZ) - in append_proto_dkp()
591 ALIGN(adata->keylen, CAAM_CMD_SZ)) / in append_proto_dkp()
601 adata->keylen); in append_proto_dkp()
602 append_ptr(desc, adata->key_dma); in append_proto_dkp()