Imported Upstream version 16.04
[deb_dpdk.git] / drivers / net / cxgbe / base / t4_regs_values.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2014-2015 Chelsio Communications.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Chelsio Communications nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef __T4_REGS_VALUES_H__
35 #define __T4_REGS_VALUES_H__
36
37 /*
38  * This file contains definitions for various T4 register value hardware
39  * constants.  The types of values encoded here are predominantly those for
40  * register fields which control "modal" behavior.  For the most part, we do
41  * not include definitions for register fields which are simple numeric
42  * metrics, etc.
43  */
44
45 /*
46  * SGE definitions.
47  * ================
48  */
49
50 /*
51  * SGE register field values.
52  */
53
54 /* CONTROL register */
55 #define X_RXPKTCPLMODE_SPLIT            1
56 #define X_INGPCIEBOUNDARY_32B           0
57 #define X_INGPADBOUNDARY_SHIFT          5
58
59 /* CONTROL2 register */
60 #define X_INGPACKBOUNDARY_SHIFT         5
61 #define X_INGPACKBOUNDARY_16B           0
62
63 /* GTS register */
64 #define X_TIMERREG_RESTART_COUNTER      6
65 #define X_TIMERREG_UPDATE_CIDX          7
66
67 /*
68  * Egress Context field values
69  */
70 #define X_FETCHBURSTMIN_64B             2
71 #define X_FETCHBURSTMIN_128B            3
72 #define X_FETCHBURSTMAX_256B            2
73 #define X_FETCHBURSTMAX_512B            3
74
75 #define X_HOSTFCMODE_NONE               0
76
77 /*
78  * Ingress Context field values
79  */
80 #define X_UPDATEDELIVERY_INTERRUPT      1
81
82 #define X_RSPD_TYPE_FLBUF               0
83 #define X_RSPD_TYPE_CPL                 1
84
85 /*
86  * Context field definitions.  This is by no means a complete list of SGE
87  * Context fields.  In the vast majority of cases the firmware initializes
88  * things the way they need to be set up.  But in a few small cases, we need
89  * to compute new values and ship them off to the firmware to be applied to
90  * the SGE Conexts ...
91  */
92
93 /*
94  * Congestion Manager Definitions.
95  */
96 #define S_CONMCTXT_CNGTPMODE            19
97 #define M_CONMCTXT_CNGTPMODE            0x3
98 #define V_CONMCTXT_CNGTPMODE(x)         ((x) << S_CONMCTXT_CNGTPMODE)
99 #define G_CONMCTXT_CNGTPMODE(x)  \
100         (((x) >> S_CONMCTXT_CNGTPMODE) & M_CONMCTXT_CNGTPMODE)
101 #define S_CONMCTXT_CNGCHMAP             0
102 #define M_CONMCTXT_CNGCHMAP             0xffff
103 #define V_CONMCTXT_CNGCHMAP(x)          ((x) << S_CONMCTXT_CNGCHMAP)
104 #define G_CONMCTXT_CNGCHMAP(x)   \
105         (((x) >> S_CONMCTXT_CNGCHMAP) & M_CONMCTXT_CNGCHMAP)
106
107 #define X_CONMCTXT_CNGTPMODE_QUEUE      1
108 #define X_CONMCTXT_CNGTPMODE_CHANNEL    2
109
110 /*
111  * T5 and later support a new BAR2-based doorbell mechanism for Egress Queues.
112  * The User Doorbells are each 128 bytes in length with a Simple Doorbell at
113  * offsets 8x and a Write Combining single 64-byte Egress Queue Unit
114  * (X_IDXSIZE_UNIT) Gather Buffer interface at offset 64.  For Ingress Queues,
115  * we have a Going To Sleep register at offsets 8x+4.
116  *
117  * As noted above, we have many instances of the Simple Doorbell and Going To
118  * Sleep registers at offsets 8x and 8x+4, respectively.  We want to use a
119  * non-64-byte aligned offset for the Simple Doorbell in order to attempt to
120  * avoid buffering of the writes to the Simple Doorbell and we want to use a
121  * non-contiguous offset for the Going To Sleep writes in order to avoid
122  * possible combining between them.
123  */
124 #define SGE_UDB_SIZE            128
125 #define SGE_UDB_KDOORBELL       8
126 #define SGE_UDB_GTS             20
127
128 /*
129  * CIM definitions.
130  * ================
131  */
132
133 /*
134  * CIM register field values.
135  */
136 #define X_MBOWNER_NONE                  0
137 #define X_MBOWNER_FW                    1
138 #define X_MBOWNER_PL                    2
139
140 /*
141  * PCI-E definitions.
142  * ==================
143  */
144 #define X_WINDOW_SHIFT                  10
145 #define X_PCIEOFST_SHIFT                10
146
147 /*
148  * TP definitions.
149  * ===============
150  */
151
152 /*
153  * TP_VLAN_PRI_MAP controls which subset of fields will be present in the
154  * Compressed Filter Tuple for LE filters.  Each bit set in TP_VLAN_PRI_MAP
155  * selects for a particular field being present.  These fields, when present
156  * in the Compressed Filter Tuple, have the following widths in bits.
157  */
158 #define W_FT_FCOE                       1
159 #define W_FT_PORT                       3
160 #define W_FT_VNIC_ID                    17
161 #define W_FT_VLAN                       17
162 #define W_FT_TOS                        8
163 #define W_FT_PROTOCOL                   8
164 #define W_FT_ETHERTYPE                  16
165 #define W_FT_MACMATCH                   9
166 #define W_FT_MPSHITTYPE                 3
167 #define W_FT_FRAGMENTATION              1
168
169 #endif /* __T4_REGS_VALUES_H__ */