18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __MYRI10GE_MCP_H__
38c2ecf20Sopenharmony_ci#define __MYRI10GE_MCP_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define MXGEFW_VERSION_MAJOR	1
68c2ecf20Sopenharmony_ci#define MXGEFW_VERSION_MINOR	4
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/* 8 Bytes */
98c2ecf20Sopenharmony_cistruct mcp_dma_addr {
108c2ecf20Sopenharmony_ci	__be32 high;
118c2ecf20Sopenharmony_ci	__be32 low;
128c2ecf20Sopenharmony_ci};
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* 4 Bytes */
158c2ecf20Sopenharmony_cistruct mcp_slot {
168c2ecf20Sopenharmony_ci	__sum16 checksum;
178c2ecf20Sopenharmony_ci	__be16 length;
188c2ecf20Sopenharmony_ci};
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* 64 Bytes */
218c2ecf20Sopenharmony_cistruct mcp_cmd {
228c2ecf20Sopenharmony_ci	__be32 cmd;
238c2ecf20Sopenharmony_ci	__be32 data0;		/* will be low portion if data > 32 bits */
248c2ecf20Sopenharmony_ci	/* 8 */
258c2ecf20Sopenharmony_ci	__be32 data1;		/* will be high portion if data > 32 bits */
268c2ecf20Sopenharmony_ci	__be32 data2;		/* currently unused.. */
278c2ecf20Sopenharmony_ci	/* 16 */
288c2ecf20Sopenharmony_ci	struct mcp_dma_addr response_addr;
298c2ecf20Sopenharmony_ci	/* 24 */
308c2ecf20Sopenharmony_ci	u8 pad[40];
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* 8 Bytes */
348c2ecf20Sopenharmony_cistruct mcp_cmd_response {
358c2ecf20Sopenharmony_ci	__be32 data;
368c2ecf20Sopenharmony_ci	__be32 result;
378c2ecf20Sopenharmony_ci};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/*
408c2ecf20Sopenharmony_ci * flags used in mcp_kreq_ether_send_t:
418c2ecf20Sopenharmony_ci *
428c2ecf20Sopenharmony_ci * The SMALL flag is only needed in the first segment. It is raised
438c2ecf20Sopenharmony_ci * for packets that are total less or equal 512 bytes.
448c2ecf20Sopenharmony_ci *
458c2ecf20Sopenharmony_ci * The CKSUM flag must be set in all segments.
468c2ecf20Sopenharmony_ci *
478c2ecf20Sopenharmony_ci * The PADDED flags is set if the packet needs to be padded, and it
488c2ecf20Sopenharmony_ci * must be set for all segments.
498c2ecf20Sopenharmony_ci *
508c2ecf20Sopenharmony_ci * The  MXGEFW_FLAGS_ALIGN_ODD must be set if the cumulative
518c2ecf20Sopenharmony_ci * length of all previous segments was odd.
528c2ecf20Sopenharmony_ci */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_SMALL      0x1
558c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_TSO_HDR    0x1
568c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_FIRST      0x2
578c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_ALIGN_ODD  0x4
588c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_CKSUM      0x8
598c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_TSO_LAST   0x8
608c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_NO_TSO     0x10
618c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_TSO_CHOP   0x10
628c2ecf20Sopenharmony_ci#define MXGEFW_FLAGS_TSO_PLD    0x20
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define MXGEFW_SEND_SMALL_SIZE  1520
658c2ecf20Sopenharmony_ci#define MXGEFW_MAX_MTU          9400
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ciunion mcp_pso_or_cumlen {
688c2ecf20Sopenharmony_ci	u16 pseudo_hdr_offset;
698c2ecf20Sopenharmony_ci	u16 cum_len;
708c2ecf20Sopenharmony_ci};
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define	MXGEFW_MAX_SEND_DESC 12
738c2ecf20Sopenharmony_ci#define MXGEFW_PAD	    2
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* 16 Bytes */
768c2ecf20Sopenharmony_cistruct mcp_kreq_ether_send {
778c2ecf20Sopenharmony_ci	__be32 addr_high;
788c2ecf20Sopenharmony_ci	__be32 addr_low;
798c2ecf20Sopenharmony_ci	__be16 pseudo_hdr_offset;
808c2ecf20Sopenharmony_ci	__be16 length;
818c2ecf20Sopenharmony_ci	u8 pad;
828c2ecf20Sopenharmony_ci	u8 rdma_count;
838c2ecf20Sopenharmony_ci	u8 cksum_offset;	/* where to start computing cksum */
848c2ecf20Sopenharmony_ci	u8 flags;		/* as defined above */
858c2ecf20Sopenharmony_ci};
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* 8 Bytes */
888c2ecf20Sopenharmony_cistruct mcp_kreq_ether_recv {
898c2ecf20Sopenharmony_ci	__be32 addr_high;
908c2ecf20Sopenharmony_ci	__be32 addr_low;
918c2ecf20Sopenharmony_ci};
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/* Commands */
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci#define	MXGEFW_BOOT_HANDOFF	0xfc0000
968c2ecf20Sopenharmony_ci#define	MXGEFW_BOOT_DUMMY_RDMA	0xfc01c0
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_CMD		0xf80000
998c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_SEND_4	0x200000
1008c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_SEND_1	0x240000
1018c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_SEND_2	0x280000
1028c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_SEND_3	0x2c0000
1038c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_RECV_SMALL	0x300000
1048c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_RECV_BIG	0x340000
1058c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_SEND_GO	0x380000
1068c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_SEND_STOP	0x3C0000
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_SEND(n)		(0x200000 + (((n) & 0x03) * 0x40000))
1098c2ecf20Sopenharmony_ci#define	MXGEFW_ETH_SEND_OFFSET(n)	(MXGEFW_ETH_SEND(n) - MXGEFW_ETH_SEND_4)
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_cienum myri10ge_mcp_cmd_type {
1128c2ecf20Sopenharmony_ci	MXGEFW_CMD_NONE = 0,
1138c2ecf20Sopenharmony_ci	/* Reset the mcp, it is left in a safe state, waiting
1148c2ecf20Sopenharmony_ci	 * for the driver to set all its parameters */
1158c2ecf20Sopenharmony_ci	MXGEFW_CMD_RESET = 1,
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci	/* get the version number of the current firmware..
1188c2ecf20Sopenharmony_ci	 * (may be available in the eeprom strings..? */
1198c2ecf20Sopenharmony_ci	MXGEFW_GET_MCP_VERSION = 2,
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci	/* Parameters which must be set by the driver before it can
1228c2ecf20Sopenharmony_ci	 * issue MXGEFW_CMD_ETHERNET_UP. They persist until the next
1238c2ecf20Sopenharmony_ci	 * MXGEFW_CMD_RESET is issued */
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_INTRQ_DMA = 3,
1268c2ecf20Sopenharmony_ci	/* data0 = LSW of the host address
1278c2ecf20Sopenharmony_ci	 * data1 = MSW of the host address
1288c2ecf20Sopenharmony_ci	 * data2 = slice number if multiple slices are used
1298c2ecf20Sopenharmony_ci	 */
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_BIG_BUFFER_SIZE = 4,	/* in bytes, power of 2 */
1328c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_SMALL_BUFFER_SIZE = 5,	/* in bytes */
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci	/* Parameters which refer to lanai SRAM addresses where the
1358c2ecf20Sopenharmony_ci	 * driver must issue PIO writes for various things */
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_SEND_OFFSET = 6,
1388c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_SMALL_RX_OFFSET = 7,
1398c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_BIG_RX_OFFSET = 8,
1408c2ecf20Sopenharmony_ci	/* data0 = slice number if multiple slices are used */
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_IRQ_ACK_OFFSET = 9,
1438c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET = 10,
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci	/* Parameters which refer to rings stored on the MCP,
1468c2ecf20Sopenharmony_ci	 * and whose size is controlled by the mcp */
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_SEND_RING_SIZE = 11,	/* in bytes */
1498c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_RX_RING_SIZE = 12,	/* in bytes */
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci	/* Parameters which refer to rings stored in the host,
1528c2ecf20Sopenharmony_ci	 * and whose size is controlled by the host.  Note that
1538c2ecf20Sopenharmony_ci	 * all must be physically contiguous and must contain
1548c2ecf20Sopenharmony_ci	 * a power of 2 number of entries.  */
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_INTRQ_SIZE = 13,	/* in bytes */
1578c2ecf20Sopenharmony_ci#define MXGEFW_CMD_SET_INTRQ_SIZE_FLAG_NO_STRICT_SIZE_CHECK  (1 << 31)
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci	/* command to bring ethernet interface up.  Above parameters
1608c2ecf20Sopenharmony_ci	 * (plus mtu & mac address) must have been exchanged prior
1618c2ecf20Sopenharmony_ci	 * to issuing this command  */
1628c2ecf20Sopenharmony_ci	MXGEFW_CMD_ETHERNET_UP = 14,
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci	/* command to bring ethernet interface down.  No further sends
1658c2ecf20Sopenharmony_ci	 * or receives may be processed until an MXGEFW_CMD_ETHERNET_UP
1668c2ecf20Sopenharmony_ci	 * is issued, and all interrupt queues must be flushed prior
1678c2ecf20Sopenharmony_ci	 * to ack'ing this command */
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci	MXGEFW_CMD_ETHERNET_DOWN = 15,
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci	/* commands the driver may issue live, without resetting
1728c2ecf20Sopenharmony_ci	 * the nic.  Note that increasing the mtu "live" should
1738c2ecf20Sopenharmony_ci	 * only be done if the driver has already supplied buffers
1748c2ecf20Sopenharmony_ci	 * sufficiently large to handle the new mtu.  Decreasing
1758c2ecf20Sopenharmony_ci	 * the mtu live is safe */
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_MTU = 16,
1788c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET = 17,	/* in microseconds */
1798c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_STATS_INTERVAL = 18,	/* in microseconds */
1808c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_STATS_DMA_OBSOLETE = 19,	/* replaced by SET_STATS_DMA_V2 */
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	MXGEFW_ENABLE_PROMISC = 20,
1838c2ecf20Sopenharmony_ci	MXGEFW_DISABLE_PROMISC = 21,
1848c2ecf20Sopenharmony_ci	MXGEFW_SET_MAC_ADDRESS = 22,
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci	MXGEFW_ENABLE_FLOW_CONTROL = 23,
1878c2ecf20Sopenharmony_ci	MXGEFW_DISABLE_FLOW_CONTROL = 24,
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci	/* do a DMA test
1908c2ecf20Sopenharmony_ci	 * data0,data1 = DMA address
1918c2ecf20Sopenharmony_ci	 * data2       = RDMA length (MSH), WDMA length (LSH)
1928c2ecf20Sopenharmony_ci	 * command return data = repetitions (MSH), 0.5-ms ticks (LSH)
1938c2ecf20Sopenharmony_ci	 */
1948c2ecf20Sopenharmony_ci	MXGEFW_DMA_TEST = 25,
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci	MXGEFW_ENABLE_ALLMULTI = 26,
1978c2ecf20Sopenharmony_ci	MXGEFW_DISABLE_ALLMULTI = 27,
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci	/* returns MXGEFW_CMD_ERROR_MULTICAST
2008c2ecf20Sopenharmony_ci	 * if there is no room in the cache
2018c2ecf20Sopenharmony_ci	 * data0,MSH(data1) = multicast group address */
2028c2ecf20Sopenharmony_ci	MXGEFW_JOIN_MULTICAST_GROUP = 28,
2038c2ecf20Sopenharmony_ci	/* returns MXGEFW_CMD_ERROR_MULTICAST
2048c2ecf20Sopenharmony_ci	 * if the address is not in the cache,
2058c2ecf20Sopenharmony_ci	 * or is equal to FF-FF-FF-FF-FF-FF
2068c2ecf20Sopenharmony_ci	 * data0,MSH(data1) = multicast group address */
2078c2ecf20Sopenharmony_ci	MXGEFW_LEAVE_MULTICAST_GROUP = 29,
2088c2ecf20Sopenharmony_ci	MXGEFW_LEAVE_ALL_MULTICAST_GROUPS = 30,
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_STATS_DMA_V2 = 31,
2118c2ecf20Sopenharmony_ci	/* data0, data1 = bus addr,
2128c2ecf20Sopenharmony_ci	 * data2 = sizeof(struct mcp_irq_data) from driver point of view, allows
2138c2ecf20Sopenharmony_ci	 * adding new stuff to mcp_irq_data without changing the ABI
2148c2ecf20Sopenharmony_ci	 *
2158c2ecf20Sopenharmony_ci	 * If multiple slices are used, data2 contains both the size of the
2168c2ecf20Sopenharmony_ci	 * structure (in the lower 16 bits) and the slice number
2178c2ecf20Sopenharmony_ci	 * (in the upper 16 bits).
2188c2ecf20Sopenharmony_ci	 */
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci	MXGEFW_CMD_UNALIGNED_TEST = 32,
2218c2ecf20Sopenharmony_ci	/* same than DMA_TEST (same args) but abort with UNALIGNED on unaligned
2228c2ecf20Sopenharmony_ci	 * chipset */
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	MXGEFW_CMD_UNALIGNED_STATUS = 33,
2258c2ecf20Sopenharmony_ci	/* return data = boolean, true if the chipset is known to be unaligned */
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci	MXGEFW_CMD_ALWAYS_USE_N_BIG_BUFFERS = 34,
2288c2ecf20Sopenharmony_ci	/* data0 = number of big buffers to use.  It must be 0 or a power of 2.
2298c2ecf20Sopenharmony_ci	 * 0 indicates that the NIC consumes as many buffers as they are required
2308c2ecf20Sopenharmony_ci	 * for packet. This is the default behavior.
2318c2ecf20Sopenharmony_ci	 * A power of 2 number indicates that the NIC always uses the specified
2328c2ecf20Sopenharmony_ci	 * number of buffers for each big receive packet.
2338c2ecf20Sopenharmony_ci	 * It is up to the driver to ensure that this value is big enough for
2348c2ecf20Sopenharmony_ci	 * the NIC to be able to receive maximum-sized packets.
2358c2ecf20Sopenharmony_ci	 */
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_MAX_RSS_QUEUES = 35,
2388c2ecf20Sopenharmony_ci	MXGEFW_CMD_ENABLE_RSS_QUEUES = 36,
2398c2ecf20Sopenharmony_ci	/* data0 = number of slices n (0, 1, ..., n-1) to enable
2408c2ecf20Sopenharmony_ci	 * data1 = interrupt mode | use of multiple transmit queues.
2418c2ecf20Sopenharmony_ci	 * 0=share one INTx/MSI.
2428c2ecf20Sopenharmony_ci	 * 1=use one MSI-X per queue.
2438c2ecf20Sopenharmony_ci	 * If all queues share one interrupt, the driver must have set
2448c2ecf20Sopenharmony_ci	 * RSS_SHARED_INTERRUPT_DMA before enabling queues.
2458c2ecf20Sopenharmony_ci	 * 2=enable both receive and send queues.
2468c2ecf20Sopenharmony_ci	 * Without this bit set, only one send queue (slice 0's send queue)
2478c2ecf20Sopenharmony_ci	 * is enabled.  The receive queues are always enabled.
2488c2ecf20Sopenharmony_ci	 */
2498c2ecf20Sopenharmony_ci#define MXGEFW_SLICE_INTR_MODE_SHARED          0x0
2508c2ecf20Sopenharmony_ci#define MXGEFW_SLICE_INTR_MODE_ONE_PER_SLICE   0x1
2518c2ecf20Sopenharmony_ci#define MXGEFW_SLICE_ENABLE_MULTIPLE_TX_QUEUES 0x2
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_RSS_SHARED_INTERRUPT_MASK_OFFSET = 37,
2548c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_RSS_SHARED_INTERRUPT_DMA = 38,
2558c2ecf20Sopenharmony_ci	/* data0, data1 = bus address lsw, msw */
2568c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_RSS_TABLE_OFFSET = 39,
2578c2ecf20Sopenharmony_ci	/* get the offset of the indirection table */
2588c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_RSS_TABLE_SIZE = 40,
2598c2ecf20Sopenharmony_ci	/* set the size of the indirection table */
2608c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_RSS_KEY_OFFSET = 41,
2618c2ecf20Sopenharmony_ci	/* get the offset of the secret key */
2628c2ecf20Sopenharmony_ci	MXGEFW_CMD_RSS_KEY_UPDATED = 42,
2638c2ecf20Sopenharmony_ci	/* tell nic that the secret key's been updated */
2648c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_RSS_ENABLE = 43,
2658c2ecf20Sopenharmony_ci	/* data0 = enable/disable rss
2668c2ecf20Sopenharmony_ci	 * 0: disable rss.  nic does not distribute receive packets.
2678c2ecf20Sopenharmony_ci	 * 1: enable rss.  nic distributes receive packets among queues.
2688c2ecf20Sopenharmony_ci	 * data1 = hash type
2698c2ecf20Sopenharmony_ci	 * 1: IPV4            (required by RSS)
2708c2ecf20Sopenharmony_ci	 * 2: TCP_IPV4        (required by RSS)
2718c2ecf20Sopenharmony_ci	 * 3: IPV4 | TCP_IPV4 (required by RSS)
2728c2ecf20Sopenharmony_ci	 * 4: source port
2738c2ecf20Sopenharmony_ci	 * 5: source port + destination port
2748c2ecf20Sopenharmony_ci	 */
2758c2ecf20Sopenharmony_ci#define MXGEFW_RSS_HASH_TYPE_IPV4      0x1
2768c2ecf20Sopenharmony_ci#define MXGEFW_RSS_HASH_TYPE_TCP_IPV4  0x2
2778c2ecf20Sopenharmony_ci#define MXGEFW_RSS_HASH_TYPE_SRC_PORT  0x4
2788c2ecf20Sopenharmony_ci#define MXGEFW_RSS_HASH_TYPE_SRC_DST_PORT 0x5
2798c2ecf20Sopenharmony_ci#define MXGEFW_RSS_HASH_TYPE_MAX 0x5
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE = 44,
2828c2ecf20Sopenharmony_ci	/* Return data = the max. size of the entire headers of a IPv6 TSO packet.
2838c2ecf20Sopenharmony_ci	 * If the header size of a IPv6 TSO packet is larger than the specified
2848c2ecf20Sopenharmony_ci	 * value, then the driver must not use TSO.
2858c2ecf20Sopenharmony_ci	 * This size restriction only applies to IPv6 TSO.
2868c2ecf20Sopenharmony_ci	 * For IPv4 TSO, the maximum size of the headers is fixed, and the NIC
2878c2ecf20Sopenharmony_ci	 * always has enough header buffer to store maximum-sized headers.
2888c2ecf20Sopenharmony_ci	 */
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_TSO_MODE = 45,
2918c2ecf20Sopenharmony_ci	/* data0 = TSO mode.
2928c2ecf20Sopenharmony_ci	 * 0: Linux/FreeBSD style (NIC default)
2938c2ecf20Sopenharmony_ci	 * 1: NDIS/NetBSD style
2948c2ecf20Sopenharmony_ci	 */
2958c2ecf20Sopenharmony_ci#define MXGEFW_TSO_MODE_LINUX  0
2968c2ecf20Sopenharmony_ci#define MXGEFW_TSO_MODE_NDIS   1
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	MXGEFW_CMD_MDIO_READ = 46,
2998c2ecf20Sopenharmony_ci	/* data0 = dev_addr (PMA/PMD or PCS ...), data1 = register/addr */
3008c2ecf20Sopenharmony_ci	MXGEFW_CMD_MDIO_WRITE = 47,
3018c2ecf20Sopenharmony_ci	/* data0 = dev_addr,  data1 = register/addr, data2 = value  */
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	MXGEFW_CMD_I2C_READ = 48,
3048c2ecf20Sopenharmony_ci	/* Starts to get a fresh copy of one byte or of the module i2c table, the
3058c2ecf20Sopenharmony_ci	 * obtained data is cached inside the xaui-xfi chip :
3068c2ecf20Sopenharmony_ci	 *   data0 :  0 => get one byte, 1=> get 256 bytes
3078c2ecf20Sopenharmony_ci	 *   data1 :  If data0 == 0: location to refresh
3088c2ecf20Sopenharmony_ci	 *               bit 7:0  register location
3098c2ecf20Sopenharmony_ci	 *               bit 8:15 is the i2c slave addr (0 is interpreted as 0xA1)
3108c2ecf20Sopenharmony_ci	 *               bit 23:16 is the i2c bus number (for multi-port NICs)
3118c2ecf20Sopenharmony_ci	 *            If data0 == 1: unused
3128c2ecf20Sopenharmony_ci	 * The operation might take ~1ms for a single byte or ~65ms when refreshing all 256 bytes
3138c2ecf20Sopenharmony_ci	 * During the i2c operation,  MXGEFW_CMD_I2C_READ or MXGEFW_CMD_I2C_BYTE attempts
3148c2ecf20Sopenharmony_ci	 *  will return MXGEFW_CMD_ERROR_BUSY
3158c2ecf20Sopenharmony_ci	 */
3168c2ecf20Sopenharmony_ci	MXGEFW_CMD_I2C_BYTE = 49,
3178c2ecf20Sopenharmony_ci	/* Return the last obtained copy of a given byte in the xfp i2c table
3188c2ecf20Sopenharmony_ci	 * (copy cached during the last relevant MXGEFW_CMD_I2C_READ)
3198c2ecf20Sopenharmony_ci	 *   data0 : index of the desired table entry
3208c2ecf20Sopenharmony_ci	 *  Return data = the byte stored at the requested index in the table
3218c2ecf20Sopenharmony_ci	 */
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_VPUMP_OFFSET = 50,
3248c2ecf20Sopenharmony_ci	/* Return data = NIC memory offset of mcp_vpump_public_global */
3258c2ecf20Sopenharmony_ci	MXGEFW_CMD_RESET_VPUMP = 51,
3268c2ecf20Sopenharmony_ci	/* Resets the VPUMP state */
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_RSS_MCP_SLOT_TYPE = 52,
3298c2ecf20Sopenharmony_ci	/* data0 = mcp_slot type to use.
3308c2ecf20Sopenharmony_ci	 * 0 = the default 4B mcp_slot
3318c2ecf20Sopenharmony_ci	 * 1 = 8B mcp_slot_8
3328c2ecf20Sopenharmony_ci	 */
3338c2ecf20Sopenharmony_ci#define MXGEFW_RSS_MCP_SLOT_TYPE_MIN        0
3348c2ecf20Sopenharmony_ci#define MXGEFW_RSS_MCP_SLOT_TYPE_WITH_HASH  1
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci	MXGEFW_CMD_SET_THROTTLE_FACTOR = 53,
3378c2ecf20Sopenharmony_ci	/* set the throttle factor for ethp_z8e
3388c2ecf20Sopenharmony_ci	 * data0 = throttle_factor
3398c2ecf20Sopenharmony_ci	 * throttle_factor = 256 * pcie-raw-speed / tx_speed
3408c2ecf20Sopenharmony_ci	 * tx_speed = 256 * pcie-raw-speed / throttle_factor
3418c2ecf20Sopenharmony_ci	 *
3428c2ecf20Sopenharmony_ci	 * For PCI-E x8: pcie-raw-speed == 16Gb/s
3438c2ecf20Sopenharmony_ci	 * For PCI-E x4: pcie-raw-speed == 8Gb/s
3448c2ecf20Sopenharmony_ci	 *
3458c2ecf20Sopenharmony_ci	 * ex1: throttle_factor == 0x1a0 (416), tx_speed == 1.23GB/s == 9.846 Gb/s
3468c2ecf20Sopenharmony_ci	 * ex2: throttle_factor == 0x200 (512), tx_speed == 1.0GB/s == 8 Gb/s
3478c2ecf20Sopenharmony_ci	 *
3488c2ecf20Sopenharmony_ci	 * with tx_boundary == 2048, max-throttle-factor == 8191 => min-speed == 500Mb/s
3498c2ecf20Sopenharmony_ci	 * with tx_boundary == 4096, max-throttle-factor == 4095 => min-speed == 1Gb/s
3508c2ecf20Sopenharmony_ci	 */
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci	MXGEFW_CMD_VPUMP_UP = 54,
3538c2ecf20Sopenharmony_ci	/* Allocates VPump Connection, Send Request and Zero copy buffer address tables */
3548c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_VPUMP_CLK = 55,
3558c2ecf20Sopenharmony_ci	/* Get the lanai clock */
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci	MXGEFW_CMD_GET_DCA_OFFSET = 56,
3588c2ecf20Sopenharmony_ci	/* offset of dca control for WDMAs */
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci	/* VMware NetQueue commands */
3618c2ecf20Sopenharmony_ci	MXGEFW_CMD_NETQ_GET_FILTERS_PER_QUEUE = 57,
3628c2ecf20Sopenharmony_ci	MXGEFW_CMD_NETQ_ADD_FILTER = 58,
3638c2ecf20Sopenharmony_ci	/* data0 = filter_id << 16 | queue << 8 | type */
3648c2ecf20Sopenharmony_ci	/* data1 = MS4 of MAC Addr */
3658c2ecf20Sopenharmony_ci	/* data2 = LS2_MAC << 16 | VLAN_tag */
3668c2ecf20Sopenharmony_ci	MXGEFW_CMD_NETQ_DEL_FILTER = 59,
3678c2ecf20Sopenharmony_ci	/* data0 = filter_id */
3688c2ecf20Sopenharmony_ci	MXGEFW_CMD_NETQ_QUERY1 = 60,
3698c2ecf20Sopenharmony_ci	MXGEFW_CMD_NETQ_QUERY2 = 61,
3708c2ecf20Sopenharmony_ci	MXGEFW_CMD_NETQ_QUERY3 = 62,
3718c2ecf20Sopenharmony_ci	MXGEFW_CMD_NETQ_QUERY4 = 63,
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci	MXGEFW_CMD_RELAX_RXBUFFER_ALIGNMENT = 64,
3748c2ecf20Sopenharmony_ci	/* When set, small receive buffers can cross page boundaries.
3758c2ecf20Sopenharmony_ci	 * Both small and big receive buffers may start at any address.
3768c2ecf20Sopenharmony_ci	 * This option has performance implications, so use with caution.
3778c2ecf20Sopenharmony_ci	 */
3788c2ecf20Sopenharmony_ci};
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_cienum myri10ge_mcp_cmd_status {
3818c2ecf20Sopenharmony_ci	MXGEFW_CMD_OK = 0,
3828c2ecf20Sopenharmony_ci	MXGEFW_CMD_UNKNOWN = 1,
3838c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_RANGE = 2,
3848c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_BUSY = 3,
3858c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_EMPTY = 4,
3868c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_CLOSED = 5,
3878c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_HASH_ERROR = 6,
3888c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_BAD_PORT = 7,
3898c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_RESOURCES = 8,
3908c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_MULTICAST = 9,
3918c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_UNALIGNED = 10,
3928c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_NO_MDIO = 11,
3938c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_I2C_FAILURE = 12,
3948c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_I2C_ABSENT = 13,
3958c2ecf20Sopenharmony_ci	MXGEFW_CMD_ERROR_BAD_PCIE_LINK = 14
3968c2ecf20Sopenharmony_ci};
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci#define MXGEFW_OLD_IRQ_DATA_LEN 40
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_cistruct mcp_irq_data {
4018c2ecf20Sopenharmony_ci	/* add new counters at the beginning */
4028c2ecf20Sopenharmony_ci	__be32 future_use[1];
4038c2ecf20Sopenharmony_ci	__be32 dropped_pause;
4048c2ecf20Sopenharmony_ci	__be32 dropped_unicast_filtered;
4058c2ecf20Sopenharmony_ci	__be32 dropped_bad_crc32;
4068c2ecf20Sopenharmony_ci	__be32 dropped_bad_phy;
4078c2ecf20Sopenharmony_ci	__be32 dropped_multicast_filtered;
4088c2ecf20Sopenharmony_ci	/* 40 Bytes */
4098c2ecf20Sopenharmony_ci	__be32 send_done_count;
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci#define MXGEFW_LINK_DOWN 0
4128c2ecf20Sopenharmony_ci#define MXGEFW_LINK_UP 1
4138c2ecf20Sopenharmony_ci#define MXGEFW_LINK_MYRINET 2
4148c2ecf20Sopenharmony_ci#define MXGEFW_LINK_UNKNOWN 3
4158c2ecf20Sopenharmony_ci	__be32 link_up;
4168c2ecf20Sopenharmony_ci	__be32 dropped_link_overflow;
4178c2ecf20Sopenharmony_ci	__be32 dropped_link_error_or_filtered;
4188c2ecf20Sopenharmony_ci	__be32 dropped_runt;
4198c2ecf20Sopenharmony_ci	__be32 dropped_overrun;
4208c2ecf20Sopenharmony_ci	__be32 dropped_no_small_buffer;
4218c2ecf20Sopenharmony_ci	__be32 dropped_no_big_buffer;
4228c2ecf20Sopenharmony_ci	__be32 rdma_tags_available;
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci	u8 tx_stopped;
4258c2ecf20Sopenharmony_ci	u8 link_down;
4268c2ecf20Sopenharmony_ci	u8 stats_updated;
4278c2ecf20Sopenharmony_ci	u8 valid;
4288c2ecf20Sopenharmony_ci};
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/* definitions for NETQ filter type */
4318c2ecf20Sopenharmony_ci#define MXGEFW_NETQ_FILTERTYPE_NONE 0
4328c2ecf20Sopenharmony_ci#define MXGEFW_NETQ_FILTERTYPE_MACADDR 1
4338c2ecf20Sopenharmony_ci#define MXGEFW_NETQ_FILTERTYPE_VLAN 2
4348c2ecf20Sopenharmony_ci#define MXGEFW_NETQ_FILTERTYPE_VLANMACADDR 3
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci#endif				/* __MYRI10GE_MCP_H__ */
437