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 0 17 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_DRBG 0 18 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_DSA 0 19 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_ECC 0 20 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_KEYGEN 0 21 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_LN 0 22 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_PRIME 0 23 #define ADF_CFG_STATIC_CONF_SAL_STATS_CFG_RSA 0 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 2 32 #define ADF_CFG_STATIC_CONF_INST_NUM_CY_IRQ 2 33 34 #define ADF_CFG_FW_STRING_TO_ID(str, acc, id) \ 35 do { \ 36 typeof(id) id_ = (id); \ 37 typeof(str) str_; \ 38 memcpy(str_, (str), sizeof(str_)); \ 39 if (!strncmp(str_, \ 40 ADF_SERVICES_DEFAULT, \ 41 sizeof(ADF_SERVICES_DEFAULT))) \ 42 *id_ = ADF_FW_IMAGE_DEFAULT; \ 43 else if (!strncmp(str_, \ 44 ADF_SERVICES_CRYPTO, \ 45 sizeof(ADF_SERVICES_CRYPTO))) \ 46 *id_ = ADF_FW_IMAGE_CRYPTO; \ 47 else if (!strncmp(str_, \ 48 ADF_SERVICES_COMPRESSION, \ 49 sizeof(ADF_SERVICES_COMPRESSION))) \ 50 *id_ = ADF_FW_IMAGE_COMPRESSION; \ 51 else if (!strncmp(str_, \ 52 ADF_SERVICES_CUSTOM1, \ 53 sizeof(ADF_SERVICES_CUSTOM1))) \ 54 *id_ = ADF_FW_IMAGE_CUSTOM1; \ 55 else { \ 56 *id_ = ADF_FW_IMAGE_DEFAULT; \ 57 device_printf(GET_DEV(acc), \ 58 "Invalid SerivesProfile: %s," \ 59 "Using DEFAULT image\n", \ 60 str_); \ 61 } \ 62 } while (0) 63 64 int adf_cfg_get_ring_pairs(struct adf_cfg_device *device, 65 struct adf_cfg_instance *inst, 66 const char *process_name, 67 struct adf_accel_dev *accel_dev); 68 69 int adf_cfg_device_init(struct adf_cfg_device *device, 70 struct adf_accel_dev *accel_dev); 71 72 void adf_cfg_device_clear(struct adf_cfg_device *device, 73 struct adf_accel_dev *accel_dev); 74 75 #endif 76