blob: ff709e3b3e7e43371518222d93a5119dcd3b185d [file] [log] [blame]
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001/*
2 * This file is part of the Chelsio T4 Ethernet driver for Linux.
3 *
Anish Bhattce100b8b2014-06-19 21:37:15 -07004 * Copyright (c) 2009-2014 Chelsio Communications, Inc. All rights reserved.
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00005 *
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
11 *
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
14 * conditions are met:
15 *
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer.
19 *
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
33 */
34
35#ifndef _T4FW_INTERFACE_H_
36#define _T4FW_INTERFACE_H_
37
Vipul Pandya5be78ee2012-12-10 09:30:54 +000038enum fw_retval {
39 FW_SUCCESS = 0, /* completed sucessfully */
40 FW_EPERM = 1, /* operation not permitted */
41 FW_ENOENT = 2, /* no such file or directory */
42 FW_EIO = 5, /* input/output error; hw bad */
43 FW_ENOEXEC = 8, /* exec format error; inv microcode */
44 FW_EAGAIN = 11, /* try again */
45 FW_ENOMEM = 12, /* out of memory */
46 FW_EFAULT = 14, /* bad address; fw bad */
47 FW_EBUSY = 16, /* resource busy */
48 FW_EEXIST = 17, /* file exists */
Anish Bhatt989594e2014-06-19 21:37:11 -070049 FW_ENODEV = 19, /* no such device */
Vipul Pandya5be78ee2012-12-10 09:30:54 +000050 FW_EINVAL = 22, /* invalid argument */
51 FW_ENOSPC = 28, /* no space left on device */
52 FW_ENOSYS = 38, /* functionality not implemented */
Anish Bhatt989594e2014-06-19 21:37:11 -070053 FW_ENODATA = 61, /* no data available */
Vipul Pandya5be78ee2012-12-10 09:30:54 +000054 FW_EPROTO = 71, /* protocol error */
55 FW_EADDRINUSE = 98, /* address already in use */
56 FW_EADDRNOTAVAIL = 99, /* cannot assigned requested address */
57 FW_ENETDOWN = 100, /* network is down */
58 FW_ENETUNREACH = 101, /* network is unreachable */
59 FW_ENOBUFS = 105, /* no buffer space available */
60 FW_ETIMEDOUT = 110, /* timeout */
61 FW_EINPROGRESS = 115, /* fw internal */
62 FW_SCSI_ABORT_REQUESTED = 128, /* */
63 FW_SCSI_ABORT_TIMEDOUT = 129, /* */
64 FW_SCSI_ABORTED = 130, /* */
65 FW_SCSI_CLOSE_REQUESTED = 131, /* */
66 FW_ERR_LINK_DOWN = 132, /* */
67 FW_RDEV_NOT_READY = 133, /* */
68 FW_ERR_RDEV_LOST = 134, /* */
69 FW_ERR_RDEV_LOGO = 135, /* */
70 FW_FCOE_NO_XCHG = 136, /* */
71 FW_SCSI_RSP_ERR = 137, /* */
72 FW_ERR_RDEV_IMPL_LOGO = 138, /* */
73 FW_SCSI_UNDER_FLOW_ERR = 139, /* */
74 FW_SCSI_OVER_FLOW_ERR = 140, /* */
75 FW_SCSI_DDP_ERR = 141, /* DDP error*/
76 FW_SCSI_TASK_ERR = 142, /* No SCSI tasks available */
Vipul Pandyaf2b7e782012-12-10 09:30:52 +000077};
78
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +000079#define FW_T4VF_SGE_BASE_ADDR 0x0000
80#define FW_T4VF_MPS_BASE_ADDR 0x0100
81#define FW_T4VF_PL_BASE_ADDR 0x0200
82#define FW_T4VF_MBDATA_BASE_ADDR 0x0240
83#define FW_T4VF_CIM_BASE_ADDR 0x0300
84
85enum fw_wr_opcodes {
86 FW_FILTER_WR = 0x02,
87 FW_ULPTX_WR = 0x04,
88 FW_TP_WR = 0x05,
89 FW_ETH_TX_PKT_WR = 0x08,
Vipul Pandya5be78ee2012-12-10 09:30:54 +000090 FW_OFLD_CONNECTION_WR = 0x2f,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +000091 FW_FLOWC_WR = 0x0a,
92 FW_OFLD_TX_DATA_WR = 0x0b,
93 FW_CMD_WR = 0x10,
94 FW_ETH_TX_PKT_VM_WR = 0x11,
95 FW_RI_RES_WR = 0x0c,
96 FW_RI_INIT_WR = 0x0d,
97 FW_RI_RDMA_WRITE_WR = 0x14,
98 FW_RI_SEND_WR = 0x15,
99 FW_RI_RDMA_READ_WR = 0x16,
100 FW_RI_RECV_WR = 0x17,
101 FW_RI_BIND_MW_WR = 0x18,
102 FW_RI_FR_NSMR_WR = 0x19,
103 FW_RI_INV_LSTAG_WR = 0x1a,
104 FW_LASTC2E_WR = 0x40
105};
106
107struct fw_wr_hdr {
108 __be32 hi;
109 __be32 lo;
110};
111
112#define FW_WR_OP(x) ((x) << 24)
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530113#define FW_WR_OP_GET(x) (((x) >> 24) & 0xff)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000114#define FW_WR_ATOMIC(x) ((x) << 23)
115#define FW_WR_FLUSH(x) ((x) << 22)
116#define FW_WR_COMPL(x) ((x) << 21)
Casey Leedom81323b72010-06-25 12:10:32 +0000117#define FW_WR_IMMDLEN_MASK 0xff
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000118#define FW_WR_IMMDLEN(x) ((x) << 0)
119
120#define FW_WR_EQUIQ (1U << 31)
121#define FW_WR_EQUEQ (1U << 30)
122#define FW_WR_FLOWID(x) ((x) << 8)
123#define FW_WR_LEN16(x) ((x) << 0)
124
Vipul Pandya13ee15d2012-09-26 02:39:40 +0000125#define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
Vipul Pandya5be78ee2012-12-10 09:30:54 +0000126#define HW_TPL_FR_MT_PR_OV_P_FC 0X327
Vipul Pandya13ee15d2012-09-26 02:39:40 +0000127
Vipul Pandyaf2b7e782012-12-10 09:30:52 +0000128/* filter wr reply code in cookie in CPL_SET_TCB_RPL */
129enum fw_filter_wr_cookie {
130 FW_FILTER_WR_SUCCESS,
131 FW_FILTER_WR_FLT_ADDED,
132 FW_FILTER_WR_FLT_DELETED,
133 FW_FILTER_WR_SMT_TBL_FULL,
134 FW_FILTER_WR_EINVAL,
135};
136
137struct fw_filter_wr {
138 __be32 op_pkd;
139 __be32 len16_pkd;
140 __be64 r3;
141 __be32 tid_to_iq;
142 __be32 del_filter_to_l2tix;
143 __be16 ethtype;
144 __be16 ethtypem;
145 __u8 frag_to_ovlan_vldm;
146 __u8 smac_sel;
147 __be16 rx_chan_rx_rpl_iq;
148 __be32 maci_to_matchtypem;
149 __u8 ptcl;
150 __u8 ptclm;
151 __u8 ttyp;
152 __u8 ttypm;
153 __be16 ivlan;
154 __be16 ivlanm;
155 __be16 ovlan;
156 __be16 ovlanm;
157 __u8 lip[16];
158 __u8 lipm[16];
159 __u8 fip[16];
160 __u8 fipm[16];
161 __be16 lp;
162 __be16 lpm;
163 __be16 fp;
164 __be16 fpm;
165 __be16 r7;
166 __u8 sma[6];
167};
168
169#define S_FW_FILTER_WR_TID 12
170#define M_FW_FILTER_WR_TID 0xfffff
171#define V_FW_FILTER_WR_TID(x) ((x) << S_FW_FILTER_WR_TID)
172#define G_FW_FILTER_WR_TID(x) \
173 (((x) >> S_FW_FILTER_WR_TID) & M_FW_FILTER_WR_TID)
174
175#define S_FW_FILTER_WR_RQTYPE 11
176#define M_FW_FILTER_WR_RQTYPE 0x1
177#define V_FW_FILTER_WR_RQTYPE(x) ((x) << S_FW_FILTER_WR_RQTYPE)
178#define G_FW_FILTER_WR_RQTYPE(x) \
179 (((x) >> S_FW_FILTER_WR_RQTYPE) & M_FW_FILTER_WR_RQTYPE)
180#define F_FW_FILTER_WR_RQTYPE V_FW_FILTER_WR_RQTYPE(1U)
181
182#define S_FW_FILTER_WR_NOREPLY 10
183#define M_FW_FILTER_WR_NOREPLY 0x1
184#define V_FW_FILTER_WR_NOREPLY(x) ((x) << S_FW_FILTER_WR_NOREPLY)
185#define G_FW_FILTER_WR_NOREPLY(x) \
186 (((x) >> S_FW_FILTER_WR_NOREPLY) & M_FW_FILTER_WR_NOREPLY)
187#define F_FW_FILTER_WR_NOREPLY V_FW_FILTER_WR_NOREPLY(1U)
188
189#define S_FW_FILTER_WR_IQ 0
190#define M_FW_FILTER_WR_IQ 0x3ff
191#define V_FW_FILTER_WR_IQ(x) ((x) << S_FW_FILTER_WR_IQ)
192#define G_FW_FILTER_WR_IQ(x) \
193 (((x) >> S_FW_FILTER_WR_IQ) & M_FW_FILTER_WR_IQ)
194
195#define S_FW_FILTER_WR_DEL_FILTER 31
196#define M_FW_FILTER_WR_DEL_FILTER 0x1
197#define V_FW_FILTER_WR_DEL_FILTER(x) ((x) << S_FW_FILTER_WR_DEL_FILTER)
198#define G_FW_FILTER_WR_DEL_FILTER(x) \
199 (((x) >> S_FW_FILTER_WR_DEL_FILTER) & M_FW_FILTER_WR_DEL_FILTER)
200#define F_FW_FILTER_WR_DEL_FILTER V_FW_FILTER_WR_DEL_FILTER(1U)
201
202#define S_FW_FILTER_WR_RPTTID 25
203#define M_FW_FILTER_WR_RPTTID 0x1
204#define V_FW_FILTER_WR_RPTTID(x) ((x) << S_FW_FILTER_WR_RPTTID)
205#define G_FW_FILTER_WR_RPTTID(x) \
206 (((x) >> S_FW_FILTER_WR_RPTTID) & M_FW_FILTER_WR_RPTTID)
207#define F_FW_FILTER_WR_RPTTID V_FW_FILTER_WR_RPTTID(1U)
208
209#define S_FW_FILTER_WR_DROP 24
210#define M_FW_FILTER_WR_DROP 0x1
211#define V_FW_FILTER_WR_DROP(x) ((x) << S_FW_FILTER_WR_DROP)
212#define G_FW_FILTER_WR_DROP(x) \
213 (((x) >> S_FW_FILTER_WR_DROP) & M_FW_FILTER_WR_DROP)
214#define F_FW_FILTER_WR_DROP V_FW_FILTER_WR_DROP(1U)
215
216#define S_FW_FILTER_WR_DIRSTEER 23
217#define M_FW_FILTER_WR_DIRSTEER 0x1
218#define V_FW_FILTER_WR_DIRSTEER(x) ((x) << S_FW_FILTER_WR_DIRSTEER)
219#define G_FW_FILTER_WR_DIRSTEER(x) \
220 (((x) >> S_FW_FILTER_WR_DIRSTEER) & M_FW_FILTER_WR_DIRSTEER)
221#define F_FW_FILTER_WR_DIRSTEER V_FW_FILTER_WR_DIRSTEER(1U)
222
223#define S_FW_FILTER_WR_MASKHASH 22
224#define M_FW_FILTER_WR_MASKHASH 0x1
225#define V_FW_FILTER_WR_MASKHASH(x) ((x) << S_FW_FILTER_WR_MASKHASH)
226#define G_FW_FILTER_WR_MASKHASH(x) \
227 (((x) >> S_FW_FILTER_WR_MASKHASH) & M_FW_FILTER_WR_MASKHASH)
228#define F_FW_FILTER_WR_MASKHASH V_FW_FILTER_WR_MASKHASH(1U)
229
230#define S_FW_FILTER_WR_DIRSTEERHASH 21
231#define M_FW_FILTER_WR_DIRSTEERHASH 0x1
232#define V_FW_FILTER_WR_DIRSTEERHASH(x) ((x) << S_FW_FILTER_WR_DIRSTEERHASH)
233#define G_FW_FILTER_WR_DIRSTEERHASH(x) \
234 (((x) >> S_FW_FILTER_WR_DIRSTEERHASH) & M_FW_FILTER_WR_DIRSTEERHASH)
235#define F_FW_FILTER_WR_DIRSTEERHASH V_FW_FILTER_WR_DIRSTEERHASH(1U)
236
237#define S_FW_FILTER_WR_LPBK 20
238#define M_FW_FILTER_WR_LPBK 0x1
239#define V_FW_FILTER_WR_LPBK(x) ((x) << S_FW_FILTER_WR_LPBK)
240#define G_FW_FILTER_WR_LPBK(x) \
241 (((x) >> S_FW_FILTER_WR_LPBK) & M_FW_FILTER_WR_LPBK)
242#define F_FW_FILTER_WR_LPBK V_FW_FILTER_WR_LPBK(1U)
243
244#define S_FW_FILTER_WR_DMAC 19
245#define M_FW_FILTER_WR_DMAC 0x1
246#define V_FW_FILTER_WR_DMAC(x) ((x) << S_FW_FILTER_WR_DMAC)
247#define G_FW_FILTER_WR_DMAC(x) \
248 (((x) >> S_FW_FILTER_WR_DMAC) & M_FW_FILTER_WR_DMAC)
249#define F_FW_FILTER_WR_DMAC V_FW_FILTER_WR_DMAC(1U)
250
251#define S_FW_FILTER_WR_SMAC 18
252#define M_FW_FILTER_WR_SMAC 0x1
253#define V_FW_FILTER_WR_SMAC(x) ((x) << S_FW_FILTER_WR_SMAC)
254#define G_FW_FILTER_WR_SMAC(x) \
255 (((x) >> S_FW_FILTER_WR_SMAC) & M_FW_FILTER_WR_SMAC)
256#define F_FW_FILTER_WR_SMAC V_FW_FILTER_WR_SMAC(1U)
257
258#define S_FW_FILTER_WR_INSVLAN 17
259#define M_FW_FILTER_WR_INSVLAN 0x1
260#define V_FW_FILTER_WR_INSVLAN(x) ((x) << S_FW_FILTER_WR_INSVLAN)
261#define G_FW_FILTER_WR_INSVLAN(x) \
262 (((x) >> S_FW_FILTER_WR_INSVLAN) & M_FW_FILTER_WR_INSVLAN)
263#define F_FW_FILTER_WR_INSVLAN V_FW_FILTER_WR_INSVLAN(1U)
264
265#define S_FW_FILTER_WR_RMVLAN 16
266#define M_FW_FILTER_WR_RMVLAN 0x1
267#define V_FW_FILTER_WR_RMVLAN(x) ((x) << S_FW_FILTER_WR_RMVLAN)
268#define G_FW_FILTER_WR_RMVLAN(x) \
269 (((x) >> S_FW_FILTER_WR_RMVLAN) & M_FW_FILTER_WR_RMVLAN)
270#define F_FW_FILTER_WR_RMVLAN V_FW_FILTER_WR_RMVLAN(1U)
271
272#define S_FW_FILTER_WR_HITCNTS 15
273#define M_FW_FILTER_WR_HITCNTS 0x1
274#define V_FW_FILTER_WR_HITCNTS(x) ((x) << S_FW_FILTER_WR_HITCNTS)
275#define G_FW_FILTER_WR_HITCNTS(x) \
276 (((x) >> S_FW_FILTER_WR_HITCNTS) & M_FW_FILTER_WR_HITCNTS)
277#define F_FW_FILTER_WR_HITCNTS V_FW_FILTER_WR_HITCNTS(1U)
278
279#define S_FW_FILTER_WR_TXCHAN 13
280#define M_FW_FILTER_WR_TXCHAN 0x3
281#define V_FW_FILTER_WR_TXCHAN(x) ((x) << S_FW_FILTER_WR_TXCHAN)
282#define G_FW_FILTER_WR_TXCHAN(x) \
283 (((x) >> S_FW_FILTER_WR_TXCHAN) & M_FW_FILTER_WR_TXCHAN)
284
285#define S_FW_FILTER_WR_PRIO 12
286#define M_FW_FILTER_WR_PRIO 0x1
287#define V_FW_FILTER_WR_PRIO(x) ((x) << S_FW_FILTER_WR_PRIO)
288#define G_FW_FILTER_WR_PRIO(x) \
289 (((x) >> S_FW_FILTER_WR_PRIO) & M_FW_FILTER_WR_PRIO)
290#define F_FW_FILTER_WR_PRIO V_FW_FILTER_WR_PRIO(1U)
291
292#define S_FW_FILTER_WR_L2TIX 0
293#define M_FW_FILTER_WR_L2TIX 0xfff
294#define V_FW_FILTER_WR_L2TIX(x) ((x) << S_FW_FILTER_WR_L2TIX)
295#define G_FW_FILTER_WR_L2TIX(x) \
296 (((x) >> S_FW_FILTER_WR_L2TIX) & M_FW_FILTER_WR_L2TIX)
297
298#define S_FW_FILTER_WR_FRAG 7
299#define M_FW_FILTER_WR_FRAG 0x1
300#define V_FW_FILTER_WR_FRAG(x) ((x) << S_FW_FILTER_WR_FRAG)
301#define G_FW_FILTER_WR_FRAG(x) \
302 (((x) >> S_FW_FILTER_WR_FRAG) & M_FW_FILTER_WR_FRAG)
303#define F_FW_FILTER_WR_FRAG V_FW_FILTER_WR_FRAG(1U)
304
305#define S_FW_FILTER_WR_FRAGM 6
306#define M_FW_FILTER_WR_FRAGM 0x1
307#define V_FW_FILTER_WR_FRAGM(x) ((x) << S_FW_FILTER_WR_FRAGM)
308#define G_FW_FILTER_WR_FRAGM(x) \
309 (((x) >> S_FW_FILTER_WR_FRAGM) & M_FW_FILTER_WR_FRAGM)
310#define F_FW_FILTER_WR_FRAGM V_FW_FILTER_WR_FRAGM(1U)
311
312#define S_FW_FILTER_WR_IVLAN_VLD 5
313#define M_FW_FILTER_WR_IVLAN_VLD 0x1
314#define V_FW_FILTER_WR_IVLAN_VLD(x) ((x) << S_FW_FILTER_WR_IVLAN_VLD)
315#define G_FW_FILTER_WR_IVLAN_VLD(x) \
316 (((x) >> S_FW_FILTER_WR_IVLAN_VLD) & M_FW_FILTER_WR_IVLAN_VLD)
317#define F_FW_FILTER_WR_IVLAN_VLD V_FW_FILTER_WR_IVLAN_VLD(1U)
318
319#define S_FW_FILTER_WR_OVLAN_VLD 4
320#define M_FW_FILTER_WR_OVLAN_VLD 0x1
321#define V_FW_FILTER_WR_OVLAN_VLD(x) ((x) << S_FW_FILTER_WR_OVLAN_VLD)
322#define G_FW_FILTER_WR_OVLAN_VLD(x) \
323 (((x) >> S_FW_FILTER_WR_OVLAN_VLD) & M_FW_FILTER_WR_OVLAN_VLD)
324#define F_FW_FILTER_WR_OVLAN_VLD V_FW_FILTER_WR_OVLAN_VLD(1U)
325
326#define S_FW_FILTER_WR_IVLAN_VLDM 3
327#define M_FW_FILTER_WR_IVLAN_VLDM 0x1
328#define V_FW_FILTER_WR_IVLAN_VLDM(x) ((x) << S_FW_FILTER_WR_IVLAN_VLDM)
329#define G_FW_FILTER_WR_IVLAN_VLDM(x) \
330 (((x) >> S_FW_FILTER_WR_IVLAN_VLDM) & M_FW_FILTER_WR_IVLAN_VLDM)
331#define F_FW_FILTER_WR_IVLAN_VLDM V_FW_FILTER_WR_IVLAN_VLDM(1U)
332
333#define S_FW_FILTER_WR_OVLAN_VLDM 2
334#define M_FW_FILTER_WR_OVLAN_VLDM 0x1
335#define V_FW_FILTER_WR_OVLAN_VLDM(x) ((x) << S_FW_FILTER_WR_OVLAN_VLDM)
336#define G_FW_FILTER_WR_OVLAN_VLDM(x) \
337 (((x) >> S_FW_FILTER_WR_OVLAN_VLDM) & M_FW_FILTER_WR_OVLAN_VLDM)
338#define F_FW_FILTER_WR_OVLAN_VLDM V_FW_FILTER_WR_OVLAN_VLDM(1U)
339
340#define S_FW_FILTER_WR_RX_CHAN 15
341#define M_FW_FILTER_WR_RX_CHAN 0x1
342#define V_FW_FILTER_WR_RX_CHAN(x) ((x) << S_FW_FILTER_WR_RX_CHAN)
343#define G_FW_FILTER_WR_RX_CHAN(x) \
344 (((x) >> S_FW_FILTER_WR_RX_CHAN) & M_FW_FILTER_WR_RX_CHAN)
345#define F_FW_FILTER_WR_RX_CHAN V_FW_FILTER_WR_RX_CHAN(1U)
346
347#define S_FW_FILTER_WR_RX_RPL_IQ 0
348#define M_FW_FILTER_WR_RX_RPL_IQ 0x3ff
349#define V_FW_FILTER_WR_RX_RPL_IQ(x) ((x) << S_FW_FILTER_WR_RX_RPL_IQ)
350#define G_FW_FILTER_WR_RX_RPL_IQ(x) \
351 (((x) >> S_FW_FILTER_WR_RX_RPL_IQ) & M_FW_FILTER_WR_RX_RPL_IQ)
352
353#define S_FW_FILTER_WR_MACI 23
354#define M_FW_FILTER_WR_MACI 0x1ff
355#define V_FW_FILTER_WR_MACI(x) ((x) << S_FW_FILTER_WR_MACI)
356#define G_FW_FILTER_WR_MACI(x) \
357 (((x) >> S_FW_FILTER_WR_MACI) & M_FW_FILTER_WR_MACI)
358
359#define S_FW_FILTER_WR_MACIM 14
360#define M_FW_FILTER_WR_MACIM 0x1ff
361#define V_FW_FILTER_WR_MACIM(x) ((x) << S_FW_FILTER_WR_MACIM)
362#define G_FW_FILTER_WR_MACIM(x) \
363 (((x) >> S_FW_FILTER_WR_MACIM) & M_FW_FILTER_WR_MACIM)
364
365#define S_FW_FILTER_WR_FCOE 13
366#define M_FW_FILTER_WR_FCOE 0x1
367#define V_FW_FILTER_WR_FCOE(x) ((x) << S_FW_FILTER_WR_FCOE)
368#define G_FW_FILTER_WR_FCOE(x) \
369 (((x) >> S_FW_FILTER_WR_FCOE) & M_FW_FILTER_WR_FCOE)
370#define F_FW_FILTER_WR_FCOE V_FW_FILTER_WR_FCOE(1U)
371
372#define S_FW_FILTER_WR_FCOEM 12
373#define M_FW_FILTER_WR_FCOEM 0x1
374#define V_FW_FILTER_WR_FCOEM(x) ((x) << S_FW_FILTER_WR_FCOEM)
375#define G_FW_FILTER_WR_FCOEM(x) \
376 (((x) >> S_FW_FILTER_WR_FCOEM) & M_FW_FILTER_WR_FCOEM)
377#define F_FW_FILTER_WR_FCOEM V_FW_FILTER_WR_FCOEM(1U)
378
379#define S_FW_FILTER_WR_PORT 9
380#define M_FW_FILTER_WR_PORT 0x7
381#define V_FW_FILTER_WR_PORT(x) ((x) << S_FW_FILTER_WR_PORT)
382#define G_FW_FILTER_WR_PORT(x) \
383 (((x) >> S_FW_FILTER_WR_PORT) & M_FW_FILTER_WR_PORT)
384
385#define S_FW_FILTER_WR_PORTM 6
386#define M_FW_FILTER_WR_PORTM 0x7
387#define V_FW_FILTER_WR_PORTM(x) ((x) << S_FW_FILTER_WR_PORTM)
388#define G_FW_FILTER_WR_PORTM(x) \
389 (((x) >> S_FW_FILTER_WR_PORTM) & M_FW_FILTER_WR_PORTM)
390
391#define S_FW_FILTER_WR_MATCHTYPE 3
392#define M_FW_FILTER_WR_MATCHTYPE 0x7
393#define V_FW_FILTER_WR_MATCHTYPE(x) ((x) << S_FW_FILTER_WR_MATCHTYPE)
394#define G_FW_FILTER_WR_MATCHTYPE(x) \
395 (((x) >> S_FW_FILTER_WR_MATCHTYPE) & M_FW_FILTER_WR_MATCHTYPE)
396
397#define S_FW_FILTER_WR_MATCHTYPEM 0
398#define M_FW_FILTER_WR_MATCHTYPEM 0x7
399#define V_FW_FILTER_WR_MATCHTYPEM(x) ((x) << S_FW_FILTER_WR_MATCHTYPEM)
400#define G_FW_FILTER_WR_MATCHTYPEM(x) \
401 (((x) >> S_FW_FILTER_WR_MATCHTYPEM) & M_FW_FILTER_WR_MATCHTYPEM)
402
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000403struct fw_ulptx_wr {
404 __be32 op_to_compl;
405 __be32 flowid_len16;
406 u64 cookie;
407};
408
409struct fw_tp_wr {
410 __be32 op_to_immdlen;
411 __be32 flowid_len16;
412 u64 cookie;
413};
414
415struct fw_eth_tx_pkt_wr {
416 __be32 op_immdlen;
417 __be32 equiq_to_len16;
418 __be64 r3;
419};
420
Vipul Pandya5be78ee2012-12-10 09:30:54 +0000421struct fw_ofld_connection_wr {
422 __be32 op_compl;
423 __be32 len16_pkd;
424 __u64 cookie;
425 __be64 r2;
426 __be64 r3;
427 struct fw_ofld_connection_le {
428 __be32 version_cpl;
429 __be32 filter;
430 __be32 r1;
431 __be16 lport;
432 __be16 pport;
433 union fw_ofld_connection_leip {
434 struct fw_ofld_connection_le_ipv4 {
435 __be32 pip;
436 __be32 lip;
437 __be64 r0;
438 __be64 r1;
439 __be64 r2;
440 } ipv4;
441 struct fw_ofld_connection_le_ipv6 {
442 __be64 pip_hi;
443 __be64 pip_lo;
444 __be64 lip_hi;
445 __be64 lip_lo;
446 } ipv6;
447 } u;
448 } le;
449 struct fw_ofld_connection_tcb {
450 __be32 t_state_to_astid;
451 __be16 cplrxdataack_cplpassacceptrpl;
452 __be16 rcv_adv;
453 __be32 rcv_nxt;
454 __be32 tx_max;
455 __be64 opt0;
456 __be32 opt2;
457 __be32 r1;
458 __be64 r2;
459 __be64 r3;
460 } tcb;
461};
462
463#define S_FW_OFLD_CONNECTION_WR_VERSION 31
464#define M_FW_OFLD_CONNECTION_WR_VERSION 0x1
465#define V_FW_OFLD_CONNECTION_WR_VERSION(x) \
466 ((x) << S_FW_OFLD_CONNECTION_WR_VERSION)
467#define G_FW_OFLD_CONNECTION_WR_VERSION(x) \
468 (((x) >> S_FW_OFLD_CONNECTION_WR_VERSION) & \
469 M_FW_OFLD_CONNECTION_WR_VERSION)
470#define F_FW_OFLD_CONNECTION_WR_VERSION \
471 V_FW_OFLD_CONNECTION_WR_VERSION(1U)
472
473#define S_FW_OFLD_CONNECTION_WR_CPL 30
474#define M_FW_OFLD_CONNECTION_WR_CPL 0x1
475#define V_FW_OFLD_CONNECTION_WR_CPL(x) ((x) << S_FW_OFLD_CONNECTION_WR_CPL)
476#define G_FW_OFLD_CONNECTION_WR_CPL(x) \
477 (((x) >> S_FW_OFLD_CONNECTION_WR_CPL) & M_FW_OFLD_CONNECTION_WR_CPL)
478#define F_FW_OFLD_CONNECTION_WR_CPL V_FW_OFLD_CONNECTION_WR_CPL(1U)
479
480#define S_FW_OFLD_CONNECTION_WR_T_STATE 28
481#define M_FW_OFLD_CONNECTION_WR_T_STATE 0xf
482#define V_FW_OFLD_CONNECTION_WR_T_STATE(x) \
483 ((x) << S_FW_OFLD_CONNECTION_WR_T_STATE)
484#define G_FW_OFLD_CONNECTION_WR_T_STATE(x) \
485 (((x) >> S_FW_OFLD_CONNECTION_WR_T_STATE) & \
486 M_FW_OFLD_CONNECTION_WR_T_STATE)
487
488#define S_FW_OFLD_CONNECTION_WR_RCV_SCALE 24
489#define M_FW_OFLD_CONNECTION_WR_RCV_SCALE 0xf
490#define V_FW_OFLD_CONNECTION_WR_RCV_SCALE(x) \
491 ((x) << S_FW_OFLD_CONNECTION_WR_RCV_SCALE)
492#define G_FW_OFLD_CONNECTION_WR_RCV_SCALE(x) \
493 (((x) >> S_FW_OFLD_CONNECTION_WR_RCV_SCALE) & \
494 M_FW_OFLD_CONNECTION_WR_RCV_SCALE)
495
496#define S_FW_OFLD_CONNECTION_WR_ASTID 0
497#define M_FW_OFLD_CONNECTION_WR_ASTID 0xffffff
498#define V_FW_OFLD_CONNECTION_WR_ASTID(x) \
499 ((x) << S_FW_OFLD_CONNECTION_WR_ASTID)
500#define G_FW_OFLD_CONNECTION_WR_ASTID(x) \
501 (((x) >> S_FW_OFLD_CONNECTION_WR_ASTID) & M_FW_OFLD_CONNECTION_WR_ASTID)
502
503#define S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK 15
504#define M_FW_OFLD_CONNECTION_WR_CPLRXDATAACK 0x1
505#define V_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(x) \
506 ((x) << S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK)
507#define G_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(x) \
508 (((x) >> S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK) & \
509 M_FW_OFLD_CONNECTION_WR_CPLRXDATAACK)
510#define F_FW_OFLD_CONNECTION_WR_CPLRXDATAACK \
511 V_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(1U)
512
513#define S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL 14
514#define M_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL 0x1
515#define V_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(x) \
516 ((x) << S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL)
517#define G_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(x) \
518 (((x) >> S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL) & \
519 M_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL)
520#define F_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL \
521 V_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(1U)
522
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000523enum fw_flowc_mnem {
524 FW_FLOWC_MNEM_PFNVFN, /* PFN [15:8] VFN [7:0] */
525 FW_FLOWC_MNEM_CH,
526 FW_FLOWC_MNEM_PORT,
527 FW_FLOWC_MNEM_IQID,
528 FW_FLOWC_MNEM_SNDNXT,
529 FW_FLOWC_MNEM_RCVNXT,
530 FW_FLOWC_MNEM_SNDBUF,
531 FW_FLOWC_MNEM_MSS,
532};
533
534struct fw_flowc_mnemval {
535 u8 mnemonic;
536 u8 r4[3];
537 __be32 val;
538};
539
540struct fw_flowc_wr {
541 __be32 op_to_nparams;
542#define FW_FLOWC_WR_NPARAMS(x) ((x) << 0)
543 __be32 flowid_len16;
544 struct fw_flowc_mnemval mnemval[0];
545};
546
547struct fw_ofld_tx_data_wr {
548 __be32 op_to_immdlen;
549 __be32 flowid_len16;
550 __be32 plen;
551 __be32 tunnel_to_proxy;
552#define FW_OFLD_TX_DATA_WR_TUNNEL(x) ((x) << 19)
553#define FW_OFLD_TX_DATA_WR_SAVE(x) ((x) << 18)
554#define FW_OFLD_TX_DATA_WR_FLUSH(x) ((x) << 17)
555#define FW_OFLD_TX_DATA_WR_URGENT(x) ((x) << 16)
556#define FW_OFLD_TX_DATA_WR_MORE(x) ((x) << 15)
557#define FW_OFLD_TX_DATA_WR_SHOVE(x) ((x) << 14)
558#define FW_OFLD_TX_DATA_WR_ULPMODE(x) ((x) << 10)
559#define FW_OFLD_TX_DATA_WR_ULPSUBMODE(x) ((x) << 6)
560};
561
562struct fw_cmd_wr {
563 __be32 op_dma;
564#define FW_CMD_WR_DMA (1U << 17)
565 __be32 len16_pkd;
566 __be64 cookie_daddr;
567};
568
569struct fw_eth_tx_pkt_vm_wr {
570 __be32 op_immdlen;
571 __be32 equiq_to_len16;
572 __be32 r3[2];
573 u8 ethmacdst[6];
574 u8 ethmacsrc[6];
575 __be16 ethtype;
576 __be16 vlantci;
577};
578
Santosh Rastapur2422d9a2013-03-14 05:08:48 +0000579#define FW_CMD_MAX_TIMEOUT 10000
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000580
Vipul Pandya636f9d32012-09-26 02:39:39 +0000581/*
582 * If a host driver does a HELLO and discovers that there's already a MASTER
583 * selected, we may have to wait for that MASTER to finish issuing RESET,
584 * configuration and INITIALIZE commands. Also, there's a possibility that
585 * our own HELLO may get lost if it happens right as the MASTER is issuign a
586 * RESET command, so we need to be willing to make a few retries of our HELLO.
587 */
588#define FW_CMD_HELLO_TIMEOUT (3 * FW_CMD_MAX_TIMEOUT)
589#define FW_CMD_HELLO_RETRIES 3
590
591
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000592enum fw_cmd_opcodes {
593 FW_LDST_CMD = 0x01,
594 FW_RESET_CMD = 0x03,
595 FW_HELLO_CMD = 0x04,
596 FW_BYE_CMD = 0x05,
597 FW_INITIALIZE_CMD = 0x06,
598 FW_CAPS_CONFIG_CMD = 0x07,
599 FW_PARAMS_CMD = 0x08,
600 FW_PFVF_CMD = 0x09,
601 FW_IQ_CMD = 0x10,
602 FW_EQ_MNGT_CMD = 0x11,
603 FW_EQ_ETH_CMD = 0x12,
604 FW_EQ_CTRL_CMD = 0x13,
605 FW_EQ_OFLD_CMD = 0x21,
606 FW_VI_CMD = 0x14,
607 FW_VI_MAC_CMD = 0x15,
608 FW_VI_RXMODE_CMD = 0x16,
609 FW_VI_ENABLE_CMD = 0x17,
610 FW_ACL_MAC_CMD = 0x18,
611 FW_ACL_VLAN_CMD = 0x19,
612 FW_VI_STATS_CMD = 0x1a,
613 FW_PORT_CMD = 0x1b,
614 FW_PORT_STATS_CMD = 0x1c,
615 FW_PORT_LB_STATS_CMD = 0x1d,
616 FW_PORT_TRACE_CMD = 0x1e,
617 FW_PORT_TRACE_MMAP_CMD = 0x1f,
618 FW_RSS_IND_TBL_CMD = 0x20,
619 FW_RSS_GLB_CONFIG_CMD = 0x22,
620 FW_RSS_VI_CONFIG_CMD = 0x23,
Vipul Pandya01bcca62013-07-04 16:10:46 +0530621 FW_CLIP_CMD = 0x28,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000622 FW_LASTC2E_CMD = 0x40,
623 FW_ERROR_CMD = 0x80,
624 FW_DEBUG_CMD = 0x81,
625};
626
627enum fw_cmd_cap {
628 FW_CMD_CAP_PF = 0x01,
629 FW_CMD_CAP_DMAQ = 0x02,
630 FW_CMD_CAP_PORT = 0x04,
631 FW_CMD_CAP_PORTPROMISC = 0x08,
632 FW_CMD_CAP_PORTSTATS = 0x10,
633 FW_CMD_CAP_VF = 0x80,
634};
635
636/*
637 * Generic command header flit0
638 */
639struct fw_cmd_hdr {
640 __be32 hi;
641 __be32 lo;
642};
643
644#define FW_CMD_OP(x) ((x) << 24)
645#define FW_CMD_OP_GET(x) (((x) >> 24) & 0xff)
646#define FW_CMD_REQUEST (1U << 23)
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530647#define FW_CMD_REQUEST_GET(x) (((x) >> 23) & 0x1)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000648#define FW_CMD_READ (1U << 22)
649#define FW_CMD_WRITE (1U << 21)
650#define FW_CMD_EXEC (1U << 20)
651#define FW_CMD_RAMASK(x) ((x) << 20)
652#define FW_CMD_RETVAL(x) ((x) << 8)
653#define FW_CMD_RETVAL_GET(x) (((x) >> 8) & 0xff)
654#define FW_CMD_LEN16(x) ((x) << 0)
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530655#define FW_LEN16(fw_struct) FW_CMD_LEN16(sizeof(fw_struct) / 16)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000656
657enum fw_ldst_addrspc {
658 FW_LDST_ADDRSPC_FIRMWARE = 0x0001,
659 FW_LDST_ADDRSPC_SGE_EGRC = 0x0008,
660 FW_LDST_ADDRSPC_SGE_INGC = 0x0009,
661 FW_LDST_ADDRSPC_SGE_FLMC = 0x000a,
662 FW_LDST_ADDRSPC_SGE_CONMC = 0x000b,
663 FW_LDST_ADDRSPC_TP_PIO = 0x0010,
664 FW_LDST_ADDRSPC_TP_TM_PIO = 0x0011,
665 FW_LDST_ADDRSPC_TP_MIB = 0x0012,
666 FW_LDST_ADDRSPC_MDIO = 0x0018,
667 FW_LDST_ADDRSPC_MPS = 0x0020,
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530668 FW_LDST_ADDRSPC_FUNC = 0x0028,
669 FW_LDST_ADDRSPC_FUNC_PCIE = 0x0029,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000670};
671
672enum fw_ldst_mps_fid {
673 FW_LDST_MPS_ATRB,
674 FW_LDST_MPS_RPLC
675};
676
677enum fw_ldst_func_access_ctl {
678 FW_LDST_FUNC_ACC_CTL_VIID,
679 FW_LDST_FUNC_ACC_CTL_FID
680};
681
682enum fw_ldst_func_mod_index {
683 FW_LDST_FUNC_MPS
684};
685
686struct fw_ldst_cmd {
687 __be32 op_to_addrspace;
688#define FW_LDST_CMD_ADDRSPACE(x) ((x) << 0)
689 __be32 cycles_to_len16;
690 union fw_ldst {
691 struct fw_ldst_addrval {
692 __be32 addr;
693 __be32 val;
694 } addrval;
695 struct fw_ldst_idctxt {
696 __be32 physid;
697 __be32 msg_pkd;
698 __be32 ctxt_data7;
699 __be32 ctxt_data6;
700 __be32 ctxt_data5;
701 __be32 ctxt_data4;
702 __be32 ctxt_data3;
703 __be32 ctxt_data2;
704 __be32 ctxt_data1;
705 __be32 ctxt_data0;
706 } idctxt;
707 struct fw_ldst_mdio {
708 __be16 paddr_mmd;
709 __be16 raddr;
710 __be16 vctl;
711 __be16 rval;
712 } mdio;
713 struct fw_ldst_mps {
714 __be16 fid_ctl;
715 __be16 rplcpf_pkd;
716 __be32 rplc127_96;
717 __be32 rplc95_64;
718 __be32 rplc63_32;
719 __be32 rplc31_0;
720 __be32 atrb;
721 __be16 vlan[16];
722 } mps;
723 struct fw_ldst_func {
724 u8 access_ctl;
725 u8 mod_index;
726 __be16 ctl_id;
727 __be32 offset;
728 __be64 data0;
729 __be64 data1;
730 } func;
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530731 struct fw_ldst_pcie {
732 u8 ctrl_to_fn;
733 u8 bnum;
734 u8 r;
735 u8 ext_r;
736 u8 select_naccess;
737 u8 pcie_fn;
738 __be16 nset_pkd;
739 __be32 data[12];
740 } pcie;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000741 } u;
742};
743
744#define FW_LDST_CMD_MSG(x) ((x) << 31)
745#define FW_LDST_CMD_PADDR(x) ((x) << 8)
746#define FW_LDST_CMD_MMD(x) ((x) << 0)
747#define FW_LDST_CMD_FID(x) ((x) << 15)
748#define FW_LDST_CMD_CTL(x) ((x) << 0)
749#define FW_LDST_CMD_RPLCPF(x) ((x) << 0)
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530750#define FW_LDST_CMD_LC (1U << 4)
751#define FW_LDST_CMD_NACCESS(x) ((x) << 0)
752#define FW_LDST_CMD_FN(x) ((x) << 0)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000753
754struct fw_reset_cmd {
755 __be32 op_to_write;
756 __be32 retval_len16;
757 __be32 val;
Vipul Pandya26f7cbc2012-09-26 02:39:42 +0000758 __be32 halt_pkd;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000759};
760
Vipul Pandya26f7cbc2012-09-26 02:39:42 +0000761#define FW_RESET_CMD_HALT_SHIFT 31
762#define FW_RESET_CMD_HALT_MASK 0x1
763#define FW_RESET_CMD_HALT(x) ((x) << FW_RESET_CMD_HALT_SHIFT)
764#define FW_RESET_CMD_HALT_GET(x) \
765 (((x) >> FW_RESET_CMD_HALT_SHIFT) & FW_RESET_CMD_HALT_MASK)
766
Vipul Pandya636f9d32012-09-26 02:39:39 +0000767enum fw_hellow_cmd {
768 fw_hello_cmd_stage_os = 0x0
769};
770
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000771struct fw_hello_cmd {
772 __be32 op_to_write;
773 __be32 retval_len16;
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530774 __be32 err_to_clearinit;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000775#define FW_HELLO_CMD_ERR (1U << 31)
776#define FW_HELLO_CMD_INIT (1U << 30)
777#define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
778#define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)
Vipul Pandya636f9d32012-09-26 02:39:39 +0000779#define FW_HELLO_CMD_MBMASTER_MASK 0xfU
780#define FW_HELLO_CMD_MBMASTER_SHIFT 24
781#define FW_HELLO_CMD_MBMASTER(x) ((x) << FW_HELLO_CMD_MBMASTER_SHIFT)
782#define FW_HELLO_CMD_MBMASTER_GET(x) \
783 (((x) >> FW_HELLO_CMD_MBMASTER_SHIFT) & FW_HELLO_CMD_MBMASTER_MASK)
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530784#define FW_HELLO_CMD_MBASYNCNOTINT(x) ((x) << 23)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000785#define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)
Vipul Pandya636f9d32012-09-26 02:39:39 +0000786#define FW_HELLO_CMD_STAGE(x) ((x) << 17)
787#define FW_HELLO_CMD_CLEARINIT (1U << 16)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000788 __be32 fwrev;
789};
790
791struct fw_bye_cmd {
792 __be32 op_to_write;
793 __be32 retval_len16;
794 __be64 r3;
795};
796
797struct fw_initialize_cmd {
798 __be32 op_to_write;
799 __be32 retval_len16;
800 __be64 r3;
801};
802
803enum fw_caps_config_hm {
804 FW_CAPS_CONFIG_HM_PCIE = 0x00000001,
805 FW_CAPS_CONFIG_HM_PL = 0x00000002,
806 FW_CAPS_CONFIG_HM_SGE = 0x00000004,
807 FW_CAPS_CONFIG_HM_CIM = 0x00000008,
808 FW_CAPS_CONFIG_HM_ULPTX = 0x00000010,
809 FW_CAPS_CONFIG_HM_TP = 0x00000020,
810 FW_CAPS_CONFIG_HM_ULPRX = 0x00000040,
811 FW_CAPS_CONFIG_HM_PMRX = 0x00000080,
812 FW_CAPS_CONFIG_HM_PMTX = 0x00000100,
813 FW_CAPS_CONFIG_HM_MC = 0x00000200,
814 FW_CAPS_CONFIG_HM_LE = 0x00000400,
815 FW_CAPS_CONFIG_HM_MPS = 0x00000800,
816 FW_CAPS_CONFIG_HM_XGMAC = 0x00001000,
817 FW_CAPS_CONFIG_HM_CPLSWITCH = 0x00002000,
818 FW_CAPS_CONFIG_HM_T4DBG = 0x00004000,
819 FW_CAPS_CONFIG_HM_MI = 0x00008000,
820 FW_CAPS_CONFIG_HM_I2CM = 0x00010000,
821 FW_CAPS_CONFIG_HM_NCSI = 0x00020000,
822 FW_CAPS_CONFIG_HM_SMB = 0x00040000,
823 FW_CAPS_CONFIG_HM_MA = 0x00080000,
824 FW_CAPS_CONFIG_HM_EDRAM = 0x00100000,
825 FW_CAPS_CONFIG_HM_PMU = 0x00200000,
826 FW_CAPS_CONFIG_HM_UART = 0x00400000,
827 FW_CAPS_CONFIG_HM_SF = 0x00800000,
828};
829
830enum fw_caps_config_nbm {
831 FW_CAPS_CONFIG_NBM_IPMI = 0x00000001,
832 FW_CAPS_CONFIG_NBM_NCSI = 0x00000002,
833};
834
835enum fw_caps_config_link {
836 FW_CAPS_CONFIG_LINK_PPP = 0x00000001,
837 FW_CAPS_CONFIG_LINK_QFC = 0x00000002,
838 FW_CAPS_CONFIG_LINK_DCBX = 0x00000004,
839};
840
841enum fw_caps_config_switch {
842 FW_CAPS_CONFIG_SWITCH_INGRESS = 0x00000001,
843 FW_CAPS_CONFIG_SWITCH_EGRESS = 0x00000002,
844};
845
846enum fw_caps_config_nic {
847 FW_CAPS_CONFIG_NIC = 0x00000001,
848 FW_CAPS_CONFIG_NIC_VM = 0x00000002,
849};
850
851enum fw_caps_config_ofld {
852 FW_CAPS_CONFIG_OFLD = 0x00000001,
853};
854
855enum fw_caps_config_rdma {
856 FW_CAPS_CONFIG_RDMA_RDDP = 0x00000001,
857 FW_CAPS_CONFIG_RDMA_RDMAC = 0x00000002,
858};
859
860enum fw_caps_config_iscsi {
861 FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU = 0x00000001,
862 FW_CAPS_CONFIG_ISCSI_TARGET_PDU = 0x00000002,
863 FW_CAPS_CONFIG_ISCSI_INITIATOR_CNXOFLD = 0x00000004,
864 FW_CAPS_CONFIG_ISCSI_TARGET_CNXOFLD = 0x00000008,
865};
866
867enum fw_caps_config_fcoe {
868 FW_CAPS_CONFIG_FCOE_INITIATOR = 0x00000001,
869 FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530870 FW_CAPS_CONFIG_FCOE_CTRL_OFLD = 0x00000004,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000871};
872
Vipul Pandya52367a72012-09-26 02:39:38 +0000873enum fw_memtype_cf {
874 FW_MEMTYPE_CF_EDC0 = 0x0,
875 FW_MEMTYPE_CF_EDC1 = 0x1,
876 FW_MEMTYPE_CF_EXTMEM = 0x2,
877 FW_MEMTYPE_CF_FLASH = 0x4,
878 FW_MEMTYPE_CF_INTERNAL = 0x5,
879};
880
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000881struct fw_caps_config_cmd {
882 __be32 op_to_write;
Naresh Kumar Innace91a922012-11-15 22:41:17 +0530883 __be32 cfvalid_to_len16;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000884 __be32 r2;
885 __be32 hwmbitmap;
886 __be16 nbmcaps;
887 __be16 linkcaps;
888 __be16 switchcaps;
889 __be16 r3;
890 __be16 niccaps;
891 __be16 ofldcaps;
892 __be16 rdmacaps;
893 __be16 r4;
894 __be16 iscsicaps;
895 __be16 fcoecaps;
Vipul Pandya52367a72012-09-26 02:39:38 +0000896 __be32 cfcsum;
897 __be32 finiver;
898 __be32 finicsum;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000899};
900
Vipul Pandya52367a72012-09-26 02:39:38 +0000901#define FW_CAPS_CONFIG_CMD_CFVALID (1U << 27)
902#define FW_CAPS_CONFIG_CMD_MEMTYPE_CF(x) ((x) << 24)
903#define FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(x) ((x) << 16)
904
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000905/*
906 * params command mnemonics
907 */
908enum fw_params_mnem {
909 FW_PARAMS_MNEM_DEV = 1, /* device params */
910 FW_PARAMS_MNEM_PFVF = 2, /* function params */
911 FW_PARAMS_MNEM_REG = 3, /* limited register access */
912 FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */
913 FW_PARAMS_MNEM_LAST
914};
915
916/*
917 * device parameters
918 */
919enum fw_params_param_dev {
920 FW_PARAMS_PARAM_DEV_CCLK = 0x00, /* chip core clock in khz */
921 FW_PARAMS_PARAM_DEV_PORTVEC = 0x01, /* the port vector */
922 FW_PARAMS_PARAM_DEV_NTID = 0x02, /* reads the number of TIDs
923 * allocated by the device's
924 * Lookup Engine
925 */
926 FW_PARAMS_PARAM_DEV_FLOWC_BUFFIFO_SZ = 0x03,
927 FW_PARAMS_PARAM_DEV_INTVER_NIC = 0x04,
928 FW_PARAMS_PARAM_DEV_INTVER_VNIC = 0x05,
929 FW_PARAMS_PARAM_DEV_INTVER_OFLD = 0x06,
930 FW_PARAMS_PARAM_DEV_INTVER_RI = 0x07,
931 FW_PARAMS_PARAM_DEV_INTVER_ISCSIPDU = 0x08,
932 FW_PARAMS_PARAM_DEV_INTVER_ISCSI = 0x09,
Casey Leedom81323b72010-06-25 12:10:32 +0000933 FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,
934 FW_PARAMS_PARAM_DEV_FWREV = 0x0B,
935 FW_PARAMS_PARAM_DEV_TPREV = 0x0C,
Vipul Pandya52367a72012-09-26 02:39:38 +0000936 FW_PARAMS_PARAM_DEV_CF = 0x0D,
Hariprasad Shenai4c2c5762014-07-14 21:34:52 +0530937 FW_PARAMS_PARAM_DEV_MAXORDIRD_QP = 0x13, /* max supported QP IRD/ORD */
938 FW_PARAMS_PARAM_DEV_MAXIRD_ADAPTER = 0x14, /* max supported adap IRD */
Kumar Sanghvi1ac0f092014-02-18 17:56:12 +0530939 FW_PARAMS_PARAM_DEV_ULPTX_MEMWRITE_DSGL = 0x17,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000940};
941
942/*
943 * physical and virtual function parameters
944 */
945enum fw_params_param_pfvf {
946 FW_PARAMS_PARAM_PFVF_RWXCAPS = 0x00,
947 FW_PARAMS_PARAM_PFVF_ROUTE_START = 0x01,
948 FW_PARAMS_PARAM_PFVF_ROUTE_END = 0x02,
949 FW_PARAMS_PARAM_PFVF_CLIP_START = 0x03,
950 FW_PARAMS_PARAM_PFVF_CLIP_END = 0x04,
951 FW_PARAMS_PARAM_PFVF_FILTER_START = 0x05,
952 FW_PARAMS_PARAM_PFVF_FILTER_END = 0x06,
953 FW_PARAMS_PARAM_PFVF_SERVER_START = 0x07,
954 FW_PARAMS_PARAM_PFVF_SERVER_END = 0x08,
955 FW_PARAMS_PARAM_PFVF_TDDP_START = 0x09,
956 FW_PARAMS_PARAM_PFVF_TDDP_END = 0x0A,
957 FW_PARAMS_PARAM_PFVF_ISCSI_START = 0x0B,
958 FW_PARAMS_PARAM_PFVF_ISCSI_END = 0x0C,
959 FW_PARAMS_PARAM_PFVF_STAG_START = 0x0D,
960 FW_PARAMS_PARAM_PFVF_STAG_END = 0x0E,
961 FW_PARAMS_PARAM_PFVF_RQ_START = 0x1F,
962 FW_PARAMS_PARAM_PFVF_RQ_END = 0x10,
963 FW_PARAMS_PARAM_PFVF_PBL_START = 0x11,
964 FW_PARAMS_PARAM_PFVF_PBL_END = 0x12,
965 FW_PARAMS_PARAM_PFVF_L2T_START = 0x13,
966 FW_PARAMS_PARAM_PFVF_L2T_END = 0x14,
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +0000967 FW_PARAMS_PARAM_PFVF_SQRQ_START = 0x15,
968 FW_PARAMS_PARAM_PFVF_SQRQ_END = 0x16,
969 FW_PARAMS_PARAM_PFVF_CQ_START = 0x17,
970 FW_PARAMS_PARAM_PFVF_CQ_END = 0x18,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000971 FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH = 0x20,
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +0000972 FW_PARAMS_PARAM_PFVF_VIID = 0x24,
973 FW_PARAMS_PARAM_PFVF_CPMASK = 0x25,
Dimitris Michailidis1ae970e2010-08-02 13:19:19 +0000974 FW_PARAMS_PARAM_PFVF_OCQ_START = 0x26,
975 FW_PARAMS_PARAM_PFVF_OCQ_END = 0x27,
Dimitris Michailidise46dab42010-08-23 17:20:58 +0000976 FW_PARAMS_PARAM_PFVF_CONM_MAP = 0x28,
977 FW_PARAMS_PARAM_PFVF_IQFLINT_START = 0x29,
978 FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,
979 FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,
980 FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C,
Vipul Pandya52367a72012-09-26 02:39:38 +0000981 FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D,
Vipul Pandyab407a4a2013-04-29 04:04:40 +0000982 FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E,
983 FW_PARAMS_PARAM_PFVF_ETHOFLD_END = 0x30,
984 FW_PARAMS_PARAM_PFVF_CPLFW4MSG_ENCAP = 0x31
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000985};
986
987/*
988 * dma queue parameters
989 */
990enum fw_params_param_dmaq {
991 FW_PARAMS_PARAM_DMAQ_IQ_DCAEN_DCACPU = 0x00,
992 FW_PARAMS_PARAM_DMAQ_IQ_INTCNTTHRESH = 0x01,
993 FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_MNGT = 0x10,
994 FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11,
995 FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12,
Anish Bhatt989594e2014-06-19 21:37:11 -0700996 FW_PARAMS_PARAM_DMAQ_EQ_DCBPRIO_ETH = 0x13,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +0000997};
998
999#define FW_PARAMS_MNEM(x) ((x) << 24)
1000#define FW_PARAMS_PARAM_X(x) ((x) << 16)
Vipul Pandya52367a72012-09-26 02:39:38 +00001001#define FW_PARAMS_PARAM_Y_SHIFT 8
1002#define FW_PARAMS_PARAM_Y_MASK 0xffU
1003#define FW_PARAMS_PARAM_Y(x) ((x) << FW_PARAMS_PARAM_Y_SHIFT)
1004#define FW_PARAMS_PARAM_Y_GET(x) (((x) >> FW_PARAMS_PARAM_Y_SHIFT) &\
1005 FW_PARAMS_PARAM_Y_MASK)
1006#define FW_PARAMS_PARAM_Z_SHIFT 0
1007#define FW_PARAMS_PARAM_Z_MASK 0xffu
1008#define FW_PARAMS_PARAM_Z(x) ((x) << FW_PARAMS_PARAM_Z_SHIFT)
1009#define FW_PARAMS_PARAM_Z_GET(x) (((x) >> FW_PARAMS_PARAM_Z_SHIFT) &\
1010 FW_PARAMS_PARAM_Z_MASK)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001011#define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
1012#define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
1013
1014struct fw_params_cmd {
1015 __be32 op_to_vfn;
1016 __be32 retval_len16;
1017 struct fw_params_param {
1018 __be32 mnem;
1019 __be32 val;
1020 } param[7];
1021};
1022
1023#define FW_PARAMS_CMD_PFN(x) ((x) << 8)
1024#define FW_PARAMS_CMD_VFN(x) ((x) << 0)
1025
1026struct fw_pfvf_cmd {
1027 __be32 op_to_vfn;
1028 __be32 retval_len16;
1029 __be32 niqflint_niq;
Casey Leedom81323b72010-06-25 12:10:32 +00001030 __be32 type_to_neq;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001031 __be32 tc_to_nexactf;
1032 __be32 r_caps_to_nethctrl;
1033 __be16 nricq;
1034 __be16 nriqp;
1035 __be32 r4;
1036};
1037
1038#define FW_PFVF_CMD_PFN(x) ((x) << 8)
1039#define FW_PFVF_CMD_VFN(x) ((x) << 0)
1040
1041#define FW_PFVF_CMD_NIQFLINT(x) ((x) << 20)
1042#define FW_PFVF_CMD_NIQFLINT_GET(x) (((x) >> 20) & 0xfff)
1043
1044#define FW_PFVF_CMD_NIQ(x) ((x) << 0)
1045#define FW_PFVF_CMD_NIQ_GET(x) (((x) >> 0) & 0xfffff)
1046
Casey Leedom81323b72010-06-25 12:10:32 +00001047#define FW_PFVF_CMD_TYPE (1 << 31)
1048#define FW_PFVF_CMD_TYPE_GET(x) (((x) >> 31) & 0x1)
1049
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001050#define FW_PFVF_CMD_CMASK(x) ((x) << 24)
Casey Leedom81323b72010-06-25 12:10:32 +00001051#define FW_PFVF_CMD_CMASK_MASK 0xf
1052#define FW_PFVF_CMD_CMASK_GET(x) (((x) >> 24) & FW_PFVF_CMD_CMASK_MASK)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001053
1054#define FW_PFVF_CMD_PMASK(x) ((x) << 20)
Casey Leedom81323b72010-06-25 12:10:32 +00001055#define FW_PFVF_CMD_PMASK_MASK 0xf
1056#define FW_PFVF_CMD_PMASK_GET(x) (((x) >> 20) & FW_PFVF_CMD_PMASK_MASK)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001057
1058#define FW_PFVF_CMD_NEQ(x) ((x) << 0)
1059#define FW_PFVF_CMD_NEQ_GET(x) (((x) >> 0) & 0xfffff)
1060
1061#define FW_PFVF_CMD_TC(x) ((x) << 24)
1062#define FW_PFVF_CMD_TC_GET(x) (((x) >> 24) & 0xff)
1063
1064#define FW_PFVF_CMD_NVI(x) ((x) << 16)
1065#define FW_PFVF_CMD_NVI_GET(x) (((x) >> 16) & 0xff)
1066
1067#define FW_PFVF_CMD_NEXACTF(x) ((x) << 0)
1068#define FW_PFVF_CMD_NEXACTF_GET(x) (((x) >> 0) & 0xffff)
1069
1070#define FW_PFVF_CMD_R_CAPS(x) ((x) << 24)
1071#define FW_PFVF_CMD_R_CAPS_GET(x) (((x) >> 24) & 0xff)
1072
1073#define FW_PFVF_CMD_WX_CAPS(x) ((x) << 16)
1074#define FW_PFVF_CMD_WX_CAPS_GET(x) (((x) >> 16) & 0xff)
1075
1076#define FW_PFVF_CMD_NETHCTRL(x) ((x) << 0)
1077#define FW_PFVF_CMD_NETHCTRL_GET(x) (((x) >> 0) & 0xffff)
1078
1079enum fw_iq_type {
1080 FW_IQ_TYPE_FL_INT_CAP,
1081 FW_IQ_TYPE_NO_FL_INT_CAP
1082};
1083
1084struct fw_iq_cmd {
1085 __be32 op_to_vfn;
1086 __be32 alloc_to_len16;
1087 __be16 physiqid;
1088 __be16 iqid;
1089 __be16 fl0id;
1090 __be16 fl1id;
1091 __be32 type_to_iqandstindex;
1092 __be16 iqdroprss_to_iqesize;
1093 __be16 iqsize;
1094 __be64 iqaddr;
1095 __be32 iqns_to_fl0congen;
1096 __be16 fl0dcaen_to_fl0cidxfthresh;
1097 __be16 fl0size;
1098 __be64 fl0addr;
1099 __be32 fl1cngchmap_to_fl1congen;
1100 __be16 fl1dcaen_to_fl1cidxfthresh;
1101 __be16 fl1size;
1102 __be64 fl1addr;
1103};
1104
1105#define FW_IQ_CMD_PFN(x) ((x) << 8)
1106#define FW_IQ_CMD_VFN(x) ((x) << 0)
1107
1108#define FW_IQ_CMD_ALLOC (1U << 31)
1109#define FW_IQ_CMD_FREE (1U << 30)
1110#define FW_IQ_CMD_MODIFY (1U << 29)
1111#define FW_IQ_CMD_IQSTART(x) ((x) << 28)
1112#define FW_IQ_CMD_IQSTOP(x) ((x) << 27)
1113
1114#define FW_IQ_CMD_TYPE(x) ((x) << 29)
1115#define FW_IQ_CMD_IQASYNCH(x) ((x) << 28)
1116#define FW_IQ_CMD_VIID(x) ((x) << 16)
1117#define FW_IQ_CMD_IQANDST(x) ((x) << 15)
1118#define FW_IQ_CMD_IQANUS(x) ((x) << 14)
1119#define FW_IQ_CMD_IQANUD(x) ((x) << 12)
1120#define FW_IQ_CMD_IQANDSTINDEX(x) ((x) << 0)
1121
1122#define FW_IQ_CMD_IQDROPRSS (1U << 15)
1123#define FW_IQ_CMD_IQGTSMODE (1U << 14)
1124#define FW_IQ_CMD_IQPCIECH(x) ((x) << 12)
1125#define FW_IQ_CMD_IQDCAEN(x) ((x) << 11)
1126#define FW_IQ_CMD_IQDCACPU(x) ((x) << 6)
1127#define FW_IQ_CMD_IQINTCNTTHRESH(x) ((x) << 4)
1128#define FW_IQ_CMD_IQO (1U << 3)
1129#define FW_IQ_CMD_IQCPRIO(x) ((x) << 2)
1130#define FW_IQ_CMD_IQESIZE(x) ((x) << 0)
1131
1132#define FW_IQ_CMD_IQNS(x) ((x) << 31)
1133#define FW_IQ_CMD_IQRO(x) ((x) << 30)
1134#define FW_IQ_CMD_IQFLINTIQHSEN(x) ((x) << 28)
1135#define FW_IQ_CMD_IQFLINTCONGEN(x) ((x) << 27)
1136#define FW_IQ_CMD_IQFLINTISCSIC(x) ((x) << 26)
1137#define FW_IQ_CMD_FL0CNGCHMAP(x) ((x) << 20)
1138#define FW_IQ_CMD_FL0CACHELOCK(x) ((x) << 15)
1139#define FW_IQ_CMD_FL0DBP(x) ((x) << 14)
1140#define FW_IQ_CMD_FL0DATANS(x) ((x) << 13)
1141#define FW_IQ_CMD_FL0DATARO(x) ((x) << 12)
1142#define FW_IQ_CMD_FL0CONGCIF(x) ((x) << 11)
1143#define FW_IQ_CMD_FL0ONCHIP(x) ((x) << 10)
1144#define FW_IQ_CMD_FL0STATUSPGNS(x) ((x) << 9)
1145#define FW_IQ_CMD_FL0STATUSPGRO(x) ((x) << 8)
1146#define FW_IQ_CMD_FL0FETCHNS(x) ((x) << 7)
1147#define FW_IQ_CMD_FL0FETCHRO(x) ((x) << 6)
1148#define FW_IQ_CMD_FL0HOSTFCMODE(x) ((x) << 4)
1149#define FW_IQ_CMD_FL0CPRIO(x) ((x) << 3)
Naresh Kumar Innace91a922012-11-15 22:41:17 +05301150#define FW_IQ_CMD_FL0PADEN(x) ((x) << 2)
1151#define FW_IQ_CMD_FL0PACKEN(x) ((x) << 1)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001152#define FW_IQ_CMD_FL0CONGEN (1U << 0)
1153
1154#define FW_IQ_CMD_FL0DCAEN(x) ((x) << 15)
1155#define FW_IQ_CMD_FL0DCACPU(x) ((x) << 10)
1156#define FW_IQ_CMD_FL0FBMIN(x) ((x) << 7)
1157#define FW_IQ_CMD_FL0FBMAX(x) ((x) << 4)
1158#define FW_IQ_CMD_FL0CIDXFTHRESHO (1U << 3)
1159#define FW_IQ_CMD_FL0CIDXFTHRESH(x) ((x) << 0)
1160
1161#define FW_IQ_CMD_FL1CNGCHMAP(x) ((x) << 20)
1162#define FW_IQ_CMD_FL1CACHELOCK(x) ((x) << 15)
1163#define FW_IQ_CMD_FL1DBP(x) ((x) << 14)
1164#define FW_IQ_CMD_FL1DATANS(x) ((x) << 13)
1165#define FW_IQ_CMD_FL1DATARO(x) ((x) << 12)
1166#define FW_IQ_CMD_FL1CONGCIF(x) ((x) << 11)
1167#define FW_IQ_CMD_FL1ONCHIP(x) ((x) << 10)
1168#define FW_IQ_CMD_FL1STATUSPGNS(x) ((x) << 9)
1169#define FW_IQ_CMD_FL1STATUSPGRO(x) ((x) << 8)
1170#define FW_IQ_CMD_FL1FETCHNS(x) ((x) << 7)
1171#define FW_IQ_CMD_FL1FETCHRO(x) ((x) << 6)
1172#define FW_IQ_CMD_FL1HOSTFCMODE(x) ((x) << 4)
1173#define FW_IQ_CMD_FL1CPRIO(x) ((x) << 3)
1174#define FW_IQ_CMD_FL1PADEN (1U << 2)
1175#define FW_IQ_CMD_FL1PACKEN (1U << 1)
1176#define FW_IQ_CMD_FL1CONGEN (1U << 0)
1177
1178#define FW_IQ_CMD_FL1DCAEN(x) ((x) << 15)
1179#define FW_IQ_CMD_FL1DCACPU(x) ((x) << 10)
1180#define FW_IQ_CMD_FL1FBMIN(x) ((x) << 7)
1181#define FW_IQ_CMD_FL1FBMAX(x) ((x) << 4)
1182#define FW_IQ_CMD_FL1CIDXFTHRESHO (1U << 3)
1183#define FW_IQ_CMD_FL1CIDXFTHRESH(x) ((x) << 0)
1184
1185struct fw_eq_eth_cmd {
1186 __be32 op_to_vfn;
1187 __be32 alloc_to_len16;
1188 __be32 eqid_pkd;
1189 __be32 physeqid_pkd;
1190 __be32 fetchszm_to_iqid;
1191 __be32 dcaen_to_eqsize;
1192 __be64 eqaddr;
1193 __be32 viid_pkd;
1194 __be32 r8_lo;
1195 __be64 r9;
1196};
1197
1198#define FW_EQ_ETH_CMD_PFN(x) ((x) << 8)
1199#define FW_EQ_ETH_CMD_VFN(x) ((x) << 0)
1200#define FW_EQ_ETH_CMD_ALLOC (1U << 31)
1201#define FW_EQ_ETH_CMD_FREE (1U << 30)
1202#define FW_EQ_ETH_CMD_MODIFY (1U << 29)
1203#define FW_EQ_ETH_CMD_EQSTART (1U << 28)
1204#define FW_EQ_ETH_CMD_EQSTOP (1U << 27)
1205
1206#define FW_EQ_ETH_CMD_EQID(x) ((x) << 0)
1207#define FW_EQ_ETH_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
1208#define FW_EQ_ETH_CMD_PHYSEQID(x) ((x) << 0)
Casey Leedom81323b72010-06-25 12:10:32 +00001209#define FW_EQ_ETH_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001210
1211#define FW_EQ_ETH_CMD_FETCHSZM(x) ((x) << 26)
1212#define FW_EQ_ETH_CMD_STATUSPGNS(x) ((x) << 25)
1213#define FW_EQ_ETH_CMD_STATUSPGRO(x) ((x) << 24)
1214#define FW_EQ_ETH_CMD_FETCHNS(x) ((x) << 23)
1215#define FW_EQ_ETH_CMD_FETCHRO(x) ((x) << 22)
1216#define FW_EQ_ETH_CMD_HOSTFCMODE(x) ((x) << 20)
1217#define FW_EQ_ETH_CMD_CPRIO(x) ((x) << 19)
1218#define FW_EQ_ETH_CMD_ONCHIP(x) ((x) << 18)
1219#define FW_EQ_ETH_CMD_PCIECHN(x) ((x) << 16)
1220#define FW_EQ_ETH_CMD_IQID(x) ((x) << 0)
1221
1222#define FW_EQ_ETH_CMD_DCAEN(x) ((x) << 31)
1223#define FW_EQ_ETH_CMD_DCACPU(x) ((x) << 26)
1224#define FW_EQ_ETH_CMD_FBMIN(x) ((x) << 23)
1225#define FW_EQ_ETH_CMD_FBMAX(x) ((x) << 20)
1226#define FW_EQ_ETH_CMD_CIDXFTHRESHO(x) ((x) << 19)
1227#define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16)
1228#define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0)
1229
1230#define FW_EQ_ETH_CMD_VIID(x) ((x) << 16)
1231
1232struct fw_eq_ctrl_cmd {
1233 __be32 op_to_vfn;
1234 __be32 alloc_to_len16;
1235 __be32 cmpliqid_eqid;
1236 __be32 physeqid_pkd;
1237 __be32 fetchszm_to_iqid;
1238 __be32 dcaen_to_eqsize;
1239 __be64 eqaddr;
1240};
1241
1242#define FW_EQ_CTRL_CMD_PFN(x) ((x) << 8)
1243#define FW_EQ_CTRL_CMD_VFN(x) ((x) << 0)
1244
1245#define FW_EQ_CTRL_CMD_ALLOC (1U << 31)
1246#define FW_EQ_CTRL_CMD_FREE (1U << 30)
1247#define FW_EQ_CTRL_CMD_MODIFY (1U << 29)
1248#define FW_EQ_CTRL_CMD_EQSTART (1U << 28)
1249#define FW_EQ_CTRL_CMD_EQSTOP (1U << 27)
1250
1251#define FW_EQ_CTRL_CMD_CMPLIQID(x) ((x) << 20)
1252#define FW_EQ_CTRL_CMD_EQID(x) ((x) << 0)
1253#define FW_EQ_CTRL_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
1254#define FW_EQ_CTRL_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
1255
1256#define FW_EQ_CTRL_CMD_FETCHSZM (1U << 26)
1257#define FW_EQ_CTRL_CMD_STATUSPGNS (1U << 25)
1258#define FW_EQ_CTRL_CMD_STATUSPGRO (1U << 24)
1259#define FW_EQ_CTRL_CMD_FETCHNS (1U << 23)
1260#define FW_EQ_CTRL_CMD_FETCHRO (1U << 22)
1261#define FW_EQ_CTRL_CMD_HOSTFCMODE(x) ((x) << 20)
1262#define FW_EQ_CTRL_CMD_CPRIO(x) ((x) << 19)
1263#define FW_EQ_CTRL_CMD_ONCHIP(x) ((x) << 18)
1264#define FW_EQ_CTRL_CMD_PCIECHN(x) ((x) << 16)
1265#define FW_EQ_CTRL_CMD_IQID(x) ((x) << 0)
1266
1267#define FW_EQ_CTRL_CMD_DCAEN(x) ((x) << 31)
1268#define FW_EQ_CTRL_CMD_DCACPU(x) ((x) << 26)
1269#define FW_EQ_CTRL_CMD_FBMIN(x) ((x) << 23)
1270#define FW_EQ_CTRL_CMD_FBMAX(x) ((x) << 20)
1271#define FW_EQ_CTRL_CMD_CIDXFTHRESHO(x) ((x) << 19)
1272#define FW_EQ_CTRL_CMD_CIDXFTHRESH(x) ((x) << 16)
1273#define FW_EQ_CTRL_CMD_EQSIZE(x) ((x) << 0)
1274
1275struct fw_eq_ofld_cmd {
1276 __be32 op_to_vfn;
1277 __be32 alloc_to_len16;
1278 __be32 eqid_pkd;
1279 __be32 physeqid_pkd;
1280 __be32 fetchszm_to_iqid;
1281 __be32 dcaen_to_eqsize;
1282 __be64 eqaddr;
1283};
1284
1285#define FW_EQ_OFLD_CMD_PFN(x) ((x) << 8)
1286#define FW_EQ_OFLD_CMD_VFN(x) ((x) << 0)
1287
1288#define FW_EQ_OFLD_CMD_ALLOC (1U << 31)
1289#define FW_EQ_OFLD_CMD_FREE (1U << 30)
1290#define FW_EQ_OFLD_CMD_MODIFY (1U << 29)
1291#define FW_EQ_OFLD_CMD_EQSTART (1U << 28)
1292#define FW_EQ_OFLD_CMD_EQSTOP (1U << 27)
1293
1294#define FW_EQ_OFLD_CMD_EQID(x) ((x) << 0)
1295#define FW_EQ_OFLD_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
1296#define FW_EQ_OFLD_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
1297
1298#define FW_EQ_OFLD_CMD_FETCHSZM(x) ((x) << 26)
1299#define FW_EQ_OFLD_CMD_STATUSPGNS(x) ((x) << 25)
1300#define FW_EQ_OFLD_CMD_STATUSPGRO(x) ((x) << 24)
1301#define FW_EQ_OFLD_CMD_FETCHNS(x) ((x) << 23)
1302#define FW_EQ_OFLD_CMD_FETCHRO(x) ((x) << 22)
1303#define FW_EQ_OFLD_CMD_HOSTFCMODE(x) ((x) << 20)
1304#define FW_EQ_OFLD_CMD_CPRIO(x) ((x) << 19)
1305#define FW_EQ_OFLD_CMD_ONCHIP(x) ((x) << 18)
1306#define FW_EQ_OFLD_CMD_PCIECHN(x) ((x) << 16)
1307#define FW_EQ_OFLD_CMD_IQID(x) ((x) << 0)
1308
1309#define FW_EQ_OFLD_CMD_DCAEN(x) ((x) << 31)
1310#define FW_EQ_OFLD_CMD_DCACPU(x) ((x) << 26)
1311#define FW_EQ_OFLD_CMD_FBMIN(x) ((x) << 23)
1312#define FW_EQ_OFLD_CMD_FBMAX(x) ((x) << 20)
1313#define FW_EQ_OFLD_CMD_CIDXFTHRESHO(x) ((x) << 19)
1314#define FW_EQ_OFLD_CMD_CIDXFTHRESH(x) ((x) << 16)
1315#define FW_EQ_OFLD_CMD_EQSIZE(x) ((x) << 0)
1316
1317/*
1318 * Macros for VIID parsing:
1319 * VIID - [10:8] PFN, [7] VI Valid, [6:0] VI number
1320 */
1321#define FW_VIID_PFN_GET(x) (((x) >> 8) & 0x7)
1322#define FW_VIID_VIVLD_GET(x) (((x) >> 7) & 0x1)
1323#define FW_VIID_VIN_GET(x) (((x) >> 0) & 0x7F)
1324
1325struct fw_vi_cmd {
1326 __be32 op_to_vfn;
1327 __be32 alloc_to_len16;
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001328 __be16 type_viid;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001329 u8 mac[6];
1330 u8 portid_pkd;
1331 u8 nmac;
1332 u8 nmac0[6];
1333 __be16 rsssize_pkd;
1334 u8 nmac1[6];
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001335 __be16 idsiiq_pkd;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001336 u8 nmac2[6];
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001337 __be16 idseiq_pkd;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001338 u8 nmac3[6];
1339 __be64 r9;
1340 __be64 r10;
1341};
1342
1343#define FW_VI_CMD_PFN(x) ((x) << 8)
1344#define FW_VI_CMD_VFN(x) ((x) << 0)
1345#define FW_VI_CMD_ALLOC (1U << 31)
1346#define FW_VI_CMD_FREE (1U << 30)
1347#define FW_VI_CMD_VIID(x) ((x) << 0)
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001348#define FW_VI_CMD_VIID_GET(x) ((x) & 0xfff)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001349#define FW_VI_CMD_PORTID(x) ((x) << 4)
Casey Leedom81323b72010-06-25 12:10:32 +00001350#define FW_VI_CMD_PORTID_GET(x) (((x) >> 4) & 0xf)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001351#define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff)
1352
1353/* Special VI_MAC command index ids */
1354#define FW_VI_MAC_ADD_MAC 0x3FF
1355#define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE
1356#define FW_VI_MAC_MAC_BASED_FREE 0x3FD
Casey Leedom81323b72010-06-25 12:10:32 +00001357#define FW_CLS_TCAM_NUM_ENTRIES 336
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001358
1359enum fw_vi_mac_smac {
1360 FW_VI_MAC_MPS_TCAM_ENTRY,
1361 FW_VI_MAC_MPS_TCAM_ONLY,
1362 FW_VI_MAC_SMT_ONLY,
1363 FW_VI_MAC_SMT_AND_MPSTCAM
1364};
1365
1366enum fw_vi_mac_result {
1367 FW_VI_MAC_R_SUCCESS,
1368 FW_VI_MAC_R_F_NONEXISTENT_NOMEM,
1369 FW_VI_MAC_R_SMAC_FAIL,
1370 FW_VI_MAC_R_F_ACL_CHECK
1371};
1372
1373struct fw_vi_mac_cmd {
1374 __be32 op_to_viid;
1375 __be32 freemacs_to_len16;
1376 union fw_vi_mac {
1377 struct fw_vi_mac_exact {
1378 __be16 valid_to_idx;
1379 u8 macaddr[6];
1380 } exact[7];
1381 struct fw_vi_mac_hash {
1382 __be64 hashvec;
1383 } hash;
1384 } u;
1385};
1386
1387#define FW_VI_MAC_CMD_VIID(x) ((x) << 0)
1388#define FW_VI_MAC_CMD_FREEMACS(x) ((x) << 31)
1389#define FW_VI_MAC_CMD_HASHVECEN (1U << 23)
1390#define FW_VI_MAC_CMD_HASHUNIEN(x) ((x) << 22)
1391#define FW_VI_MAC_CMD_VALID (1U << 15)
1392#define FW_VI_MAC_CMD_PRIO(x) ((x) << 12)
1393#define FW_VI_MAC_CMD_SMAC_RESULT(x) ((x) << 10)
1394#define FW_VI_MAC_CMD_SMAC_RESULT_GET(x) (((x) >> 10) & 0x3)
1395#define FW_VI_MAC_CMD_IDX(x) ((x) << 0)
1396#define FW_VI_MAC_CMD_IDX_GET(x) (((x) >> 0) & 0x3ff)
1397
1398#define FW_RXMODE_MTU_NO_CHG 65535
1399
1400struct fw_vi_rxmode_cmd {
1401 __be32 op_to_viid;
1402 __be32 retval_len16;
Dimitris Michailidisf8f5aaf2010-05-10 15:58:07 +00001403 __be32 mtu_to_vlanexen;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001404 __be32 r4_lo;
1405};
1406
1407#define FW_VI_RXMODE_CMD_VIID(x) ((x) << 0)
Casey Leedom81323b72010-06-25 12:10:32 +00001408#define FW_VI_RXMODE_CMD_MTU_MASK 0xffff
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001409#define FW_VI_RXMODE_CMD_MTU(x) ((x) << 16)
1410#define FW_VI_RXMODE_CMD_PROMISCEN_MASK 0x3
1411#define FW_VI_RXMODE_CMD_PROMISCEN(x) ((x) << 14)
1412#define FW_VI_RXMODE_CMD_ALLMULTIEN_MASK 0x3
1413#define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
1414#define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
1415#define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
Dimitris Michailidisf8f5aaf2010-05-10 15:58:07 +00001416#define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
1417#define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001418
1419struct fw_vi_enable_cmd {
1420 __be32 op_to_viid;
1421 __be32 ien_to_len16;
1422 __be16 blinkdur;
1423 __be16 r3;
1424 __be32 r4;
1425};
1426
1427#define FW_VI_ENABLE_CMD_VIID(x) ((x) << 0)
1428#define FW_VI_ENABLE_CMD_IEN(x) ((x) << 31)
1429#define FW_VI_ENABLE_CMD_EEN(x) ((x) << 30)
Anish Bhatt989594e2014-06-19 21:37:11 -07001430#define FW_VI_ENABLE_CMD_DCB_INFO(x) ((x) << 28)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001431#define FW_VI_ENABLE_CMD_LED (1U << 29)
1432
1433/* VI VF stats offset definitions */
1434#define VI_VF_NUM_STATS 16
1435enum fw_vi_stats_vf_index {
1436 FW_VI_VF_STAT_TX_BCAST_BYTES_IX,
1437 FW_VI_VF_STAT_TX_BCAST_FRAMES_IX,
1438 FW_VI_VF_STAT_TX_MCAST_BYTES_IX,
1439 FW_VI_VF_STAT_TX_MCAST_FRAMES_IX,
1440 FW_VI_VF_STAT_TX_UCAST_BYTES_IX,
1441 FW_VI_VF_STAT_TX_UCAST_FRAMES_IX,
1442 FW_VI_VF_STAT_TX_DROP_FRAMES_IX,
1443 FW_VI_VF_STAT_TX_OFLD_BYTES_IX,
1444 FW_VI_VF_STAT_TX_OFLD_FRAMES_IX,
1445 FW_VI_VF_STAT_RX_BCAST_BYTES_IX,
1446 FW_VI_VF_STAT_RX_BCAST_FRAMES_IX,
1447 FW_VI_VF_STAT_RX_MCAST_BYTES_IX,
1448 FW_VI_VF_STAT_RX_MCAST_FRAMES_IX,
1449 FW_VI_VF_STAT_RX_UCAST_BYTES_IX,
1450 FW_VI_VF_STAT_RX_UCAST_FRAMES_IX,
1451 FW_VI_VF_STAT_RX_ERR_FRAMES_IX
1452};
1453
1454/* VI PF stats offset definitions */
1455#define VI_PF_NUM_STATS 17
1456enum fw_vi_stats_pf_index {
1457 FW_VI_PF_STAT_TX_BCAST_BYTES_IX,
1458 FW_VI_PF_STAT_TX_BCAST_FRAMES_IX,
1459 FW_VI_PF_STAT_TX_MCAST_BYTES_IX,
1460 FW_VI_PF_STAT_TX_MCAST_FRAMES_IX,
1461 FW_VI_PF_STAT_TX_UCAST_BYTES_IX,
1462 FW_VI_PF_STAT_TX_UCAST_FRAMES_IX,
1463 FW_VI_PF_STAT_TX_OFLD_BYTES_IX,
1464 FW_VI_PF_STAT_TX_OFLD_FRAMES_IX,
1465 FW_VI_PF_STAT_RX_BYTES_IX,
1466 FW_VI_PF_STAT_RX_FRAMES_IX,
1467 FW_VI_PF_STAT_RX_BCAST_BYTES_IX,
1468 FW_VI_PF_STAT_RX_BCAST_FRAMES_IX,
1469 FW_VI_PF_STAT_RX_MCAST_BYTES_IX,
1470 FW_VI_PF_STAT_RX_MCAST_FRAMES_IX,
1471 FW_VI_PF_STAT_RX_UCAST_BYTES_IX,
1472 FW_VI_PF_STAT_RX_UCAST_FRAMES_IX,
1473 FW_VI_PF_STAT_RX_ERR_FRAMES_IX
1474};
1475
1476struct fw_vi_stats_cmd {
1477 __be32 op_to_viid;
1478 __be32 retval_len16;
1479 union fw_vi_stats {
1480 struct fw_vi_stats_ctl {
1481 __be16 nstats_ix;
1482 __be16 r6;
1483 __be32 r7;
1484 __be64 stat0;
1485 __be64 stat1;
1486 __be64 stat2;
1487 __be64 stat3;
1488 __be64 stat4;
1489 __be64 stat5;
1490 } ctl;
1491 struct fw_vi_stats_pf {
1492 __be64 tx_bcast_bytes;
1493 __be64 tx_bcast_frames;
1494 __be64 tx_mcast_bytes;
1495 __be64 tx_mcast_frames;
1496 __be64 tx_ucast_bytes;
1497 __be64 tx_ucast_frames;
1498 __be64 tx_offload_bytes;
1499 __be64 tx_offload_frames;
1500 __be64 rx_pf_bytes;
1501 __be64 rx_pf_frames;
1502 __be64 rx_bcast_bytes;
1503 __be64 rx_bcast_frames;
1504 __be64 rx_mcast_bytes;
1505 __be64 rx_mcast_frames;
1506 __be64 rx_ucast_bytes;
1507 __be64 rx_ucast_frames;
1508 __be64 rx_err_frames;
1509 } pf;
1510 struct fw_vi_stats_vf {
1511 __be64 tx_bcast_bytes;
1512 __be64 tx_bcast_frames;
1513 __be64 tx_mcast_bytes;
1514 __be64 tx_mcast_frames;
1515 __be64 tx_ucast_bytes;
1516 __be64 tx_ucast_frames;
1517 __be64 tx_drop_frames;
1518 __be64 tx_offload_bytes;
1519 __be64 tx_offload_frames;
1520 __be64 rx_bcast_bytes;
1521 __be64 rx_bcast_frames;
1522 __be64 rx_mcast_bytes;
1523 __be64 rx_mcast_frames;
1524 __be64 rx_ucast_bytes;
1525 __be64 rx_ucast_frames;
1526 __be64 rx_err_frames;
1527 } vf;
1528 } u;
1529};
1530
1531#define FW_VI_STATS_CMD_VIID(x) ((x) << 0)
1532#define FW_VI_STATS_CMD_NSTATS(x) ((x) << 12)
1533#define FW_VI_STATS_CMD_IX(x) ((x) << 0)
1534
1535struct fw_acl_mac_cmd {
1536 __be32 op_to_vfn;
1537 __be32 en_to_len16;
1538 u8 nmac;
1539 u8 r3[7];
1540 __be16 r4;
1541 u8 macaddr0[6];
1542 __be16 r5;
1543 u8 macaddr1[6];
1544 __be16 r6;
1545 u8 macaddr2[6];
1546 __be16 r7;
1547 u8 macaddr3[6];
1548};
1549
1550#define FW_ACL_MAC_CMD_PFN(x) ((x) << 8)
1551#define FW_ACL_MAC_CMD_VFN(x) ((x) << 0)
1552#define FW_ACL_MAC_CMD_EN(x) ((x) << 31)
1553
1554struct fw_acl_vlan_cmd {
1555 __be32 op_to_vfn;
1556 __be32 en_to_len16;
1557 u8 nvlan;
1558 u8 dropnovlan_fm;
1559 u8 r3_lo[6];
1560 __be16 vlanid[16];
1561};
1562
1563#define FW_ACL_VLAN_CMD_PFN(x) ((x) << 8)
1564#define FW_ACL_VLAN_CMD_VFN(x) ((x) << 0)
1565#define FW_ACL_VLAN_CMD_EN(x) ((x) << 31)
1566#define FW_ACL_VLAN_CMD_DROPNOVLAN(x) ((x) << 7)
1567#define FW_ACL_VLAN_CMD_FM(x) ((x) << 6)
1568
1569enum fw_port_cap {
1570 FW_PORT_CAP_SPEED_100M = 0x0001,
1571 FW_PORT_CAP_SPEED_1G = 0x0002,
1572 FW_PORT_CAP_SPEED_2_5G = 0x0004,
1573 FW_PORT_CAP_SPEED_10G = 0x0008,
1574 FW_PORT_CAP_SPEED_40G = 0x0010,
1575 FW_PORT_CAP_SPEED_100G = 0x0020,
1576 FW_PORT_CAP_FC_RX = 0x0040,
1577 FW_PORT_CAP_FC_TX = 0x0080,
1578 FW_PORT_CAP_ANEG = 0x0100,
1579 FW_PORT_CAP_MDI_0 = 0x0200,
1580 FW_PORT_CAP_MDI_1 = 0x0400,
1581 FW_PORT_CAP_BEAN = 0x0800,
1582 FW_PORT_CAP_PMA_LPBK = 0x1000,
1583 FW_PORT_CAP_PCS_LPBK = 0x2000,
1584 FW_PORT_CAP_PHYXS_LPBK = 0x4000,
1585 FW_PORT_CAP_FAR_END_LPBK = 0x8000,
1586};
1587
1588enum fw_port_mdi {
1589 FW_PORT_MDI_UNCHANGED,
1590 FW_PORT_MDI_AUTO,
1591 FW_PORT_MDI_F_STRAIGHT,
1592 FW_PORT_MDI_F_CROSSOVER
1593};
1594
1595#define FW_PORT_MDI(x) ((x) << 9)
1596
1597enum fw_port_action {
1598 FW_PORT_ACTION_L1_CFG = 0x0001,
1599 FW_PORT_ACTION_L2_CFG = 0x0002,
1600 FW_PORT_ACTION_GET_PORT_INFO = 0x0003,
1601 FW_PORT_ACTION_L2_PPP_CFG = 0x0004,
1602 FW_PORT_ACTION_L2_DCB_CFG = 0x0005,
Anish Bhatt989594e2014-06-19 21:37:11 -07001603 FW_PORT_ACTION_DCB_READ_TRANS = 0x0006,
1604 FW_PORT_ACTION_DCB_READ_RECV = 0x0007,
1605 FW_PORT_ACTION_DCB_READ_DET = 0x0008,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001606 FW_PORT_ACTION_LOW_PWR_TO_NORMAL = 0x0010,
1607 FW_PORT_ACTION_L1_LOW_PWR_EN = 0x0011,
1608 FW_PORT_ACTION_L2_WOL_MODE_EN = 0x0012,
1609 FW_PORT_ACTION_LPBK_TO_NORMAL = 0x0020,
1610 FW_PORT_ACTION_L1_LPBK = 0x0021,
1611 FW_PORT_ACTION_L1_PMA_LPBK = 0x0022,
1612 FW_PORT_ACTION_L1_PCS_LPBK = 0x0023,
1613 FW_PORT_ACTION_L1_PHYXS_CSIDE_LPBK = 0x0024,
1614 FW_PORT_ACTION_L1_PHYXS_ESIDE_LPBK = 0x0025,
1615 FW_PORT_ACTION_PHY_RESET = 0x0040,
1616 FW_PORT_ACTION_PMA_RESET = 0x0041,
1617 FW_PORT_ACTION_PCS_RESET = 0x0042,
1618 FW_PORT_ACTION_PHYXS_RESET = 0x0043,
1619 FW_PORT_ACTION_DTEXS_REEST = 0x0044,
1620 FW_PORT_ACTION_AN_RESET = 0x0045
1621};
1622
1623enum fw_port_l2cfg_ctlbf {
1624 FW_PORT_L2_CTLBF_OVLAN0 = 0x01,
1625 FW_PORT_L2_CTLBF_OVLAN1 = 0x02,
1626 FW_PORT_L2_CTLBF_OVLAN2 = 0x04,
1627 FW_PORT_L2_CTLBF_OVLAN3 = 0x08,
1628 FW_PORT_L2_CTLBF_IVLAN = 0x10,
1629 FW_PORT_L2_CTLBF_TXIPG = 0x20
1630};
1631
1632enum fw_port_dcb_cfg {
1633 FW_PORT_DCB_CFG_PG = 0x01,
1634 FW_PORT_DCB_CFG_PFC = 0x02,
1635 FW_PORT_DCB_CFG_APPL = 0x04
1636};
1637
1638enum fw_port_dcb_cfg_rc {
1639 FW_PORT_DCB_CFG_SUCCESS = 0x0,
1640 FW_PORT_DCB_CFG_ERROR = 0x1
1641};
1642
Naresh Kumar Innace91a922012-11-15 22:41:17 +05301643enum fw_port_dcb_type {
1644 FW_PORT_DCB_TYPE_PGID = 0x00,
1645 FW_PORT_DCB_TYPE_PGRATE = 0x01,
1646 FW_PORT_DCB_TYPE_PRIORATE = 0x02,
1647 FW_PORT_DCB_TYPE_PFC = 0x03,
1648 FW_PORT_DCB_TYPE_APP_ID = 0x04,
Anish Bhatt989594e2014-06-19 21:37:11 -07001649 FW_PORT_DCB_TYPE_CONTROL = 0x05,
1650};
1651
1652enum fw_port_dcb_feature_state {
1653 FW_PORT_DCB_FEATURE_STATE_PENDING = 0x0,
1654 FW_PORT_DCB_FEATURE_STATE_SUCCESS = 0x1,
1655 FW_PORT_DCB_FEATURE_STATE_ERROR = 0x2,
1656 FW_PORT_DCB_FEATURE_STATE_TIMEOUT = 0x3,
Naresh Kumar Innace91a922012-11-15 22:41:17 +05301657};
1658
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001659struct fw_port_cmd {
1660 __be32 op_to_portid;
1661 __be32 action_to_len16;
1662 union fw_port {
1663 struct fw_port_l1cfg {
1664 __be32 rcap;
1665 __be32 r;
1666 } l1cfg;
1667 struct fw_port_l2cfg {
Anish Bhatt989594e2014-06-19 21:37:11 -07001668 __u8 ctlbf;
1669 __u8 ovlan3_to_ivlan0;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001670 __be16 ivlantype;
Anish Bhatt989594e2014-06-19 21:37:11 -07001671 __be16 txipg_force_pinfo;
1672 __be16 mtu;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001673 __be16 ovlan0mask;
1674 __be16 ovlan0type;
1675 __be16 ovlan1mask;
1676 __be16 ovlan1type;
1677 __be16 ovlan2mask;
1678 __be16 ovlan2type;
1679 __be16 ovlan3mask;
1680 __be16 ovlan3type;
1681 } l2cfg;
1682 struct fw_port_info {
1683 __be32 lstatus_to_modtype;
1684 __be16 pcap;
1685 __be16 acap;
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001686 __be16 mtu;
1687 __u8 cbllen;
Anish Bhatt989594e2014-06-19 21:37:11 -07001688 __u8 auxlinfo;
1689 __u8 dcbxdis_pkd;
1690 __u8 r8_lo[3];
1691 __be64 r9;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001692 } info;
Anish Bhatt989594e2014-06-19 21:37:11 -07001693 struct fw_port_diags {
1694 __u8 diagop;
1695 __u8 r[3];
1696 __be32 diagval;
1697 } diags;
1698 union fw_port_dcb {
1699 struct fw_port_dcb_pgid {
1700 __u8 type;
1701 __u8 apply_pkd;
1702 __u8 r10_lo[2];
1703 __be32 pgid;
1704 __be64 r11;
1705 } pgid;
1706 struct fw_port_dcb_pgrate {
1707 __u8 type;
1708 __u8 apply_pkd;
1709 __u8 r10_lo[5];
1710 __u8 num_tcs_supported;
1711 __u8 pgrate[8];
1712 } pgrate;
1713 struct fw_port_dcb_priorate {
1714 __u8 type;
1715 __u8 apply_pkd;
1716 __u8 r10_lo[6];
1717 __u8 strict_priorate[8];
1718 } priorate;
1719 struct fw_port_dcb_pfc {
1720 __u8 type;
1721 __u8 pfcen;
1722 __u8 r10[5];
1723 __u8 max_pfc_tcs;
1724 __be64 r11;
1725 } pfc;
1726 struct fw_port_app_priority {
1727 __u8 type;
1728 __u8 r10[2];
1729 __u8 idx;
1730 __u8 user_prio_map;
1731 __u8 sel_field;
1732 __be16 protocolid;
1733 __be64 r12;
1734 } app_priority;
1735 struct fw_port_dcb_control {
1736 __u8 type;
1737 __u8 all_syncd_pkd;
1738 __be16 pfc_state_to_app_state;
1739 __be32 r11;
1740 __be64 r12;
1741 } control;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001742 } dcb;
1743 } u;
1744};
1745
1746#define FW_PORT_CMD_READ (1U << 22)
1747
1748#define FW_PORT_CMD_PORTID(x) ((x) << 0)
1749#define FW_PORT_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
1750
1751#define FW_PORT_CMD_ACTION(x) ((x) << 16)
Casey Leedom81323b72010-06-25 12:10:32 +00001752#define FW_PORT_CMD_ACTION_GET(x) (((x) >> 16) & 0xffff)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001753
1754#define FW_PORT_CMD_CTLBF(x) ((x) << 10)
1755#define FW_PORT_CMD_OVLAN3(x) ((x) << 7)
1756#define FW_PORT_CMD_OVLAN2(x) ((x) << 6)
1757#define FW_PORT_CMD_OVLAN1(x) ((x) << 5)
1758#define FW_PORT_CMD_OVLAN0(x) ((x) << 4)
1759#define FW_PORT_CMD_IVLAN0(x) ((x) << 3)
1760
1761#define FW_PORT_CMD_TXIPG(x) ((x) << 19)
1762
1763#define FW_PORT_CMD_LSTATUS (1U << 31)
Naresh Kumar Innace91a922012-11-15 22:41:17 +05301764#define FW_PORT_CMD_LSTATUS_GET(x) (((x) >> 31) & 0x1)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001765#define FW_PORT_CMD_LSPEED(x) ((x) << 24)
1766#define FW_PORT_CMD_LSPEED_GET(x) (((x) >> 24) & 0x3f)
1767#define FW_PORT_CMD_TXPAUSE (1U << 23)
1768#define FW_PORT_CMD_RXPAUSE (1U << 22)
1769#define FW_PORT_CMD_MDIOCAP (1U << 21)
1770#define FW_PORT_CMD_MDIOADDR_GET(x) (((x) >> 16) & 0x1f)
1771#define FW_PORT_CMD_LPTXPAUSE (1U << 15)
1772#define FW_PORT_CMD_LPRXPAUSE (1U << 14)
1773#define FW_PORT_CMD_PTYPE_MASK 0x1f
1774#define FW_PORT_CMD_PTYPE_GET(x) (((x) >> 8) & FW_PORT_CMD_PTYPE_MASK)
1775#define FW_PORT_CMD_MODTYPE_MASK 0x1f
1776#define FW_PORT_CMD_MODTYPE_GET(x) (((x) >> 0) & FW_PORT_CMD_MODTYPE_MASK)
1777
Anish Bhatt989594e2014-06-19 21:37:11 -07001778#define FW_PORT_CMD_DCBXDIS (1U << 7)
1779#define FW_PORT_CMD_APPLY (1U << 7)
1780#define FW_PORT_CMD_ALL_SYNCD (1U << 7)
1781
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001782#define FW_PORT_CMD_PPPEN(x) ((x) << 31)
1783#define FW_PORT_CMD_TPSRC(x) ((x) << 28)
1784#define FW_PORT_CMD_NCSISRC(x) ((x) << 24)
1785
1786#define FW_PORT_CMD_CH0(x) ((x) << 20)
1787#define FW_PORT_CMD_CH1(x) ((x) << 16)
1788#define FW_PORT_CMD_CH2(x) ((x) << 12)
1789#define FW_PORT_CMD_CH3(x) ((x) << 8)
1790#define FW_PORT_CMD_NCSICH(x) ((x) << 4)
1791
1792enum fw_port_type {
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001793 FW_PORT_TYPE_FIBER_XFI,
1794 FW_PORT_TYPE_FIBER_XAUI,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001795 FW_PORT_TYPE_BT_SGMII,
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001796 FW_PORT_TYPE_BT_XFI,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001797 FW_PORT_TYPE_BT_XAUI,
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001798 FW_PORT_TYPE_KX4,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001799 FW_PORT_TYPE_CX4,
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001800 FW_PORT_TYPE_KX,
1801 FW_PORT_TYPE_KR,
1802 FW_PORT_TYPE_SFP,
1803 FW_PORT_TYPE_BP_AP,
Dimitris Michailidis7d5e77a2010-12-14 21:36:47 +00001804 FW_PORT_TYPE_BP4_AP,
Kumar Sanghvi72aca4b2014-02-18 17:56:08 +05301805 FW_PORT_TYPE_QSFP_10G,
1806 FW_PORT_TYPE_QSFP,
1807 FW_PORT_TYPE_BP40_BA,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001808
1809 FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK
1810};
1811
1812enum fw_port_module_type {
1813 FW_PORT_MOD_TYPE_NA,
1814 FW_PORT_MOD_TYPE_LR,
1815 FW_PORT_MOD_TYPE_SR,
1816 FW_PORT_MOD_TYPE_ER,
Dimitris Michailidisa0881ca2010-06-18 10:05:34 +00001817 FW_PORT_MOD_TYPE_TWINAX_PASSIVE,
1818 FW_PORT_MOD_TYPE_TWINAX_ACTIVE,
1819 FW_PORT_MOD_TYPE_LRM,
Naresh Kumar Innace91a922012-11-15 22:41:17 +05301820 FW_PORT_MOD_TYPE_ERROR = FW_PORT_CMD_MODTYPE_MASK - 3,
1821 FW_PORT_MOD_TYPE_UNKNOWN = FW_PORT_CMD_MODTYPE_MASK - 2,
1822 FW_PORT_MOD_TYPE_NOTSUPPORTED = FW_PORT_CMD_MODTYPE_MASK - 1,
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001823
1824 FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK
1825};
1826
Vipul Pandyab407a4a2013-04-29 04:04:40 +00001827enum fw_port_mod_sub_type {
1828 FW_PORT_MOD_SUB_TYPE_NA,
1829 FW_PORT_MOD_SUB_TYPE_MV88E114X = 0x1,
1830 FW_PORT_MOD_SUB_TYPE_TN8022 = 0x2,
1831 FW_PORT_MOD_SUB_TYPE_AQ1202 = 0x3,
1832 FW_PORT_MOD_SUB_TYPE_88x3120 = 0x4,
1833 FW_PORT_MOD_SUB_TYPE_BCM84834 = 0x5,
1834 FW_PORT_MOD_SUB_TYPE_BT_VSC8634 = 0x8,
1835
1836 /* The following will never been in the VPD. They are TWINAX cable
1837 * lengths decoded from SFP+ module i2c PROMs. These should
1838 * almost certainly go somewhere else ...
1839 */
1840 FW_PORT_MOD_SUB_TYPE_TWINAX_1 = 0x9,
1841 FW_PORT_MOD_SUB_TYPE_TWINAX_3 = 0xA,
1842 FW_PORT_MOD_SUB_TYPE_TWINAX_5 = 0xB,
1843 FW_PORT_MOD_SUB_TYPE_TWINAX_7 = 0xC,
1844};
1845
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00001846/* port stats */
1847#define FW_NUM_PORT_STATS 50
1848#define FW_NUM_PORT_TX_STATS 23
1849#define FW_NUM_PORT_RX_STATS 27
1850
1851enum fw_port_stats_tx_index {
1852 FW_STAT_TX_PORT_BYTES_IX,
1853 FW_STAT_TX_PORT_FRAMES_IX,
1854 FW_STAT_TX_PORT_BCAST_IX,
1855 FW_STAT_TX_PORT_MCAST_IX,
1856 FW_STAT_TX_PORT_UCAST_IX,
1857 FW_STAT_TX_PORT_ERROR_IX,
1858 FW_STAT_TX_PORT_64B_IX,
1859 FW_STAT_TX_PORT_65B_127B_IX,
1860 FW_STAT_TX_PORT_128B_255B_IX,
1861 FW_STAT_TX_PORT_256B_511B_IX,
1862 FW_STAT_TX_PORT_512B_1023B_IX,
1863 FW_STAT_TX_PORT_1024B_1518B_IX,
1864 FW_STAT_TX_PORT_1519B_MAX_IX,
1865 FW_STAT_TX_PORT_DROP_IX,
1866 FW_STAT_TX_PORT_PAUSE_IX,
1867 FW_STAT_TX_PORT_PPP0_IX,
1868 FW_STAT_TX_PORT_PPP1_IX,
1869 FW_STAT_TX_PORT_PPP2_IX,
1870 FW_STAT_TX_PORT_PPP3_IX,
1871 FW_STAT_TX_PORT_PPP4_IX,
1872 FW_STAT_TX_PORT_PPP5_IX,
1873 FW_STAT_TX_PORT_PPP6_IX,
1874 FW_STAT_TX_PORT_PPP7_IX
1875};
1876
1877enum fw_port_stat_rx_index {
1878 FW_STAT_RX_PORT_BYTES_IX,
1879 FW_STAT_RX_PORT_FRAMES_IX,
1880 FW_STAT_RX_PORT_BCAST_IX,
1881 FW_STAT_RX_PORT_MCAST_IX,
1882 FW_STAT_RX_PORT_UCAST_IX,
1883 FW_STAT_RX_PORT_MTU_ERROR_IX,
1884 FW_STAT_RX_PORT_MTU_CRC_ERROR_IX,
1885 FW_STAT_RX_PORT_CRC_ERROR_IX,
1886 FW_STAT_RX_PORT_LEN_ERROR_IX,
1887 FW_STAT_RX_PORT_SYM_ERROR_IX,
1888 FW_STAT_RX_PORT_64B_IX,
1889 FW_STAT_RX_PORT_65B_127B_IX,
1890 FW_STAT_RX_PORT_128B_255B_IX,
1891 FW_STAT_RX_PORT_256B_511B_IX,
1892 FW_STAT_RX_PORT_512B_1023B_IX,
1893 FW_STAT_RX_PORT_1024B_1518B_IX,
1894 FW_STAT_RX_PORT_1519B_MAX_IX,
1895 FW_STAT_RX_PORT_PAUSE_IX,
1896 FW_STAT_RX_PORT_PPP0_IX,
1897 FW_STAT_RX_PORT_PPP1_IX,
1898 FW_STAT_RX_PORT_PPP2_IX,
1899 FW_STAT_RX_PORT_PPP3_IX,
1900 FW_STAT_RX_PORT_PPP4_IX,
1901 FW_STAT_RX_PORT_PPP5_IX,
1902 FW_STAT_RX_PORT_PPP6_IX,
1903 FW_STAT_RX_PORT_PPP7_IX,
1904 FW_STAT_RX_PORT_LESS_64B_IX
1905};
1906
1907struct fw_port_stats_cmd {
1908 __be32 op_to_portid;
1909 __be32 retval_len16;
1910 union fw_port_stats {
1911 struct fw_port_stats_ctl {
1912 u8 nstats_bg_bm;
1913 u8 tx_ix;
1914 __be16 r6;
1915 __be32 r7;
1916 __be64 stat0;
1917 __be64 stat1;
1918 __be64 stat2;
1919 __be64 stat3;
1920 __be64 stat4;
1921 __be64 stat5;
1922 } ctl;
1923 struct fw_port_stats_all {
1924 __be64 tx_bytes;
1925 __be64 tx_frames;
1926 __be64 tx_bcast;
1927 __be64 tx_mcast;
1928 __be64 tx_ucast;
1929 __be64 tx_error;
1930 __be64 tx_64b;
1931 __be64 tx_65b_127b;
1932 __be64 tx_128b_255b;
1933 __be64 tx_256b_511b;
1934 __be64 tx_512b_1023b;
1935 __be64 tx_1024b_1518b;
1936 __be64 tx_1519b_max;
1937 __be64 tx_drop;
1938 __be64 tx_pause;
1939 __be64 tx_ppp0;
1940 __be64 tx_ppp1;
1941 __be64 tx_ppp2;
1942 __be64 tx_ppp3;
1943 __be64 tx_ppp4;
1944 __be64 tx_ppp5;
1945 __be64 tx_ppp6;
1946 __be64 tx_ppp7;
1947 __be64 rx_bytes;
1948 __be64 rx_frames;
1949 __be64 rx_bcast;
1950 __be64 rx_mcast;
1951 __be64 rx_ucast;
1952 __be64 rx_mtu_error;
1953 __be64 rx_mtu_crc_error;
1954 __be64 rx_crc_error;
1955 __be64 rx_len_error;
1956 __be64 rx_sym_error;
1957 __be64 rx_64b;
1958 __be64 rx_65b_127b;
1959 __be64 rx_128b_255b;
1960 __be64 rx_256b_511b;
1961 __be64 rx_512b_1023b;
1962 __be64 rx_1024b_1518b;
1963 __be64 rx_1519b_max;
1964 __be64 rx_pause;
1965 __be64 rx_ppp0;
1966 __be64 rx_ppp1;
1967 __be64 rx_ppp2;
1968 __be64 rx_ppp3;
1969 __be64 rx_ppp4;
1970 __be64 rx_ppp5;
1971 __be64 rx_ppp6;
1972 __be64 rx_ppp7;
1973 __be64 rx_less_64b;
1974 __be64 rx_bg_drop;
1975 __be64 rx_bg_trunc;
1976 } all;
1977 } u;
1978};
1979
1980#define FW_PORT_STATS_CMD_NSTATS(x) ((x) << 4)
1981#define FW_PORT_STATS_CMD_BG_BM(x) ((x) << 0)
1982#define FW_PORT_STATS_CMD_TX(x) ((x) << 7)
1983#define FW_PORT_STATS_CMD_IX(x) ((x) << 0)
1984
1985/* port loopback stats */
1986#define FW_NUM_LB_STATS 16
1987enum fw_port_lb_stats_index {
1988 FW_STAT_LB_PORT_BYTES_IX,
1989 FW_STAT_LB_PORT_FRAMES_IX,
1990 FW_STAT_LB_PORT_BCAST_IX,
1991 FW_STAT_LB_PORT_MCAST_IX,
1992 FW_STAT_LB_PORT_UCAST_IX,
1993 FW_STAT_LB_PORT_ERROR_IX,
1994 FW_STAT_LB_PORT_64B_IX,
1995 FW_STAT_LB_PORT_65B_127B_IX,
1996 FW_STAT_LB_PORT_128B_255B_IX,
1997 FW_STAT_LB_PORT_256B_511B_IX,
1998 FW_STAT_LB_PORT_512B_1023B_IX,
1999 FW_STAT_LB_PORT_1024B_1518B_IX,
2000 FW_STAT_LB_PORT_1519B_MAX_IX,
2001 FW_STAT_LB_PORT_DROP_FRAMES_IX
2002};
2003
2004struct fw_port_lb_stats_cmd {
2005 __be32 op_to_lbport;
2006 __be32 retval_len16;
2007 union fw_port_lb_stats {
2008 struct fw_port_lb_stats_ctl {
2009 u8 nstats_bg_bm;
2010 u8 ix_pkd;
2011 __be16 r6;
2012 __be32 r7;
2013 __be64 stat0;
2014 __be64 stat1;
2015 __be64 stat2;
2016 __be64 stat3;
2017 __be64 stat4;
2018 __be64 stat5;
2019 } ctl;
2020 struct fw_port_lb_stats_all {
2021 __be64 tx_bytes;
2022 __be64 tx_frames;
2023 __be64 tx_bcast;
2024 __be64 tx_mcast;
2025 __be64 tx_ucast;
2026 __be64 tx_error;
2027 __be64 tx_64b;
2028 __be64 tx_65b_127b;
2029 __be64 tx_128b_255b;
2030 __be64 tx_256b_511b;
2031 __be64 tx_512b_1023b;
2032 __be64 tx_1024b_1518b;
2033 __be64 tx_1519b_max;
2034 __be64 rx_lb_drop;
2035 __be64 rx_lb_trunc;
2036 } all;
2037 } u;
2038};
2039
2040#define FW_PORT_LB_STATS_CMD_LBPORT(x) ((x) << 0)
2041#define FW_PORT_LB_STATS_CMD_NSTATS(x) ((x) << 4)
2042#define FW_PORT_LB_STATS_CMD_BG_BM(x) ((x) << 0)
2043#define FW_PORT_LB_STATS_CMD_IX(x) ((x) << 0)
2044
2045struct fw_rss_ind_tbl_cmd {
2046 __be32 op_to_viid;
2047#define FW_RSS_IND_TBL_CMD_VIID(x) ((x) << 0)
2048 __be32 retval_len16;
2049 __be16 niqid;
2050 __be16 startidx;
2051 __be32 r3;
2052 __be32 iq0_to_iq2;
2053#define FW_RSS_IND_TBL_CMD_IQ0(x) ((x) << 20)
2054#define FW_RSS_IND_TBL_CMD_IQ1(x) ((x) << 10)
2055#define FW_RSS_IND_TBL_CMD_IQ2(x) ((x) << 0)
2056 __be32 iq3_to_iq5;
2057 __be32 iq6_to_iq8;
2058 __be32 iq9_to_iq11;
2059 __be32 iq12_to_iq14;
2060 __be32 iq15_to_iq17;
2061 __be32 iq18_to_iq20;
2062 __be32 iq21_to_iq23;
2063 __be32 iq24_to_iq26;
2064 __be32 iq27_to_iq29;
2065 __be32 iq30_iq31;
2066 __be32 r15_lo;
2067};
2068
2069struct fw_rss_glb_config_cmd {
2070 __be32 op_to_write;
2071 __be32 retval_len16;
2072 union fw_rss_glb_config {
2073 struct fw_rss_glb_config_manual {
2074 __be32 mode_pkd;
2075 __be32 r3;
2076 __be64 r4;
2077 __be64 r5;
2078 } manual;
2079 struct fw_rss_glb_config_basicvirtual {
2080 __be32 mode_pkd;
2081 __be32 synmapen_to_hashtoeplitz;
2082#define FW_RSS_GLB_CONFIG_CMD_SYNMAPEN (1U << 8)
2083#define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV6 (1U << 7)
2084#define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV6 (1U << 6)
2085#define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV4 (1U << 5)
2086#define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV4 (1U << 4)
2087#define FW_RSS_GLB_CONFIG_CMD_OFDMAPEN (1U << 3)
2088#define FW_RSS_GLB_CONFIG_CMD_TNLMAPEN (1U << 2)
2089#define FW_RSS_GLB_CONFIG_CMD_TNLALLLKP (1U << 1)
2090#define FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ (1U << 0)
2091 __be64 r8;
2092 __be64 r9;
2093 } basicvirtual;
2094 } u;
2095};
2096
2097#define FW_RSS_GLB_CONFIG_CMD_MODE(x) ((x) << 28)
Casey Leedom81323b72010-06-25 12:10:32 +00002098#define FW_RSS_GLB_CONFIG_CMD_MODE_GET(x) (((x) >> 28) & 0xf)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002099
2100#define FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL 0
2101#define FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL 1
2102
2103struct fw_rss_vi_config_cmd {
2104 __be32 op_to_viid;
2105#define FW_RSS_VI_CONFIG_CMD_VIID(x) ((x) << 0)
2106 __be32 retval_len16;
2107 union fw_rss_vi_config {
2108 struct fw_rss_vi_config_manual {
2109 __be64 r3;
2110 __be64 r4;
2111 __be64 r5;
2112 } manual;
2113 struct fw_rss_vi_config_basicvirtual {
2114 __be32 r6;
Casey Leedom81323b72010-06-25 12:10:32 +00002115 __be32 defaultq_to_udpen;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002116#define FW_RSS_VI_CONFIG_CMD_DEFAULTQ(x) ((x) << 16)
Casey Leedom81323b72010-06-25 12:10:32 +00002117#define FW_RSS_VI_CONFIG_CMD_DEFAULTQ_GET(x) (((x) >> 16) & 0x3ff)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002118#define FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN (1U << 4)
2119#define FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN (1U << 3)
2120#define FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN (1U << 2)
2121#define FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN (1U << 1)
Casey Leedom81323b72010-06-25 12:10:32 +00002122#define FW_RSS_VI_CONFIG_CMD_UDPEN (1U << 0)
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002123 __be64 r9;
2124 __be64 r10;
2125 } basicvirtual;
2126 } u;
2127};
2128
Vipul Pandya01bcca62013-07-04 16:10:46 +05302129struct fw_clip_cmd {
2130 __be32 op_to_write;
2131 __be32 alloc_to_len16;
2132 __be64 ip_hi;
2133 __be64 ip_lo;
2134 __be32 r4[2];
2135};
2136
2137#define S_FW_CLIP_CMD_ALLOC 31
2138#define M_FW_CLIP_CMD_ALLOC 0x1
2139#define V_FW_CLIP_CMD_ALLOC(x) ((x) << S_FW_CLIP_CMD_ALLOC)
2140#define G_FW_CLIP_CMD_ALLOC(x) \
2141 (((x) >> S_FW_CLIP_CMD_ALLOC) & M_FW_CLIP_CMD_ALLOC)
2142#define F_FW_CLIP_CMD_ALLOC V_FW_CLIP_CMD_ALLOC(1U)
2143
2144#define S_FW_CLIP_CMD_FREE 30
2145#define M_FW_CLIP_CMD_FREE 0x1
2146#define V_FW_CLIP_CMD_FREE(x) ((x) << S_FW_CLIP_CMD_FREE)
2147#define G_FW_CLIP_CMD_FREE(x) \
2148 (((x) >> S_FW_CLIP_CMD_FREE) & M_FW_CLIP_CMD_FREE)
2149#define F_FW_CLIP_CMD_FREE V_FW_CLIP_CMD_FREE(1U)
2150
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002151enum fw_error_type {
2152 FW_ERROR_TYPE_EXCEPTION = 0x0,
2153 FW_ERROR_TYPE_HWMODULE = 0x1,
2154 FW_ERROR_TYPE_WR = 0x2,
2155 FW_ERROR_TYPE_ACL = 0x3,
2156};
2157
2158struct fw_error_cmd {
2159 __be32 op_to_type;
2160 __be32 len16_pkd;
2161 union fw_error {
2162 struct fw_error_exception {
2163 __be32 info[6];
2164 } exception;
2165 struct fw_error_hwmodule {
2166 __be32 regaddr;
2167 __be32 regval;
2168 } hwmodule;
2169 struct fw_error_wr {
2170 __be16 cidx;
2171 __be16 pfn_vfn;
2172 __be32 eqid;
2173 u8 wrhdr[16];
2174 } wr;
2175 struct fw_error_acl {
2176 __be16 cidx;
2177 __be16 pfn_vfn;
2178 __be32 eqid;
2179 __be16 mv_pkd;
2180 u8 val[6];
2181 __be64 r4;
2182 } acl;
2183 } u;
2184};
2185
2186struct fw_debug_cmd {
2187 __be32 op_type;
2188#define FW_DEBUG_CMD_TYPE_GET(x) ((x) & 0xff)
2189 __be32 len16_pkd;
2190 union fw_debug {
2191 struct fw_debug_assert {
2192 __be32 fcid;
2193 __be32 line;
2194 __be32 x;
2195 __be32 y;
2196 u8 filename_0_7[8];
2197 u8 filename_8_15[8];
2198 __be64 r3;
2199 } assert;
2200 struct fw_debug_prt {
2201 __be16 dprtstridx;
2202 __be16 r3[3];
2203 __be32 dprtstrparam0;
2204 __be32 dprtstrparam1;
2205 __be32 dprtstrparam2;
2206 __be32 dprtstrparam3;
2207 } prt;
2208 } u;
2209};
2210
Vipul Pandya52367a72012-09-26 02:39:38 +00002211#define FW_PCIE_FW_ERR (1U << 31)
2212#define FW_PCIE_FW_INIT (1U << 30)
Vipul Pandya26f7cbc2012-09-26 02:39:42 +00002213#define FW_PCIE_FW_HALT (1U << 29)
Vipul Pandya52367a72012-09-26 02:39:38 +00002214#define FW_PCIE_FW_MASTER_VLD (1U << 15)
2215#define FW_PCIE_FW_MASTER_MASK 0x7
2216#define FW_PCIE_FW_MASTER_SHIFT 12
2217#define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
2218#define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
2219 FW_PCIE_FW_MASTER_MASK)
2220
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002221struct fw_hdr {
2222 u8 ver;
Hariprasad Shenai16e47622013-12-03 17:05:58 +05302223 u8 chip; /* terminator chip type */
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002224 __be16 len512; /* bin length in units of 512-bytes */
2225 __be32 fw_ver; /* firmware version */
2226 __be32 tp_microcode_ver;
2227 u8 intfver_nic;
2228 u8 intfver_vnic;
2229 u8 intfver_ofld;
2230 u8 intfver_ri;
2231 u8 intfver_iscsipdu;
2232 u8 intfver_iscsi;
Vipul Pandyab407a4a2013-04-29 04:04:40 +00002233 u8 intfver_fcoepdu;
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002234 u8 intfver_fcoe;
Vipul Pandyab407a4a2013-04-29 04:04:40 +00002235 __u32 reserved2;
Vipul Pandya26f7cbc2012-09-26 02:39:42 +00002236 __u32 reserved3;
2237 __u32 reserved4;
Vipul Pandya26f7cbc2012-09-26 02:39:42 +00002238 __be32 flags;
2239 __be32 reserved6[23];
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002240};
2241
Hariprasad Shenai16e47622013-12-03 17:05:58 +05302242enum fw_hdr_chip {
2243 FW_HDR_CHIP_T4,
2244 FW_HDR_CHIP_T5
2245};
2246
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002247#define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
2248#define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff)
2249#define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
2250#define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
Vipul Pandya3069ee9b2012-05-18 15:29:26 +05302251
Vipul Pandyab407a4a2013-04-29 04:04:40 +00002252enum fw_hdr_intfver {
2253 FW_HDR_INTFVER_NIC = 0x00,
2254 FW_HDR_INTFVER_VNIC = 0x00,
2255 FW_HDR_INTFVER_OFLD = 0x00,
2256 FW_HDR_INTFVER_RI = 0x00,
2257 FW_HDR_INTFVER_ISCSIPDU = 0x00,
2258 FW_HDR_INTFVER_ISCSI = 0x00,
2259 FW_HDR_INTFVER_FCOEPDU = 0x00,
2260 FW_HDR_INTFVER_FCOE = 0x00,
2261};
2262
Vipul Pandya26f7cbc2012-09-26 02:39:42 +00002263enum fw_hdr_flags {
2264 FW_HDR_FLAGS_RESET_HALT = 0x00000001,
2265};
2266
Dimitris Michailidisbbc02c72010-04-01 15:28:22 +00002267#endif /* _T4FW_INTERFACE_H_ */