Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
t4fw_api.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Chelsio T4 Ethernet driver for Linux.
3  *
4  * Copyright (c) 2009-2010 Chelsio Communications, Inc. All rights reserved.
5  *
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 
38 #define FW_T4VF_SGE_BASE_ADDR 0x0000
39 #define FW_T4VF_MPS_BASE_ADDR 0x0100
40 #define FW_T4VF_PL_BASE_ADDR 0x0200
41 #define FW_T4VF_MBDATA_BASE_ADDR 0x0240
42 #define FW_T4VF_CIM_BASE_ADDR 0x0300
43 
45  FW_FILTER_WR = 0x02,
46  FW_ULPTX_WR = 0x04,
47  FW_TP_WR = 0x05,
49  FW_FLOWC_WR = 0x0a,
51  FW_CMD_WR = 0x10,
53  FW_RI_RES_WR = 0x0c,
54  FW_RI_INIT_WR = 0x0d,
56  FW_RI_SEND_WR = 0x15,
58  FW_RI_RECV_WR = 0x17,
63 };
64 
65 struct fw_wr_hdr {
68 };
69 
70 #define FW_WR_OP(x) ((x) << 24)
71 #define FW_WR_ATOMIC(x) ((x) << 23)
72 #define FW_WR_FLUSH(x) ((x) << 22)
73 #define FW_WR_COMPL(x) ((x) << 21)
74 #define FW_WR_IMMDLEN_MASK 0xff
75 #define FW_WR_IMMDLEN(x) ((x) << 0)
76 
77 #define FW_WR_EQUIQ (1U << 31)
78 #define FW_WR_EQUEQ (1U << 30)
79 #define FW_WR_FLOWID(x) ((x) << 8)
80 #define FW_WR_LEN16(x) ((x) << 0)
81 
82 #define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
83 
84 struct fw_ulptx_wr {
88 };
89 
90 struct fw_tp_wr {
94 };
95 
100 };
101 
103  FW_FLOWC_MNEM_PFNVFN, /* PFN [15:8] VFN [7:0] */
111 };
112 
115  u8 r4[3];
117 };
118 
119 struct fw_flowc_wr {
121 #define FW_FLOWC_WR_NPARAMS(x) ((x) << 0)
124 };
125 
131 #define FW_OFLD_TX_DATA_WR_TUNNEL(x) ((x) << 19)
132 #define FW_OFLD_TX_DATA_WR_SAVE(x) ((x) << 18)
133 #define FW_OFLD_TX_DATA_WR_FLUSH(x) ((x) << 17)
134 #define FW_OFLD_TX_DATA_WR_URGENT(x) ((x) << 16)
135 #define FW_OFLD_TX_DATA_WR_MORE(x) ((x) << 15)
136 #define FW_OFLD_TX_DATA_WR_SHOVE(x) ((x) << 14)
137 #define FW_OFLD_TX_DATA_WR_ULPMODE(x) ((x) << 10)
138 #define FW_OFLD_TX_DATA_WR_ULPSUBMODE(x) ((x) << 6)
139 };
140 
141 struct fw_cmd_wr {
143 #define FW_CMD_WR_DMA (1U << 17)
146 };
147 
151  __be32 r3[2];
156 };
157 
158 #define FW_CMD_MAX_TIMEOUT 3000
159 
160 /*
161  * If a host driver does a HELLO and discovers that there's already a MASTER
162  * selected, we may have to wait for that MASTER to finish issuing RESET,
163  * configuration and INITIALIZE commands. Also, there's a possibility that
164  * our own HELLO may get lost if it happens right as the MASTER is issuign a
165  * RESET command, so we need to be willing to make a few retries of our HELLO.
166  */
167 #define FW_CMD_HELLO_TIMEOUT (3 * FW_CMD_MAX_TIMEOUT)
168 #define FW_CMD_HELLO_RETRIES 3
169 
170 
172  FW_LDST_CMD = 0x01,
173  FW_RESET_CMD = 0x03,
174  FW_HELLO_CMD = 0x04,
175  FW_BYE_CMD = 0x05,
179  FW_PFVF_CMD = 0x09,
180  FW_IQ_CMD = 0x10,
185  FW_VI_CMD = 0x14,
192  FW_PORT_CMD = 0x1b,
201  FW_ERROR_CMD = 0x80,
202  FW_DEBUG_CMD = 0x81,
203 };
204 
212 };
213 
214 /*
215  * Generic command header flit0
216  */
217 struct fw_cmd_hdr {
220 };
221 
222 #define FW_CMD_OP(x) ((x) << 24)
223 #define FW_CMD_OP_GET(x) (((x) >> 24) & 0xff)
224 #define FW_CMD_REQUEST (1U << 23)
225 #define FW_CMD_READ (1U << 22)
226 #define FW_CMD_WRITE (1U << 21)
227 #define FW_CMD_EXEC (1U << 20)
228 #define FW_CMD_RAMASK(x) ((x) << 20)
229 #define FW_CMD_RETVAL(x) ((x) << 8)
230 #define FW_CMD_RETVAL_GET(x) (((x) >> 8) & 0xff)
231 #define FW_CMD_LEN16(x) ((x) << 0)
232 
245 };
246 
250 };
251 
255 };
256 
259 };
260 
261 struct fw_ldst_cmd {
263 #define FW_LDST_CMD_ADDRSPACE(x) ((x) << 0)
265  union fw_ldst {
269  } addrval;
270  struct fw_ldst_idctxt {
281  } idctxt;
282  struct fw_ldst_mdio {
287  } mdio;
288  struct fw_ldst_mps {
297  } mps;
298  struct fw_ldst_func {
305  } func;
306  } u;
307 };
308 
309 #define FW_LDST_CMD_MSG(x) ((x) << 31)
310 #define FW_LDST_CMD_PADDR(x) ((x) << 8)
311 #define FW_LDST_CMD_MMD(x) ((x) << 0)
312 #define FW_LDST_CMD_FID(x) ((x) << 15)
313 #define FW_LDST_CMD_CTL(x) ((x) << 0)
314 #define FW_LDST_CMD_RPLCPF(x) ((x) << 0)
315 
316 struct fw_reset_cmd {
321 };
322 
323 #define FW_RESET_CMD_HALT_SHIFT 31
324 #define FW_RESET_CMD_HALT_MASK 0x1
325 #define FW_RESET_CMD_HALT(x) ((x) << FW_RESET_CMD_HALT_SHIFT)
326 #define FW_RESET_CMD_HALT_GET(x) \
327  (((x) >> FW_RESET_CMD_HALT_SHIFT) & FW_RESET_CMD_HALT_MASK)
328 
331 };
332 
333 struct fw_hello_cmd {
337 #define FW_HELLO_CMD_ERR (1U << 31)
338 #define FW_HELLO_CMD_INIT (1U << 30)
339 #define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
340 #define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)
341 #define FW_HELLO_CMD_MBMASTER_MASK 0xfU
342 #define FW_HELLO_CMD_MBMASTER_SHIFT 24
343 #define FW_HELLO_CMD_MBMASTER(x) ((x) << FW_HELLO_CMD_MBMASTER_SHIFT)
344 #define FW_HELLO_CMD_MBMASTER_GET(x) \
345  (((x) >> FW_HELLO_CMD_MBMASTER_SHIFT) & FW_HELLO_CMD_MBMASTER_MASK)
346 #define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)
347 #define FW_HELLO_CMD_STAGE(x) ((x) << 17)
348 #define FW_HELLO_CMD_CLEARINIT (1U << 16)
350 };
351 
352 struct fw_bye_cmd {
356 };
357 
362 };
363 
366  FW_CAPS_CONFIG_HM_PL = 0x00000002,
367  FW_CAPS_CONFIG_HM_SGE = 0x00000004,
368  FW_CAPS_CONFIG_HM_CIM = 0x00000008,
370  FW_CAPS_CONFIG_HM_TP = 0x00000020,
374  FW_CAPS_CONFIG_HM_MC = 0x00000200,
375  FW_CAPS_CONFIG_HM_LE = 0x00000400,
376  FW_CAPS_CONFIG_HM_MPS = 0x00000800,
380  FW_CAPS_CONFIG_HM_MI = 0x00008000,
383  FW_CAPS_CONFIG_HM_SMB = 0x00040000,
384  FW_CAPS_CONFIG_HM_MA = 0x00080000,
386  FW_CAPS_CONFIG_HM_PMU = 0x00200000,
388  FW_CAPS_CONFIG_HM_SF = 0x00800000,
389 };
390 
394 };
395 
400 };
401 
405 };
406 
408  FW_CAPS_CONFIG_NIC = 0x00000001,
409  FW_CAPS_CONFIG_NIC_VM = 0x00000002,
410 };
411 
413  FW_CAPS_CONFIG_OFLD = 0x00000001,
414 };
415 
419 };
420 
426 };
427 
431 };
432 
439 };
440 
459 };
460 
461 #define FW_CAPS_CONFIG_CMD_CFVALID (1U << 27)
462 #define FW_CAPS_CONFIG_CMD_MEMTYPE_CF(x) ((x) << 24)
463 #define FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(x) ((x) << 16)
464 
465 /*
466  * params command mnemonics
467  */
469  FW_PARAMS_MNEM_DEV = 1, /* device params */
470  FW_PARAMS_MNEM_PFVF = 2, /* function params */
471  FW_PARAMS_MNEM_REG = 3, /* limited register access */
472  FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */
474 };
475 
476 /*
477  * device parameters
478  */
480  FW_PARAMS_PARAM_DEV_CCLK = 0x00, /* chip core clock in khz */
481  FW_PARAMS_PARAM_DEV_PORTVEC = 0x01, /* the port vector */
482  FW_PARAMS_PARAM_DEV_NTID = 0x02, /* reads the number of TIDs
483  * allocated by the device's
484  * Lookup Engine
485  */
497 };
498 
499 /*
500  * physical and virtual function parameters
501  */
540 };
541 
542 /*
543  * dma queue parameters
544  */
551 };
552 
553 #define FW_PARAMS_MNEM(x) ((x) << 24)
554 #define FW_PARAMS_PARAM_X(x) ((x) << 16)
555 #define FW_PARAMS_PARAM_Y_SHIFT 8
556 #define FW_PARAMS_PARAM_Y_MASK 0xffU
557 #define FW_PARAMS_PARAM_Y(x) ((x) << FW_PARAMS_PARAM_Y_SHIFT)
558 #define FW_PARAMS_PARAM_Y_GET(x) (((x) >> FW_PARAMS_PARAM_Y_SHIFT) &\
559  FW_PARAMS_PARAM_Y_MASK)
560 #define FW_PARAMS_PARAM_Z_SHIFT 0
561 #define FW_PARAMS_PARAM_Z_MASK 0xffu
562 #define FW_PARAMS_PARAM_Z(x) ((x) << FW_PARAMS_PARAM_Z_SHIFT)
563 #define FW_PARAMS_PARAM_Z_GET(x) (((x) >> FW_PARAMS_PARAM_Z_SHIFT) &\
564  FW_PARAMS_PARAM_Z_MASK)
565 #define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
566 #define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
567 
574  } param[7];
575 };
576 
577 #define FW_PARAMS_CMD_PFN(x) ((x) << 8)
578 #define FW_PARAMS_CMD_VFN(x) ((x) << 0)
579 
580 struct fw_pfvf_cmd {
590 };
591 
592 #define FW_PFVF_CMD_PFN(x) ((x) << 8)
593 #define FW_PFVF_CMD_VFN(x) ((x) << 0)
594 
595 #define FW_PFVF_CMD_NIQFLINT(x) ((x) << 20)
596 #define FW_PFVF_CMD_NIQFLINT_GET(x) (((x) >> 20) & 0xfff)
597 
598 #define FW_PFVF_CMD_NIQ(x) ((x) << 0)
599 #define FW_PFVF_CMD_NIQ_GET(x) (((x) >> 0) & 0xfffff)
600 
601 #define FW_PFVF_CMD_TYPE (1 << 31)
602 #define FW_PFVF_CMD_TYPE_GET(x) (((x) >> 31) & 0x1)
603 
604 #define FW_PFVF_CMD_CMASK(x) ((x) << 24)
605 #define FW_PFVF_CMD_CMASK_MASK 0xf
606 #define FW_PFVF_CMD_CMASK_GET(x) (((x) >> 24) & FW_PFVF_CMD_CMASK_MASK)
607 
608 #define FW_PFVF_CMD_PMASK(x) ((x) << 20)
609 #define FW_PFVF_CMD_PMASK_MASK 0xf
610 #define FW_PFVF_CMD_PMASK_GET(x) (((x) >> 20) & FW_PFVF_CMD_PMASK_MASK)
611 
612 #define FW_PFVF_CMD_NEQ(x) ((x) << 0)
613 #define FW_PFVF_CMD_NEQ_GET(x) (((x) >> 0) & 0xfffff)
614 
615 #define FW_PFVF_CMD_TC(x) ((x) << 24)
616 #define FW_PFVF_CMD_TC_GET(x) (((x) >> 24) & 0xff)
617 
618 #define FW_PFVF_CMD_NVI(x) ((x) << 16)
619 #define FW_PFVF_CMD_NVI_GET(x) (((x) >> 16) & 0xff)
620 
621 #define FW_PFVF_CMD_NEXACTF(x) ((x) << 0)
622 #define FW_PFVF_CMD_NEXACTF_GET(x) (((x) >> 0) & 0xffff)
623 
624 #define FW_PFVF_CMD_R_CAPS(x) ((x) << 24)
625 #define FW_PFVF_CMD_R_CAPS_GET(x) (((x) >> 24) & 0xff)
626 
627 #define FW_PFVF_CMD_WX_CAPS(x) ((x) << 16)
628 #define FW_PFVF_CMD_WX_CAPS_GET(x) (((x) >> 16) & 0xff)
629 
630 #define FW_PFVF_CMD_NETHCTRL(x) ((x) << 0)
631 #define FW_PFVF_CMD_NETHCTRL_GET(x) (((x) >> 0) & 0xffff)
632 
636 };
637 
638 struct fw_iq_cmd {
657 };
658 
659 #define FW_IQ_CMD_PFN(x) ((x) << 8)
660 #define FW_IQ_CMD_VFN(x) ((x) << 0)
661 
662 #define FW_IQ_CMD_ALLOC (1U << 31)
663 #define FW_IQ_CMD_FREE (1U << 30)
664 #define FW_IQ_CMD_MODIFY (1U << 29)
665 #define FW_IQ_CMD_IQSTART(x) ((x) << 28)
666 #define FW_IQ_CMD_IQSTOP(x) ((x) << 27)
667 
668 #define FW_IQ_CMD_TYPE(x) ((x) << 29)
669 #define FW_IQ_CMD_IQASYNCH(x) ((x) << 28)
670 #define FW_IQ_CMD_VIID(x) ((x) << 16)
671 #define FW_IQ_CMD_IQANDST(x) ((x) << 15)
672 #define FW_IQ_CMD_IQANUS(x) ((x) << 14)
673 #define FW_IQ_CMD_IQANUD(x) ((x) << 12)
674 #define FW_IQ_CMD_IQANDSTINDEX(x) ((x) << 0)
675 
676 #define FW_IQ_CMD_IQDROPRSS (1U << 15)
677 #define FW_IQ_CMD_IQGTSMODE (1U << 14)
678 #define FW_IQ_CMD_IQPCIECH(x) ((x) << 12)
679 #define FW_IQ_CMD_IQDCAEN(x) ((x) << 11)
680 #define FW_IQ_CMD_IQDCACPU(x) ((x) << 6)
681 #define FW_IQ_CMD_IQINTCNTTHRESH(x) ((x) << 4)
682 #define FW_IQ_CMD_IQO (1U << 3)
683 #define FW_IQ_CMD_IQCPRIO(x) ((x) << 2)
684 #define FW_IQ_CMD_IQESIZE(x) ((x) << 0)
685 
686 #define FW_IQ_CMD_IQNS(x) ((x) << 31)
687 #define FW_IQ_CMD_IQRO(x) ((x) << 30)
688 #define FW_IQ_CMD_IQFLINTIQHSEN(x) ((x) << 28)
689 #define FW_IQ_CMD_IQFLINTCONGEN(x) ((x) << 27)
690 #define FW_IQ_CMD_IQFLINTISCSIC(x) ((x) << 26)
691 #define FW_IQ_CMD_FL0CNGCHMAP(x) ((x) << 20)
692 #define FW_IQ_CMD_FL0CACHELOCK(x) ((x) << 15)
693 #define FW_IQ_CMD_FL0DBP(x) ((x) << 14)
694 #define FW_IQ_CMD_FL0DATANS(x) ((x) << 13)
695 #define FW_IQ_CMD_FL0DATARO(x) ((x) << 12)
696 #define FW_IQ_CMD_FL0CONGCIF(x) ((x) << 11)
697 #define FW_IQ_CMD_FL0ONCHIP(x) ((x) << 10)
698 #define FW_IQ_CMD_FL0STATUSPGNS(x) ((x) << 9)
699 #define FW_IQ_CMD_FL0STATUSPGRO(x) ((x) << 8)
700 #define FW_IQ_CMD_FL0FETCHNS(x) ((x) << 7)
701 #define FW_IQ_CMD_FL0FETCHRO(x) ((x) << 6)
702 #define FW_IQ_CMD_FL0HOSTFCMODE(x) ((x) << 4)
703 #define FW_IQ_CMD_FL0CPRIO(x) ((x) << 3)
704 #define FW_IQ_CMD_FL0PADEN (1U << 2)
705 #define FW_IQ_CMD_FL0PACKEN (1U << 1)
706 #define FW_IQ_CMD_FL0CONGEN (1U << 0)
707 
708 #define FW_IQ_CMD_FL0DCAEN(x) ((x) << 15)
709 #define FW_IQ_CMD_FL0DCACPU(x) ((x) << 10)
710 #define FW_IQ_CMD_FL0FBMIN(x) ((x) << 7)
711 #define FW_IQ_CMD_FL0FBMAX(x) ((x) << 4)
712 #define FW_IQ_CMD_FL0CIDXFTHRESHO (1U << 3)
713 #define FW_IQ_CMD_FL0CIDXFTHRESH(x) ((x) << 0)
714 
715 #define FW_IQ_CMD_FL1CNGCHMAP(x) ((x) << 20)
716 #define FW_IQ_CMD_FL1CACHELOCK(x) ((x) << 15)
717 #define FW_IQ_CMD_FL1DBP(x) ((x) << 14)
718 #define FW_IQ_CMD_FL1DATANS(x) ((x) << 13)
719 #define FW_IQ_CMD_FL1DATARO(x) ((x) << 12)
720 #define FW_IQ_CMD_FL1CONGCIF(x) ((x) << 11)
721 #define FW_IQ_CMD_FL1ONCHIP(x) ((x) << 10)
722 #define FW_IQ_CMD_FL1STATUSPGNS(x) ((x) << 9)
723 #define FW_IQ_CMD_FL1STATUSPGRO(x) ((x) << 8)
724 #define FW_IQ_CMD_FL1FETCHNS(x) ((x) << 7)
725 #define FW_IQ_CMD_FL1FETCHRO(x) ((x) << 6)
726 #define FW_IQ_CMD_FL1HOSTFCMODE(x) ((x) << 4)
727 #define FW_IQ_CMD_FL1CPRIO(x) ((x) << 3)
728 #define FW_IQ_CMD_FL1PADEN (1U << 2)
729 #define FW_IQ_CMD_FL1PACKEN (1U << 1)
730 #define FW_IQ_CMD_FL1CONGEN (1U << 0)
731 
732 #define FW_IQ_CMD_FL1DCAEN(x) ((x) << 15)
733 #define FW_IQ_CMD_FL1DCACPU(x) ((x) << 10)
734 #define FW_IQ_CMD_FL1FBMIN(x) ((x) << 7)
735 #define FW_IQ_CMD_FL1FBMAX(x) ((x) << 4)
736 #define FW_IQ_CMD_FL1CIDXFTHRESHO (1U << 3)
737 #define FW_IQ_CMD_FL1CIDXFTHRESH(x) ((x) << 0)
738 
750 };
751 
752 #define FW_EQ_ETH_CMD_PFN(x) ((x) << 8)
753 #define FW_EQ_ETH_CMD_VFN(x) ((x) << 0)
754 #define FW_EQ_ETH_CMD_ALLOC (1U << 31)
755 #define FW_EQ_ETH_CMD_FREE (1U << 30)
756 #define FW_EQ_ETH_CMD_MODIFY (1U << 29)
757 #define FW_EQ_ETH_CMD_EQSTART (1U << 28)
758 #define FW_EQ_ETH_CMD_EQSTOP (1U << 27)
759 
760 #define FW_EQ_ETH_CMD_EQID(x) ((x) << 0)
761 #define FW_EQ_ETH_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
762 #define FW_EQ_ETH_CMD_PHYSEQID(x) ((x) << 0)
763 #define FW_EQ_ETH_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
764 
765 #define FW_EQ_ETH_CMD_FETCHSZM(x) ((x) << 26)
766 #define FW_EQ_ETH_CMD_STATUSPGNS(x) ((x) << 25)
767 #define FW_EQ_ETH_CMD_STATUSPGRO(x) ((x) << 24)
768 #define FW_EQ_ETH_CMD_FETCHNS(x) ((x) << 23)
769 #define FW_EQ_ETH_CMD_FETCHRO(x) ((x) << 22)
770 #define FW_EQ_ETH_CMD_HOSTFCMODE(x) ((x) << 20)
771 #define FW_EQ_ETH_CMD_CPRIO(x) ((x) << 19)
772 #define FW_EQ_ETH_CMD_ONCHIP(x) ((x) << 18)
773 #define FW_EQ_ETH_CMD_PCIECHN(x) ((x) << 16)
774 #define FW_EQ_ETH_CMD_IQID(x) ((x) << 0)
775 
776 #define FW_EQ_ETH_CMD_DCAEN(x) ((x) << 31)
777 #define FW_EQ_ETH_CMD_DCACPU(x) ((x) << 26)
778 #define FW_EQ_ETH_CMD_FBMIN(x) ((x) << 23)
779 #define FW_EQ_ETH_CMD_FBMAX(x) ((x) << 20)
780 #define FW_EQ_ETH_CMD_CIDXFTHRESHO(x) ((x) << 19)
781 #define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16)
782 #define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0)
783 
784 #define FW_EQ_ETH_CMD_VIID(x) ((x) << 16)
785 
794 };
795 
796 #define FW_EQ_CTRL_CMD_PFN(x) ((x) << 8)
797 #define FW_EQ_CTRL_CMD_VFN(x) ((x) << 0)
798 
799 #define FW_EQ_CTRL_CMD_ALLOC (1U << 31)
800 #define FW_EQ_CTRL_CMD_FREE (1U << 30)
801 #define FW_EQ_CTRL_CMD_MODIFY (1U << 29)
802 #define FW_EQ_CTRL_CMD_EQSTART (1U << 28)
803 #define FW_EQ_CTRL_CMD_EQSTOP (1U << 27)
804 
805 #define FW_EQ_CTRL_CMD_CMPLIQID(x) ((x) << 20)
806 #define FW_EQ_CTRL_CMD_EQID(x) ((x) << 0)
807 #define FW_EQ_CTRL_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
808 #define FW_EQ_CTRL_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
809 
810 #define FW_EQ_CTRL_CMD_FETCHSZM (1U << 26)
811 #define FW_EQ_CTRL_CMD_STATUSPGNS (1U << 25)
812 #define FW_EQ_CTRL_CMD_STATUSPGRO (1U << 24)
813 #define FW_EQ_CTRL_CMD_FETCHNS (1U << 23)
814 #define FW_EQ_CTRL_CMD_FETCHRO (1U << 22)
815 #define FW_EQ_CTRL_CMD_HOSTFCMODE(x) ((x) << 20)
816 #define FW_EQ_CTRL_CMD_CPRIO(x) ((x) << 19)
817 #define FW_EQ_CTRL_CMD_ONCHIP(x) ((x) << 18)
818 #define FW_EQ_CTRL_CMD_PCIECHN(x) ((x) << 16)
819 #define FW_EQ_CTRL_CMD_IQID(x) ((x) << 0)
820 
821 #define FW_EQ_CTRL_CMD_DCAEN(x) ((x) << 31)
822 #define FW_EQ_CTRL_CMD_DCACPU(x) ((x) << 26)
823 #define FW_EQ_CTRL_CMD_FBMIN(x) ((x) << 23)
824 #define FW_EQ_CTRL_CMD_FBMAX(x) ((x) << 20)
825 #define FW_EQ_CTRL_CMD_CIDXFTHRESHO(x) ((x) << 19)
826 #define FW_EQ_CTRL_CMD_CIDXFTHRESH(x) ((x) << 16)
827 #define FW_EQ_CTRL_CMD_EQSIZE(x) ((x) << 0)
828 
837 };
838 
839 #define FW_EQ_OFLD_CMD_PFN(x) ((x) << 8)
840 #define FW_EQ_OFLD_CMD_VFN(x) ((x) << 0)
841 
842 #define FW_EQ_OFLD_CMD_ALLOC (1U << 31)
843 #define FW_EQ_OFLD_CMD_FREE (1U << 30)
844 #define FW_EQ_OFLD_CMD_MODIFY (1U << 29)
845 #define FW_EQ_OFLD_CMD_EQSTART (1U << 28)
846 #define FW_EQ_OFLD_CMD_EQSTOP (1U << 27)
847 
848 #define FW_EQ_OFLD_CMD_EQID(x) ((x) << 0)
849 #define FW_EQ_OFLD_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
850 #define FW_EQ_OFLD_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
851 
852 #define FW_EQ_OFLD_CMD_FETCHSZM(x) ((x) << 26)
853 #define FW_EQ_OFLD_CMD_STATUSPGNS(x) ((x) << 25)
854 #define FW_EQ_OFLD_CMD_STATUSPGRO(x) ((x) << 24)
855 #define FW_EQ_OFLD_CMD_FETCHNS(x) ((x) << 23)
856 #define FW_EQ_OFLD_CMD_FETCHRO(x) ((x) << 22)
857 #define FW_EQ_OFLD_CMD_HOSTFCMODE(x) ((x) << 20)
858 #define FW_EQ_OFLD_CMD_CPRIO(x) ((x) << 19)
859 #define FW_EQ_OFLD_CMD_ONCHIP(x) ((x) << 18)
860 #define FW_EQ_OFLD_CMD_PCIECHN(x) ((x) << 16)
861 #define FW_EQ_OFLD_CMD_IQID(x) ((x) << 0)
862 
863 #define FW_EQ_OFLD_CMD_DCAEN(x) ((x) << 31)
864 #define FW_EQ_OFLD_CMD_DCACPU(x) ((x) << 26)
865 #define FW_EQ_OFLD_CMD_FBMIN(x) ((x) << 23)
866 #define FW_EQ_OFLD_CMD_FBMAX(x) ((x) << 20)
867 #define FW_EQ_OFLD_CMD_CIDXFTHRESHO(x) ((x) << 19)
868 #define FW_EQ_OFLD_CMD_CIDXFTHRESH(x) ((x) << 16)
869 #define FW_EQ_OFLD_CMD_EQSIZE(x) ((x) << 0)
870 
871 /*
872  * Macros for VIID parsing:
873  * VIID - [10:8] PFN, [7] VI Valid, [6:0] VI number
874  */
875 #define FW_VIID_PFN_GET(x) (((x) >> 8) & 0x7)
876 #define FW_VIID_VIVLD_GET(x) (((x) >> 7) & 0x1)
877 #define FW_VIID_VIN_GET(x) (((x) >> 0) & 0x7F)
878 
879 struct fw_vi_cmd {
883  u8 mac[6];
886  u8 nmac0[6];
888  u8 nmac1[6];
890  u8 nmac2[6];
892  u8 nmac3[6];
895 };
896 
897 #define FW_VI_CMD_PFN(x) ((x) << 8)
898 #define FW_VI_CMD_VFN(x) ((x) << 0)
899 #define FW_VI_CMD_ALLOC (1U << 31)
900 #define FW_VI_CMD_FREE (1U << 30)
901 #define FW_VI_CMD_VIID(x) ((x) << 0)
902 #define FW_VI_CMD_VIID_GET(x) ((x) & 0xfff)
903 #define FW_VI_CMD_PORTID(x) ((x) << 4)
904 #define FW_VI_CMD_PORTID_GET(x) (((x) >> 4) & 0xf)
905 #define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff)
906 
907 /* Special VI_MAC command index ids */
908 #define FW_VI_MAC_ADD_MAC 0x3FF
909 #define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE
910 #define FW_VI_MAC_MAC_BASED_FREE 0x3FD
911 #define FW_CLS_TCAM_NUM_ENTRIES 336
912 
918 };
919 
925 };
926 
930  union fw_vi_mac {
934  } exact[7];
935  struct fw_vi_mac_hash {
937  } hash;
938  } u;
939 };
940 
941 #define FW_VI_MAC_CMD_VIID(x) ((x) << 0)
942 #define FW_VI_MAC_CMD_FREEMACS(x) ((x) << 31)
943 #define FW_VI_MAC_CMD_HASHVECEN (1U << 23)
944 #define FW_VI_MAC_CMD_HASHUNIEN(x) ((x) << 22)
945 #define FW_VI_MAC_CMD_VALID (1U << 15)
946 #define FW_VI_MAC_CMD_PRIO(x) ((x) << 12)
947 #define FW_VI_MAC_CMD_SMAC_RESULT(x) ((x) << 10)
948 #define FW_VI_MAC_CMD_SMAC_RESULT_GET(x) (((x) >> 10) & 0x3)
949 #define FW_VI_MAC_CMD_IDX(x) ((x) << 0)
950 #define FW_VI_MAC_CMD_IDX_GET(x) (((x) >> 0) & 0x3ff)
951 
952 #define FW_RXMODE_MTU_NO_CHG 65535
953 
959 };
960 
961 #define FW_VI_RXMODE_CMD_VIID(x) ((x) << 0)
962 #define FW_VI_RXMODE_CMD_MTU_MASK 0xffff
963 #define FW_VI_RXMODE_CMD_MTU(x) ((x) << 16)
964 #define FW_VI_RXMODE_CMD_PROMISCEN_MASK 0x3
965 #define FW_VI_RXMODE_CMD_PROMISCEN(x) ((x) << 14)
966 #define FW_VI_RXMODE_CMD_ALLMULTIEN_MASK 0x3
967 #define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
968 #define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
969 #define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
970 #define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
971 #define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
972 
979 };
980 
981 #define FW_VI_ENABLE_CMD_VIID(x) ((x) << 0)
982 #define FW_VI_ENABLE_CMD_IEN(x) ((x) << 31)
983 #define FW_VI_ENABLE_CMD_EEN(x) ((x) << 30)
984 #define FW_VI_ENABLE_CMD_LED (1U << 29)
985 
986 /* VI VF stats offset definitions */
987 #define VI_VF_NUM_STATS 16
1005 };
1006 
1007 /* VI PF stats offset definitions */
1008 #define VI_PF_NUM_STATS 17
1027 };
1028 
1032  union fw_vi_stats {
1043  } ctl;
1062  } pf;
1080  } vf;
1081  } u;
1082 };
1083 
1084 #define FW_VI_STATS_CMD_VIID(x) ((x) << 0)
1085 #define FW_VI_STATS_CMD_NSTATS(x) ((x) << 12)
1086 #define FW_VI_STATS_CMD_IX(x) ((x) << 0)
1087 
1092  u8 r3[7];
1101 };
1102 
1103 #define FW_ACL_MAC_CMD_PFN(x) ((x) << 8)
1104 #define FW_ACL_MAC_CMD_VFN(x) ((x) << 0)
1105 #define FW_ACL_MAC_CMD_EN(x) ((x) << 31)
1106 
1112  u8 r3_lo[6];
1114 };
1115 
1116 #define FW_ACL_VLAN_CMD_PFN(x) ((x) << 8)
1117 #define FW_ACL_VLAN_CMD_VFN(x) ((x) << 0)
1118 #define FW_ACL_VLAN_CMD_EN(x) ((x) << 31)
1119 #define FW_ACL_VLAN_CMD_DROPNOVLAN(x) ((x) << 7)
1120 #define FW_ACL_VLAN_CMD_FM(x) ((x) << 6)
1121 
1139 };
1140 
1146 };
1147 
1148 #define FW_PORT_MDI(x) ((x) << 9)
1149 
1171 };
1172 
1180 };
1181 
1186 };
1187 
1191 };
1192 
1193 struct fw_port_cmd {
1196  union fw_port {
1197  struct fw_port_l1cfg {
1200  } l1cfg;
1201  struct fw_port_l2cfg {
1213  } l2cfg;
1214  struct fw_port_info {
1223  } info;
1224  struct fw_port_ppp {
1227  } ppp;
1228  struct fw_port_dcb {
1237  u8 pgpc[8];
1238  } dcb;
1239  } u;
1240 };
1241 
1242 #define FW_PORT_CMD_READ (1U << 22)
1243 
1244 #define FW_PORT_CMD_PORTID(x) ((x) << 0)
1245 #define FW_PORT_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
1246 
1247 #define FW_PORT_CMD_ACTION(x) ((x) << 16)
1248 #define FW_PORT_CMD_ACTION_GET(x) (((x) >> 16) & 0xffff)
1249 
1250 #define FW_PORT_CMD_CTLBF(x) ((x) << 10)
1251 #define FW_PORT_CMD_OVLAN3(x) ((x) << 7)
1252 #define FW_PORT_CMD_OVLAN2(x) ((x) << 6)
1253 #define FW_PORT_CMD_OVLAN1(x) ((x) << 5)
1254 #define FW_PORT_CMD_OVLAN0(x) ((x) << 4)
1255 #define FW_PORT_CMD_IVLAN0(x) ((x) << 3)
1256 
1257 #define FW_PORT_CMD_TXIPG(x) ((x) << 19)
1258 
1259 #define FW_PORT_CMD_LSTATUS (1U << 31)
1260 #define FW_PORT_CMD_LSPEED(x) ((x) << 24)
1261 #define FW_PORT_CMD_LSPEED_GET(x) (((x) >> 24) & 0x3f)
1262 #define FW_PORT_CMD_TXPAUSE (1U << 23)
1263 #define FW_PORT_CMD_RXPAUSE (1U << 22)
1264 #define FW_PORT_CMD_MDIOCAP (1U << 21)
1265 #define FW_PORT_CMD_MDIOADDR_GET(x) (((x) >> 16) & 0x1f)
1266 #define FW_PORT_CMD_LPTXPAUSE (1U << 15)
1267 #define FW_PORT_CMD_LPRXPAUSE (1U << 14)
1268 #define FW_PORT_CMD_PTYPE_MASK 0x1f
1269 #define FW_PORT_CMD_PTYPE_GET(x) (((x) >> 8) & FW_PORT_CMD_PTYPE_MASK)
1270 #define FW_PORT_CMD_MODTYPE_MASK 0x1f
1271 #define FW_PORT_CMD_MODTYPE_GET(x) (((x) >> 0) & FW_PORT_CMD_MODTYPE_MASK)
1272 
1273 #define FW_PORT_CMD_PPPEN(x) ((x) << 31)
1274 #define FW_PORT_CMD_TPSRC(x) ((x) << 28)
1275 #define FW_PORT_CMD_NCSISRC(x) ((x) << 24)
1276 
1277 #define FW_PORT_CMD_CH0(x) ((x) << 20)
1278 #define FW_PORT_CMD_CH1(x) ((x) << 16)
1279 #define FW_PORT_CMD_CH2(x) ((x) << 12)
1280 #define FW_PORT_CMD_CH3(x) ((x) << 8)
1281 #define FW_PORT_CMD_NCSICH(x) ((x) << 4)
1282 
1296 
1298 };
1299 
1308 
1310 };
1311 
1312 /* port stats */
1313 #define FW_NUM_PORT_STATS 50
1314 #define FW_NUM_PORT_TX_STATS 23
1315 #define FW_NUM_PORT_RX_STATS 27
1316 
1341 };
1342 
1371 };
1372 
1388  } ctl;
1442  } all;
1443  } u;
1444 };
1445 
1446 #define FW_PORT_STATS_CMD_NSTATS(x) ((x) << 4)
1447 #define FW_PORT_STATS_CMD_BG_BM(x) ((x) << 0)
1448 #define FW_PORT_STATS_CMD_TX(x) ((x) << 7)
1449 #define FW_PORT_STATS_CMD_IX(x) ((x) << 0)
1450 
1451 /* port loopback stats */
1452 #define FW_NUM_LB_STATS 16
1468 };
1469 
1485  } ctl;
1502  } all;
1503  } u;
1504 };
1505 
1506 #define FW_PORT_LB_STATS_CMD_LBPORT(x) ((x) << 0)
1507 #define FW_PORT_LB_STATS_CMD_NSTATS(x) ((x) << 4)
1508 #define FW_PORT_LB_STATS_CMD_BG_BM(x) ((x) << 0)
1509 #define FW_PORT_LB_STATS_CMD_IX(x) ((x) << 0)
1510 
1513 #define FW_RSS_IND_TBL_CMD_VIID(x) ((x) << 0)
1519 #define FW_RSS_IND_TBL_CMD_IQ0(x) ((x) << 20)
1520 #define FW_RSS_IND_TBL_CMD_IQ1(x) ((x) << 10)
1521 #define FW_RSS_IND_TBL_CMD_IQ2(x) ((x) << 0)
1533 };
1534 
1544  } manual;
1548 #define FW_RSS_GLB_CONFIG_CMD_SYNMAPEN (1U << 8)
1549 #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV6 (1U << 7)
1550 #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV6 (1U << 6)
1551 #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV4 (1U << 5)
1552 #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV4 (1U << 4)
1553 #define FW_RSS_GLB_CONFIG_CMD_OFDMAPEN (1U << 3)
1554 #define FW_RSS_GLB_CONFIG_CMD_TNLMAPEN (1U << 2)
1555 #define FW_RSS_GLB_CONFIG_CMD_TNLALLLKP (1U << 1)
1556 #define FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ (1U << 0)
1559  } basicvirtual;
1560  } u;
1561 };
1562 
1563 #define FW_RSS_GLB_CONFIG_CMD_MODE(x) ((x) << 28)
1564 #define FW_RSS_GLB_CONFIG_CMD_MODE_GET(x) (((x) >> 28) & 0xf)
1565 
1566 #define FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL 0
1567 #define FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL 1
1568 
1571 #define FW_RSS_VI_CONFIG_CMD_VIID(x) ((x) << 0)
1578  } manual;
1582 #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ(x) ((x) << 16)
1583 #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ_GET(x) (((x) >> 16) & 0x3ff)
1584 #define FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN (1U << 4)
1585 #define FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN (1U << 3)
1586 #define FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN (1U << 2)
1587 #define FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN (1U << 1)
1588 #define FW_RSS_VI_CONFIG_CMD_UDPEN (1U << 0)
1591  } basicvirtual;
1592  } u;
1593 };
1594 
1600 };
1601 
1605  union fw_error {
1608  } exception;
1612  } hwmodule;
1613  struct fw_error_wr {
1617  u8 wrhdr[16];
1618  } wr;
1619  struct fw_error_acl {
1624  u8 val[6];
1626  } acl;
1627  } u;
1628 };
1629 
1632 #define FW_DEBUG_CMD_TYPE_GET(x) ((x) & 0xff)
1634  union fw_debug {
1643  } assert;
1644  struct fw_debug_prt {
1651  } prt;
1652  } u;
1653 };
1654 
1655 #define FW_PCIE_FW_ERR (1U << 31)
1656 #define FW_PCIE_FW_INIT (1U << 30)
1657 #define FW_PCIE_FW_HALT (1U << 29)
1658 #define FW_PCIE_FW_MASTER_VLD (1U << 15)
1659 #define FW_PCIE_FW_MASTER_MASK 0x7
1660 #define FW_PCIE_FW_MASTER_SHIFT 12
1661 #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
1662 #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
1663  FW_PCIE_FW_MASTER_MASK)
1664 
1665 struct fw_hdr {
1668  __be16 len512; /* bin length in units of 512-bytes */
1669  __be32 fw_ver; /* firmware version */
1684 };
1685 
1686 #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
1687 #define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff)
1688 #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
1689 #define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
1690 
1693 };
1694 
1695 #endif /* _T4FW_INTERFACE_H_ */