#ifndef _WX_MBX_H_
#define _WX_MBX_H_
#define WX_VXMAILBOX_SIZE 15
#define WX_PXMAILBOX(i) (0x600 + (4 * (i)))
#define WX_PXMAILBOX_STS BIT(0)
#define WX_PXMAILBOX_ACK BIT(1)
#define WX_PXMAILBOX_PFU BIT(3)
#define WX_VXMAILBOX 0x600
#define WX_VXMAILBOX_REQ BIT(0)
#define WX_VXMAILBOX_ACK BIT(1)
#define WX_VXMAILBOX_VFU BIT(2)
#define WX_VXMAILBOX_PFU BIT(3)
#define WX_VXMAILBOX_PFSTS BIT(4)
#define WX_VXMAILBOX_PFACK BIT(5)
#define WX_VXMAILBOX_RSTI BIT(6)
#define WX_VXMAILBOX_RSTD BIT(7)
#define WX_VXMAILBOX_R2C_BITS (WX_VXMAILBOX_RSTD | \
WX_VXMAILBOX_PFSTS | WX_VXMAILBOX_PFACK)
#define WX_VXMBMEM 0x00C00
#define WX_PXMBMEM(i) (0x5000 + (64 * (i)))
#define WX_VFLRE(i) (0x4A0 + (4 * (i)))
#define WX_VFLREC(i) (0x4A8 + (4 * (i)))
#define WX_MBVFICR(i) (0x480 + (4 * (i)))
#define WX_MBVFICR_VFREQ_MASK GENMASK(15, 0)
#define WX_MBVFICR_VFACK_MASK GENMASK(31, 16)
#define WX_VT_MSGTYPE_ACK BIT(31)
#define WX_VT_MSGTYPE_NACK BIT(30)
#define WX_VT_MSGTYPE_CTS BIT(29)
#define WX_VT_MSGINFO_SHIFT 16
#define WX_VT_MSGINFO_MASK GENMASK(23, 16)
enum wx_pfvf_api_rev {
wx_mbox_api_null,
wx_mbox_api_13 = 4,
wx_mbox_api_unknown,
};
#define WX_VF_RESET 0x01
#define WX_VF_SET_MAC_ADDR 0x02
#define WX_VF_SET_MULTICAST 0x03
#define WX_VF_SET_VLAN 0x04
#define WX_VF_SET_LPE 0x05
#define WX_VF_SET_MACVLAN 0x06
#define WX_VF_API_NEGOTIATE 0x08
#define WX_VF_GET_QUEUES 0x09
#define WX_VF_GET_RETA 0x0a
#define WX_VF_GET_RSS_KEY 0x0b
#define WX_VF_UPDATE_XCAST_MODE 0x0c
#define WX_VF_GET_LINK_STATE 0x10
#define WX_VF_GET_FW_VERSION 0x11
#define WX_VF_BACKUP 0x8001
#define WX_PF_CONTROL_MSG BIT(8)
#define WX_PF_NOFITY_VF_LINK_STATUS 0x1
#define WX_PF_NOFITY_VF_NET_NOT_RUNNING BIT(31)
#define WX_VF_TX_QUEUES 1
#define WX_VF_RX_QUEUES 2
#define WX_VF_TRANS_VLAN 3
#define WX_VF_DEF_QUEUE 4
#define WX_VF_PERMADDR_MSG_LEN 4
enum wxvf_xcast_modes {
WXVF_XCAST_MODE_NONE = 0,
WXVF_XCAST_MODE_MULTI,
WXVF_XCAST_MODE_ALLMULTI,
WXVF_XCAST_MODE_PROMISC,
};
int wx_write_mbx_pf(struct wx *wx, u32 *msg, u16 size, u16 vf);
int wx_read_mbx_pf(struct wx *wx, u32 *msg, u16 size, u16 vf);
int wx_check_for_rst_pf(struct wx *wx, u16 mbx_id);
int wx_check_for_msg_pf(struct wx *wx, u16 mbx_id);
int wx_check_for_ack_pf(struct wx *wx, u16 mbx_id);
int wx_read_posted_mbx(struct wx *wx, u32 *msg, u16 size);
int wx_write_posted_mbx(struct wx *wx, u32 *msg, u16 size);
int wx_check_for_rst_vf(struct wx *wx);
int wx_check_for_msg_vf(struct wx *wx);
int wx_read_mbx_vf(struct wx *wx, u32 *msg, u16 size);
int wx_write_mbx_vf(struct wx *wx, u32 *msg, u16 size);
int wx_init_mbx_params_vf(struct wx *wx);
#endif