1 /* SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-3-Clause */
2 /* $NetBSD: qat_hw17reg.h,v 1.1 2019/11/20 09:37:46 hikaru Exp $ */
5 * Copyright (c) 2019 Internet Initiative Japan, Inc.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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.
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.
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
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
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.
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.
61 #ifndef _DEV_PCI_QAT_HW17REG_H_
62 #define _DEV_PCI_QAT_HW17REG_H_
64 /* Default message size in bytes */
65 #define FW_REQ_DEFAULT_SZ_HW17 128
66 #define FW_RESP_DEFAULT_SZ_HW17 32
68 /* -------------------------------------------------------------------------- */
71 enum fw_init_admin_cmd_id {
79 FW_HEARTBEAT_SYNC = 7,
81 FW_COMP_CAPABILITY_GET = 9,
82 FW_CRYPTO_CAPABILITY_GET = 10,
83 FW_HEARTBEAT_TIMER_SET = 13,
86 enum fw_init_admin_resp_status {
87 FW_INIT_RESP_STATUS_SUCCESS = 0,
88 FW_INIT_RESP_STATUS_FAIL = 1,
89 FW_INIT_RESP_STATUS_UNSUPPORTED = 4
92 struct fw_init_admin_req {
95 uint8_t init_admin_cmd_id;
98 uint64_t init_cfg_ptr;
102 uint16_t ibuf_size_in_kb;
105 uint32_t heartbeat_ticks;
111 struct fw_init_admin_resp_hdr {
115 uint8_t init_admin_cmd_id;
118 enum fw_init_admin_init_flag {
119 FW_INIT_FLAG_PKE_DISABLED = 0
122 struct fw_init_admin_fw_capability_resp_hdr {
125 uint8_t init_admin_cmd_id;
128 struct fw_init_admin_capability_resp {
129 struct fw_init_admin_fw_capability_resp_hdr init_resp_hdr;
130 uint32_t extended_features;
131 uint64_t opaque_data;
134 uint16_t compression_algos;
135 uint16_t checksum_algos;
136 uint32_t deflate_capabilities;
138 uint32_t lzs_capabilities;
141 uint32_t cipher_algos;
143 uint16_t keygen_algos;
145 uint16_t public_key_algos;
146 uint16_t prime_algos;
151 struct fw_init_admin_resp_pars {
155 uint32_t version_patch_num;
162 uint64_t req_rec_count;
163 uint64_t resp_sent_count;
168 struct fw_init_admin_hb_cnt {
169 uint16_t resp_heartbeat_cnt;
170 uint16_t req_heartbeat_cnt;
173 #define QAT_NUM_THREADS 8
175 struct fw_init_admin_hb_stats {
176 struct fw_init_admin_hb_cnt stats[QAT_NUM_THREADS];
179 struct fw_init_admin_resp {
180 struct fw_init_admin_resp_hdr init_resp_hdr;
184 uint16_t version_minor_num;
185 uint16_t version_major_num;
188 uint64_t opaque_data;
189 struct fw_init_admin_resp_pars init_resp_pars;
192 #define FW_COMN_HEARTBEAT_OK 0
193 #define FW_COMN_HEARTBEAT_BLOCKED 1
194 #define FW_COMN_HEARTBEAT_FLAG_BITPOS 0
195 #define FW_COMN_HEARTBEAT_FLAG_MASK 0x1
196 #define FW_COMN_STATUS_RESRVD_FLD_MASK 0xFE
197 #define FW_COMN_HEARTBEAT_HDR_FLAG_GET(hdr_t) \
198 FW_COMN_HEARTBEAT_FLAG_GET(hdr_t.flags)
200 #define FW_COMN_HEARTBEAT_HDR_FLAG_SET(hdr_t, val) \
201 FW_COMN_HEARTBEAT_FLAG_SET(hdr_t, val)
203 #define FW_COMN_HEARTBEAT_FLAG_GET(flags) \
204 QAT_FIELD_GET(flags, \
205 FW_COMN_HEARTBEAT_FLAG_BITPOS, \
206 FW_COMN_HEARTBEAT_FLAG_MASK)
208 /* -------------------------------------------------------------------------- */
210 /* Big assumptions that both bitpos and mask are constants */
211 #define FIELD_SET(flags, val, bitpos, mask) \
213 (((flags) & (~((mask) << (bitpos)))) | (((val) & (mask)) << (bitpos)))
215 #define FIELD_GET(flags, bitpos, mask) (((flags) >> (bitpos)) & (mask))
217 #define FLAG_SET(flags, bitpos) (flags) = ((flags) | (1 << (bitpos)))
219 #define FLAG_CLEAR(flags, bitpos) (flags) = ((flags) & (~(1 << (bitpos))))
221 #define FLAG_GET(flags, bitpos) (((flags) >> (bitpos)) & 1)
223 /* Default request and response ring size in bytes */
224 #define FW_REQ_DEFAULT_SZ 128
225 #define FW_RESP_DEFAULT_SZ 32
227 #define FW_COMN_ONE_BYTE_SHIFT 8
228 #define FW_COMN_SINGLE_BYTE_MASK 0xFF
230 /* Common Request - Block sizes definitions in multiples of individual long
232 #define FW_NUM_LONGWORDS_1 1
233 #define FW_NUM_LONGWORDS_2 2
234 #define FW_NUM_LONGWORDS_3 3
235 #define FW_NUM_LONGWORDS_4 4
236 #define FW_NUM_LONGWORDS_5 5
237 #define FW_NUM_LONGWORDS_6 6
238 #define FW_NUM_LONGWORDS_7 7
239 #define FW_NUM_LONGWORDS_10 10
240 #define FW_NUM_LONGWORDS_13 13
242 /* Definition of the associated service Id for NULL service type.
243 Note: the response is expected to use FW_COMN_RESP_SERV_CPM_FW */
244 #define FW_NULL_REQ_SERV_ID 1
247 * Definition of the firmware interface service users, for
249 * Enumeration which is used to indicate the ids of the services
250 * for responses using the external firmware interfaces.
253 enum fw_comn_resp_serv_id {
254 FW_COMN_RESP_SERV_NULL, /* NULL service id type */
255 FW_COMN_RESP_SERV_CPM_FW, /* CPM FW Service ID */
256 FW_COMN_RESP_SERV_DELIMITER /* Delimiter service id type */
260 * Definition of the request types
261 * Enumeration which is used to indicate the ids of the request
262 * types used in each of the external firmware interfaces
265 enum fw_comn_request_id {
266 FW_COMN_REQ_NULL = 0, /* NULL request type */
267 FW_COMN_REQ_CPM_FW_PKE = 3, /* CPM FW PKE Request */
268 FW_COMN_REQ_CPM_FW_LA = 4, /* CPM FW Lookaside Request */
269 FW_COMN_REQ_CPM_FW_DMA = 7, /* CPM FW DMA Request */
270 FW_COMN_REQ_CPM_FW_COMP = 9, /* CPM FW Compression Request */
271 FW_COMN_REQ_DELIMITER /* End delimiter */
276 * Definition of the common QAT FW request content descriptor field -
277 * points to the content descriptor parameters or itself contains service-
278 * specific data. Also specifies content descriptor parameter size.
279 * Contains reserved fields.
280 * Common section of the request used across all of the services exposed
281 * by the QAT FW. Each of the services inherit these common fields
283 union fw_comn_req_hdr_cd_pars {
287 uint64_t content_desc_addr;
288 /* Address of the content descriptor */
290 uint16_t content_desc_resrvd1;
291 /* Content descriptor reserved field */
293 uint8_t content_desc_params_sz;
294 /* Size of the content descriptor parameters in quad words. These
295 * parameters describe the session setup configuration info for the
296 * slices that this request relies upon i.e. the configuration word and
297 * cipher key needed by the cipher slice if there is a request for
298 * cipher processing. */
300 uint8_t content_desc_hdr_resrvd2;
301 /* Content descriptor reserved field */
303 uint32_t content_desc_resrvd3;
304 /* Content descriptor reserved field */
309 uint32_t serv_specif_fields[FW_NUM_LONGWORDS_4];
316 * Definition of the common QAT FW request middle block.
317 * Common section of the request used across all of the services exposed
318 * by the QAT FW. Each of the services inherit these common fields
320 struct fw_comn_req_mid
323 uint64_t opaque_data;
324 /* Opaque data passed unmodified from the request to response messages by
327 uint64_t src_data_addr;
328 /* Generic definition of the source data supplied to the QAT AE. The
329 * common flags are used to further describe the attributes of this
332 uint64_t dest_data_addr;
333 /* Generic definition of the destination data supplied to the QAT AE. The
334 * common flags are used to further describe the attributes of this
338 /* Length of source flat buffer incase src buffer
342 /* Length of source flat buffer incase dst buffer
348 * Definition of the common QAT FW request content descriptor control
351 * Service specific section of the request used across all of the services
352 * exposed by the QAT FW. Each of the services populates this block
353 * uniquely. Refer to the service-specific header structures e.g.
354 * 'fw_cipher_hdr_s' (for Cipher) etc.
356 struct fw_comn_req_cd_ctrl
359 uint32_t content_desc_ctrl_lw[FW_NUM_LONGWORDS_5];
364 * Definition of the common QAT FW request header.
365 * Common section of the request used across all of the services exposed
366 * by the QAT FW. Each of the services inherit these common fields. The
367 * reserved field of 7 bits and the service command Id field are all
368 * service-specific fields, along with the service specific flags.
370 struct fw_comn_req_hdr
376 uint8_t service_cmd_id;
377 /* Service Command Id - this field is service-specific
378 * Please use service-specific command Id here e.g.Crypto Command Id
379 * or Compression Command Id etc. */
381 uint8_t service_type;
385 /* This represents a flags field for the Service Request.
386 * The most significant bit is the 'valid' flag and the only
387 * one used. All remaining bit positions are unused and
388 * are therefore reserved and need to be set to 0. */
391 uint16_t serv_specif_flags;
392 /* Common Request service-specific flags
393 * e.g. Symmetric Crypto Command Flags */
395 uint16_t comn_req_flags;
396 /* Common Request Flags consisting of
397 * - 14 reserved bits,
398 * - 1 Content Descriptor field type bit and
399 * - 1 Source/destination pointer type bit */
404 * Definition of the common QAT FW request parameter field.
406 * Service specific section of the request used across all of the services
407 * exposed by the QAT FW. Each of the services populates this block
408 * uniquely. Refer to service-specific header structures e.g.
409 * 'fw_comn_req_cipher_rqpars_s' (for Cipher) etc.
412 struct fw_comn_req_rqpars
415 uint32_t serv_specif_rqpars_lw[FW_NUM_LONGWORDS_13];
420 * Definition of the common request structure with service specific
422 * This is a definition of the full qat request structure used by all
423 * services. Each service is free to use the service fields in its own
424 * way. This struct is useful as a message passing argument before the
425 * service contained within the request is determined.
430 struct fw_comn_req_hdr comn_hdr;
431 /* Common request header */
434 union fw_comn_req_hdr_cd_pars cd_pars;
435 /* Common Request content descriptor field which points either to a
437 * parameter block or contains the service-specific data itself. */
440 struct fw_comn_req_mid comn_mid;
441 /* Common request middle section */
444 struct fw_comn_req_rqpars serv_specif_rqpars;
445 /* Common request service-specific parameter field */
448 struct fw_comn_req_cd_ctrl cd_ctrl;
449 /* Common request content descriptor control block -
450 * this field is service-specific */
457 * Overloaded field with 8 bit common error field or two
458 * 8 bit compression error fields for compression and translator slices
460 union fw_comn_error {
464 /* 8 bit reserved field */
466 uint8_t comn_err_code;
467 /* 8 bit common error code */
470 /* Structure which is used for non-compression responses */
474 uint8_t xlat_err_code;
475 /* 8 bit translator error field */
477 uint8_t cmp_err_code;
478 /* 8 bit compression error field */
481 /* Structure which is used for compression responses */
486 * Definition of the common QAT FW response header.
487 * This section of the response is common across all of the services
488 * that generate a firmware interface response
490 struct fw_comn_resp_hdr
494 /* Reserved field - this field is service-specific -
495 * Note: The Response Destination Id has been removed
496 * from first QWord */
499 /* Service Id returned by service block */
501 uint8_t response_type;
502 /* Response type - copied from the request to
503 * the response message */
506 /* This represents a flags field for the Response.
507 * Bit<7> = 'valid' flag
508 * Bit<6> = 'CNV' flag indicating that CNV was executed
509 * on the current request
510 * Bit<5> = 'CNVNR' flag indicating that a recovery happened
511 * on the current request following a CNV error
512 * All remaining bits are unused and are therefore reserved.
513 * They must to be set to 0.
517 union fw_comn_error comn_error;
518 /* This field is overloaded to allow for one 8 bit common error field
519 * or two 8 bit error fields from compression and translator */
522 /* Status field which specifies which slice(s) report an error */
525 /* Command Id - passed from the request to the response message */
530 * Definition of the common response structure with service specific
532 * This is a definition of the full qat response structure used by all
538 struct fw_comn_resp_hdr comn_hdr;
539 /* Common header fields */
542 uint64_t opaque_data;
543 /* Opaque data passed from the request to the response message */
546 uint32_t resrvd[FW_NUM_LONGWORDS_4];
551 /* Common QAT FW request header - structure of LW0
552 * + ===== + ---- + ----------- + ----------- + ----------- + ----------- +
553 * | Bit | 31 | 30 - 24 | 21 - 16 | 15 - 8 | 7 - 0 |
554 * + ===== + ---- + ----------- + ----------- + ----------- + ----------- +
555 * | Flags | V | Reserved | Serv Type | Serv Cmd Id | Reserved |
556 * + ===== + ---- + ----------- + ----------- + ----------- + ----------- +
559 #define FW_COMN_VALID __BIT(7)
561 /* Common QAT FW response header - structure of LW0
562 * + ===== + --- + --- + ----- + ----- + --------- + ----------- + ----- +
563 * | Bit | 31 | 30 | 29 | 28-24 | 21 - 16 | 15 - 8 | 7-0 |
564 * + ===== + --- + ----+ ----- + ----- + --------- + ----------- + ----- +
565 * | Flags | V | CNV | CNVNR | Rsvd | Serv Type | Serv Cmd Id | Rsvd |
566 * + ===== + --- + --- + ----- + ----- + --------- + ----------- + ----- + */
567 /* Macros defining the bit position and mask of 'CNV' flag
568 * within the hdr_flags field of LW0 (service response only) */
569 #define FW_COMN_CNV_FLAG_BITPOS 6
570 #define FW_COMN_CNV_FLAG_MASK 0x1
572 /* Macros defining the bit position and mask of CNVNR flag
573 * within the hdr_flags field of LW0 (service response only) */
574 #define FW_COMN_CNVNR_FLAG_BITPOS 5
575 #define FW_COMN_CNVNR_FLAG_MASK 0x1
578 * Macro for extraction of Service Type Field
580 * struct fw_comn_req_hdr Structure 'fw_comn_req_hdr_t'
581 * to extract the Service Type Field
583 #define FW_COMN_OV_SRV_TYPE_GET(fw_comn_req_hdr_t) \
584 fw_comn_req_hdr_t.service_type
587 * Macro for setting of Service Type Field
589 * 'fw_comn_req_hdr_t' structure to set the Service
591 * val Value of the Service Type Field
593 #define FW_COMN_OV_SRV_TYPE_SET(fw_comn_req_hdr_t, val) \
594 fw_comn_req_hdr_t.service_type = val
597 * Macro for extraction of Service Command Id Field
599 * struct fw_comn_req_hdr Structure 'fw_comn_req_hdr_t'
600 * to extract the Service Command Id Field
602 #define FW_COMN_OV_SRV_CMD_ID_GET(fw_comn_req_hdr_t) \
603 fw_comn_req_hdr_t.service_cmd_id
606 * Macro for setting of Service Command Id Field
608 * 'fw_comn_req_hdr_t' structure to set the
609 * Service Command Id Field
610 * val Value of the Service Command Id Field
612 #define FW_COMN_OV_SRV_CMD_ID_SET(fw_comn_req_hdr_t, val) \
613 fw_comn_req_hdr_t.service_cmd_id = val
616 * Extract the valid flag from the request or response's header flags.
618 * hdr_t Request or Response 'hdr_t' structure to extract the valid bit
619 * from the 'hdr_flags' field.
621 #define FW_COMN_HDR_VALID_FLAG_GET(hdr_t) \
622 FW_COMN_VALID_FLAG_GET(hdr_t.hdr_flags)
625 * Extract the CNVNR flag from the header flags in the response only.
627 * hdr_t Response 'hdr_t' structure to extract the CNVNR bit
628 * from the 'hdr_flags' field.
630 #define FW_COMN_HDR_CNVNR_FLAG_GET(hdr_flags) \
631 FIELD_GET(hdr_flags, \
632 FW_COMN_CNVNR_FLAG_BITPOS, \
633 FW_COMN_CNVNR_FLAG_MASK)
636 * Extract the CNV flag from the header flags in the response only.
638 * hdr_t Response 'hdr_t' structure to extract the CNV bit
639 * from the 'hdr_flags' field.
641 #define FW_COMN_HDR_CNV_FLAG_GET(hdr_flags) \
642 FIELD_GET(hdr_flags, \
643 FW_COMN_CNV_FLAG_BITPOS, \
644 FW_COMN_CNV_FLAG_MASK)
647 * Set the valid bit in the request's header flags.
649 * hdr_t Request or Response 'hdr_t' structure to set the valid bit
650 * val Value of the valid bit flag.
652 #define FW_COMN_HDR_VALID_FLAG_SET(hdr_t, val) \
653 FW_COMN_VALID_FLAG_SET(hdr_t, val)
656 * Common macro to extract the valid flag from the header flags field
657 * within the header structure (request or response).
659 * hdr_t Structure (request or response) to extract the
660 * valid bit from the 'hdr_flags' field.
662 #define FW_COMN_VALID_FLAG_GET(hdr_flags) \
663 FIELD_GET(hdr_flags, \
664 FW_COMN_VALID_FLAG_BITPOS, \
665 FW_COMN_VALID_FLAG_MASK)
668 * Common macro to extract the remaining reserved flags from the header
669 * flags field within the header structure (request or response).
671 * hdr_t Structure (request or response) to extract the
672 * remaining bits from the 'hdr_flags' field (excluding the
675 #define FW_COMN_HDR_RESRVD_FLD_GET(hdr_flags) \
676 (hdr_flags & FW_COMN_HDR_RESRVD_FLD_MASK)
679 * Common macro to set the valid bit in the header flags field within
680 * the header structure (request or response).
682 * hdr_t Structure (request or response) containing the header
683 * flags field, to allow the valid bit to be set.
684 * val Value of the valid bit flag.
686 #define FW_COMN_VALID_FLAG_SET(hdr_t, val) \
687 FIELD_SET((hdr_t.hdr_flags), \
689 FW_COMN_VALID_FLAG_BITPOS, \
690 FW_COMN_VALID_FLAG_MASK)
693 * Macro that must be used when building the common header flags.
694 * Note that all bits reserved field bits 0-6 (LW0) need to be forced to 0.
696 * ptr Value of the valid flag
699 #define FW_COMN_HDR_FLAGS_BUILD(valid) \
700 (((valid)&FW_COMN_VALID_FLAG_MASK) \
701 << FW_COMN_VALID_FLAG_BITPOS)
704 * Common Request Flags Definition
705 * The bit offsets below are within the flags field. These are NOT relative to
706 * the memory word. Unused fields e.g. reserved bits, must be zeroed.
708 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
709 * | Bits [15:8] | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
710 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
711 * | Flags[15:8] | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv | Rsv |
712 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
713 * | Bits [7:0] | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
714 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
715 * | Flags [7:0] | Rsv | Rsv | Rsv | Rsv | Rsv | BnP | Cdt | Ptr |
716 * + ===== + ------ + --- + --- + --- + --- + --- + --- + --- + --- +
719 #define COMN_PTR_TYPE_BITPOS 0
720 /* Common Request Flags - Starting bit position indicating
721 * Src&Dst Buffer Pointer type */
723 #define COMN_PTR_TYPE_MASK 0x1
724 /* Common Request Flags - One bit mask used to determine
725 * Src&Dst Buffer Pointer type */
727 #define COMN_CD_FLD_TYPE_BITPOS 1
728 /* Common Request Flags - Starting bit position indicating
731 #define COMN_CD_FLD_TYPE_MASK 0x1
732 /* Common Request Flags - One bit mask used to determine
735 #define COMN_BNP_ENABLED_BITPOS 2
736 /* Common Request Flags - Starting bit position indicating
737 * the source buffer contains batch of requests. if this
738 * bit is set, source buffer is type of Batch And Pack OpData List
739 * and the Ptr Type Bit only applies to Destination buffer. */
741 #define COMN_BNP_ENABLED_MASK 0x1
742 /* Batch And Pack Enabled Flag Mask - One bit mask used to determine
743 * the source buffer is in Batch and Pack OpData Link List Mode. */
745 /* ========================================================================= */
746 /* Pointer Type Flag definitions */
747 /* ========================================================================= */
748 #define COMN_PTR_TYPE_FLAT 0x0
749 /* Constant value indicating Src&Dst Buffer Pointer type is flat
750 * If Batch and Pack mode is enabled, only applies to Destination buffer. */
752 #define COMN_PTR_TYPE_SGL 0x1
753 /* Constant value indicating Src&Dst Buffer Pointer type is SGL type
754 * If Batch and Pack mode is enabled, only applies to Destination buffer. */
756 #define COMN_PTR_TYPE_BATCH 0x2
757 /* Constant value indicating Src is a batch request
758 * and Dst Buffer Pointer type is SGL type */
760 /* ========================================================================= */
761 /* CD Field Flag definitions */
762 /* ========================================================================= */
763 #define COMN_CD_FLD_TYPE_64BIT_ADR 0x0
764 /* Constant value indicating CD Field contains 64-bit address */
766 #define COMN_CD_FLD_TYPE_16BYTE_DATA 0x1
767 /* Constant value indicating CD Field contains 16 bytes of setup data */
769 /* ========================================================================= */
770 /* Batch And Pack Enable/Disable Definitions */
771 /* ========================================================================= */
772 #define COMN_BNP_ENABLED 0x1
773 /* Constant value indicating Source buffer will point to Batch And Pack OpData
776 #define COMN_BNP_DISABLED 0x0
777 /* Constant value indicating Source buffer will point to Batch And Pack OpData
781 * Macro that must be used when building the common request flags (for all
782 * requests but comp BnP).
783 * Note that all bits reserved field bits 2-15 (LW1) need to be forced to 0.
785 * ptr Value of the pointer type flag
786 * cdt Value of the cd field type flag
788 #define FW_COMN_FLAGS_BUILD(cdt, ptr) \
789 ((((cdt)&COMN_CD_FLD_TYPE_MASK) << COMN_CD_FLD_TYPE_BITPOS) | \
790 (((ptr)&COMN_PTR_TYPE_MASK) << COMN_PTR_TYPE_BITPOS))
793 * Macro that must be used when building the common request flags for comp
795 * Note that all bits reserved field bits 3-15 (LW1) need to be forced to 0.
797 * ptr Value of the pointer type flag
798 * cdt Value of the cd field type flag
799 * bnp Value of the bnp enabled flag
801 #define FW_COMN_FLAGS_BUILD_BNP(cdt, ptr, bnp) \
802 ((((cdt)&COMN_CD_FLD_TYPE_MASK) << COMN_CD_FLD_TYPE_BITPOS) | \
803 (((ptr)&COMN_PTR_TYPE_MASK) << COMN_PTR_TYPE_BITPOS) | \
804 (((bnp)&COMN_BNP_ENABLED_MASK) << COMN_BNP_ENABLED_BITPOS))
807 * Macro for extraction of the pointer type bit from the common flags
809 * flags Flags to extract the pointer type bit from
811 #define FW_COMN_PTR_TYPE_GET(flags) \
812 FIELD_GET(flags, COMN_PTR_TYPE_BITPOS, COMN_PTR_TYPE_MASK)
815 * Macro for extraction of the cd field type bit from the common flags
817 * flags Flags to extract the cd field type type bit from
819 #define FW_COMN_CD_FLD_TYPE_GET(flags) \
820 FIELD_GET(flags, COMN_CD_FLD_TYPE_BITPOS, COMN_CD_FLD_TYPE_MASK)
823 * Macro for extraction of the bnp field type bit from the common flags
825 * flags Flags to extract the bnp field type type bit from
828 #define FW_COMN_BNP_ENABLED_GET(flags) \
829 FIELD_GET(flags, COMN_BNP_ENABLED_BITPOS, COMN_BNP_ENABLED_MASK)
832 * Macro for setting the pointer type bit in the common flags
834 * flags Flags in which Pointer Type bit will be set
835 * val Value of the bit to be set in flags
838 #define FW_COMN_PTR_TYPE_SET(flags, val) \
839 FIELD_SET(flags, val, COMN_PTR_TYPE_BITPOS, COMN_PTR_TYPE_MASK)
842 * Macro for setting the cd field type bit in the common flags
844 * flags Flags in which Cd Field Type bit will be set
845 * val Value of the bit to be set in flags
848 #define FW_COMN_CD_FLD_TYPE_SET(flags, val) \
850 flags, val, COMN_CD_FLD_TYPE_BITPOS, COMN_CD_FLD_TYPE_MASK)
853 * Macro for setting the bnp field type bit in the common flags
855 * flags Flags in which Bnp Field Type bit will be set
856 * val Value of the bit to be set in flags
859 #define FW_COMN_BNP_ENABLE_SET(flags, val) \
861 flags, val, COMN_BNP_ENABLED_BITPOS, COMN_BNP_ENABLED_MASK)
864 * Macros using the bit position and mask to set/extract the next
865 * and current id nibbles within the next_curr_id field of the
866 * content descriptor header block. Note that these are defined
867 * in the common header file, as they are used by compression, cipher
868 * and authentication.
870 * cd_ctrl_hdr_t Content descriptor control block header pointer.
871 * val Value of the field being set.
873 #define FW_COMN_NEXT_ID_BITPOS 4
874 #define FW_COMN_NEXT_ID_MASK 0xF0
875 #define FW_COMN_CURR_ID_BITPOS 0
876 #define FW_COMN_CURR_ID_MASK 0x0F
878 #define FW_COMN_NEXT_ID_GET(cd_ctrl_hdr_t) \
879 ((((cd_ctrl_hdr_t)->next_curr_id) & FW_COMN_NEXT_ID_MASK) >> \
880 (FW_COMN_NEXT_ID_BITPOS))
882 #define FW_COMN_NEXT_ID_SET(cd_ctrl_hdr_t, val) \
883 ((cd_ctrl_hdr_t)->next_curr_id) = \
884 ((((cd_ctrl_hdr_t)->next_curr_id) & FW_COMN_CURR_ID_MASK) | \
885 ((val << FW_COMN_NEXT_ID_BITPOS) & \
886 FW_COMN_NEXT_ID_MASK))
888 #define FW_COMN_CURR_ID_GET(cd_ctrl_hdr_t) \
889 (((cd_ctrl_hdr_t)->next_curr_id) & FW_COMN_CURR_ID_MASK)
891 #define FW_COMN_CURR_ID_SET(cd_ctrl_hdr_t, val) \
892 ((cd_ctrl_hdr_t)->next_curr_id) = \
893 ((((cd_ctrl_hdr_t)->next_curr_id) & FW_COMN_NEXT_ID_MASK) | \
894 ((val)&FW_COMN_CURR_ID_MASK))
897 * Common Status Field Definition The bit offsets below are within the COMMON
898 * RESPONSE status field, assumed to be 8 bits wide. In the case of the PKE
899 * response (which follows the CPM 1.5 message format), the status field is 16
901 * The status flags are contained within the most significant byte and align
902 * with the diagram below. Please therefore refer to the service-specific PKE
903 * header file for the appropriate macro definition to extract the PKE status
904 * flag from the PKE response, which assumes that a word is passed to the
906 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- +
907 * | Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
908 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- +
909 * | Flags | Crypto | Pke | Cmp | Xlat | EOLB | UnSupReq | Rsvd | XltWaApply |
910 * + ===== + ------ + --- + --- + ---- + ---- + -------- + ---- + ---------- +
912 * For the service specific status bit definitions refer to service header files
913 * Eg. Crypto Status bit refers to Symmetric Crypto, Key Generation, and NRBG
914 * Requests' Status. Unused bits e.g. reserved bits need to have been forced to
918 #define COMN_RESP_CRYPTO_STATUS_BITPOS 7
919 /* Starting bit position indicating Response for Crypto service Flag */
921 #define COMN_RESP_CRYPTO_STATUS_MASK 0x1
922 /* One bit mask used to determine Crypto status mask */
924 #define COMN_RESP_PKE_STATUS_BITPOS 6
925 /* Starting bit position indicating Response for PKE service Flag */
927 #define COMN_RESP_PKE_STATUS_MASK 0x1
928 /* One bit mask used to determine PKE status mask */
930 #define COMN_RESP_CMP_STATUS_BITPOS 5
931 /* Starting bit position indicating Response for Compression service Flag */
933 #define COMN_RESP_CMP_STATUS_MASK 0x1
934 /* One bit mask used to determine Compression status mask */
936 #define COMN_RESP_XLAT_STATUS_BITPOS 4
937 /* Starting bit position indicating Response for Xlat service Flag */
939 #define COMN_RESP_XLAT_STATUS_MASK 0x1
940 /* One bit mask used to determine Translator status mask */
942 #define COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS 3
943 /* Starting bit position indicating the last block in a deflate stream for
944 the compression service Flag */
946 #define COMN_RESP_CMP_END_OF_LAST_BLK_MASK 0x1
947 /* One bit mask used to determine the last block in a deflate stream
950 #define COMN_RESP_UNSUPPORTED_REQUEST_BITPOS 2
951 /* Starting bit position indicating when an unsupported service request Flag */
953 #define COMN_RESP_UNSUPPORTED_REQUEST_MASK 0x1
954 /* One bit mask used to determine the unsupported service request status mask */
956 #define COMN_RESP_XLT_WA_APPLIED_BITPOS 0
957 /* Bit position indicating a firmware workaround was applied to translation */
959 #define COMN_RESP_XLT_WA_APPLIED_MASK 0x1
963 * Macro that must be used when building the status
964 * for the common response
966 * crypto Value of the Crypto Service status flag
967 * comp Value of the Compression Service Status flag
968 * xlat Value of the Xlator Status flag
969 * eolb Value of the Compression End of Last Block Status flag
970 * unsupp Value of the Unsupported Request flag
971 * xlt_wa Value of the Translation WA marker
973 #define FW_COMN_RESP_STATUS_BUILD( \
974 crypto, pke, comp, xlat, eolb, unsupp, xlt_wa) \
975 ((((crypto)&COMN_RESP_CRYPTO_STATUS_MASK) \
976 << COMN_RESP_CRYPTO_STATUS_BITPOS) | \
977 (((pke)&COMN_RESP_PKE_STATUS_MASK) \
978 << COMN_RESP_PKE_STATUS_BITPOS) | \
979 (((xlt_wa)&COMN_RESP_XLT_WA_APPLIED_MASK) \
980 << COMN_RESP_XLT_WA_APPLIED_BITPOS) | \
981 (((comp)&COMN_RESP_CMP_STATUS_MASK) \
982 << COMN_RESP_CMP_STATUS_BITPOS) | \
983 (((xlat)&COMN_RESP_XLAT_STATUS_MASK) \
984 << COMN_RESP_XLAT_STATUS_BITPOS) | \
985 (((eolb)&COMN_RESP_CMP_END_OF_LAST_BLK_MASK) \
986 << COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS) | \
987 (((unsupp)&COMN_RESP_UNSUPPORTED_REQUEST_BITPOS) \
988 << COMN_RESP_UNSUPPORTED_REQUEST_MASK))
991 * Macro for extraction of the Crypto bit from the status
993 * status Status to extract the status bit from
995 #define FW_COMN_RESP_CRYPTO_STAT_GET(status) \
997 COMN_RESP_CRYPTO_STATUS_BITPOS, \
998 COMN_RESP_CRYPTO_STATUS_MASK)
1001 * Macro for extraction of the PKE bit from the status
1003 * status Status to extract the status bit from
1005 #define FW_COMN_RESP_PKE_STAT_GET(status) \
1007 COMN_RESP_PKE_STATUS_BITPOS, \
1008 COMN_RESP_PKE_STATUS_MASK)
1011 * Macro for extraction of the Compression bit from the status
1013 * status Status to extract the status bit from
1015 #define FW_COMN_RESP_CMP_STAT_GET(status) \
1017 COMN_RESP_CMP_STATUS_BITPOS, \
1018 COMN_RESP_CMP_STATUS_MASK)
1021 * Macro for extraction of the Translator bit from the status
1023 * status Status to extract the status bit from
1025 #define FW_COMN_RESP_XLAT_STAT_GET(status) \
1027 COMN_RESP_XLAT_STATUS_BITPOS, \
1028 COMN_RESP_XLAT_STATUS_MASK)
1031 * Macro for extraction of the Translation Workaround Applied bit from the
1034 * status Status to extract the status bit from
1036 #define FW_COMN_RESP_XLT_WA_APPLIED_GET(status) \
1038 COMN_RESP_XLT_WA_APPLIED_BITPOS, \
1039 COMN_RESP_XLT_WA_APPLIED_MASK)
1042 * Macro for extraction of the end of compression block bit from the
1046 * Status to extract the status bit from
1048 #define FW_COMN_RESP_CMP_END_OF_LAST_BLK_FLAG_GET(status) \
1050 COMN_RESP_CMP_END_OF_LAST_BLK_BITPOS, \
1051 COMN_RESP_CMP_END_OF_LAST_BLK_MASK)
1054 * Macro for extraction of the Unsupported request from the status
1057 * Status to extract the status bit from
1059 #define FW_COMN_RESP_UNSUPPORTED_REQUEST_STAT_GET(status) \
1061 COMN_RESP_UNSUPPORTED_REQUEST_BITPOS, \
1062 COMN_RESP_UNSUPPORTED_REQUEST_MASK)
1064 #define FW_COMN_STATUS_FLAG_OK 0
1065 /* Definition of successful processing of a request */
1067 #define FW_COMN_STATUS_FLAG_ERROR 1
1068 /* Definition of erroneous processing of a request */
1070 #define FW_COMN_STATUS_CMP_END_OF_LAST_BLK_FLAG_CLR 0
1071 /* Final Deflate block of a compression request not completed */
1073 #define FW_COMN_STATUS_CMP_END_OF_LAST_BLK_FLAG_SET 1
1074 /* Final Deflate block of a compression request completed */
1076 #define ERR_CODE_NO_ERROR 0
1077 /* Error Code constant value for no error */
1079 #define ERR_CODE_INVALID_BLOCK_TYPE -1
1080 /* Invalid block type (type == 3)*/
1082 #define ERR_CODE_NO_MATCH_ONES_COMP -2
1083 /* Stored block length does not match one's complement */
1085 #define ERR_CODE_TOO_MANY_LEN_OR_DIS -3
1086 /* Too many length or distance codes */
1088 #define ERR_CODE_INCOMPLETE_LEN -4
1089 /* Code lengths codes incomplete */
1091 #define ERR_CODE_RPT_LEN_NO_FIRST_LEN -5
1092 /* Repeat lengths with no first length */
1094 #define ERR_CODE_RPT_GT_SPEC_LEN -6
1095 /* Repeat more than specified lengths */
1097 #define ERR_CODE_INV_LIT_LEN_CODE_LEN -7
1098 /* Invalid lit/len code lengths */
1100 #define ERR_CODE_INV_DIS_CODE_LEN -8
1101 /* Invalid distance code lengths */
1103 #define ERR_CODE_INV_LIT_LEN_DIS_IN_BLK -9
1104 /* Invalid lit/len or distance code in fixed/dynamic block */
1106 #define ERR_CODE_DIS_TOO_FAR_BACK -10
1107 /* Distance too far back in fixed or dynamic block */
1109 /* Common Error code definitions */
1110 #define ERR_CODE_OVERFLOW_ERROR -11
1111 /* Error Code constant value for overflow error */
1113 #define ERR_CODE_SOFT_ERROR -12
1114 /* Error Code constant value for soft error */
1116 #define ERR_CODE_FATAL_ERROR -13
1117 /* Error Code constant value for hard/fatal error */
1119 #define ERR_CODE_COMP_OUTPUT_CORRUPTION -14
1120 /* Error Code constant for compression output corruption */
1122 #define ERR_CODE_HW_INCOMPLETE_FILE -15
1123 /* Error Code constant value for incomplete file hardware error */
1125 #define ERR_CODE_SSM_ERROR -16
1126 /* Error Code constant value for error detected by SSM e.g. slice hang */
1128 #define ERR_CODE_ENDPOINT_ERROR -17
1129 /* Error Code constant value for error detected by PCIe Endpoint, e.g. push
1132 #define ERR_CODE_CNV_ERROR -18
1133 /* Error Code constant value for cnv failure */
1135 #define ERR_CODE_EMPTY_DYM_BLOCK -19
1136 /* Error Code constant value for submission of empty dynamic stored block to
1139 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_INVALID_HANDLE -20
1140 /* Error Code constant for invalid handle in kpt crypto service */
1142 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_HMAC_FAILED -21
1143 /* Error Code constant for failed hmac in kpt crypto service */
1145 #define ERR_CODE_KPT_CRYPTO_SERVICE_FAIL_INVALID_WRAPPING_ALGO -22
1146 /* Error Code constant for invalid wrapping algo in kpt crypto service */
1148 #define ERR_CODE_KPT_DRNG_SEED_NOT_LOAD -23
1149 /* Error Code constant for no drng seed is not loaded in kpt ecdsa signrs
1152 #define FW_LA_ICV_VER_STATUS_PASS FW_COMN_STATUS_FLAG_OK
1153 /* Status flag indicating that the ICV verification passed */
1155 #define FW_LA_ICV_VER_STATUS_FAIL FW_COMN_STATUS_FLAG_ERROR
1156 /* Status flag indicating that the ICV verification failed */
1158 #define FW_LA_TRNG_STATUS_PASS FW_COMN_STATUS_FLAG_OK
1159 /* Status flag indicating that the TRNG returned valid entropy data */
1161 #define FW_LA_TRNG_STATUS_FAIL FW_COMN_STATUS_FLAG_ERROR
1162 /* Status flag indicating that the TRNG Command Failed. */
1164 /* -------------------------------------------------------------------------- */
1167 * Definition of the full bulk processing request structure.
1168 * Used for hash, cipher, hash-cipher and authentication-encryption
1171 struct fw_la_bulk_req
1174 struct fw_comn_req_hdr comn_hdr;
1175 /* Common request header - for Service Command Id,
1176 * use service-specific Crypto Command Id.
1177 * Service Specific Flags - use Symmetric Crypto Command Flags
1178 * (all of cipher, auth, SSL3, TLS and MGF,
1179 * excluding TRNG - field unused) */
1182 union fw_comn_req_hdr_cd_pars cd_pars;
1183 /* Common Request content descriptor field which points either to a
1184 * content descriptor
1185 * parameter block or contains the service-specific data itself. */
1188 struct fw_comn_req_mid comn_mid;
1189 /* Common request middle section */
1192 struct fw_comn_req_rqpars serv_specif_rqpars;
1193 /* Common request service-specific parameter field */
1196 struct fw_comn_req_cd_ctrl cd_ctrl;
1197 /* Common request content descriptor control block -
1198 * this field is service-specific */
1202 /* clang-format off */
1205 * LA BULK (SYMMETRIC CRYPTO) COMMAND FLAGS
1207 * + ===== + ---------- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- +
1208 * | Bit | [15:13] | 12 | 11 | 10 | 7-9 | 6 | 5 | 4 | 3 | 2 | 1-0 |
1209 * + ===== + ---------- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ------+ ----- +
1210 * | Flags | Resvd Bits | ZUC | GcmIV |Digest | Prot | Cmp | Rtn | Upd | Ciph/ | CiphIV| Part- |
1211 * | | =0 | Prot | Len | In Buf| flgs | Auth | Auth | State | Auth | Field | ial |
1212 * + ===== + ---------- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ------+ ----- +
1215 /* clang-format on */
1217 /* Private defines */
1219 #define FW_LA_ZUC_3G_PROTO __BIT(12)
1220 /* Indicating ZUC processing for a encrypt command
1221 * Must be set for Cipher-only, Cipher + Auth and Auth-only */
1223 #define FW_LA_GCM_IV_LEN_12_OCTETS __BIT(11)
1224 /* Indicates the IV Length for GCM protocol is 96 Bits (12 Octets)
1225 * If set FW does the padding to compute CTR0 */
1227 #define FW_LA_DIGEST_IN_BUFFER __BIT(10)
1228 /* Flag representing that authentication digest is stored or is extracted
1229 * from the source buffer. Auth Result Pointer will be ignored in this case. */
1231 #define FW_LA_PROTO __BITS(7, 9)
1232 #define FW_LA_PROTO_SNOW_3G __BIT(9)
1233 /* Indicates SNOW_3G processing for a encrypt command */
1234 #define FW_LA_PROTO_GCM __BIT(8)
1235 /* Indicates GCM processing for a auth_encrypt command */
1236 #define FW_LA_PROTO_CCM __BIT(7)
1237 /* Indicates CCM processing for a auth_encrypt command */
1238 #define FW_LA_PROTO_NONE 0
1239 /* Indicates no specific protocol processing for the command */
1241 #define FW_LA_CMP_AUTH_RES __BIT(6)
1242 /* Flag representing the need to compare the auth result data to the expected
1243 * value in DRAM at the auth_address. */
1245 #define FW_LA_RET_AUTH_RES __BIT(5)
1246 /* Flag representing the need to return the auth result data to dram after the
1247 * request processing is complete */
1249 #define FW_LA_UPDATE_STATE __BIT(4)
1250 /* Flag representing the need to update the state data in dram after the
1251 * request processing is complete */
1253 #define FW_CIPH_AUTH_CFG_OFFSET_IN_SHRAM_CP __BIT(3)
1254 /* Flag representing Cipher/Auth Config Offset Type, where the offset
1255 * is contained in SHRAM constants page. When the SHRAM constants page
1256 * is not used for cipher/auth configuration, then the Content Descriptor
1257 * pointer field must be a pointer (as opposed to a 16-byte key), since
1258 * the block pointed to must contain both the slice config and the key */
1260 #define FW_CIPH_IV_16BYTE_DATA __BIT(2)
1261 /* Flag representing Cipher IV field contents as 16-byte data array
1262 * Otherwise Cipher IV field contents via 64-bit pointer */
1264 #define FW_LA_PARTIAL __BITS(0, 1)
1265 #define FW_LA_PARTIAL_NONE 0
1266 /* Flag representing no need for partial processing condition i.e.
1267 * entire packet processed in the current command */
1268 #define FW_LA_PARTIAL_START 1
1269 /* Flag representing the first chunk of the partial packet */
1270 #define FW_LA_PARTIAL_MID 3
1271 /* Flag representing a middle chunk of the partial packet */
1272 #define FW_LA_PARTIAL_END 2
1273 /* Flag representing the final/end chunk of the partial packet */
1275 /* The table below defines the meaning of the prefix_addr & hash_state_sz in
1276 * the case of partial processing. See the HLD for further details
1278 * + ====== + ------------------------- + ----------------------- +
1279 * | Parial | Prefix Addr | Hash State Sz |
1281 * + ====== + ------------------------- + ----------------------- +
1282 * | FULL | Points to the prefix data | Prefix size as below. |
1283 * | | | No update of state |
1284 * + ====== + ------------------------- + ----------------------- +
1285 * | SOP | Points to the prefix | = inner prefix rounded |
1286 * | | data. State is updated | to qwrds + outer prefix |
1287 * | | at prefix_addr - state_sz | rounded to qwrds. The |
1288 * | | - 8 (counter size) | writeback state sz |
1289 * | | | comes from the CD |
1290 * + ====== + ------------------------- + ----------------------- +
1291 * | MOP | Points to the state data | State size rounded to |
1292 * | | Updated state written to | num qwrds + 8 (for the |
1293 * | | same location | counter) + inner prefix |
1294 * | | | rounded to qwrds + |
1295 * | | | outer prefix rounded to |
1297 * + ====== + ------------------------- + ----------------------- +
1298 * | EOP | Points to the state data | State size rounded to |
1299 * | | | num qwrds + 8 (for the |
1300 * | | | counter) + inner prefix |
1301 * | | | rounded to qwrds + |
1302 * | | | outer prefix rounded to |
1304 * + ====== + ------------------------- + ----------------------- +
1308 * - If the EOP is set it is assumed that no state update is to be performed.
1309 * However it is the clients responsibility to set the update_state flag
1310 * correctly i.e. not set for EOP or Full packet cases. Only set for SOP and
1311 * MOP with no EOP flag
1312 * - The SOP take precedence over the MOP and EOP i.e. in the calculation of
1313 * the address to writeback the state.
1314 * - The prefix address must be on at least the 8 byte boundary
1317 /* Macros for extracting field bits */
1319 * Macro for extraction of the Cipher IV field contents (bit 2)
1321 * flags Flags to extract the Cipher IV field contents
1324 #define FW_LA_CIPH_IV_FLD_FLAG_GET(flags) \
1325 FIELD_GET(flags, LA_CIPH_IV_FLD_BITPOS, LA_CIPH_IV_FLD_MASK)
1328 * Macro for extraction of the Cipher/Auth Config
1329 * offset type (bit 3)
1331 * flags Flags to extract the Cipher/Auth Config offset type
1334 #define FW_LA_CIPH_AUTH_CFG_OFFSET_FLAG_GET(flags) \
1336 LA_CIPH_AUTH_CFG_OFFSET_BITPOS, \
1337 LA_CIPH_AUTH_CFG_OFFSET_MASK)
1340 * Macro for extraction of the ZUC protocol bit
1341 * information (bit 11)
1343 * flags Flags to extract the ZUC protocol bit
1345 #define FW_LA_ZUC_3G_PROTO_FLAG_GET(flags) \
1347 FW_LA_ZUC_3G_PROTO_FLAG_BITPOS, \
1348 FW_LA_ZUC_3G_PROTO_FLAG_MASK)
1351 * Macro for extraction of the GCM IV Len is 12 Octets / 96 Bits
1352 * information (bit 11)
1354 * flags Flags to extract the GCM IV length
1356 #define FW_LA_GCM_IV_LEN_FLAG_GET(flags) \
1358 flags, LA_GCM_IV_LEN_FLAG_BITPOS, LA_GCM_IV_LEN_FLAG_MASK)
1361 * Macro for extraction of the LA protocol state (bits 9-7)
1363 * flags Flags to extract the protocol state
1365 #define FW_LA_PROTO_GET(flags) \
1366 FIELD_GET(flags, LA_PROTO_BITPOS, LA_PROTO_MASK)
1369 * Macro for extraction of the "compare auth" state (bit 6)
1371 * flags Flags to extract the compare auth result state
1374 #define FW_LA_CMP_AUTH_GET(flags) \
1375 FIELD_GET(flags, LA_CMP_AUTH_RES_BITPOS, LA_CMP_AUTH_RES_MASK)
1378 * Macro for extraction of the "return auth" state (bit 5)
1380 * flags Flags to extract the return auth result state
1383 #define FW_LA_RET_AUTH_GET(flags) \
1384 FIELD_GET(flags, LA_RET_AUTH_RES_BITPOS, LA_RET_AUTH_RES_MASK)
1387 * Macro for extraction of the "digest in buffer" state (bit 10)
1389 * flags Flags to extract the digest in buffer state
1392 #define FW_LA_DIGEST_IN_BUFFER_GET(flags) \
1394 flags, LA_DIGEST_IN_BUFFER_BITPOS, LA_DIGEST_IN_BUFFER_MASK)
1397 * Macro for extraction of the update content state value. (bit 4)
1399 * flags Flags to extract the update content state bit
1401 #define FW_LA_UPDATE_STATE_GET(flags) \
1402 FIELD_GET(flags, LA_UPDATE_STATE_BITPOS, LA_UPDATE_STATE_MASK)
1405 * Macro for extraction of the "partial" packet state (bits 1-0)
1407 * flags Flags to extract the partial state
1409 #define FW_LA_PARTIAL_GET(flags) \
1410 FIELD_GET(flags, LA_PARTIAL_BITPOS, LA_PARTIAL_MASK)
1412 /* Macros for setting field bits */
1414 * Macro for setting the Cipher IV field contents
1416 * flags Flags to set with the Cipher IV field contents
1417 * val Field contents indicator value
1419 #define FW_LA_CIPH_IV_FLD_FLAG_SET(flags, val) \
1421 flags, val, LA_CIPH_IV_FLD_BITPOS, LA_CIPH_IV_FLD_MASK)
1424 * Macro for setting the Cipher/Auth Config
1427 * flags Flags to set the Cipher/Auth Config offset type
1428 * val Offset type value
1430 #define FW_LA_CIPH_AUTH_CFG_OFFSET_FLAG_SET(flags, val) \
1433 LA_CIPH_AUTH_CFG_OFFSET_BITPOS, \
1434 LA_CIPH_AUTH_CFG_OFFSET_MASK)
1437 * Macro for setting the ZUC protocol flag
1439 * flags Flags to set the ZUC protocol flag
1440 * val Protocol value
1442 #define FW_LA_ZUC_3G_PROTO_FLAG_SET(flags, val) \
1445 FW_LA_ZUC_3G_PROTO_FLAG_BITPOS, \
1446 FW_LA_ZUC_3G_PROTO_FLAG_MASK)
1449 * Macro for setting the GCM IV length flag state
1451 * flags Flags to set the GCM IV length flag state
1452 * val Protocol value
1454 #define FW_LA_GCM_IV_LEN_FLAG_SET(flags, val) \
1457 LA_GCM_IV_LEN_FLAG_BITPOS, \
1458 LA_GCM_IV_LEN_FLAG_MASK)
1461 * Macro for setting the LA protocol flag state
1463 * flags Flags to set the protocol state
1464 * val Protocol value
1466 #define FW_LA_PROTO_SET(flags, val) \
1467 FIELD_SET(flags, val, LA_PROTO_BITPOS, LA_PROTO_MASK)
1470 * Macro for setting the "compare auth" flag state
1472 * flags Flags to set the compare auth result state
1473 * val Compare Auth value
1475 #define FW_LA_CMP_AUTH_SET(flags, val) \
1477 flags, val, LA_CMP_AUTH_RES_BITPOS, LA_CMP_AUTH_RES_MASK)
1480 * Macro for setting the "return auth" flag state
1482 * flags Flags to set the return auth result state
1483 * val Return Auth value
1485 #define FW_LA_RET_AUTH_SET(flags, val) \
1487 flags, val, LA_RET_AUTH_RES_BITPOS, LA_RET_AUTH_RES_MASK)
1490 * Macro for setting the "digest in buffer" flag state
1492 * flags Flags to set the digest in buffer state
1493 * val Digest in buffer value
1495 #define FW_LA_DIGEST_IN_BUFFER_SET(flags, val) \
1498 LA_DIGEST_IN_BUFFER_BITPOS, \
1499 LA_DIGEST_IN_BUFFER_MASK)
1502 * Macro for setting the "update state" flag value
1504 * flags Flags to set the update content state
1505 * val Update Content State flag value
1507 #define FW_LA_UPDATE_STATE_SET(flags, val) \
1509 flags, val, LA_UPDATE_STATE_BITPOS, LA_UPDATE_STATE_MASK)
1512 * Macro for setting the "partial" packet flag state
1514 * flags Flags to set the partial state
1515 * val Partial state value
1517 #define FW_LA_PARTIAL_SET(flags, val) \
1518 FIELD_SET(flags, val, LA_PARTIAL_BITPOS, LA_PARTIAL_MASK)
1521 * Definition of the Cipher header Content Descriptor pars block
1522 * Definition of the cipher processing header cd pars block.
1523 * The structure is a service-specific implementation of the common
1524 * 'fw_comn_req_hdr_cd_pars_s' structure.
1526 union fw_cipher_req_hdr_cd_pars {
1530 uint64_t content_desc_addr;
1531 /* Address of the content descriptor */
1533 uint16_t content_desc_resrvd1;
1534 /* Content descriptor reserved field */
1536 uint8_t content_desc_params_sz;
1537 /* Size of the content descriptor parameters in quad words. These
1538 * parameters describe the session setup configuration info for the
1539 * slices that this request relies upon i.e. the configuration word and
1540 * cipher key needed by the cipher slice if there is a request for
1541 * cipher processing. */
1543 uint8_t content_desc_hdr_resrvd2;
1544 /* Content descriptor reserved field */
1546 uint32_t content_desc_resrvd3;
1547 /* Content descriptor reserved field */
1552 uint32_t cipher_key_array[FW_NUM_LONGWORDS_4];
1553 /* Cipher Key Array */
1560 * Definition of the Authentication header Content Descriptor pars block
1561 * Definition of the authentication processing header cd pars block.
1563 /* Note: Authentication uses the common 'fw_comn_req_hdr_cd_pars_s'
1564 * structure - similarly, it is also used by SSL3, TLS and MGF. Only cipher
1565 * and cipher + authentication require service-specific implementations of
1569 * Definition of the Cipher + Auth header Content Descriptor pars block
1570 * Definition of the cipher + auth processing header cd pars block.
1571 * The structure is a service-specific implementation of the common
1572 * 'fw_comn_req_hdr_cd_pars_s' structure.
1574 union fw_cipher_auth_req_hdr_cd_pars {
1578 uint64_t content_desc_addr;
1579 /* Address of the content descriptor */
1581 uint16_t content_desc_resrvd1;
1582 /* Content descriptor reserved field */
1584 uint8_t content_desc_params_sz;
1585 /* Size of the content descriptor parameters in quad words. These
1586 * parameters describe the session setup configuration info for the
1587 * slices that this request relies upon i.e. the configuration word and
1588 * cipher key needed by the cipher slice if there is a request for
1589 * cipher processing. */
1591 uint8_t content_desc_hdr_resrvd2;
1592 /* Content descriptor reserved field */
1594 uint32_t content_desc_resrvd3;
1595 /* Content descriptor reserved field */
1600 uint32_t cipher_key_array[FW_NUM_LONGWORDS_4];
1601 /* Cipher Key Array */
1608 * Cipher content descriptor control block (header)
1609 * Definition of the service-specific cipher control block header
1610 * structure. This header forms part of the content descriptor
1611 * block incorporating LWs 27-31, as defined by the common base
1612 * parameters structure.
1614 struct fw_cipher_cd_ctrl_hdr
1617 uint8_t cipher_state_sz;
1618 /* State size in quad words of the cipher algorithm used in this session.
1619 * Set to zero if the algorithm doesnt provide any state */
1621 uint8_t cipher_key_sz;
1622 /* Key size in quad words of the cipher algorithm used in this session */
1624 uint8_t cipher_cfg_offset;
1625 /* Quad word offset from the content descriptor parameters address i.e.
1626 * (content_address + (cd_hdr_sz << 3)) to the parameters for the cipher
1629 uint8_t next_curr_id;
1630 /* This field combines the next and current id (each four bits) -
1631 * the next id is the most significant nibble.
1632 * Next Id: Set to the next slice to pass the ciphered data through.
1633 * Set to FW_SLICE_DRAM_WR if the data is not to go through
1634 * any more slices after cipher.
1635 * Current Id: Initialised with the cipher slice type */
1638 uint8_t cipher_padding_sz;
1639 /* State padding size in quad words. Set to 0 if no padding is required.
1644 /* Reserved bytes to bring the struct to the word boundary, used by
1645 * authentication. MUST be set to 0 */
1648 uint32_t resrvd3[FW_NUM_LONGWORDS_3];
1649 /* Reserved bytes used by authentication. MUST be set to 0 */
1654 * Authentication content descriptor control block (header)
1655 * Definition of the service-specific authentication control block
1656 * header structure. This header forms part of the content descriptor
1657 * block incorporating LWs 27-31, as defined by the common base
1658 * parameters structure, the first portion of which is reserved for
1661 struct fw_auth_cd_ctrl_hdr
1665 /* Reserved bytes, used by cipher only. MUST be set to 0 */
1669 /* Reserved byte, used by cipher only. MUST be set to 0 */
1672 /* General flags defining the processing to perform. 0 is normal
1674 * and 1 means there is a nested hash processing loop to go through */
1676 uint8_t hash_cfg_offset;
1677 /* Quad word offset from the content descriptor parameters address to the
1678 * parameters for the auth processing */
1680 uint8_t next_curr_id;
1681 /* This field combines the next and current id (each four bits) -
1682 * the next id is the most significant nibble.
1683 * Next Id: Set to the next slice to pass the authentication data through.
1684 * Set to FW_SLICE_DRAM_WR if the data is not to go through
1685 * any more slices after authentication.
1686 * Current Id: Initialised with the authentication slice type */
1690 /* Now a reserved field. MUST be set to 0 */
1692 uint8_t outer_prefix_sz;
1693 /* Size in bytes of outer prefix data */
1696 /* Size in bytes of digest to be returned to the client if requested */
1698 uint8_t inner_res_sz;
1699 /* Size in bytes of the digest from the inner hash algorithm */
1703 /* Now a reserved field. MUST be set to zero. */
1705 uint8_t inner_state1_sz;
1706 /* Size in bytes of inner hash state1 data. Must be a qword multiple */
1708 uint8_t inner_state2_offset;
1709 /* Quad word offset from the content descriptor parameters pointer to the
1710 * inner state2 value */
1712 uint8_t inner_state2_sz;
1713 /* Size in bytes of inner hash state2 data. Must be a qword multiple */
1716 uint8_t outer_config_offset;
1717 /* Quad word offset from the content descriptor parameters pointer to the
1718 * outer configuration information */
1720 uint8_t outer_state1_sz;
1721 /* Size in bytes of the outer state1 value */
1723 uint8_t outer_res_sz;
1724 /* Size in bytes of digest from the outer auth algorithm */
1726 uint8_t outer_prefix_offset;
1727 /* Quad word offset from the start of the inner prefix data to the outer
1728 * prefix information. Should equal the rounded inner prefix size, converted
1734 * Cipher + Authentication content descriptor control block header
1735 * Definition of both service-specific cipher + authentication control
1736 * block header structures. This header forms part of the content
1737 * descriptor block incorporating LWs 27-31, as defined by the common
1738 * base parameters structure.
1740 struct fw_cipher_auth_cd_ctrl_hdr
1743 uint8_t cipher_state_sz;
1744 /* State size in quad words of the cipher algorithm used in this session.
1745 * Set to zero if the algorithm doesnt provide any state */
1747 uint8_t cipher_key_sz;
1748 /* Key size in quad words of the cipher algorithm used in this session */
1750 uint8_t cipher_cfg_offset;
1751 /* Quad word offset from the content descriptor parameters address i.e.
1752 * (content_address + (cd_hdr_sz << 3)) to the parameters for the cipher
1755 uint8_t next_curr_id_cipher;
1756 /* This field combines the next and current id (each four bits) -
1757 * the next id is the most significant nibble.
1758 * Next Id: Set to the next slice to pass the ciphered data through.
1759 * Set to FW_SLICE_DRAM_WR if the data is not to go through
1760 * any more slices after cipher.
1761 * Current Id: Initialised with the cipher slice type */
1764 uint8_t cipher_padding_sz;
1765 /* State padding size in quad words. Set to 0 if no padding is required.
1769 /* General flags defining the processing to perform. 0 is normal
1771 * and 1 means there is a nested hash processing loop to go through */
1773 uint8_t hash_cfg_offset;
1774 /* Quad word offset from the content descriptor parameters address to the
1775 * parameters for the auth processing */
1777 uint8_t next_curr_id_auth;
1778 /* This field combines the next and current id (each four bits) -
1779 * the next id is the most significant nibble.
1780 * Next Id: Set to the next slice to pass the authentication data through.
1781 * Set to FW_SLICE_DRAM_WR if the data is not to go through
1782 * any more slices after authentication.
1783 * Current Id: Initialised with the authentication slice type */
1787 /* Reserved field. MUST be set to 0 */
1789 uint8_t outer_prefix_sz;
1790 /* Size in bytes of outer prefix data */
1793 /* Size in bytes of digest to be returned to the client if requested */
1795 uint8_t inner_res_sz;
1796 /* Size in bytes of the digest from the inner hash algorithm */
1800 /* Now a reserved field. MUST be set to zero. */
1802 uint8_t inner_state1_sz;
1803 /* Size in bytes of inner hash state1 data. Must be a qword multiple */
1805 uint8_t inner_state2_offset;
1806 /* Quad word offset from the content descriptor parameters pointer to the
1807 * inner state2 value */
1809 uint8_t inner_state2_sz;
1810 /* Size in bytes of inner hash state2 data. Must be a qword multiple */
1813 uint8_t outer_config_offset;
1814 /* Quad word offset from the content descriptor parameters pointer to the
1815 * outer configuration information */
1817 uint8_t outer_state1_sz;
1818 /* Size in bytes of the outer state1 value */
1820 uint8_t outer_res_sz;
1821 /* Size in bytes of digest from the outer auth algorithm */
1823 uint8_t outer_prefix_offset;
1824 /* Quad word offset from the start of the inner prefix data to the outer
1825 * prefix information. Should equal the rounded inner prefix size, converted
1830 #define FW_AUTH_HDR_FLAG_DO_NESTED 1
1831 /* Definition of the hash_flags bit of the auth_hdr to indicate the request
1832 * requires nested hashing */
1834 #define FW_AUTH_HDR_FLAG_NO_NESTED 0
1835 /* Definition of the hash_flags bit of the auth_hdr for no nested hashing
1838 #define FW_CCM_GCM_AAD_SZ_MAX 240
1839 /* Maximum size of AAD data allowed for CCM or GCM processing. AAD data size90 -
1840 * is stored in 8-bit field and must be multiple of hash block size. 240 is
1841 * largest value which satisfy both requirements.AAD_SZ_MAX is in byte units */
1844 * request parameter #defines
1846 #define FW_HASH_REQUEST_PARAMETERS_OFFSET \
1847 (sizeof(fw_la_cipher_req_params_t))
1848 /* Offset in bytes from the start of the request parameters block to the hash
1849 * (auth) request parameters */
1851 #define FW_CIPHER_REQUEST_PARAMETERS_OFFSET (0)
1852 /* Offset in bytes from the start of the request parameters block to the cipher
1853 * request parameters */
1856 * Definition of the cipher request parameters block
1858 * Definition of the cipher processing request parameters block
1859 * structure, which forms part of the block incorporating LWs 14-26,
1860 * as defined by the common base parameters structure.
1861 * Unused fields must be set to 0.
1863 struct fw_la_cipher_req_params {
1865 uint32_t cipher_offset;
1866 /* Cipher offset long word. */
1869 uint32_t cipher_length;
1870 /* Cipher length long word. */
1874 uint32_t cipher_IV_array[FW_NUM_LONGWORDS_4];
1875 /* Cipher IV array */
1879 uint64_t cipher_IV_ptr;
1880 /* Cipher IV pointer or Partial State Pointer */
1892 * Definition of the auth request parameters block
1893 * Definition of the authentication processing request parameters block
1894 * structure, which forms part of the block incorporating LWs 14-26,
1895 * as defined by the common base parameters structure. Note:
1896 * This structure is used by TLS only.
1898 struct fw_la_auth_req_params {
1901 /* Byte offset from the start of packet to the auth data region */
1905 /* Byte length of the auth data region */
1909 uint64_t auth_partial_st_prefix;
1910 /* Address of the authentication partial state prefix
1914 /* Address of the AAD info in DRAM. Used for the CCM and GCM
1920 uint64_t auth_res_addr;
1921 /* Address of the authentication result information to validate or
1922 * the location to which the digest information can be written back to */
1926 uint8_t inner_prefix_sz;
1927 /* Size in bytes of the inner prefix data */
1930 /* Size in bytes of padded AAD data to prefix to the packet for CCM
1931 * or GCM processing */
1937 uint8_t hash_state_sz;
1938 /* Number of quad words of inner and outer hash prefix data to process
1939 * Maximum size is 240 */
1941 uint8_t auth_res_sz;
1942 /* Size in bytes of the authentication result */
1947 * Definition of the auth request parameters block
1948 * Definition of the authentication processing request parameters block
1949 * structure, which forms part of the block incorporating LWs 14-26,
1950 * as defined by the common base parameters structure. Note:
1951 * This structure is used by SSL3 and MGF1 only. All fields other than
1952 * inner prefix/ AAD size are unused and therefore reserved.
1954 struct fw_la_auth_req_params_resrvd_flds {
1956 uint32_t resrvd[FW_NUM_LONGWORDS_6];
1960 uint8_t inner_prefix_sz;
1961 /* Size in bytes of the inner prefix data */
1964 /* Size in bytes of padded AAD data to prefix to the packet for CCM
1965 * or GCM processing */
1976 * Definition of the shared fields within the parameter block
1977 * containing SSL, TLS or MGF information.
1978 * This structure defines the shared fields for SSL, TLS or MGF
1979 * within the parameter block incorporating LWs 14-26, as defined
1980 * by the common base parameters structure.
1981 * Unused fields must be set to 0.
1983 struct fw_la_key_gen_common {
1987 uint16_t secret_lgth_ssl;
1988 /* Length of Secret information for SSL. In the case of TLS the
1989 * secret is supplied in the content descriptor */
1992 uint16_t mask_length;
1993 /* Size in bytes of the desired output mask for MGF1*/
1996 uint16_t secret_lgth_tls;
1997 /* TLS Secret length */
2005 uint8_t output_lgth_ssl;
2008 uint8_t label_lgth_ssl;
2016 uint8_t hash_length;
2019 uint8_t seed_length;
2027 uint8_t output_lgth_tls;
2030 uint8_t label_lgth_tls;
2041 /* Iteration count used by the SSL key gen request */
2044 uint8_t tls_seed_length;
2045 /* TLS Seed length */
2048 /* Reserved field set to 0 for MGF1 */
2054 /* Reserved space - unused */
2059 * Definition of the SSL3 request parameters block
2060 * This structure contains the the SSL3 processing request parameters
2061 * incorporating LWs 14-26, as defined by the common base
2062 * parameters structure. Unused fields must be set to 0.
2064 struct fw_la_ssl3_req_params {
2066 struct fw_la_key_gen_common keygen_comn;
2067 /* For other key gen processing these field holds ssl, tls or mgf
2071 uint32_t resrvd[FW_NUM_LONGWORDS_10];
2076 uint8_t inner_prefix_sz;
2077 /* Size in bytes of the inner prefix data */
2080 /* Size in bytes of padded AAD data to prefix to the packet for CCM
2081 * or GCM processing */
2093 * Definition of the MGF request parameters block
2094 * This structure contains the the MGF processing request parameters
2095 * incorporating LWs 14-26, as defined by the common base parameters
2096 * structure. Unused fields must be set to 0.
2098 struct fw_la_mgf_req_params {
2100 struct fw_la_key_gen_common keygen_comn;
2101 /* For other key gen processing these field holds ssl or mgf
2105 uint32_t resrvd[FW_NUM_LONGWORDS_10];
2110 uint8_t inner_prefix_sz;
2111 /* Size in bytes of the inner prefix data */
2114 /* Size in bytes of padded AAD data to prefix to the packet for CCM
2115 * or GCM processing */
2127 * Definition of the TLS request parameters block
2128 * This structure contains the the TLS processing request parameters
2129 * incorporating LWs 14-26, as defined by the common base parameters
2130 * structure. Unused fields must be set to 0.
2132 struct fw_la_tls_req_params {
2134 struct fw_la_key_gen_common keygen_comn;
2135 /* For other key gen processing these field holds ssl, tls or mgf
2139 uint32_t resrvd[FW_NUM_LONGWORDS_4];
2145 * Definition of the common QAT FW request middle block for TRNG.
2146 * Common section of the request used across all of the services exposed
2147 * by the QAT FW. Each of the services inherit these common fields. TRNG
2148 * requires a specific implementation.
2150 struct fw_la_trng_req_mid {
2152 uint64_t opaque_data;
2153 /* Opaque data passed unmodified from the request to response messages by
2157 /* Reserved, unused for TRNG */
2159 uint64_t dest_data_addr;
2160 /* Generic definition of the destination data supplied to the QAT AE. The
2161 * common flags are used to further describe the attributes of this
2165 /* Reserved, unused for TRNG */
2167 uint32_t entropy_length;
2168 /* Size of the data in bytes to process. Used by the get_random
2169 * command. Set to 0 for commands that dont need a length parameter */
2174 * Definition of the common LA QAT FW TRNG request
2175 * Definition of the TRNG processing request type
2177 struct fw_la_trng_req {
2179 struct fw_comn_req_hdr comn_hdr;
2180 /* Common request header */
2183 union fw_comn_req_hdr_cd_pars cd_pars;
2184 /* Common Request content descriptor field which points either to a
2185 * content descriptor
2186 * parameter block or contains the service-specific data itself. */
2189 struct fw_la_trng_req_mid comn_mid;
2190 /* TRNG request middle section - differs from the common mid-section */
2193 uint32_t resrvd1[FW_NUM_LONGWORDS_13];
2196 uint32_t resrvd2[FW_NUM_LONGWORDS_5];
2201 * Definition of the Lookaside Eagle Tail Response
2202 * This is the response delivered to the ET rings by the Lookaside
2203 * QAT FW service for all commands
2207 struct fw_comn_resp_hdr comn_resp;
2208 /* Common interface response format see fw.h */
2211 uint64_t opaque_data;
2212 /* Opaque data passed from the request to the response message */
2215 uint32_t resrvd[FW_NUM_LONGWORDS_4];
2221 * Definition of the Lookaside TRNG Test Status Structure
2222 * As an addition to FW_LA_TRNG_STATUS Pass or Fail information
2223 * in common response fields, as a response to TRNG_TEST request, Test
2224 * status, Counter for failed tests and 4 entropy counter values are
2226 * Status of test status and the fail counts.
2228 struct fw_la_trng_test_result {
2229 uint32_t test_status_info;
2230 /* TRNG comparator health test status& Validity information
2231 see Test Status Bit Fields below. */
2233 uint32_t test_status_fail_count;
2234 /* TRNG comparator health test status, 32bit fail counter */
2236 uint64_t r_ent_ones_cnt;
2237 /* Raw Entropy ones counter */
2239 uint64_t r_ent_zeros_cnt;
2240 /* Raw Entropy zeros counter */
2242 uint64_t c_ent_ones_cnt;
2243 /* Conditioned Entropy ones counter */
2245 uint64_t c_ent_zeros_cnt;
2246 /* Conditioned Entropy zeros counter */
2249 /* Reserved field must be set to zero */
2254 * Definition of the Lookaside SSL Key Material Input
2255 * This struct defines the layout of input parameters for the
2256 * SSL3 key generation (source flat buffer format)
2258 struct fw_la_ssl_key_material_input {
2260 /* Pointer to seed */
2262 uint64_t label_addr;
2263 /* Pointer to label(s) */
2265 uint64_t secret_addr;
2266 /* Pointer to secret */
2271 * Definition of the Lookaside TLS Key Material Input
2272 * This struct defines the layout of input parameters for the
2273 * TLS key generation (source flat buffer format)
2275 * Secret state value (S split into S1 and S2 parts) is supplied via
2276 * Content Descriptor. S1 is placed in an outer prefix buffer, and S2
2277 * inside the inner prefix buffer.
2279 struct fw_la_tls_key_material_input {
2281 /* Pointer to seed */
2283 uint64_t label_addr;
2284 /* Pointer to label(s) */
2289 * Macros using the bit position and mask to set/extract the next
2290 * and current id nibbles within the next_curr_id field of the
2291 * content descriptor header block, ONLY FOR CIPHER + AUTH COMBINED.
2292 * Note that for cipher only or authentication only, the common macros
2293 * need to be used. These are defined in the 'fw.h' common header
2294 * file, as they are used by compression, cipher and authentication.
2296 * cd_ctrl_hdr_t Content descriptor control block header.
2297 * val Value of the field being set.
2299 /* Cipher fields within Cipher + Authentication structure */
2300 #define FW_CIPHER_NEXT_ID_GET(cd_ctrl_hdr_t) \
2301 ((((cd_ctrl_hdr_t)->next_curr_id_cipher) & \
2302 FW_COMN_NEXT_ID_MASK) >> \
2303 (FW_COMN_NEXT_ID_BITPOS))
2305 #define FW_CIPHER_NEXT_ID_SET(cd_ctrl_hdr_t, val) \
2306 (cd_ctrl_hdr_t)->next_curr_id_cipher = \
2307 ((((cd_ctrl_hdr_t)->next_curr_id_cipher) & \
2308 FW_COMN_CURR_ID_MASK) | \
2309 ((val << FW_COMN_NEXT_ID_BITPOS) & \
2310 FW_COMN_NEXT_ID_MASK))
2312 #define FW_CIPHER_CURR_ID_GET(cd_ctrl_hdr_t) \
2313 (((cd_ctrl_hdr_t)->next_curr_id_cipher) & FW_COMN_CURR_ID_MASK)
2315 #define FW_CIPHER_CURR_ID_SET(cd_ctrl_hdr_t, val) \
2316 (cd_ctrl_hdr_t)->next_curr_id_cipher = \
2317 ((((cd_ctrl_hdr_t)->next_curr_id_cipher) & \
2318 FW_COMN_NEXT_ID_MASK) | \
2319 ((val)&FW_COMN_CURR_ID_MASK))
2321 /* Authentication fields within Cipher + Authentication structure */
2322 #define FW_AUTH_NEXT_ID_GET(cd_ctrl_hdr_t) \
2323 ((((cd_ctrl_hdr_t)->next_curr_id_auth) & FW_COMN_NEXT_ID_MASK) >> \
2324 (FW_COMN_NEXT_ID_BITPOS))
2326 #define FW_AUTH_NEXT_ID_SET(cd_ctrl_hdr_t, val) \
2327 (cd_ctrl_hdr_t)->next_curr_id_auth = \
2328 ((((cd_ctrl_hdr_t)->next_curr_id_auth) & \
2329 FW_COMN_CURR_ID_MASK) | \
2330 ((val << FW_COMN_NEXT_ID_BITPOS) & \
2331 FW_COMN_NEXT_ID_MASK))
2333 #define FW_AUTH_CURR_ID_GET(cd_ctrl_hdr_t) \
2334 (((cd_ctrl_hdr_t)->next_curr_id_auth) & FW_COMN_CURR_ID_MASK)
2336 #define FW_AUTH_CURR_ID_SET(cd_ctrl_hdr_t, val) \
2337 (cd_ctrl_hdr_t)->next_curr_id_auth = \
2338 ((((cd_ctrl_hdr_t)->next_curr_id_auth) & \
2339 FW_COMN_NEXT_ID_MASK) | \
2340 ((val)&FW_COMN_CURR_ID_MASK))
2342 /* Definitions of the bits in the test_status_info of the TRNG_TEST response.
2343 * The values returned by the Lookaside service are given below
2344 * The Test result and Test Fail Count values are only valid if the Test
2345 * Results Valid (Tv) is set.
2347 * TRNG Test Status Info
2348 * + ===== + ------------------------------------------------ + --- + --- +
2349 * | Bit | 31 - 2 | 1 | 0 |
2350 * + ===== + ------------------------------------------------ + --- + --- +
2351 * | Flags | RESERVED = 0 | Tv | Ts |
2352 * + ===== + ------------------------------------------------------------ +
2355 * Definition of the Lookaside TRNG Test Status Information received as
2356 * a part of fw_la_trng_test_result_t
2359 #define FW_LA_TRNG_TEST_STATUS_TS_BITPOS 0
2360 /* TRNG Test Result t_status field bit pos definition. */
2362 #define FW_LA_TRNG_TEST_STATUS_TS_MASK 0x1
2363 /* TRNG Test Result t_status field mask definition. */
2365 #define FW_LA_TRNG_TEST_STATUS_TV_BITPOS 1
2366 /* TRNG Test Result test results valid field bit pos definition. */
2368 #define FW_LA_TRNG_TEST_STATUS_TV_MASK 0x1
2369 /* TRNG Test Result test results valid field mask definition. */
2372 * Definition of the Lookaside TRNG test_status values.
2376 #define FW_LA_TRNG_TEST_STATUS_TV_VALID 1
2377 /* TRNG TEST Response Test Results Valid Value. */
2379 #define FW_LA_TRNG_TEST_STATUS_TV_NOT_VALID 0
2380 /* TRNG TEST Response Test Results are NOT Valid Value. */
2382 #define FW_LA_TRNG_TEST_STATUS_TS_NO_FAILS 1
2383 /* Value for TRNG Test status tests have NO FAILs Value. */
2385 #define FW_LA_TRNG_TEST_STATUS_TS_HAS_FAILS 0
2386 /* Value for TRNG Test status tests have one or more FAILS Value. */
2389 * Macro for extraction of the Test Status Field returned in the response
2390 * to TRNG TEST command.
2392 * test_status 8 bit test_status value to extract the status bit
2394 #define FW_LA_TRNG_TEST_STATUS_TS_FLD_GET(test_status) \
2395 FIELD_GET(test_status, \
2396 FW_LA_TRNG_TEST_STATUS_TS_BITPOS, \
2397 FW_LA_TRNG_TEST_STATUS_TS_MASK)
2399 * Macro for extraction of the Test Results Valid Field returned in the
2400 * response to TRNG TEST command.
2402 * test_status 8 bit test_status value to extract the Tests
2405 #define FW_LA_TRNG_TEST_STATUS_TV_FLD_GET(test_status) \
2406 FIELD_GET(test_status, \
2407 FW_LA_TRNG_TEST_STATUS_TV_BITPOS, \
2408 FW_LA_TRNG_TEST_STATUS_TV_MASK)
2411 * MGF Max supported input parameters
2413 #define FW_LA_MGF_SEED_LEN_MAX 255
2414 /* Maximum seed length for MGF1 request in bytes
2415 * Typical values may be 48, 64, 128 bytes (or any). */
2417 #define FW_LA_MGF_MASK_LEN_MAX 65528
2418 /* Maximum mask length for MGF1 request in bytes
2419 * Typical values may be 8 (64-bit), 16 (128-bit). MUST be quad word multiple */
2422 * SSL Max supported input parameters
2424 #define FW_LA_SSL_SECRET_LEN_MAX 512
2425 /* Maximum secret length for SSL3 Key Gen request (bytes) */
2427 #define FW_LA_SSL_ITERATES_LEN_MAX 16
2428 /* Maximum iterations for SSL3 Key Gen request (integer) */
2430 #define FW_LA_SSL_LABEL_LEN_MAX 136
2431 /* Maximum label length for SSL3 Key Gen request (bytes) */
2433 #define FW_LA_SSL_SEED_LEN_MAX 64
2434 /* Maximum seed length for SSL3 Key Gen request (bytes) */
2436 #define FW_LA_SSL_OUTPUT_LEN_MAX 248
2437 /* Maximum output length for SSL3 Key Gen request (bytes) */
2440 * TLS Max supported input parameters
2442 #define FW_LA_TLS_SECRET_LEN_MAX 128
2443 /* Maximum secret length for TLS Key Gen request (bytes) */
2445 #define FW_LA_TLS_V1_1_SECRET_LEN_MAX 128
2446 /* Maximum secret length for TLS Key Gen request (bytes) */
2448 #define FW_LA_TLS_V1_2_SECRET_LEN_MAX 64
2449 /* Maximum secret length for TLS Key Gen request (bytes) */
2451 #define FW_LA_TLS_LABEL_LEN_MAX 255
2452 /* Maximum label length for TLS Key Gen request (bytes) */
2454 #define FW_LA_TLS_SEED_LEN_MAX 64
2455 /* Maximum seed length for TLS Key Gen request (bytes) */
2457 #define FW_LA_TLS_OUTPUT_LEN_MAX 248
2458 /* Maximum output length for TLS Key Gen request (bytes) */