162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright(c) 1999 - 2018 Intel Corporation. */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef _E1000_MBX_H_
562306a36Sopenharmony_ci#define _E1000_MBX_H_
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#include "vf.h"
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#define E1000_V2PMAILBOX_REQ	0x00000001 /* Request for PF Ready bit */
1062306a36Sopenharmony_ci#define E1000_V2PMAILBOX_ACK	0x00000002 /* Ack PF message received */
1162306a36Sopenharmony_ci#define E1000_V2PMAILBOX_VFU	0x00000004 /* VF owns the mailbox buffer */
1262306a36Sopenharmony_ci#define E1000_V2PMAILBOX_PFU	0x00000008 /* PF owns the mailbox buffer */
1362306a36Sopenharmony_ci#define E1000_V2PMAILBOX_PFSTS	0x00000010 /* PF wrote a message in the MB */
1462306a36Sopenharmony_ci#define E1000_V2PMAILBOX_PFACK	0x00000020 /* PF ack the previous VF msg */
1562306a36Sopenharmony_ci#define E1000_V2PMAILBOX_RSTI	0x00000040 /* PF has reset indication */
1662306a36Sopenharmony_ci#define E1000_V2PMAILBOX_RSTD	0x00000080 /* PF has indicated reset done */
1762306a36Sopenharmony_ci#define E1000_V2PMAILBOX_R2C_BITS 0x000000B0 /* All read to clear bits */
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define E1000_VFMAILBOX_SIZE	16 /* 16 32 bit words - 64 bytes */
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* If it's a E1000_VF_* msg then it originates in the VF and is sent to the
2262306a36Sopenharmony_ci * PF.  The reverse is true if it is E1000_PF_*.
2362306a36Sopenharmony_ci * Message ACK's are the value or'd with 0xF0000000
2462306a36Sopenharmony_ci */
2562306a36Sopenharmony_ci/* Messages below or'd with this are the ACK */
2662306a36Sopenharmony_ci#define E1000_VT_MSGTYPE_ACK	0x80000000
2762306a36Sopenharmony_ci/* Messages below or'd with this are the NACK */
2862306a36Sopenharmony_ci#define E1000_VT_MSGTYPE_NACK	0x40000000
2962306a36Sopenharmony_ci/* Indicates that VF is still clear to send requests */
3062306a36Sopenharmony_ci#define E1000_VT_MSGTYPE_CTS	0x20000000
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci/* We have a total wait time of 1s for vf mailbox posted messages */
3362306a36Sopenharmony_ci#define E1000_VF_MBX_INIT_TIMEOUT	2000 /* retry count for mbx timeout */
3462306a36Sopenharmony_ci#define E1000_VF_MBX_INIT_DELAY		500  /* usec delay between retries */
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#define E1000_VT_MSGINFO_SHIFT	16
3762306a36Sopenharmony_ci/* bits 23:16 are used for exra info for certain messages */
3862306a36Sopenharmony_ci#define E1000_VT_MSGINFO_MASK	(0xFF << E1000_VT_MSGINFO_SHIFT)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define E1000_VF_RESET		0x01 /* VF requests reset */
4162306a36Sopenharmony_ci#define E1000_VF_SET_MAC_ADDR	0x02 /* VF requests PF to set MAC addr */
4262306a36Sopenharmony_ci/* VF requests PF to clear all unicast MAC filters */
4362306a36Sopenharmony_ci#define E1000_VF_MAC_FILTER_CLR (0x01 << E1000_VT_MSGINFO_SHIFT)
4462306a36Sopenharmony_ci/* VF requests PF to add unicast MAC filter */
4562306a36Sopenharmony_ci#define E1000_VF_MAC_FILTER_ADD (0x02 << E1000_VT_MSGINFO_SHIFT)
4662306a36Sopenharmony_ci#define E1000_VF_SET_MULTICAST	0x03 /* VF requests PF to set MC addr */
4762306a36Sopenharmony_ci#define E1000_VF_SET_VLAN	0x04 /* VF requests PF to set VLAN */
4862306a36Sopenharmony_ci#define E1000_VF_SET_LPE	0x05 /* VF requests PF to set VMOLR.LPE */
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define E1000_PF_CONTROL_MSG	0x0100 /* PF control message */
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_civoid e1000_init_mbx_ops_generic(struct e1000_hw *hw);
5362306a36Sopenharmony_cis32 e1000_init_mbx_params_vf(struct e1000_hw *);
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#endif /* _E1000_MBX_H_ */
56