1f7917c00SJeff Kirsher /*
2f7917c00SJeff Kirsher  * Copyright (c) 2004-2008 Chelsio, Inc. All rights reserved.
3f7917c00SJeff Kirsher  *
4f7917c00SJeff Kirsher  * This software is available to you under a choice of one of two
5f7917c00SJeff Kirsher  * licenses.  You may choose to be licensed under the terms of the GNU
6f7917c00SJeff Kirsher  * General Public License (GPL) Version 2, available from the file
7f7917c00SJeff Kirsher  * COPYING in the main directory of this source tree, or the
8f7917c00SJeff Kirsher  * OpenIB.org BSD license below:
9f7917c00SJeff Kirsher  *
10f7917c00SJeff Kirsher  *     Redistribution and use in source and binary forms, with or
11f7917c00SJeff Kirsher  *     without modification, are permitted provided that the following
12f7917c00SJeff Kirsher  *     conditions are met:
13f7917c00SJeff Kirsher  *
14f7917c00SJeff Kirsher  *      - Redistributions of source code must retain the above
15f7917c00SJeff Kirsher  *        copyright notice, this list of conditions and the following
16f7917c00SJeff Kirsher  *        disclaimer.
17f7917c00SJeff Kirsher  *
18f7917c00SJeff Kirsher  *      - Redistributions in binary form must reproduce the above
19f7917c00SJeff Kirsher  *        copyright notice, this list of conditions and the following
20f7917c00SJeff Kirsher  *        disclaimer in the documentation and/or other materials
21f7917c00SJeff Kirsher  *        provided with the distribution.
22f7917c00SJeff Kirsher  *
23f7917c00SJeff Kirsher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24f7917c00SJeff Kirsher  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25f7917c00SJeff Kirsher  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26f7917c00SJeff Kirsher  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27f7917c00SJeff Kirsher  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28f7917c00SJeff Kirsher  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29f7917c00SJeff Kirsher  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30f7917c00SJeff Kirsher  * SOFTWARE.
31f7917c00SJeff Kirsher  */
32f7917c00SJeff Kirsher #ifndef _FIRMWARE_EXPORTS_H_
33f7917c00SJeff Kirsher #define _FIRMWARE_EXPORTS_H_
34f7917c00SJeff Kirsher 
35f7917c00SJeff Kirsher /* WR OPCODES supported by the firmware.
36f7917c00SJeff Kirsher  */
37f7917c00SJeff Kirsher #define	FW_WROPCODE_FORWARD			0x01
38f7917c00SJeff Kirsher #define FW_WROPCODE_BYPASS			0x05
39f7917c00SJeff Kirsher 
40f7917c00SJeff Kirsher #define FW_WROPCODE_TUNNEL_TX_PKT		0x03
41f7917c00SJeff Kirsher 
42f7917c00SJeff Kirsher #define FW_WROPOCDE_ULPTX_DATA_SGL		0x00
43f7917c00SJeff Kirsher #define FW_WROPCODE_ULPTX_MEM_READ		0x02
44f7917c00SJeff Kirsher #define FW_WROPCODE_ULPTX_PKT			0x04
45f7917c00SJeff Kirsher #define FW_WROPCODE_ULPTX_INVALIDATE		0x06
46f7917c00SJeff Kirsher 
47f7917c00SJeff Kirsher #define FW_WROPCODE_TUNNEL_RX_PKT		0x07
48f7917c00SJeff Kirsher 
49f7917c00SJeff Kirsher #define FW_WROPCODE_OFLD_GETTCB_RPL		0x08
50f7917c00SJeff Kirsher #define FW_WROPCODE_OFLD_CLOSE_CON		0x09
51f7917c00SJeff Kirsher #define FW_WROPCODE_OFLD_TP_ABORT_CON_REQ	0x0A
52f7917c00SJeff Kirsher #define FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL	0x0F
53f7917c00SJeff Kirsher #define FW_WROPCODE_OFLD_HOST_ABORT_CON_REQ	0x0B
54f7917c00SJeff Kirsher #define FW_WROPCODE_OFLD_TP_ABORT_CON_RPL	0x0C
55f7917c00SJeff Kirsher #define FW_WROPCODE_OFLD_TX_DATA		0x0D
56f7917c00SJeff Kirsher #define FW_WROPCODE_OFLD_TX_DATA_ACK		0x0E
57f7917c00SJeff Kirsher 
58f7917c00SJeff Kirsher #define FW_WROPCODE_RI_RDMA_INIT		0x10
59f7917c00SJeff Kirsher #define FW_WROPCODE_RI_RDMA_WRITE		0x11
60f7917c00SJeff Kirsher #define FW_WROPCODE_RI_RDMA_READ_REQ		0x12
61f7917c00SJeff Kirsher #define FW_WROPCODE_RI_RDMA_READ_RESP		0x13
62f7917c00SJeff Kirsher #define FW_WROPCODE_RI_SEND			0x14
63f7917c00SJeff Kirsher #define FW_WROPCODE_RI_TERMINATE		0x15
64f7917c00SJeff Kirsher #define FW_WROPCODE_RI_RDMA_READ		0x16
65f7917c00SJeff Kirsher #define FW_WROPCODE_RI_RECEIVE			0x17
66f7917c00SJeff Kirsher #define FW_WROPCODE_RI_BIND_MW			0x18
67f7917c00SJeff Kirsher #define FW_WROPCODE_RI_FASTREGISTER_MR		0x19
68f7917c00SJeff Kirsher #define FW_WROPCODE_RI_LOCAL_INV		0x1A
69f7917c00SJeff Kirsher #define FW_WROPCODE_RI_MODIFY_QP		0x1B
70f7917c00SJeff Kirsher #define FW_WROPCODE_RI_BYPASS			0x1C
71f7917c00SJeff Kirsher 
72f7917c00SJeff Kirsher #define FW_WROPOCDE_RSVD			0x1E
73f7917c00SJeff Kirsher 
74f7917c00SJeff Kirsher #define FW_WROPCODE_SGE_EGRESSCONTEXT_RR	0x1F
75f7917c00SJeff Kirsher 
76f7917c00SJeff Kirsher #define FW_WROPCODE_MNGT			0x1D
77f7917c00SJeff Kirsher #define FW_MNGTOPCODE_PKTSCHED_SET		0x00
78f7917c00SJeff Kirsher 
79f7917c00SJeff Kirsher /* Maximum size of a WR sent from the host, limited by the SGE.
80f7917c00SJeff Kirsher  *
81f7917c00SJeff Kirsher  * Note: WR coming from ULP or TP are only limited by CIM.
82f7917c00SJeff Kirsher  */
83f7917c00SJeff Kirsher #define FW_WR_SIZE			128
84f7917c00SJeff Kirsher 
85f7917c00SJeff Kirsher /* Maximum number of outstanding WRs sent from the host. Value must be
86f7917c00SJeff Kirsher  * programmed in the CTRL/TUNNEL/QP SGE Egress Context and used by
87f7917c00SJeff Kirsher  * offload modules to limit the number of WRs per connection.
88f7917c00SJeff Kirsher  */
89f7917c00SJeff Kirsher #define FW_T3_WR_NUM			16
90f7917c00SJeff Kirsher #define FW_N3_WR_NUM			7
91f7917c00SJeff Kirsher 
92f7917c00SJeff Kirsher #ifndef N3
93f7917c00SJeff Kirsher # define FW_WR_NUM			FW_T3_WR_NUM
94f7917c00SJeff Kirsher #else
95f7917c00SJeff Kirsher # define FW_WR_NUM			FW_N3_WR_NUM
96f7917c00SJeff Kirsher #endif
97f7917c00SJeff Kirsher 
98f7917c00SJeff Kirsher /* FW_TUNNEL_NUM corresponds to the number of supported TUNNEL Queues. These
99f7917c00SJeff Kirsher  * queues must start at SGE Egress Context FW_TUNNEL_SGEEC_START and must
100f7917c00SJeff Kirsher  * start at 'TID' (or 'uP Token') FW_TUNNEL_TID_START.
101f7917c00SJeff Kirsher  *
102f7917c00SJeff Kirsher  * Ingress Traffic (e.g. DMA completion credit)  for TUNNEL Queue[i] is sent
103f7917c00SJeff Kirsher  * to RESP Queue[i].
104f7917c00SJeff Kirsher  */
105f7917c00SJeff Kirsher #define FW_TUNNEL_NUM			8
106f7917c00SJeff Kirsher #define FW_TUNNEL_SGEEC_START		8
107f7917c00SJeff Kirsher #define FW_TUNNEL_TID_START		65544
108f7917c00SJeff Kirsher 
109f7917c00SJeff Kirsher /* FW_CTRL_NUM corresponds to the number of supported CTRL Queues. These queues
110f7917c00SJeff Kirsher  * must start at SGE Egress Context FW_CTRL_SGEEC_START and must start at 'TID'
111f7917c00SJeff Kirsher  * (or 'uP Token') FW_CTRL_TID_START.
112f7917c00SJeff Kirsher  *
113f7917c00SJeff Kirsher  * Ingress Traffic for CTRL Queue[i] is sent to RESP Queue[i].
114f7917c00SJeff Kirsher  */
115f7917c00SJeff Kirsher #define FW_CTRL_NUM			8
116f7917c00SJeff Kirsher #define FW_CTRL_SGEEC_START		65528
117f7917c00SJeff Kirsher #define FW_CTRL_TID_START		65536
118f7917c00SJeff Kirsher 
119f7917c00SJeff Kirsher /* FW_OFLD_NUM corresponds to the number of supported OFFLOAD Queues. These
120f7917c00SJeff Kirsher  * queues must start at SGE Egress Context FW_OFLD_SGEEC_START.
121f7917c00SJeff Kirsher  *
122f7917c00SJeff Kirsher  * Note: the 'uP Token' in the SGE Egress Context fields is irrelevant for
123f7917c00SJeff Kirsher  * OFFLOAD Queues, as the host is responsible for providing the correct TID in
124f7917c00SJeff Kirsher  * every WR.
125f7917c00SJeff Kirsher  *
126f7917c00SJeff Kirsher  * Ingress Trafffic for OFFLOAD Queue[i] is sent to RESP Queue[i].
127f7917c00SJeff Kirsher  */
128f7917c00SJeff Kirsher #define FW_OFLD_NUM			8
129f7917c00SJeff Kirsher #define FW_OFLD_SGEEC_START		0
130f7917c00SJeff Kirsher 
131f7917c00SJeff Kirsher /*
132f7917c00SJeff Kirsher  *
133f7917c00SJeff Kirsher  */
134f7917c00SJeff Kirsher #define FW_RI_NUM			1
135f7917c00SJeff Kirsher #define FW_RI_SGEEC_START		65527
136f7917c00SJeff Kirsher #define FW_RI_TID_START			65552
137f7917c00SJeff Kirsher 
138f7917c00SJeff Kirsher /*
139f7917c00SJeff Kirsher  * The RX_PKT_TID
140f7917c00SJeff Kirsher  */
141f7917c00SJeff Kirsher #define FW_RX_PKT_NUM			1
142f7917c00SJeff Kirsher #define FW_RX_PKT_TID_START		65553
143f7917c00SJeff Kirsher 
144f7917c00SJeff Kirsher /* FW_WRC_NUM corresponds to the number of Work Request Context that supported
145f7917c00SJeff Kirsher  * by the firmware.
146f7917c00SJeff Kirsher  */
147f7917c00SJeff Kirsher #define FW_WRC_NUM			\
148f7917c00SJeff Kirsher     (65536 + FW_TUNNEL_NUM + FW_CTRL_NUM + FW_RI_NUM + FW_RX_PKT_NUM)
149f7917c00SJeff Kirsher 
150f7917c00SJeff Kirsher /*
151f7917c00SJeff Kirsher  * FW type and version.
152f7917c00SJeff Kirsher  */
153f7917c00SJeff Kirsher #define S_FW_VERSION_TYPE		28
154f7917c00SJeff Kirsher #define M_FW_VERSION_TYPE		0xF
155f7917c00SJeff Kirsher #define V_FW_VERSION_TYPE(x)		((x) << S_FW_VERSION_TYPE)
156f7917c00SJeff Kirsher #define G_FW_VERSION_TYPE(x)		\
157f7917c00SJeff Kirsher     (((x) >> S_FW_VERSION_TYPE) & M_FW_VERSION_TYPE)
158f7917c00SJeff Kirsher 
159f7917c00SJeff Kirsher #define S_FW_VERSION_MAJOR		16
160f7917c00SJeff Kirsher #define M_FW_VERSION_MAJOR		0xFFF
161f7917c00SJeff Kirsher #define V_FW_VERSION_MAJOR(x)		((x) << S_FW_VERSION_MAJOR)
162f7917c00SJeff Kirsher #define G_FW_VERSION_MAJOR(x)		\
163f7917c00SJeff Kirsher     (((x) >> S_FW_VERSION_MAJOR) & M_FW_VERSION_MAJOR)
164f7917c00SJeff Kirsher 
165f7917c00SJeff Kirsher #define S_FW_VERSION_MINOR		8
166f7917c00SJeff Kirsher #define M_FW_VERSION_MINOR		0xFF
167f7917c00SJeff Kirsher #define V_FW_VERSION_MINOR(x)		((x) << S_FW_VERSION_MINOR)
168f7917c00SJeff Kirsher #define G_FW_VERSION_MINOR(x)		\
169f7917c00SJeff Kirsher     (((x) >> S_FW_VERSION_MINOR) & M_FW_VERSION_MINOR)
170f7917c00SJeff Kirsher 
171f7917c00SJeff Kirsher #define S_FW_VERSION_MICRO		0
172f7917c00SJeff Kirsher #define M_FW_VERSION_MICRO		0xFF
173f7917c00SJeff Kirsher #define V_FW_VERSION_MICRO(x)		((x) << S_FW_VERSION_MICRO)
174f7917c00SJeff Kirsher #define G_FW_VERSION_MICRO(x)		\
175f7917c00SJeff Kirsher     (((x) >> S_FW_VERSION_MICRO) & M_FW_VERSION_MICRO)
176f7917c00SJeff Kirsher 
177f7917c00SJeff Kirsher #endif				/* _FIRMWARE_EXPORTS_H_ */
178