1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /******************************************************************************
5  * @file icp_adf_cfg.h
6  *
7  * @defgroup icp_AdfCfg Acceleration Driver Framework Configuration Interface.
8  *
9  * @ingroup icp_Adf
10  *
11  * @description
12  *      This is the top level header file for the run-time system configuration
13  *      parameters. This interface may be used by components of this API to
14  *      access the supported run-time configuration parameters.
15  *
16  *****************************************************************************/
17 
18 #ifndef ICP_ADF_CFG_H
19 #define ICP_ADF_CFG_H
20 
21 #include "cpa.h"
22 #include "icp_accel_devices.h"
23 
24 /******************************************************************************
25 * Section for #define's & typedef's
26 ******************************************************************************/
27 /* Address of the UOF firmware */
28 #define ICP_CFG_UOF_ADDRESS_KEY ("Firmware_UofAddress")
29 /* Size of the UOF firmware */
30 #define ICP_CFG_UOF_SIZE_BYTES_KEY ("Firmware_UofSizeInBytes")
31 /* Address of the MMP firmware */
32 #define ICP_CFG_MMP_ADDRESS_KEY ("Firmware_MmpAddress")
33 /* Size of the MMP firmware */
34 #define ICP_CFG_MMP_SIZE_BYTES_KEY ("Firmware_MMpSizeInBytes")
35 /* MMP firmware version */
36 #define ICP_CFG_MMP_VER_KEY ("Firmware_MmpVer")
37 /* UOF firmware version */
38 #define ICP_CFG_UOF_VER_KEY ("Firmware_UofVer")
39 /* Tools version */
40 #define ICP_CFG_TOOLS_VER_KEY ("Firmware_ToolsVer")
41 /* Hardware rev id */
42 #define ICP_CFG_HW_REV_ID_KEY ("HW_RevId")
43 /* Lowest Compatible Driver Version */
44 #define ICP_CFG_LO_COMPATIBLE_DRV_KEY ("Lowest_Compat_Drv_Ver")
45 /* Pke Service Disabled flag */
46 #define ICP_CFG_PKE_DISABLED ("PkeServiceDisabled")
47 /* SRAM Physical Address Key */
48 #define ADF_SRAM_PHYSICAL_ADDRESS ("Sram_PhysicalAddress")
49 /* SRAM Virtual Address Key */
50 #define ADF_SRAM_VIRTUAL_ADDRESS ("Sram_VirtualAddress")
51 /* SRAM Size In Bytes Key */
52 #define ADF_SRAM_SIZE_IN_BYTES ("Sram_SizeInBytes")
53 /* Device node id, tells to which die the device is
54  * connected to */
55 #define ADF_DEV_NODE_ID "Device_NodeId"
56 /* Device package id, this is accel_dev id */
57 #define ADF_DEV_PKG_ID "Device_PkgId"
58 /* Device bus address, B.D.F (Bus(8bits),Device(5bits),Function(3bits)) */
59 #define ADF_DEV_BUS_ADDRESS ("Device_BusAddress")
60 /* Number of Acceleration Engines */
61 #define ADF_DEV_NUM_AE ("Device_Num_AE")
62 /* Number of Accelerators */
63 #define ADF_DEV_NUM_ACCEL ("Device_Num_Accel")
64 /* Max Number of Acceleration Engines */
65 #define ADF_DEV_MAX_AE ("Device_Max_AE")
66 /* Max Number of Accelerators */
67 #define ADF_DEV_MAX_ACCEL ("Device_Max_Accel")
68 /* QAT/AE Mask*/
69 #define ADF_DEV_MAX_RING_PER_QAT ("Device_Max_Num_Rings_per_Accel")
70 /* Number of Accelerators */
71 #define ADF_DEV_ACCELAE_MASK_FMT ("Device_Accel_AE_Mask_%d")
72 /* VF ring offset */
73 #define ADF_VF_RING_OFFSET_KEY ("VF_RingOffset")
74 /* Mask of Accelerators */
75 #define ADF_DEV_AE_MASK ("Device_AE_Mask")
76 /* Whether or not arbitration is supported */
77 #define ADF_DEV_ARB_SUPPORTED ("ArbitrationSupported")
78 /* Slice Watch Dog Timer for CySym+Comp */
79 #define ADF_DEV_SSM_WDT_BULK "CySymAndDcWatchDogTimer"
80 /* Slice Watch Dog Timer for CyAsym */
81 #define ADF_DEV_SSM_WDT_PKE "CyAsymWatchDogTimer"
82 
83 /* String names for the exposed sections of config file. */
84 #define GENERAL_SEC "GENERAL"
85 #define WIRELESS_SEC "WIRELESS_INT_"
86 #define DYN_SEC "DYN"
87 #define DEV_LIMIT_CFG_ACCESS_TMPL "_D_L_ACC"
88 /*#define WIRELESS_ENABLED                "WirelessEnabled"*/
89 
90 /*
91  * icp_adf_cfgGetParamValue
92  *
93  * Description:
94  * This function is used to determine the value for a given parameter name.
95  *
96  * Returns:
97  *   CPA_STATUS_SUCCESS   on success
98  *   CPA_STATUS_FAIL      on failure
99  */
100 CpaStatus icp_adf_cfgGetParamValue(icp_accel_dev_t *accel_dev,
101 				   const char *section,
102 				   const char *param_name,
103 				   char *param_value);
104 /*
105  * icp_adf_cfgGetRingNumber
106  *
107  * Description:
108  * Function returns ring number configured for the service.
109  * NOTE: this function will only be used by QATAL in kernelspace.
110  * Returns:
111  *   CPA_STATUS_SUCCESS   on success
112  *   CPA_STATUS_FAIL      on failure
113  */
114 CpaStatus icp_adf_cfgGetRingNumber(icp_accel_dev_t *accel_dev,
115 				   const char *section_name,
116 				   const Cpa32U accel_num,
117 				   const Cpa32U bank_num,
118 				   const char *pServiceName,
119 				   Cpa32U *pRingNum);
120 
121 /*
122  * icp_adf_get_busAddress
123  * Gets the B.D.F. of the physical device
124  */
125 Cpa16U icp_adf_get_busAddress(Cpa16U packageId);
126 
127 #endif /* ICP_ADF_CFG_H */
128