1 /* SPDX-License-Identifier: BSD-3-Clause */ 2 /* Copyright(c) 2007-2022 Intel Corporation */ 3 /* $FreeBSD$ */ 4 /** 5 ***************************************************************************** 6 * @file sal_qat_cmn_msg.c 7 * 8 * @ingroup SalQatCmnMessage 9 * 10 * @description 11 * Implementation for populating the common (across services) QAT structures. 12 * 13 *****************************************************************************/ 14 #ifndef SAL_QAT_CMN_MSG_H 15 #define SAL_QAT_CMN_MSG_H 16 /* 17 ******************************************************************************* 18 * Include public/global header files 19 ******************************************************************************* 20 */ 21 #include "cpa.h" 22 23 /* 24 ******************************************************************************* 25 * Include private header files 26 ******************************************************************************* 27 */ 28 #include "lac_common.h" 29 #include "icp_accel_devices.h" 30 #include "qat_utils.h" 31 32 #include "cpa_cy_sym.h" 33 #include "lac_mem.h" 34 #include "lac_mem_pools.h" 35 #include "lac_list.h" 36 #include "icp_adf_transport.h" 37 #include "icp_adf_transport_dp.h" 38 39 #include "icp_qat_hw.h" 40 #include "icp_qat_fw.h" 41 #include "icp_qat_fw_la.h" 42 43 /** 44 ****************************************************************************** 45 * @ingroup SalQatCmnMessage 46 * content descriptor info structure 47 * 48 * @description 49 * This structure contains generic information on the content descriptor 50 * 51 *****************************************************************************/ 52 typedef struct sal_qat_content_desc_info_s { 53 CpaPhysicalAddr hardwareSetupBlockPhys; 54 /**< Physical address of hardware setup block of the content descriptor 55 */ 56 void *pData; 57 /**< Virtual Pointer to the hardware setup block of the content 58 * descriptor */ 59 Cpa8U hwBlkSzQuadWords; 60 /**< Hardware Setup Block size in quad words */ 61 } sal_qat_content_desc_info_t; 62 63 /** 64 ******************************************************************************* 65 * @ingroup SalQatCmnMessage 66 * Lookaside response handler function type 67 * 68 * @description 69 * This type definition specifies the function prototype for handling the 70 * response messages for a specific symmetric operation 71 * 72 * @param[in] lacCmdId Look Aside Command ID 73 * 74 * @param[in] pOpaqueData Pointer to Opaque Data 75 * 76 * @param[in] cmnRespFlags Common Response flags 77 * 78 * @return void 79 * 80 *****************************************************************************/ 81 typedef void (*sal_qat_resp_handler_func_t)(icp_qat_fw_la_cmd_id_t lacCmdId, 82 void *pOpaqueData, 83 icp_qat_fw_comn_flags cmnRespFlags); 84 85 /******************************************************************** 86 * @ingroup SalQatMsg_CmnHdrWrite 87 * 88 * @description 89 * This function fills in all fields in the icp_qat_fw_comn_req_hdr_t 90 * section of the Request Msg. Build LW0 + LW1 - 91 * service part of the request 92 * 93 * @param[in] pMsg Pointer to 128B Request Msg buffer 94 * @param[in] serviceType type of service request 95 * @param[in] serviceCmdId id for the type of service request 96 * @param[in] cmnFlags common request flags 97 * @param[in] serviceCmdFlags service command flahgs 98 * 99 * @return 100 * None 101 * 102 *****************************************/ 103 void SalQatMsg_CmnHdrWrite(icp_qat_fw_comn_req_t *pMsg, 104 icp_qat_fw_comn_request_id_t serviceType, 105 uint8_t serviceCmdId, 106 icp_qat_fw_comn_flags cmnFlags, 107 icp_qat_fw_serv_specif_flags serviceCmdFlags); 108 109 /******************************************************************** 110 * @ingroup SalQatMsg_CmnMidWrite 111 * 112 * @description 113 * This function fills in all fields in the icp_qat_fw_comn_req_mid_t 114 * section of the Request Msg and the corresponding SGL/Flat flag 115 * in the Hdr. 116 * 117 * @param[in] pReq Pointer to 128B Request Msg buffer 118 * @param[in] pOpaqueData Pointer to opaque data used by callback 119 * @param[in] bufferFormat src and dst Buffers are either SGL or Flat 120 format 121 * @param[in] pSrcBuffer Address of source buffer 122 * @param[in] pDstBuffer Address of destination buffer 123 * @param[in] pSrcLength Length of source buffer 124 * @param[in] pDstLength Length of destination buffer 125 * 126 127 * @assumptions 128 * All fields in mid section are zero before fn is called 129 130 * @return 131 * None 132 * 133 *****************************************/ 134 void SalQatMsg_CmnMidWrite(icp_qat_fw_la_bulk_req_t *pReq, 135 const void *pOpaqueData, 136 Cpa8U bufferFormat, 137 Cpa64U srcBuffer, 138 Cpa64U dstBuffer, 139 Cpa32U srcLength, 140 Cpa32U dstLength); 141 142 /******************************************************************** 143 * @ingroup SalQatMsg_ContentDescHdrWrite 144 * 145 * @description 146 * This function fills in all fields in the 147 *icp_qat_fw_comn_req_hdr_cd_pars_t 148 * section of the Request Msg. 149 * 150 * @param[in] pMsg Pointer to 128B Request Msg buffer. 151 * @param[in] pContentDescInfo content descripter info. 152 * 153 * @return 154 * none 155 * 156 *****************************************/ 157 void SalQatMsg_ContentDescHdrWrite( 158 icp_qat_fw_comn_req_t *pMsg, 159 const sal_qat_content_desc_info_t *pContentDescInfo); 160 161 /******************************************************************** 162 * @ingroup SalQatMsg_CtrlBlkSetToReserved 163 * 164 * @description 165 * This function set the whole contrle block to a reserved state. 166 * 167 * @param[in] _pMsg Pointer to 128B Request Msg buffer. 168 * 169 * @return 170 * none 171 * 172 *****************************************/ 173 void SalQatMsg_CtrlBlkSetToReserved(icp_qat_fw_comn_req_t *_pMsg); 174 175 /******************************************************************** 176 * @ingroup SalQatMsg_transPutMsg 177 * 178 * @description 179 * 180 * 181 * @param[in] trans_handle 182 * @param[in] pqat_msg 183 * @param[in] size_in_lws 184 * @param[in] service 185 * 186 * @return 187 * CpaStatus 188 * 189 *****************************************/ 190 CpaStatus SalQatMsg_transPutMsg(icp_comms_trans_handle trans_handle, 191 void *pqat_msg, 192 Cpa32U size_in_lws, 193 Cpa8U service); 194 195 /******************************************************************** 196 * @ingroup SalQatMsg_updateQueueTail 197 * 198 * @description 199 * 200 * 201 * @param[in] trans_handle 202 * 203 * 204 * @return 205 * CpaStatus 206 * 207 *****************************************/ 208 void SalQatMsg_updateQueueTail(icp_comms_trans_handle trans_hnd); 209 #endif 210