#include <linux/ctype.h>
#include <linux/firmware.h>
#include "otx_cpt_common.h"
#include "otx_cptpf_ucode.h"
#include "otx_cptpf.h"
#define CSR_DELAY …
#define TAR_MAGIC …
#define TAR_MAGIC_LEN …
#define TAR_BLOCK_LEN …
#define REGTYPE …
#define AREGTYPE …
struct tar_hdr_t { … };
struct tar_blk_t { … };
struct tar_arch_info_t { … };
static struct otx_cpt_bitmap get_cores_bmap(struct device *dev,
struct otx_cpt_eng_grp_info *eng_grp)
{ … }
static int is_eng_type(int val, int eng_type)
{ … }
static int dev_supports_eng_type(struct otx_cpt_eng_grps *eng_grps,
int eng_type)
{ … }
static void set_ucode_filename(struct otx_cpt_ucode *ucode,
const char *filename)
{ … }
static char *get_eng_type_str(int eng_type)
{ … }
static char *get_ucode_type_str(int ucode_type)
{ … }
static int get_ucode_type(struct otx_cpt_ucode_hdr *ucode_hdr, int *ucode_type)
{ … }
static int is_mem_zero(const char *ptr, int size)
{ … }
static int cpt_set_ucode_base(struct otx_cpt_eng_grp_info *eng_grp, void *obj)
{ … }
static int cpt_detach_and_disable_cores(struct otx_cpt_eng_grp_info *eng_grp,
void *obj)
{ … }
static int cpt_attach_and_enable_cores(struct otx_cpt_eng_grp_info *eng_grp,
void *obj)
{ … }
static int process_tar_file(struct device *dev,
struct tar_arch_info_t *tar_arch, char *filename,
const u8 *data, u32 size)
{ … }
static void release_tar_archive(struct tar_arch_info_t *tar_arch)
{ … }
static struct tar_ucode_info_t *get_uc_from_tar_archive(
struct tar_arch_info_t *tar_arch,
int ucode_type)
{ … }
static void print_tar_dbg_info(struct tar_arch_info_t *tar_arch,
char *tar_filename)
{ … }
static struct tar_arch_info_t *load_tar_archive(struct device *dev,
char *tar_filename)
{ … }
static struct otx_cpt_engs_rsvd *find_engines_by_type(
struct otx_cpt_eng_grp_info *eng_grp,
int eng_type)
{ … }
int otx_cpt_uc_supports_eng_type(struct otx_cpt_ucode *ucode, int eng_type)
{ … }
EXPORT_SYMBOL_GPL(…);
int otx_cpt_eng_grp_has_eng_type(struct otx_cpt_eng_grp_info *eng_grp,
int eng_type)
{ … }
EXPORT_SYMBOL_GPL(…);
static void print_ucode_info(struct otx_cpt_eng_grp_info *eng_grp,
char *buf, int size)
{ … }
static void print_engs_info(struct otx_cpt_eng_grp_info *eng_grp,
char *buf, int size, int idx)
{ … }
static void print_ucode_dbg_info(struct otx_cpt_ucode *ucode)
{ … }
static void cpt_print_engines_mask(struct otx_cpt_eng_grp_info *eng_grp,
struct device *dev, char *buf, int size)
{ … }
static void print_dbg_info(struct device *dev,
struct otx_cpt_eng_grps *eng_grps)
{ … }
static int update_engines_avail_count(struct device *dev,
struct otx_cpt_engs_available *avail,
struct otx_cpt_engs_rsvd *engs, int val)
{ … }
static int update_engines_offset(struct device *dev,
struct otx_cpt_engs_available *avail,
struct otx_cpt_engs_rsvd *engs)
{ … }
static int release_engines(struct device *dev, struct otx_cpt_eng_grp_info *grp)
{ … }
static int do_reserve_engines(struct device *dev,
struct otx_cpt_eng_grp_info *grp,
struct otx_cpt_engines *req_engs)
{ … }
static int check_engines_availability(struct device *dev,
struct otx_cpt_eng_grp_info *grp,
struct otx_cpt_engines *req_eng)
{ … }
static int reserve_engines(struct device *dev, struct otx_cpt_eng_grp_info *grp,
struct otx_cpt_engines *req_engs, int req_cnt)
{ … }
static ssize_t eng_grp_info_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static int create_sysfs_eng_grps_info(struct device *dev,
struct otx_cpt_eng_grp_info *eng_grp)
{ … }
static void ucode_unload(struct device *dev, struct otx_cpt_ucode *ucode)
{ … }
static int copy_ucode_to_dma_mem(struct device *dev,
struct otx_cpt_ucode *ucode,
const u8 *ucode_data)
{ … }
static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode,
const char *ucode_filename)
{ … }
static int enable_eng_grp(struct otx_cpt_eng_grp_info *eng_grp,
void *obj)
{ … }
static int disable_eng_grp(struct device *dev,
struct otx_cpt_eng_grp_info *eng_grp,
void *obj)
{ … }
static void setup_eng_grp_mirroring(struct otx_cpt_eng_grp_info *dst_grp,
struct otx_cpt_eng_grp_info *src_grp)
{ … }
static void remove_eng_grp_mirroring(struct otx_cpt_eng_grp_info *dst_grp)
{ … }
static void update_requested_engs(struct otx_cpt_eng_grp_info *mirrored_eng_grp,
struct otx_cpt_engines *engs, int engs_cnt)
{ … }
static struct otx_cpt_eng_grp_info *find_mirrored_eng_grp(
struct otx_cpt_eng_grp_info *grp)
{ … }
static struct otx_cpt_eng_grp_info *find_unused_eng_grp(
struct otx_cpt_eng_grps *eng_grps)
{ … }
static int eng_grp_update_masks(struct device *dev,
struct otx_cpt_eng_grp_info *eng_grp)
{ … }
static int delete_engine_group(struct device *dev,
struct otx_cpt_eng_grp_info *eng_grp)
{ … }
static int validate_1_ucode_scenario(struct device *dev,
struct otx_cpt_eng_grp_info *eng_grp,
struct otx_cpt_engines *engs, int engs_cnt)
{ … }
static void update_ucode_ptrs(struct otx_cpt_eng_grp_info *eng_grp)
{ … }
static int create_engine_group(struct device *dev,
struct otx_cpt_eng_grps *eng_grps,
struct otx_cpt_engines *engs, int engs_cnt,
void *ucode_data[], int ucodes_cnt,
bool use_uc_from_tar_arch)
{ … }
static ssize_t ucode_load_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
int otx_cpt_try_create_default_eng_grps(struct pci_dev *pdev,
struct otx_cpt_eng_grps *eng_grps,
int pf_type)
{ … }
void otx_cpt_set_eng_grps_is_rdonly(struct otx_cpt_eng_grps *eng_grps,
bool is_rdonly)
{ … }
void otx_cpt_disable_all_cores(struct otx_cpt_device *cpt)
{ … }
void otx_cpt_cleanup_eng_grps(struct pci_dev *pdev,
struct otx_cpt_eng_grps *eng_grps)
{ … }
int otx_cpt_init_eng_grps(struct pci_dev *pdev,
struct otx_cpt_eng_grps *eng_grps, int pf_type)
{ … }