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