xref: /freebsd/sys/dev/qat/include/adf_cfg_device.h (revision 66fd12cf4896eb08ad8e7a2627537f84ead84dd3)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 #ifndef ADF_CFG_DEVICE_H_
5 #define ADF_CFG_DEVICE_H_
6 
7 #include "adf_cfg.h"
8 #include "sal_statistics_strings.h"
9 
10 #define ADF_CFG_STATIC_CONF_VER 2
11 #define ADF_CFG_STATIC_CONF_CY_ASYM_RING_SIZE 64
12 #define ADF_CFG_STATIC_CONF_CY_SYM_RING_SIZE 512
13 #define ADF_CFG_STATIC_CONF_DC_INTER_BUF_SIZE 64
14 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_ENABLED 1
15 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_DC 1
16 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_DH 1
17 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_DRBG 1
18 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_DSA 1
19 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_ECC 1
20 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_KEYGEN 1
21 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_LN 1
22 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_PRIME 1
23 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_RSA 1
24 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_SYM 1
25 #define ADF_CFG_STATIC_CONF_POLL 1
26 #define ADF_CFG_STATIC_CONF_IRQ 0
27 #define ADF_CFG_STATIC_CONF_AUTO_RESET 0
28 #define ADF_CFG_STATIC_CONF_NUM_DC_ACCEL_UNITS 2
29 #define ADF_CFG_STATIC_CONF_NUM_INLINE_ACCEL_UNITS 0
30 #define ADF_CFG_STATIC_CONF_INST_NUM_DC 2
31 #define ADF_CFG_STATIC_CONF_INST_NUM_CY_POLL 6
32 #define ADF_CFG_STATIC_CONF_INST_NUM_CY_IRQ 2
33 #define ADF_CFG_STATIC_CONF_USER_PROCESSES_NUM 2
34 #define ADF_CFG_STATIC_CONF_USER_INST_NUM_CY 6
35 #define ADF_CFG_STATIC_CONF_USER_INST_NUM_DC 2
36 #define ADF_CFG_STATIC_CONF_INST_NUM_CY_POLL_VF 1
37 #define ADF_CFG_STATIC_CONF_INST_NUM_CY_IRQ_VF 1
38 #define ADF_CFG_STATIC_CONF_INST_NUM_DC_VF 2
39 #define ADF_CFG_STATIC_CONF_USER_INST_NUM_CY_VF 2
40 #define ADF_CFG_STATIC_CONF_USER_INST_NUM_DC_VF 2
41 
42 #define ADF_CFG_FW_STRING_TO_ID(str, acc, id)                                  \
43 	do {                                                                   \
44 		typeof(id) id_ = (id);                                         \
45 		typeof(str) str_;                                              \
46 		memcpy(str_, (str), sizeof(str_));                             \
47 		if (!strncmp(str_,                                             \
48 			     ADF_SERVICES_DEFAULT,                             \
49 			     sizeof(ADF_SERVICES_DEFAULT)))                    \
50 			*id_ = ADF_FW_IMAGE_DEFAULT;                           \
51 		else if (!strncmp(str_,                                        \
52 				  ADF_SERVICES_CRYPTO,                         \
53 				  sizeof(ADF_SERVICES_CRYPTO)))                \
54 			*id_ = ADF_FW_IMAGE_CRYPTO;                            \
55 		else if (!strncmp(str_,                                        \
56 				  ADF_SERVICES_COMPRESSION,                    \
57 				  sizeof(ADF_SERVICES_COMPRESSION)))           \
58 			*id_ = ADF_FW_IMAGE_COMPRESSION;                       \
59 		else if (!strncmp(str_,                                        \
60 				  ADF_SERVICES_CUSTOM1,                        \
61 				  sizeof(ADF_SERVICES_CUSTOM1)))               \
62 			*id_ = ADF_FW_IMAGE_CUSTOM1;                           \
63 		else {                                                         \
64 			*id_ = ADF_FW_IMAGE_DEFAULT;                           \
65 			device_printf(GET_DEV(acc),                            \
66 				      "Invalid SerivesProfile: %s,"            \
67 				      "Using DEFAULT image\n",                 \
68 				      str_);                                   \
69 		}                                                              \
70 	} while (0)
71 
72 int adf_cfg_get_ring_pairs(struct adf_cfg_device *device,
73 			   struct adf_cfg_instance *inst,
74 			   const char *process_name,
75 			   struct adf_accel_dev *accel_dev);
76 
77 int adf_cfg_device_init(struct adf_cfg_device *device,
78 			struct adf_accel_dev *accel_dev);
79 
80 void adf_cfg_device_clear(struct adf_cfg_device *device,
81 			  struct adf_accel_dev *accel_dev);
82 
83 #endif
84