#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/pci_ids.h>
#include "adf_accel_devices.h"
#include "adf_common_drv.h"
#include "icp_qat_hal.h"
#include "icp_qat_uclo.h"
#define BAD_REGADDR …
#define MAX_RETRY_TIMES …
#define INIT_CTX_ARB_VALUE …
#define INIT_CTX_ENABLE_VALUE …
#define INIT_PC_VALUE …
#define INIT_WAKEUP_EVENTS_VALUE …
#define INIT_SIG_EVENTS_VALUE …
#define INIT_CCENABLE_VALUE …
#define RST_CSR_QAT_LSB …
#define RST_CSR_AE_LSB …
#define MC_TIMESTAMP_ENABLE …
#define IGNORE_W1C_MASK …
#define INSERT_IMMED_GPRA_CONST(inst, const_val) …
#define INSERT_IMMED_GPRB_CONST(inst, const_val) …
#define AE(handle, ae) …
static const u64 inst_4b[] = …;
static const u64 inst[] = …;
void qat_hal_set_live_ctx(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int ctx_mask)
{ … }
#define CSR_RETRY_TIMES …
static int qat_hal_rd_ae_csr(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int csr)
{ … }
static int qat_hal_wr_ae_csr(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int csr,
unsigned int value)
{ … }
static void qat_hal_get_wakeup_event(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
unsigned int *events)
{ … }
static int qat_hal_wait_cycles(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int cycles,
int chk_inactive)
{ … }
#define CLR_BIT(wrd, bit) …
#define SET_BIT(wrd, bit) …
int qat_hal_set_ae_ctx_mode(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char mode)
{ … }
int qat_hal_set_ae_nn_mode(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char mode)
{ … }
int qat_hal_set_ae_lm_mode(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, enum icp_qat_uof_regtype lm_type,
unsigned char mode)
{ … }
void qat_hal_set_ae_tindex_mode(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char mode)
{ … }
static unsigned short qat_hal_get_reg_addr(unsigned int type,
unsigned short reg_num)
{ … }
void qat_hal_reset(struct icp_qat_fw_loader_handle *handle)
{ … }
static void qat_hal_wr_indr_csr(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int ctx_mask,
unsigned int ae_csr, unsigned int csr_val)
{ … }
static unsigned int qat_hal_rd_indr_csr(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
unsigned int ae_csr)
{ … }
static void qat_hal_put_sig_event(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int ctx_mask,
unsigned int events)
{ … }
static void qat_hal_put_wakeup_event(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int ctx_mask,
unsigned int events)
{ … }
static int qat_hal_check_ae_alive(struct icp_qat_fw_loader_handle *handle)
{ … }
int qat_hal_check_ae_active(struct icp_qat_fw_loader_handle *handle,
unsigned int ae)
{ … }
static void qat_hal_reset_timestamp(struct icp_qat_fw_loader_handle *handle)
{ … }
#define ESRAM_AUTO_TINIT …
#define ESRAM_AUTO_TINIT_DONE …
#define ESRAM_AUTO_INIT_USED_CYCLES …
#define ESRAM_AUTO_INIT_CSR_OFFSET …
static int qat_hal_init_esram(struct icp_qat_fw_loader_handle *handle)
{ … }
#define SHRAM_INIT_CYCLES …
int qat_hal_clr_reset(struct icp_qat_fw_loader_handle *handle)
{ … }
static void qat_hal_disable_ctx(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int ctx_mask)
{ … }
static u64 qat_hal_parity_64bit(u64 word)
{ … }
static u64 qat_hal_set_uword_ecc(u64 uword)
{ … }
void qat_hal_wr_uwords(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int uaddr,
unsigned int words_num, u64 *uword)
{ … }
static void qat_hal_enable_ctx(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int ctx_mask)
{ … }
static void qat_hal_clear_xfer(struct icp_qat_fw_loader_handle *handle)
{ … }
static int qat_hal_clear_gpr(struct icp_qat_fw_loader_handle *handle)
{ … }
static int qat_hal_chip_init(struct icp_qat_fw_loader_handle *handle,
struct adf_accel_dev *accel_dev)
{ … }
int qat_hal_init(struct adf_accel_dev *accel_dev)
{ … }
void qat_hal_deinit(struct icp_qat_fw_loader_handle *handle)
{ … }
int qat_hal_start(struct icp_qat_fw_loader_handle *handle)
{ … }
void qat_hal_stop(struct icp_qat_fw_loader_handle *handle, unsigned char ae,
unsigned int ctx_mask)
{ … }
void qat_hal_set_pc(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int ctx_mask, unsigned int upc)
{ … }
static void qat_hal_get_uwords(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int uaddr,
unsigned int words_num, u64 *uword)
{ … }
void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int uaddr,
unsigned int words_num, unsigned int *data)
{ … }
#define MAX_EXEC_INST …
static int qat_hal_exec_micro_inst(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
u64 *micro_inst, unsigned int inst_num,
int code_off, unsigned int max_cycle,
unsigned int *endpc)
{ … }
static int qat_hal_rd_rel_reg(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
enum icp_qat_uof_regtype reg_type,
unsigned short reg_num, unsigned int *data)
{ … }
static int qat_hal_wr_rel_reg(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
enum icp_qat_uof_regtype reg_type,
unsigned short reg_num, unsigned int data)
{ … }
int qat_hal_get_ins_num(void)
{ … }
static int qat_hal_concat_micro_code(u64 *micro_inst,
unsigned int inst_num, unsigned int size,
unsigned int addr, unsigned int *value)
{ … }
static int qat_hal_exec_micro_init_lm(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
int *pfirst_exec, u64 *micro_inst,
unsigned int inst_num)
{ … }
int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle,
unsigned char ae,
struct icp_qat_uof_batch_init *lm_init_header)
{ … }
static int qat_hal_put_rel_rd_xfer(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
enum icp_qat_uof_regtype reg_type,
unsigned short reg_num, unsigned int val)
{ … }
static int qat_hal_put_rel_wr_xfer(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
enum icp_qat_uof_regtype reg_type,
unsigned short reg_num, unsigned int data)
{ … }
static int qat_hal_put_rel_nn(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx,
unsigned short nn, unsigned int val)
{ … }
static int qat_hal_convert_abs_to_rel(struct icp_qat_fw_loader_handle
*handle, unsigned char ae,
unsigned short absreg_num,
unsigned short *relreg,
unsigned char *ctx)
{ … }
int qat_hal_init_gpr(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned long ctx_mask,
enum icp_qat_uof_regtype reg_type,
unsigned short reg_num, unsigned int regdata)
{ … }
int qat_hal_init_wr_xfer(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned long ctx_mask,
enum icp_qat_uof_regtype reg_type,
unsigned short reg_num, unsigned int regdata)
{ … }
int qat_hal_init_rd_xfer(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned long ctx_mask,
enum icp_qat_uof_regtype reg_type,
unsigned short reg_num, unsigned int regdata)
{ … }
int qat_hal_init_nn(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned long ctx_mask,
unsigned short reg_num, unsigned int regdata)
{ … }