linux/drivers/crypto/hisilicon/zip/zip_main.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2019 HiSilicon Limited. */
#include <linux/acpi.h>
#include <linux/bitops.h>
#include <linux/debugfs.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/seq_file.h>
#include <linux/topology.h>
#include <linux/uacce.h>
#include "zip.h"

#define PCI_DEVICE_ID_HUAWEI_ZIP_PF

#define HZIP_QUEUE_NUM_V1

#define HZIP_CLOCK_GATE_CTRL
#define HZIP_DECOMP_CHECK_ENABLE
#define HZIP_FSM_MAX_CNT

#define HZIP_PORT_ARCA_CHE_0
#define HZIP_PORT_ARCA_CHE_1
#define HZIP_PORT_AWCA_CHE_0
#define HZIP_PORT_AWCA_CHE_1
#define HZIP_CACHE_ALL_EN

#define HZIP_BD_RUSER_32_63
#define HZIP_SGL_RUSER_32_63
#define HZIP_DATA_RUSER_32_63
#define HZIP_DATA_WUSER_32_63
#define HZIP_BD_WUSER_32_63

#define HZIP_QM_IDEL_STATUS

#define HZIP_CORE_DFX_BASE
#define HZIP_CORE_DFX_DECOMP_BASE
#define HZIP_CORE_DFX_COMP_0
#define HZIP_CORE_DFX_COMP_1
#define HZIP_CORE_DFX_DECOMP_0
#define HZIP_CORE_DFX_DECOMP_1
#define HZIP_CORE_DFX_DECOMP_2
#define HZIP_CORE_DFX_DECOMP_3
#define HZIP_CORE_DFX_DECOMP_4
#define HZIP_CORE_DFX_DECOMP_5
#define HZIP_CORE_REGS_BASE_LEN
#define HZIP_CORE_REGS_DFX_LEN
#define HZIP_CORE_ADDR_INTRVL

#define HZIP_CORE_INT_SOURCE
#define HZIP_CORE_INT_MASK_REG
#define HZIP_CORE_INT_SET
#define HZIP_CORE_INT_STATUS
#define HZIP_CORE_INT_STATUS_M_ECC
#define HZIP_CORE_SRAM_ECC_ERR_INFO
#define HZIP_CORE_INT_RAS_CE_ENB
#define HZIP_CORE_INT_RAS_NFE_ENB
#define HZIP_CORE_INT_RAS_FE_ENB
#define HZIP_CORE_INT_RAS_FE_ENB_MASK
#define HZIP_OOO_SHUTDOWN_SEL
#define HZIP_SRAM_ECC_ERR_NUM_SHIFT
#define HZIP_SRAM_ECC_ERR_ADDR_SHIFT
#define HZIP_CORE_INT_MASK_ALL
#define HZIP_SQE_SIZE
#define HZIP_PF_DEF_Q_NUM
#define HZIP_PF_DEF_Q_BASE
#define HZIP_CTX_Q_NUM_DEF

#define HZIP_SOFT_CTRL_CNT_CLR_CE
#define HZIP_SOFT_CTRL_CNT_CLR_CE_BIT
#define HZIP_SOFT_CTRL_ZIP_CONTROL
#define HZIP_AXI_SHUTDOWN_ENABLE
#define HZIP_WR_PORT

#define HZIP_ALG_ZLIB_BIT
#define HZIP_ALG_GZIP_BIT
#define HZIP_ALG_DEFLATE_BIT
#define HZIP_ALG_LZ77_BIT

#define HZIP_BUF_SIZE
#define HZIP_SQE_MASK_OFFSET
#define HZIP_SQE_MASK_LEN

#define HZIP_CNT_CLR_CE_EN
#define HZIP_RO_CNT_CLR_CE_EN
#define HZIP_RD_CNT_CLR_CE_EN

#define HZIP_PREFETCH_CFG
#define HZIP_SVA_TRANS
#define HZIP_PREFETCH_ENABLE
#define HZIP_SVA_PREFETCH_DISABLE
#define HZIP_SVA_DISABLE_READY
#define HZIP_SHAPER_RATE_COMPRESS
#define HZIP_SHAPER_RATE_DECOMPRESS
#define HZIP_DELAY_1_US
#define HZIP_POLL_TIMEOUT_US

/* clock gating */
#define HZIP_PEH_CFG_AUTO_GATE
#define HZIP_PEH_CFG_AUTO_GATE_EN
#define HZIP_CORE_GATED_EN
#define HZIP_CORE_GATED_OOO_EN
#define HZIP_CLOCK_GATED_EN

/* zip comp high performance */
#define HZIP_HIGH_PERF_OFFSET

enum {};

static const char hisi_zip_name[] =;
static struct dentry *hzip_debugfs_root;

struct hisi_zip_hw_error {};

struct zip_dfx_item {};

static const struct qm_dev_alg zip_dev_algs[] =;

static struct hisi_qm_list zip_devices =;

static struct zip_dfx_item zip_dfx_files[] =;

static const struct hisi_zip_hw_error zip_hw_error[] =;

enum ctrl_debug_file_index {};

static const char * const ctrl_debug_file_name[] =;

struct ctrl_debug_file {};

/*
 * One ZIP controller has one PF and multiple VFs, some global configurations
 * which PF has need this structure.
 *
 * Just relevant for PF.
 */
struct hisi_zip_ctrl {};

enum zip_cap_type {};

static struct hisi_qm_cap_info zip_basic_cap_info[] =;

enum zip_pre_store_cap_idx {};

static const u32 zip_pre_store_caps[] =;

static const struct debugfs_reg32 hzip_dfx_regs[] =;

static const struct debugfs_reg32 hzip_com_dfx_regs[] =;

static const struct debugfs_reg32 hzip_dump_dfx_regs[] =;

/* define the ZIP's dfx regs region and region length */
static struct dfx_diff_registers hzip_diff_regs[] =;

static int hzip_diff_regs_show(struct seq_file *s, void *unused)
{}
DEFINE_SHOW_ATTRIBUTE();

static int perf_mode_set(const char *val, const struct kernel_param *kp)
{}

static const struct kernel_param_ops zip_com_perf_ops =;

/*
 * perf_mode = 0 means enable high compression rate mode,
 * perf_mode = 1 means enable high compression performance mode.
 * These two modes only apply to the compression direction.
 */
static u32 perf_mode =;
module_param_cb();
MODULE_PARM_DESC();

static const struct kernel_param_ops zip_uacce_mode_ops =;

/*
 * uacce_mode = 0 means zip only register to crypto,
 * uacce_mode = 1 means zip both register to crypto and uacce.
 */
static u32 uacce_mode =;
module_param_cb();
MODULE_PARM_DESC(uacce_mode, UACCE_MODE_DESC);

static bool pf_q_num_flag;
static int pf_q_num_set(const char *val, const struct kernel_param *kp)
{}

static const struct kernel_param_ops pf_q_num_ops =;

static u32 pf_q_num =;
module_param_cb();
MODULE_PARM_DESC();

static const struct kernel_param_ops vfs_num_ops =;

static u32 vfs_num;
module_param_cb();
MODULE_PARM_DESC();

static const struct pci_device_id hisi_zip_dev_ids[] =;
MODULE_DEVICE_TABLE(pci, hisi_zip_dev_ids);

int zip_create_qps(struct hisi_qp **qps, int qp_num, int node)
{}

bool hisi_zip_alg_support(struct hisi_qm *qm, u32 alg)
{}

static int hisi_zip_set_high_perf(struct hisi_qm *qm)
{}

static void hisi_zip_open_sva_prefetch(struct hisi_qm *qm)
{}

static void hisi_zip_close_sva_prefetch(struct hisi_qm *qm)
{}

static void hisi_zip_enable_clock_gate(struct hisi_qm *qm)
{}

static int hisi_zip_set_user_domain_and_cache(struct hisi_qm *qm)
{}

static void hisi_zip_master_ooo_ctrl(struct hisi_qm *qm, bool enable)
{}

static void hisi_zip_hw_error_enable(struct hisi_qm *qm)
{}

static void hisi_zip_hw_error_disable(struct hisi_qm *qm)
{}

static inline struct hisi_qm *file_to_qm(struct ctrl_debug_file *file)
{}

static u32 clear_enable_read(struct hisi_qm *qm)
{}

static int clear_enable_write(struct hisi_qm *qm, u32 val)
{}

static ssize_t hisi_zip_ctrl_debug_read(struct file *filp, char __user *buf,
					size_t count, loff_t *pos)
{}

static ssize_t hisi_zip_ctrl_debug_write(struct file *filp,
					 const char __user *buf,
					 size_t count, loff_t *pos)
{}

static const struct file_operations ctrl_debug_fops =;

static int zip_debugfs_atomic64_set(void *data, u64 val)
{}

static int zip_debugfs_atomic64_get(void *data, u64 *val)
{}

DEFINE_DEBUGFS_ATTRIBUTE();

static int hisi_zip_regs_show(struct seq_file *s, void *unused)
{}

DEFINE_SHOW_ATTRIBUTE();

static void __iomem *get_zip_core_addr(struct hisi_qm *qm, int core_num)
{}

static int hisi_zip_core_debug_init(struct hisi_qm *qm)
{}

static void hisi_zip_dfx_debug_init(struct hisi_qm *qm)
{}

static int hisi_zip_ctrl_debug_init(struct hisi_qm *qm)
{}

static int hisi_zip_debugfs_init(struct hisi_qm *qm)
{}

/* hisi_zip_debug_regs_clear() - clear the zip debug regs */
static void hisi_zip_debug_regs_clear(struct hisi_qm *qm)
{}

static void hisi_zip_debugfs_exit(struct hisi_qm *qm)
{}

static int hisi_zip_show_last_regs_init(struct hisi_qm *qm)
{}

static void hisi_zip_show_last_regs_uninit(struct hisi_qm *qm)
{}

static void hisi_zip_show_last_dfx_regs(struct hisi_qm *qm)
{}

static void hisi_zip_log_hw_error(struct hisi_qm *qm, u32 err_sts)
{}

static u32 hisi_zip_get_hw_err_status(struct hisi_qm *qm)
{}

static void hisi_zip_clear_hw_err_status(struct hisi_qm *qm, u32 err_sts)
{}

static void hisi_zip_open_axi_master_ooo(struct hisi_qm *qm)
{}

static void hisi_zip_close_axi_master_ooo(struct hisi_qm *qm)
{}

static void hisi_zip_err_info_init(struct hisi_qm *qm)
{}

static const struct hisi_qm_err_ini hisi_zip_err_ini =;

static int hisi_zip_pf_probe_init(struct hisi_zip *hisi_zip)
{}

static int zip_pre_store_cap_reg(struct hisi_qm *qm)
{}

static int hisi_zip_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
{}

static void hisi_zip_qm_uninit(struct hisi_qm *qm)
{}

static int hisi_zip_probe_init(struct hisi_zip *hisi_zip)
{}

static int hisi_zip_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static void hisi_zip_remove(struct pci_dev *pdev)
{}

static const struct dev_pm_ops hisi_zip_pm_ops =;

static const struct pci_error_handlers hisi_zip_err_handler =;

static struct pci_driver hisi_zip_pci_driver =;

struct pci_driver *hisi_zip_get_pf_driver(void)
{}
EXPORT_SYMBOL_GPL();

static void hisi_zip_register_debugfs(void)
{}

static void hisi_zip_unregister_debugfs(void)
{}

static int __init hisi_zip_init(void)
{}

static void __exit hisi_zip_exit(void)
{}

module_init();
module_exit(hisi_zip_exit);

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();