1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /**
5 * @file icp_qat_fw_pke.h
6 * @defgroup icp_qat_fw_pke ICP QAT FW PKE Processing Definitions
7 * @ingroup icp_qat_fw
8 * $Revision: 0.1 $
9 * @brief
10 * This file documents the external interfaces that the QAT FW running
11 * on the QAT Acceleration Engine provides to clients wanting to
12 * accelerate crypto assymetric applications
13 */
14
15 #ifndef _ICP_QAT_FW_PKE_
16 #define _ICP_QAT_FW_PKE_
17
18 /*
19 ****************************************************************************
20 * Include local header files
21 ****************************************************************************
22 */
23 #include "icp_qat_fw.h"
24
25 /**
26 *****************************************************************************
27 *
28 * @ingroup icp_qat_fw_pke
29 *
30 * @brief
31 * PKE response status field structure contained
32 * within LW1, comprising the common error codes and
33 * the response flags.
34 *
35 *****************************************************************************/
36 typedef struct icp_qat_fw_pke_resp_status_s {
37 uint8_t comn_err_code;
38 /**< 8 bit common error code */
39
40 uint8_t pke_resp_flags;
41 /**< 8-bit PKE response flags */
42
43 } icp_qat_fw_pke_resp_status_t;
44
45 /**
46 *****************************************************************************
47 * @ingroup icp_qat_fw_pke
48 * Definition of the QAT FW PKE request header pars field.
49 * Structure differs from the DH895xxCC common base header structure, hence
50 * redefined here.
51 * @description
52 * PKE request message header pars structure
53 *
54 *****************************************************************************/
55 typedef struct icp_qat_fw_req_hdr_pke_cd_pars_s {
56 /**< LWs 2-3 */
57 uint64_t content_desc_addr;
58 /**< Content descriptor pointer */
59
60 /**< LW 4 */
61 uint32_t content_desc_resrvd;
62 /**< Content descriptor reserved field */
63
64 /**< LW 5 */
65 uint32_t func_id;
66 /**< MMP functionality Id */
67
68 } icp_qat_fw_req_hdr_pke_cd_pars_t;
69
70 /**
71 *****************************************************************************
72 * @ingroup icp_qat_fw_pke
73 * Definition of the QAT FW PKE request header mid section.
74 * Structure differs from the DH895xxCC common base header structure,
75 * instead following the DH89xxCC format, hence redefined here.
76 * @description
77 * PKE request message header middle structure
78 *
79 *****************************************************************************/
80 typedef struct icp_qat_fw_req_pke_mid_s {
81 /**< LWs 6-11 */
82 uint64_t opaque_data;
83 /**< Opaque data passed unmodified from the request to response messages
84 * by
85 * firmware (fw) */
86
87 uint64_t src_data_addr;
88 /**< Generic definition of the source data supplied to the QAT AE. The
89 * common flags are used to further describe the attributes of this
90 * field */
91
92 uint64_t dest_data_addr;
93 /**< Generic definition of the destination data supplied to the QAT AE.
94 * The
95 * common flags are used to further describe the attributes of this
96 * field */
97
98 /**< Following DH89xxCC structure format - footer is excluded */
99
100 } icp_qat_fw_req_pke_mid_t;
101
102 /**
103 *****************************************************************************
104 * @ingroup icp_qat_fw_pke
105 * Definition of the QAT FW PKE request header.
106 * Structure differs from the DH895xxCC common base header structure,
107 * instead following the DH89xxCC format, hence redefined here.
108 * @description
109 * PKE request message header structure
110 *
111 *****************************************************************************/
112 typedef struct icp_qat_fw_req_pke_hdr_s {
113 /**< LW0 */
114 uint8_t resrvd1;
115 /**< reserved field */
116
117 uint8_t resrvd2;
118 /**< reserved field */
119
120 uint8_t service_type;
121 /**< Service type */
122
123 uint8_t hdr_flags;
124 /**< This represents a flags field for the Service Request.
125 * The most significant bit is the 'valid' flag and the only
126 * one used. All remaining bit positions are unused and
127 * are therefore reserved and need to be set to 0. */
128
129 /**< LW1 */
130 icp_qat_fw_comn_flags comn_req_flags;
131 /**< Common Request flags must indicate flat buffer (as per DH89xxCC)
132 * Common Request flags - PKE slice flags no longer used - slice
133 * allocated to a threadstrand.*/
134
135 uint16_t resrvd4;
136 /**< (DH89xxCC) CD Header Size and CD Params Size unused. Set to zero.
137 */
138
139 /**< LWs 2-5 */
140 icp_qat_fw_req_hdr_pke_cd_pars_t cd_pars;
141 /**< PKE request message header pars structure - this differs
142 * from the DH895xxCC common base structure */
143
144 } icp_qat_fw_req_pke_hdr_t;
145
146 /**
147 ***************************************************************************
148 *
149 * @ingroup icp_qat_fw_pke
150 *
151 * @brief
152 * PKE request message structure (64 bytes)
153 *
154 *****************************************************************************/
155 typedef struct icp_qat_fw_pke_request_s {
156 /**< LWs 0-5 */
157 icp_qat_fw_req_pke_hdr_t pke_hdr;
158 /**< Request header for PKE - CD Header/Param size
159 * must be zero */
160
161 /**< LWs 6-11 (same as DH89xxCC) */
162 icp_qat_fw_req_pke_mid_t pke_mid;
163 /**< Request middle section for PKE */
164
165 /**< LW 12 */
166 uint8_t output_param_count;
167 /**< Number of output large integers
168 * for request */
169
170 uint8_t input_param_count;
171 /**< Number of input large integers
172 * for request */
173
174 uint16_t resrvd1;
175 /** Reserved **/
176
177 /**< LW 13 */
178 uint32_t resrvd2;
179 /**< Reserved */
180
181 /**< LWs 14-15 */
182 uint64_t next_req_adr;
183 /** < PKE - next request address */
184
185 } icp_qat_fw_pke_request_t;
186
187 /**
188 *****************************************************************************
189 *
190 * @ingroup icp_qat_fw_pke
191 *
192 * @brief
193 * PKE response message header structure
194 *
195 *****************************************************************************/
196 typedef struct icp_qat_fw_resp_pke_hdr_s {
197 /**< LW0 */
198 uint8_t resrvd1;
199 /**< The Response Destination Id has been removed
200 * from first QWord */
201
202 uint8_t resrvd2;
203 /**< Response Pipe Id field is unused (reserved)
204 * - Functionality within DH895xxCC uses arbiter instead */
205
206 uint8_t response_type;
207 /**< Response type - copied from the request to
208 * the response message */
209
210 uint8_t hdr_flags;
211 /**< This represents a flags field for the Response.
212 * The most significant bit is the 'valid' flag and the only
213 * one used. All remaining bit positions are unused and
214 * are therefore reserved */
215
216 /**< LW1 */
217 icp_qat_fw_pke_resp_status_t resp_status;
218
219 uint16_t resrvd4;
220 /**< (DH89xxCC) CD Header Size and CD Params Size fields unused.
221 * Set to zero. */
222
223 } icp_qat_fw_resp_pke_hdr_t;
224
225 /**
226 *****************************************************************************
227 *
228 * @ingroup icp_qat_fw_pke
229 *
230 * @brief
231 * PKE response message structure (32 bytes)
232 *
233 *****************************************************************************/
234 typedef struct icp_qat_fw_pke_resp_s {
235 /**< LWs 0-1 */
236 icp_qat_fw_resp_pke_hdr_t pke_resp_hdr;
237 /**< Response header for PKE */
238
239 /**< LWs 2-3 */
240 uint64_t opaque_data;
241 /**< Opaque data passed from the request to the response message */
242
243 /**< LWs 4-5 */
244 uint64_t src_data_addr;
245 /**< Generic definition of the source data supplied to the QAT AE. The
246 * common flags are used to further describe the attributes of this
247 * field */
248
249 /**< LWs 6-7 */
250 uint64_t dest_data_addr;
251 /**< Generic definition of the destination data supplied to the QAT AE.
252 * The
253 * common flags are used to further describe the attributes of this
254 * field */
255
256 } icp_qat_fw_pke_resp_t;
257
258 /* ========================================================================= */
259 /* MACRO DEFINITIONS */
260 /* ========================================================================= */
261
262 /**< @ingroup icp_qat_fw_pke
263 * Macro defining the bit position and mask of the 'valid' flag, within the
264 * hdr_flags field of LW0 (service request and response) of the PKE request */
265 #define ICP_QAT_FW_PKE_HDR_VALID_FLAG_BITPOS 7
266 #define ICP_QAT_FW_PKE_HDR_VALID_FLAG_MASK 0x1
267
268 /**< @ingroup icp_qat_fw_pke
269 * Macro defining the bit position and mask of the PKE status flag, within the
270 * status field LW1 of a PKE response message */
271 #define QAT_COMN_RESP_PKE_STATUS_BITPOS 6
272 /**< @ingroup icp_qat_fw_pke
273 * Starting bit position indicating the PKE status flag within the PKE response
274 * pke_resp_flags byte. */
275
276 #define QAT_COMN_RESP_PKE_STATUS_MASK 0x1
277 /**< @ingroup icp_qat_fw_pke
278 * One bit mask used to determine PKE status mask */
279
280 /*
281 * < @ingroup icp_qat_fw_pke
282 * *** PKE Response Status Field Definition ***
283 * The PKE response follows the CPM 1.5 message format. The status field is 16 bits
284 * wide, where the status flags are contained within the most significant byte of the
285 * icp_qat_fw_pke_resp_status_t structure. The lower 8 bits of this word now contain
286 * the common error codes, which are defined in the common header file(*).
287 */
288 /* + ===== + ----- + ---- + ----- + ----- + ----- + ----- + ----- + ----- + ----------------------- +
289 * | Bit | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | [7....0] |
290 * + ===== + ----- + ---- + ----- + ----- + ----- + ----- + ----- + ----- + ----------------------- +
291 * | Flags | Rsrvd | Pke | Rsrvd | Rsrvd | Rsrvd | Rsrvd | Rsrvd | Rsrvd | Common error codes(*) |
292 * + ===== + ----- + ---- + ----- + ----- + ----- + ----- + ----- + ----- + ----------------------- +
293 */
294
295 /**
296 ******************************************************************************
297 * @ingroup icp_qat_fw_pke
298 *
299 * @description
300 * Macro for extraction of the PKE bit from the 16-bit status field
301 * particular to a PKE response. The status flags are contained within
302 * the most significant byte of the word. The lower 8 bits of this status
303 * word now contain the common error codes, which are defined in the common
304 * header file. The appropriate macro definition to extract the PKE status
305 * flag from the PKE response assumes that a single byte i.e.
306 *pke_resp_flags
307 * is passed to the macro.
308 *
309 * @param status
310 * Status to extract the PKE status bit
311 *
312 *****************************************************************************/
313 #define ICP_QAT_FW_PKE_RESP_PKE_STAT_GET(flags) \
314 QAT_FIELD_GET((flags), \
315 QAT_COMN_RESP_PKE_STATUS_BITPOS, \
316 QAT_COMN_RESP_PKE_STATUS_MASK)
317
318 /**
319 ******************************************************************************
320 * @ingroup icp_qat_fw_pke
321 *
322 * @description
323 * Extract the valid flag from the PKE Request's header flags. Note that
324 * this invokes the common macro which may be used by either the request
325 * or the response.
326 *
327 * @param icp_qat_fw_req_pke_hdr_t Structure passed to extract the valid bit
328 * from the 'hdr_flags' field.
329 *
330 *****************************************************************************/
331 #define ICP_QAT_FW_PKE_RQ_VALID_FLAG_GET(icp_qat_fw_req_pke_hdr_t) \
332 ICP_QAT_FW_PKE_HDR_VALID_FLAG_GET(icp_qat_fw_req_pke_hdr_t)
333
334 /**
335 ******************************************************************************
336 * @ingroup icp_qat_fw_pke
337 *
338 * @description
339 * Set the valid bit in the PKE Request's header flags. Note that
340 * this invokes the common macro which may be used by either the request
341 * or the response.
342 *
343 * @param icp_qat_fw_req_pke_hdr_t Structure passed to set the valid bit.
344 * @param val Value of the valid bit flag.
345 *
346 *****************************************************************************/
347 #define ICP_QAT_FW_PKE_RQ_VALID_FLAG_SET(icp_qat_fw_req_pke_hdr_t, val) \
348 ICP_QAT_FW_PKE_HDR_VALID_FLAG_SET(icp_qat_fw_req_pke_hdr_t, val)
349
350 /**
351 ******************************************************************************
352 * @ingroup icp_qat_fw_pke
353 *
354 * @description
355 * Extract the valid flag from the PKE Response's header flags. Note that
356 * invokes the common macro which may be used by either the request
357 * or the response.
358 *
359 * @param icp_qat_fw_resp_pke_hdr_t Structure to extract the valid bit
360 * from the 'hdr_flags' field.
361 *
362 *****************************************************************************/
363 #define ICP_QAT_FW_PKE_RESP_VALID_FLAG_GET(icp_qat_fw_resp_pke_hdr_t) \
364 ICP_QAT_FW_PKE_HDR_VALID_FLAG_GET(icp_qat_fw_resp_pke_hdr_t)
365
366 /**
367 ******************************************************************************
368 * @ingroup icp_qat_fw_pke
369 *
370 * @description
371 * Set the valid bit in the PKE Response's header flags. Note that
372 * this invokes the common macro which may be used by either the
373 * request or the response.
374 *
375 * @param icp_qat_fw_resp_pke_hdr_t Structure to set the valid bit
376 * @param val Value of the valid bit flag.
377 *
378 *****************************************************************************/
379 #define ICP_QAT_FW_PKE_RESP_VALID_FLAG_SET(icp_qat_fw_resp_pke_hdr_t, val) \
380 ICP_QAT_FW_PKE_HDR_VALID_FLAG_SET(icp_qat_fw_resp_pke_hdr_t, val)
381
382 /**
383 ******************************************************************************
384 * @ingroup icp_qat_fw_pke
385 *
386 * @description
387 * Common macro to extract the valid flag from the header flags field
388 * within the header structure (request or response).
389 *
390 * @param hdr_t Structure (request or response) to extract the
391 * valid bit from the 'hdr_flags' field.
392 *
393 *****************************************************************************/
394 #define ICP_QAT_FW_PKE_HDR_VALID_FLAG_GET(hdr_t) \
395 QAT_FIELD_GET(hdr_t.hdr_flags, \
396 ICP_QAT_FW_PKE_HDR_VALID_FLAG_BITPOS, \
397 ICP_QAT_FW_PKE_HDR_VALID_FLAG_MASK)
398
399 /**
400 ******************************************************************************
401 * @ingroup icp_qat_fw_pke
402 *
403 * @description
404 * Common macro to set the valid bit in the header flags field within
405 * the header structure (request or response).
406 *
407 * @param hdr_t Structure (request or response) containing the header
408 * flags field, to allow the valid bit to be set.
409 * @param val Value of the valid bit flag.
410 *
411 *****************************************************************************/
412 #define ICP_QAT_FW_PKE_HDR_VALID_FLAG_SET(hdr_t, val) \
413 QAT_FIELD_SET((hdr_t.hdr_flags), \
414 (val), \
415 ICP_QAT_FW_PKE_HDR_VALID_FLAG_BITPOS, \
416 ICP_QAT_FW_PKE_HDR_VALID_FLAG_MASK)
417
418 #endif /* _ICP_QAT_FW_PKE_ */
Cache object: adc5bd3f9d7ebf0076841b176245ff0e
|