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 - 24 | 21 - 16 | 15 - 8 | 7 - 0 | 491 * + ===== + ---- + ----------- + ----------- + ----------- + ----------- + 492 * | Flags | V | Reserved | Serv Type | Serv Cmd Id | Reserved | 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 #define ICP_QAT_FW_COMN_HDR_RESRVD_FLD_MASK 0x7F 509 510 /* Common QAT FW response header - structure of LW0 511 * + ===== + --- + --- + ----- + ----- + --------- + ----------- + ----- + 512 * | Bit | 31 | 30 | 29 | 28-24 | 21 - 16 | 15 - 8 | 7-0 | 513 * + ===== + --- + ----+ ----- + ----- + --------- + ----------- + ----- + 514 * | Flags | V | CNV | CNVNR | Rsvd | Serv Type | Serv Cmd Id | Rsvd | 515 * + ===== + --- + --- + ----- + ----- + --------- + ----------- + ----- + */ 516 /**< @ingroup icp_qat_fw_comn 517 * Macros defining the bit position and mask of 'CNV' flag 518 * within the hdr_flags field of LW0 (service response only) */ 519 #define ICP_QAT_FW_COMN_CNV_FLAG_BITPOS 6 520 #define ICP_QAT_FW_COMN_CNV_FLAG_MASK 0x1 521 522 /**< @ingroup icp_qat_fw_comn 523 * Macros defining the bit position and mask of CNVNR flag 524 * within the hdr_flags field of LW0 (service response only) */ 525 #define ICP_QAT_FW_COMN_CNVNR_FLAG_BITPOS 5 526 #define ICP_QAT_FW_COMN_CNVNR_FLAG_MASK 0x1 527 528 /** 529 ****************************************************************************** 530 * @ingroup icp_qat_fw_comn 531 * 532 * @description 533 * Macro for extraction of Service Type Field 534 * 535 * @param icp_qat_fw_comn_req_hdr_t Structure 'icp_qat_fw_comn_req_hdr_t' 536 * to extract the Service Type Field 537 * 538 *****************************************************************************/ 539 #define ICP_QAT_FW_COMN_OV_SRV_TYPE_GET(icp_qat_fw_comn_req_hdr_t) \ 540 icp_qat_fw_comn_req_hdr_t.service_type 541 542 /** 543 ****************************************************************************** 544 * @ingroup icp_qat_fw_comn 545 * 546 * @description 547 * Macro for setting of Service Type Field 548 * 549 * @param 'icp_qat_fw_comn_req_hdr_t' structure to set the Service 550 * Type Field 551 * @param val Value of the Service Type Field 552 * 553 *****************************************************************************/ 554 #define ICP_QAT_FW_COMN_OV_SRV_TYPE_SET(icp_qat_fw_comn_req_hdr_t, val) \ 555 icp_qat_fw_comn_req_hdr_t.service_type = val 556 557 /** 558 ****************************************************************************** 559 * @ingroup icp_qat_fw_comn 560 * 561 * @description 562 * Macro for extraction of Service Command Id Field 563 * 564 * @param icp_qat_fw_comn_req_hdr_t Structure 'icp_qat_fw_comn_req_hdr_t' 565 * to extract the Service Command Id Field 566 * 567 *****************************************************************************/ 568 #define ICP_QAT_FW_COMN_OV_SRV_CMD_ID_GET(icp_qat_fw_comn_req_hdr_t) \ 569 icp_qat_fw_comn_req_hdr_t.service_cmd_id 570 571 /** 572 ****************************************************************************** 573 * @ingroup icp_qat_fw_comn 574 * 575 * @description 576 * Macro for setting of Service Command Id Field 577 * 578 * @param 'icp_qat_fw_comn_req_hdr_t' structure to set the 579 * Service Command Id Field 580 * @param val Value of the Service Command Id Field 581 * 582 *****************************************************************************/ 583 #define ICP_QAT_FW_COMN_OV_SRV_CMD_ID_SET(icp_qat_fw_comn_req_hdr_t, val) \ 584 icp_qat_fw_comn_req_hdr_t.service_cmd_id = val 585 586 /** 587 ****************************************************************************** 588 * @ingroup icp_qat_fw_comn 589 * 590 * @description 591 * Extract the valid flag from the request or response's header flags. 592 * 593 * @param hdr_t Request or Response 'hdr_t' structure to extract the valid bit 594 * from the 'hdr_flags' field. 595 * 596 *****************************************************************************/ 597 #define ICP_QAT_FW_COMN_HDR_VALID_FLAG_GET(hdr_t) \ 598 ICP_QAT_FW_COMN_VALID_FLAG_GET(hdr_t.hdr_flags) 599 600 /** 601 ****************************************************************************** 602 * @ingroup icp_qat_fw_comn 603 * 604 * @description 605 * Extract the CNVNR flag from the header flags in the response only. 606 * 607 * @param hdr_t Response 'hdr_t' structure to extract the CNVNR bit 608 * from the 'hdr_flags' field. 609 * 610 *****************************************************************************/ 611 #define ICP_QAT_FW_COMN_HDR_CNVNR_FLAG_GET(hdr_flags) \ 612 QAT_FIELD_GET(hdr_flags, \ 613 ICP_QAT_FW_COMN_CNVNR_FLAG_BITPOS, \ 614 ICP_QAT_FW_COMN_CNVNR_FLAG_MASK) 615 616 /** 617 ****************************************************************************** 618 * @ingroup icp_qat_fw_comn 619 * 620 * @description 621 * Extract the CNV flag from the header flags in the response only. 622 * 623 * @param hdr_t Response 'hdr_t' structure to extract the CNV bit 624 * from the 'hdr_flags' field. 625 * 626 *****************************************************************************/ 627 #define ICP_QAT_FW_COMN_HDR_CNV_FLAG_GET(hdr_flags) \ 628 QAT_FIELD_GET(hdr_flags, \ 629 ICP_QAT_FW_COMN_CNV_FLAG_BITPOS, \ 630 ICP_QAT_FW_COMN_CNV_FLAG_MASK) 631 632 /** 633 ****************************************************************************** 634 * @ingroup icp_qat_fw_comn 635 * 636 * @description 637 * Set the valid bit in the request's header flags. 638 * 639 * @param hdr_t Request or Response 'hdr_t' structure to set the valid bit 640 * @param val Value of the valid bit flag. 641 * 642 *****************************************************************************/ 643 #define ICP_QAT_FW_COMN_HDR_VALID_FLAG_SET(hdr_t, val) \ 644 ICP_QAT_FW_COMN_VALID_FLAG_SET(hdr_t, val) 645 646 /** 647 ****************************************************************************** 648 * @ingroup icp_qat_fw_comn 649 * 650 * @description 651 * Common macro to extract the valid flag from the header flags field 652 * within the header structure (request or response). 653 * 654 * @param hdr_t Structure (request or response) to extract the 655 * valid bit from the 'hdr_flags' field. 656 * 657 *****************************************************************************/ 658 #define ICP_QAT_FW_COMN_VALID_FLAG_GET(hdr_flags) \ 659 QAT_FIELD_GET(hdr_flags, \ 660 ICP_QAT_FW_COMN_VALID_FLAG_BITPOS, \ 661 ICP_QAT_FW_COMN_VALID_FLAG_MASK) 662 663 /** 664 ****************************************************************************** 665 * @ingroup icp_qat_fw_comn 666 * 667 * @description 668 * Common macro to extract the remaining reserved flags from the header 669 flags field within the header structure (request or response). 670 * 671 * @param hdr_t Structure (request or response) to extract the 672 * remaining bits from the 'hdr_flags' field (excluding the 673 * valid flag). 674 * 675 *****************************************************************************/ 676 #define ICP_QAT_FW_COMN_HDR_RESRVD_FLD_GET(hdr_flags) \ 677 (hdr_flags & ICP_QAT_FW_COMN_HDR_RESRVD_FLD_MASK) 678 679 /** 680 ****************************************************************************** 681 * @ingroup icp_qat_fw_comn 682 * 683 * @description 684 * Common macro to set the valid bit in the header flags field within 685 * the header structure (request or response). 686 * 687 * @param hdr_t Structure (request or response) containing the header 688 * flags field, to allow the valid bit to be set. 689 * @param val Value of the valid bit flag. 690 * 691 *****************************************************************************/ 692 #define ICP_QAT_FW_COMN_VALID_FLAG_SET(hdr_t, val) \ 693 QAT_FIELD_SET((hdr_t.hdr_flags), \ 694 (val), \ 695 ICP_QAT_FW_COMN_VALID_FLAG_BITPOS, \ 696 ICP_QAT_FW_COMN_VALID_FLAG_MASK) 697 698 /** 699 ****************************************************************************** 700 * @ingroup icp_qat_fw_comn 701 * 702 * @description 703 * Macro that must be used when building the common header flags. 704 * Note that all bits reserved field bits 0-6 (LW0) need to be forced to 0. 705 * 706 * @param ptr Value of the valid flag 707 *****************************************************************************/ 708 709 #define ICP_QAT_FW_COMN_HDR_FLAGS_BUILD(valid) \ 710 (((valid)&ICP_QAT_FW_COMN_VALID_FLAG_MASK) \ 711 << ICP_QAT_FW_COMN_VALID_FLAG_BITPOS) 712 713 /* 714 * < @ingroup icp_qat_fw_comn 715 * Common Request Flags Definition 716 * The bit offsets below are within the flags field. These are NOT relative to 717 * the memory word. Unused fields e.g. reserved bits, must be zeroed. 718 * 719 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 720 * | Bits [15:8] | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 721 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 722 * | Flags[15:8] | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | 723 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 724 * | Bits [7:0] | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 725 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 726 * | Flags [7:0] | Rsv | Rsv | Rsv | Rsv | Rsv | BnP | Cdt | Ptr | 727 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 728 */ 729 730 #define QAT_COMN_PTR_TYPE_BITPOS 0 731 /**< @ingroup icp_qat_fw_comn 732 * Common Request Flags - Starting bit position indicating 733 * Src&Dst Buffer Pointer type */ 734 735 #define QAT_COMN_PTR_TYPE_MASK 0x1 736 /**< @ingroup icp_qat_fw_comn 737 * Common Request Flags - One bit mask used to determine 738 * Src&Dst Buffer Pointer type */ 739 740 #define QAT_COMN_CD_FLD_TYPE_BITPOS 1 741 /**< @ingroup icp_qat_fw_comn 742 * Common Request Flags - Starting bit position indicating 743 * CD Field type */ 744 745 #define QAT_COMN_CD_FLD_TYPE_MASK 0x1 746 /**< @ingroup icp_qat_fw_comn 747 * Common Request Flags - One bit mask used to determine 748 * CD Field type */ 749 750 #define QAT_COMN_BNP_ENABLED_BITPOS 2 751 /**< @ingroup icp_qat_fw_comn 752 * Common Request Flags - Starting bit position indicating 753 * the source buffer contains batch of requests. if this 754 * bit is set, source buffer is type of Batch And Pack OpData List 755 * and the Ptr Type Bit only applies to Destination buffer. */ 756 757 #define QAT_COMN_BNP_ENABLED_MASK 0x1 758 /**< @ingroup icp_qat_fw_comn 759 * Batch And Pack Enabled Flag Mask - One bit mask used to determine 760 * the source buffer is in Batch and Pack OpData Link List Mode. */ 761 762 /* ========================================================================= */ 763 /* Pointer Type Flag definitions */ 764 /* ========================================================================= */ 765 #define QAT_COMN_PTR_TYPE_FLAT 0x0 766 /**< @ingroup icp_qat_fw_comn 767 * Constant value indicating Src&Dst Buffer Pointer type is flat 768 * If Batch and Pack mode is enabled, only applies to Destination buffer.*/ 769 770 #define QAT_COMN_PTR_TYPE_SGL 0x1 771 /**< @ingroup icp_qat_fw_comn 772 * Constant value indicating Src&Dst Buffer Pointer type is SGL type 773 * If Batch and Pack mode is enabled, only applies to Destination buffer.*/ 774 775 #define QAT_COMN_PTR_TYPE_BATCH 0x2 776 /**< @ingroup icp_qat_fw_comn 777 * Constant value indicating Src is a batch request 778 * and Dst Buffer Pointer type is SGL type */ 779 780 /* ========================================================================= */ 781 /* CD Field Flag definitions */ 782 /* ========================================================================= */ 783 #define QAT_COMN_CD_FLD_TYPE_64BIT_ADR 0x0 784 /**< @ingroup icp_qat_fw_comn 785 * Constant value indicating CD Field contains 64-bit address */ 786 787 #define QAT_COMN_CD_FLD_TYPE_16BYTE_DATA 0x1 788 /**< @ingroup icp_qat_fw_comn 789 * Constant value indicating CD Field contains 16 bytes of setup data */ 790 791 /* ========================================================================= */ 792 /* Batch And Pack Enable/Disable Definitions */ 793 /* ========================================================================= */ 794 #define QAT_COMN_BNP_ENABLED 0x1 795 /**< @ingroup icp_qat_fw_comn 796 * Constant value indicating Source buffer will point to Batch And Pack OpData 797 * List */ 798 799 #define QAT_COMN_BNP_DISABLED 0x0 800 /**< @ingroup icp_qat_fw_comn 801 * Constant value indicating Source buffer will point to Batch And Pack OpData 802 * List */ 803 804 /** 805 ****************************************************************************** 806 * @ingroup icp_qat_fw_comn 807 * 808 * @description 809 * Macro that must be used when building the common request flags (for all 810 * requests but comp BnP). 811 * Note that all bits reserved field bits 2-15 (LW1) need to be forced to 0. 812 * 813 * @param ptr Value of the pointer type flag 814 * @param cdt Value of the cd field type flag 815 *****************************************************************************/ 816 #define ICP_QAT_FW_COMN_FLAGS_BUILD(cdt, ptr) \ 817 ((((cdt)&QAT_COMN_CD_FLD_TYPE_MASK) << QAT_COMN_CD_FLD_TYPE_BITPOS) | \ 818 (((ptr)&QAT_COMN_PTR_TYPE_MASK) << QAT_COMN_PTR_TYPE_BITPOS)) 819 820 /** 821 ****************************************************************************** 822 * @ingroup icp_qat_fw_comn 823 * 824 * @description 825 * Macro that must be used when building the common request flags for comp 826 * BnP service. 827 * Note that all bits reserved field bits 3-15 (LW1) need to be forced to 0. 828 * 829 * @param ptr Value of the pointer type flag 830 * @param cdt Value of the cd field type flag 831 * @param bnp Value of the bnp enabled flag 832 *****************************************************************************/ 833 #define ICP_QAT_FW_COMN_FLAGS_BUILD_BNP(cdt, ptr, bnp) \ 834 ((((cdt)&QAT_COMN_CD_FLD_TYPE_MASK) << QAT_COMN_CD_FLD_TYPE_BITPOS) | \ 835 (((ptr)&QAT_COMN_PTR_TYPE_MASK) << QAT_COMN_PTR_TYPE_BITPOS) | \ 836 (((bnp)&QAT_COMN_BNP_ENABLED_MASK) << QAT_COMN_BNP_ENABLED_BITPOS)) 837 838 /** 839 ****************************************************************************** 840 * @ingroup icp_qat_fw_comn 841 * 842 * @description 843 * Macro for extraction of the pointer type bit from the common flags 844 * 845 * @param flags Flags to extract the pointer type bit from 846 * 847 *****************************************************************************/ 848 #define ICP_QAT_FW_COMN_PTR_TYPE_GET(flags) \ 849 QAT_FIELD_GET(flags, QAT_COMN_PTR_TYPE_BITPOS, QAT_COMN_PTR_TYPE_MASK) 850 851 /** 852 ****************************************************************************** 853 * @ingroup icp_qat_fw_comn 854 * 855 * @description 856 * Macro for extraction of the cd field type bit from the common flags 857 * 858 * @param flags Flags to extract the cd field type type bit from 859 * 860 *****************************************************************************/ 861 #define ICP_QAT_FW_COMN_CD_FLD_TYPE_GET(flags) \ 862 QAT_FIELD_GET(flags, \ 863 QAT_COMN_CD_FLD_TYPE_BITPOS, \ 864 QAT_COMN_CD_FLD_TYPE_MASK) 865 866 /** 867 ****************************************************************************** 868 * @ingroup icp_qat_fw_comn 869 * 870 * @description 871 * Macro for extraction of the bnp field type bit from the common flags 872 * 873 * @param flags Flags to extract the bnp field type type bit from 874 * 875 *****************************************************************************/ 876 #define ICP_QAT_FW_COMN_BNP_ENABLED_GET(flags) \ 877 QAT_FIELD_GET(flags, \ 878 QAT_COMN_BNP_ENABLED_BITPOS, \ 879 QAT_COMN_BNP_ENABLED_MASK) 880 881 /** 882 ****************************************************************************** 883 * @ingroup icp_qat_fw_comn 884 * 885 * @description 886 * Macro for setting the pointer type bit in the common flags 887 * 888 * @param flags Flags in which Pointer Type bit will be set 889 * @param val Value of the bit to be set in flags 890 * 891 *****************************************************************************/ 892 #define ICP_QAT_FW_COMN_PTR_TYPE_SET(flags, val) \ 893 QAT_FIELD_SET(flags, \ 894 val, \ 895 QAT_COMN_PTR_TYPE_BITPOS, \ 896 QAT_COMN_PTR_TYPE_MASK) 897 898 /** 899 ****************************************************************************** 900 * @ingroup icp_qat_fw_comn 901 * 902 * @description 903 * Macro for setting the cd field type bit in the common flags 904 * 905 * @param flags Flags in which Cd Field Type bit will be set 906 * @param val Value of the bit to be set in flags 907 * 908 *****************************************************************************/ 909 #define ICP_QAT_FW_COMN_CD_FLD_TYPE_SET(flags, val) \ 910 QAT_FIELD_SET(flags, \ 911 val, \ 912 QAT_COMN_CD_FLD_TYPE_BITPOS, \ 913 QAT_COMN_CD_FLD_TYPE_MASK) 914 915 /** 916 ****************************************************************************** 917 * @ingroup icp_qat_fw_comn 918 * 919 * @description 920 * Macro for setting the bnp field type bit in the common flags 921 * 922 * @param flags Flags in which Bnp Field Type bit will be set 923 * @param val Value of the bit to be set in flags 924 * 925 *****************************************************************************/ 926 #define ICP_QAT_FW_COMN_BNP_ENABLE_SET(flags, val) \ 927 QAT_FIELD_SET(flags, \ 928 val, \ 929 QAT_COMN_BNP_ENABLED_BITPOS, \ 930 QAT_COMN_BNP_ENABLED_MASK) 931 932 /** 933 ****************************************************************************** 934 * @ingroup icp_qat_fw_comn 935 * 936 * @description 937 * Macros using the bit position and mask to set/extract the next 938 * and current id nibbles within the next_curr_id field of the 939 * content descriptor header block. Note that these are defined 940 * in the common header file, as they are used by compression, cipher 941 * and authentication. 942 * 943 * @param cd_ctrl_hdr_t Content descriptor control block header pointer. 944 * @param val Value of the field being set. 945 * 946 *****************************************************************************/ 947 #define ICP_QAT_FW_COMN_NEXT_ID_BITPOS 4 948 #define ICP_QAT_FW_COMN_NEXT_ID_MASK 0xF0 949 #define ICP_QAT_FW_COMN_CURR_ID_BITPOS 0 950 #define ICP_QAT_FW_COMN_CURR_ID_MASK 0x0F 951 952 #define ICP_QAT_FW_COMN_NEXT_ID_GET(cd_ctrl_hdr_t) \ 953 ((((cd_ctrl_hdr_t)->next_curr_id) & ICP_QAT_FW_COMN_NEXT_ID_MASK) >> \ 954 (ICP_QAT_FW_COMN_NEXT_ID_BITPOS)) 955 956 #define ICP_QAT_FW_COMN_NEXT_ID_SET(cd_ctrl_hdr_t, val) \ 957 ((cd_ctrl_hdr_t)->next_curr_id) = \ 958 ((((cd_ctrl_hdr_t)->next_curr_id) & \ 959 ICP_QAT_FW_COMN_CURR_ID_MASK) | \ 960 ((val << ICP_QAT_FW_COMN_NEXT_ID_BITPOS) & \ 961 ICP_QAT_FW_COMN_NEXT_ID_MASK)) 962 963 #define ICP_QAT_FW_COMN_CURR_ID_GET(cd_ctrl_hdr_t) \ 964 (((cd_ctrl_hdr_t)->next_curr_id) & ICP_QAT_FW_COMN_CURR_ID_MASK) 965 966 #define ICP_QAT_FW_COMN_CURR_ID_SET(cd_ctrl_hdr_t, val) \ 967 ((cd_ctrl_hdr_t)->next_curr_id) = \ 968 ((((cd_ctrl_hdr_t)->next_curr_id) & \ 969 ICP_QAT_FW_COMN_NEXT_ID_MASK) | \ 970 ((val)&ICP_QAT_FW_COMN_CURR_ID_MASK)) 971 972 /* 973 * < @ingroup icp_qat_fw_comn 974 * Common Status Field Definition The bit offsets below are within the COMMON 975 * RESPONSE status field, assumed to be 8 bits wide. In the case of the PKE 976 * response (which follows the CPM 1.5 message format), the status field is 16 977 * bits wide. 978 * The status flags are contained within the most significant byte and align 979 * with the diagram below. Please therefore refer to the service-specific PKE 980 * header file for the appropriate macro definition to extract the PKE status 981 * flag from the PKE response, which assumes that a word is passed to the 982 * macro. 983 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- + 984 * | Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 985 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- + 986 * | Flags | Crypto | Pke | Cmp | Xlat | EOLB | UnSupReq | Rsvd | XltWaApply | 987 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- + 988 * Note: 989 * For the service specific status bit definitions refer to service header files 990 * Eg. Crypto Status bit refers to Symmetric Crypto, Key Generation, and NRBG 991 * Requests' Status. Unused bits e.g. reserved bits need to have been forced to 992 * 0. 993 */ 994 995 #define QAT_COMN_RESP_CRYPTO_STATUS_BITPOS 7 996 /**< @ingroup icp_qat_fw_comn 997 * Starting bit position indicating Response for Crypto service Flag */ 998 999 #define QAT_COMN_RESP_CRYPTO_STATUS_MASK 0x1 1000 /**< @ingroup icp_qat_fw_comn 1001 * One bit mask used to determine Crypto status mask */ 1002 1003 #define QAT_COMN_RESP_PKE_STATUS_BITPOS 6 1004 /**< @ingroup icp_qat_fw_comn 1005 * Starting bit position indicating Response for PKE service Flag */ 1006 1007 #define QAT_COMN_RESP_PKE_STATUS_MASK 0x1 1008 /**< @ingroup icp_qat_fw_comn 1009 * One bit mask used to determine PKE status mask */ 1010 1011 #define QAT_COMN_RESP_CMP_STATUS_BITPOS 5 1012 /**< @ingroup icp_qat_fw_comn 1013 * Starting bit position indicating Response for Compression service Flag */ 1014 1015 #define QAT_COMN_RESP_CMP_STATUS_MASK 0x1 1016 /**< @ingroup icp_qat_fw_comn 1017 * One bit mask used to determine Compression status mask */ 1018 1019 #define QAT_COMN_RESP_XLAT_STATUS_BITPOS 4 1020 /**< @ingroup icp_qat_fw_comn 1021 * Starting bit position indicating Response for Xlat service Flag */ 1022 1023 #define QAT_COMN_RESP_XLAT_STATUS_MASK 0x1 1024 /**< @ingroup icp_qat_fw_comn 1025 * One bit mask used to determine Translator status mask */ 1026 1027 #define QAT_COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS 3 1028 /**< @ingroup icp_qat_fw_comn 1029 * Starting bit position indicating the last block in a deflate stream for 1030 the compression service Flag */ 1031 1032 #define QAT_COMN_RESP_CMP_END_OF_LAST_BLK_MASK 0x1 1033 /**< @ingroup icp_qat_fw_comn 1034 * One bit mask used to determine the last block in a deflate stream 1035 status mask */ 1036 1037 #define QAT_COMN_RESP_UNSUPPORTED_REQUEST_BITPOS 2 1038 /**< @ingroup icp_qat_fw_comn 1039 * Starting bit position indicating when an unsupported service request Flag */ 1040 1041 #define QAT_COMN_RESP_UNSUPPORTED_REQUEST_MASK 0x1 1042 /**< @ingroup icp_qat_fw_comn 1043 * One bit mask used to determine the unsupported service request status mask */ 1044 1045 #define QAT_COMN_RESP_XLT_INV_APPLIED_BITPOS 0 1046 /**< @ingroup icp_qat_fw_comn 1047 * Bit position indicating that firmware detected an invalid translation during 1048 * dynamic compression and took measures to overcome this 1049 * 1050 */ 1051 1052 #define QAT_COMN_RESP_XLT_INV_APPLIED_MASK 0x1 1053 /**< @ingroup icp_qat_fw_comn 1054 * One bit mask */ 1055 1056 /** 1057 ****************************************************************************** 1058 * @description 1059 * Macro that must be used when building the status 1060 * for the common response 1061 * 1062 * @param crypto Value of the Crypto Service status flag 1063 * @param comp Value of the Compression Service Status flag 1064 * @param xlat Value of the Xlator Status flag 1065 * @param eolb Value of the Compression End of Last Block Status flag 1066 * @param unsupp Value of the Unsupported Request flag 1067 * @param xlt_inv Value of the Invalid Translation flag 1068 *****************************************************************************/ 1069 #define ICP_QAT_FW_COMN_RESP_STATUS_BUILD( \ 1070 crypto, pke, comp, xlat, eolb, unsupp, xlt_inv) \ 1071 ((((crypto)&QAT_COMN_RESP_CRYPTO_STATUS_MASK) \ 1072 << QAT_COMN_RESP_CRYPTO_STATUS_BITPOS) | \ 1073 (((pke)&QAT_COMN_RESP_PKE_STATUS_MASK) \ 1074 << QAT_COMN_RESP_PKE_STATUS_BITPOS) | \ 1075 (((xlt_inv)&QAT_COMN_RESP_XLT_INV_APPLIED_MASK) \ 1076 << QAT_COMN_RESP_XLT_INV_APPLIED_BITPOS) | \ 1077 (((comp)&QAT_COMN_RESP_CMP_STATUS_MASK) \ 1078 << QAT_COMN_RESP_CMP_STATUS_BITPOS) | \ 1079 (((xlat)&QAT_COMN_RESP_XLAT_STATUS_MASK) \ 1080 << QAT_COMN_RESP_XLAT_STATUS_BITPOS) | \ 1081 (((eolb)&QAT_COMN_RESP_CMP_END_OF_LAST_BLK_MASK) \ 1082 << QAT_COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS) | \ 1083 (((unsupp)&QAT_COMN_RESP_UNSUPPORTED_REQUEST_BITPOS) \ 1084 << QAT_COMN_RESP_UNSUPPORTED_REQUEST_MASK)) 1085 1086 /* ========================================================================= */ 1087 /* GETTERS */ 1088 /* ========================================================================= */ 1089 /** 1090 ****************************************************************************** 1091 * @ingroup icp_qat_fw_comn 1092 * 1093 * @description 1094 * Macro for extraction of the Crypto bit from the status 1095 * 1096 * @param status 1097 * Status to extract the status bit from 1098 * 1099 *****************************************************************************/ 1100 #define ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET(status) \ 1101 QAT_FIELD_GET(status, \ 1102 QAT_COMN_RESP_CRYPTO_STATUS_BITPOS, \ 1103 QAT_COMN_RESP_CRYPTO_STATUS_MASK) 1104 1105 /** 1106 ****************************************************************************** 1107 * @ingroup icp_qat_fw_comn 1108 * 1109 * @description 1110 * Macro for extraction of the PKE bit from the status 1111 * 1112 * @param status 1113 * Status to extract the status bit from 1114 * 1115 *****************************************************************************/ 1116 #define ICP_QAT_FW_COMN_RESP_PKE_STAT_GET(status) \ 1117 QAT_FIELD_GET(status, \ 1118 QAT_COMN_RESP_PKE_STATUS_BITPOS, \ 1119 QAT_COMN_RESP_PKE_STATUS_MASK) 1120 1121 /** 1122 ****************************************************************************** 1123 * @ingroup icp_qat_fw_comn 1124 * 1125 * @description 1126 * Macro for extraction of the Compression bit from the status 1127 * 1128 * @param status 1129 * Status to extract the status bit from 1130 * 1131 *****************************************************************************/ 1132 #define ICP_QAT_FW_COMN_RESP_CMP_STAT_GET(status) \ 1133 QAT_FIELD_GET(status, \ 1134 QAT_COMN_RESP_CMP_STATUS_BITPOS, \ 1135 QAT_COMN_RESP_CMP_STATUS_MASK) 1136 1137 /** 1138 ****************************************************************************** 1139 * @ingroup icp_qat_fw_comn 1140 * 1141 * @description 1142 * Macro for extraction of the Translator bit from the status 1143 * 1144 * @param status 1145 * Status to extract the status bit from 1146 * 1147 *****************************************************************************/ 1148 #define ICP_QAT_FW_COMN_RESP_XLAT_STAT_GET(status) \ 1149 QAT_FIELD_GET(status, \ 1150 QAT_COMN_RESP_XLAT_STATUS_BITPOS, \ 1151 QAT_COMN_RESP_XLAT_STATUS_MASK) 1152 1153 /** 1154 ****************************************************************************** 1155 * @ingroup icp_qat_fw_comn 1156 * 1157 * @description 1158 * Macro for extraction of the Translation Invalid bit 1159 * from the status 1160 * 1161 * @param status 1162 * Status to extract the status bit from 1163 * 1164 *****************************************************************************/ 1165 #define ICP_QAT_FW_COMN_RESP_XLT_INV_APPLIED_GET(status) \ 1166 QAT_FIELD_GET(status, \ 1167 QAT_COMN_RESP_XLT_INV_APPLIED_BITPOS, \ 1168 QAT_COMN_RESP_XLT_INV_APPLIED_MASK) 1169 1170 /** 1171 ****************************************************************************** 1172 * @ingroup icp_qat_fw_comn 1173 * 1174 * @description 1175 * Macro for extraction of the end of compression block bit from the 1176 * status 1177 * 1178 * @param status 1179 * Status to extract the status bit from 1180 * 1181 *****************************************************************************/ 1182 #define ICP_QAT_FW_COMN_RESP_CMP_END_OF_LAST_BLK_FLAG_GET(status) \ 1183 QAT_FIELD_GET(status, \ 1184 QAT_COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS, \ 1185 QAT_COMN_RESP_CMP_END_OF_LAST_BLK_MASK) 1186 1187 /** 1188 ****************************************************************************** 1189 * @ingroup icp_qat_fw_comn 1190 * 1191 * @description 1192 * Macro for extraction of the Unsupported request from the status 1193 * 1194 * @param status 1195 * Status to extract the status bit from 1196 * 1197 *****************************************************************************/ 1198 #define ICP_QAT_FW_COMN_RESP_UNSUPPORTED_REQUEST_STAT_GET(status) \ 1199 QAT_FIELD_GET(status, \ 1200 QAT_COMN_RESP_UNSUPPORTED_REQUEST_BITPOS, \ 1201 QAT_COMN_RESP_UNSUPPORTED_REQUEST_MASK) 1202 1203 /* ========================================================================= */ 1204 /* Status Flag definitions */ 1205 /* ========================================================================= */ 1206 1207 #define ICP_QAT_FW_COMN_STATUS_FLAG_OK 0 1208 /**< @ingroup icp_qat_fw_comn 1209 * Definition of successful processing of a request */ 1210 1211 #define ICP_QAT_FW_COMN_STATUS_FLAG_ERROR 1 1212 /**< @ingroup icp_qat_fw_comn 1213 * Definition of erroneous processing of a request */ 1214 1215 #define ICP_QAT_FW_COMN_STATUS_CMP_END_OF_LAST_BLK_FLAG_CLR 0 1216 /**< @ingroup icp_qat_fw_comn 1217 * Final Deflate block of a compression request not completed */ 1218 1219 #define ICP_QAT_FW_COMN_STATUS_CMP_END_OF_LAST_BLK_FLAG_SET 1 1220 /**< @ingroup icp_qat_fw_comn 1221 * Final Deflate block of a compression request completed */ 1222 1223 #define ERR_CODE_NO_ERROR 0 1224 /**< Error Code constant value for no error */ 1225 1226 #define ERR_CODE_INVALID_BLOCK_TYPE -1 1227 /* Invalid block type (type == 3)*/ 1228 1229 #define ERR_CODE_NO_MATCH_ONES_COMP -2 1230 /* Stored block length does not match one's complement */ 1231 1232 #define ERR_CODE_TOO_MANY_LEN_OR_DIS -3 1233 /* Too many length or distance codes */ 1234 1235 #define ERR_CODE_INCOMPLETE_LEN -4 1236 /* Code lengths codes incomplete */ 1237 1238 #define ERR_CODE_RPT_LEN_NO_FIRST_LEN -5 1239 /* Repeat lengths with no first length */ 1240 1241 #define ERR_CODE_RPT_GT_SPEC_LEN -6 1242 /* Repeat more than specified lengths */ 1243 1244 #define ERR_CODE_INV_LIT_LEN_CODE_LEN -7 1245 /* Invalid lit/len code lengths */ 1246 1247 #define ERR_CODE_INV_DIS_CODE_LEN -8 1248 /* Invalid distance code lengths */ 1249 1250 #define ERR_CODE_INV_LIT_LEN_DIS_IN_BLK -9 1251 /* Invalid lit/len or distance code in fixed/dynamic block */ 1252 1253 #define ERR_CODE_DIS_TOO_FAR_BACK -10 1254 /* Distance too far back in fixed or dynamic block */ 1255 1256 /* Common Error code definitions */ 1257 #define ERR_CODE_OVERFLOW_ERROR -11 1258 /**< Error Code constant value for overflow error */ 1259 1260 #define ERR_CODE_SOFT_ERROR -12 1261 /**< Error Code constant value for soft error */ 1262 1263 #define ERR_CODE_FATAL_ERROR -13 1264 /**< Error Code constant value for hard/fatal error */ 1265 1266 #define ERR_CODE_COMP_OUTPUT_CORRUPTION -14 1267 /**< Error Code constant for compression output corruption */ 1268 1269 #define ERR_CODE_HW_INCOMPLETE_FILE -15 1270 /**< Error Code constant value for incomplete file hardware error */ 1271 1272 #define ERR_CODE_SSM_ERROR -16 1273 /**< Error Code constant value for error detected by SSM e.g. slice hang */ 1274 1275 #define ERR_CODE_ENDPOINT_ERROR -17 1276 /**< Error Code constant value for error detected by PCIe Endpoint, e.g. push 1277 * data error */ 1278 1279 #define ERR_CODE_CNV_ERROR -18 1280 /**< Error Code constant value for cnv failure */ 1281 1282 #define ERR_CODE_EMPTY_DYM_BLOCK -19 1283 /**< Error Code constant value for submission of empty dynamic stored block to 1284 * slice */ 1285 1286 #define ERR_CODE_EXCEED_MAX_REQ_TIME -24 1287 /**< Error Code constant for exceeding max request time */ 1288 1289 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_INVALID_HANDLE -20 1290 /**< Error Code constant for invalid handle in kpt crypto service */ 1291 1292 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_HMAC_FAILED -21 1293 /**< Error Code constant for failed hmac in kpt crypto service */ 1294 1295 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_INVALID_WRAPPING_ALGO -22 1296 /**< Error Code constant for invalid wrapping algo in kpt crypto service */ 1297 1298 #define ERR_CODE_KPT_DRNG_SEED_NOT_LOAD -23 1299 /**< Error Code constant for no drng seed is not loaded in kpt ecdsa signrs 1300 /service */ 1301 1302 #define ERR_CODE_MISC_ERROR -50 1303 /**< Error Code constant for error detected but the source 1304 * of error is not recognized */ 1305 1306 /** 1307 ***************************************************************************** 1308 * @ingroup icp_qat_fw_comn 1309 * Slice types for building of the processing chain within the content 1310 * descriptor 1311 * 1312 * @description 1313 * Enumeration used to indicate the ids of the slice types through which 1314 * data will pass. 1315 * 1316 * A logical slice is not a hardware slice but is a software FSM 1317 * performing the actions of a slice 1318 * 1319 *****************************************************************************/ 1320 1321 typedef enum { 1322 ICP_QAT_FW_SLICE_NULL = 0, /**< NULL slice type */ 1323 ICP_QAT_FW_SLICE_CIPHER = 1, /**< CIPHER slice type */ 1324 ICP_QAT_FW_SLICE_AUTH = 2, /**< AUTH slice type */ 1325 ICP_QAT_FW_SLICE_DRAM_RD = 3, /**< DRAM_RD Logical slice type */ 1326 ICP_QAT_FW_SLICE_DRAM_WR = 4, /**< DRAM_WR Logical slice type */ 1327 ICP_QAT_FW_SLICE_COMP = 5, /**< Compression slice type */ 1328 ICP_QAT_FW_SLICE_XLAT = 6, /**< Translator slice type */ 1329 ICP_QAT_FW_SLICE_DELIMITER /**< End delimiter */ 1330 1331 } icp_qat_fw_slice_t; 1332 1333 #endif /* _ICP_QAT_FW_H_ */ 1334