xref: /openbmc/linux/drivers/net/ethernet/intel/ixgbevf/mbx.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1ae06c70bSJeff Kirsher /* SPDX-License-Identifier: GPL-2.0 */
251dce24bSJeff Kirsher /* Copyright(c) 1999 - 2018 Intel Corporation. */
3dee1ad47SJeff Kirsher 
4dee1ad47SJeff Kirsher #ifndef _IXGBE_MBX_H_
5dee1ad47SJeff Kirsher #define _IXGBE_MBX_H_
6dee1ad47SJeff Kirsher 
7dee1ad47SJeff Kirsher #include "vf.h"
8dee1ad47SJeff Kirsher 
9dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_SIZE	16 /* 16 32 bit words - 64 bytes */
10dee1ad47SJeff Kirsher 
11dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX		0x002FC
12dee1ad47SJeff Kirsher #define IXGBE_VFMBMEM		0x00200
13dee1ad47SJeff Kirsher 
14dee1ad47SJeff Kirsher /* Define mailbox register bits */
15dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_REQ	0x00000001 /* Request for PF Ready bit */
16dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_ACK	0x00000002 /* Ack PF message received */
17dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_VFU	0x00000004 /* VF owns the mailbox buffer */
18dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_PFU	0x00000008 /* PF owns the mailbox buffer */
19dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_PFSTS	0x00000010 /* PF wrote a message in the MB */
20dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_PFACK	0x00000020 /* PF ack the previous VF msg */
21dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_RSTI	0x00000040 /* PF has reset indication */
22dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_RSTD	0x00000080 /* PF has indicated reset done */
23dee1ad47SJeff Kirsher #define IXGBE_VFMAILBOX_R2C_BITS 0x000000B0 /* All read to clear bits */
24dee1ad47SJeff Kirsher 
25f131a6c0SAlexander Duyck #define IXGBE_PFMAILBOX(x)	(0x04B00 + (4 * (x)))
26f131a6c0SAlexander Duyck #define IXGBE_PFMBMEM(vfn)	(0x13000 + (64 * (vfn)))
27dee1ad47SJeff Kirsher 
28dee1ad47SJeff Kirsher #define IXGBE_PFMAILBOX_STS	0x00000001 /* Initiate message send to VF */
29dee1ad47SJeff Kirsher #define IXGBE_PFMAILBOX_ACK	0x00000002 /* Ack message recv'd from VF */
30dee1ad47SJeff Kirsher #define IXGBE_PFMAILBOX_VFU	0x00000004 /* VF owns the mailbox buffer */
31dee1ad47SJeff Kirsher #define IXGBE_PFMAILBOX_PFU	0x00000008 /* PF owns the mailbox buffer */
32dee1ad47SJeff Kirsher #define IXGBE_PFMAILBOX_RVFU	0x00000010 /* Reset VFU - used when VF stuck */
33dee1ad47SJeff Kirsher 
34dee1ad47SJeff Kirsher #define IXGBE_MBVFICR_VFREQ_MASK 0x0000FFFF /* bits for VF messages */
35dee1ad47SJeff Kirsher #define IXGBE_MBVFICR_VFREQ_VF1	0x00000001 /* bit for VF 1 message */
36dee1ad47SJeff Kirsher #define IXGBE_MBVFICR_VFACK_MASK 0xFFFF0000 /* bits for VF acks */
37dee1ad47SJeff Kirsher #define IXGBE_MBVFICR_VFACK_VF1	0x00010000 /* bit for VF 1 ack */
38dee1ad47SJeff Kirsher 
39dee1ad47SJeff Kirsher /* If it's a IXGBE_VF_* msg then it originates in the VF and is sent to the
40dee1ad47SJeff Kirsher  * PF.  The reverse is true if it is IXGBE_PF_*.
410edbecd5SRadoslaw Tyl  * Message results are the value or'd with 0xF0000000
42dee1ad47SJeff Kirsher  */
430edbecd5SRadoslaw Tyl #define IXGBE_VT_MSGTYPE_SUCCESS	0x80000000 /* Messages or'd with this
440edbecd5SRadoslaw Tyl 						    * have succeeded
450edbecd5SRadoslaw Tyl 						    */
460edbecd5SRadoslaw Tyl #define IXGBE_VT_MSGTYPE_FAILURE	0x40000000 /* Messages or'd with this
470edbecd5SRadoslaw Tyl 						    * have failed
480edbecd5SRadoslaw Tyl 						    */
490edbecd5SRadoslaw Tyl #define IXGBE_VT_MSGTYPE_CTS		0x20000000 /* Indicates that VF is still
500edbecd5SRadoslaw Tyl 						    * clear to send requests
510edbecd5SRadoslaw Tyl 						    */
52dee1ad47SJeff Kirsher #define IXGBE_VT_MSGINFO_SHIFT	16
53dee1ad47SJeff Kirsher /* bits 23:16 are used for exra info for certain messages */
54dee1ad47SJeff Kirsher #define IXGBE_VT_MSGINFO_MASK	(0xFF << IXGBE_VT_MSGINFO_SHIFT)
55dee1ad47SJeff Kirsher 
5631186785SAlexander Duyck /* definitions to support mailbox API version negotiation */
5731186785SAlexander Duyck 
58dec0d8e4SJeff Kirsher /* each element denotes a version of the API; existing numbers may not
5931186785SAlexander Duyck  * change; any additions must go at the end
6031186785SAlexander Duyck  */
6131186785SAlexander Duyck enum ixgbe_pfvf_api_rev {
6231186785SAlexander Duyck 	ixgbe_mbox_api_10,	/* API version 1.0, linux/freebsd VF driver */
6331186785SAlexander Duyck 	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
6456e94095SAlexander Duyck 	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
6594cf66f8SVlad Zolotarov 	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
6641e544cdSDon Skidmore 	ixgbe_mbox_api_13,	/* API version 1.3, linux/freebsd VF driver */
67adef9a26SShannon Nelson 	ixgbe_mbox_api_14,	/* API version 1.4, linux/freebsd VF driver */
68339f2896SRadoslaw Tyl 	ixgbe_mbox_api_15,	/* API version 1.5, linux/freebsd VF driver */
6931186785SAlexander Duyck 	/* This value should always be last */
7031186785SAlexander Duyck 	ixgbe_mbox_api_unknown,	/* indicates that API version is not known */
7131186785SAlexander Duyck };
7231186785SAlexander Duyck 
7331186785SAlexander Duyck /* mailbox API, legacy requests */
74dee1ad47SJeff Kirsher #define IXGBE_VF_RESET		0x01 /* VF requests reset */
75dee1ad47SJeff Kirsher #define IXGBE_VF_SET_MAC_ADDR	0x02 /* VF requests PF to set MAC addr */
76dee1ad47SJeff Kirsher #define IXGBE_VF_SET_MULTICAST	0x03 /* VF requests PF to set MC addr */
77dee1ad47SJeff Kirsher #define IXGBE_VF_SET_VLAN	0x04 /* VF requests PF to set VLAN */
7831186785SAlexander Duyck 
7931186785SAlexander Duyck /* mailbox API, version 1.0 VF requests */
80dee1ad47SJeff Kirsher #define IXGBE_VF_SET_LPE	0x05 /* VF requests PF to set VMOLR.LPE */
81dee1ad47SJeff Kirsher #define IXGBE_VF_SET_MACVLAN	0x06 /* VF requests PF for unicast filter */
8231186785SAlexander Duyck #define IXGBE_VF_API_NEGOTIATE	0x08 /* negotiate API version */
83dee1ad47SJeff Kirsher 
8456e94095SAlexander Duyck /* mailbox API, version 1.1 VF requests */
8556e94095SAlexander Duyck #define IXGBE_VF_GET_QUEUE	0x09 /* get queue configuration */
8656e94095SAlexander Duyck 
8756e94095SAlexander Duyck /* GET_QUEUES return data indices within the mailbox */
8856e94095SAlexander Duyck #define IXGBE_VF_TX_QUEUES	1 /* number of Tx queues supported */
8956e94095SAlexander Duyck #define IXGBE_VF_RX_QUEUES	2 /* number of Rx queues supported */
90dec0d8e4SJeff Kirsher #define IXGBE_VF_TRANS_VLAN	3 /* Indication of port VLAN */
9156e94095SAlexander Duyck #define IXGBE_VF_DEF_QUEUE	4 /* Default queue offset */
9256e94095SAlexander Duyck 
9394cf66f8SVlad Zolotarov /* mailbox API, version 1.2 VF requests */
9494cf66f8SVlad Zolotarov #define IXGBE_VF_GET_RETA	0x0a	/* VF request for RETA */
95ad1431e2SVlad Zolotarov #define IXGBE_VF_GET_RSS_KEY	0x0b	/* get RSS hash key */
9694cf66f8SVlad Zolotarov 
978443c1a4SHiroshi Shimamoto #define IXGBE_VF_UPDATE_XCAST_MODE	0x0c
988443c1a4SHiroshi Shimamoto 
99adef9a26SShannon Nelson /* mailbox API, version 1.4 VF requests */
100adef9a26SShannon Nelson #define IXGBE_VF_IPSEC_ADD	0x0d
101adef9a26SShannon Nelson #define IXGBE_VF_IPSEC_DEL	0x0e
102adef9a26SShannon Nelson 
103*443ebdd6SSlawomir Mrozowicz #define IXGBE_VF_GET_LINK_STATE 0x10 /* get vf link state */
104*443ebdd6SSlawomir Mrozowicz 
105dee1ad47SJeff Kirsher /* length of permanent address message returned from PF */
106dee1ad47SJeff Kirsher #define IXGBE_VF_PERMADDR_MSG_LEN	4
107dee1ad47SJeff Kirsher /* word in permanent address message with the current multicast type */
108dee1ad47SJeff Kirsher #define IXGBE_VF_MC_TYPE_WORD		3
109dee1ad47SJeff Kirsher 
110dee1ad47SJeff Kirsher #define IXGBE_PF_CONTROL_MSG		0x0100 /* PF control message */
111dee1ad47SJeff Kirsher 
112dee1ad47SJeff Kirsher #define IXGBE_VF_MBX_INIT_TIMEOUT	2000 /* number of retries on mailbox */
113dee1ad47SJeff Kirsher #define IXGBE_VF_MBX_INIT_DELAY		500  /* microseconds between retries */
114dee1ad47SJeff Kirsher 
115dee1ad47SJeff Kirsher /* forward declaration of the HW struct */
116dee1ad47SJeff Kirsher struct ixgbe_hw;
117dee1ad47SJeff Kirsher 
118dee1ad47SJeff Kirsher #endif /* _IXGBE_MBX_H_ */
119