#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/pci_ids.h>
#include "adf_accel_devices.h"
#include "adf_common_drv.h"
#include "icp_qat_uclo.h"
#include "icp_qat_hal.h"
#include "icp_qat_fw_loader_handle.h"
#define UWORD_CPYBUF_SIZE …
#define INVLD_UWORD …
#define PID_MINOR_REV …
#define PID_MAJOR_REV …
static int qat_uclo_init_ae_data(struct icp_qat_uclo_objhandle *obj_handle,
unsigned int ae, unsigned int image_num)
{ … }
static int qat_uclo_free_ae_data(struct icp_qat_uclo_aedata *ae_data)
{ … }
static char *qat_uclo_get_string(struct icp_qat_uof_strtable *str_table,
unsigned int str_offset)
{ … }
static int qat_uclo_check_uof_format(struct icp_qat_uof_filehdr *hdr)
{ … }
static int qat_uclo_check_suof_format(struct icp_qat_suof_filehdr *suof_hdr)
{ … }
static void qat_uclo_wr_sram_by_words(struct icp_qat_fw_loader_handle *handle,
unsigned int addr, unsigned int *val,
unsigned int num_in_bytes)
{ … }
static void qat_uclo_wr_umem_by_words(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int addr,
unsigned int *val,
unsigned int num_in_bytes)
{ … }
static void qat_uclo_batch_wr_umem(struct icp_qat_fw_loader_handle *handle,
unsigned char ae,
struct icp_qat_uof_batch_init
*umem_init_header)
{ … }
static void
qat_uclo_cleanup_batch_init_list(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uof_batch_init **base)
{ … }
static int qat_uclo_parse_num(char *str, unsigned int *num)
{ … }
static int qat_uclo_fetch_initmem_ae(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uof_initmem *init_mem,
unsigned int size_range, unsigned int *ae)
{ … }
static int qat_uclo_create_batch_init_list(struct icp_qat_fw_loader_handle
*handle, struct icp_qat_uof_initmem
*init_mem, unsigned int ae,
struct icp_qat_uof_batch_init
**init_tab_base)
{ … }
static int qat_uclo_init_lmem_seg(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uof_initmem *init_mem)
{ … }
static int qat_uclo_init_umem_seg(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uof_initmem *init_mem)
{ … }
static int qat_uclo_init_ae_memory(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uof_initmem *init_mem)
{ … }
static int qat_uclo_init_ustore(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uclo_encapme *image)
{ … }
static int qat_uclo_init_memory(struct icp_qat_fw_loader_handle *handle)
{ … }
static void *qat_uclo_find_chunk(struct icp_qat_uof_objhdr *obj_hdr,
char *chunk_id, void *cur)
{ … }
static unsigned int qat_uclo_calc_checksum(unsigned int reg, int ch)
{ … }
static unsigned int qat_uclo_calc_str_checksum(char *ptr, int num)
{ … }
static struct icp_qat_uclo_objhdr *
qat_uclo_map_chunk(char *buf, struct icp_qat_uof_filehdr *file_hdr,
char *chunk_id)
{ … }
static int
qat_uclo_check_image_compat(struct icp_qat_uof_encap_obj *encap_uof_obj,
struct icp_qat_uof_image *image)
{ … }
static void qat_uclo_map_image_page(struct icp_qat_uof_encap_obj
*encap_uof_obj,
struct icp_qat_uof_image *img,
struct icp_qat_uclo_encap_page *page)
{ … }
static int qat_uclo_map_uimage(struct icp_qat_uclo_objhandle *obj_handle,
struct icp_qat_uclo_encapme *ae_uimage,
int max_image)
{ … }
static int qat_uclo_map_ae(struct icp_qat_fw_loader_handle *handle, int max_ae)
{ … }
static struct icp_qat_uof_strtable *
qat_uclo_map_str_table(struct icp_qat_uclo_objhdr *obj_hdr,
char *tab_name, struct icp_qat_uof_strtable *str_table)
{ … }
static void
qat_uclo_map_initmem_table(struct icp_qat_uof_encap_obj *encap_uof_obj,
struct icp_qat_uclo_init_mem_table *init_mem_tab)
{ … }
static unsigned int
qat_uclo_get_dev_type(struct icp_qat_fw_loader_handle *handle)
{ … }
static int qat_uclo_check_uof_compat(struct icp_qat_uclo_objhandle *obj_handle)
{ … }
static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned char ctx_mask,
enum icp_qat_uof_regtype reg_type,
unsigned short reg_addr, unsigned int value)
{ … }
static int qat_uclo_init_reg_sym(struct icp_qat_fw_loader_handle *handle,
unsigned int ae,
struct icp_qat_uclo_encapme *encap_ae)
{ … }
static int qat_uclo_init_globals(struct icp_qat_fw_loader_handle *handle)
{ … }
static int qat_hal_set_modes(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uclo_objhandle *obj_handle,
unsigned char ae,
struct icp_qat_uof_image *uof_image)
{ … }
static int qat_uclo_set_ae_mode(struct icp_qat_fw_loader_handle *handle)
{ … }
static void qat_uclo_init_uword_num(struct icp_qat_fw_loader_handle *handle)
{ … }
static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle)
{ … }
static int qat_uclo_map_suof_file_hdr(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_suof_filehdr *suof_ptr,
int suof_size)
{ … }
static void qat_uclo_map_simg(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_suof_img_hdr *suof_img_hdr,
struct icp_qat_suof_chunk_hdr *suof_chunk_hdr)
{ … }
static void
qat_uclo_map_suof_symobjs(struct icp_qat_suof_handle *suof_handle,
struct icp_qat_suof_chunk_hdr *suof_chunk_hdr)
{ … }
static int qat_uclo_check_simg_compat(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_suof_img_hdr *img_hdr)
{ … }
static void qat_uclo_del_suof(struct icp_qat_fw_loader_handle *handle)
{ … }
static void qat_uclo_tail_img(struct icp_qat_suof_img_hdr *suof_img_hdr,
unsigned int img_id, unsigned int num_simgs)
{ … }
static int qat_uclo_map_suof(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_suof_filehdr *suof_ptr,
int suof_size)
{ … }
#define ADD_ADDR(high, low) …
#define BITS_IN_DWORD …
static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_fw_auth_desc *desc)
{ … }
static bool qat_uclo_is_broadcast(struct icp_qat_fw_loader_handle *handle,
int imgid)
{ … }
static int qat_uclo_broadcast_load_fw(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_fw_auth_desc *desc)
{ … }
static int qat_uclo_simg_alloc(struct icp_qat_fw_loader_handle *handle,
struct icp_firml_dram_desc *dram_desc,
unsigned int size)
{ … }
static void qat_uclo_simg_free(struct icp_qat_fw_loader_handle *handle,
struct icp_firml_dram_desc *dram_desc)
{ … }
static void qat_uclo_ummap_auth_fw(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_fw_auth_desc **desc)
{ … }
static int qat_uclo_check_image(struct icp_qat_fw_loader_handle *handle,
char *image, unsigned int size,
unsigned int fw_type)
{ … }
static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
char *image, unsigned int size,
struct icp_qat_fw_auth_desc **desc)
{ … }
static int qat_uclo_load_fw(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_fw_auth_desc *desc)
{ … }
static int qat_uclo_map_suof_obj(struct icp_qat_fw_loader_handle *handle,
void *addr_ptr, int mem_size)
{ … }
int qat_uclo_wr_mimage(struct icp_qat_fw_loader_handle *handle,
void *addr_ptr, int mem_size)
{ … }
static int qat_uclo_map_uof_obj(struct icp_qat_fw_loader_handle *handle,
void *addr_ptr, int mem_size)
{ … }
static int qat_uclo_map_mof_file_hdr(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_mof_file_hdr *mof_ptr,
u32 mof_size)
{ … }
static void qat_uclo_del_mof(struct icp_qat_fw_loader_handle *handle)
{ … }
static int qat_uclo_seek_obj_inside_mof(struct icp_qat_mof_handle *mobj_handle,
const char *obj_name, char **obj_ptr,
unsigned int *obj_size)
{ … }
static int qat_uclo_map_obj_from_mof(struct icp_qat_mof_handle *mobj_handle,
struct icp_qat_mof_objhdr *mobj_hdr,
struct icp_qat_mof_obj_chunkhdr *obj_chunkhdr)
{ … }
static int qat_uclo_map_objs_from_mof(struct icp_qat_mof_handle *mobj_handle)
{ … }
static void qat_uclo_map_mof_symobjs(struct icp_qat_mof_handle *mobj_handle,
struct icp_qat_mof_chunkhdr *mof_chunkhdr)
{ … }
static void qat_uclo_map_mof_chunk(struct icp_qat_mof_handle *mobj_handle,
struct icp_qat_mof_chunkhdr *mof_chunkhdr)
{ … }
static int qat_uclo_check_mof_format(struct icp_qat_mof_file_hdr *mof_hdr)
{ … }
static int qat_uclo_map_mof_obj(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_mof_file_hdr *mof_ptr,
u32 mof_size, const char *obj_name,
char **obj_ptr, unsigned int *obj_size)
{ … }
int qat_uclo_map_obj(struct icp_qat_fw_loader_handle *handle,
void *addr_ptr, u32 mem_size, const char *obj_name)
{ … }
void qat_uclo_del_obj(struct icp_qat_fw_loader_handle *handle)
{ … }
static void qat_uclo_fill_uwords(struct icp_qat_uclo_objhandle *obj_handle,
struct icp_qat_uclo_encap_page *encap_page,
u64 *uword, unsigned int addr_p,
unsigned int raddr, u64 fill)
{ … }
static void qat_uclo_wr_uimage_raw_page(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uclo_encap_page
*encap_page, unsigned int ae)
{ … }
static void qat_uclo_wr_uimage_page(struct icp_qat_fw_loader_handle *handle,
struct icp_qat_uof_image *image)
{ … }
static int qat_uclo_wr_suof_img(struct icp_qat_fw_loader_handle *handle)
{ … }
static int qat_uclo_wr_uof_img(struct icp_qat_fw_loader_handle *handle)
{ … }
int qat_uclo_wr_all_uimage(struct icp_qat_fw_loader_handle *handle)
{ … }
int qat_uclo_set_cfg_ae_mask(struct icp_qat_fw_loader_handle *handle,
unsigned int cfg_ae_mask)
{ … }