153812Salfred/**************************************************************************
253812Salfred
353812SalfredCopyright (c) 2007, Chelsio Inc.
453812SalfredAll rights reserved.
553812Salfred
653812SalfredRedistribution and use in source and binary forms, with or without
753812Salfredmodification, are permitted provided that the following conditions are met:
853812Salfred
956277Sjasone 1. Redistributions of source code must retain the above copyright notice,
1056277Sjasone    this list of conditions and the following disclaimer.
1175369Sdeischen
1275369Sdeischen 2. Neither the name of the Chelsio Corporation nor the names of its
1375369Sdeischen    contributors may be used to endorse or promote products derived from
1475369Sdeischen    this software without specific prior written permission.
1571581Sdeischen
1653812SalfredTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1771581SdeischenAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1853812SalfredIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1953812SalfredARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2053812SalfredLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2153812SalfredCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2253812SalfredSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2395947SarchieINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2495947SarchieCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2553812SalfredARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2653812SalfredPOSSIBILITY OF SUCH DAMAGE.
2753812Salfred
2853812Salfred$FreeBSD$
2953812Salfred
3054708Sdeischen***************************************************************************/
3154708Sdeischen#ifndef _FIRMWARE_EXPORTS_H_
3254708Sdeischen#define _FIRMWARE_EXPORTS_H_
3354708Sdeischen
3454708Sdeischen/* WR OPCODES supported by the firmware.
3554708Sdeischen */
3654708Sdeischen#define	FW_WROPCODE_FORWARD			0x01
3754708Sdeischen#define FW_WROPCODE_BYPASS			0x05
3854708Sdeischen
3954708Sdeischen#define FW_WROPCODE_TUNNEL_TX_PKT		0x03
4053812Salfred
4153812Salfred#define FW_WROPOCDE_ULPTX_DATA_SGL		0x00
4253812Salfred#define FW_WROPCODE_ULPTX_MEM_READ		0x02
4353812Salfred#define FW_WROPCODE_ULPTX_PKT			0x04
4453812Salfred#define FW_WROPCODE_ULPTX_INVALIDATE		0x06
4553812Salfred
4653812Salfred#define FW_WROPCODE_TUNNEL_RX_PKT		0x07
4753812Salfred
4853812Salfred#define FW_WROPCODE_OFLD_GETTCB_RPL		0x08
4953812Salfred#define FW_WROPCODE_OFLD_CLOSE_CON		0x09
5053812Salfred#define FW_WROPCODE_OFLD_TP_ABORT_CON_REQ	0x0A
5154708Sdeischen#define FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL	0x0F
5253812Salfred#define FW_WROPCODE_OFLD_HOST_ABORT_CON_REQ	0x0B
5353812Salfred#define FW_WROPCODE_OFLD_TP_ABORT_CON_RPL	0x0C
5453812Salfred#define FW_WROPCODE_OFLD_TX_DATA		0x0D
5553812Salfred#define FW_WROPCODE_OFLD_TX_DATA_ACK		0x0E
5653812Salfred
5753812Salfred#define FW_WROPCODE_RI_RDMA_INIT		0x10
5853812Salfred#define FW_WROPCODE_RI_RDMA_WRITE		0x11
5953812Salfred#define FW_WROPCODE_RI_RDMA_READ_REQ		0x12
6053812Salfred#define FW_WROPCODE_RI_RDMA_READ_RESP		0x13
6153812Salfred#define FW_WROPCODE_RI_SEND			0x14
6253812Salfred#define FW_WROPCODE_RI_TERMINATE		0x15
6353812Salfred#define FW_WROPCODE_RI_RDMA_READ		0x16
6453812Salfred#define FW_WROPCODE_RI_RECEIVE			0x17
6553812Salfred#define FW_WROPCODE_RI_BIND_MW			0x18
6653812Salfred#define FW_WROPCODE_RI_FASTREGISTER_MR		0x19
6776909Sjasone#define FW_WROPCODE_RI_LOCAL_INV		0x1A
6881750Sjasone#define FW_WROPCODE_RI_MODIFY_QP		0x1B
6988015Sdeischen#define FW_WROPCODE_RI_BYPASS			0x1C
7081750Sjasone
7187988Sdeischen#define FW_WROPOCDE_RSVD			0x1E
7287988Sdeischen
7387988Sdeischen#define FW_WROPCODE_SGE_EGRESSCONTEXT_RR	0x1F
7491762Sdeischen
7581750Sjasone#define FW_WROPCODE_MNGT			0x1D
7681750Sjasone#define FW_MNGTOPCODE_PKTSCHED_SET		0x00
7781750Sjasone#define FW_MNGTOPCODE_WRC_SET			0x01
7881750Sjasone#define FW_MNGTOPCODE_TUNNEL_CR_FLUSH		0x02
7981750Sjasone
8061681Sjasone/* Maximum size of a WR sent from the host, limited by the SGE.
8153812Salfred *
8253812Salfred * Note: WR coming from ULP or TP are only limited by CIM.
8353812Salfred */
8453812Salfred#define FW_WR_SIZE			128
8553812Salfred
8653812Salfred/* Maximum number of outstanding WRs sent from the host. Value must be
8753812Salfred * programmed in the CTRL/TUNNEL/QP SGE Egress Context and used by
8853812Salfred * offload modules to limit the number of WRs per connection.
8953812Salfred */
9053812Salfred#define FW_T3_WR_NUM			16
9153812Salfred#define FW_N3_WR_NUM			7
9253812Salfred
9356277Sjasone#ifndef N3
9456277Sjasone# define FW_WR_NUM			FW_T3_WR_NUM
9553812Salfred#else
9653812Salfred# define FW_WR_NUM			FW_N3_WR_NUM
9753812Salfred#endif
9897204Sdeischen
9956277Sjasone/* FW_TUNNEL_NUM corresponds to the number of supported TUNNEL Queues. These
10053812Salfred * queues must start at SGE Egress Context FW_TUNNEL_SGEEC_START and must
10153812Salfred * start at 'TID' (or 'uP Token') FW_TUNNEL_TID_START.
10253812Salfred *
10353812Salfred * Ingress Traffic (e.g. DMA completion credit)  for TUNNEL Queue[i] is sent
10453812Salfred * to RESP Queue[i].
10553812Salfred */
10653812Salfred#define FW_TUNNEL_NUM			8
10754708Sdeischen#define FW_TUNNEL_SGEEC_START		8
10853812Salfred#define FW_TUNNEL_TID_START		65544
10954708Sdeischen
11053812Salfred
11153812Salfred/* FW_CTRL_NUM corresponds to the number of supported CTRL Queues. These queues
11253812Salfred * must start at SGE Egress Context FW_CTRL_SGEEC_START and must start at 'TID'
11353812Salfred * (or 'uP Token') FW_CTRL_TID_START.
11453812Salfred *
11553812Salfred * Ingress Traffic for CTRL Queue[i] is sent to RESP Queue[i].
11653812Salfred */
11753812Salfred#define FW_CTRL_NUM			8
11853812Salfred#define FW_CTRL_SGEEC_START		65528
11971581Sdeischen#define FW_CTRL_TID_START		65536
12053812Salfred
12171581Sdeischen/* FW_OFLD_NUM corresponds to the number of supported OFFLOAD Queues. These
12253812Salfred * queues must start at SGE Egress Context FW_OFLD_SGEEC_START.
12353812Salfred *
12453812Salfred * Note: the 'uP Token' in the SGE Egress Context fields is irrelevant for
12571581Sdeischen * OFFLOAD Queues, as the host is responsible for providing the correct TID in
12653812Salfred * every WR.
12753812Salfred *
12853812Salfred * Ingress Trafffic for OFFLOAD Queue[i] is sent to RESP Queue[i].
12953812Salfred */
13053812Salfred#define FW_OFLD_NUM			8
13171581Sdeischen#define FW_OFLD_SGEEC_START		0
13271581Sdeischen
13353812Salfred/*
13453812Salfred *
13553812Salfred */
13653812Salfred#define FW_RI_NUM			1
13753812Salfred#define FW_RI_SGEEC_START		65527
13853812Salfred#define FW_RI_TID_START			65552
13971581Sdeischen
14053812Salfred/*
14153812Salfred * The RX_PKT_TID
14253812Salfred */
14353812Salfred#define FW_RX_PKT_NUM			1
14453812Salfred#define FW_RX_PKT_TID_START		65553
14553812Salfred
14653812Salfred/* FW_WRC_NUM corresponds to the number of Work Request Context that supported
14753812Salfred * by the firmware.
14853812Salfred */
14953812Salfred#define FW_WRC_NUM			\
15071581Sdeischen    (65536 + FW_TUNNEL_NUM + FW_CTRL_NUM + FW_RI_NUM + FW_RX_PKT_NUM)
15153812Salfred
15271581Sdeischen/*
15353812Salfred * FW type and version.
15453812Salfred */
15553812Salfred#define S_FW_VERSION_TYPE		28
15671581Sdeischen#define M_FW_VERSION_TYPE		0xF
15753812Salfred#define V_FW_VERSION_TYPE(x)		((x) << S_FW_VERSION_TYPE)
15853812Salfred#define G_FW_VERSION_TYPE(x)		\
15953812Salfred    (((x) >> S_FW_VERSION_TYPE) & M_FW_VERSION_TYPE)
16053812Salfred
16171581Sdeischen#define S_FW_VERSION_MAJOR		16
16253812Salfred#define M_FW_VERSION_MAJOR		0xFFF
16353812Salfred#define V_FW_VERSION_MAJOR(x)		((x) << S_FW_VERSION_MAJOR)
16453812Salfred#define G_FW_VERSION_MAJOR(x)		\
16553812Salfred    (((x) >> S_FW_VERSION_MAJOR) & M_FW_VERSION_MAJOR)
16653812Salfred
16753812Salfred#define S_FW_VERSION_MINOR		8
16871581Sdeischen#define M_FW_VERSION_MINOR		0xFF
16953812Salfred#define V_FW_VERSION_MINOR(x)		((x) << S_FW_VERSION_MINOR)
17053812Salfred#define G_FW_VERSION_MINOR(x)		\
17153812Salfred    (((x) >> S_FW_VERSION_MINOR) & M_FW_VERSION_MINOR)
17253812Salfred
17353812Salfred#define S_FW_VERSION_MICRO		0
17453812Salfred#define M_FW_VERSION_MICRO		0xFF
17553812Salfred#define V_FW_VERSION_MICRO(x)		((x) << S_FW_VERSION_MICRO)
17653812Salfred#define G_FW_VERSION_MICRO(x)		\
17753812Salfred    (((x) >> S_FW_VERSION_MICRO) & M_FW_VERSION_MICRO)
17853812Salfred
17971581Sdeischen#endif /* _FIRMWARE_EXPORTS_H_ */
18053812Salfred