1 /* SPDX-License-Identifier: BSD-2-Clause AND BSD-3-Clause */ 2 /* $NetBSD: qat_hw17reg.h,v 1.1 2019/11/20 09:37:46 hikaru Exp $ */ 3 4 /* 5 * Copyright (c) 2019 Internet Initiative Japan, Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 /* 31 * Copyright(c) 2014 Intel Corporation. 32 * Redistribution and use in source and binary forms, with or without 33 * modification, are permitted provided that the following conditions 34 * are met: 35 * 36 * * Redistributions of source code must retain the above copyright 37 * notice, this list of conditions and the following disclaimer. 38 * * Redistributions in binary form must reproduce the above copyright 39 * notice, this list of conditions and the following disclaimer in 40 * the documentation and/or other materials provided with the 41 * distribution. 42 * * Neither the name of Intel Corporation nor the names of its 43 * contributors may be used to endorse or promote products derived 44 * from this software without specific prior written permission. 45 * 46 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 47 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 48 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 49 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 50 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 51 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 52 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 53 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 54 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 55 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 56 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 57 */ 58 59 60 #ifndef _DEV_PCI_QAT_HW17REG_H_ 61 #define _DEV_PCI_QAT_HW17REG_H_ 62 63 /* Default message size in bytes */ 64 #define FW_REQ_DEFAULT_SZ_HW17 128 65 #define FW_RESP_DEFAULT_SZ_HW17 32 66 67 /* -------------------------------------------------------------------------- */ 68 /* accel */ 69 70 enum fw_init_admin_cmd_id { 71 FW_INIT_ME = 0, 72 FW_TRNG_ENABLE = 1, 73 FW_TRNG_DISABLE = 2, 74 FW_CONSTANTS_CFG = 3, 75 FW_STATUS_GET = 4, 76 FW_COUNTERS_GET = 5, 77 FW_LOOPBACK = 6, 78 FW_HEARTBEAT_SYNC = 7, 79 FW_HEARTBEAT_GET = 8, 80 FW_COMP_CAPABILITY_GET = 9, 81 FW_CRYPTO_CAPABILITY_GET = 10, 82 FW_HEARTBEAT_TIMER_SET = 13, 83 }; 84 85 enum fw_init_admin_resp_status { 86 FW_INIT_RESP_STATUS_SUCCESS = 0, 87 FW_INIT_RESP_STATUS_FAIL = 1, 88 FW_INIT_RESP_STATUS_UNSUPPORTED = 4 89 }; 90 91 struct fw_init_admin_req { 92 uint16_t init_cfg_sz; 93 uint8_t resrvd1; 94 uint8_t init_admin_cmd_id; 95 uint32_t resrvd2; 96 uint64_t opaque_data; 97 uint64_t init_cfg_ptr; 98 99 union { 100 struct { 101 uint16_t ibuf_size_in_kb; 102 uint16_t resrvd3; 103 }; 104 uint32_t heartbeat_ticks; 105 }; 106 107 uint32_t resrvd4; 108 }; 109 110 struct fw_init_admin_resp_hdr { 111 uint8_t flags; 112 uint8_t resrvd1; 113 uint8_t status; 114 uint8_t init_admin_cmd_id; 115 }; 116 117 enum fw_init_admin_init_flag { 118 FW_INIT_FLAG_PKE_DISABLED = 0 119 }; 120 121 struct fw_init_admin_fw_capability_resp_hdr { 122 uint16_t reserved; 123 uint8_t status; 124 uint8_t init_admin_cmd_id; 125 }; 126 127 struct fw_init_admin_capability_resp { 128 struct fw_init_admin_fw_capability_resp_hdr init_resp_hdr; 129 uint32_t extended_features; 130 uint64_t opaque_data; 131 union { 132 struct { 133 uint16_t compression_algos; 134 uint16_t checksum_algos; 135 uint32_t deflate_capabilities; 136 uint32_t resrvd1; 137 uint32_t lzs_capabilities; 138 } compression; 139 struct { 140 uint32_t cipher_algos; 141 uint32_t hash_algos; 142 uint16_t keygen_algos; 143 uint16_t other; 144 uint16_t public_key_algos; 145 uint16_t prime_algos; 146 } crypto; 147 }; 148 }; 149 150 struct fw_init_admin_resp_pars { 151 union { 152 uint32_t resrvd1[4]; 153 struct { 154 uint32_t version_patch_num; 155 uint8_t context_id; 156 uint8_t ae_id; 157 uint16_t resrvd1; 158 uint64_t resrvd2; 159 } s1; 160 struct { 161 uint64_t req_rec_count; 162 uint64_t resp_sent_count; 163 } s2; 164 } u; 165 }; 166 167 struct fw_init_admin_hb_cnt { 168 uint16_t resp_heartbeat_cnt; 169 uint16_t req_heartbeat_cnt; 170 }; 171 172 #define QAT_NUM_THREADS 8 173 174 struct fw_init_admin_hb_stats { 175 struct fw_init_admin_hb_cnt stats[QAT_NUM_THREADS]; 176 }; 177 178 struct fw_init_admin_resp { 179 struct fw_init_admin_resp_hdr init_resp_hdr; 180 union { 181 uint32_t resrvd2; 182 struct { 183 uint16_t version_minor_num; 184 uint16_t version_major_num; 185 } s; 186 } u; 187 uint64_t opaque_data; 188 struct fw_init_admin_resp_pars init_resp_pars; 189 }; 190 191 #define FW_COMN_HEARTBEAT_OK 0 192 #define FW_COMN_HEARTBEAT_BLOCKED 1 193 #define FW_COMN_HEARTBEAT_FLAG_BITPOS 0 194 #define FW_COMN_HEARTBEAT_FLAG_MASK 0x1 195 #define FW_COMN_STATUS_RESRVD_FLD_MASK 0xFE 196 #define FW_COMN_HEARTBEAT_HDR_FLAG_GET(hdr_t) \ 197 FW_COMN_HEARTBEAT_FLAG_GET(hdr_t.flags) 198 199 #define FW_COMN_HEARTBEAT_HDR_FLAG_SET(hdr_t, val) \ 200 FW_COMN_HEARTBEAT_FLAG_SET(hdr_t, val) 201 202 #define FW_COMN_HEARTBEAT_FLAG_GET(flags) \ 203 QAT_FIELD_GET(flags, \ 204 FW_COMN_HEARTBEAT_FLAG_BITPOS, \ 205 FW_COMN_HEARTBEAT_FLAG_MASK) 206 207 /* -------------------------------------------------------------------------- */ 208 209 /* Big assumptions that both bitpos and mask are constants */ 210 #define FIELD_SET(flags, val, bitpos, mask) \ 211 (flags) = \ 212 (((flags) & (~((mask) << (bitpos)))) | (((val) & (mask)) << (bitpos))) 213 214 #define FIELD_GET(flags, bitpos, mask) (((flags) >> (bitpos)) & (mask)) 215 216 #define FLAG_SET(flags, bitpos) (flags) = ((flags) | (1 << (bitpos))) 217 218 #define FLAG_CLEAR(flags, bitpos) (flags) = ((flags) & (~(1 << (bitpos)))) 219 220 #define FLAG_GET(flags, bitpos) (((flags) >> (bitpos)) & 1) 221 222 /* Default request and response ring size in bytes */ 223 #define FW_REQ_DEFAULT_SZ 128 224 #define FW_RESP_DEFAULT_SZ 32 225 226 #define FW_COMN_ONE_BYTE_SHIFT 8 227 #define FW_COMN_SINGLE_BYTE_MASK 0xFF 228 229 /* Common Request - Block sizes definitions in multiples of individual long 230 * words */ 231 #define FW_NUM_LONGWORDS_1 1 232 #define FW_NUM_LONGWORDS_2 2 233 #define FW_NUM_LONGWORDS_3 3 234 #define FW_NUM_LONGWORDS_4 4 235 #define FW_NUM_LONGWORDS_5 5 236 #define FW_NUM_LONGWORDS_6 6 237 #define FW_NUM_LONGWORDS_7 7 238 #define FW_NUM_LONGWORDS_10 10 239 #define FW_NUM_LONGWORDS_13 13 240 241 /* Definition of the associated service Id for NULL service type. 242 Note: the response is expected to use FW_COMN_RESP_SERV_CPM_FW */ 243 #define FW_NULL_REQ_SERV_ID 1 244 245 /* 246 * Definition of the firmware interface service users, for 247 * responses. 248 * Enumeration which is used to indicate the ids of the services 249 * for responses using the external firmware interfaces. 250 */ 251 252 enum fw_comn_resp_serv_id { 253 FW_COMN_RESP_SERV_NULL, /* NULL service id type */ 254 FW_COMN_RESP_SERV_CPM_FW, /* CPM FW Service ID */ 255 FW_COMN_RESP_SERV_DELIMITER /* Delimiter service id type */ 256 }; 257 258 /* 259 * Definition of the request types 260 * Enumeration which is used to indicate the ids of the request 261 * types used in each of the external firmware interfaces 262 */ 263 264 enum fw_comn_request_id { 265 FW_COMN_REQ_NULL = 0, /* NULL request type */ 266 FW_COMN_REQ_CPM_FW_PKE = 3, /* CPM FW PKE Request */ 267 FW_COMN_REQ_CPM_FW_LA = 4, /* CPM FW Lookaside Request */ 268 FW_COMN_REQ_CPM_FW_DMA = 7, /* CPM FW DMA Request */ 269 FW_COMN_REQ_CPM_FW_COMP = 9, /* CPM FW Compression Request */ 270 FW_COMN_REQ_DELIMITER /* End delimiter */ 271 272 }; 273 274 /* 275 * Definition of the common QAT FW request content descriptor field - 276 * points to the content descriptor parameters or itself contains service- 277 * specific data. Also specifies content descriptor parameter size. 278 * Contains reserved fields. 279 * Common section of the request used across all of the services exposed 280 * by the QAT FW. Each of the services inherit these common fields 281 */ 282 union fw_comn_req_hdr_cd_pars { 283 /* LWs 2-5 */ 284 struct 285 { 286 uint64_t content_desc_addr; 287 /* Address of the content descriptor */ 288 289 uint16_t content_desc_resrvd1; 290 /* Content descriptor reserved field */ 291 292 uint8_t content_desc_params_sz; 293 /* Size of the content descriptor parameters in quad words. These 294 * parameters describe the session setup configuration info for the 295 * slices that this request relies upon i.e. the configuration word and 296 * cipher key needed by the cipher slice if there is a request for 297 * cipher processing. */ 298 299 uint8_t content_desc_hdr_resrvd2; 300 /* Content descriptor reserved field */ 301 302 uint32_t content_desc_resrvd3; 303 /* Content descriptor reserved field */ 304 } s; 305 306 struct 307 { 308 uint32_t serv_specif_fields[FW_NUM_LONGWORDS_4]; 309 310 } s1; 311 312 }; 313 314 /* 315 * Definition of the common QAT FW request middle block. 316 * Common section of the request used across all of the services exposed 317 * by the QAT FW. Each of the services inherit these common fields 318 */ 319 struct fw_comn_req_mid 320 { 321 /* LWs 6-13 */ 322 uint64_t opaque_data; 323 /* Opaque data passed unmodified from the request to response messages by 324 * firmware (fw) */ 325 326 uint64_t src_data_addr; 327 /* Generic definition of the source data supplied to the QAT AE. The 328 * common flags are used to further describe the attributes of this 329 * field */ 330 331 uint64_t dest_data_addr; 332 /* Generic definition of the destination data supplied to the QAT AE. The 333 * common flags are used to further describe the attributes of this 334 * field */ 335 336 uint32_t src_length; 337 /* Length of source flat buffer incase src buffer 338 * type is flat */ 339 340 uint32_t dst_length; 341 /* Length of source flat buffer incase dst buffer 342 * type is flat */ 343 344 }; 345 346 /* 347 * Definition of the common QAT FW request content descriptor control 348 * block. 349 * 350 * Service specific section of the request used across all of the services 351 * exposed by the QAT FW. Each of the services populates this block 352 * uniquely. Refer to the service-specific header structures e.g. 353 * 'fw_cipher_hdr_s' (for Cipher) etc. 354 */ 355 struct fw_comn_req_cd_ctrl 356 { 357 /* LWs 27-31 */ 358 uint32_t content_desc_ctrl_lw[FW_NUM_LONGWORDS_5]; 359 360 }; 361 362 /* 363 * Definition of the common QAT FW request header. 364 * Common section of the request used across all of the services exposed 365 * by the QAT FW. Each of the services inherit these common fields. The 366 * reserved field of 7 bits and the service command Id field are all 367 * service-specific fields, along with the service specific flags. 368 */ 369 struct fw_comn_req_hdr 370 { 371 /* LW0 */ 372 uint8_t resrvd1; 373 /* reserved field */ 374 375 uint8_t service_cmd_id; 376 /* Service Command Id - this field is service-specific 377 * Please use service-specific command Id here e.g.Crypto Command Id 378 * or Compression Command Id etc. */ 379 380 uint8_t service_type; 381 /* Service type */ 382 383 uint8_t hdr_flags; 384 /* This represents a flags field for the Service Request. 385 * The most significant bit is the 'valid' flag and the only 386 * one used. All remaining bit positions are unused and 387 * are therefore reserved and need to be set to 0. */ 388 389 /* LW1 */ 390 uint16_t serv_specif_flags; 391 /* Common Request service-specific flags 392 * e.g. Symmetric Crypto Command Flags */ 393 394 uint16_t comn_req_flags; 395 /* Common Request Flags consisting of 396 * - 14 reserved bits, 397 * - 1 Content Descriptor field type bit and 398 * - 1 Source/destination pointer type bit */ 399 400 }; 401 402 /* 403 * Definition of the common QAT FW request parameter field. 404 * 405 * Service specific section of the request used across all of the services 406 * exposed by the QAT FW. Each of the services populates this block 407 * uniquely. Refer to service-specific header structures e.g. 408 * 'fw_comn_req_cipher_rqpars_s' (for Cipher) etc. 409 * 410 */ 411 struct fw_comn_req_rqpars 412 { 413 /* LWs 14-26 */ 414 uint32_t serv_specif_rqpars_lw[FW_NUM_LONGWORDS_13]; 415 416 }; 417 418 /* 419 * Definition of the common request structure with service specific 420 * fields 421 * This is a definition of the full qat request structure used by all 422 * services. Each service is free to use the service fields in its own 423 * way. This struct is useful as a message passing argument before the 424 * service contained within the request is determined. 425 */ 426 struct fw_comn_req 427 { 428 /* LWs 0-1 */ 429 struct fw_comn_req_hdr comn_hdr; 430 /* Common request header */ 431 432 /* LWs 2-5 */ 433 union fw_comn_req_hdr_cd_pars cd_pars; 434 /* Common Request content descriptor field which points either to a 435 * content descriptor 436 * parameter block or contains the service-specific data itself. */ 437 438 /* LWs 6-13 */ 439 struct fw_comn_req_mid comn_mid; 440 /* Common request middle section */ 441 442 /* LWs 14-26 */ 443 struct fw_comn_req_rqpars serv_specif_rqpars; 444 /* Common request service-specific parameter field */ 445 446 /* LWs 27-31 */ 447 struct fw_comn_req_cd_ctrl cd_ctrl; 448 /* Common request content descriptor control block - 449 * this field is service-specific */ 450 451 }; 452 453 /* 454 * Error code field 455 * 456 * Overloaded field with 8 bit common error field or two 457 * 8 bit compression error fields for compression and translator slices 458 */ 459 union fw_comn_error { 460 struct 461 { 462 uint8_t resrvd; 463 /* 8 bit reserved field */ 464 465 uint8_t comn_err_code; 466 /* 8 bit common error code */ 467 468 } s; 469 /* Structure which is used for non-compression responses */ 470 471 struct 472 { 473 uint8_t xlat_err_code; 474 /* 8 bit translator error field */ 475 476 uint8_t cmp_err_code; 477 /* 8 bit compression error field */ 478 479 } s1; 480 /* Structure which is used for compression responses */ 481 482 }; 483 484 /* 485 * Definition of the common QAT FW response header. 486 * This section of the response is common across all of the services 487 * that generate a firmware interface response 488 */ 489 struct fw_comn_resp_hdr 490 { 491 /* LW0 */ 492 uint8_t resrvd1; 493 /* Reserved field - this field is service-specific - 494 * Note: The Response Destination Id has been removed 495 * from first QWord */ 496 497 uint8_t service_id; 498 /* Service Id returned by service block */ 499 500 uint8_t response_type; 501 /* Response type - copied from the request to 502 * the response message */ 503 504 uint8_t hdr_flags; 505 /* This represents a flags field for the Response. 506 * Bit<7> = 'valid' flag 507 * Bit<6> = 'CNV' flag indicating that CNV was executed 508 * on the current request 509 * Bit<5> = 'CNVNR' flag indicating that a recovery happened 510 * on the current request following a CNV error 511 * All remaining bits are unused and are therefore reserved. 512 * They must to be set to 0. 513 */ 514 515 /* LW 1 */ 516 union fw_comn_error comn_error; 517 /* This field is overloaded to allow for one 8 bit common error field 518 * or two 8 bit error fields from compression and translator */ 519 520 uint8_t comn_status; 521 /* Status field which specifies which slice(s) report an error */ 522 523 uint8_t cmd_id; 524 /* Command Id - passed from the request to the response message */ 525 526 }; 527 528 /* 529 * Definition of the common response structure with service specific 530 * fields 531 * This is a definition of the full qat response structure used by all 532 * services. 533 */ 534 struct fw_comn_resp 535 { 536 /* LWs 0-1 */ 537 struct fw_comn_resp_hdr comn_hdr; 538 /* Common header fields */ 539 540 /* LWs 2-3 */ 541 uint64_t opaque_data; 542 /* Opaque data passed from the request to the response message */ 543 544 /* LWs 4-7 */ 545 uint32_t resrvd[FW_NUM_LONGWORDS_4]; 546 /* Reserved */ 547 548 }; 549 550 /* Common QAT FW request header - structure of LW0 551 * + ===== + ---- + ----------- + ----------- + ----------- + ----------- + 552 * | Bit | 31 | 30 - 24 | 21 - 16 | 15 - 8 | 7 - 0 | 553 * + ===== + ---- + ----------- + ----------- + ----------- + ----------- + 554 * | Flags | V | Reserved | Serv Type | Serv Cmd Id | Reserved | 555 * + ===== + ---- + ----------- + ----------- + ----------- + ----------- + 556 */ 557 558 #define FW_COMN_VALID __BIT(7) 559 560 /* Common QAT FW response header - structure of LW0 561 * + ===== + --- + --- + ----- + ----- + --------- + ----------- + ----- + 562 * | Bit | 31 | 30 | 29 | 28-24 | 21 - 16 | 15 - 8 | 7-0 | 563 * + ===== + --- + ----+ ----- + ----- + --------- + ----------- + ----- + 564 * | Flags | V | CNV | CNVNR | Rsvd | Serv Type | Serv Cmd Id | Rsvd | 565 * + ===== + --- + --- + ----- + ----- + --------- + ----------- + ----- + */ 566 /* Macros defining the bit position and mask of 'CNV' flag 567 * within the hdr_flags field of LW0 (service response only) */ 568 #define FW_COMN_CNV_FLAG_BITPOS 6 569 #define FW_COMN_CNV_FLAG_MASK 0x1 570 571 /* Macros defining the bit position and mask of CNVNR flag 572 * within the hdr_flags field of LW0 (service response only) */ 573 #define FW_COMN_CNVNR_FLAG_BITPOS 5 574 #define FW_COMN_CNVNR_FLAG_MASK 0x1 575 576 /* 577 * Macro for extraction of Service Type Field 578 * 579 * struct fw_comn_req_hdr Structure 'fw_comn_req_hdr_t' 580 * to extract the Service Type Field 581 */ 582 #define FW_COMN_OV_SRV_TYPE_GET(fw_comn_req_hdr_t) \ 583 fw_comn_req_hdr_t.service_type 584 585 /* 586 * Macro for setting of Service Type Field 587 * 588 * 'fw_comn_req_hdr_t' structure to set the Service 589 * Type Field 590 * val Value of the Service Type Field 591 */ 592 #define FW_COMN_OV_SRV_TYPE_SET(fw_comn_req_hdr_t, val) \ 593 fw_comn_req_hdr_t.service_type = val 594 595 /* 596 * Macro for extraction of Service Command Id Field 597 * 598 * struct fw_comn_req_hdr Structure 'fw_comn_req_hdr_t' 599 * to extract the Service Command Id Field 600 */ 601 #define FW_COMN_OV_SRV_CMD_ID_GET(fw_comn_req_hdr_t) \ 602 fw_comn_req_hdr_t.service_cmd_id 603 604 /* 605 * Macro for setting of Service Command Id Field 606 * 607 * 'fw_comn_req_hdr_t' structure to set the 608 * Service Command Id Field 609 * val Value of the Service Command Id Field 610 */ 611 #define FW_COMN_OV_SRV_CMD_ID_SET(fw_comn_req_hdr_t, val) \ 612 fw_comn_req_hdr_t.service_cmd_id = val 613 614 /* 615 * Extract the valid flag from the request or response's header flags. 616 * 617 * hdr_t Request or Response 'hdr_t' structure to extract the valid bit 618 * from the 'hdr_flags' field. 619 */ 620 #define FW_COMN_HDR_VALID_FLAG_GET(hdr_t) \ 621 FW_COMN_VALID_FLAG_GET(hdr_t.hdr_flags) 622 623 /* 624 * Extract the CNVNR flag from the header flags in the response only. 625 * 626 * hdr_t Response 'hdr_t' structure to extract the CNVNR bit 627 * from the 'hdr_flags' field. 628 */ 629 #define FW_COMN_HDR_CNVNR_FLAG_GET(hdr_flags) \ 630 FIELD_GET(hdr_flags, \ 631 FW_COMN_CNVNR_FLAG_BITPOS, \ 632 FW_COMN_CNVNR_FLAG_MASK) 633 634 /* 635 * Extract the CNV flag from the header flags in the response only. 636 * 637 * hdr_t Response 'hdr_t' structure to extract the CNV bit 638 * from the 'hdr_flags' field. 639 */ 640 #define FW_COMN_HDR_CNV_FLAG_GET(hdr_flags) \ 641 FIELD_GET(hdr_flags, \ 642 FW_COMN_CNV_FLAG_BITPOS, \ 643 FW_COMN_CNV_FLAG_MASK) 644 645 /* 646 * Set the valid bit in the request's header flags. 647 * 648 * hdr_t Request or Response 'hdr_t' structure to set the valid bit 649 * val Value of the valid bit flag. 650 */ 651 #define FW_COMN_HDR_VALID_FLAG_SET(hdr_t, val) \ 652 FW_COMN_VALID_FLAG_SET(hdr_t, val) 653 654 /* 655 * Common macro to extract the valid flag from the header flags field 656 * within the header structure (request or response). 657 * 658 * hdr_t Structure (request or response) to extract the 659 * valid bit from the 'hdr_flags' field. 660 */ 661 #define FW_COMN_VALID_FLAG_GET(hdr_flags) \ 662 FIELD_GET(hdr_flags, \ 663 FW_COMN_VALID_FLAG_BITPOS, \ 664 FW_COMN_VALID_FLAG_MASK) 665 666 /* 667 * Common macro to extract the remaining reserved flags from the header 668 * flags field within the header structure (request or response). 669 * 670 * hdr_t Structure (request or response) to extract the 671 * remaining bits from the 'hdr_flags' field (excluding the 672 * valid flag). 673 */ 674 #define FW_COMN_HDR_RESRVD_FLD_GET(hdr_flags) \ 675 (hdr_flags & FW_COMN_HDR_RESRVD_FLD_MASK) 676 677 /* 678 * Common macro to set the valid bit in the header flags field within 679 * the header structure (request or response). 680 * 681 * hdr_t Structure (request or response) containing the header 682 * flags field, to allow the valid bit to be set. 683 * val Value of the valid bit flag. 684 */ 685 #define FW_COMN_VALID_FLAG_SET(hdr_t, val) \ 686 FIELD_SET((hdr_t.hdr_flags), \ 687 (val), \ 688 FW_COMN_VALID_FLAG_BITPOS, \ 689 FW_COMN_VALID_FLAG_MASK) 690 691 /* 692 * Macro that must be used when building the common header flags. 693 * Note that all bits reserved field bits 0-6 (LW0) need to be forced to 0. 694 * 695 * ptr Value of the valid flag 696 */ 697 698 #define FW_COMN_HDR_FLAGS_BUILD(valid) \ 699 (((valid)&FW_COMN_VALID_FLAG_MASK) \ 700 << FW_COMN_VALID_FLAG_BITPOS) 701 702 /* 703 * Common Request Flags Definition 704 * The bit offsets below are within the flags field. These are NOT relative to 705 * the memory word. Unused fields e.g. reserved bits, must be zeroed. 706 * 707 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 708 * | Bits [15:8] | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 709 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 710 * | Flags[15:8] | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | 711 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 712 * | Bits [7:0] | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 713 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 714 * | Flags [7:0] | Rsv | Rsv | Rsv | Rsv | Rsv | BnP | Cdt | Ptr | 715 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- + 716 */ 717 718 #define COMN_PTR_TYPE_BITPOS 0 719 /* Common Request Flags - Starting bit position indicating 720 * Src&Dst Buffer Pointer type */ 721 722 #define COMN_PTR_TYPE_MASK 0x1 723 /* Common Request Flags - One bit mask used to determine 724 * Src&Dst Buffer Pointer type */ 725 726 #define COMN_CD_FLD_TYPE_BITPOS 1 727 /* Common Request Flags - Starting bit position indicating 728 * CD Field type */ 729 730 #define COMN_CD_FLD_TYPE_MASK 0x1 731 /* Common Request Flags - One bit mask used to determine 732 * CD Field type */ 733 734 #define COMN_BNP_ENABLED_BITPOS 2 735 /* Common Request Flags - Starting bit position indicating 736 * the source buffer contains batch of requests. if this 737 * bit is set, source buffer is type of Batch And Pack OpData List 738 * and the Ptr Type Bit only applies to Destination buffer. */ 739 740 #define COMN_BNP_ENABLED_MASK 0x1 741 /* Batch And Pack Enabled Flag Mask - One bit mask used to determine 742 * the source buffer is in Batch and Pack OpData Link List Mode. */ 743 744 /* ========================================================================= */ 745 /* Pointer Type Flag definitions */ 746 /* ========================================================================= */ 747 #define COMN_PTR_TYPE_FLAT 0x0 748 /* Constant value indicating Src&Dst Buffer Pointer type is flat 749 * If Batch and Pack mode is enabled, only applies to Destination buffer. */ 750 751 #define COMN_PTR_TYPE_SGL 0x1 752 /* Constant value indicating Src&Dst Buffer Pointer type is SGL type 753 * If Batch and Pack mode is enabled, only applies to Destination buffer. */ 754 755 #define COMN_PTR_TYPE_BATCH 0x2 756 /* Constant value indicating Src is a batch request 757 * and Dst Buffer Pointer type is SGL type */ 758 759 /* ========================================================================= */ 760 /* CD Field Flag definitions */ 761 /* ========================================================================= */ 762 #define COMN_CD_FLD_TYPE_64BIT_ADR 0x0 763 /* Constant value indicating CD Field contains 64-bit address */ 764 765 #define COMN_CD_FLD_TYPE_16BYTE_DATA 0x1 766 /* Constant value indicating CD Field contains 16 bytes of setup data */ 767 768 /* ========================================================================= */ 769 /* Batch And Pack Enable/Disable Definitions */ 770 /* ========================================================================= */ 771 #define COMN_BNP_ENABLED 0x1 772 /* Constant value indicating Source buffer will point to Batch And Pack OpData 773 * List */ 774 775 #define COMN_BNP_DISABLED 0x0 776 /* Constant value indicating Source buffer will point to Batch And Pack OpData 777 * List */ 778 779 /* 780 * Macro that must be used when building the common request flags (for all 781 * requests but comp BnP). 782 * Note that all bits reserved field bits 2-15 (LW1) need to be forced to 0. 783 * 784 * ptr Value of the pointer type flag 785 * cdt Value of the cd field type flag 786 */ 787 #define FW_COMN_FLAGS_BUILD(cdt, ptr) \ 788 ((((cdt)&COMN_CD_FLD_TYPE_MASK) << COMN_CD_FLD_TYPE_BITPOS) | \ 789 (((ptr)&COMN_PTR_TYPE_MASK) << COMN_PTR_TYPE_BITPOS)) 790 791 /* 792 * Macro that must be used when building the common request flags for comp 793 * BnP service. 794 * Note that all bits reserved field bits 3-15 (LW1) need to be forced to 0. 795 * 796 * ptr Value of the pointer type flag 797 * cdt Value of the cd field type flag 798 * bnp Value of the bnp enabled flag 799 */ 800 #define FW_COMN_FLAGS_BUILD_BNP(cdt, ptr, bnp) \ 801 ((((cdt)&COMN_CD_FLD_TYPE_MASK) << COMN_CD_FLD_TYPE_BITPOS) | \ 802 (((ptr)&COMN_PTR_TYPE_MASK) << COMN_PTR_TYPE_BITPOS) | \ 803 (((bnp)&COMN_BNP_ENABLED_MASK) << COMN_BNP_ENABLED_BITPOS)) 804 805 /* 806 * Macro for extraction of the pointer type bit from the common flags 807 * 808 * flags Flags to extract the pointer type bit from 809 */ 810 #define FW_COMN_PTR_TYPE_GET(flags) \ 811 FIELD_GET(flags, COMN_PTR_TYPE_BITPOS, COMN_PTR_TYPE_MASK) 812 813 /* 814 * Macro for extraction of the cd field type bit from the common flags 815 * 816 * flags Flags to extract the cd field type type bit from 817 */ 818 #define FW_COMN_CD_FLD_TYPE_GET(flags) \ 819 FIELD_GET(flags, COMN_CD_FLD_TYPE_BITPOS, COMN_CD_FLD_TYPE_MASK) 820 821 /* 822 * Macro for extraction of the bnp field type bit from the common flags 823 * 824 * flags Flags to extract the bnp field type type bit from 825 * 826 */ 827 #define FW_COMN_BNP_ENABLED_GET(flags) \ 828 FIELD_GET(flags, COMN_BNP_ENABLED_BITPOS, COMN_BNP_ENABLED_MASK) 829 830 /* 831 * Macro for setting the pointer type bit in the common flags 832 * 833 * flags Flags in which Pointer Type bit will be set 834 * val Value of the bit to be set in flags 835 * 836 */ 837 #define FW_COMN_PTR_TYPE_SET(flags, val) \ 838 FIELD_SET(flags, val, COMN_PTR_TYPE_BITPOS, COMN_PTR_TYPE_MASK) 839 840 /* 841 * Macro for setting the cd field type bit in the common flags 842 * 843 * flags Flags in which Cd Field Type bit will be set 844 * val Value of the bit to be set in flags 845 * 846 */ 847 #define FW_COMN_CD_FLD_TYPE_SET(flags, val) \ 848 FIELD_SET( \ 849 flags, val, COMN_CD_FLD_TYPE_BITPOS, COMN_CD_FLD_TYPE_MASK) 850 851 /* 852 * Macro for setting the bnp field type bit in the common flags 853 * 854 * flags Flags in which Bnp Field Type bit will be set 855 * val Value of the bit to be set in flags 856 * 857 */ 858 #define FW_COMN_BNP_ENABLE_SET(flags, val) \ 859 FIELD_SET( \ 860 flags, val, COMN_BNP_ENABLED_BITPOS, COMN_BNP_ENABLED_MASK) 861 862 /* 863 * Macros using the bit position and mask to set/extract the next 864 * and current id nibbles within the next_curr_id field of the 865 * content descriptor header block. Note that these are defined 866 * in the common header file, as they are used by compression, cipher 867 * and authentication. 868 * 869 * cd_ctrl_hdr_t Content descriptor control block header pointer. 870 * val Value of the field being set. 871 */ 872 #define FW_COMN_NEXT_ID_BITPOS 4 873 #define FW_COMN_NEXT_ID_MASK 0xF0 874 #define FW_COMN_CURR_ID_BITPOS 0 875 #define FW_COMN_CURR_ID_MASK 0x0F 876 877 #define FW_COMN_NEXT_ID_GET(cd_ctrl_hdr_t) \ 878 ((((cd_ctrl_hdr_t)->next_curr_id) & FW_COMN_NEXT_ID_MASK) >> \ 879 (FW_COMN_NEXT_ID_BITPOS)) 880 881 #define FW_COMN_NEXT_ID_SET(cd_ctrl_hdr_t, val) \ 882 ((cd_ctrl_hdr_t)->next_curr_id) = \ 883 ((((cd_ctrl_hdr_t)->next_curr_id) & FW_COMN_CURR_ID_MASK) | \ 884 ((val << FW_COMN_NEXT_ID_BITPOS) & \ 885 FW_COMN_NEXT_ID_MASK)) 886 887 #define FW_COMN_CURR_ID_GET(cd_ctrl_hdr_t) \ 888 (((cd_ctrl_hdr_t)->next_curr_id) & FW_COMN_CURR_ID_MASK) 889 890 #define FW_COMN_CURR_ID_SET(cd_ctrl_hdr_t, val) \ 891 ((cd_ctrl_hdr_t)->next_curr_id) = \ 892 ((((cd_ctrl_hdr_t)->next_curr_id) & FW_COMN_NEXT_ID_MASK) | \ 893 ((val)&FW_COMN_CURR_ID_MASK)) 894 895 /* 896 * Common Status Field Definition The bit offsets below are within the COMMON 897 * RESPONSE status field, assumed to be 8 bits wide. In the case of the PKE 898 * response (which follows the CPM 1.5 message format), the status field is 16 899 * bits wide. 900 * The status flags are contained within the most significant byte and align 901 * with the diagram below. Please therefore refer to the service-specific PKE 902 * header file for the appropriate macro definition to extract the PKE status 903 * flag from the PKE response, which assumes that a word is passed to the 904 * macro. 905 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- + 906 * | Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 907 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- + 908 * | Flags | Crypto | Pke | Cmp | Xlat | EOLB | UnSupReq | Rsvd | XltWaApply | 909 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- + 910 * Note: 911 * For the service specific status bit definitions refer to service header files 912 * Eg. Crypto Status bit refers to Symmetric Crypto, Key Generation, and NRBG 913 * Requests' Status. Unused bits e.g. reserved bits need to have been forced to 914 * 0. 915 */ 916 917 #define COMN_RESP_CRYPTO_STATUS_BITPOS 7 918 /* Starting bit position indicating Response for Crypto service Flag */ 919 920 #define COMN_RESP_CRYPTO_STATUS_MASK 0x1 921 /* One bit mask used to determine Crypto status mask */ 922 923 #define COMN_RESP_PKE_STATUS_BITPOS 6 924 /* Starting bit position indicating Response for PKE service Flag */ 925 926 #define COMN_RESP_PKE_STATUS_MASK 0x1 927 /* One bit mask used to determine PKE status mask */ 928 929 #define COMN_RESP_CMP_STATUS_BITPOS 5 930 /* Starting bit position indicating Response for Compression service Flag */ 931 932 #define COMN_RESP_CMP_STATUS_MASK 0x1 933 /* One bit mask used to determine Compression status mask */ 934 935 #define COMN_RESP_XLAT_STATUS_BITPOS 4 936 /* Starting bit position indicating Response for Xlat service Flag */ 937 938 #define COMN_RESP_XLAT_STATUS_MASK 0x1 939 /* One bit mask used to determine Translator status mask */ 940 941 #define COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS 3 942 /* Starting bit position indicating the last block in a deflate stream for 943 the compression service Flag */ 944 945 #define COMN_RESP_CMP_END_OF_LAST_BLK_MASK 0x1 946 /* One bit mask used to determine the last block in a deflate stream 947 status mask */ 948 949 #define COMN_RESP_UNSUPPORTED_REQUEST_BITPOS 2 950 /* Starting bit position indicating when an unsupported service request Flag */ 951 952 #define COMN_RESP_UNSUPPORTED_REQUEST_MASK 0x1 953 /* One bit mask used to determine the unsupported service request status mask */ 954 955 #define COMN_RESP_XLT_WA_APPLIED_BITPOS 0 956 /* Bit position indicating a firmware workaround was applied to translation */ 957 958 #define COMN_RESP_XLT_WA_APPLIED_MASK 0x1 959 /* One bit mask */ 960 961 /* 962 * Macro that must be used when building the status 963 * for the common response 964 * 965 * crypto Value of the Crypto Service status flag 966 * comp Value of the Compression Service Status flag 967 * xlat Value of the Xlator Status flag 968 * eolb Value of the Compression End of Last Block Status flag 969 * unsupp Value of the Unsupported Request flag 970 * xlt_wa Value of the Translation WA marker 971 */ 972 #define FW_COMN_RESP_STATUS_BUILD( \ 973 crypto, pke, comp, xlat, eolb, unsupp, xlt_wa) \ 974 ((((crypto)&COMN_RESP_CRYPTO_STATUS_MASK) \ 975 << COMN_RESP_CRYPTO_STATUS_BITPOS) | \ 976 (((pke)&COMN_RESP_PKE_STATUS_MASK) \ 977 << COMN_RESP_PKE_STATUS_BITPOS) | \ 978 (((xlt_wa)&COMN_RESP_XLT_WA_APPLIED_MASK) \ 979 << COMN_RESP_XLT_WA_APPLIED_BITPOS) | \ 980 (((comp)&COMN_RESP_CMP_STATUS_MASK) \ 981 << COMN_RESP_CMP_STATUS_BITPOS) | \ 982 (((xlat)&COMN_RESP_XLAT_STATUS_MASK) \ 983 << COMN_RESP_XLAT_STATUS_BITPOS) | \ 984 (((eolb)&COMN_RESP_CMP_END_OF_LAST_BLK_MASK) \ 985 << COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS) | \ 986 (((unsupp)&COMN_RESP_UNSUPPORTED_REQUEST_BITPOS) \ 987 << COMN_RESP_UNSUPPORTED_REQUEST_MASK)) 988 989 /* 990 * Macro for extraction of the Crypto bit from the status 991 * 992 * status Status to extract the status bit from 993 */ 994 #define FW_COMN_RESP_CRYPTO_STAT_GET(status) \ 995 FIELD_GET(status, \ 996 COMN_RESP_CRYPTO_STATUS_BITPOS, \ 997 COMN_RESP_CRYPTO_STATUS_MASK) 998 999 /* 1000 * Macro for extraction of the PKE bit from the status 1001 * 1002 * status Status to extract the status bit from 1003 */ 1004 #define FW_COMN_RESP_PKE_STAT_GET(status) \ 1005 FIELD_GET(status, \ 1006 COMN_RESP_PKE_STATUS_BITPOS, \ 1007 COMN_RESP_PKE_STATUS_MASK) 1008 1009 /* 1010 * Macro for extraction of the Compression bit from the status 1011 * 1012 * status Status to extract the status bit from 1013 */ 1014 #define FW_COMN_RESP_CMP_STAT_GET(status) \ 1015 FIELD_GET(status, \ 1016 COMN_RESP_CMP_STATUS_BITPOS, \ 1017 COMN_RESP_CMP_STATUS_MASK) 1018 1019 /* 1020 * Macro for extraction of the Translator bit from the status 1021 * 1022 * status Status to extract the status bit from 1023 */ 1024 #define FW_COMN_RESP_XLAT_STAT_GET(status) \ 1025 FIELD_GET(status, \ 1026 COMN_RESP_XLAT_STATUS_BITPOS, \ 1027 COMN_RESP_XLAT_STATUS_MASK) 1028 1029 /* 1030 * Macro for extraction of the Translation Workaround Applied bit from the 1031 * status 1032 * 1033 * status Status to extract the status bit from 1034 */ 1035 #define FW_COMN_RESP_XLT_WA_APPLIED_GET(status) \ 1036 FIELD_GET(status, \ 1037 COMN_RESP_XLT_WA_APPLIED_BITPOS, \ 1038 COMN_RESP_XLT_WA_APPLIED_MASK) 1039 1040 /* 1041 * Macro for extraction of the end of compression block bit from the 1042 * status 1043 * 1044 * status 1045 * Status to extract the status bit from 1046 */ 1047 #define FW_COMN_RESP_CMP_END_OF_LAST_BLK_FLAG_GET(status) \ 1048 FIELD_GET(status, \ 1049 COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS, \ 1050 COMN_RESP_CMP_END_OF_LAST_BLK_MASK) 1051 1052 /* 1053 * Macro for extraction of the Unsupported request from the status 1054 * 1055 * status 1056 * Status to extract the status bit from 1057 */ 1058 #define FW_COMN_RESP_UNSUPPORTED_REQUEST_STAT_GET(status) \ 1059 FIELD_GET(status, \ 1060 COMN_RESP_UNSUPPORTED_REQUEST_BITPOS, \ 1061 COMN_RESP_UNSUPPORTED_REQUEST_MASK) 1062 1063 #define FW_COMN_STATUS_FLAG_OK 0 1064 /* Definition of successful processing of a request */ 1065 1066 #define FW_COMN_STATUS_FLAG_ERROR 1 1067 /* Definition of erroneous processing of a request */ 1068 1069 #define FW_COMN_STATUS_CMP_END_OF_LAST_BLK_FLAG_CLR 0 1070 /* Final Deflate block of a compression request not completed */ 1071 1072 #define FW_COMN_STATUS_CMP_END_OF_LAST_BLK_FLAG_SET 1 1073 /* Final Deflate block of a compression request completed */ 1074 1075 #define ERR_CODE_NO_ERROR 0 1076 /* Error Code constant value for no error */ 1077 1078 #define ERR_CODE_INVALID_BLOCK_TYPE -1 1079 /* Invalid block type (type == 3)*/ 1080 1081 #define ERR_CODE_NO_MATCH_ONES_COMP -2 1082 /* Stored block length does not match one's complement */ 1083 1084 #define ERR_CODE_TOO_MANY_LEN_OR_DIS -3 1085 /* Too many length or distance codes */ 1086 1087 #define ERR_CODE_INCOMPLETE_LEN -4 1088 /* Code lengths codes incomplete */ 1089 1090 #define ERR_CODE_RPT_LEN_NO_FIRST_LEN -5 1091 /* Repeat lengths with no first length */ 1092 1093 #define ERR_CODE_RPT_GT_SPEC_LEN -6 1094 /* Repeat more than specified lengths */ 1095 1096 #define ERR_CODE_INV_LIT_LEN_CODE_LEN -7 1097 /* Invalid lit/len code lengths */ 1098 1099 #define ERR_CODE_INV_DIS_CODE_LEN -8 1100 /* Invalid distance code lengths */ 1101 1102 #define ERR_CODE_INV_LIT_LEN_DIS_IN_BLK -9 1103 /* Invalid lit/len or distance code in fixed/dynamic block */ 1104 1105 #define ERR_CODE_DIS_TOO_FAR_BACK -10 1106 /* Distance too far back in fixed or dynamic block */ 1107 1108 /* Common Error code definitions */ 1109 #define ERR_CODE_OVERFLOW_ERROR -11 1110 /* Error Code constant value for overflow error */ 1111 1112 #define ERR_CODE_SOFT_ERROR -12 1113 /* Error Code constant value for soft error */ 1114 1115 #define ERR_CODE_FATAL_ERROR -13 1116 /* Error Code constant value for hard/fatal error */ 1117 1118 #define ERR_CODE_COMP_OUTPUT_CORRUPTION -14 1119 /* Error Code constant for compression output corruption */ 1120 1121 #define ERR_CODE_HW_INCOMPLETE_FILE -15 1122 /* Error Code constant value for incomplete file hardware error */ 1123 1124 #define ERR_CODE_SSM_ERROR -16 1125 /* Error Code constant value for error detected by SSM e.g. slice hang */ 1126 1127 #define ERR_CODE_ENDPOINT_ERROR -17 1128 /* Error Code constant value for error detected by PCIe Endpoint, e.g. push 1129 * data error */ 1130 1131 #define ERR_CODE_CNV_ERROR -18 1132 /* Error Code constant value for cnv failure */ 1133 1134 #define ERR_CODE_EMPTY_DYM_BLOCK -19 1135 /* Error Code constant value for submission of empty dynamic stored block to 1136 * slice */ 1137 1138 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_INVALID_HANDLE -20 1139 /* Error Code constant for invalid handle in kpt crypto service */ 1140 1141 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_HMAC_FAILED -21 1142 /* Error Code constant for failed hmac in kpt crypto service */ 1143 1144 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_INVALID_WRAPPING_ALGO -22 1145 /* Error Code constant for invalid wrapping algo in kpt crypto service */ 1146 1147 #define ERR_CODE_KPT_DRNG_SEED_NOT_LOAD -23 1148 /* Error Code constant for no drng seed is not loaded in kpt ecdsa signrs 1149 /service */ 1150 1151 #define FW_LA_ICV_VER_STATUS_PASS FW_COMN_STATUS_FLAG_OK 1152 /* Status flag indicating that the ICV verification passed */ 1153 1154 #define FW_LA_ICV_VER_STATUS_FAIL FW_COMN_STATUS_FLAG_ERROR 1155 /* Status flag indicating that the ICV verification failed */ 1156 1157 #define FW_LA_TRNG_STATUS_PASS FW_COMN_STATUS_FLAG_OK 1158 /* Status flag indicating that the TRNG returned valid entropy data */ 1159 1160 #define FW_LA_TRNG_STATUS_FAIL FW_COMN_STATUS_FLAG_ERROR 1161 /* Status flag indicating that the TRNG Command Failed. */ 1162 1163 /* -------------------------------------------------------------------------- */ 1164 1165 /* 1166 * Definition of the full bulk processing request structure. 1167 * Used for hash, cipher, hash-cipher and authentication-encryption 1168 * requests etc. 1169 */ 1170 struct fw_la_bulk_req 1171 { 1172 /* LWs 0-1 */ 1173 struct fw_comn_req_hdr comn_hdr; 1174 /* Common request header - for Service Command Id, 1175 * use service-specific Crypto Command Id. 1176 * Service Specific Flags - use Symmetric Crypto Command Flags 1177 * (all of cipher, auth, SSL3, TLS and MGF, 1178 * excluding TRNG - field unused) */ 1179 1180 /* LWs 2-5 */ 1181 union fw_comn_req_hdr_cd_pars cd_pars; 1182 /* Common Request content descriptor field which points either to a 1183 * content descriptor 1184 * parameter block or contains the service-specific data itself. */ 1185 1186 /* LWs 6-13 */ 1187 struct fw_comn_req_mid comn_mid; 1188 /* Common request middle section */ 1189 1190 /* LWs 14-26 */ 1191 struct fw_comn_req_rqpars serv_specif_rqpars; 1192 /* Common request service-specific parameter field */ 1193 1194 /* LWs 27-31 */ 1195 struct fw_comn_req_cd_ctrl cd_ctrl; 1196 /* Common request content descriptor control block - 1197 * this field is service-specific */ 1198 1199 }; 1200 1201 /* clang-format off */ 1202 1203 /* 1204 * LA BULK (SYMMETRIC CRYPTO) COMMAND FLAGS 1205 * 1206 * + ===== + ---------- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + 1207 * | Bit | [15:13] | 12 | 11 | 10 | 7-9 | 6 | 5 | 4 | 3 | 2 | 1-0 | 1208 * + ===== + ---------- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ------+ ----- + 1209 * | Flags | Resvd Bits | ZUC | GcmIV |Digest | Prot | Cmp | Rtn | Upd | Ciph/ | CiphIV| Part- | 1210 * | | =0 | Prot | Len | In Buf| flgs | Auth | Auth | State | Auth | Field | ial | 1211 * + ===== + ---------- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ------+ ----- + 1212 */ 1213 1214 /* clang-format on */ 1215 1216 /* Private defines */ 1217 1218 #define FW_LA_ZUC_3G_PROTO __BIT(12) 1219 /* Indicating ZUC processing for a encrypt command 1220 * Must be set for Cipher-only, Cipher + Auth and Auth-only */ 1221 1222 #define FW_LA_GCM_IV_LEN_12_OCTETS __BIT(11) 1223 /* Indicates the IV Length for GCM protocol is 96 Bits (12 Octets) 1224 * If set FW does the padding to compute CTR0 */ 1225 1226 #define FW_LA_DIGEST_IN_BUFFER __BIT(10) 1227 /* Flag representing that authentication digest is stored or is extracted 1228 * from the source buffer. Auth Result Pointer will be ignored in this case. */ 1229 1230 #define FW_LA_PROTO __BITS(7, 9) 1231 #define FW_LA_PROTO_SNOW_3G __BIT(9) 1232 /* Indicates SNOW_3G processing for a encrypt command */ 1233 #define FW_LA_PROTO_GCM __BIT(8) 1234 /* Indicates GCM processing for a auth_encrypt command */ 1235 #define FW_LA_PROTO_CCM __BIT(7) 1236 /* Indicates CCM processing for a auth_encrypt command */ 1237 #define FW_LA_PROTO_NONE 0 1238 /* Indicates no specific protocol processing for the command */ 1239 1240 #define FW_LA_CMP_AUTH_RES __BIT(6) 1241 /* Flag representing the need to compare the auth result data to the expected 1242 * value in DRAM at the auth_address. */ 1243 1244 #define FW_LA_RET_AUTH_RES __BIT(5) 1245 /* Flag representing the need to return the auth result data to dram after the 1246 * request processing is complete */ 1247 1248 #define FW_LA_UPDATE_STATE __BIT(4) 1249 /* Flag representing the need to update the state data in dram after the 1250 * request processing is complete */ 1251 1252 #define FW_CIPH_AUTH_CFG_OFFSET_IN_SHRAM_CP __BIT(3) 1253 /* Flag representing Cipher/Auth Config Offset Type, where the offset 1254 * is contained in SHRAM constants page. When the SHRAM constants page 1255 * is not used for cipher/auth configuration, then the Content Descriptor 1256 * pointer field must be a pointer (as opposed to a 16-byte key), since 1257 * the block pointed to must contain both the slice config and the key */ 1258 1259 #define FW_CIPH_IV_16BYTE_DATA __BIT(2) 1260 /* Flag representing Cipher IV field contents as 16-byte data array 1261 * Otherwise Cipher IV field contents via 64-bit pointer */ 1262 1263 #define FW_LA_PARTIAL __BITS(0, 1) 1264 #define FW_LA_PARTIAL_NONE 0 1265 /* Flag representing no need for partial processing condition i.e. 1266 * entire packet processed in the current command */ 1267 #define FW_LA_PARTIAL_START 1 1268 /* Flag representing the first chunk of the partial packet */ 1269 #define FW_LA_PARTIAL_MID 3 1270 /* Flag representing a middle chunk of the partial packet */ 1271 #define FW_LA_PARTIAL_END 2 1272 /* Flag representing the final/end chunk of the partial packet */ 1273 1274 /* The table below defines the meaning of the prefix_addr & hash_state_sz in 1275 * the case of partial processing. See the HLD for further details 1276 * 1277 * + ====== + ------------------------- + ----------------------- + 1278 * | Parial | Prefix Addr | Hash State Sz | 1279 * | State | | | 1280 * + ====== + ------------------------- + ----------------------- + 1281 * | FULL | Points to the prefix data | Prefix size as below. | 1282 * | | | No update of state | 1283 * + ====== + ------------------------- + ----------------------- + 1284 * | SOP | Points to the prefix | = inner prefix rounded | 1285 * | | data. State is updated | to qwrds + outer prefix | 1286 * | | at prefix_addr - state_sz | rounded to qwrds. The | 1287 * | | - 8 (counter size) | writeback state sz | 1288 * | | | comes from the CD | 1289 * + ====== + ------------------------- + ----------------------- + 1290 * | MOP | Points to the state data | State size rounded to | 1291 * | | Updated state written to | num qwrds + 8 (for the | 1292 * | | same location | counter) + inner prefix | 1293 * | | | rounded to qwrds + | 1294 * | | | outer prefix rounded to | 1295 * | | | qwrds. | 1296 * + ====== + ------------------------- + ----------------------- + 1297 * | EOP | Points to the state data | State size rounded to | 1298 * | | | num qwrds + 8 (for the | 1299 * | | | counter) + inner prefix | 1300 * | | | rounded to qwrds + | 1301 * | | | outer prefix rounded to | 1302 * | | | qwrds. | 1303 * + ====== + ------------------------- + ----------------------- + 1304 * 1305 * Notes: 1306 * 1307 * - If the EOP is set it is assumed that no state update is to be performed. 1308 * However it is the clients responsibility to set the update_state flag 1309 * correctly i.e. not set for EOP or Full packet cases. Only set for SOP and 1310 * MOP with no EOP flag 1311 * - The SOP take precedence over the MOP and EOP i.e. in the calculation of 1312 * the address to writeback the state. 1313 * - The prefix address must be on at least the 8 byte boundary 1314 */ 1315 1316 /* Macros for extracting field bits */ 1317 /* 1318 * Macro for extraction of the Cipher IV field contents (bit 2) 1319 * 1320 * flags Flags to extract the Cipher IV field contents 1321 * 1322 */ 1323 #define FW_LA_CIPH_IV_FLD_FLAG_GET(flags) \ 1324 FIELD_GET(flags, LA_CIPH_IV_FLD_BITPOS, LA_CIPH_IV_FLD_MASK) 1325 1326 /* 1327 * Macro for extraction of the Cipher/Auth Config 1328 * offset type (bit 3) 1329 * 1330 * flags Flags to extract the Cipher/Auth Config offset type 1331 * 1332 */ 1333 #define FW_LA_CIPH_AUTH_CFG_OFFSET_FLAG_GET(flags) \ 1334 FIELD_GET(flags, \ 1335 LA_CIPH_AUTH_CFG_OFFSET_BITPOS, \ 1336 LA_CIPH_AUTH_CFG_OFFSET_MASK) 1337 1338 /* 1339 * Macro for extraction of the ZUC protocol bit 1340 * information (bit 11) 1341 * 1342 * flags Flags to extract the ZUC protocol bit 1343 */ 1344 #define FW_LA_ZUC_3G_PROTO_FLAG_GET(flags) \ 1345 FIELD_GET(flags, \ 1346 FW_LA_ZUC_3G_PROTO_FLAG_BITPOS, \ 1347 FW_LA_ZUC_3G_PROTO_FLAG_MASK) 1348 1349 /* 1350 * Macro for extraction of the GCM IV Len is 12 Octets / 96 Bits 1351 * information (bit 11) 1352 * 1353 * flags Flags to extract the GCM IV length 1354 */ 1355 #define FW_LA_GCM_IV_LEN_FLAG_GET(flags) \ 1356 FIELD_GET( \ 1357 flags, LA_GCM_IV_LEN_FLAG_BITPOS, LA_GCM_IV_LEN_FLAG_MASK) 1358 1359 /* 1360 * Macro for extraction of the LA protocol state (bits 9-7) 1361 * 1362 * flags Flags to extract the protocol state 1363 */ 1364 #define FW_LA_PROTO_GET(flags) \ 1365 FIELD_GET(flags, LA_PROTO_BITPOS, LA_PROTO_MASK) 1366 1367 /* 1368 * Macro for extraction of the "compare auth" state (bit 6) 1369 * 1370 * flags Flags to extract the compare auth result state 1371 * 1372 */ 1373 #define FW_LA_CMP_AUTH_GET(flags) \ 1374 FIELD_GET(flags, LA_CMP_AUTH_RES_BITPOS, LA_CMP_AUTH_RES_MASK) 1375 1376 /* 1377 * Macro for extraction of the "return auth" state (bit 5) 1378 * 1379 * flags Flags to extract the return auth result state 1380 * 1381 */ 1382 #define FW_LA_RET_AUTH_GET(flags) \ 1383 FIELD_GET(flags, LA_RET_AUTH_RES_BITPOS, LA_RET_AUTH_RES_MASK) 1384 1385 /* 1386 * Macro for extraction of the "digest in buffer" state (bit 10) 1387 * 1388 * flags Flags to extract the digest in buffer state 1389 * 1390 */ 1391 #define FW_LA_DIGEST_IN_BUFFER_GET(flags) \ 1392 FIELD_GET( \ 1393 flags, LA_DIGEST_IN_BUFFER_BITPOS, LA_DIGEST_IN_BUFFER_MASK) 1394 1395 /* 1396 * Macro for extraction of the update content state value. (bit 4) 1397 * 1398 * flags Flags to extract the update content state bit 1399 */ 1400 #define FW_LA_UPDATE_STATE_GET(flags) \ 1401 FIELD_GET(flags, LA_UPDATE_STATE_BITPOS, LA_UPDATE_STATE_MASK) 1402 1403 /* 1404 * Macro for extraction of the "partial" packet state (bits 1-0) 1405 * 1406 * flags Flags to extract the partial state 1407 */ 1408 #define FW_LA_PARTIAL_GET(flags) \ 1409 FIELD_GET(flags, LA_PARTIAL_BITPOS, LA_PARTIAL_MASK) 1410 1411 /* Macros for setting field bits */ 1412 /* 1413 * Macro for setting the Cipher IV field contents 1414 * 1415 * flags Flags to set with the Cipher IV field contents 1416 * val Field contents indicator value 1417 */ 1418 #define FW_LA_CIPH_IV_FLD_FLAG_SET(flags, val) \ 1419 FIELD_SET( \ 1420 flags, val, LA_CIPH_IV_FLD_BITPOS, LA_CIPH_IV_FLD_MASK) 1421 1422 /* 1423 * Macro for setting the Cipher/Auth Config 1424 * offset type 1425 * 1426 * flags Flags to set the Cipher/Auth Config offset type 1427 * val Offset type value 1428 */ 1429 #define FW_LA_CIPH_AUTH_CFG_OFFSET_FLAG_SET(flags, val) \ 1430 FIELD_SET(flags, \ 1431 val, \ 1432 LA_CIPH_AUTH_CFG_OFFSET_BITPOS, \ 1433 LA_CIPH_AUTH_CFG_OFFSET_MASK) 1434 1435 /* 1436 * Macro for setting the ZUC protocol flag 1437 * 1438 * flags Flags to set the ZUC protocol flag 1439 * val Protocol value 1440 */ 1441 #define FW_LA_ZUC_3G_PROTO_FLAG_SET(flags, val) \ 1442 FIELD_SET(flags, \ 1443 val, \ 1444 FW_LA_ZUC_3G_PROTO_FLAG_BITPOS, \ 1445 FW_LA_ZUC_3G_PROTO_FLAG_MASK) 1446 1447 /* 1448 * Macro for setting the GCM IV length flag state 1449 * 1450 * flags Flags to set the GCM IV length flag state 1451 * val Protocol value 1452 */ 1453 #define FW_LA_GCM_IV_LEN_FLAG_SET(flags, val) \ 1454 FIELD_SET(flags, \ 1455 val, \ 1456 LA_GCM_IV_LEN_FLAG_BITPOS, \ 1457 LA_GCM_IV_LEN_FLAG_MASK) 1458 1459 /* 1460 * Macro for setting the LA protocol flag state 1461 * 1462 * flags Flags to set the protocol state 1463 * val Protocol value 1464 */ 1465 #define FW_LA_PROTO_SET(flags, val) \ 1466 FIELD_SET(flags, val, LA_PROTO_BITPOS, LA_PROTO_MASK) 1467 1468 /* 1469 * Macro for setting the "compare auth" flag state 1470 * 1471 * flags Flags to set the compare auth result state 1472 * val Compare Auth value 1473 */ 1474 #define FW_LA_CMP_AUTH_SET(flags, val) \ 1475 FIELD_SET( \ 1476 flags, val, LA_CMP_AUTH_RES_BITPOS, LA_CMP_AUTH_RES_MASK) 1477 1478 /* 1479 * Macro for setting the "return auth" flag state 1480 * 1481 * flags Flags to set the return auth result state 1482 * val Return Auth value 1483 */ 1484 #define FW_LA_RET_AUTH_SET(flags, val) \ 1485 FIELD_SET( \ 1486 flags, val, LA_RET_AUTH_RES_BITPOS, LA_RET_AUTH_RES_MASK) 1487 1488 /* 1489 * Macro for setting the "digest in buffer" flag state 1490 * 1491 * flags Flags to set the digest in buffer state 1492 * val Digest in buffer value 1493 */ 1494 #define FW_LA_DIGEST_IN_BUFFER_SET(flags, val) \ 1495 FIELD_SET(flags, \ 1496 val, \ 1497 LA_DIGEST_IN_BUFFER_BITPOS, \ 1498 LA_DIGEST_IN_BUFFER_MASK) 1499 1500 /* 1501 * Macro for setting the "update state" flag value 1502 * 1503 * flags Flags to set the update content state 1504 * val Update Content State flag value 1505 */ 1506 #define FW_LA_UPDATE_STATE_SET(flags, val) \ 1507 FIELD_SET( \ 1508 flags, val, LA_UPDATE_STATE_BITPOS, LA_UPDATE_STATE_MASK) 1509 1510 /* 1511 * Macro for setting the "partial" packet flag state 1512 * 1513 * flags Flags to set the partial state 1514 * val Partial state value 1515 */ 1516 #define FW_LA_PARTIAL_SET(flags, val) \ 1517 FIELD_SET(flags, val, LA_PARTIAL_BITPOS, LA_PARTIAL_MASK) 1518 1519 /* 1520 * Definition of the Cipher header Content Descriptor pars block 1521 * Definition of the cipher processing header cd pars block. 1522 * The structure is a service-specific implementation of the common 1523 * 'fw_comn_req_hdr_cd_pars_s' structure. 1524 */ 1525 union fw_cipher_req_hdr_cd_pars { 1526 /* LWs 2-5 */ 1527 struct 1528 { 1529 uint64_t content_desc_addr; 1530 /* Address of the content descriptor */ 1531 1532 uint16_t content_desc_resrvd1; 1533 /* Content descriptor reserved field */ 1534 1535 uint8_t content_desc_params_sz; 1536 /* Size of the content descriptor parameters in quad words. These 1537 * parameters describe the session setup configuration info for the 1538 * slices that this request relies upon i.e. the configuration word and 1539 * cipher key needed by the cipher slice if there is a request for 1540 * cipher processing. */ 1541 1542 uint8_t content_desc_hdr_resrvd2; 1543 /* Content descriptor reserved field */ 1544 1545 uint32_t content_desc_resrvd3; 1546 /* Content descriptor reserved field */ 1547 } s; 1548 1549 struct 1550 { 1551 uint32_t cipher_key_array[FW_NUM_LONGWORDS_4]; 1552 /* Cipher Key Array */ 1553 1554 } s1; 1555 1556 }; 1557 1558 /* 1559 * Definition of the Authentication header Content Descriptor pars block 1560 * Definition of the authentication processing header cd pars block. 1561 */ 1562 /* Note: Authentication uses the common 'fw_comn_req_hdr_cd_pars_s' 1563 * structure - similarly, it is also used by SSL3, TLS and MGF. Only cipher 1564 * and cipher + authentication require service-specific implementations of 1565 * the structure */ 1566 1567 /* 1568 * Definition of the Cipher + Auth header Content Descriptor pars block 1569 * Definition of the cipher + auth processing header cd pars block. 1570 * The structure is a service-specific implementation of the common 1571 * 'fw_comn_req_hdr_cd_pars_s' structure. 1572 */ 1573 union fw_cipher_auth_req_hdr_cd_pars { 1574 /* LWs 2-5 */ 1575 struct 1576 { 1577 uint64_t content_desc_addr; 1578 /* Address of the content descriptor */ 1579 1580 uint16_t content_desc_resrvd1; 1581 /* Content descriptor reserved field */ 1582 1583 uint8_t content_desc_params_sz; 1584 /* Size of the content descriptor parameters in quad words. These 1585 * parameters describe the session setup configuration info for the 1586 * slices that this request relies upon i.e. the configuration word and 1587 * cipher key needed by the cipher slice if there is a request for 1588 * cipher processing. */ 1589 1590 uint8_t content_desc_hdr_resrvd2; 1591 /* Content descriptor reserved field */ 1592 1593 uint32_t content_desc_resrvd3; 1594 /* Content descriptor reserved field */ 1595 } s; 1596 1597 struct 1598 { 1599 uint32_t cipher_key_array[FW_NUM_LONGWORDS_4]; 1600 /* Cipher Key Array */ 1601 1602 } sl; 1603 1604 }; 1605 1606 /* 1607 * Cipher content descriptor control block (header) 1608 * Definition of the service-specific cipher control block header 1609 * structure. This header forms part of the content descriptor 1610 * block incorporating LWs 27-31, as defined by the common base 1611 * parameters structure. 1612 */ 1613 struct fw_cipher_cd_ctrl_hdr 1614 { 1615 /* LW 27 */ 1616 uint8_t cipher_state_sz; 1617 /* State size in quad words of the cipher algorithm used in this session. 1618 * Set to zero if the algorithm doesnt provide any state */ 1619 1620 uint8_t cipher_key_sz; 1621 /* Key size in quad words of the cipher algorithm used in this session */ 1622 1623 uint8_t cipher_cfg_offset; 1624 /* Quad word offset from the content descriptor parameters address i.e. 1625 * (content_address + (cd_hdr_sz << 3)) to the parameters for the cipher 1626 * processing */ 1627 1628 uint8_t next_curr_id; 1629 /* This field combines the next and current id (each four bits) - 1630 * the next id is the most significant nibble. 1631 * Next Id: Set to the next slice to pass the ciphered data through. 1632 * Set to FW_SLICE_DRAM_WR if the data is not to go through 1633 * any more slices after cipher. 1634 * Current Id: Initialised with the cipher slice type */ 1635 1636 /* LW 28 */ 1637 uint8_t cipher_padding_sz; 1638 /* State padding size in quad words. Set to 0 if no padding is required. 1639 */ 1640 1641 uint8_t resrvd1; 1642 uint16_t resrvd2; 1643 /* Reserved bytes to bring the struct to the word boundary, used by 1644 * authentication. MUST be set to 0 */ 1645 1646 /* LWs 29-31 */ 1647 uint32_t resrvd3[FW_NUM_LONGWORDS_3]; 1648 /* Reserved bytes used by authentication. MUST be set to 0 */ 1649 1650 }; 1651 1652 /* 1653 * Authentication content descriptor control block (header) 1654 * Definition of the service-specific authentication control block 1655 * header structure. This header forms part of the content descriptor 1656 * block incorporating LWs 27-31, as defined by the common base 1657 * parameters structure, the first portion of which is reserved for 1658 * cipher. 1659 */ 1660 struct fw_auth_cd_ctrl_hdr 1661 { 1662 /* LW 27 */ 1663 uint32_t resrvd1; 1664 /* Reserved bytes, used by cipher only. MUST be set to 0 */ 1665 1666 /* LW 28 */ 1667 uint8_t resrvd2; 1668 /* Reserved byte, used by cipher only. MUST be set to 0 */ 1669 1670 uint8_t hash_flags; 1671 /* General flags defining the processing to perform. 0 is normal 1672 * processing 1673 * and 1 means there is a nested hash processing loop to go through */ 1674 1675 uint8_t hash_cfg_offset; 1676 /* Quad word offset from the content descriptor parameters address to the 1677 * parameters for the auth processing */ 1678 1679 uint8_t next_curr_id; 1680 /* This field combines the next and current id (each four bits) - 1681 * the next id is the most significant nibble. 1682 * Next Id: Set to the next slice to pass the authentication data through. 1683 * Set to FW_SLICE_DRAM_WR if the data is not to go through 1684 * any more slices after authentication. 1685 * Current Id: Initialised with the authentication slice type */ 1686 1687 /* LW 29 */ 1688 uint8_t resrvd3; 1689 /* Now a reserved field. MUST be set to 0 */ 1690 1691 uint8_t outer_prefix_sz; 1692 /* Size in bytes of outer prefix data */ 1693 1694 uint8_t final_sz; 1695 /* Size in bytes of digest to be returned to the client if requested */ 1696 1697 uint8_t inner_res_sz; 1698 /* Size in bytes of the digest from the inner hash algorithm */ 1699 1700 /* LW 30 */ 1701 uint8_t resrvd4; 1702 /* Now a reserved field. MUST be set to zero. */ 1703 1704 uint8_t inner_state1_sz; 1705 /* Size in bytes of inner hash state1 data. Must be a qword multiple */ 1706 1707 uint8_t inner_state2_offset; 1708 /* Quad word offset from the content descriptor parameters pointer to the 1709 * inner state2 value */ 1710 1711 uint8_t inner_state2_sz; 1712 /* Size in bytes of inner hash state2 data. Must be a qword multiple */ 1713 1714 /* LW 31 */ 1715 uint8_t outer_config_offset; 1716 /* Quad word offset from the content descriptor parameters pointer to the 1717 * outer configuration information */ 1718 1719 uint8_t outer_state1_sz; 1720 /* Size in bytes of the outer state1 value */ 1721 1722 uint8_t outer_res_sz; 1723 /* Size in bytes of digest from the outer auth algorithm */ 1724 1725 uint8_t outer_prefix_offset; 1726 /* Quad word offset from the start of the inner prefix data to the outer 1727 * prefix information. Should equal the rounded inner prefix size, converted 1728 * to qwords */ 1729 1730 }; 1731 1732 /* 1733 * Cipher + Authentication content descriptor control block header 1734 * Definition of both service-specific cipher + authentication control 1735 * block header structures. This header forms part of the content 1736 * descriptor block incorporating LWs 27-31, as defined by the common 1737 * base parameters structure. 1738 */ 1739 struct fw_cipher_auth_cd_ctrl_hdr 1740 { 1741 /* LW 27 */ 1742 uint8_t cipher_state_sz; 1743 /* State size in quad words of the cipher algorithm used in this session. 1744 * Set to zero if the algorithm doesnt provide any state */ 1745 1746 uint8_t cipher_key_sz; 1747 /* Key size in quad words of the cipher algorithm used in this session */ 1748 1749 uint8_t cipher_cfg_offset; 1750 /* Quad word offset from the content descriptor parameters address i.e. 1751 * (content_address + (cd_hdr_sz << 3)) to the parameters for the cipher 1752 * processing */ 1753 1754 uint8_t next_curr_id_cipher; 1755 /* This field combines the next and current id (each four bits) - 1756 * the next id is the most significant nibble. 1757 * Next Id: Set to the next slice to pass the ciphered data through. 1758 * Set to FW_SLICE_DRAM_WR if the data is not to go through 1759 * any more slices after cipher. 1760 * Current Id: Initialised with the cipher slice type */ 1761 1762 /* LW 28 */ 1763 uint8_t cipher_padding_sz; 1764 /* State padding size in quad words. Set to 0 if no padding is required. 1765 */ 1766 1767 uint8_t hash_flags; 1768 /* General flags defining the processing to perform. 0 is normal 1769 * processing 1770 * and 1 means there is a nested hash processing loop to go through */ 1771 1772 uint8_t hash_cfg_offset; 1773 /* Quad word offset from the content descriptor parameters address to the 1774 * parameters for the auth processing */ 1775 1776 uint8_t next_curr_id_auth; 1777 /* This field combines the next and current id (each four bits) - 1778 * the next id is the most significant nibble. 1779 * Next Id: Set to the next slice to pass the authentication data through. 1780 * Set to FW_SLICE_DRAM_WR if the data is not to go through 1781 * any more slices after authentication. 1782 * Current Id: Initialised with the authentication slice type */ 1783 1784 /* LW 29 */ 1785 uint8_t resrvd1; 1786 /* Reserved field. MUST be set to 0 */ 1787 1788 uint8_t outer_prefix_sz; 1789 /* Size in bytes of outer prefix data */ 1790 1791 uint8_t final_sz; 1792 /* Size in bytes of digest to be returned to the client if requested */ 1793 1794 uint8_t inner_res_sz; 1795 /* Size in bytes of the digest from the inner hash algorithm */ 1796 1797 /* LW 30 */ 1798 uint8_t resrvd2; 1799 /* Now a reserved field. MUST be set to zero. */ 1800 1801 uint8_t inner_state1_sz; 1802 /* Size in bytes of inner hash state1 data. Must be a qword multiple */ 1803 1804 uint8_t inner_state2_offset; 1805 /* Quad word offset from the content descriptor parameters pointer to the 1806 * inner state2 value */ 1807 1808 uint8_t inner_state2_sz; 1809 /* Size in bytes of inner hash state2 data. Must be a qword multiple */ 1810 1811 /* LW 31 */ 1812 uint8_t outer_config_offset; 1813 /* Quad word offset from the content descriptor parameters pointer to the 1814 * outer configuration information */ 1815 1816 uint8_t outer_state1_sz; 1817 /* Size in bytes of the outer state1 value */ 1818 1819 uint8_t outer_res_sz; 1820 /* Size in bytes of digest from the outer auth algorithm */ 1821 1822 uint8_t outer_prefix_offset; 1823 /* Quad word offset from the start of the inner prefix data to the outer 1824 * prefix information. Should equal the rounded inner prefix size, converted 1825 * to qwords */ 1826 1827 }; 1828 1829 #define FW_AUTH_HDR_FLAG_DO_NESTED 1 1830 /* Definition of the hash_flags bit of the auth_hdr to indicate the request 1831 * requires nested hashing */ 1832 1833 #define FW_AUTH_HDR_FLAG_NO_NESTED 0 1834 /* Definition of the hash_flags bit of the auth_hdr for no nested hashing 1835 * required */ 1836 1837 #define FW_CCM_GCM_AAD_SZ_MAX 240 1838 /* Maximum size of AAD data allowed for CCM or GCM processing. AAD data size90 - 1839 * is stored in 8-bit field and must be multiple of hash block size. 240 is 1840 * largest value which satisfy both requirements.AAD_SZ_MAX is in byte units */ 1841 1842 /* 1843 * request parameter #defines 1844 */ 1845 #define FW_HASH_REQUEST_PARAMETERS_OFFSET \ 1846 (sizeof(fw_la_cipher_req_params_t)) 1847 /* Offset in bytes from the start of the request parameters block to the hash 1848 * (auth) request parameters */ 1849 1850 #define FW_CIPHER_REQUEST_PARAMETERS_OFFSET (0) 1851 /* Offset in bytes from the start of the request parameters block to the cipher 1852 * request parameters */ 1853 1854 /* 1855 * Definition of the cipher request parameters block 1856 * 1857 * Definition of the cipher processing request parameters block 1858 * structure, which forms part of the block incorporating LWs 14-26, 1859 * as defined by the common base parameters structure. 1860 * Unused fields must be set to 0. 1861 */ 1862 struct fw_la_cipher_req_params { 1863 /* LW 14 */ 1864 uint32_t cipher_offset; 1865 /* Cipher offset long word. */ 1866 1867 /* LW 15 */ 1868 uint32_t cipher_length; 1869 /* Cipher length long word. */ 1870 1871 /* LWs 16-19 */ 1872 union { 1873 uint32_t cipher_IV_array[FW_NUM_LONGWORDS_4]; 1874 /* Cipher IV array */ 1875 1876 struct 1877 { 1878 uint64_t cipher_IV_ptr; 1879 /* Cipher IV pointer or Partial State Pointer */ 1880 1881 uint64_t resrvd1; 1882 /* reserved */ 1883 1884 } s; 1885 1886 } u; 1887 1888 }; 1889 1890 /* 1891 * Definition of the auth request parameters block 1892 * Definition of the authentication processing request parameters block 1893 * structure, which forms part of the block incorporating LWs 14-26, 1894 * as defined by the common base parameters structure. Note: 1895 * This structure is used by TLS only. 1896 */ 1897 struct fw_la_auth_req_params { 1898 /* LW 20 */ 1899 uint32_t auth_off; 1900 /* Byte offset from the start of packet to the auth data region */ 1901 1902 /* LW 21 */ 1903 uint32_t auth_len; 1904 /* Byte length of the auth data region */ 1905 1906 /* LWs 22-23 */ 1907 union { 1908 uint64_t auth_partial_st_prefix; 1909 /* Address of the authentication partial state prefix 1910 * information */ 1911 1912 uint64_t aad_adr; 1913 /* Address of the AAD info in DRAM. Used for the CCM and GCM 1914 * protocols */ 1915 1916 } u1; 1917 1918 /* LWs 24-25 */ 1919 uint64_t auth_res_addr; 1920 /* Address of the authentication result information to validate or 1921 * the location to which the digest information can be written back to */ 1922 1923 /* LW 26 */ 1924 union { 1925 uint8_t inner_prefix_sz; 1926 /* Size in bytes of the inner prefix data */ 1927 1928 uint8_t aad_sz; 1929 /* Size in bytes of padded AAD data to prefix to the packet for CCM 1930 * or GCM processing */ 1931 } u2; 1932 1933 uint8_t resrvd1; 1934 /* reserved */ 1935 1936 uint8_t hash_state_sz; 1937 /* Number of quad words of inner and outer hash prefix data to process 1938 * Maximum size is 240 */ 1939 1940 uint8_t auth_res_sz; 1941 /* Size in bytes of the authentication result */ 1942 1943 } __packed; 1944 1945 /* 1946 * Definition of the auth request parameters block 1947 * Definition of the authentication processing request parameters block 1948 * structure, which forms part of the block incorporating LWs 14-26, 1949 * as defined by the common base parameters structure. Note: 1950 * This structure is used by SSL3 and MGF1 only. All fields other than 1951 * inner prefix/ AAD size are unused and therefore reserved. 1952 */ 1953 struct fw_la_auth_req_params_resrvd_flds { 1954 /* LWs 20-25 */ 1955 uint32_t resrvd[FW_NUM_LONGWORDS_6]; 1956 1957 /* LW 26 */ 1958 union { 1959 uint8_t inner_prefix_sz; 1960 /* Size in bytes of the inner prefix data */ 1961 1962 uint8_t aad_sz; 1963 /* Size in bytes of padded AAD data to prefix to the packet for CCM 1964 * or GCM processing */ 1965 } u2; 1966 1967 uint8_t resrvd1; 1968 /* reserved */ 1969 1970 uint16_t resrvd2; 1971 /* reserved */ 1972 }; 1973 1974 /* 1975 * Definition of the shared fields within the parameter block 1976 * containing SSL, TLS or MGF information. 1977 * This structure defines the shared fields for SSL, TLS or MGF 1978 * within the parameter block incorporating LWs 14-26, as defined 1979 * by the common base parameters structure. 1980 * Unused fields must be set to 0. 1981 */ 1982 struct fw_la_key_gen_common { 1983 /* LW 14 */ 1984 union { 1985 /* SSL3 */ 1986 uint16_t secret_lgth_ssl; 1987 /* Length of Secret information for SSL. In the case of TLS the 1988 * secret is supplied in the content descriptor */ 1989 1990 /* MGF */ 1991 uint16_t mask_length; 1992 /* Size in bytes of the desired output mask for MGF1*/ 1993 1994 /* TLS */ 1995 uint16_t secret_lgth_tls; 1996 /* TLS Secret length */ 1997 1998 } u; 1999 2000 union { 2001 /* SSL3 */ 2002 struct 2003 { 2004 uint8_t output_lgth_ssl; 2005 /* Output length */ 2006 2007 uint8_t label_lgth_ssl; 2008 /* Label length */ 2009 2010 } s1; 2011 2012 /* MGF */ 2013 struct 2014 { 2015 uint8_t hash_length; 2016 /* Hash length */ 2017 2018 uint8_t seed_length; 2019 /* Seed length */ 2020 2021 } s2; 2022 2023 /* TLS */ 2024 struct 2025 { 2026 uint8_t output_lgth_tls; 2027 /* Output length */ 2028 2029 uint8_t label_lgth_tls; 2030 /* Label length */ 2031 2032 } s3; 2033 2034 } u1; 2035 2036 /* LW 15 */ 2037 union { 2038 /* SSL3 */ 2039 uint8_t iter_count; 2040 /* Iteration count used by the SSL key gen request */ 2041 2042 /* TLS */ 2043 uint8_t tls_seed_length; 2044 /* TLS Seed length */ 2045 2046 uint8_t resrvd1; 2047 /* Reserved field set to 0 for MGF1 */ 2048 2049 } u2; 2050 2051 uint8_t resrvd2; 2052 uint16_t resrvd3; 2053 /* Reserved space - unused */ 2054 2055 }; 2056 2057 /* 2058 * Definition of the SSL3 request parameters block 2059 * This structure contains the the SSL3 processing request parameters 2060 * incorporating LWs 14-26, as defined by the common base 2061 * parameters structure. Unused fields must be set to 0. 2062 */ 2063 struct fw_la_ssl3_req_params { 2064 /* LWs 14-15 */ 2065 struct fw_la_key_gen_common keygen_comn; 2066 /* For other key gen processing these field holds ssl, tls or mgf 2067 * parameters */ 2068 2069 /* LW 16-25 */ 2070 uint32_t resrvd[FW_NUM_LONGWORDS_10]; 2071 /* Reserved */ 2072 2073 /* LW 26 */ 2074 union { 2075 uint8_t inner_prefix_sz; 2076 /* Size in bytes of the inner prefix data */ 2077 2078 uint8_t aad_sz; 2079 /* Size in bytes of padded AAD data to prefix to the packet for CCM 2080 * or GCM processing */ 2081 } u2; 2082 2083 uint8_t resrvd1; 2084 /* reserved */ 2085 2086 uint16_t resrvd2; 2087 /* reserved */ 2088 2089 }; 2090 2091 /* 2092 * Definition of the MGF request parameters block 2093 * This structure contains the the MGF processing request parameters 2094 * incorporating LWs 14-26, as defined by the common base parameters 2095 * structure. Unused fields must be set to 0. 2096 */ 2097 struct fw_la_mgf_req_params { 2098 /* LWs 14-15 */ 2099 struct fw_la_key_gen_common keygen_comn; 2100 /* For other key gen processing these field holds ssl or mgf 2101 * parameters */ 2102 2103 /* LW 16-25 */ 2104 uint32_t resrvd[FW_NUM_LONGWORDS_10]; 2105 /* Reserved */ 2106 2107 /* LW 26 */ 2108 union { 2109 uint8_t inner_prefix_sz; 2110 /* Size in bytes of the inner prefix data */ 2111 2112 uint8_t aad_sz; 2113 /* Size in bytes of padded AAD data to prefix to the packet for CCM 2114 * or GCM processing */ 2115 } u2; 2116 2117 uint8_t resrvd1; 2118 /* reserved */ 2119 2120 uint16_t resrvd2; 2121 /* reserved */ 2122 2123 }; 2124 2125 /* 2126 * Definition of the TLS request parameters block 2127 * This structure contains the the TLS processing request parameters 2128 * incorporating LWs 14-26, as defined by the common base parameters 2129 * structure. Unused fields must be set to 0. 2130 */ 2131 struct fw_la_tls_req_params { 2132 /* LWs 14-15 */ 2133 struct fw_la_key_gen_common keygen_comn; 2134 /* For other key gen processing these field holds ssl, tls or mgf 2135 * parameters */ 2136 2137 /* LW 16-19 */ 2138 uint32_t resrvd[FW_NUM_LONGWORDS_4]; 2139 /* Reserved */ 2140 2141 }; 2142 2143 /* 2144 * Definition of the common QAT FW request middle block for TRNG. 2145 * Common section of the request used across all of the services exposed 2146 * by the QAT FW. Each of the services inherit these common fields. TRNG 2147 * requires a specific implementation. 2148 */ 2149 struct fw_la_trng_req_mid { 2150 /* LWs 6-13 */ 2151 uint64_t opaque_data; 2152 /* Opaque data passed unmodified from the request to response messages by 2153 * firmware (fw) */ 2154 2155 uint64_t resrvd1; 2156 /* Reserved, unused for TRNG */ 2157 2158 uint64_t dest_data_addr; 2159 /* Generic definition of the destination data supplied to the QAT AE. The 2160 * common flags are used to further describe the attributes of this 2161 * field */ 2162 2163 uint32_t resrvd2; 2164 /* Reserved, unused for TRNG */ 2165 2166 uint32_t entropy_length; 2167 /* Size of the data in bytes to process. Used by the get_random 2168 * command. Set to 0 for commands that dont need a length parameter */ 2169 2170 }; 2171 2172 /* 2173 * Definition of the common LA QAT FW TRNG request 2174 * Definition of the TRNG processing request type 2175 */ 2176 struct fw_la_trng_req { 2177 /* LWs 0-1 */ 2178 struct fw_comn_req_hdr comn_hdr; 2179 /* Common request header */ 2180 2181 /* LWs 2-5 */ 2182 union fw_comn_req_hdr_cd_pars cd_pars; 2183 /* Common Request content descriptor field which points either to a 2184 * content descriptor 2185 * parameter block or contains the service-specific data itself. */ 2186 2187 /* LWs 6-13 */ 2188 struct fw_la_trng_req_mid comn_mid; 2189 /* TRNG request middle section - differs from the common mid-section */ 2190 2191 /* LWs 14-26 */ 2192 uint32_t resrvd1[FW_NUM_LONGWORDS_13]; 2193 2194 /* LWs 27-31 */ 2195 uint32_t resrvd2[FW_NUM_LONGWORDS_5]; 2196 2197 }; 2198 2199 /* 2200 * Definition of the Lookaside Eagle Tail Response 2201 * This is the response delivered to the ET rings by the Lookaside 2202 * QAT FW service for all commands 2203 */ 2204 struct fw_la_resp { 2205 /* LWs 0-1 */ 2206 struct fw_comn_resp_hdr comn_resp; 2207 /* Common interface response format see fw.h */ 2208 2209 /* LWs 2-3 */ 2210 uint64_t opaque_data; 2211 /* Opaque data passed from the request to the response message */ 2212 2213 /* LWs 4-7 */ 2214 uint32_t resrvd[FW_NUM_LONGWORDS_4]; 2215 /* Reserved */ 2216 2217 }; 2218 2219 /* 2220 * Definition of the Lookaside TRNG Test Status Structure 2221 * As an addition to FW_LA_TRNG_STATUS Pass or Fail information 2222 * in common response fields, as a response to TRNG_TEST request, Test 2223 * status, Counter for failed tests and 4 entropy counter values are 2224 * sent 2225 * Status of test status and the fail counts. 2226 */ 2227 struct fw_la_trng_test_result { 2228 uint32_t test_status_info; 2229 /* TRNG comparator health test status& Validity information 2230 see Test Status Bit Fields below. */ 2231 2232 uint32_t test_status_fail_count; 2233 /* TRNG comparator health test status, 32bit fail counter */ 2234 2235 uint64_t r_ent_ones_cnt; 2236 /* Raw Entropy ones counter */ 2237 2238 uint64_t r_ent_zeros_cnt; 2239 /* Raw Entropy zeros counter */ 2240 2241 uint64_t c_ent_ones_cnt; 2242 /* Conditioned Entropy ones counter */ 2243 2244 uint64_t c_ent_zeros_cnt; 2245 /* Conditioned Entropy zeros counter */ 2246 2247 uint64_t resrvd; 2248 /* Reserved field must be set to zero */ 2249 2250 }; 2251 2252 /* 2253 * Definition of the Lookaside SSL Key Material Input 2254 * This struct defines the layout of input parameters for the 2255 * SSL3 key generation (source flat buffer format) 2256 */ 2257 struct fw_la_ssl_key_material_input { 2258 uint64_t seed_addr; 2259 /* Pointer to seed */ 2260 2261 uint64_t label_addr; 2262 /* Pointer to label(s) */ 2263 2264 uint64_t secret_addr; 2265 /* Pointer to secret */ 2266 2267 }; 2268 2269 /* 2270 * Definition of the Lookaside TLS Key Material Input 2271 * This struct defines the layout of input parameters for the 2272 * TLS key generation (source flat buffer format) 2273 * NOTE: 2274 * Secret state value (S split into S1 and S2 parts) is supplied via 2275 * Content Descriptor. S1 is placed in an outer prefix buffer, and S2 2276 * inside the inner prefix buffer. 2277 */ 2278 struct fw_la_tls_key_material_input { 2279 uint64_t seed_addr; 2280 /* Pointer to seed */ 2281 2282 uint64_t label_addr; 2283 /* Pointer to label(s) */ 2284 2285 }; 2286 2287 /* 2288 * Macros using the bit position and mask to set/extract the next 2289 * and current id nibbles within the next_curr_id field of the 2290 * content descriptor header block, ONLY FOR CIPHER + AUTH COMBINED. 2291 * Note that for cipher only or authentication only, the common macros 2292 * need to be used. These are defined in the 'fw.h' common header 2293 * file, as they are used by compression, cipher and authentication. 2294 * 2295 * cd_ctrl_hdr_t Content descriptor control block header. 2296 * val Value of the field being set. 2297 */ 2298 /* Cipher fields within Cipher + Authentication structure */ 2299 #define FW_CIPHER_NEXT_ID_GET(cd_ctrl_hdr_t) \ 2300 ((((cd_ctrl_hdr_t)->next_curr_id_cipher) & \ 2301 FW_COMN_NEXT_ID_MASK) >> \ 2302 (FW_COMN_NEXT_ID_BITPOS)) 2303 2304 #define FW_CIPHER_NEXT_ID_SET(cd_ctrl_hdr_t, val) \ 2305 (cd_ctrl_hdr_t)->next_curr_id_cipher = \ 2306 ((((cd_ctrl_hdr_t)->next_curr_id_cipher) & \ 2307 FW_COMN_CURR_ID_MASK) | \ 2308 ((val << FW_COMN_NEXT_ID_BITPOS) & \ 2309 FW_COMN_NEXT_ID_MASK)) 2310 2311 #define FW_CIPHER_CURR_ID_GET(cd_ctrl_hdr_t) \ 2312 (((cd_ctrl_hdr_t)->next_curr_id_cipher) & FW_COMN_CURR_ID_MASK) 2313 2314 #define FW_CIPHER_CURR_ID_SET(cd_ctrl_hdr_t, val) \ 2315 (cd_ctrl_hdr_t)->next_curr_id_cipher = \ 2316 ((((cd_ctrl_hdr_t)->next_curr_id_cipher) & \ 2317 FW_COMN_NEXT_ID_MASK) | \ 2318 ((val)&FW_COMN_CURR_ID_MASK)) 2319 2320 /* Authentication fields within Cipher + Authentication structure */ 2321 #define FW_AUTH_NEXT_ID_GET(cd_ctrl_hdr_t) \ 2322 ((((cd_ctrl_hdr_t)->next_curr_id_auth) & FW_COMN_NEXT_ID_MASK) >> \ 2323 (FW_COMN_NEXT_ID_BITPOS)) 2324 2325 #define FW_AUTH_NEXT_ID_SET(cd_ctrl_hdr_t, val) \ 2326 (cd_ctrl_hdr_t)->next_curr_id_auth = \ 2327 ((((cd_ctrl_hdr_t)->next_curr_id_auth) & \ 2328 FW_COMN_CURR_ID_MASK) | \ 2329 ((val << FW_COMN_NEXT_ID_BITPOS) & \ 2330 FW_COMN_NEXT_ID_MASK)) 2331 2332 #define FW_AUTH_CURR_ID_GET(cd_ctrl_hdr_t) \ 2333 (((cd_ctrl_hdr_t)->next_curr_id_auth) & FW_COMN_CURR_ID_MASK) 2334 2335 #define FW_AUTH_CURR_ID_SET(cd_ctrl_hdr_t, val) \ 2336 (cd_ctrl_hdr_t)->next_curr_id_auth = \ 2337 ((((cd_ctrl_hdr_t)->next_curr_id_auth) & \ 2338 FW_COMN_NEXT_ID_MASK) | \ 2339 ((val)&FW_COMN_CURR_ID_MASK)) 2340 2341 /* Definitions of the bits in the test_status_info of the TRNG_TEST response. 2342 * The values returned by the Lookaside service are given below 2343 * The Test result and Test Fail Count values are only valid if the Test 2344 * Results Valid (Tv) is set. 2345 * 2346 * TRNG Test Status Info 2347 * + ===== + ------------------------------------------------ + --- + --- + 2348 * | Bit | 31 - 2 | 1 | 0 | 2349 * + ===== + ------------------------------------------------ + --- + --- + 2350 * | Flags | RESERVED = 0 | Tv | Ts | 2351 * + ===== + ------------------------------------------------------------ + 2352 */ 2353 /* 2354 * Definition of the Lookaside TRNG Test Status Information received as 2355 * a part of fw_la_trng_test_result_t 2356 * 2357 */ 2358 #define FW_LA_TRNG_TEST_STATUS_TS_BITPOS 0 2359 /* TRNG Test Result t_status field bit pos definition. */ 2360 2361 #define FW_LA_TRNG_TEST_STATUS_TS_MASK 0x1 2362 /* TRNG Test Result t_status field mask definition. */ 2363 2364 #define FW_LA_TRNG_TEST_STATUS_TV_BITPOS 1 2365 /* TRNG Test Result test results valid field bit pos definition. */ 2366 2367 #define FW_LA_TRNG_TEST_STATUS_TV_MASK 0x1 2368 /* TRNG Test Result test results valid field mask definition. */ 2369 2370 /* 2371 * Definition of the Lookaside TRNG test_status values. 2372 * 2373 * 2374 */ 2375 #define FW_LA_TRNG_TEST_STATUS_TV_VALID 1 2376 /* TRNG TEST Response Test Results Valid Value. */ 2377 2378 #define FW_LA_TRNG_TEST_STATUS_TV_NOT_VALID 0 2379 /* TRNG TEST Response Test Results are NOT Valid Value. */ 2380 2381 #define FW_LA_TRNG_TEST_STATUS_TS_NO_FAILS 1 2382 /* Value for TRNG Test status tests have NO FAILs Value. */ 2383 2384 #define FW_LA_TRNG_TEST_STATUS_TS_HAS_FAILS 0 2385 /* Value for TRNG Test status tests have one or more FAILS Value. */ 2386 2387 /* 2388 * Macro for extraction of the Test Status Field returned in the response 2389 * to TRNG TEST command. 2390 * 2391 * test_status 8 bit test_status value to extract the status bit 2392 */ 2393 #define FW_LA_TRNG_TEST_STATUS_TS_FLD_GET(test_status) \ 2394 FIELD_GET(test_status, \ 2395 FW_LA_TRNG_TEST_STATUS_TS_BITPOS, \ 2396 FW_LA_TRNG_TEST_STATUS_TS_MASK) 2397 /* 2398 * Macro for extraction of the Test Results Valid Field returned in the 2399 * response to TRNG TEST command. 2400 * 2401 * test_status 8 bit test_status value to extract the Tests 2402 * Results valid bit 2403 */ 2404 #define FW_LA_TRNG_TEST_STATUS_TV_FLD_GET(test_status) \ 2405 FIELD_GET(test_status, \ 2406 FW_LA_TRNG_TEST_STATUS_TV_BITPOS, \ 2407 FW_LA_TRNG_TEST_STATUS_TV_MASK) 2408 2409 /* 2410 * MGF Max supported input parameters 2411 */ 2412 #define FW_LA_MGF_SEED_LEN_MAX 255 2413 /* Maximum seed length for MGF1 request in bytes 2414 * Typical values may be 48, 64, 128 bytes (or any). */ 2415 2416 #define FW_LA_MGF_MASK_LEN_MAX 65528 2417 /* Maximum mask length for MGF1 request in bytes 2418 * Typical values may be 8 (64-bit), 16 (128-bit). MUST be quad word multiple */ 2419 2420 /* 2421 * SSL Max supported input parameters 2422 */ 2423 #define FW_LA_SSL_SECRET_LEN_MAX 512 2424 /* Maximum secret length for SSL3 Key Gen request (bytes) */ 2425 2426 #define FW_LA_SSL_ITERATES_LEN_MAX 16 2427 /* Maximum iterations for SSL3 Key Gen request (integer) */ 2428 2429 #define FW_LA_SSL_LABEL_LEN_MAX 136 2430 /* Maximum label length for SSL3 Key Gen request (bytes) */ 2431 2432 #define FW_LA_SSL_SEED_LEN_MAX 64 2433 /* Maximum seed length for SSL3 Key Gen request (bytes) */ 2434 2435 #define FW_LA_SSL_OUTPUT_LEN_MAX 248 2436 /* Maximum output length for SSL3 Key Gen request (bytes) */ 2437 2438 /* 2439 * TLS Max supported input parameters 2440 */ 2441 #define FW_LA_TLS_SECRET_LEN_MAX 128 2442 /* Maximum secret length for TLS Key Gen request (bytes) */ 2443 2444 #define FW_LA_TLS_V1_1_SECRET_LEN_MAX 128 2445 /* Maximum secret length for TLS Key Gen request (bytes) */ 2446 2447 #define FW_LA_TLS_V1_2_SECRET_LEN_MAX 64 2448 /* Maximum secret length for TLS Key Gen request (bytes) */ 2449 2450 #define FW_LA_TLS_LABEL_LEN_MAX 255 2451 /* Maximum label length for TLS Key Gen request (bytes) */ 2452 2453 #define FW_LA_TLS_SEED_LEN_MAX 64 2454 /* Maximum seed length for TLS Key Gen request (bytes) */ 2455 2456 #define FW_LA_TLS_OUTPUT_LEN_MAX 248 2457 /* Maximum output length for TLS Key Gen request (bytes) */ 2458 2459 #endif 2460