2 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 #ifndef __CC_HW_QUEUE_DEFS_H__
18 #define __CC_HW_QUEUE_DEFS_H__
20 #include "cc_pal_log.h"
22 #include "dx_crys_kernel.h"
25 #include <linux/types.h>
26 #define UINT32_MAX 0xFFFFFFFFL
27 #define INT32_MAX 0x7FFFFFFFL
28 #define UINT16_MAX 0xFFFFL
33 /******************************************************************************
35 ******************************************************************************/
38 /* Dma AXI Secure bit */
40 #define AXI_NOT_SECURE 1
42 #define HW_DESC_SIZE_WORDS 6
43 #define HW_QUEUE_SLOTS_MAX 15 /* Max. available slots in HW queue */
45 #define _HW_DESC_MONITOR_KICK 0x7FFFC00
47 /******************************************************************************
49 ******************************************************************************/
51 typedef struct HwDesc {
52 uint32_t word[HW_DESC_SIZE_WORDS];
55 typedef enum DescDirection {
56 DESC_DIRECTION_ILLEGAL = -1,
57 DESC_DIRECTION_ENCRYPT_ENCRYPT = 0,
58 DESC_DIRECTION_DECRYPT_DECRYPT = 1,
59 DESC_DIRECTION_DECRYPT_ENCRYPT = 3,
60 DESC_DIRECTION_END = INT32_MAX,
63 typedef enum DmaMode {
70 DmaMode_END = INT32_MAX,
73 typedef enum FlowMode {
84 DIN_HASH_and_BYPASS = 8,
85 AESMAC_and_BYPASS = 9,
86 AES_to_HASH_and_DOUT = 10,
88 DES_to_HASH_and_DOUT = 12,
89 AES_to_AES_to_HASH_and_DOUT = 13,
90 AES_to_AES_to_HASH = 14,
91 AES_to_HASH_and_AES = 15,
100 S_DIN_to_MULTI2 = 36,
109 FlowMode_END = INT32_MAX,
112 typedef enum TunnelOp {
113 TUNNEL_OP_INVALID = -1,
117 TunnelOp_END = INT32_MAX,
120 typedef enum SetupOp {
122 SETUP_LOAD_STATE0 = 1,
123 SETUP_LOAD_STATE1 = 2,
124 SETUP_LOAD_STATE2 = 3,
126 SETUP_LOAD_XEX_KEY = 5,
127 SETUP_WRITE_STATE0 = 8,
128 SETUP_WRITE_STATE1 = 9,
129 SETUP_WRITE_STATE2 = 10,
130 SETUP_WRITE_STATE3 = 11,
132 setupOp_END = INT32_MAX,
135 enum AesMacSelector {
139 AesMacEnd = INT32_MAX,
142 #define HW_KEY_MASK_CIPHER_DO 0x3
143 #define HW_KEY_SHIFT_CIPHER_CFG2 2
146 /* HwCryptoKey[1:0] is mapped to cipher_do[1:0] */
147 /* HwCryptoKey[2:3] is mapped to cipher_config2[1:0] */
148 typedef enum HwCryptoKey {
149 USER_KEY = 0, /* 0x0000 */
150 ROOT_KEY = 1, /* 0x0001 */
151 PROVISIONING_KEY = 2, /* 0x0010 */ /* ==KCP */
152 SESSION_KEY = 3, /* 0x0011 */
153 RESERVED_KEY = 4, /* NA */
154 PLATFORM_KEY = 5, /* 0x0101 */
155 CUSTOMER_KEY = 6, /* 0x0110 */
156 KFDE0_KEY = 7, /* 0x0111 */
157 KFDE1_KEY = 9, /* 0x1001 */
158 KFDE2_KEY = 10, /* 0x1010 */
159 KFDE3_KEY = 11, /* 0x1011 */
160 END_OF_KEYS = INT32_MAX,
163 typedef enum HwAesKeySize {
167 END_OF_AES_KEYS = INT32_MAX,
170 typedef enum HwDesKeySize {
174 END_OF_DES_KEYS = INT32_MAX,
177 /*****************************/
178 /* Descriptor packing macros */
179 /*****************************/
181 #define GET_HW_Q_DESC_WORD_IDX(descWordIdx) (CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD ## descWordIdx) )
183 #define HW_DESC_INIT(pDesc) do { \
184 (pDesc)->word[0] = 0; \
185 (pDesc)->word[1] = 0; \
186 (pDesc)->word[2] = 0; \
187 (pDesc)->word[3] = 0; \
188 (pDesc)->word[4] = 0; \
189 (pDesc)->word[5] = 0; \
192 /* HW descriptor debug functions */
193 int createDetailedDump(HwDesc_s *pDesc);
194 void descriptor_log(HwDesc_s *desc);
196 #if defined(HW_DESCRIPTOR_LOG) || defined(HW_DESC_DUMP_HOST_BUF)
197 #define LOG_HW_DESC(pDesc) descriptor_log(pDesc)
199 #define LOG_HW_DESC(pDesc)
202 #if (CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_TRACE) || defined(OEMFW_LOG)
205 #define CREATE_DETAILED_DUMP(pDesc) createDetailedDump(pDesc)
207 #define CREATE_DETAILED_DUMP(pDesc)
210 #define HW_DESC_DUMP(pDesc) do { \
211 CC_PAL_LOG_TRACE("\n---------------------------------------------------\n"); \
212 CREATE_DETAILED_DUMP(pDesc); \
213 CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[0]); \
214 CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[1]); \
215 CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[2]); \
216 CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[3]); \
217 CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[4]); \
218 CC_PAL_LOG_TRACE("0x%08X\n", (unsigned int)(pDesc)->word[5]); \
219 CC_PAL_LOG_TRACE("---------------------------------------------------\n\n"); \
223 #define HW_DESC_DUMP(pDesc) do {} while (0)
228 * This macro indicates the end of current HW descriptors flow and release the HW engines.
230 * \param pDesc pointer HW descriptor struct
232 #define HW_DESC_SET_QUEUE_LAST_IND(pDesc) \
234 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, QUEUE_LAST_IND, (pDesc)->word[3], 1); \
238 * This macro signs the end of HW descriptors flow by asking for completion ack, and release the HW engines
240 * \param pDesc pointer HW descriptor struct
242 #define HW_DESC_SET_ACK_LAST(pDesc) \
244 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, QUEUE_LAST_IND, (pDesc)->word[3], 1); \
245 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, ACK_NEEDED, (pDesc)->word[4], 1); \
249 #define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32)&UINT16_MAX)
252 * This macro sets the DIN field of a HW descriptors
254 * \param pDesc pointer HW descriptor struct
255 * \param dmaMode The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT
256 * \param dinAdr DIN address
257 * \param dinSize Data size in bytes
258 * \param axiNs AXI secure bit
260 #define HW_DESC_SET_DIN_TYPE(pDesc, dmaMode, dinAdr, dinSize, axiNs) \
262 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (dinAdr)&UINT32_MAX ); \
263 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DIN_ADDR_HIGH, (pDesc)->word[5], MSB64(dinAdr) ); \
264 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], (dmaMode)); \
265 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \
266 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, NS_BIT, (pDesc)->word[1], (axiNs)); \
271 * This macro sets the DIN field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and
272 * other special modes
274 * \param pDesc pointer HW descriptor struct
275 * \param dinAdr DIN address
276 * \param dinSize Data size in bytes
278 #define HW_DESC_SET_DIN_NO_DMA(pDesc, dinAdr, dinSize) \
280 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (uint32_t)(dinAdr)); \
281 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \
285 * This macro sets the DIN field of a HW descriptors to SRAM mode.
286 * Note: No need to check SRAM alignment since host requests do not use SRAM and
287 * adaptor will enforce alignment check.
289 * \param pDesc pointer HW descriptor struct
290 * \param dinAdr DIN address
291 * \param dinSize Data size in bytes
293 #define HW_DESC_SET_DIN_SRAM(pDesc, dinAdr, dinSize) \
295 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (uint32_t)(dinAdr)); \
296 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], DMA_SRAM); \
297 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \
300 /*! This macro sets the DIN field of a HW descriptors to CONST mode
302 * \param pDesc pointer HW descriptor struct
303 * \param val DIN const value
304 * \param dinSize Data size in bytes
306 #define HW_DESC_SET_DIN_CONST(pDesc, val, dinSize) \
308 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (uint32_t)(val)); \
309 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_CONST_VALUE, (pDesc)->word[1], 1); \
310 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], DMA_SRAM); \
311 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \
315 * This macro sets the DIN not last input data indicator
317 * \param pDesc pointer HW descriptor struct
319 #define HW_DESC_SET_DIN_NOT_LAST_INDICATION(pDesc) \
321 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, NOT_LAST, (pDesc)->word[1], 1); \
325 * This macro sets the DOUT field of a HW descriptors
327 * \param pDesc pointer HW descriptor struct
328 * \param dmaMode The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT
329 * \param doutAdr DOUT address
330 * \param doutSize Data size in bytes
331 * \param axiNs AXI secure bit
333 #define HW_DESC_SET_DOUT_TYPE(pDesc, dmaMode, doutAdr, doutSize, axiNs) \
335 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&UINT32_MAX ); \
336 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \
337 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], (dmaMode)); \
338 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \
339 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, NS_BIT, (pDesc)->word[3], (axiNs)); \
343 * This macro sets the DOUT field of a HW descriptors to DLLI type
344 * The LAST INDICATION is provided by the user
346 * \param pDesc pointer HW descriptor struct
347 * \param doutAdr DOUT address
348 * \param doutSize Data size in bytes
349 * \param lastInd The last indication bit
350 * \param axiNs AXI secure bit
352 #define HW_DESC_SET_DOUT_DLLI(pDesc, doutAdr, doutSize, axiNs ,lastInd) \
354 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&UINT32_MAX ); \
355 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \
356 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_DLLI); \
357 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \
358 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], lastInd); \
359 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, NS_BIT, (pDesc)->word[3], (axiNs)); \
363 * This macro sets the DOUT field of a HW descriptors to DLLI type
364 * The LAST INDICATION is provided by the user
366 * \param pDesc pointer HW descriptor struct
367 * \param doutAdr DOUT address
368 * \param doutSize Data size in bytes
369 * \param lastInd The last indication bit
370 * \param axiNs AXI secure bit
372 #define HW_DESC_SET_DOUT_MLLI(pDesc, doutAdr, doutSize, axiNs ,lastInd) \
374 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&UINT32_MAX ); \
375 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \
376 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_MLLI); \
377 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \
378 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], lastInd); \
379 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, NS_BIT, (pDesc)->word[3], (axiNs)); \
383 * This macro sets the DOUT field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and
384 * other special modes
386 * \param pDesc pointer HW descriptor struct
387 * \param doutAdr DOUT address
388 * \param doutSize Data size in bytes
389 * \param registerWriteEnable Enables a write operation to a register
391 #define HW_DESC_SET_DOUT_NO_DMA(pDesc, doutAdr, doutSize, registerWriteEnable) \
393 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(doutAdr)); \
394 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \
395 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], (registerWriteEnable)); \
399 * This macro sets the word for the XOR operation.
401 * \param pDesc pointer HW descriptor struct
402 * \param xorVal xor data value
404 #define HW_DESC_SET_XOR_VAL(pDesc, xorVal) \
406 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(xorVal)); \
410 * This macro sets the XOR indicator bit in the descriptor
412 * \param pDesc pointer HW descriptor struct
414 #define HW_DESC_SET_XOR_ACTIVE(pDesc) \
416 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, HASH_XOR_BIT, (pDesc)->word[3], 1); \
420 * This macro selects the AES engine instead of HASH engine when setting up combined mode with AES XCBC MAC
422 * \param pDesc pointer HW descriptor struct
424 #define HW_DESC_SET_AES_NOT_HASH_MODE(pDesc) \
426 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, AES_SEL_N_HASH, (pDesc)->word[4], 1); \
430 * This macro sets the DOUT field of a HW descriptors to SRAM mode
431 * Note: No need to check SRAM alignment since host requests do not use SRAM and
432 * adaptor will enforce alignment check.
434 * \param pDesc pointer HW descriptor struct
435 * \param doutAdr DOUT address
436 * \param doutSize Data size in bytes
438 #define HW_DESC_SET_DOUT_SRAM(pDesc, doutAdr, doutSize) \
440 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(doutAdr)); \
441 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_SRAM); \
442 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \
447 * This macro sets the data unit size for XEX mode in data_out_addr[15:0]
449 * \param pDesc pointer HW descriptor struct
450 * \param dataUnitSize data unit size for XEX mode
452 #define HW_DESC_SET_XEX_DATA_UNIT_SIZE(pDesc, dataUnitSize) \
454 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(dataUnitSize)); \
458 * This macro sets the number of rounds for Multi2 in data_out_addr[15:0]
460 * \param pDesc pointer HW descriptor struct
461 * \param numRounds number of rounds for Multi2
463 #define HW_DESC_SET_MULTI2_NUM_ROUNDS(pDesc, numRounds) \
465 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(numRounds)); \
469 * This macro sets the flow mode.
471 * \param pDesc pointer HW descriptor struct
472 * \param flowMode Any one of the modes defined in [CC7x-DESC]
475 #define HW_DESC_SET_FLOW_MODE(pDesc, flowMode) \
477 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, DATA_FLOW_MODE, (pDesc)->word[4], (flowMode)); \
481 * This macro sets the cipher mode.
483 * \param pDesc pointer HW descriptor struct
484 * \param cipherMode Any one of the modes defined in [CC7x-DESC]
486 #define HW_DESC_SET_CIPHER_MODE(pDesc, cipherMode) \
488 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_MODE, (pDesc)->word[4], (cipherMode)); \
492 * This macro sets the cipher configuration fields.
494 * \param pDesc pointer HW descriptor struct
495 * \param cipherConfig Any one of the modes defined in [CC7x-DESC]
497 #define HW_DESC_SET_CIPHER_CONFIG0(pDesc, cipherConfig) \
499 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF0, (pDesc)->word[4], (cipherConfig)); \
503 * This macro sets the cipher configuration fields.
505 * \param pDesc pointer HW descriptor struct
506 * \param cipherConfig Any one of the modes defined in [CC7x-DESC]
508 #define HW_DESC_SET_CIPHER_CONFIG1(pDesc, cipherConfig) \
510 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF1, (pDesc)->word[4], (cipherConfig)); \
514 * This macro sets HW key configuration fields.
516 * \param pDesc pointer HW descriptor struct
517 * \param hwKey The hw key number as in enun HwCryptoKey
519 #define HW_DESC_SET_HW_CRYPTO_KEY(pDesc, hwKey) \
521 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (hwKey)&HW_KEY_MASK_CIPHER_DO); \
522 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF2, (pDesc)->word[4], (hwKey>>HW_KEY_SHIFT_CIPHER_CFG2)); \
526 * This macro changes the bytes order of all setup-finalize descriptosets.
528 * \param pDesc pointer HW descriptor struct
529 * \param swapConfig Any one of the modes defined in [CC7x-DESC]
531 #define HW_DESC_SET_BYTES_SWAP(pDesc, swapConfig) \
533 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, BYTES_SWAP, (pDesc)->word[4], (swapConfig)); \
537 * This macro sets the CMAC_SIZE0 mode.
539 * \param pDesc pointer HW descriptor struct
541 #define HW_DESC_SET_CMAC_SIZE0_MODE(pDesc) \
543 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CMAC_SIZE0, (pDesc)->word[4], 0x1); \
547 * This macro sets the key size for AES engine.
549 * \param pDesc pointer HW descriptor struct
550 * \param keySize key size in bytes (NOT size code)
552 #define HW_DESC_SET_KEY_SIZE_AES(pDesc, keySize) \
554 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, KEY_SIZE, (pDesc)->word[4], ((keySize) >> 3) - 2); \
558 * This macro sets the key size for DES engine.
560 * \param pDesc pointer HW descriptor struct
561 * \param keySize key size in bytes (NOT size code)
563 #define HW_DESC_SET_KEY_SIZE_DES(pDesc, keySize) \
565 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, KEY_SIZE, (pDesc)->word[4], ((keySize) >> 3) - 1); \
569 * This macro sets the descriptor's setup mode
571 * \param pDesc pointer HW descriptor struct
572 * \param setupMode Any one of the setup modes defined in [CC7x-DESC]
574 #define HW_DESC_SET_SETUP_MODE(pDesc, setupMode) \
576 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, SETUP_OPERATION, (pDesc)->word[4], (setupMode)); \
580 * This macro sets the descriptor's cipher do
582 * \param pDesc pointer HW descriptor struct
583 * \param cipherDo Any one of the cipher do defined in [CC7x-DESC]
585 #define HW_DESC_SET_CIPHER_DO(pDesc, cipherDo) \
587 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (cipherDo)&HW_KEY_MASK_CIPHER_DO); \
591 * This macro sets the DIN field of a HW descriptors to star/stop monitor descriptor.
592 * Used for performance measurements and debug purposes.
594 * \param pDesc pointer HW descriptor struct
596 #define HW_DESC_SET_DIN_MONITOR_CNTR(pDesc) \
598 CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_MEASURE_CNTR, VALUE, (pDesc)->word[1], _HW_DESC_MONITOR_KICK); \
603 #endif /*__CC_HW_QUEUE_DEFS_H__*/