1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /**
5 *****************************************************************************
6 * @file icp_qat_fw.h
7 * @defgroup icp_qat_fw_comn ICP QAT FW Common Processing Definitions
8 * @ingroup icp_qat_fw
9 *
10 * @description
11 * This file documents the common interfaces that the QAT FW running on
12 * the QAT AE exports. This common layer is used by a number of services
13 * to export content processing services.
14 *
15 *****************************************************************************/
16
17 #ifndef _ICP_QAT_FW_H_
18 #define _ICP_QAT_FW_H_
19
20 /*
21 * ==============================
22 * General Notes on the Interface
23 */
24
25 /*
26 *
27 * ==============================
28 *
29 * Introduction
30 *
31 * Data movement and slice chaining
32 *
33 * Endianness
34 * - Unless otherwise stated, all structures are defined in LITTLE ENDIAN
35 * MODE
36 *
37 * Alignment
38 * - In general all data structures provided to a request should be aligned
39 * on the 64 byte boundary so as to allow optimal memory transfers. At the
40 * minimum they must be aligned to the 8 byte boundary
41 *
42 * Sizes
43 * Quad words = 8 bytes
44 *
45 * Terminology
46 *
47 * ==============================
48 */
49
50 /*
51 ******************************************************************************
52 * Include public/global header files
53 ******************************************************************************
54 */
55
56 #include "icp_qat_hw.h"
57
58 /* Big assumptions that both bitpos and mask are constants */
59 #define QAT_FIELD_SET(flags, val, bitpos, mask) \
60 (flags) = (((flags) & (~((mask) << (bitpos)))) | \
61 (((val) & (mask)) << (bitpos)))
62
63 #define QAT_FIELD_GET(flags, bitpos, mask) (((flags) >> (bitpos)) & (mask))
64 #define QAT_FLAG_SET(flags, val, bitpos) \
65 ((flags) = (((flags) & (~(1 << (bitpos)))) | (((val)&1) << (bitpos))))
66
67 #define QAT_FLAG_CLEAR(flags, bitpos) (flags) = ((flags) & (~(1 << (bitpos))))
68
69 #define QAT_FLAG_GET(flags, bitpos) (((flags) >> (bitpos)) & 1)
70
71 /**< @ingroup icp_qat_fw_comn
72 * Default request and response ring size in bytes */
73 #define ICP_QAT_FW_REQ_DEFAULT_SZ 128
74 #define ICP_QAT_FW_RESP_DEFAULT_SZ 32
75
76 #define ICP_QAT_FW_COMN_ONE_BYTE_SHIFT 8
77 #define ICP_QAT_FW_COMN_SINGLE_BYTE_MASK 0xFF
78
79 /**< @ingroup icp_qat_fw_comn
80 * Common Request - Block sizes definitions in multiples of individual long
81 * words */
82 #define ICP_QAT_FW_NUM_LONGWORDS_1 1
83 #define ICP_QAT_FW_NUM_LONGWORDS_2 2
84 #define ICP_QAT_FW_NUM_LONGWORDS_3 3
85 #define ICP_QAT_FW_NUM_LONGWORDS_4 4
86 #define ICP_QAT_FW_NUM_LONGWORDS_5 5
87 #define ICP_QAT_FW_NUM_LONGWORDS_6 6
88 #define ICP_QAT_FW_NUM_LONGWORDS_7 7
89 #define ICP_QAT_FW_NUM_LONGWORDS_10 10
90 #define ICP_QAT_FW_NUM_LONGWORDS_13 13
91
92 /**< @ingroup icp_qat_fw_comn
93 * Definition of the associated service Id for NULL service type.
94 * Note: the response is expected to use ICP_QAT_FW_COMN_RESP_SERV_CPM_FW */
95 #define ICP_QAT_FW_NULL_REQ_SERV_ID 1
96
97 /**
98 *****************************************************************************
99 * @ingroup icp_qat_fw_comn
100 * Definition of the firmware interface service users, for
101 * responses.
102 * @description
103 * Enumeration which is used to indicate the ids of the services
104 * for responses using the external firmware interfaces.
105 *
106 *****************************************************************************/
107
108 typedef enum {
109 ICP_QAT_FW_COMN_RESP_SERV_NULL, /**< NULL service id type */
110 ICP_QAT_FW_COMN_RESP_SERV_CPM_FW, /**< CPM FW Service ID */
111 ICP_QAT_FW_COMN_RESP_SERV_DELIMITER /**< Delimiter service id type */
112 } icp_qat_fw_comn_resp_serv_id_t;
113
114 /**
115 *****************************************************************************
116 * @ingroup icp_qat_fw_comn
117 * Definition of the request types
118 * @description
119 * Enumeration which is used to indicate the ids of the request
120 * types used in each of the external firmware interfaces
121 *
122 *****************************************************************************/
123
124 typedef enum {
125 ICP_QAT_FW_COMN_REQ_NULL = 0, /**< NULL request type */
126 ICP_QAT_FW_COMN_REQ_CPM_FW_PKE = 3, /**< CPM FW PKE Request */
127 ICP_QAT_FW_COMN_REQ_CPM_FW_LA = 4, /**< CPM FW Lookaside Request */
128 ICP_QAT_FW_COMN_REQ_CPM_FW_DMA = 7, /**< CPM FW DMA Request */
129 ICP_QAT_FW_COMN_REQ_CPM_FW_COMP = 9, /**< CPM FW Compression Request */
130 ICP_QAT_FW_COMN_REQ_DELIMITER /**< End delimiter */
131
132 } icp_qat_fw_comn_request_id_t;
133
134 /* ========================================================================= */
135 /* QAT FW REQUEST STRUCTURES */
136 /* ========================================================================= */
137
138 /**
139 *****************************************************************************
140 * @ingroup icp_qat_fw_comn
141 * Common request flags type
142 *
143 * @description
144 * Definition of the common request flags.
145 *
146 *****************************************************************************/
147 typedef uint8_t icp_qat_fw_comn_flags;
148
149 /**
150 *****************************************************************************
151 * @ingroup icp_qat_fw_comn
152 * Common request - Service specific flags type
153 *
154 * @description
155 * Definition of the common request service specific flags.
156 *
157 *****************************************************************************/
158 typedef uint16_t icp_qat_fw_serv_specif_flags;
159
160 /**
161 *****************************************************************************
162 * @ingroup icp_qat_fw_comn
163 * Common request - Extended service specific flags type
164 *
165 * @description
166 * Definition of the common request extended service specific flags.
167 *
168 *****************************************************************************/
169 typedef uint8_t icp_qat_fw_ext_serv_specif_flags;
170
171 /**
172 *****************************************************************************
173 * @ingroup icp_qat_fw_comn
174 * Definition of the common QAT FW request content descriptor field -
175 * points to the content descriptor parameters or itself contains service-
176 * specific data. Also specifies content descriptor parameter size.
177 * Contains reserved fields.
178 * @description
179 * Common section of the request used across all of the services exposed
180 * by the QAT FW. Each of the services inherit these common fields
181 *
182 *****************************************************************************/
183 typedef union icp_qat_fw_comn_req_hdr_cd_pars_s {
184 /**< LWs 2-5 */
185 struct {
186 uint64_t content_desc_addr;
187 /**< Address of the content descriptor */
188
189 uint16_t content_desc_resrvd1;
190 /**< Content descriptor reserved field */
191
192 uint8_t content_desc_params_sz;
193 /**< Size of the content descriptor parameters in quad words.
194 * These
195 * parameters describe the session setup configuration info for
196 * the
197 * slices that this request relies upon i.e. the configuration
198 * word and
199 * cipher key needed by the cipher slice if there is a request
200 * for
201 * cipher processing. */
202
203 uint8_t content_desc_hdr_resrvd2;
204 /**< Content descriptor reserved field */
205
206 uint32_t content_desc_resrvd3;
207 /**< Content descriptor reserved field */
208 } s;
209
210 struct {
211 uint32_t serv_specif_fields[ICP_QAT_FW_NUM_LONGWORDS_4];
212
213 } s1;
214
215 } icp_qat_fw_comn_req_hdr_cd_pars_t;
216
217 /**
218 *****************************************************************************
219 * @ingroup icp_qat_fw_comn
220 * Definition of the common QAT FW request middle block.
221 * @description
222 * Common section of the request used across all of the services exposed
223 * by the QAT FW. Each of the services inherit these common fields
224 *
225 *****************************************************************************/
226 typedef struct icp_qat_fw_comn_req_mid_s {
227 /**< LWs 6-13 */
228 uint64_t opaque_data;
229 /**< Opaque data passed unmodified from the request to response messages
230 * by
231 * firmware (fw) */
232
233 uint64_t src_data_addr;
234 /**< Generic definition of the source data supplied to the QAT AE. The
235 * common flags are used to further describe the attributes of this
236 * field */
237
238 uint64_t dest_data_addr;
239 /**< Generic definition of the destination data supplied to the QAT AE.
240 * The
241 * common flags are used to further describe the attributes of this
242 * field */
243
244 uint32_t src_length;
245 /** < Length of source flat buffer incase src buffer
246 * type is flat */
247
248 uint32_t dst_length;
249 /** < Length of source flat buffer incase dst buffer
250 * type is flat */
251
252 } icp_qat_fw_comn_req_mid_t;
253
254 /**
255 *****************************************************************************
256 * @ingroup icp_qat_fw_comn
257 * Definition of the common QAT FW request content descriptor control
258 * block.
259 *
260 * @description
261 * Service specific section of the request used across all of the services
262 * exposed by the QAT FW. Each of the services populates this block
263 * uniquely. Refer to the service-specific header structures e.g.
264 * 'icp_qat_fw_cipher_hdr_s' (for Cipher) etc.
265 *
266 *****************************************************************************/
267 typedef struct icp_qat_fw_comn_req_cd_ctrl_s {
268 /**< LWs 27-31 */
269 uint32_t content_desc_ctrl_lw[ICP_QAT_FW_NUM_LONGWORDS_5];
270
271 } icp_qat_fw_comn_req_cd_ctrl_t;
272
273 /**
274 *****************************************************************************
275 * @ingroup icp_qat_fw_comn
276 * Definition of the common QAT FW request header.
277 * @description
278 * Common section of the request used across all of the services exposed
279 * by the QAT FW. Each of the services inherit these common fields. The
280 * reserved field of 7 bits and the service command Id field are all
281 * service-specific fields, along with the service specific flags.
282 *
283 *****************************************************************************/
284 typedef struct icp_qat_fw_comn_req_hdr_s {
285 /**< LW0 */
286 uint8_t resrvd1;
287 /**< reserved field */
288
289 uint8_t service_cmd_id;
290 /**< Service Command Id - this field is service-specific
291 * Please use service-specific command Id here e.g.Crypto Command Id
292 * or Compression Command Id etc. */
293
294 uint8_t service_type;
295 /**< Service type */
296
297 uint8_t hdr_flags;
298 /**< This represents a flags field for the Service Request.
299 * The most significant bit is the 'valid' flag and the only
300 * one used. All remaining bit positions are unused and
301 * are therefore reserved and need to be set to 0. */
302
303 /**< LW1 */
304 icp_qat_fw_serv_specif_flags serv_specif_flags;
305 /**< Common Request service-specific flags
306 * e.g. Symmetric Crypto Command Flags */
307
308 icp_qat_fw_comn_flags comn_req_flags;
309 /**< Common Request Flags consisting of
310 * - 6 reserved bits,
311 * - 1 Content Descriptor field type bit and
312 * - 1 Source/destination pointer type bit */
313
314 icp_qat_fw_ext_serv_specif_flags extended_serv_specif_flags;
315 /**< An extension of serv_specif_flags
316 */
317 } icp_qat_fw_comn_req_hdr_t;
318
319 /**
320 *****************************************************************************
321 * @ingroup icp_qat_fw_comn
322 * Definition of the common QAT FW request parameter field.
323 *
324 * @description
325 * Service specific section of the request used across all of the services
326 * exposed by the QAT FW. Each of the services populates this block
327 * uniquely. Refer to service-specific header structures e.g.
328 * 'icp_qat_fw_comn_req_cipher_rqpars_s' (for Cipher) etc.
329 *
330 *****************************************************************************/
331 typedef struct icp_qat_fw_comn_req_rqpars_s {
332 /**< LWs 14-26 */
333 uint32_t serv_specif_rqpars_lw[ICP_QAT_FW_NUM_LONGWORDS_13];
334
335 } icp_qat_fw_comn_req_rqpars_t;
336
337 /**
338 *****************************************************************************
339 * @ingroup icp_qat_fw_comn
340 * Definition of the common request structure with service specific
341 * fields
342 * @description
343 * This is a definition of the full qat request structure used by all
344 * services. Each service is free to use the service fields in its own
345 * way. This struct is useful as a message passing argument before the
346 * service contained within the request is determined.
347 *
348 *****************************************************************************/
349 typedef struct icp_qat_fw_comn_req_s {
350 /**< LWs 0-1 */
351 icp_qat_fw_comn_req_hdr_t comn_hdr;
352 /**< Common request header */
353
354 /**< LWs 2-5 */
355 icp_qat_fw_comn_req_hdr_cd_pars_t cd_pars;
356 /**< Common Request content descriptor field which points either to a
357 * content descriptor
358 * parameter block or contains the service-specific data itself. */
359
360 /**< LWs 6-13 */
361 icp_qat_fw_comn_req_mid_t comn_mid;
362 /**< Common request middle section */
363
364 /**< LWs 14-26 */
365 icp_qat_fw_comn_req_rqpars_t serv_specif_rqpars;
366 /**< Common request service-specific parameter field */
367
368 /**< LWs 27-31 */
369 icp_qat_fw_comn_req_cd_ctrl_t cd_ctrl;
370 /**< Common request content descriptor control block -
371 * this field is service-specific */
372
373 } icp_qat_fw_comn_req_t;
374
375 /* ========================================================================= */
376 /* QAT FW RESPONSE STRUCTURES */
377 /* ========================================================================= */
378
379 /**
380 *****************************************************************************
381 * @ingroup icp_qat_fw_comn
382 * Error code field
383 *
384 * @description
385 * Overloaded field with 8 bit common error field or two
386 * 8 bit compression error fields for compression and translator slices
387 *
388 *****************************************************************************/
389 typedef union icp_qat_fw_comn_error_s {
390 struct {
391 uint8_t resrvd;
392 /**< 8 bit reserved field */
393
394 uint8_t comn_err_code;
395 /**< 8 bit common error code */
396
397 } s;
398 /**< Structure which is used for non-compression responses */
399
400 struct {
401 uint8_t xlat_err_code;
402 /**< 8 bit translator error field */
403
404 uint8_t cmp_err_code;
405 /**< 8 bit compression error field */
406
407 } s1;
408 /** Structure which is used for compression responses */
409
410 } icp_qat_fw_comn_error_t;
411
412 /**
413 *****************************************************************************
414 * @ingroup icp_qat_fw_comn
415 * Definition of the common QAT FW response header.
416 * @description
417 * This section of the response is common across all of the services
418 * that generate a firmware interface response
419 *
420 *****************************************************************************/
421 typedef struct icp_qat_fw_comn_resp_hdr_s {
422 /**< LW0 */
423 uint8_t resrvd1;
424 /**< Reserved field - this field is service-specific -
425 * Note: The Response Destination Id has been removed
426 * from first QWord */
427
428 uint8_t service_id;
429 /**< Service Id returned by service block */
430
431 uint8_t response_type;
432 /**< Response type - copied from the request to
433 * the response message */
434
435 uint8_t hdr_flags;
436 /**< This represents a flags field for the Response.
437 * Bit<7> = 'valid' flag
438 * Bit<6> = 'CNV' flag indicating that CNV was executed
439 * on the current request
440 * Bit<5> = 'CNVNR' flag indicating that a recovery happened
441 * on the current request following a CNV error
442 * All remaining bits are unused and are therefore reserved.
443 * They must to be set to 0.
444 */
445
446 /**< LW 1 */
447 icp_qat_fw_comn_error_t comn_error;
448 /**< This field is overloaded to allow for one 8 bit common error field
449 * or two 8 bit error fields from compression and translator */
450
451 uint8_t comn_status;
452 /**< Status field which specifies which slice(s) report an error */
453
454 uint8_t cmd_id;
455 /**< Command Id - passed from the request to the response message */
456
457 } icp_qat_fw_comn_resp_hdr_t;
458
459 /**
460 *****************************************************************************
461 * @ingroup icp_qat_fw_comn
462 * Definition of the common response structure with service specific
463 * fields
464 * @description
465 * This is a definition of the full qat response structure used by all
466 * services.
467 *
468 *****************************************************************************/
469 typedef struct icp_qat_fw_comn_resp_s {
470 /**< LWs 0-1 */
471 icp_qat_fw_comn_resp_hdr_t comn_hdr;
472 /**< Common header fields */
473
474 /**< LWs 2-3 */
475 uint64_t opaque_data;
476 /**< Opaque data passed from the request to the response message */
477
478 /**< LWs 4-7 */
479 uint32_t resrvd[ICP_QAT_FW_NUM_LONGWORDS_4];
480 /**< Reserved */
481
482 } icp_qat_fw_comn_resp_t;
483
484 /* ========================================================================= */
485 /* MACRO DEFINITIONS */
486 /* ========================================================================= */
487
488 /* Common QAT FW request header - structure of LW0
489 * + ===== + ------- + ----------- + ----------- + ----------- + -------- +
490 * | Bit | 31/30 | 29 - 24 | 21 - 16 | 15 - 8 | 7 - 0 |
491 * + ===== + ------- + ----------- + ----------- + ----------- + -------- +
492 * | Flags | V/Gen | Reserved | Serv Type | Serv Cmd Id | Rsv |
493 * + ===== + ------- + ----------- + ----------- + ----------- + -------- +
494 */
495
496 /**< @ingroup icp_qat_fw_comn
497 * Definition of the setting of the header's valid flag */
498 #define ICP_QAT_FW_COMN_REQ_FLAG_SET 1
499 /**< @ingroup icp_qat_fw_comn
500 * Definition of the setting of the header's valid flag */
501 #define ICP_QAT_FW_COMN_REQ_FLAG_CLR 0
502
503 /**< @ingroup icp_qat_fw_comn
504 * Macros defining the bit position and mask of the 'valid' flag, within the
505 * hdr_flags field of LW0 (service request and response) */
506 #define ICP_QAT_FW_COMN_VALID_FLAG_BITPOS 7
507 #define ICP_QAT_FW_COMN_VALID_FLAG_MASK 0x1
508
509 /**< @ingroup icp_qat_fw_comn
510 * Macros defining the bit position and mask of the 'generation' flag, within
511 * the hdr_flags field of LW0 (service request and response) */
512 #define ICP_QAT_FW_COMN_GEN_FLAG_BITPOS 6
513 #define ICP_QAT_FW_COMN_GEN_FLAG_MASK 0x1
514 /**< @ingroup icp_qat_fw_comn
515 * The request is targeted for QAT2.0 */
516 #define ICP_QAT_FW_COMN_GEN_2 1
517 /**< @ingroup icp_qat_fw_comn
518 * The request is targeted for QAT1.x. QAT2.0 FW will return
519 'unsupported request' if GEN1 request type is sent to QAT2.0 FW */
520 #define ICP_QAT_FW_COMN_GEN_1 0
521
522 #define ICP_QAT_FW_COMN_HDR_RESRVD_FLD_MASK 0x7F
523
524 /* Common QAT FW response header - structure of LW0
525 * + ===== + --- + --- + ----- + ----- + --------- + ----------- + ----- +
526 * | Bit | 31 | 30 | 29 | 28-24 | 21 - 16 | 15 - 8 | 7-0 |
527 * + ===== + --- + ----+ ----- + ----- + --------- + ----------- + ----- +
528 * | Flags | V | CNV | CNVNR | Rsvd | Serv Type | Serv Cmd Id | Rsvd |
529 * + ===== + --- + --- + ----- + ----- + --------- + ----------- + ----- + */
530 /**< @ingroup icp_qat_fw_comn
531 * Macros defining the bit position and mask of 'CNV' flag
532 * within the hdr_flags field of LW0 (service response only) */
533 #define ICP_QAT_FW_COMN_CNV_FLAG_BITPOS 6
534 #define ICP_QAT_FW_COMN_CNV_FLAG_MASK 0x1
535
536 /**< @ingroup icp_qat_fw_comn
537 * Macros defining the bit position and mask of CNVNR flag
538 * within the hdr_flags field of LW0 (service response only) */
539 #define ICP_QAT_FW_COMN_CNVNR_FLAG_BITPOS 5
540 #define ICP_QAT_FW_COMN_CNVNR_FLAG_MASK 0x1
541
542 /**< @ingroup icp_qat_fw_comn
543 * Macros defining the bit position and mask of Stored Blocks flag
544 * within the hdr_flags field of LW0 (service response only)
545 */
546 #define ICP_QAT_FW_COMN_ST_BLK_FLAG_BITPOS 4
547 #define ICP_QAT_FW_COMN_ST_BLK_FLAG_MASK 0x1
548
549 /**
550 ******************************************************************************
551 * @ingroup icp_qat_fw_comn
552 *
553 * @description
554 * Macro for extraction of Service Type Field
555 *
556 * @param icp_qat_fw_comn_req_hdr_t Structure 'icp_qat_fw_comn_req_hdr_t'
557 * to extract the Service Type Field
558 *
559 *****************************************************************************/
560 #define ICP_QAT_FW_COMN_OV_SRV_TYPE_GET(icp_qat_fw_comn_req_hdr_t) \
561 icp_qat_fw_comn_req_hdr_t.service_type
562
563 /**
564 ******************************************************************************
565 * @ingroup icp_qat_fw_comn
566 *
567 * @description
568 * Macro for setting of Service Type Field
569 *
570 * @param 'icp_qat_fw_comn_req_hdr_t' structure to set the Service
571 * Type Field
572 * @param val Value of the Service Type Field
573 *
574 *****************************************************************************/
575 #define ICP_QAT_FW_COMN_OV_SRV_TYPE_SET(icp_qat_fw_comn_req_hdr_t, val) \
576 icp_qat_fw_comn_req_hdr_t.service_type = val
577
578 /**
579 ******************************************************************************
580 * @ingroup icp_qat_fw_comn
581 *
582 * @description
583 * Macro for extraction of Service Command Id Field
584 *
585 * @param icp_qat_fw_comn_req_hdr_t Structure 'icp_qat_fw_comn_req_hdr_t'
586 * to extract the Service Command Id Field
587 *
588 *****************************************************************************/
589 #define ICP_QAT_FW_COMN_OV_SRV_CMD_ID_GET(icp_qat_fw_comn_req_hdr_t) \
590 icp_qat_fw_comn_req_hdr_t.service_cmd_id
591
592 /**
593 ******************************************************************************
594 * @ingroup icp_qat_fw_comn
595 *
596 * @description
597 * Macro for setting of Service Command Id Field
598 *
599 * @param 'icp_qat_fw_comn_req_hdr_t' structure to set the
600 * Service Command Id Field
601 * @param val Value of the Service Command Id Field
602 *
603 *****************************************************************************/
604 #define ICP_QAT_FW_COMN_OV_SRV_CMD_ID_SET(icp_qat_fw_comn_req_hdr_t, val) \
605 icp_qat_fw_comn_req_hdr_t.service_cmd_id = val
606
607 /**
608 ******************************************************************************
609 * @ingroup icp_qat_fw_comn
610 *
611 * @description
612 * Extract the valid flag from the request or response's header flags.
613 *
614 * @param hdr_t Request or Response 'hdr_t' structure to extract the valid bit
615 * from the 'hdr_flags' field.
616 *
617 *****************************************************************************/
618 #define ICP_QAT_FW_COMN_HDR_VALID_FLAG_GET(hdr_t) \
619 ICP_QAT_FW_COMN_VALID_FLAG_GET(hdr_t.hdr_flags)
620
621 /**
622 ******************************************************************************
623 * @ingroup icp_qat_fw_comn
624 *
625 * @description
626 * Extract the CNVNR flag from the header flags in the response only.
627 *
628 * @param hdr_t Response 'hdr_t' structure to extract the CNVNR bit
629 * from the 'hdr_flags' field.
630 *
631 *****************************************************************************/
632 #define ICP_QAT_FW_COMN_HDR_CNVNR_FLAG_GET(hdr_flags) \
633 QAT_FIELD_GET(hdr_flags, \
634 ICP_QAT_FW_COMN_CNVNR_FLAG_BITPOS, \
635 ICP_QAT_FW_COMN_CNVNR_FLAG_MASK)
636
637 /**
638 ******************************************************************************
639 * @ingroup icp_qat_fw_comn
640 *
641 * @description
642 * Extract the CNV flag from the header flags in the response only.
643 *
644 * @param hdr_t Response 'hdr_t' structure to extract the CNV bit
645 * from the 'hdr_flags' field.
646 *
647 *****************************************************************************/
648 #define ICP_QAT_FW_COMN_HDR_CNV_FLAG_GET(hdr_flags) \
649 QAT_FIELD_GET(hdr_flags, \
650 ICP_QAT_FW_COMN_CNV_FLAG_BITPOS, \
651 ICP_QAT_FW_COMN_CNV_FLAG_MASK)
652
653 /**
654 ******************************************************************************
655 * @ingroup icp_qat_fw_comn
656 *
657 * @description
658 * Set the valid bit in the request's header flags.
659 *
660 * @param hdr_t Request or Response 'hdr_t' structure to set the valid bit
661 * @param val Value of the valid bit flag.
662 *
663 *****************************************************************************/
664 #define ICP_QAT_FW_COMN_HDR_VALID_FLAG_SET(hdr_t, val) \
665 ICP_QAT_FW_COMN_VALID_FLAG_SET(hdr_t, val)
666
667 /**
668 ******************************************************************************
669 * @ingroup icp_qat_fw_comn
670 *
671 * @description
672 * Common macro to extract the valid flag from the header flags field
673 * within the header structure (request or response).
674 *
675 * @param hdr_t Structure (request or response) to extract the
676 * valid bit from the 'hdr_flags' field.
677 *
678 *****************************************************************************/
679 #define ICP_QAT_FW_COMN_VALID_FLAG_GET(hdr_flags) \
680 QAT_FIELD_GET(hdr_flags, \
681 ICP_QAT_FW_COMN_VALID_FLAG_BITPOS, \
682 ICP_QAT_FW_COMN_VALID_FLAG_MASK)
683
684 /**
685 ******************************************************************************
686 * @ingroup icp_qat_fw_comn
687 *
688 * @description
689 * Extract the Stored Block flag from the header flags in the
690 * response only.
691 *
692 * @param hdr_flags Response 'hdr' structure to extract the
693 * Stored Block bit from the 'hdr_flags' field.
694 *
695 *****************************************************************************/
696 #define ICP_QAT_FW_COMN_HDR_ST_BLK_FLAG_GET(hdr_flags) \
697 QAT_FIELD_GET(hdr_flags, \
698 ICP_QAT_FW_COMN_ST_BLK_FLAG_BITPOS, \
699 ICP_QAT_FW_COMN_ST_BLK_FLAG_MASK)
700
701 /**
702 ******************************************************************************
703 * @ingroup icp_qat_fw_comn
704 *
705 * @description
706 * Set the Stored Block bit in the response's header flags.
707 *
708 * @param hdr_t Response 'hdr_t' structure to set the ST_BLK bit
709 * @param val Value of the ST_BLK bit flag.
710 *
711 *****************************************************************************/
712 #define ICP_QAT_FW_COMN_HDR_ST_BLK_FLAG_SET(hdr_t, val) \
713 QAT_FIELD_SET((hdr_t.hdr_flags), \
714 (val), \
715 ICP_QAT_FW_COMN_ST_BLK_FLAG_BITPOS, \
716 ICP_QAT_FW_COMN_ST_BLK_FLAG_MASK)
717
718 /**
719 ******************************************************************************
720 * @ingroup icp_qat_fw_comn
721 *
722 * @description
723 * Set the generation bit in the request's header flags.
724 *
725 * @param hdr_t Request or Response 'hdr_t' structure to set the gen bit
726 * @param val Value of the generation bit flag.
727 *
728 *****************************************************************************/
729 #define ICP_QAT_FW_COMN_HDR_GENERATION_FLAG_SET(hdr_t, val) \
730 ICP_QAT_FW_COMN_GENERATION_FLAG_SET(hdr_t, val)
731
732 /**
733 ******************************************************************************
734 * @ingroup icp_qat_fw_comn
735 *
736 * @description
737 * Common macro to set the generation bit in the common header
738 *
739 * @param hdr_t Structure (request or response) containing the header
740 * flags field, to allow the generation bit to be set.
741 * @param val Value of the generation bit flag.
742 *
743 *****************************************************************************/
744 #define ICP_QAT_FW_COMN_GENERATION_FLAG_SET(hdr_t, val) \
745 QAT_FIELD_SET((hdr_t.hdr_flags), \
746 (val), \
747 ICP_QAT_FW_COMN_GEN_FLAG_BITPOS, \
748 ICP_QAT_FW_COMN_GEN_FLAG_MASK)
749
750 /**
751 ******************************************************************************
752 * @ingroup icp_qat_fw_comn
753 *
754 * @description
755 * Common macro to extract the generation flag from the header flags field
756 * within the header structure (request or response).
757 *
758 * @param hdr_t Structure (request or response) to extract the
759 * generation bit from the 'hdr_flags' field.
760 *
761 *****************************************************************************/
762
763 #define ICP_QAT_FW_COMN_HDR_GENERATION_FLAG_GET(hdr_flags) \
764 QAT_FIELD_GET(hdr_flags, \
765 ICP_QAT_FW_COMN_GEN_FLAG_BITPOS, \
766 ICP_QAT_FW_COMN_GEN_FLAG_MASK)
767 /**
768 ******************************************************************************
769 * @ingroup icp_qat_fw_comn
770 *
771 * @description
772 * Common macro to extract the remaining reserved flags from the header
773 flags field within the header structure (request or response).
774 *
775 * @param hdr_t Structure (request or response) to extract the
776 * remaining bits from the 'hdr_flags' field (excluding the
777 * valid flag).
778 *
779 *****************************************************************************/
780 #define ICP_QAT_FW_COMN_HDR_RESRVD_FLD_GET(hdr_flags) \
781 (hdr_flags & ICP_QAT_FW_COMN_HDR_RESRVD_FLD_MASK)
782
783 /**
784 ******************************************************************************
785 * @ingroup icp_qat_fw_comn
786 *
787 * @description
788 * Common macro to set the valid bit in the header flags field within
789 * the header structure (request or response).
790 *
791 * @param hdr_t Structure (request or response) containing the header
792 * flags field, to allow the valid bit to be set.
793 * @param val Value of the valid bit flag.
794 *
795 *****************************************************************************/
796 #define ICP_QAT_FW_COMN_VALID_FLAG_SET(hdr_t, val) \
797 QAT_FIELD_SET((hdr_t.hdr_flags), \
798 (val), \
799 ICP_QAT_FW_COMN_VALID_FLAG_BITPOS, \
800 ICP_QAT_FW_COMN_VALID_FLAG_MASK)
801
802 /**
803 ******************************************************************************
804 * @ingroup icp_qat_fw_comn
805 *
806 * @description
807 * Macro that must be used when building the common header flags.
808 * Note that all bits reserved field bits 0-6 (LW0) need to be forced to 0.
809 *
810 * @param ptr Value of the valid flag
811 *****************************************************************************/
812
813 #define ICP_QAT_FW_COMN_HDR_FLAGS_BUILD(valid) \
814 (((valid)&ICP_QAT_FW_COMN_VALID_FLAG_MASK) \
815 << ICP_QAT_FW_COMN_VALID_FLAG_BITPOS)
816
817 /*
818 * < @ingroup icp_qat_fw_comn
819 * Common Request Flags Definition
820 * The bit offsets below are within the flags field. These are NOT relative to
821 * the memory word. Unused fields e.g. reserved bits, must be zeroed.
822 *
823 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
824 * | Bits [15:8] | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
825 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
826 * | Flags[15:8] | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv |
827 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
828 * | Bits [7:0] | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
829 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
830 * | Flags [7:0] | Rsv | Rsv | Rsv | Rsv | Rsv | BnP | Cdt | Ptr |
831 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
832 */
833
834 #define QAT_COMN_PTR_TYPE_BITPOS 0
835 /**< @ingroup icp_qat_fw_comn
836 * Common Request Flags - Starting bit position indicating
837 * Src&Dst Buffer Pointer type */
838
839 #define QAT_COMN_PTR_TYPE_MASK 0x1
840 /**< @ingroup icp_qat_fw_comn
841 * Common Request Flags - One bit mask used to determine
842 * Src&Dst Buffer Pointer type */
843
844 #define QAT_COMN_CD_FLD_TYPE_BITPOS 1
845 /**< @ingroup icp_qat_fw_comn
846 * Common Request Flags - Starting bit position indicating
847 * CD Field type */
848
849 #define QAT_COMN_CD_FLD_TYPE_MASK 0x1
850 /**< @ingroup icp_qat_fw_comn
851 * Common Request Flags - One bit mask used to determine
852 * CD Field type */
853
854 #define QAT_COMN_BNP_ENABLED_BITPOS 2
855 /**< @ingroup icp_qat_fw_comn
856 * Common Request Flags - Starting bit position indicating
857 * the source buffer contains batch of requests. if this
858 * bit is set, source buffer is type of Batch And Pack OpData List
859 * and the Ptr Type Bit only applies to Destination buffer. */
860
861 #define QAT_COMN_BNP_ENABLED_MASK 0x1
862 /**< @ingroup icp_qat_fw_comn
863 * Batch And Pack Enabled Flag Mask - One bit mask used to determine
864 * the source buffer is in Batch and Pack OpData Link List Mode. */
865
866 /* ========================================================================= */
867 /* Pointer Type Flag definitions */
868 /* ========================================================================= */
869 #define QAT_COMN_PTR_TYPE_FLAT 0x0
870 /**< @ingroup icp_qat_fw_comn
871 * Constant value indicating Src&Dst Buffer Pointer type is flat
872 * If Batch and Pack mode is enabled, only applies to Destination buffer.*/
873
874 #define QAT_COMN_PTR_TYPE_SGL 0x1
875 /**< @ingroup icp_qat_fw_comn
876 * Constant value indicating Src&Dst Buffer Pointer type is SGL type
877 * If Batch and Pack mode is enabled, only applies to Destination buffer.*/
878
879 #define QAT_COMN_PTR_TYPE_BATCH 0x2
880 /**< @ingroup icp_qat_fw_comn
881 * Constant value indicating Src is a batch request
882 * and Dst Buffer Pointer type is SGL type */
883
884 /* ========================================================================= */
885 /* CD Field Flag definitions */
886 /* ========================================================================= */
887 #define QAT_COMN_CD_FLD_TYPE_64BIT_ADR 0x0
888 /**< @ingroup icp_qat_fw_comn
889 * Constant value indicating CD Field contains 64-bit address */
890
891 #define QAT_COMN_CD_FLD_TYPE_16BYTE_DATA 0x1
892 /**< @ingroup icp_qat_fw_comn
893 * Constant value indicating CD Field contains 16 bytes of setup data */
894
895 /* ========================================================================= */
896 /* Batch And Pack Enable/Disable Definitions */
897 /* ========================================================================= */
898 #define QAT_COMN_BNP_ENABLED 0x1
899 /**< @ingroup icp_qat_fw_comn
900 * Constant value indicating Source buffer will point to Batch And Pack OpData
901 * List */
902
903 #define QAT_COMN_BNP_DISABLED 0x0
904 /**< @ingroup icp_qat_fw_comn
905 * Constant value indicating Source buffer will point to Batch And Pack OpData
906 * List */
907
908 /**
909 ******************************************************************************
910 * @ingroup icp_qat_fw_comn
911 *
912 * @description
913 * Macro that must be used when building the common request flags (for all
914 * requests but comp BnP).
915 * Note that all bits reserved field bits 2-15 (LW1) need to be forced to 0.
916 *
917 * @param ptr Value of the pointer type flag
918 * @param cdt Value of the cd field type flag
919 *****************************************************************************/
920 #define ICP_QAT_FW_COMN_FLAGS_BUILD(cdt, ptr) \
921 ((((cdt)&QAT_COMN_CD_FLD_TYPE_MASK) << QAT_COMN_CD_FLD_TYPE_BITPOS) | \
922 (((ptr)&QAT_COMN_PTR_TYPE_MASK) << QAT_COMN_PTR_TYPE_BITPOS))
923
924 /**
925 ******************************************************************************
926 * @ingroup icp_qat_fw_comn
927 *
928 * @description
929 * Macro that must be used when building the common request flags for comp
930 * BnP service.
931 * Note that all bits reserved field bits 3-15 (LW1) need to be forced to 0.
932 *
933 * @param ptr Value of the pointer type flag
934 * @param cdt Value of the cd field type flag
935 * @param bnp Value of the bnp enabled flag
936 *****************************************************************************/
937 #define ICP_QAT_FW_COMN_FLAGS_BUILD_BNP(cdt, ptr, bnp) \
938 ((((cdt)&QAT_COMN_CD_FLD_TYPE_MASK) << QAT_COMN_CD_FLD_TYPE_BITPOS) | \
939 (((ptr)&QAT_COMN_PTR_TYPE_MASK) << QAT_COMN_PTR_TYPE_BITPOS) | \
940 (((bnp)&QAT_COMN_BNP_ENABLED_MASK) << QAT_COMN_BNP_ENABLED_BITPOS))
941
942 /**
943 ******************************************************************************
944 * @ingroup icp_qat_fw_comn
945 *
946 * @description
947 * Macro for extraction of the pointer type bit from the common flags
948 *
949 * @param flags Flags to extract the pointer type bit from
950 *
951 *****************************************************************************/
952 #define ICP_QAT_FW_COMN_PTR_TYPE_GET(flags) \
953 QAT_FIELD_GET(flags, QAT_COMN_PTR_TYPE_BITPOS, QAT_COMN_PTR_TYPE_MASK)
954
955 /**
956 ******************************************************************************
957 * @ingroup icp_qat_fw_comn
958 *
959 * @description
960 * Macro for extraction of the cd field type bit from the common flags
961 *
962 * @param flags Flags to extract the cd field type type bit from
963 *
964 *****************************************************************************/
965 #define ICP_QAT_FW_COMN_CD_FLD_TYPE_GET(flags) \
966 QAT_FIELD_GET(flags, \
967 QAT_COMN_CD_FLD_TYPE_BITPOS, \
968 QAT_COMN_CD_FLD_TYPE_MASK)
969
970 /**
971 ******************************************************************************
972 * @ingroup icp_qat_fw_comn
973 *
974 * @description
975 * Macro for extraction of the bnp field type bit from the common flags
976 *
977 * @param flags Flags to extract the bnp field type type bit from
978 *
979 *****************************************************************************/
980 #define ICP_QAT_FW_COMN_BNP_ENABLED_GET(flags) \
981 QAT_FIELD_GET(flags, \
982 QAT_COMN_BNP_ENABLED_BITPOS, \
983 QAT_COMN_BNP_ENABLED_MASK)
984
985 /**
986 ******************************************************************************
987 * @ingroup icp_qat_fw_comn
988 *
989 * @description
990 * Macro for setting the pointer type bit in the common flags
991 *
992 * @param flags Flags in which Pointer Type bit will be set
993 * @param val Value of the bit to be set in flags
994 *
995 *****************************************************************************/
996 #define ICP_QAT_FW_COMN_PTR_TYPE_SET(flags, val) \
997 QAT_FIELD_SET(flags, \
998 val, \
999 QAT_COMN_PTR_TYPE_BITPOS, \
1000 QAT_COMN_PTR_TYPE_MASK)
1001
1002 /**
1003 ******************************************************************************
1004 * @ingroup icp_qat_fw_comn
1005 *
1006 * @description
1007 * Macro for setting the cd field type bit in the common flags
1008 *
1009 * @param flags Flags in which Cd Field Type bit will be set
1010 * @param val Value of the bit to be set in flags
1011 *
1012 *****************************************************************************/
1013 #define ICP_QAT_FW_COMN_CD_FLD_TYPE_SET(flags, val) \
1014 QAT_FIELD_SET(flags, \
1015 val, \
1016 QAT_COMN_CD_FLD_TYPE_BITPOS, \
1017 QAT_COMN_CD_FLD_TYPE_MASK)
1018
1019 /**
1020 ******************************************************************************
1021 * @ingroup icp_qat_fw_comn
1022 *
1023 * @description
1024 * Macro for setting the bnp field type bit in the common flags
1025 *
1026 * @param flags Flags in which Bnp Field Type bit will be set
1027 * @param val Value of the bit to be set in flags
1028 *
1029 *****************************************************************************/
1030 #define ICP_QAT_FW_COMN_BNP_ENABLE_SET(flags, val) \
1031 QAT_FIELD_SET(flags, \
1032 val, \
1033 QAT_COMN_BNP_ENABLED_BITPOS, \
1034 QAT_COMN_BNP_ENABLED_MASK)
1035
1036 /**
1037 ******************************************************************************
1038 * @ingroup icp_qat_fw_comn
1039 *
1040 * @description
1041 * Macros using the bit position and mask to set/extract the next
1042 * and current id nibbles within the next_curr_id field of the
1043 * content descriptor header block. Note that these are defined
1044 * in the common header file, as they are used by compression, cipher
1045 * and authentication.
1046 *
1047 * @param cd_ctrl_hdr_t Content descriptor control block header pointer.
1048 * @param val Value of the field being set.
1049 *
1050 *****************************************************************************/
1051 #define ICP_QAT_FW_COMN_NEXT_ID_BITPOS 4
1052 #define ICP_QAT_FW_COMN_NEXT_ID_MASK 0xF0
1053 #define ICP_QAT_FW_COMN_CURR_ID_BITPOS 0
1054 #define ICP_QAT_FW_COMN_CURR_ID_MASK 0x0F
1055
1056 #define ICP_QAT_FW_COMN_NEXT_ID_GET(cd_ctrl_hdr_t) \
1057 ((((cd_ctrl_hdr_t)->next_curr_id) & ICP_QAT_FW_COMN_NEXT_ID_MASK) >> \
1058 (ICP_QAT_FW_COMN_NEXT_ID_BITPOS))
1059
1060 #define ICP_QAT_FW_COMN_NEXT_ID_SET(cd_ctrl_hdr_t, val) \
1061 ((cd_ctrl_hdr_t)->next_curr_id) = \
1062 ((((cd_ctrl_hdr_t)->next_curr_id) & \
1063 ICP_QAT_FW_COMN_CURR_ID_MASK) | \
1064 ((val << ICP_QAT_FW_COMN_NEXT_ID_BITPOS) & \
1065 ICP_QAT_FW_COMN_NEXT_ID_MASK))
1066
1067 #define ICP_QAT_FW_COMN_CURR_ID_GET(cd_ctrl_hdr_t) \
1068 (((cd_ctrl_hdr_t)->next_curr_id) & ICP_QAT_FW_COMN_CURR_ID_MASK)
1069
1070 #define ICP_QAT_FW_COMN_CURR_ID_SET(cd_ctrl_hdr_t, val) \
1071 ((cd_ctrl_hdr_t)->next_curr_id) = \
1072 ((((cd_ctrl_hdr_t)->next_curr_id) & \
1073 ICP_QAT_FW_COMN_NEXT_ID_MASK) | \
1074 ((val)&ICP_QAT_FW_COMN_CURR_ID_MASK))
1075
1076 /*
1077 * < @ingroup icp_qat_fw_comn
1078 * Common Status Field Definition The bit offsets below are within the COMMON
1079 * RESPONSE status field, assumed to be 8 bits wide. In the case of the PKE
1080 * response (which follows the CPM 1.5 message format), the status field is 16
1081 * bits wide.
1082 * The status flags are contained within the most significant byte and align
1083 * with the diagram below. Please therefore refer to the service-specific PKE
1084 * header file for the appropriate macro definition to extract the PKE status
1085 * flag from the PKE response, which assumes that a word is passed to the
1086 * macro.
1087 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- +
1088 * | Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1089 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- +
1090 * | Flags | Crypto | Pke | Cmp | Xlat | EOLB | UnSupReq | Rsvd | XltWaApply |
1091 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- +
1092 * Note:
1093 * For the service specific status bit definitions refer to service header files
1094 * Eg. Crypto Status bit refers to Symmetric Crypto, Key Generation, and NRBG
1095 * Requests' Status. Unused bits e.g. reserved bits need to have been forced to
1096 * 0.
1097 */
1098
1099 #define QAT_COMN_RESP_CRYPTO_STATUS_BITPOS 7
1100 /**< @ingroup icp_qat_fw_comn
1101 * Starting bit position indicating Response for Crypto service Flag */
1102
1103 #define QAT_COMN_RESP_CRYPTO_STATUS_MASK 0x1
1104 /**< @ingroup icp_qat_fw_comn
1105 * One bit mask used to determine Crypto status mask */
1106
1107 #define QAT_COMN_RESP_PKE_STATUS_BITPOS 6
1108 /**< @ingroup icp_qat_fw_comn
1109 * Starting bit position indicating Response for PKE service Flag */
1110
1111 #define QAT_COMN_RESP_PKE_STATUS_MASK 0x1
1112 /**< @ingroup icp_qat_fw_comn
1113 * One bit mask used to determine PKE status mask */
1114
1115 #define QAT_COMN_RESP_CMP_STATUS_BITPOS 5
1116 /**< @ingroup icp_qat_fw_comn
1117 * Starting bit position indicating Response for Compression service Flag */
1118
1119 #define QAT_COMN_RESP_CMP_STATUS_MASK 0x1
1120 /**< @ingroup icp_qat_fw_comn
1121 * One bit mask used to determine Compression status mask */
1122
1123 #define QAT_COMN_RESP_XLAT_STATUS_BITPOS 4
1124 /**< @ingroup icp_qat_fw_comn
1125 * Starting bit position indicating Response for Xlat service Flag */
1126
1127 #define QAT_COMN_RESP_XLAT_STATUS_MASK 0x1
1128 /**< @ingroup icp_qat_fw_comn
1129 * One bit mask used to determine Translator status mask */
1130
1131 #define QAT_COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS 3
1132 /**< @ingroup icp_qat_fw_comn
1133 * Starting bit position indicating the last block in a deflate stream for
1134 the compression service Flag */
1135
1136 #define QAT_COMN_RESP_CMP_END_OF_LAST_BLK_MASK 0x1
1137 /**< @ingroup icp_qat_fw_comn
1138 * One bit mask used to determine the last block in a deflate stream
1139 status mask */
1140
1141 #define QAT_COMN_RESP_UNSUPPORTED_REQUEST_BITPOS 2
1142 /**< @ingroup icp_qat_fw_comn
1143 * Starting bit position indicating when an unsupported service request Flag */
1144
1145 #define QAT_COMN_RESP_UNSUPPORTED_REQUEST_MASK 0x1
1146 /**< @ingroup icp_qat_fw_comn
1147 * One bit mask used to determine the unsupported service request status mask */
1148
1149 #define QAT_COMN_RESP_XLT_INV_APPLIED_BITPOS 0
1150 /**< @ingroup icp_qat_fw_comn
1151 * Bit position indicating that firmware detected an invalid translation during
1152 * dynamic compression and took measures to overcome this
1153 *
1154 */
1155
1156 #define QAT_COMN_RESP_XLT_INV_APPLIED_MASK 0x1
1157 /**< @ingroup icp_qat_fw_comn
1158 * One bit mask */
1159
1160 /**
1161 ******************************************************************************
1162 * @description
1163 * Macro that must be used when building the status
1164 * for the common response
1165 *
1166 * @param crypto Value of the Crypto Service status flag
1167 * @param comp Value of the Compression Service Status flag
1168 * @param xlat Value of the Xlator Status flag
1169 * @param eolb Value of the Compression End of Last Block Status flag
1170 * @param unsupp Value of the Unsupported Request flag
1171 * @param xlt_inv Value of the Invalid Translation flag
1172 *****************************************************************************/
1173 #define ICP_QAT_FW_COMN_RESP_STATUS_BUILD( \
1174 crypto, pke, comp, xlat, eolb, unsupp, xlt_inv) \
1175 ((((crypto)&QAT_COMN_RESP_CRYPTO_STATUS_MASK) \
1176 << QAT_COMN_RESP_CRYPTO_STATUS_BITPOS) | \
1177 (((pke)&QAT_COMN_RESP_PKE_STATUS_MASK) \
1178 << QAT_COMN_RESP_PKE_STATUS_BITPOS) | \
1179 (((xlt_inv)&QAT_COMN_RESP_XLT_INV_APPLIED_MASK) \
1180 << QAT_COMN_RESP_XLT_INV_APPLIED_BITPOS) | \
1181 (((comp)&QAT_COMN_RESP_CMP_STATUS_MASK) \
1182 << QAT_COMN_RESP_CMP_STATUS_BITPOS) | \
1183 (((xlat)&QAT_COMN_RESP_XLAT_STATUS_MASK) \
1184 << QAT_COMN_RESP_XLAT_STATUS_BITPOS) | \
1185 (((eolb)&QAT_COMN_RESP_CMP_END_OF_LAST_BLK_MASK) \
1186 << QAT_COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS) | \
1187 (((unsupp)&QAT_COMN_RESP_UNSUPPORTED_REQUEST_BITPOS) \
1188 << QAT_COMN_RESP_UNSUPPORTED_REQUEST_MASK))
1189
1190 /* ========================================================================= */
1191 /* GETTERS */
1192 /* ========================================================================= */
1193 /**
1194 ******************************************************************************
1195 * @ingroup icp_qat_fw_comn
1196 *
1197 * @description
1198 * Macro for extraction of the Crypto bit from the status
1199 *
1200 * @param status
1201 * Status to extract the status bit from
1202 *
1203 *****************************************************************************/
1204 #define ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET(status) \
1205 QAT_FIELD_GET(status, \
1206 QAT_COMN_RESP_CRYPTO_STATUS_BITPOS, \
1207 QAT_COMN_RESP_CRYPTO_STATUS_MASK)
1208
1209 /**
1210 ******************************************************************************
1211 * @ingroup icp_qat_fw_comn
1212 *
1213 * @description
1214 * Macro for extraction of the PKE bit from the status
1215 *
1216 * @param status
1217 * Status to extract the status bit from
1218 *
1219 *****************************************************************************/
1220 #define ICP_QAT_FW_COMN_RESP_PKE_STAT_GET(status) \
1221 QAT_FIELD_GET(status, \
1222 QAT_COMN_RESP_PKE_STATUS_BITPOS, \
1223 QAT_COMN_RESP_PKE_STATUS_MASK)
1224
1225 /**
1226 ******************************************************************************
1227 * @ingroup icp_qat_fw_comn
1228 *
1229 * @description
1230 * Macro for extraction of the Compression bit from the status
1231 *
1232 * @param status
1233 * Status to extract the status bit from
1234 *
1235 *****************************************************************************/
1236 #define ICP_QAT_FW_COMN_RESP_CMP_STAT_GET(status) \
1237 QAT_FIELD_GET(status, \
1238 QAT_COMN_RESP_CMP_STATUS_BITPOS, \
1239 QAT_COMN_RESP_CMP_STATUS_MASK)
1240
1241 /**
1242 ******************************************************************************
1243 * @ingroup icp_qat_fw_comn
1244 *
1245 * @description
1246 * Macro for extraction of the Translator bit from the status
1247 *
1248 * @param status
1249 * Status to extract the status bit from
1250 *
1251 *****************************************************************************/
1252 #define ICP_QAT_FW_COMN_RESP_XLAT_STAT_GET(status) \
1253 QAT_FIELD_GET(status, \
1254 QAT_COMN_RESP_XLAT_STATUS_BITPOS, \
1255 QAT_COMN_RESP_XLAT_STATUS_MASK)
1256
1257 /**
1258 ******************************************************************************
1259 * @ingroup icp_qat_fw_comn
1260 *
1261 * @description
1262 * Macro for extraction of the Translation Invalid bit
1263 * from the status
1264 *
1265 * @param status
1266 * Status to extract the status bit from
1267 *
1268 *****************************************************************************/
1269 #define ICP_QAT_FW_COMN_RESP_XLT_INV_APPLIED_GET(status) \
1270 QAT_FIELD_GET(status, \
1271 QAT_COMN_RESP_XLT_INV_APPLIED_BITPOS, \
1272 QAT_COMN_RESP_XLT_INV_APPLIED_MASK)
1273
1274 /**
1275 ******************************************************************************
1276 * @ingroup icp_qat_fw_comn
1277 *
1278 * @description
1279 * Macro for extraction of the end of compression block bit from the
1280 * status
1281 *
1282 * @param status
1283 * Status to extract the status bit from
1284 *
1285 *****************************************************************************/
1286 #define ICP_QAT_FW_COMN_RESP_CMP_END_OF_LAST_BLK_FLAG_GET(status) \
1287 QAT_FIELD_GET(status, \
1288 QAT_COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS, \
1289 QAT_COMN_RESP_CMP_END_OF_LAST_BLK_MASK)
1290
1291 /**
1292 ******************************************************************************
1293 * @ingroup icp_qat_fw_comn
1294 *
1295 * @description
1296 * Macro for extraction of the Unsupported request from the status
1297 *
1298 * @param status
1299 * Status to extract the status bit from
1300 *
1301 *****************************************************************************/
1302 #define ICP_QAT_FW_COMN_RESP_UNSUPPORTED_REQUEST_STAT_GET(status) \
1303 QAT_FIELD_GET(status, \
1304 QAT_COMN_RESP_UNSUPPORTED_REQUEST_BITPOS, \
1305 QAT_COMN_RESP_UNSUPPORTED_REQUEST_MASK)
1306
1307 /* ========================================================================= */
1308 /* Status Flag definitions */
1309 /* ========================================================================= */
1310
1311 #define ICP_QAT_FW_COMN_STATUS_FLAG_OK 0
1312 /**< @ingroup icp_qat_fw_comn
1313 * Definition of successful processing of a request */
1314
1315 #define ICP_QAT_FW_COMN_STATUS_FLAG_ERROR 1
1316 /**< @ingroup icp_qat_fw_comn
1317 * Definition of erroneous processing of a request */
1318
1319 #define ICP_QAT_FW_COMN_STATUS_CMP_END_OF_LAST_BLK_FLAG_CLR 0
1320 /**< @ingroup icp_qat_fw_comn
1321 * Final Deflate block of a compression request not completed */
1322
1323 #define ICP_QAT_FW_COMN_STATUS_CMP_END_OF_LAST_BLK_FLAG_SET 1
1324 /**< @ingroup icp_qat_fw_comn
1325 * Final Deflate block of a compression request completed */
1326
1327 #define ERR_CODE_NO_ERROR 0
1328 /**< Error Code constant value for no error */
1329
1330 #define ERR_CODE_INVALID_BLOCK_TYPE -1
1331 /* Invalid block type (type == 3)*/
1332
1333 #define ERR_CODE_NO_MATCH_ONES_COMP -2
1334 /* Stored block length does not match one's complement */
1335
1336 #define ERR_CODE_TOO_MANY_LEN_OR_DIS -3
1337 /* Too many length or distance codes */
1338
1339 #define ERR_CODE_INCOMPLETE_LEN -4
1340 /* Code lengths codes incomplete */
1341
1342 #define ERR_CODE_RPT_LEN_NO_FIRST_LEN -5
1343 /* Repeat lengths with no first length */
1344
1345 #define ERR_CODE_RPT_GT_SPEC_LEN -6
1346 /* Repeat more than specified lengths */
1347
1348 #define ERR_CODE_INV_LIT_LEN_CODE_LEN -7
1349 /* Invalid lit/len code lengths */
1350
1351 #define ERR_CODE_INV_DIS_CODE_LEN -8
1352 /* Invalid distance code lengths */
1353
1354 #define ERR_CODE_INV_LIT_LEN_DIS_IN_BLK -9
1355 /* Invalid lit/len or distance code in fixed/dynamic block */
1356
1357 #define ERR_CODE_DIS_TOO_FAR_BACK -10
1358 /* Distance too far back in fixed or dynamic block */
1359
1360 /* Common Error code definitions */
1361 #define ERR_CODE_OVERFLOW_ERROR -11
1362 /**< Error Code constant value for overflow error */
1363
1364 #define ERR_CODE_SOFT_ERROR -12
1365 /**< Error Code constant value for soft error */
1366
1367 #define ERR_CODE_FATAL_ERROR -13
1368 /**< Error Code constant value for hard/fatal error */
1369
1370 #define ERR_CODE_COMP_OUTPUT_CORRUPTION -14
1371 /**< Error Code constant for compression output corruption */
1372
1373 #define ERR_CODE_HW_INCOMPLETE_FILE -15
1374 /**< Error Code constant value for incomplete file hardware error */
1375
1376 #define ERR_CODE_SSM_ERROR -16
1377 /**< Error Code constant value for error detected by SSM e.g. slice hang */
1378
1379 #define ERR_CODE_ENDPOINT_ERROR -17
1380 /**< Error Code constant value for error detected by PCIe Endpoint, e.g. push
1381 * data error */
1382
1383 #define ERR_CODE_CNV_ERROR -18
1384 /**< Error Code constant value for cnv failure */
1385
1386 #define ERR_CODE_EMPTY_DYM_BLOCK -19
1387 /**< Error Code constant value for submission of empty dynamic stored block to
1388 * slice */
1389
1390 #define ERR_CODE_EXCEED_MAX_REQ_TIME -24
1391 /**< Error Code constant for exceeding max request time */
1392
1393 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_INVALID_HANDLE -20
1394 /**< Error Code constant for invalid handle in kpt crypto service */
1395
1396 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_HMAC_FAILED -21
1397 /**< Error Code constant for failed hmac in kpt crypto service */
1398
1399 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_INVALID_WRAPPING_ALGO -22
1400 /**< Error Code constant for invalid wrapping algo in kpt crypto service */
1401
1402 #define ERR_CODE_KPT_DRNG_SEED_NOT_LOAD -23
1403 /**< Error Code constant for no drng seed is not loaded in kpt ecdsa signrs
1404 /service */
1405
1406 #define ERR_CODE_MISC_ERROR -50
1407 /**< Error Code constant for error detected but the source
1408 * of error is not recognized */
1409
1410 /**
1411 *****************************************************************************
1412 * @ingroup icp_qat_fw_comn
1413 * Slice types for building of the processing chain within the content
1414 * descriptor
1415 *
1416 * @description
1417 * Enumeration used to indicate the ids of the slice types through which
1418 * data will pass.
1419 *
1420 * A logical slice is not a hardware slice but is a software FSM
1421 * performing the actions of a slice
1422 *
1423 *****************************************************************************/
1424
1425 typedef enum {
1426 ICP_QAT_FW_SLICE_NULL = 0, /**< NULL slice type */
1427 ICP_QAT_FW_SLICE_CIPHER = 1, /**< CIPHER slice type */
1428 ICP_QAT_FW_SLICE_AUTH = 2, /**< AUTH slice type */
1429 ICP_QAT_FW_SLICE_DRAM_RD = 3, /**< DRAM_RD Logical slice type */
1430 ICP_QAT_FW_SLICE_DRAM_WR = 4, /**< DRAM_WR Logical slice type */
1431 ICP_QAT_FW_SLICE_COMP = 5, /**< Compression slice type */
1432 ICP_QAT_FW_SLICE_XLAT = 6, /**< Translator slice type */
1433 ICP_QAT_FW_SLICE_DELIMITER /**< End delimiter */
1434
1435 } icp_qat_fw_slice_t;
1436
1437 #endif /* _ICP_QAT_FW_H_ */
Cache object: e1407d0ddde63512fd537df3701bf8c8
|