linux/drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.h

/* SPDX-License-Identifier: GPL-2.0-only */
/* Huawei HiNIC PCI Express Linux driver
 * Copyright(c) 2017 Huawei Technologies Co., Ltd
 */

#ifndef HINIC_MBOX_H_
#define HINIC_MBOX_H_

#define HINIC_MBOX_PF_SEND_ERR
#define HINIC_MBOX_PF_BUSY_ACTIVE_FW
#define HINIC_MBOX_VF_CMD_ERROR

#define HINIC_MAX_FUNCTIONS

#define HINIC_MAX_PF_FUNCS

#define HINIC_MBOX_WQ_NAME

#define HINIC_FUNC_CSR_MAILBOX_DATA_OFF
#define HINIC_FUNC_CSR_MAILBOX_CONTROL_OFF
#define HINIC_FUNC_CSR_MAILBOX_INT_OFFSET_OFF
#define HINIC_FUNC_CSR_MAILBOX_RESULT_H_OFF
#define HINIC_FUNC_CSR_MAILBOX_RESULT_L_OFF

#define MAX_FUNCTION_NUM

struct vf_cmd_check_handle {};

enum hinic_mbox_ack_type {};

struct mbox_msg_info {};

struct hinic_recv_mbox {};

struct hinic_send_mbox {};

hinic_vf_mbox_cb;
hinic_pf_mbox_cb;

enum mbox_event_state {};

enum hinic_mbox_cb_state {};

struct hinic_mbox_func_to_func {};

struct hinic_mbox_work {};

struct vf_cmd_msg_handle {};

bool hinic_mbox_check_func_id_8B(struct hinic_hwdev *hwdev, u16 func_idx,
				 void *buf_in, u16 in_size);

bool hinic_mbox_check_cmd_valid(struct hinic_hwdev *hwdev,
				struct vf_cmd_check_handle *cmd_handle,
				u16 vf_id, u8 cmd, void *buf_in,
				u16 in_size, u8 size);

int hinic_register_pf_mbox_cb(struct hinic_hwdev *hwdev,
			      enum hinic_mod_type mod,
			      hinic_pf_mbox_cb callback);

int hinic_register_vf_mbox_cb(struct hinic_hwdev *hwdev,
			      enum hinic_mod_type mod,
			      hinic_vf_mbox_cb callback);

void hinic_unregister_pf_mbox_cb(struct hinic_hwdev *hwdev,
				 enum hinic_mod_type mod);

void hinic_unregister_vf_mbox_cb(struct hinic_hwdev *hwdev,
				 enum hinic_mod_type mod);

int hinic_func_to_func_init(struct hinic_hwdev *hwdev);

void hinic_func_to_func_free(struct hinic_hwdev *hwdev);

int hinic_mbox_to_pf(struct hinic_hwdev *hwdev, enum hinic_mod_type mod,
		     u8 cmd, void *buf_in, u16 in_size, void *buf_out,
		     u16 *out_size, u32 timeout);

int hinic_mbox_to_func(struct hinic_mbox_func_to_func *func_to_func,
		       enum hinic_mod_type mod, u16 cmd, u16 dst_func,
		       void *buf_in, u16 in_size, void *buf_out,
		       u16 *out_size, u32 timeout);

int hinic_mbox_to_vf(struct hinic_hwdev *hwdev,
		     enum hinic_mod_type mod, u16 vf_id, u8 cmd, void *buf_in,
		     u16 in_size, void *buf_out, u16 *out_size, u32 timeout);

int hinic_vf_mbox_random_id_init(struct hinic_hwdev *hwdev);

#endif