18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright(c) 2013 - 2018 Intel Corporation. */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _FM10K_MBX_H_
58c2ecf20Sopenharmony_ci#define _FM10K_MBX_H_
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* forward declaration */
88c2ecf20Sopenharmony_cistruct fm10k_mbx_info;
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include "fm10k_type.h"
118c2ecf20Sopenharmony_ci#include "fm10k_tlv.h"
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* PF Mailbox Registers */
148c2ecf20Sopenharmony_ci#define FM10K_MBMEM(_n)		((_n) + 0x18000)
158c2ecf20Sopenharmony_ci#define FM10K_MBMEM_VF(_n, _m)	(((_n) * 0x10) + (_m) + 0x18000)
168c2ecf20Sopenharmony_ci#define FM10K_MBMEM_SM(_n)	((_n) + 0x18400)
178c2ecf20Sopenharmony_ci#define FM10K_MBMEM_PF(_n)	((_n) + 0x18600)
188c2ecf20Sopenharmony_ci/* XOR provides means of switching from Tx to Rx FIFO */
198c2ecf20Sopenharmony_ci#define FM10K_MBMEM_PF_XOR	(FM10K_MBMEM_SM(0) ^ FM10K_MBMEM_PF(0))
208c2ecf20Sopenharmony_ci#define FM10K_MBX(_n)		((_n) + 0x18800)
218c2ecf20Sopenharmony_ci#define FM10K_MBX_REQ				0x00000002
228c2ecf20Sopenharmony_ci#define FM10K_MBX_ACK				0x00000004
238c2ecf20Sopenharmony_ci#define FM10K_MBX_REQ_INTERRUPT			0x00000008
248c2ecf20Sopenharmony_ci#define FM10K_MBX_ACK_INTERRUPT			0x00000010
258c2ecf20Sopenharmony_ci#define FM10K_MBX_INTERRUPT_ENABLE		0x00000020
268c2ecf20Sopenharmony_ci#define FM10K_MBX_INTERRUPT_DISABLE		0x00000040
278c2ecf20Sopenharmony_ci#define FM10K_MBX_GLOBAL_REQ_INTERRUPT		0x00000200
288c2ecf20Sopenharmony_ci#define FM10K_MBX_GLOBAL_ACK_INTERRUPT		0x00000400
298c2ecf20Sopenharmony_ci#define FM10K_MBICR(_n)		((_n) + 0x18840)
308c2ecf20Sopenharmony_ci#define FM10K_GMBX		0x18842
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* VF Mailbox Registers */
338c2ecf20Sopenharmony_ci#define FM10K_VFMBX		0x00010
348c2ecf20Sopenharmony_ci#define FM10K_VFMBMEM(_n)	((_n) + 0x00020)
358c2ecf20Sopenharmony_ci#define FM10K_VFMBMEM_LEN	16
368c2ecf20Sopenharmony_ci#define FM10K_VFMBMEM_VF_XOR	(FM10K_VFMBMEM_LEN / 2)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* Delays/timeouts */
398c2ecf20Sopenharmony_ci#define FM10K_MBX_DISCONNECT_TIMEOUT		500
408c2ecf20Sopenharmony_ci#define FM10K_MBX_POLL_DELAY			19
418c2ecf20Sopenharmony_ci#define FM10K_MBX_INT_DELAY			20
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* PF/VF Mailbox state machine
448c2ecf20Sopenharmony_ci *
458c2ecf20Sopenharmony_ci * +----------+	    connect()	+----------+
468c2ecf20Sopenharmony_ci * |  CLOSED  | --------------> |  CONNECT |
478c2ecf20Sopenharmony_ci * +----------+			+----------+
488c2ecf20Sopenharmony_ci *   ^				  ^	 |
498c2ecf20Sopenharmony_ci *   | rcv:	      rcv:	  |	 | rcv:
508c2ecf20Sopenharmony_ci *   |  Connect	       Disconnect |	 |  Connect
518c2ecf20Sopenharmony_ci *   |  Disconnect     Error	  |	 |  Data
528c2ecf20Sopenharmony_ci *   |				  |	 |
538c2ecf20Sopenharmony_ci *   |				  |	 V
548c2ecf20Sopenharmony_ci * +----------+   disconnect()	+----------+
558c2ecf20Sopenharmony_ci * |DISCONNECT| <-------------- |   OPEN   |
568c2ecf20Sopenharmony_ci * +----------+			+----------+
578c2ecf20Sopenharmony_ci *
588c2ecf20Sopenharmony_ci * The diagram above describes the PF/VF mailbox state machine.  There
598c2ecf20Sopenharmony_ci * are four main states to this machine.
608c2ecf20Sopenharmony_ci * Closed: This state represents a mailbox that is in a standby state
618c2ecf20Sopenharmony_ci *	   with interrupts disabled.  In this state the mailbox should not
628c2ecf20Sopenharmony_ci *	   read the mailbox or write any data.  The only means of exiting
638c2ecf20Sopenharmony_ci *	   this state is for the system to make the connect() call for the
648c2ecf20Sopenharmony_ci *	   mailbox, it will then transition to the connect state.
658c2ecf20Sopenharmony_ci * Connect: In this state the mailbox is seeking a connection.  It will
668c2ecf20Sopenharmony_ci *	    post a connect message with no specified destination and will
678c2ecf20Sopenharmony_ci *	    wait for a reply from the other side of the mailbox.  This state
688c2ecf20Sopenharmony_ci *	    is exited when either a connect with the local mailbox as the
698c2ecf20Sopenharmony_ci *	    destination is received or when a data message is received with
708c2ecf20Sopenharmony_ci *	    a valid sequence number.
718c2ecf20Sopenharmony_ci * Open: In this state the mailbox is able to transfer data between the local
728c2ecf20Sopenharmony_ci *       entity and the remote.  It will fall back to connect in the event of
738c2ecf20Sopenharmony_ci *       receiving either an error message, or a disconnect message.  It will
748c2ecf20Sopenharmony_ci *       transition to disconnect on a call to disconnect();
758c2ecf20Sopenharmony_ci * Disconnect: In this state the mailbox is attempting to gracefully terminate
768c2ecf20Sopenharmony_ci *	       the connection.  It will do so at the first point where it knows
778c2ecf20Sopenharmony_ci *	       that the remote endpoint is either done sending, or when the
788c2ecf20Sopenharmony_ci *	       remote endpoint has fallen back into connect.
798c2ecf20Sopenharmony_ci */
808c2ecf20Sopenharmony_cienum fm10k_mbx_state {
818c2ecf20Sopenharmony_ci	FM10K_STATE_CLOSED,
828c2ecf20Sopenharmony_ci	FM10K_STATE_CONNECT,
838c2ecf20Sopenharmony_ci	FM10K_STATE_OPEN,
848c2ecf20Sopenharmony_ci	FM10K_STATE_DISCONNECT,
858c2ecf20Sopenharmony_ci};
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* PF/VF Mailbox header format
888c2ecf20Sopenharmony_ci *    3			  2		      1			  0
898c2ecf20Sopenharmony_ci *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
908c2ecf20Sopenharmony_ci * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
918c2ecf20Sopenharmony_ci * |        Size/Err_no/CRC        | Rsvd0 | Head  | Tail  | Type  |
928c2ecf20Sopenharmony_ci * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
938c2ecf20Sopenharmony_ci *
948c2ecf20Sopenharmony_ci * The layout above describes the format for the header used in the PF/VF
958c2ecf20Sopenharmony_ci * mailbox.  The header is broken out into the following fields:
968c2ecf20Sopenharmony_ci * Type: There are 4 supported message types
978c2ecf20Sopenharmony_ci *		0x8: Data header - used to transport message data
988c2ecf20Sopenharmony_ci *		0xC: Connect header - used to establish connection
998c2ecf20Sopenharmony_ci *		0xD: Disconnect header - used to tear down a connection
1008c2ecf20Sopenharmony_ci *		0xE: Error header - used to address message exceptions
1018c2ecf20Sopenharmony_ci * Tail: Tail index for local FIFO
1028c2ecf20Sopenharmony_ci *		Tail index actually consists of two parts.  The MSB of
1038c2ecf20Sopenharmony_ci *		the head is a loop tracker, it is 0 on an even numbered
1048c2ecf20Sopenharmony_ci *		loop through the FIFO, and 1 on the odd numbered loops.
1058c2ecf20Sopenharmony_ci *		To get the actual mailbox offset based on the tail it
1068c2ecf20Sopenharmony_ci *		is necessary to add bit 3 to bit 0 and clear bit 3.  This
1078c2ecf20Sopenharmony_ci *		gives us a valid range of 0x1 - 0xE.
1088c2ecf20Sopenharmony_ci * Head: Head index for remote FIFO
1098c2ecf20Sopenharmony_ci *		Head index follows the same format as the tail index.
1108c2ecf20Sopenharmony_ci * Rsvd0: Reserved 0 portion of the mailbox header
1118c2ecf20Sopenharmony_ci * CRC: Running CRC for all data since connect plus current message header
1128c2ecf20Sopenharmony_ci * Size: Maximum message size - Applies only to connect headers
1138c2ecf20Sopenharmony_ci *		The maximum message size is provided during connect to avoid
1148c2ecf20Sopenharmony_ci *		jamming the mailbox with messages that do not fit.
1158c2ecf20Sopenharmony_ci * Err_no: Error number - Applies only to error headers
1168c2ecf20Sopenharmony_ci *		The error number provides an indication of the type of error
1178c2ecf20Sopenharmony_ci *		experienced.
1188c2ecf20Sopenharmony_ci */
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* macros for retrieving and setting header values */
1218c2ecf20Sopenharmony_ci#define FM10K_MSG_HDR_MASK(name) \
1228c2ecf20Sopenharmony_ci	((0x1u << FM10K_MSG_##name##_SIZE) - 1)
1238c2ecf20Sopenharmony_ci#define FM10K_MSG_HDR_FIELD_SET(value, name) \
1248c2ecf20Sopenharmony_ci	(((u32)(value) & FM10K_MSG_HDR_MASK(name)) << FM10K_MSG_##name##_SHIFT)
1258c2ecf20Sopenharmony_ci#define FM10K_MSG_HDR_FIELD_GET(value, name) \
1268c2ecf20Sopenharmony_ci	((u16)((value) >> FM10K_MSG_##name##_SHIFT) & FM10K_MSG_HDR_MASK(name))
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/* offsets shared between all headers */
1298c2ecf20Sopenharmony_ci#define FM10K_MSG_TYPE_SHIFT			0
1308c2ecf20Sopenharmony_ci#define FM10K_MSG_TYPE_SIZE			4
1318c2ecf20Sopenharmony_ci#define FM10K_MSG_TAIL_SHIFT			4
1328c2ecf20Sopenharmony_ci#define FM10K_MSG_TAIL_SIZE			4
1338c2ecf20Sopenharmony_ci#define FM10K_MSG_HEAD_SHIFT			8
1348c2ecf20Sopenharmony_ci#define FM10K_MSG_HEAD_SIZE			4
1358c2ecf20Sopenharmony_ci#define FM10K_MSG_RSVD0_SHIFT			12
1368c2ecf20Sopenharmony_ci#define FM10K_MSG_RSVD0_SIZE			4
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci/* offsets for data/disconnect headers */
1398c2ecf20Sopenharmony_ci#define FM10K_MSG_CRC_SHIFT			16
1408c2ecf20Sopenharmony_ci#define FM10K_MSG_CRC_SIZE			16
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/* offsets for connect headers */
1438c2ecf20Sopenharmony_ci#define FM10K_MSG_CONNECT_SIZE_SHIFT		16
1448c2ecf20Sopenharmony_ci#define FM10K_MSG_CONNECT_SIZE_SIZE		16
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci/* offsets for error headers */
1478c2ecf20Sopenharmony_ci#define FM10K_MSG_ERR_NO_SHIFT			16
1488c2ecf20Sopenharmony_ci#define FM10K_MSG_ERR_NO_SIZE			16
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_cienum fm10k_msg_type {
1518c2ecf20Sopenharmony_ci	FM10K_MSG_DATA			= 0x8,
1528c2ecf20Sopenharmony_ci	FM10K_MSG_CONNECT		= 0xC,
1538c2ecf20Sopenharmony_ci	FM10K_MSG_DISCONNECT		= 0xD,
1548c2ecf20Sopenharmony_ci	FM10K_MSG_ERROR			= 0xE,
1558c2ecf20Sopenharmony_ci};
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* HNI/SM Mailbox FIFO format
1588c2ecf20Sopenharmony_ci *    3                   2                   1                   0
1598c2ecf20Sopenharmony_ci *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
1608c2ecf20Sopenharmony_ci * +-------+-----------------------+-------+-----------------------+
1618c2ecf20Sopenharmony_ci * | Error |      Remote Head      |Version|      Local Tail       |
1628c2ecf20Sopenharmony_ci * +-------+-----------------------+-------+-----------------------+
1638c2ecf20Sopenharmony_ci * |                                                               |
1648c2ecf20Sopenharmony_ci * .                        Local FIFO Data                        .
1658c2ecf20Sopenharmony_ci * .                                                               .
1668c2ecf20Sopenharmony_ci * +-------+-----------------------+-------+-----------------------+
1678c2ecf20Sopenharmony_ci *
1688c2ecf20Sopenharmony_ci * The layout above describes the format for the FIFOs used by the host
1698c2ecf20Sopenharmony_ci * network interface and the switch manager to communicate messages back
1708c2ecf20Sopenharmony_ci * and forth.  Both the HNI and the switch maintain one such FIFO.  The
1718c2ecf20Sopenharmony_ci * layout in memory has the switch manager FIFO followed immediately by
1728c2ecf20Sopenharmony_ci * the HNI FIFO.  For this reason I am using just the pointer to the
1738c2ecf20Sopenharmony_ci * HNI FIFO in the mailbox ops as the offset between the two is fixed.
1748c2ecf20Sopenharmony_ci *
1758c2ecf20Sopenharmony_ci * The header for the FIFO is broken out into the following fields:
1768c2ecf20Sopenharmony_ci * Local Tail:  Offset into FIFO region for next DWORD to write.
1778c2ecf20Sopenharmony_ci * Version:  Version info for mailbox, only values of 0/1 are supported.
1788c2ecf20Sopenharmony_ci * Remote Head:  Offset into remote FIFO to indicate how much we have read.
1798c2ecf20Sopenharmony_ci * Error: Error indication, values TBD.
1808c2ecf20Sopenharmony_ci */
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci/* version number for switch manager mailboxes */
1838c2ecf20Sopenharmony_ci#define FM10K_SM_MBX_VERSION		1
1848c2ecf20Sopenharmony_ci#define FM10K_SM_MBX_FIFO_LEN		(FM10K_MBMEM_PF_XOR - 1)
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/* offsets shared between all SM FIFO headers */
1878c2ecf20Sopenharmony_ci#define FM10K_MSG_SM_TAIL_SHIFT			0
1888c2ecf20Sopenharmony_ci#define FM10K_MSG_SM_TAIL_SIZE			12
1898c2ecf20Sopenharmony_ci#define FM10K_MSG_SM_VER_SHIFT			12
1908c2ecf20Sopenharmony_ci#define FM10K_MSG_SM_VER_SIZE			4
1918c2ecf20Sopenharmony_ci#define FM10K_MSG_SM_HEAD_SHIFT			16
1928c2ecf20Sopenharmony_ci#define FM10K_MSG_SM_HEAD_SIZE			12
1938c2ecf20Sopenharmony_ci#define FM10K_MSG_SM_ERR_SHIFT			28
1948c2ecf20Sopenharmony_ci#define FM10K_MSG_SM_ERR_SIZE			4
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci/* All error messages returned by mailbox functions
1978c2ecf20Sopenharmony_ci * The value -511 is 0xFE01 in hex.  The idea is to order the errors
1988c2ecf20Sopenharmony_ci * from 0xFE01 - 0xFEFF so error codes are easily visible in the mailbox
1998c2ecf20Sopenharmony_ci * messages.  This also helps to avoid error number collisions as Linux
2008c2ecf20Sopenharmony_ci * doesn't appear to use error numbers 256 - 511.
2018c2ecf20Sopenharmony_ci */
2028c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR(_n) ((_n) - 512)
2038c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_NO_MBX		FM10K_MBX_ERR(0x01)
2048c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_NO_SPACE		FM10K_MBX_ERR(0x03)
2058c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_TAIL		FM10K_MBX_ERR(0x05)
2068c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_HEAD		FM10K_MBX_ERR(0x06)
2078c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_SRC		FM10K_MBX_ERR(0x08)
2088c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_TYPE		FM10K_MBX_ERR(0x09)
2098c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_SIZE		FM10K_MBX_ERR(0x0B)
2108c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_BUSY		FM10K_MBX_ERR(0x0C)
2118c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_RSVD0		FM10K_MBX_ERR(0x0E)
2128c2ecf20Sopenharmony_ci#define FM10K_MBX_ERR_CRC		FM10K_MBX_ERR(0x0F)
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci#define FM10K_MBX_CRC_SEED		0xFFFF
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_cistruct fm10k_mbx_ops {
2178c2ecf20Sopenharmony_ci	s32 (*connect)(struct fm10k_hw *, struct fm10k_mbx_info *);
2188c2ecf20Sopenharmony_ci	void (*disconnect)(struct fm10k_hw *, struct fm10k_mbx_info *);
2198c2ecf20Sopenharmony_ci	bool (*rx_ready)(struct fm10k_mbx_info *);
2208c2ecf20Sopenharmony_ci	bool (*tx_ready)(struct fm10k_mbx_info *, u16);
2218c2ecf20Sopenharmony_ci	bool (*tx_complete)(struct fm10k_mbx_info *);
2228c2ecf20Sopenharmony_ci	s32 (*enqueue_tx)(struct fm10k_hw *, struct fm10k_mbx_info *,
2238c2ecf20Sopenharmony_ci			  const u32 *);
2248c2ecf20Sopenharmony_ci	s32 (*process)(struct fm10k_hw *, struct fm10k_mbx_info *);
2258c2ecf20Sopenharmony_ci	s32 (*register_handlers)(struct fm10k_mbx_info *,
2268c2ecf20Sopenharmony_ci				 const struct fm10k_msg_data *);
2278c2ecf20Sopenharmony_ci};
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_cistruct fm10k_mbx_fifo {
2308c2ecf20Sopenharmony_ci	u32 *buffer;
2318c2ecf20Sopenharmony_ci	u16 head;
2328c2ecf20Sopenharmony_ci	u16 tail;
2338c2ecf20Sopenharmony_ci	u16 size;
2348c2ecf20Sopenharmony_ci};
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci/* size of buffer to be stored in mailbox for FIFOs */
2378c2ecf20Sopenharmony_ci#define FM10K_MBX_TX_BUFFER_SIZE	512
2388c2ecf20Sopenharmony_ci#define FM10K_MBX_RX_BUFFER_SIZE	128
2398c2ecf20Sopenharmony_ci#define FM10K_MBX_BUFFER_SIZE \
2408c2ecf20Sopenharmony_ci	(FM10K_MBX_TX_BUFFER_SIZE + FM10K_MBX_RX_BUFFER_SIZE)
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci/* minimum and maximum message size in dwords */
2438c2ecf20Sopenharmony_ci#define FM10K_MBX_MSG_MAX_SIZE \
2448c2ecf20Sopenharmony_ci	((FM10K_MBX_TX_BUFFER_SIZE - 1) & (FM10K_MBX_RX_BUFFER_SIZE - 1))
2458c2ecf20Sopenharmony_ci#define FM10K_VFMBX_MSG_MTU	((FM10K_VFMBMEM_LEN / 2) - 1)
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci#define FM10K_MBX_INIT_TIMEOUT	2000 /* number of retries on mailbox */
2488c2ecf20Sopenharmony_ci#define FM10K_MBX_INIT_DELAY	500  /* microseconds between retries */
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_cistruct fm10k_mbx_info {
2518c2ecf20Sopenharmony_ci	/* function pointers for mailbox operations */
2528c2ecf20Sopenharmony_ci	struct fm10k_mbx_ops ops;
2538c2ecf20Sopenharmony_ci	const struct fm10k_msg_data *msg_data;
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci	/* message FIFOs */
2568c2ecf20Sopenharmony_ci	struct fm10k_mbx_fifo rx;
2578c2ecf20Sopenharmony_ci	struct fm10k_mbx_fifo tx;
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci	/* delay for handling timeouts */
2608c2ecf20Sopenharmony_ci	u32 timeout;
2618c2ecf20Sopenharmony_ci	u32 udelay;
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	/* mailbox state info */
2648c2ecf20Sopenharmony_ci	u32 mbx_reg, mbmem_reg, mbx_lock, mbx_hdr;
2658c2ecf20Sopenharmony_ci	u16 max_size, mbmem_len;
2668c2ecf20Sopenharmony_ci	u16 tail, tail_len, pulled;
2678c2ecf20Sopenharmony_ci	u16 head, head_len, pushed;
2688c2ecf20Sopenharmony_ci	u16 local, remote;
2698c2ecf20Sopenharmony_ci	enum fm10k_mbx_state state;
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	/* result of last mailbox test */
2728c2ecf20Sopenharmony_ci	s32 test_result;
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci	/* statistics */
2758c2ecf20Sopenharmony_ci	u64 tx_busy;
2768c2ecf20Sopenharmony_ci	u64 tx_dropped;
2778c2ecf20Sopenharmony_ci	u64 tx_messages;
2788c2ecf20Sopenharmony_ci	u64 tx_dwords;
2798c2ecf20Sopenharmony_ci	u64 tx_mbmem_pulled;
2808c2ecf20Sopenharmony_ci	u64 rx_messages;
2818c2ecf20Sopenharmony_ci	u64 rx_dwords;
2828c2ecf20Sopenharmony_ci	u64 rx_mbmem_pushed;
2838c2ecf20Sopenharmony_ci	u64 rx_parse_err;
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci	/* Buffer to store messages */
2868c2ecf20Sopenharmony_ci	u32 buffer[FM10K_MBX_BUFFER_SIZE];
2878c2ecf20Sopenharmony_ci};
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_cis32 fm10k_pfvf_mbx_init(struct fm10k_hw *, struct fm10k_mbx_info *,
2908c2ecf20Sopenharmony_ci			const struct fm10k_msg_data *, u8);
2918c2ecf20Sopenharmony_cis32 fm10k_sm_mbx_init(struct fm10k_hw *, struct fm10k_mbx_info *,
2928c2ecf20Sopenharmony_ci		      const struct fm10k_msg_data *);
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci#endif /* _FM10K_MBX_H_ */
295