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