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

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

#ifndef HINIC_HW_MGMT_H
#define HINIC_HW_MGMT_H

#include <linux/types.h>
#include <linux/semaphore.h>
#include <linux/completion.h>
#include <linux/bitops.h>

#include "hinic_hw_if.h"
#include "hinic_hw_api_cmd.h"

#define HINIC_MSG_HEADER_MSG_LEN_SHIFT
#define HINIC_MSG_HEADER_MODULE_SHIFT
#define HINIC_MSG_HEADER_SEG_LEN_SHIFT
#define HINIC_MSG_HEADER_NO_ACK_SHIFT
#define HINIC_MSG_HEADER_ASYNC_MGMT_TO_PF_SHIFT
#define HINIC_MSG_HEADER_SEQID_SHIFT
#define HINIC_MSG_HEADER_LAST_SHIFT
#define HINIC_MSG_HEADER_DIRECTION_SHIFT
#define HINIC_MSG_HEADER_CMD_SHIFT
#define HINIC_MSG_HEADER_ZEROS_SHIFT
#define HINIC_MSG_HEADER_PCI_INTF_SHIFT
#define HINIC_MSG_HEADER_PF_IDX_SHIFT
#define HINIC_MSG_HEADER_MSG_ID_SHIFT

#define HINIC_MSG_HEADER_MSG_LEN_MASK
#define HINIC_MSG_HEADER_MODULE_MASK
#define HINIC_MSG_HEADER_SEG_LEN_MASK
#define HINIC_MSG_HEADER_NO_ACK_MASK
#define HINIC_MSG_HEADER_ASYNC_MGMT_TO_PF_MASK
#define HINIC_MSG_HEADER_SEQID_MASK
#define HINIC_MSG_HEADER_LAST_MASK
#define HINIC_MSG_HEADER_DIRECTION_MASK
#define HINIC_MSG_HEADER_CMD_MASK
#define HINIC_MSG_HEADER_ZEROS_MASK
#define HINIC_MSG_HEADER_PCI_INTF_MASK
#define HINIC_MSG_HEADER_PF_IDX_MASK
#define HINIC_MSG_HEADER_MSG_ID_MASK

#define HINIC_MSG_HEADER_SET(val, member)

#define HINIC_MSG_HEADER_GET(val, member)

enum hinic_mgmt_msg_type {};

enum hinic_cfg_cmd {};

enum hinic_comm_cmd {};

enum hinic_mgmt_cb_state {};

struct hinic_recv_msg {};

struct hinic_mgmt_cb {};

struct hinic_pf_to_mgmt {};

struct hinic_mgmt_msg_handle_work {};

void hinic_register_mgmt_msg_cb(struct hinic_pf_to_mgmt *pf_to_mgmt,
				enum hinic_mod_type mod,
				void *handle,
				void (*callback)(void *handle,
						 u8 cmd, void *buf_in,
						 u16 in_size, void *buf_out,
						 u16 *out_size));

void hinic_unregister_mgmt_msg_cb(struct hinic_pf_to_mgmt *pf_to_mgmt,
				  enum hinic_mod_type mod);

int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt,
		      enum hinic_mod_type mod, u8 cmd,
		      void *buf_in, u16 in_size, void *buf_out, u16 *out_size,
		      enum hinic_mgmt_msg_type sync);

int hinic_pf_to_mgmt_init(struct hinic_pf_to_mgmt *pf_to_mgmt,
			  struct hinic_hwif *hwif);

void hinic_pf_to_mgmt_free(struct hinic_pf_to_mgmt *pf_to_mgmt);

#endif