未验证 提交 6a895a1b 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!685 [sync] PR-675: driver/hifc&hinic: Fix compile error in allyesconfigs

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/675 
 
When using allyesconfig to configure the kernel, errors may occur during the linking process when making. 
 
Link:https://gitee.com/openeuler/kernel/pulls/685 

Reviewed-by: Chiqijun <chiqijun@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
......@@ -48,7 +48,7 @@ MODULE_PARM_DESC(g_rdma_mpts_num, "number of roce used mpts, use default value w
module_param(g_vfs_num, uint, 0444);
MODULE_PARM_DESC(g_vfs_num, "number of used vfs, use default value when pass 0 ");
uint intr_mode;
static uint intr_mode;
uint timer_enable = 1;
uint bloomfilter_enable;
......@@ -1461,7 +1461,7 @@ static void cfg_mbx_cleanup(struct hinic_hwdev *dev)
hinic_unregister_vf_mbox_cb(dev, HINIC_MOD_CFGM);
}
int init_cfg_mgmt(struct hinic_hwdev *dev)
static int init_cfg_mgmt(struct hinic_hwdev *dev)
{
int err;
struct cfg_mgmt_info *cfg_mgmt;
......@@ -1509,7 +1509,7 @@ int init_cfg_mgmt(struct hinic_hwdev *dev)
return err;
}
void free_cfg_mgmt(struct hinic_hwdev *dev)
static void free_cfg_mgmt(struct hinic_hwdev *dev)
{
struct cfg_mgmt_info *cfg_mgmt = dev->cfg_mgmt;
......@@ -1542,7 +1542,7 @@ void free_cfg_mgmt(struct hinic_hwdev *dev)
kfree(cfg_mgmt);
}
int init_capability(struct hinic_hwdev *dev)
static int init_capability(struct hinic_hwdev *dev)
{
struct cfg_mgmt_info *cfg_mgmt = dev->cfg_mgmt;
int err;
......@@ -1571,7 +1571,7 @@ int init_capability(struct hinic_hwdev *dev)
return 0;
}
void free_capability(struct hinic_hwdev *dev)
static void free_capability(struct hinic_hwdev *dev)
{
cfg_mbx_cleanup(dev);
sdk_info(dev->dev_hdl, "Free capability success");
......
......@@ -49,12 +49,12 @@ struct ffm_intr_info {
#define DBGTOOL_MSG_MAX_SIZE 2048ULL
#define HINIC_SELF_CMD_UP2PF_FFM 0x26
void *g_card_node_array[MAX_CARD_NUM] = {0};
void *g_card_vir_addr[MAX_CARD_NUM] = {0};
u64 g_card_phy_addr[MAX_CARD_NUM] = {0};
/* lock for g_card_vir_addr */
struct mutex g_addr_lock;
int card_id;
void *g_hinic_card_node_array[MAX_CARD_NUM] = {0};
void *g_hinic_card_vir_addr[MAX_CARD_NUM] = {0};
u64 g_hinic_card_phy_addr[MAX_CARD_NUM] = {0};
/* lock for g_hinic_card_vir_addr */
struct mutex g_hinic_addr_lock;
int g_hinic_card_id;
/* dbgtool character device name, class name, dev path */
#define CHR_DEV_DBGTOOL "dbgtool_chr_dev"
......@@ -66,15 +66,15 @@ struct dbgtool_k_glb_info {
struct ffm_record_info *ffm;
};
dev_t dbgtool_dev_id; /* device id */
struct cdev dbgtool_chr_dev; /* struct of char device */
static dev_t dbgtool_dev_id; /* device id */
static struct cdev dbgtool_chr_dev; /* struct of char device */
/*lint -save -e104 -e808*/
struct class *dbgtool_d_class; /* struct of char class */
static struct class *dbgtool_d_class; /* struct of char class */
/*lint -restore*/
int g_dbgtool_init_flag;
int g_dbgtool_ref_cnt;
static int g_dbgtool_init_flag;
static int g_dbgtool_ref_cnt;
static int dbgtool_knl_open(struct inode *pnode,
struct file *pfile)
......@@ -109,7 +109,7 @@ static bool is_valid_phy_addr(u64 offset)
int i;
for (i = 0; i < MAX_CARD_NUM; i++) {
if (offset == g_card_phy_addr[i])
if (offset == g_hinic_card_phy_addr[i])
return true;
}
......@@ -134,9 +134,9 @@ int hinic_mem_mmap(struct file *filp, struct vm_area_struct *vma)
}
/* old version of tool set vma->vm_pgoff to 0 */
phy_addr = offset ? offset : g_card_phy_addr[card_id];
phy_addr = offset ? offset : g_hinic_card_phy_addr[g_hinic_card_id];
if (!phy_addr) {
pr_err("Card_id = %d physical address is 0\n", card_id);
pr_err("Card_id = %d physical address is 0\n", g_hinic_card_id);
return -EAGAIN;
}
......@@ -154,8 +154,8 @@ int hinic_mem_mmap(struct file *filp, struct vm_area_struct *vma)
* @g_func_handle_array: global function handle
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_api_cmd_read(struct dbgtool_param *para,
void **g_func_handle_array)
static long dbgtool_knl_api_cmd_read(struct dbgtool_param *para,
void **g_func_handle_array)
{
long ret = 0;
u8 *cmd;
......@@ -237,8 +237,8 @@ long dbgtool_knl_api_cmd_read(struct dbgtool_param *para,
* @g_func_handle_array: global function handle
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_api_cmd_write(struct dbgtool_param *para,
void **g_func_handle_array)
static long dbgtool_knl_api_cmd_write(struct dbgtool_param *para,
void **g_func_handle_array)
{
long ret = 0;
u8 *cmd;
......@@ -289,8 +289,8 @@ long dbgtool_knl_api_cmd_write(struct dbgtool_param *para,
return ret;
}
void chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_idx,
void **g_func_handle_array)
void hinic_chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_idx,
void **g_func_handle_array)
{
u32 func_idx;
struct hinic_hwdev *hwdev;
......@@ -304,7 +304,7 @@ void chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_idx,
for (func_idx = 0; func_idx < 16; func_idx++) {
hwdev = (struct hinic_hwdev *)g_func_handle_array[func_idx];
dev_info[func_idx].phy_addr = g_card_phy_addr[card_idx];
dev_info[func_idx].phy_addr = g_hinic_card_phy_addr[card_idx];
if (!hwdev) {
dev_info[func_idx].bar0_size = 0;
......@@ -334,47 +334,47 @@ void chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_idx,
* @g_func_handle_array: global function handle
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_pf_dev_info_get(struct dbgtool_param *para,
void **g_func_handle_array)
static long dbgtool_knl_pf_dev_info_get(struct dbgtool_param *para,
void **g_func_handle_array)
{
struct pf_dev_info dev_info[16] = { {0} };
unsigned char *tmp;
int i;
mutex_lock(&g_addr_lock);
if (!g_card_vir_addr[card_id]) {
g_card_vir_addr[card_id] =
mutex_lock(&g_hinic_addr_lock);
if (!g_hinic_card_vir_addr[g_hinic_card_id]) {
g_hinic_card_vir_addr[g_hinic_card_id] =
(void *)__get_free_pages(GFP_KERNEL,
DBGTOOL_PAGE_ORDER);
if (!g_card_vir_addr[card_id]) {
if (!g_hinic_card_vir_addr[g_hinic_card_id]) {
pr_err("Alloc dbgtool api chain fail!\n");
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hinic_addr_lock);
return -EFAULT;
}
memset(g_card_vir_addr[card_id], 0,
memset(g_hinic_card_vir_addr[g_hinic_card_id], 0,
PAGE_SIZE * (1 << DBGTOOL_PAGE_ORDER));
g_card_phy_addr[card_id] =
virt_to_phys(g_card_vir_addr[card_id]);
if (!g_card_phy_addr[card_id]) {
pr_err("phy addr for card %d is 0\n", card_id);
free_pages((unsigned long)g_card_vir_addr[card_id],
g_hinic_card_phy_addr[g_hinic_card_id] =
virt_to_phys(g_hinic_card_vir_addr[g_hinic_card_id]);
if (!g_hinic_card_phy_addr[g_hinic_card_id]) {
pr_err("phy addr for card %d is 0\n", g_hinic_card_id);
free_pages((unsigned long)g_hinic_card_vir_addr[g_hinic_card_id],
DBGTOOL_PAGE_ORDER);
g_card_vir_addr[card_id] = NULL;
mutex_unlock(&g_addr_lock);
g_hinic_card_vir_addr[g_hinic_card_id] = NULL;
mutex_unlock(&g_hinic_addr_lock);
return -EFAULT;
}
tmp = g_card_vir_addr[card_id];
tmp = g_hinic_card_vir_addr[g_hinic_card_id];
for (i = 0; i < (1 << DBGTOOL_PAGE_ORDER); i++) {
SetPageReserved(virt_to_page(tmp));
tmp += PAGE_SIZE;
}
}
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hinic_addr_lock);
chipif_get_all_pf_dev_info(dev_info, card_id, g_func_handle_array);
hinic_chipif_get_all_pf_dev_info(dev_info, g_hinic_card_id, g_func_handle_array);
/* Copy the dev_info to user mode */
if (copy_to_user(para->param.dev_info, dev_info,
......@@ -392,8 +392,8 @@ long dbgtool_knl_pf_dev_info_get(struct dbgtool_param *para,
* @dbgtool_info: the dbgtool info
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_ffm_info_rd(struct dbgtool_param *para,
struct dbgtool_k_glb_info *dbgtool_info)
static long dbgtool_knl_ffm_info_rd(struct dbgtool_param *para,
struct dbgtool_k_glb_info *dbgtool_info)
{
/* Copy the ffm_info to user mode */
if (copy_to_user(para->param.ffm_rd, dbgtool_info->ffm,
......@@ -410,8 +410,8 @@ long dbgtool_knl_ffm_info_rd(struct dbgtool_param *para,
* @para: unused
* @dbgtool_info: the dbgtool info
*/
void dbgtool_knl_ffm_info_clr(struct dbgtool_param *para,
struct dbgtool_k_glb_info *dbgtool_info)
static void dbgtool_knl_ffm_info_clr(struct dbgtool_param *para,
struct dbgtool_k_glb_info *dbgtool_info)
{
dbgtool_info->ffm->ffm_num = 0;
}
......@@ -422,8 +422,8 @@ void dbgtool_knl_ffm_info_clr(struct dbgtool_param *para,
* @g_func_handle_array: global function handle
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_msg_to_up(struct dbgtool_param *para,
void **g_func_handle_array)
static long dbgtool_knl_msg_to_up(struct dbgtool_param *para,
void **g_func_handle_array)
{
long ret = 0;
void *buf_in;
......@@ -506,29 +506,29 @@ long dbgtool_knl_msg_to_up(struct dbgtool_param *para,
return ret;
}
long dbgtool_knl_free_mem(int id)
long hinic_dbgtool_knl_free_mem(int id)
{
unsigned char *tmp;
int i;
mutex_lock(&g_addr_lock);
mutex_lock(&g_hinic_addr_lock);
if (!g_card_vir_addr[id]) {
mutex_unlock(&g_addr_lock);
if (!g_hinic_card_vir_addr[id]) {
mutex_unlock(&g_hinic_addr_lock);
return 0;
}
tmp = g_card_vir_addr[id];
tmp = g_hinic_card_vir_addr[id];
for (i = 0; i < (1 << DBGTOOL_PAGE_ORDER); i++) {
ClearPageReserved(virt_to_page(tmp));
tmp += PAGE_SIZE;
}
free_pages((unsigned long)g_card_vir_addr[id], DBGTOOL_PAGE_ORDER);
g_card_vir_addr[id] = NULL;
g_card_phy_addr[id] = 0;
free_pages((unsigned long)g_hinic_card_vir_addr[id], DBGTOOL_PAGE_ORDER);
g_hinic_card_vir_addr[id] = NULL;
g_hinic_card_phy_addr[id] = 0;
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hinic_addr_lock);
return 0;
}
......@@ -540,9 +540,9 @@ long dbgtool_knl_free_mem(int id)
* @pfile: the pointer to file
* @cmd: the command type
*/
long dbgtool_knl_unlocked_ioctl(struct file *pfile,
unsigned int cmd,
unsigned long arg)
static long dbgtool_knl_unlocked_ioctl(struct file *pfile,
unsigned int cmd,
unsigned long arg)
{
long ret = 0;
unsigned int real_cmd;
......@@ -560,7 +560,7 @@ long dbgtool_knl_unlocked_ioctl(struct file *pfile,
param.chip_name[IFNAMSIZ - 1] = '\0';
for (i = 0; i < MAX_CARD_NUM; i++) {
card_info = (struct card_node *)g_card_node_array[i];
card_info = (struct card_node *)g_hinic_card_node_array[i];
if (!card_info)
continue;
if (!strncmp(param.chip_name, card_info->chip_name, IFNAMSIZ))
......@@ -572,7 +572,7 @@ long dbgtool_knl_unlocked_ioctl(struct file *pfile,
return -EFAULT;
}
card_id = i;
g_hinic_card_id = i;
dbgtool_info = (struct dbgtool_k_glb_info *)card_info->dbgtool_info;
......@@ -604,7 +604,7 @@ long dbgtool_knl_unlocked_ioctl(struct file *pfile,
card_info->func_handle_array);
break;
case DBGTOOL_CMD_FREE_MEM:
ret = dbgtool_knl_free_mem(i);
ret = hinic_dbgtool_knl_free_mem(i);
break;
default:
pr_err("Dbgtool cmd(x%x) not support now\n", real_cmd);
......@@ -621,8 +621,8 @@ long dbgtool_knl_unlocked_ioctl(struct file *pfile,
* @buf_in: the pointer to input buffer
* @buf_out: the pointer to outputput buffer
*/
void ffm_intr_msg_record(void *handle, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
static void ffm_intr_msg_record(void *handle, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
struct dbgtool_k_glb_info *dbgtool_info;
struct ffm_intr_info *intr;
......@@ -634,7 +634,7 @@ void ffm_intr_msg_record(void *handle, void *buf_in, u16 in_size,
int i, j;
for (i = 0; i < MAX_CARD_NUM; i++) {
card_info = (struct card_node *)g_card_node_array[i];
card_info = (struct card_node *)g_hinic_card_node_array[i];
if (!card_info)
continue;
......@@ -709,12 +709,12 @@ static const struct file_operations dbgtool_file_operations = {
};
/**
* dbgtool_knl_init - dbgtool character device init
* hinic_dbgtool_knl_init - dbgtool character device init
* @hwdev: the pointer to hardware device
* @chip_node: the pointer to card node
* Return: 0 - success, negative - failure
*/
int dbgtool_knl_init(void *vhwdev, void *chip_node)
int hinic_dbgtool_knl_init(void *vhwdev, void *chip_node)
{
int ret = 0;
int id;
......@@ -770,7 +770,7 @@ int dbgtool_knl_init(void *vhwdev, void *chip_node)
goto sscanf_chdev_fail;
}
g_card_node_array[id] = chip_info;
g_hinic_card_node_array[id] = chip_info;
chip_info->func_num++;
if (g_dbgtool_init_flag) {
......@@ -817,7 +817,7 @@ int dbgtool_knl_init(void *vhwdev, void *chip_node)
}
g_dbgtool_init_flag = 1;
g_dbgtool_ref_cnt = 1;
mutex_init(&g_addr_lock);
mutex_init(&g_hinic_addr_lock);
return 0;
......@@ -828,7 +828,7 @@ int dbgtool_knl_init(void *vhwdev, void *chip_node)
cdev_add_fail:
unregister_chrdev_region(dbgtool_dev_id, 1);
alloc_chdev_fail:
g_card_node_array[id] = NULL;
g_hinic_card_node_array[id] = NULL;
sscanf_chdev_fail:
kfree(dbgtool_info->ffm);
dbgtool_info_ffm_fail:
......@@ -844,11 +844,11 @@ int dbgtool_knl_init(void *vhwdev, void *chip_node)
}
/**
* dbgtool_knl_deinit - dbgtool character device deinit
* hinic_dbgtool_knl_deinit - dbgtool character device deinit
* @hwdev: the pointer to hardware device
* @chip_node: the pointer to card node
*/
void dbgtool_knl_deinit(void *vhwdev, void *chip_node)
void hinic_dbgtool_knl_deinit(void *vhwdev, void *chip_node)
{
struct dbgtool_k_glb_info *dbgtool_info;
struct card_node *chip_info = (struct card_node *)chip_node;
......@@ -874,7 +874,7 @@ void dbgtool_knl_deinit(void *vhwdev, void *chip_node)
if (err <= 0)
pr_err("Failed to get hinic id\n");
g_card_node_array[id] = NULL;
g_hinic_card_node_array[id] = NULL;
dbgtool_info = chip_info->dbgtool_info;
/* FFM deinit */
......@@ -884,7 +884,7 @@ void dbgtool_knl_deinit(void *vhwdev, void *chip_node)
kfree(dbgtool_info);
chip_info->dbgtool_info = NULL;
(void)dbgtool_knl_free_mem(id);
(void)hinic_dbgtool_knl_free_mem(id);
if (g_dbgtool_init_flag) {
if ((--g_dbgtool_ref_cnt))
......
......@@ -110,11 +110,11 @@ struct dbgtool_param {
#define MAX_CARD_NUM 64
#define DBGTOOL_PAGE_ORDER 10
int dbgtool_knl_init(void *vhwdev, void *chip_node);
void dbgtool_knl_deinit(void *vhwdev, void *chip_node);
int hinic_dbgtool_knl_init(void *vhwdev, void *chip_node);
void hinic_dbgtool_knl_deinit(void *vhwdev, void *chip_node);
int hinic_mem_mmap(struct file *filp, struct vm_area_struct *vma);
void chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_id,
void **g_func_handle_array);
long dbgtool_knl_free_mem(int id);
void hinic_chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_id,
void **g_func_handle_array);
long hinic_dbgtool_knl_free_mem(int id);
#endif
......@@ -610,7 +610,7 @@ struct hinic_mgmt_status_log {
const char *log;
};
struct hinic_mgmt_status_log mgmt_status_log[] = {
static struct hinic_mgmt_status_log mgmt_status_log[] = {
{HINIC_MGMT_STATUS_ERR_PARAM, "Invalid parameter"},
{HINIC_MGMT_STATUS_ERR_FAILED, "Operation failed"},
{HINIC_MGMT_STATUS_ERR_PORT, "Invalid port"},
......@@ -2700,8 +2700,8 @@ int hinic_func_tmr_bitmap_set(void *hwdev, bool en)
}
EXPORT_SYMBOL(hinic_func_tmr_bitmap_set);
int ppf_ht_gpa_set(struct hinic_hwdev *hwdev, struct hinic_page_addr *pg0,
struct hinic_page_addr *pg1)
static int ppf_ht_gpa_set(struct hinic_hwdev *hwdev, struct hinic_page_addr *pg0,
struct hinic_page_addr *pg1)
{
struct comm_info_ht_gpa_set ht_gpa_set = {0};
u16 out_size = sizeof(ht_gpa_set);
......@@ -3903,9 +3903,9 @@ static void hinic_mctp_get_host_info_event_handler(struct hinic_hwdev *hwdev,
mctp_out->actual_len = host_info->data_len;
}
char *__hw_to_char_fec[HILINK_FEC_MAX_TYPE] = {"RS-FEC", "BASE-FEC", "NO-FEC"};
static char *__hw_to_char_fec[HILINK_FEC_MAX_TYPE] = {"RS-FEC", "BASE-FEC", "NO-FEC"};
char *__hw_to_char_port_type[LINK_PORT_MAX_TYPE] = {
static char *__hw_to_char_port_type[LINK_PORT_MAX_TYPE] = {
"Unknown", "Fibre", "Electric", "Direct Attach Copper", "AOC",
"Back plane", "BaseT"
};
......@@ -4067,9 +4067,9 @@ static char *hilink_info_report_type[HILINK_EVENT_MAX_TYPE] = {
"", "link up", "link down", "cable plugged"
};
void print_hilink_info(struct hinic_hwdev *hwdev,
enum hilink_info_print_event type,
struct hinic_link_info *info)
static void print_hilink_info(struct hinic_hwdev *hwdev,
enum hilink_info_print_event type,
struct hinic_link_info *info)
{
__print_cable_info(hwdev, info);
......@@ -4318,37 +4318,37 @@ static void pf_hilink_event_handler(void *hwdev, void *pri_handle, u8 cmd,
}
/* pf fault report event */
void pf_fault_event_handler(void *hwdev,
void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
static void pf_fault_event_handler(void *hwdev,
void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HINIC_EVENT_MGMT_FAULT, buf_in,
in_size, buf_out, out_size);
}
void mgmt_watchdog_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
static void mgmt_watchdog_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HINIC_EVENT_MGMT_WATCHDOG, buf_in,
in_size, buf_out, out_size);
}
void mgmt_fmw_act_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
static void mgmt_fmw_act_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HINIC_EVENT_MGMT_FMW_ACT_NTC, buf_in,
in_size, buf_out, out_size);
}
void mgmt_pcie_dfx_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
static void mgmt_pcie_dfx_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HINIC_EVENT_MGMT_PCIE_DFX, buf_in,
in_size, buf_out, out_size);
}
void mgmt_get_mctp_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
static void mgmt_get_mctp_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HINIC_EVENT_MCTP_HOST_INFO, buf_in,
in_size, buf_out, out_size);
......
......@@ -146,7 +146,7 @@ struct hinic_lld_lock {
atomic_t dev_ref_cnt;
};
struct hinic_lld_lock g_lld_lock;
static struct hinic_lld_lock g_lld_lock;
#define WAIT_LLD_DEV_HOLD_TIMEOUT (10 * 60 * 1000) /* 10minutes */
#define WAIT_LLD_DEV_NODE_CHANGED (10 * 60 * 1000) /* 10minutes */
......@@ -1383,7 +1383,7 @@ int hinic_get_pf_id(void *hwdev, u32 port_id, u32 *pf_id, u32 *isvalid)
return 0;
}
void get_fc_devname(char *devname)
void hinic_get_fc_devname(char *devname)
{
struct card_node *chip_node;
struct hinic_pcidev *dev;
......@@ -2441,7 +2441,7 @@ static int hinic_func_init(struct pci_dev *pdev,
/* dbgtool init */
lld_lock_chip_node();
err = dbgtool_knl_init(pci_adapter->hwdev, pci_adapter->chip_node);
err = hinic_dbgtool_knl_init(pci_adapter->hwdev, pci_adapter->chip_node);
if (err) {
lld_unlock_chip_node();
sdk_err(&pdev->dev, "Failed to initialize dbgtool\n");
......@@ -2500,7 +2500,7 @@ static void hinic_func_deinit(struct pci_dev *pdev)
if (pci_adapter->init_state >= HINIC_INIT_STATE_DBGTOOL_INITED) {
lld_lock_chip_node();
dbgtool_knl_deinit(pci_adapter->hwdev, pci_adapter->chip_node);
hinic_dbgtool_knl_deinit(pci_adapter->hwdev, pci_adapter->chip_node);
lld_unlock_chip_node();
hinic_destroy_syncfw_timer(pci_adapter);
hinic_event_unregister(pci_adapter->hwdev);
......@@ -2603,7 +2603,7 @@ static void hinic_remove(struct pci_dev *pdev)
lld_lock_chip_node();
if (pci_adapter->init_state < HINIC_INIT_STATE_HW_IF_INITED)
list_del(&pci_adapter->node);
nictool_k_uninit();
hinic_tool_k_uninit();
free_chip_node(pci_adapter);
lld_unlock_chip_node();
unmapping_bar(pci_adapter);
......@@ -2720,7 +2720,7 @@ static int hinic_probe(struct pci_dev *pdev, const struct pci_device_id *id)
sscanf(pci_adapter->chip_node->chip_name, HINIC_CHIP_NAME "%d",
&pci_adapter->card_id);
err = nictool_k_init();
err = hinic_tool_k_init();
if (err) {
sdk_warn(&pdev->dev, "Failed to init nictool");
goto init_nictool_err;
......
......@@ -86,7 +86,7 @@ int hinic_get_chip_cos_up_map(struct pci_dev *pdev, bool *is_setted,
void hinic_get_all_chip_id(void *card_id);
void hinic_get_card_info(void *hwdev, void *bufin);
int hinic_get_device_id(void *hwdev, u16 *dev_id);
void get_fc_devname(char *devname);
void hinic_get_fc_devname(char *devname);
int hinic_get_pf_id(void *hwdev, u32 port_id, u32 *pf_id, u32 *isvalid);
void hinic_tool_cnt_inc(void);
......
......@@ -1306,40 +1306,40 @@ static int __get_card_usr_api_chain_mem(int card_idx)
unsigned char *tmp;
int i;
mutex_lock(&g_addr_lock);
card_id = card_idx;
if (!g_card_vir_addr[card_idx]) {
g_card_vir_addr[card_idx] =
mutex_lock(&g_hinic_addr_lock);
g_hinic_card_id = card_idx;
if (!g_hinic_card_vir_addr[card_idx]) {
g_hinic_card_vir_addr[card_idx] =
(void *)__get_free_pages(GFP_KERNEL,
DBGTOOL_PAGE_ORDER);
if (!g_card_vir_addr[card_idx]) {
if (!g_hinic_card_vir_addr[card_idx]) {
pr_err("Alloc api chain memory fail for card %d\n",
card_idx);
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hinic_addr_lock);
return -EFAULT;
}
memset(g_card_vir_addr[card_idx], 0,
memset(g_hinic_card_vir_addr[card_idx], 0,
PAGE_SIZE * (1 << DBGTOOL_PAGE_ORDER));
g_card_phy_addr[card_idx] =
virt_to_phys(g_card_vir_addr[card_idx]);
if (!g_card_phy_addr[card_idx]) {
g_hinic_card_phy_addr[card_idx] =
virt_to_phys(g_hinic_card_vir_addr[card_idx]);
if (!g_hinic_card_phy_addr[card_idx]) {
pr_err("phy addr for card %d is 0\n", card_idx);
free_pages((unsigned long)g_card_vir_addr[card_idx],
free_pages((unsigned long)g_hinic_card_vir_addr[card_idx],
DBGTOOL_PAGE_ORDER);
g_card_vir_addr[card_idx] = NULL;
mutex_unlock(&g_addr_lock);
g_hinic_card_vir_addr[card_idx] = NULL;
mutex_unlock(&g_hinic_addr_lock);
return -EFAULT;
}
tmp = g_card_vir_addr[card_idx];
tmp = g_hinic_card_vir_addr[card_idx];
for (i = 0; i < (1 << DBGTOOL_PAGE_ORDER); i++) {
SetPageReserved(virt_to_page(tmp));
tmp += PAGE_SIZE;
}
}
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hinic_addr_lock);
return 0;
}
......@@ -1360,7 +1360,7 @@ static int get_pf_dev_info(char *dev_name, struct msg_module *nt_msg)
}
for (i = 0; i < MAX_CARD_NUM; i++) {
card_info = (struct card_node *)g_card_node_array[i];
card_info = (struct card_node *)g_hinic_card_node_array[i];
if (!card_info)
continue;
if (!strncmp(dev_name, card_info->chip_name, IFNAMSIZ))
......@@ -1379,8 +1379,8 @@ static int get_pf_dev_info(char *dev_name, struct msg_module *nt_msg)
return -EFAULT;
}
chipif_get_all_pf_dev_info(dev_info, i,
card_info->func_handle_array);
hinic_chipif_get_all_pf_dev_info(dev_info, i,
card_info->func_handle_array);
/* Copy the dev_info to user mode */
if (copy_to_user(nt_msg->out_buf, dev_info, sizeof(dev_info))) {
......@@ -1397,7 +1397,7 @@ static int knl_free_mem(char *dev_name, struct msg_module *nt_msg)
int i;
for (i = 0; i < MAX_CARD_NUM; i++) {
card_info = (struct card_node *)g_card_node_array[i];
card_info = (struct card_node *)g_hinic_card_node_array[i];
if (!card_info)
continue;
if (!strncmp(dev_name, card_info->chip_name, IFNAMSIZ))
......@@ -1409,7 +1409,7 @@ static int knl_free_mem(char *dev_name, struct msg_module *nt_msg)
return -EFAULT;
}
dbgtool_knl_free_mem(i);
hinic_dbgtool_knl_free_mem(i);
return 0;
}
......@@ -1462,7 +1462,7 @@ static int get_card_func_info(char *dev_name, struct msg_module *nt_msg)
return -EFAULT;
}
card_func_info.usr_api_phy_addr = g_card_phy_addr[id];
card_func_info.usr_api_phy_addr = g_hinic_card_phy_addr[id];
/* Copy the dev_info to user mode */
if (copy_to_user(nt_msg->out_buf, &card_func_info,
......@@ -1883,7 +1883,7 @@ struct sm_module_handle {
sm_module sm_func;
};
struct sm_module_handle sm_module_cmd_handle[] = {
static struct sm_module_handle sm_module_cmd_handle[] = {
{SM_CTR_RD32, sm_rd32},
{SM_CTR_RD64_PAIR, sm_rd64_pair},
{SM_CTR_RD64, sm_rd64}
......@@ -2160,8 +2160,8 @@ static int get_service_drv_version(void *hwdev, struct msg_module *nt_msg,
return ret;
}
int send_to_service_driver(struct msg_module *nt_msg, void *buf_in,
u32 in_size, void *buf_out, u32 *out_size)
static int send_to_service_driver(struct msg_module *nt_msg, void *buf_in,
u32 in_size, void *buf_out, u32 *out_size)
{
enum hinic_service_type type;
void *uld_dev;
......@@ -2311,7 +2311,7 @@ static long nictool_k_unlocked_ioctl(struct file *pfile,
if (cmd_raw == HINICADM_FC_DRIVER &&
nt_msg.msg_formate == GET_CHIP_ID)
get_fc_devname(nt_msg.device_name);
hinic_get_fc_devname(nt_msg.device_name);
if (!nictool_k_is_cmd_support(cmd_raw, nt_msg.device_name,
nt_msg.up_cmd.up_db.up_api_type)) {
......@@ -2388,7 +2388,7 @@ static const struct file_operations fifo_operations = {
.mmap = hinic_mem_mmap,
};
int if_nictool_exist(void)
static int if_nictool_exist(void)
{
struct file *fp = NULL;
int exist = 0;
......@@ -2405,9 +2405,9 @@ int if_nictool_exist(void)
}
/**
* nictool_k_init - initialize the hw interface
* hinic_tool_k_init - initialize the hw interface
*/
int nictool_k_init(void)
int hinic_tool_k_init(void)
{
int ret;
struct device *pdevice;
......@@ -2480,7 +2480,7 @@ int nictool_k_init(void)
return ret;
}
void nictool_k_uninit(void)
void hinic_tool_k_uninit(void)
{
if (g_nictool_init_flag) {
if ((--g_nictool_ref_cnt))
......
......@@ -236,11 +236,11 @@ struct hinic_card_func_info {
};
#define MAX_CARD_NUM 64
extern void *g_card_node_array[MAX_CARD_NUM];
extern void *g_card_vir_addr[MAX_CARD_NUM];
extern u64 g_card_phy_addr[MAX_CARD_NUM];
extern struct mutex g_addr_lock;
extern int card_id;
extern void *g_hinic_card_node_array[MAX_CARD_NUM];
extern void *g_hinic_card_vir_addr[MAX_CARD_NUM];
extern u64 g_hinic_card_phy_addr[MAX_CARD_NUM];
extern struct mutex g_hinic_addr_lock;
extern int g_hinic_card_id;
struct hinic_nic_loop_mode {
u32 loop_mode;
......@@ -265,8 +265,8 @@ struct hinic_pf_info {
u32 pf_id;
};
int nictool_k_init(void);
void nictool_k_uninit(void);
int hinic_tool_k_init(void);
void hinic_tool_k_uninit(void);
u32 hinic_get_io_stats_size(struct hinic_nic_dev *nic_dev);
void hinic_get_io_stats(struct hinic_nic_dev *nic_dev,
......
......@@ -25,7 +25,7 @@
#include "hifc_mgmt.h"
#include "hifc_cfg.h"
uint intr_mode;
static uint intr_mode;
int hifc_sync_time(void *hwdev, u64 time)
{
......@@ -389,7 +389,7 @@ void hifc_free_irq(void *hwdev, enum hifc_service_type type, u32 irq_id)
mutex_unlock(&irq_info->irq_mutex);
}
int init_cfg_mgmt(struct hifc_hwdev *dev)
static int init_cfg_mgmt(struct hifc_hwdev *dev)
{
int err;
struct cfg_mgmt_info *cfg_mgmt;
......@@ -439,7 +439,7 @@ int init_cfg_mgmt(struct hifc_hwdev *dev)
return err;
}
void free_cfg_mgmt(struct hifc_hwdev *dev)
static void free_cfg_mgmt(struct hifc_hwdev *dev)
{
struct cfg_mgmt_info *cfg_mgmt = dev->cfg_mgmt;
......@@ -472,7 +472,7 @@ void free_cfg_mgmt(struct hifc_hwdev *dev)
kfree(cfg_mgmt);
}
int init_capability(struct hifc_hwdev *dev)
static int init_capability(struct hifc_hwdev *dev)
{
int err;
enum func_type type = HIFC_FUNC_TYPE(dev);
......@@ -497,7 +497,7 @@ int init_capability(struct hifc_hwdev *dev)
return 0;
}
void free_capability(struct hifc_hwdev *dev)
static void free_capability(struct hifc_hwdev *dev)
{
sdk_info(dev->dev_hdl, "Free capability success");
}
......
......@@ -43,11 +43,11 @@ struct ffm_intr_info {
#define HIFC_SELF_CMD_UP2PF_FFM 0x26
void *g_card_node_array[MAX_CARD_NUM] = {0};
void *g_card_vir_addr[MAX_CARD_NUM] = {0};
u64 g_card_phy_addr[MAX_CARD_NUM] = {0};
/* lock for g_card_vir_addr */
struct mutex g_addr_lock;
int card_id;
void *g_hifc_card_vir_addr[MAX_CARD_NUM] = {0};
u64 g_hifc_card_phy_addr[MAX_CARD_NUM] = {0};
/* lock for g_hifc_card_vir_addr */
struct mutex g_hifc_addr_lock;
int g_hifc_card_id;
/* dbgtool character device name, class name, dev path */
#define CHR_DEV_DBGTOOL "hifc_dbgtool_chr_dev"
......@@ -59,15 +59,15 @@ struct dbgtool_k_glb_info {
struct ffm_record_info *ffm;
};
dev_t dbgtool_dev_id; /* device id */
struct cdev dbgtool_chr_dev; /* struct of char device */
static dev_t dbgtool_dev_id; /* device id */
static struct cdev dbgtool_chr_dev; /* struct of char device */
/*lint -save -e104 -e808*/
struct class *dbgtool_d_class; /* struct of char class */
static struct class *dbgtool_d_class; /* struct of char class */
/*lint -restore*/
int g_dbgtool_init_flag;
int g_dbgtool_ref_cnt;
static int g_dbgtool_init_flag;
static int g_dbgtool_ref_cnt;
static int dbgtool_knl_open(struct inode *pnode,
struct file *pfile)
......@@ -102,7 +102,7 @@ static bool is_valid_phy_addr(u64 offset)
int i;
for (i = 0; i < MAX_CARD_NUM; i++) {
if (offset == g_card_phy_addr[i])
if (offset == g_hifc_card_phy_addr[i])
return true;
}
......@@ -127,9 +127,9 @@ int hifc_mem_mmap(struct file *filp, struct vm_area_struct *vma)
}
/* old version of tool set vma->vm_pgoff to 0 */
phy_addr = offset ? offset : g_card_phy_addr[card_id];
phy_addr = offset ? offset : g_hifc_card_phy_addr[g_hifc_card_id];
if (!phy_addr) {
pr_err("Card_id = %d physical address is 0\n", card_id);
pr_err("Card_id = %d physical address is 0\n", g_hifc_card_id);
return -EAGAIN;
}
......@@ -147,7 +147,7 @@ int hifc_mem_mmap(struct file *filp, struct vm_area_struct *vma)
* @g_func_handle_array: global function handle
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_api_cmd_read(struct dbgtool_param *para,
static long dbgtool_knl_api_cmd_read(struct dbgtool_param *para,
void **g_func_handle_array)
{
long ret = 0;
......@@ -231,7 +231,7 @@ long dbgtool_knl_api_cmd_read(struct dbgtool_param *para,
* @g_func_handle_array: global function handle
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_api_cmd_write(struct dbgtool_param *para,
static long dbgtool_knl_api_cmd_write(struct dbgtool_param *para,
void **g_func_handle_array)
{
long ret = 0;
......@@ -298,7 +298,7 @@ void chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_idx,
for (func_idx = 0; func_idx < 16; func_idx++) {
hwdev = (struct hifc_hwdev *)g_func_handle_array[func_idx];
dev_info[func_idx].phy_addr = g_card_phy_addr[card_idx];
dev_info[func_idx].phy_addr = g_hifc_card_phy_addr[card_idx];
if (!hwdev) {
dev_info[func_idx].bar0_size = 0;
......@@ -328,47 +328,47 @@ void chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_idx,
* @g_func_handle_array: global function handle
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_pf_dev_info_get(struct dbgtool_param *para,
static long dbgtool_knl_pf_dev_info_get(struct dbgtool_param *para,
void **g_func_handle_array)
{
struct pf_dev_info dev_info[16] = { {0} };
unsigned char *tmp;
int i;
mutex_lock(&g_addr_lock);
if (!g_card_vir_addr[card_id]) {
g_card_vir_addr[card_id] =
mutex_lock(&g_hifc_addr_lock);
if (!g_hifc_card_vir_addr[g_hifc_card_id]) {
g_hifc_card_vir_addr[g_hifc_card_id] =
(void *)__get_free_pages(GFP_KERNEL,
DBGTOOL_PAGE_ORDER);
if (!g_card_vir_addr[card_id]) {
if (!g_hifc_card_vir_addr[g_hifc_card_id]) {
pr_err("Alloc dbgtool api chain fail!\n");
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hifc_addr_lock);
return -EFAULT;
}
memset(g_card_vir_addr[card_id], 0,
memset(g_hifc_card_vir_addr[g_hifc_card_id], 0,
PAGE_SIZE * (1 << DBGTOOL_PAGE_ORDER));
g_card_phy_addr[card_id] =
virt_to_phys(g_card_vir_addr[card_id]);
if (!g_card_phy_addr[card_id]) {
pr_err("phy addr for card %d is 0\n", card_id);
free_pages((unsigned long)g_card_vir_addr[card_id],
g_hifc_card_phy_addr[g_hifc_card_id] =
virt_to_phys(g_hifc_card_vir_addr[g_hifc_card_id]);
if (!g_hifc_card_phy_addr[g_hifc_card_id]) {
pr_err("phy addr for card %d is 0\n", g_hifc_card_id);
free_pages((unsigned long)g_hifc_card_vir_addr[g_hifc_card_id],
DBGTOOL_PAGE_ORDER);
g_card_vir_addr[card_id] = NULL;
mutex_unlock(&g_addr_lock);
g_hifc_card_vir_addr[g_hifc_card_id] = NULL;
mutex_unlock(&g_hifc_addr_lock);
return -EFAULT;
}
tmp = g_card_vir_addr[card_id];
tmp = g_hifc_card_vir_addr[g_hifc_card_id];
for (i = 0; i < (1 << DBGTOOL_PAGE_ORDER); i++) {
SetPageReserved(virt_to_page(tmp));
tmp += PAGE_SIZE;
}
}
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hifc_addr_lock);
chipif_get_all_pf_dev_info(dev_info, card_id, g_func_handle_array);
chipif_get_all_pf_dev_info(dev_info, g_hifc_card_id, g_func_handle_array);
/* Copy the dev_info to user mode */
if (copy_to_user(para->param.dev_info, dev_info,
......@@ -386,7 +386,7 @@ long dbgtool_knl_pf_dev_info_get(struct dbgtool_param *para,
* @dbgtool_info: the dbgtool info
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_ffm_info_rd(struct dbgtool_param *para,
static long dbgtool_knl_ffm_info_rd(struct dbgtool_param *para,
struct dbgtool_k_glb_info *dbgtool_info)
{
/* Copy the ffm_info to user mode */
......@@ -404,7 +404,7 @@ long dbgtool_knl_ffm_info_rd(struct dbgtool_param *para,
* @para: unused
* @dbgtool_info: the dbgtool info
*/
void dbgtool_knl_ffm_info_clr(struct dbgtool_param *para,
static void dbgtool_knl_ffm_info_clr(struct dbgtool_param *para,
struct dbgtool_k_glb_info *dbgtool_info)
{
dbgtool_info->ffm->ffm_num = 0;
......@@ -416,7 +416,7 @@ void dbgtool_knl_ffm_info_clr(struct dbgtool_param *para,
* @g_func_handle_array: global function handle
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_msg_to_up(struct dbgtool_param *para,
static long dbgtool_knl_msg_to_up(struct dbgtool_param *para,
void **g_func_handle_array)
{
long ret = 0;
......@@ -500,29 +500,29 @@ long dbgtool_knl_msg_to_up(struct dbgtool_param *para,
return ret;
}
long dbgtool_knl_free_mem(int id)
long hifc_dbgtool_knl_free_mem(int id)
{
unsigned char *tmp;
int i;
mutex_lock(&g_addr_lock);
mutex_lock(&g_hifc_addr_lock);
if (!g_card_vir_addr[id]) {
mutex_unlock(&g_addr_lock);
if (!g_hifc_card_vir_addr[id]) {
mutex_unlock(&g_hifc_addr_lock);
return 0;
}
tmp = g_card_vir_addr[id];
tmp = g_hifc_card_vir_addr[id];
for (i = 0; i < (1 << DBGTOOL_PAGE_ORDER); i++) {
ClearPageReserved(virt_to_page(tmp));
tmp += PAGE_SIZE;
}
free_pages((unsigned long)g_card_vir_addr[id], DBGTOOL_PAGE_ORDER);
g_card_vir_addr[id] = NULL;
g_card_phy_addr[id] = 0;
free_pages((unsigned long)g_hifc_card_vir_addr[id], DBGTOOL_PAGE_ORDER);
g_hifc_card_vir_addr[id] = NULL;
g_hifc_card_phy_addr[id] = 0;
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hifc_addr_lock);
return 0;
}
......@@ -558,7 +558,7 @@ static long process_dbgtool_cmd(struct dbgtool_param *param, unsigned int cmd,
unsigned int real_cmd;
long ret = 0;
card_id = idx;
g_hifc_card_id = idx;
card_info = (struct card_node *)g_card_node_array[idx];
dbgtool_info = (struct dbgtool_k_glb_info *)card_info->dbgtool_info;
......@@ -590,7 +590,7 @@ static long process_dbgtool_cmd(struct dbgtool_param *param, unsigned int cmd,
card_info->func_handle_array);
break;
case DBGTOOL_CMD_FREE_MEM:
ret = dbgtool_knl_free_mem(idx);
ret = hifc_dbgtool_knl_free_mem(idx);
break;
default:
pr_err("Dbgtool cmd(x%x) not support now\n", real_cmd);
......@@ -609,7 +609,7 @@ static long process_dbgtool_cmd(struct dbgtool_param *param, unsigned int cmd,
* @arg: user space
* Return: 0 - success, negative - failure
*/
long dbgtool_knl_unlocked_ioctl(struct file *pfile,
static long dbgtool_knl_unlocked_ioctl(struct file *pfile,
unsigned int cmd,
unsigned long arg)
{
......@@ -669,7 +669,7 @@ static struct card_node *get_card_node_by_hwdev(const void *handle)
* @buf_out: the pointer to outputput buffer
* @out_size: output buffer size
*/
void ffm_intr_msg_record(void *handle, void *buf_in, u16 in_size,
static void ffm_intr_msg_record(void *handle, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
struct dbgtool_k_glb_info *dbgtool_info;
......@@ -788,12 +788,12 @@ static int dbgtool_create_cdev(void)
}
/**
* dbgtool_knl_init - dbgtool character device init
* hifc_dbgtool_knl_init - dbgtool character device init
* @hwdev: the pointer to hardware device
* @chip_node: the pointer to card node
* Return: 0 - success, negative - failure
*/
int dbgtool_knl_init(void *vhwdev, void *chip_node)
int hifc_dbgtool_knl_init(void *vhwdev, void *chip_node)
{
struct card_node *chip_info = (struct card_node *)chip_node;
struct dbgtool_k_glb_info *dbgtool_info;
......@@ -863,7 +863,7 @@ int dbgtool_knl_init(void *vhwdev, void *chip_node)
g_dbgtool_init_flag = 1;
g_dbgtool_ref_cnt = 1;
mutex_init(&g_addr_lock);
mutex_init(&g_hifc_addr_lock);
return 0;
......@@ -884,11 +884,11 @@ int dbgtool_knl_init(void *vhwdev, void *chip_node)
}
/**
* dbgtool_knl_deinit - dbgtool character device deinit
* hifc_dbgtool_knl_deinit - dbgtool character device deinit
* @hwdev: the pointer to hardware device
* @chip_node: the pointer to card node
*/
void dbgtool_knl_deinit(void *vhwdev, void *chip_node)
void hifc_dbgtool_knl_deinit(void *vhwdev, void *chip_node)
{
struct dbgtool_k_glb_info *dbgtool_info;
struct card_node *chip_info = (struct card_node *)chip_node;
......@@ -924,7 +924,7 @@ void dbgtool_knl_deinit(void *vhwdev, void *chip_node)
kfree(dbgtool_info);
chip_info->dbgtool_info = NULL;
(void)dbgtool_knl_free_mem(id);
(void)hifc_dbgtool_knl_free_mem(id);
if (g_dbgtool_init_flag) {
if ((--g_dbgtool_ref_cnt))
......
......@@ -97,11 +97,11 @@ struct dbgtool_param {
#endif
#define DBGTOOL_PAGE_ORDER 10
int dbgtool_knl_init(void *vhwdev, void *chip_node);
void dbgtool_knl_deinit(void *vhwdev, void *chip_node);
int hifc_dbgtool_knl_init(void *vhwdev, void *chip_node);
void hifc_dbgtool_knl_deinit(void *vhwdev, void *chip_node);
int hifc_mem_mmap(struct file *filp, struct vm_area_struct *vma);
void chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_id,
void hifc_chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_id,
void **g_func_handle_array);
long dbgtool_knl_free_mem(int id);
long hifc_dbgtool_knl_free_mem(int id);
#endif
......@@ -406,7 +406,7 @@ struct hifc_mgmt_status_log {
const char *log;
};
struct hifc_mgmt_status_log mgmt_status_log[] = {
static struct hifc_mgmt_status_log mgmt_status_log[] = {
{HIFC_MGMT_STATUS_ERR_PARAM, "Invalid parameter"},
{HIFC_MGMT_STATUS_ERR_FAILED, "Operation failed"},
{HIFC_MGMT_STATUS_ERR_PORT, "Invalid port"},
......@@ -2139,7 +2139,7 @@ int hifc_func_tmr_bitmap_set(void *hwdev, bool en)
return 0;
}
int ppf_ht_gpa_set(struct hifc_hwdev *hwdev, struct hifc_page_addr *pg0,
static int ppf_ht_gpa_set(struct hifc_hwdev *hwdev, struct hifc_page_addr *pg0,
struct hifc_page_addr *pg1)
{
struct comm_info_ht_gpa_set ht_gpa_set = {0};
......@@ -3211,35 +3211,35 @@ static void pf_hilink_event_handler(void *hwdev, void *pri_handle, u8 cmd,
}
/* pf fault report event */
void pf_fault_event_handler(void *hwdev, void *buf_in, u16 in_size,
static void pf_fault_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HIFC_MOD_COMM, HIFC_MGMT_CMD_FAULT_REPORT,
buf_in, in_size, buf_out, out_size);
}
void mgmt_watchdog_event_handler(void *hwdev, void *buf_in, u16 in_size,
static void mgmt_watchdog_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HIFC_MOD_COMM, HIFC_MGMT_CMD_WATCHDOG_INFO,
buf_in, in_size, buf_out, out_size);
}
void mgmt_fmw_act_event_handler(void *hwdev, void *buf_in, u16 in_size,
static void mgmt_fmw_act_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HIFC_MOD_COMM, HIFC_MGMT_CMD_FMW_ACT_NTC,
buf_in, in_size, buf_out, out_size);
}
void mgmt_pcie_dfx_event_handler(void *hwdev, void *buf_in, u16 in_size,
static void mgmt_pcie_dfx_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HIFC_MOD_COMM, HIFC_MGMT_CMD_PCIE_DFX_NTC,
buf_in, in_size, buf_out, out_size);
}
void mgmt_get_mctp_event_handler(void *hwdev, void *buf_in, u16 in_size,
static void mgmt_get_mctp_event_handler(void *hwdev, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
{
_event_handler(hwdev, HIFC_MOD_COMM, HIFC_MGMT_CMD_GET_HOST_INFO,
......
......@@ -51,7 +51,7 @@ MODULE_LICENSE("GPL");
#define MAX_CARD_ID 64
static u64 card_bit_map;
LIST_HEAD(g_hinic_chip_list);
LIST_HEAD(g_hifc_chip_list);
enum hifc_lld_status {
HIFC_NODE_CHANGE = BIT(0),
......@@ -64,7 +64,7 @@ struct hifc_lld_lock {
atomic_t dev_ref_cnt;
};
struct hifc_lld_lock g_lld_lock;
static struct hifc_lld_lock g_lld_lock;
#define WAIT_LLD_DEV_HOLD_TIMEOUT (10 * 60 * 1000) /* 10minutes */
#define WAIT_LLD_DEV_NODE_CHANGED (10 * 60 * 1000) /* 10minutes */
......@@ -455,7 +455,7 @@ static int alloc_chip_node(struct hifc_pcidev *pci_adapter)
parent_bus_number = pci_adapter->pcidev->bus->parent->number;
if (parent_bus_number != 0) {
list_for_each_entry(chip_node, &g_hinic_chip_list, node) {
list_for_each_entry(chip_node, &g_hifc_chip_list, node) {
if (chip_node->dp_bus_num == parent_bus_number) {
pci_adapter->chip_node = chip_node;
return 0;
......@@ -503,7 +503,7 @@ static int alloc_chip_node(struct hifc_pcidev *pci_adapter)
"Add new chip %s to global list succeed\n",
chip_node->chip_name);
list_add_tail(&chip_node->node, &g_hinic_chip_list);
list_add_tail(&chip_node->node, &g_hifc_chip_list);
INIT_LIST_HEAD(&chip_node->func_list);
pci_adapter->chip_node = chip_node;
......@@ -664,7 +664,7 @@ static int hifc_func_init(struct pci_dev *pdev,
hifc_sync_time_to_fmw(pci_adapter);
lld_lock_chip_node();
err = dbgtool_knl_init(pci_adapter->hwdev, pci_adapter->chip_node);
err = hifc_dbgtool_knl_init(pci_adapter->hwdev, pci_adapter->chip_node);
if (err) {
lld_unlock_chip_node();
sdk_err(&pdev->dev, "Failed to initialize dbgtool\n");
......@@ -700,7 +700,7 @@ static void hifc_func_deinit(struct pci_dev *pdev)
if (pci_adapter->init_state >= HIFC_INIT_STATE_DBGTOOL_INITED) {
lld_lock_chip_node();
dbgtool_knl_deinit(pci_adapter->hwdev, pci_adapter->chip_node);
hifc_dbgtool_knl_deinit(pci_adapter->hwdev, pci_adapter->chip_node);
lld_unlock_chip_node();
hifc_event_unregister(pci_adapter->hwdev);
}
......@@ -738,7 +738,7 @@ static void remove_func(struct hifc_pcidev *pci_adapter)
lld_lock_chip_node();
if (pci_adapter->init_state < HIFC_INIT_STATE_HW_IF_INITED)
list_del(&pci_adapter->node);
nictool_k_uninit();
hifc_tool_k_uninit();
free_chip_node(pci_adapter);
lld_unlock_chip_node();
unmapping_bar(pci_adapter);
......@@ -802,7 +802,7 @@ static int hifc_hwdev_probe(struct pci_dev *pdev,
"Failed to add new chip node to global list\n");
goto alloc_chip_node_fail;
}
err = nictool_k_init();
err = hifc_tool_k_init();
if (err) {
sdk_warn(&pdev->dev, "Failed to init nictool");
goto init_nictool_err;
......
......@@ -17,7 +17,7 @@ struct hifc_lld_dev {
void *hwdev;
};
extern struct list_head g_hinic_chip_list;
extern struct list_head g_hifc_chip_list;
/* Structure pcidev private*/
struct hifc_pcidev {
......
......@@ -167,40 +167,40 @@ static int __get_card_usr_api_chain_mem(int card_idx)
unsigned char *tmp;
int i;
mutex_lock(&g_addr_lock);
card_id = card_idx;
if (!g_card_vir_addr[card_idx]) {
g_card_vir_addr[card_idx] =
mutex_lock(&g_hifc_addr_lock);
g_hifc_card_id = card_idx;
if (!g_hifc_card_vir_addr[card_idx]) {
g_hifc_card_vir_addr[card_idx] =
(void *)__get_free_pages(GFP_KERNEL,
DBGTOOL_PAGE_ORDER);
if (!g_card_vir_addr[card_idx]) {
if (!g_hifc_card_vir_addr[card_idx]) {
pr_err("Alloc api chain memory fail for card %d.\n",
card_idx);
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hifc_addr_lock);
return -EFAULT;
}
memset(g_card_vir_addr[card_idx], 0,
memset(g_hifc_card_vir_addr[card_idx], 0,
PAGE_SIZE * (1 << DBGTOOL_PAGE_ORDER));
g_card_phy_addr[card_idx] =
virt_to_phys(g_card_vir_addr[card_idx]);
if (!g_card_phy_addr[card_idx]) {
g_hifc_card_phy_addr[card_idx] =
virt_to_phys(g_hifc_card_vir_addr[card_idx]);
if (!g_hifc_card_phy_addr[card_idx]) {
pr_err("phy addr for card %d is 0.\n", card_idx);
free_pages((unsigned long)g_card_vir_addr[card_idx],
free_pages((unsigned long)g_hifc_card_vir_addr[card_idx],
DBGTOOL_PAGE_ORDER);
g_card_vir_addr[card_idx] = NULL;
mutex_unlock(&g_addr_lock);
g_hifc_card_vir_addr[card_idx] = NULL;
mutex_unlock(&g_hifc_addr_lock);
return -EFAULT;
}
tmp = g_card_vir_addr[card_idx];
tmp = g_hifc_card_vir_addr[card_idx];
for (i = 0; i < (1 << DBGTOOL_PAGE_ORDER); i++) {
SetPageReserved(virt_to_page(tmp));
tmp += PAGE_SIZE;
}
}
mutex_unlock(&g_addr_lock);
mutex_unlock(&g_hifc_addr_lock);
return 0;
}
......@@ -250,7 +250,7 @@ static int get_card_func_info(char *dev_name, struct msg_module *nt_msg)
return -EFAULT;
}
card_func_info.usr_api_phy_addr = g_card_phy_addr[id];
card_func_info.usr_api_phy_addr = g_hifc_card_phy_addr[id];
/* Copy the dev_info to user mode */
if (copy_to_user(nt_msg->out_buf, &card_func_info,
......@@ -409,7 +409,7 @@ struct hifc_pcidev *hifc_get_pcidev_by_dev_name(char *ifname)
struct hifc_pcidev *dev;
lld_dev_hold();
list_for_each_entry(chip_node, &g_hinic_chip_list, node) {
list_for_each_entry(chip_node, &g_hifc_chip_list, node) {
list_for_each_entry(dev, &chip_node->func_list, node) {
if (test_bit(HIFC_FUNC_IN_REMOVE, &dev->flag))
continue;
......@@ -462,7 +462,7 @@ static int get_service_drv_version(void *hwdev, struct msg_module *nt_msg,
return ret;
}
int send_to_service_driver(struct msg_module *nt_msg, void *buf_in,
static int send_to_service_driver(struct msg_module *nt_msg, void *buf_in,
u32 in_size, void *buf_out, u32 *out_size)
{
enum hifc_service_type type;
......@@ -610,7 +610,7 @@ static long nictool_k_unlocked_ioctl(struct file *pfile,
if (nt_msg.module == HIFCADM_FC_DRIVER &&
nt_msg.msg_formate == GET_CHIP_ID)
get_fc_devname(nt_msg.device_name);
hifc_get_fc_devname(nt_msg.device_name);
if (!nictool_k_is_cmd_support(nt_msg.module, nt_msg.device_name,
nt_msg.up_cmd.up_db.up_api_type)) {
......@@ -661,7 +661,7 @@ static const struct file_operations fifo_operations = {
.mmap = hifc_mem_mmap,
};
int if_nictool_exist(void)
static int if_nictool_exist(void)
{
struct file *fp = NULL;
int exist = 0;
......@@ -678,9 +678,9 @@ int if_nictool_exist(void)
}
/**
* nictool_k_init - initialize the hw interface
* hifc_tool_k_init - initialize the hw interface
*/
int nictool_k_init(void)
int hifc_tool_k_init(void)
{
int ret;
struct device *pdevice;
......@@ -762,7 +762,7 @@ int nictool_k_init(void)
return ret;
}
void nictool_k_uninit(void)
void hifc_tool_k_uninit(void)
{
if (g_nictool_init_flag) {
if ((--g_nictool_ref_cnt))
......
......@@ -233,11 +233,11 @@ struct hifc_card_func_info {
#ifndef MAX_CARD_NUM
#define MAX_CARD_NUM (64)
#endif
extern void *g_card_node_array[MAX_CARD_NUM];
extern void *g_card_vir_addr[MAX_CARD_NUM];
extern u64 g_card_phy_addr[MAX_CARD_NUM];
extern struct mutex g_addr_lock;
extern int card_id;
extern void *g_hifc_card_node_array[MAX_CARD_NUM];
extern void *g_hifc_card_vir_addr[MAX_CARD_NUM];
extern u64 g_hifc_card_phy_addr[MAX_CARD_NUM];
extern struct mutex g_hifc_addr_lock;
extern int g_hifc_card_id;
struct hifc_nic_loop_mode {
u32 loop_mode;
......@@ -299,8 +299,8 @@ enum sm_cmd_type {
SM_CTR_RD64
};
int nictool_k_init(void);
void nictool_k_uninit(void);
int hifc_tool_k_init(void);
void hifc_tool_k_uninit(void);
int send_to_hw_driver(void *hwdev, struct msg_module *nt_msg,
void *buf_in, u32 in_size, void *buf_out, u32 *out_size);
......@@ -314,7 +314,7 @@ int send_to_up(void *hwdev, struct msg_module *nt_msg, void *buf_in,
int send_to_ucode(void *hwdev, struct msg_module *nt_msg, void *buf_in,
u32 in_size, void *buf_out, u32 *out_size);
void get_fc_devname(char *devname);
void hifc_get_fc_devname(char *devname);
void *hifc_get_hwdev_by_ifname(char *ifname);
enum hifc_init_state hifc_get_init_state_by_ifname(char *ifname);
void hifc_get_all_chip_id(void *id_info);
......
......@@ -239,7 +239,7 @@ bool hifc_is_in_host(void)
struct hifc_pcidev *dev;
lld_dev_hold();
list_for_each_entry(chip_node, &g_hinic_chip_list, node) {
list_for_each_entry(chip_node, &g_hifc_chip_list, node) {
list_for_each_entry(dev, &chip_node->func_list, node) {
if (test_bit(HIFC_FUNC_IN_REMOVE, &dev->flag))
continue;
......@@ -398,7 +398,7 @@ struct sm_module_handle {
sm_module sm_func;
};
struct sm_module_handle sm_module_cmd_handle[] = {
static struct sm_module_handle sm_module_cmd_handle[] = {
{SM_CTR_RD32, sm_rd32},
{SM_CTR_RD64_PAIR, sm_rd64_pair},
{SM_CTR_RD64, sm_rd64}
......@@ -664,7 +664,7 @@ static struct hifc_pcidev *_get_pcidev_by_chip_name(char *ifname,
struct hifc_pcidev *dev;
lld_dev_hold();
list_for_each_entry(chip_node, &g_hinic_chip_list, node) {
list_for_each_entry(chip_node, &g_hifc_chip_list, node) {
list_for_each_entry(dev, &chip_node->func_list, node) {
if (test_bit(HIFC_FUNC_IN_REMOVE, &dev->flag))
continue;
......@@ -763,7 +763,7 @@ enum hifc_init_state hifc_get_init_state_by_ifname(char *ifname)
return HIFC_INIT_STATE_NONE;
}
void get_fc_devname(char *devname)
void hifc_get_fc_devname(char *devname)
{
struct card_node *chip_node;
struct hifc_pcidev *dev;
......@@ -774,7 +774,7 @@ void get_fc_devname(char *devname)
}
lld_dev_hold();
list_for_each_entry(chip_node, &g_hinic_chip_list, node) {
list_for_each_entry(chip_node, &g_hifc_chip_list, node) {
list_for_each_entry(dev, &chip_node->func_list, node) {
if (test_bit(HIFC_FUNC_IN_REMOVE, &dev->flag))
continue;
......@@ -806,7 +806,7 @@ void hifc_get_all_chip_id(void *id_info)
}
lld_dev_hold();
list_for_each_entry(chip_node, &g_hinic_chip_list, node) {
list_for_each_entry(chip_node, &g_hifc_chip_list, node) {
err = sscanf(chip_node->chip_name, HIFC_CHIP_NAME "%d", &id);
if (err < 0)
pr_err("Failed to get hifc id\n");
......@@ -828,7 +828,7 @@ static struct card_node *hifc_get_chip_node_by_hwdev(const void *hwdev)
return NULL;
lld_dev_hold();
list_for_each_entry(node_tmp, &g_hinic_chip_list, node) {
list_for_each_entry(node_tmp, &g_hifc_chip_list, node) {
if (!chip_node) {
list_for_each_entry(dev, &node_tmp->func_list, node) {
if (test_bit(HIFC_FUNC_IN_REMOVE, &dev->flag))
......@@ -911,7 +911,7 @@ bool hifc_is_valid_bar_addr(u64 offset)
struct hifc_pcidev *dev;
lld_dev_hold();
list_for_each_entry(chip_node, &g_hinic_chip_list, node) {
list_for_each_entry(chip_node, &g_hifc_chip_list, node) {
list_for_each_entry(dev, &chip_node->func_list, node) {
if (test_bit(HIFC_FUNC_IN_REMOVE, &dev->flag))
continue;
......@@ -941,7 +941,7 @@ void hifc_get_card_func_info_by_card_name(
card_func->num_pf = 0;
lld_dev_hold();
list_for_each_entry(chip_node, &g_hinic_chip_list, node) {
list_for_each_entry(chip_node, &g_hifc_chip_list, node) {
if (strncmp(chip_node->chip_name, chip_name, IFNAMSIZ))
continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册