xref: /freebsd/sys/dev/cxgb/common/cxgb_firmware_exports.h (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1 /**************************************************************************
2 SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 
4 Copyright (c) 2007, Chelsio Inc.
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10  1. Redistributions of source code must retain the above copyright notice,
11     this list of conditions and the following disclaimer.
12 
13  2. Neither the name of the Chelsio Corporation nor the names of its
14     contributors may be used to endorse or promote products derived from
15     this software without specific prior written permission.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
28 
29 $FreeBSD$
30 
31 ***************************************************************************/
32 #ifndef _FIRMWARE_EXPORTS_H_
33 #define _FIRMWARE_EXPORTS_H_
34 
35 /* WR OPCODES supported by the firmware.
36  */
37 #define	FW_WROPCODE_FORWARD			0x01
38 #define FW_WROPCODE_BYPASS			0x05
39 
40 #define FW_WROPCODE_TUNNEL_TX_PKT		0x03
41 
42 #define FW_WROPOCDE_ULPTX_DATA_SGL		0x00
43 #define FW_WROPCODE_ULPTX_MEM_READ		0x02
44 #define FW_WROPCODE_ULPTX_PKT			0x04
45 #define FW_WROPCODE_ULPTX_INVALIDATE		0x06
46 
47 #define FW_WROPCODE_TUNNEL_RX_PKT		0x07
48 
49 #define FW_WROPCODE_OFLD_GETTCB_RPL		0x08
50 #define FW_WROPCODE_OFLD_CLOSE_CON		0x09
51 #define FW_WROPCODE_OFLD_TP_ABORT_CON_REQ	0x0A
52 #define FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL	0x0F
53 #define FW_WROPCODE_OFLD_HOST_ABORT_CON_REQ	0x0B
54 #define FW_WROPCODE_OFLD_TP_ABORT_CON_RPL	0x0C
55 #define FW_WROPCODE_OFLD_TX_DATA		0x0D
56 #define FW_WROPCODE_OFLD_TX_DATA_ACK		0x0E
57 
58 #define FW_WROPCODE_RI_RDMA_INIT		0x10
59 #define FW_WROPCODE_RI_RDMA_WRITE		0x11
60 #define FW_WROPCODE_RI_RDMA_READ_REQ		0x12
61 #define FW_WROPCODE_RI_RDMA_READ_RESP		0x13
62 #define FW_WROPCODE_RI_SEND			0x14
63 #define FW_WROPCODE_RI_TERMINATE		0x15
64 #define FW_WROPCODE_RI_RDMA_READ		0x16
65 #define FW_WROPCODE_RI_RECEIVE			0x17
66 #define FW_WROPCODE_RI_BIND_MW			0x18
67 #define FW_WROPCODE_RI_FASTREGISTER_MR		0x19
68 #define FW_WROPCODE_RI_LOCAL_INV		0x1A
69 #define FW_WROPCODE_RI_MODIFY_QP		0x1B
70 #define FW_WROPCODE_RI_BYPASS			0x1C
71 
72 #define FW_WROPOCDE_RSVD			0x1E
73 
74 #define FW_WROPCODE_SGE_EGRESSCONTEXT_RR	0x1F
75 
76 #define FW_WROPCODE_MNGT			0x1D
77 #define FW_MNGTOPCODE_PKTSCHED_SET		0x00
78 #define FW_MNGTOPCODE_WRC_SET			0x01
79 #define FW_MNGTOPCODE_TUNNEL_CR_FLUSH		0x02
80 
81 /* Maximum size of a WR sent from the host, limited by the SGE.
82  *
83  * Note: WR coming from ULP or TP are only limited by CIM.
84  */
85 #define FW_WR_SIZE			128
86 
87 /* Maximum number of outstanding WRs sent from the host. Value must be
88  * programmed in the CTRL/TUNNEL/QP SGE Egress Context and used by
89  * offload modules to limit the number of WRs per connection.
90  */
91 #define FW_T3_WR_NUM			16
92 #define FW_N3_WR_NUM			7
93 
94 #ifndef N3
95 # define FW_WR_NUM			FW_T3_WR_NUM
96 #else
97 # define FW_WR_NUM			FW_N3_WR_NUM
98 #endif
99 
100 /* FW_TUNNEL_NUM corresponds to the number of supported TUNNEL Queues. These
101  * queues must start at SGE Egress Context FW_TUNNEL_SGEEC_START and must
102  * start at 'TID' (or 'uP Token') FW_TUNNEL_TID_START.
103  *
104  * Ingress Traffic (e.g. DMA completion credit)  for TUNNEL Queue[i] is sent
105  * to RESP Queue[i].
106  */
107 #define FW_TUNNEL_NUM			8
108 #define FW_TUNNEL_SGEEC_START		8
109 #define FW_TUNNEL_TID_START		65544
110 
111 
112 /* FW_CTRL_NUM corresponds to the number of supported CTRL Queues. These queues
113  * must start at SGE Egress Context FW_CTRL_SGEEC_START and must start at 'TID'
114  * (or 'uP Token') FW_CTRL_TID_START.
115  *
116  * Ingress Traffic for CTRL Queue[i] is sent to RESP Queue[i].
117  */
118 #define FW_CTRL_NUM			8
119 #define FW_CTRL_SGEEC_START		65528
120 #define FW_CTRL_TID_START		65536
121 
122 /* FW_OFLD_NUM corresponds to the number of supported OFFLOAD Queues. These
123  * queues must start at SGE Egress Context FW_OFLD_SGEEC_START.
124  *
125  * Note: the 'uP Token' in the SGE Egress Context fields is irrelevant for
126  * OFFLOAD Queues, as the host is responsible for providing the correct TID in
127  * every WR.
128  *
129  * Ingress Trafffic for OFFLOAD Queue[i] is sent to RESP Queue[i].
130  */
131 #define FW_OFLD_NUM			8
132 #define FW_OFLD_SGEEC_START		0
133 
134 /*
135  *
136  */
137 #define FW_RI_NUM			1
138 #define FW_RI_SGEEC_START		65527
139 #define FW_RI_TID_START			65552
140 
141 /*
142  * The RX_PKT_TID
143  */
144 #define FW_RX_PKT_NUM			1
145 #define FW_RX_PKT_TID_START		65553
146 
147 /* FW_WRC_NUM corresponds to the number of Work Request Context that supported
148  * by the firmware.
149  */
150 #define FW_WRC_NUM			\
151     (65536 + FW_TUNNEL_NUM + FW_CTRL_NUM + FW_RI_NUM + FW_RX_PKT_NUM)
152 
153 /*
154  * FW type and version.
155  */
156 #define S_FW_VERSION_TYPE		28
157 #define M_FW_VERSION_TYPE		0xF
158 #define V_FW_VERSION_TYPE(x)		((x) << S_FW_VERSION_TYPE)
159 #define G_FW_VERSION_TYPE(x)		\
160     (((x) >> S_FW_VERSION_TYPE) & M_FW_VERSION_TYPE)
161 
162 #define S_FW_VERSION_MAJOR		16
163 #define M_FW_VERSION_MAJOR		0xFFF
164 #define V_FW_VERSION_MAJOR(x)		((x) << S_FW_VERSION_MAJOR)
165 #define G_FW_VERSION_MAJOR(x)		\
166     (((x) >> S_FW_VERSION_MAJOR) & M_FW_VERSION_MAJOR)
167 
168 #define S_FW_VERSION_MINOR		8
169 #define M_FW_VERSION_MINOR		0xFF
170 #define V_FW_VERSION_MINOR(x)		((x) << S_FW_VERSION_MINOR)
171 #define G_FW_VERSION_MINOR(x)		\
172     (((x) >> S_FW_VERSION_MINOR) & M_FW_VERSION_MINOR)
173 
174 #define S_FW_VERSION_MICRO		0
175 #define M_FW_VERSION_MICRO		0xFF
176 #define V_FW_VERSION_MICRO(x)		((x) << S_FW_VERSION_MICRO)
177 #define G_FW_VERSION_MICRO(x)		\
178     (((x) >> S_FW_VERSION_MICRO) & M_FW_VERSION_MICRO)
179 
180 #endif /* _FIRMWARE_EXPORTS_H_ */
181