1167514Skmacy/**************************************************************************
2167514Skmacy
3167514SkmacyCopyright (c) 2007, Chelsio Inc.
4167514SkmacyAll rights reserved.
5167514Skmacy
6167514SkmacyRedistribution and use in source and binary forms, with or without
7167514Skmacymodification, are permitted provided that the following conditions are met:
8167514Skmacy
9167514Skmacy 1. Redistributions of source code must retain the above copyright notice,
10167514Skmacy    this list of conditions and the following disclaimer.
11167514Skmacy
12170076Skmacy 2. Neither the name of the Chelsio Corporation nor the names of its
13167514Skmacy    contributors may be used to endorse or promote products derived from
14167514Skmacy    this software without specific prior written permission.
15167514Skmacy
16167514SkmacyTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17167514SkmacyAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18167514SkmacyIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19167514SkmacyARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20167514SkmacyLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21167514SkmacyCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22167514SkmacySUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23167514SkmacyINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24167514SkmacyCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25167514SkmacyARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26167514SkmacyPOSSIBILITY OF SUCH DAMAGE.
27167514Skmacy
28167514Skmacy$FreeBSD: releng/10.3/sys/dev/cxgb/common/cxgb_firmware_exports.h 176472 2008-02-23 01:06:17Z kmacy $
29167514Skmacy
30167514Skmacy***************************************************************************/
31167514Skmacy#ifndef _FIRMWARE_EXPORTS_H_
32167514Skmacy#define _FIRMWARE_EXPORTS_H_
33167514Skmacy
34167514Skmacy/* WR OPCODES supported by the firmware.
35167514Skmacy */
36167514Skmacy#define	FW_WROPCODE_FORWARD			0x01
37167514Skmacy#define FW_WROPCODE_BYPASS			0x05
38167514Skmacy
39167514Skmacy#define FW_WROPCODE_TUNNEL_TX_PKT		0x03
40167514Skmacy
41167514Skmacy#define FW_WROPOCDE_ULPTX_DATA_SGL		0x00
42167514Skmacy#define FW_WROPCODE_ULPTX_MEM_READ		0x02
43167514Skmacy#define FW_WROPCODE_ULPTX_PKT			0x04
44167514Skmacy#define FW_WROPCODE_ULPTX_INVALIDATE		0x06
45167514Skmacy
46167514Skmacy#define FW_WROPCODE_TUNNEL_RX_PKT		0x07
47167514Skmacy
48167514Skmacy#define FW_WROPCODE_OFLD_GETTCB_RPL		0x08
49167514Skmacy#define FW_WROPCODE_OFLD_CLOSE_CON		0x09
50167514Skmacy#define FW_WROPCODE_OFLD_TP_ABORT_CON_REQ	0x0A
51167514Skmacy#define FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL	0x0F
52167514Skmacy#define FW_WROPCODE_OFLD_HOST_ABORT_CON_REQ	0x0B
53167514Skmacy#define FW_WROPCODE_OFLD_TP_ABORT_CON_RPL	0x0C
54167514Skmacy#define FW_WROPCODE_OFLD_TX_DATA		0x0D
55167514Skmacy#define FW_WROPCODE_OFLD_TX_DATA_ACK		0x0E
56167514Skmacy
57167514Skmacy#define FW_WROPCODE_RI_RDMA_INIT		0x10
58167514Skmacy#define FW_WROPCODE_RI_RDMA_WRITE		0x11
59167514Skmacy#define FW_WROPCODE_RI_RDMA_READ_REQ		0x12
60167514Skmacy#define FW_WROPCODE_RI_RDMA_READ_RESP		0x13
61167514Skmacy#define FW_WROPCODE_RI_SEND			0x14
62167514Skmacy#define FW_WROPCODE_RI_TERMINATE		0x15
63167514Skmacy#define FW_WROPCODE_RI_RDMA_READ		0x16
64167514Skmacy#define FW_WROPCODE_RI_RECEIVE			0x17
65167514Skmacy#define FW_WROPCODE_RI_BIND_MW			0x18
66167514Skmacy#define FW_WROPCODE_RI_FASTREGISTER_MR		0x19
67167514Skmacy#define FW_WROPCODE_RI_LOCAL_INV		0x1A
68167514Skmacy#define FW_WROPCODE_RI_MODIFY_QP		0x1B
69167514Skmacy#define FW_WROPCODE_RI_BYPASS			0x1C
70167514Skmacy
71167514Skmacy#define FW_WROPOCDE_RSVD			0x1E
72167514Skmacy
73167514Skmacy#define FW_WROPCODE_SGE_EGRESSCONTEXT_RR	0x1F
74167514Skmacy
75167514Skmacy#define FW_WROPCODE_MNGT			0x1D
76167514Skmacy#define FW_MNGTOPCODE_PKTSCHED_SET		0x00
77176472Skmacy#define FW_MNGTOPCODE_WRC_SET			0x01
78176472Skmacy#define FW_MNGTOPCODE_TUNNEL_CR_FLUSH		0x02
79167514Skmacy
80167514Skmacy/* Maximum size of a WR sent from the host, limited by the SGE.
81167514Skmacy *
82167514Skmacy * Note: WR coming from ULP or TP are only limited by CIM.
83167514Skmacy */
84167514Skmacy#define FW_WR_SIZE			128
85167514Skmacy
86167514Skmacy/* Maximum number of outstanding WRs sent from the host. Value must be
87167514Skmacy * programmed in the CTRL/TUNNEL/QP SGE Egress Context and used by
88167514Skmacy * offload modules to limit the number of WRs per connection.
89167514Skmacy */
90167514Skmacy#define FW_T3_WR_NUM			16
91167514Skmacy#define FW_N3_WR_NUM			7
92167514Skmacy
93167514Skmacy#ifndef N3
94167514Skmacy# define FW_WR_NUM			FW_T3_WR_NUM
95167514Skmacy#else
96167514Skmacy# define FW_WR_NUM			FW_N3_WR_NUM
97167514Skmacy#endif
98167514Skmacy
99167514Skmacy/* FW_TUNNEL_NUM corresponds to the number of supported TUNNEL Queues. These
100167514Skmacy * queues must start at SGE Egress Context FW_TUNNEL_SGEEC_START and must
101167514Skmacy * start at 'TID' (or 'uP Token') FW_TUNNEL_TID_START.
102167514Skmacy *
103167514Skmacy * Ingress Traffic (e.g. DMA completion credit)  for TUNNEL Queue[i] is sent
104167514Skmacy * to RESP Queue[i].
105167514Skmacy */
106167514Skmacy#define FW_TUNNEL_NUM			8
107167514Skmacy#define FW_TUNNEL_SGEEC_START		8
108167514Skmacy#define FW_TUNNEL_TID_START		65544
109167514Skmacy
110167514Skmacy
111167514Skmacy/* FW_CTRL_NUM corresponds to the number of supported CTRL Queues. These queues
112167514Skmacy * must start at SGE Egress Context FW_CTRL_SGEEC_START and must start at 'TID'
113167514Skmacy * (or 'uP Token') FW_CTRL_TID_START.
114167514Skmacy *
115167514Skmacy * Ingress Traffic for CTRL Queue[i] is sent to RESP Queue[i].
116167514Skmacy */
117167514Skmacy#define FW_CTRL_NUM			8
118167514Skmacy#define FW_CTRL_SGEEC_START		65528
119167514Skmacy#define FW_CTRL_TID_START		65536
120167514Skmacy
121167514Skmacy/* FW_OFLD_NUM corresponds to the number of supported OFFLOAD Queues. These
122167514Skmacy * queues must start at SGE Egress Context FW_OFLD_SGEEC_START.
123167514Skmacy *
124167514Skmacy * Note: the 'uP Token' in the SGE Egress Context fields is irrelevant for
125167514Skmacy * OFFLOAD Queues, as the host is responsible for providing the correct TID in
126167514Skmacy * every WR.
127167514Skmacy *
128167514Skmacy * Ingress Trafffic for OFFLOAD Queue[i] is sent to RESP Queue[i].
129167514Skmacy */
130167514Skmacy#define FW_OFLD_NUM			8
131167514Skmacy#define FW_OFLD_SGEEC_START		0
132167514Skmacy
133167514Skmacy/*
134167514Skmacy *
135167514Skmacy */
136167514Skmacy#define FW_RI_NUM			1
137167514Skmacy#define FW_RI_SGEEC_START		65527
138167514Skmacy#define FW_RI_TID_START			65552
139167514Skmacy
140167514Skmacy/*
141167514Skmacy * The RX_PKT_TID
142167514Skmacy */
143167514Skmacy#define FW_RX_PKT_NUM			1
144167514Skmacy#define FW_RX_PKT_TID_START		65553
145167514Skmacy
146167514Skmacy/* FW_WRC_NUM corresponds to the number of Work Request Context that supported
147167514Skmacy * by the firmware.
148167514Skmacy */
149167514Skmacy#define FW_WRC_NUM			\
150167514Skmacy    (65536 + FW_TUNNEL_NUM + FW_CTRL_NUM + FW_RI_NUM + FW_RX_PKT_NUM)
151167514Skmacy
152167514Skmacy/*
153167514Skmacy * FW type and version.
154167514Skmacy */
155167514Skmacy#define S_FW_VERSION_TYPE		28
156167514Skmacy#define M_FW_VERSION_TYPE		0xF
157167514Skmacy#define V_FW_VERSION_TYPE(x)		((x) << S_FW_VERSION_TYPE)
158167514Skmacy#define G_FW_VERSION_TYPE(x)		\
159167514Skmacy    (((x) >> S_FW_VERSION_TYPE) & M_FW_VERSION_TYPE)
160167514Skmacy
161167514Skmacy#define S_FW_VERSION_MAJOR		16
162167514Skmacy#define M_FW_VERSION_MAJOR		0xFFF
163167514Skmacy#define V_FW_VERSION_MAJOR(x)		((x) << S_FW_VERSION_MAJOR)
164167514Skmacy#define G_FW_VERSION_MAJOR(x)		\
165167514Skmacy    (((x) >> S_FW_VERSION_MAJOR) & M_FW_VERSION_MAJOR)
166167514Skmacy
167167514Skmacy#define S_FW_VERSION_MINOR		8
168167514Skmacy#define M_FW_VERSION_MINOR		0xFF
169167514Skmacy#define V_FW_VERSION_MINOR(x)		((x) << S_FW_VERSION_MINOR)
170167514Skmacy#define G_FW_VERSION_MINOR(x)		\
171167514Skmacy    (((x) >> S_FW_VERSION_MINOR) & M_FW_VERSION_MINOR)
172167514Skmacy
173167514Skmacy#define S_FW_VERSION_MICRO		0
174167514Skmacy#define M_FW_VERSION_MICRO		0xFF
175167514Skmacy#define V_FW_VERSION_MICRO(x)		((x) << S_FW_VERSION_MICRO)
176167514Skmacy#define G_FW_VERSION_MICRO(x)		\
177167514Skmacy    (((x) >> S_FW_VERSION_MICRO) & M_FW_VERSION_MICRO)
178167514Skmacy
179167514Skmacy#endif /* _FIRMWARE_EXPORTS_H_ */
180