bnx2x: Allowing 0 as initial fairness value
[linux-2.6.git] / drivers / net / bnx2x_hsi.h
1 /* bnx2x_hsi.h: Broadcom Everest network driver.
2  *
3  * Copyright (c) 2007-2009 Broadcom Corporation
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation.
8  */
9
10 struct license_key {
11         u32 reserved[6];
12
13 #if defined(__BIG_ENDIAN)
14         u16 max_iscsi_init_conn;
15         u16 max_iscsi_trgt_conn;
16 #elif defined(__LITTLE_ENDIAN)
17         u16 max_iscsi_trgt_conn;
18         u16 max_iscsi_init_conn;
19 #endif
20
21         u32 reserved_a[6];
22 };
23
24
25 #define PORT_0                          0
26 #define PORT_1                          1
27 #define PORT_MAX                        2
28
29 /****************************************************************************
30  * Shared HW configuration                                                  *
31  ****************************************************************************/
32 struct shared_hw_cfg {                                   /* NVRAM Offset */
33         /* Up to 16 bytes of NULL-terminated string */
34         u8  part_num[16];                                       /* 0x104 */
35
36         u32 config;                                             /* 0x114 */
37 #define SHARED_HW_CFG_MDIO_VOLTAGE_MASK             0x00000001
38 #define SHARED_HW_CFG_MDIO_VOLTAGE_SHIFT            0
39 #define SHARED_HW_CFG_MDIO_VOLTAGE_1_2V             0x00000000
40 #define SHARED_HW_CFG_MDIO_VOLTAGE_2_5V             0x00000001
41 #define SHARED_HW_CFG_MCP_RST_ON_CORE_RST_EN        0x00000002
42
43 #define SHARED_HW_CFG_PORT_SWAP                     0x00000004
44
45 #define SHARED_HW_CFG_BEACON_WOL_EN                 0x00000008
46
47 #define SHARED_HW_CFG_MFW_SELECT_MASK               0x00000700
48 #define SHARED_HW_CFG_MFW_SELECT_SHIFT              8
49         /* Whatever MFW found in NVM
50            (if multiple found, priority order is: NC-SI, UMP, IPMI) */
51 #define SHARED_HW_CFG_MFW_SELECT_DEFAULT            0x00000000
52 #define SHARED_HW_CFG_MFW_SELECT_NC_SI              0x00000100
53 #define SHARED_HW_CFG_MFW_SELECT_UMP                0x00000200
54 #define SHARED_HW_CFG_MFW_SELECT_IPMI               0x00000300
55         /* Use SPIO4 as an arbiter between: 0-NC_SI, 1-IPMI
56           (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
57 #define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_IPMI   0x00000400
58         /* Use SPIO4 as an arbiter between: 0-UMP, 1-IPMI
59           (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
60 #define SHARED_HW_CFG_MFW_SELECT_SPIO4_UMP_IPMI     0x00000500
61         /* Use SPIO4 as an arbiter between: 0-NC-SI, 1-UMP
62           (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
63 #define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_UMP    0x00000600
64
65 #define SHARED_HW_CFG_LED_MODE_MASK                 0x000f0000
66 #define SHARED_HW_CFG_LED_MODE_SHIFT                16
67 #define SHARED_HW_CFG_LED_MAC1                      0x00000000
68 #define SHARED_HW_CFG_LED_PHY1                      0x00010000
69 #define SHARED_HW_CFG_LED_PHY2                      0x00020000
70 #define SHARED_HW_CFG_LED_PHY3                      0x00030000
71 #define SHARED_HW_CFG_LED_MAC2                      0x00040000
72 #define SHARED_HW_CFG_LED_PHY4                      0x00050000
73 #define SHARED_HW_CFG_LED_PHY5                      0x00060000
74 #define SHARED_HW_CFG_LED_PHY6                      0x00070000
75 #define SHARED_HW_CFG_LED_MAC3                      0x00080000
76 #define SHARED_HW_CFG_LED_PHY7                      0x00090000
77 #define SHARED_HW_CFG_LED_PHY9                      0x000a0000
78 #define SHARED_HW_CFG_LED_PHY11                     0x000b0000
79 #define SHARED_HW_CFG_LED_MAC4                      0x000c0000
80 #define SHARED_HW_CFG_LED_PHY8                      0x000d0000
81
82 #define SHARED_HW_CFG_AN_ENABLE_MASK                0x3f000000
83 #define SHARED_HW_CFG_AN_ENABLE_SHIFT               24
84 #define SHARED_HW_CFG_AN_ENABLE_CL37                0x01000000
85 #define SHARED_HW_CFG_AN_ENABLE_CL73                0x02000000
86 #define SHARED_HW_CFG_AN_ENABLE_BAM                 0x04000000
87 #define SHARED_HW_CFG_AN_ENABLE_PARALLEL_DETECTION  0x08000000
88 #define SHARED_HW_CFG_AN_EN_SGMII_FIBER_AUTO_DETECT 0x10000000
89 #define SHARED_HW_CFG_AN_ENABLE_REMOTE_PHY          0x20000000
90
91         u32 config2;                                            /* 0x118 */
92         /* one time auto detect grace period (in sec) */
93 #define SHARED_HW_CFG_GRACE_PERIOD_MASK             0x000000ff
94 #define SHARED_HW_CFG_GRACE_PERIOD_SHIFT            0
95
96 #define SHARED_HW_CFG_PCIE_GEN2_ENABLED             0x00000100
97
98         /* The default value for the core clock is 250MHz and it is
99            achieved by setting the clock change to 4 */
100 #define SHARED_HW_CFG_CLOCK_CHANGE_MASK             0x00000e00
101 #define SHARED_HW_CFG_CLOCK_CHANGE_SHIFT            9
102
103 #define SHARED_HW_CFG_SMBUS_TIMING_100KHZ           0x00000000
104 #define SHARED_HW_CFG_SMBUS_TIMING_400KHZ           0x00001000
105
106 #define SHARED_HW_CFG_HIDE_PORT1                    0x00002000
107
108         /*  The fan failure mechanism is usually related to the PHY type
109           since the power consumption of the board is determined by the PHY.
110           Currently, fan is required for most designs with SFX7101, BCM8727
111           and BCM8481. If a fan is not required for a board which uses one
112           of those PHYs, this field should be set to "Disabled". If a fan is
113           required for a different PHY type, this option should be set to
114           "Enabled".
115           The fan failure indication is expected on
116           SPIO5 */
117 #define SHARED_HW_CFG_FAN_FAILURE_MASK                        0x00180000
118 #define SHARED_HW_CFG_FAN_FAILURE_SHIFT                       19
119 #define SHARED_HW_CFG_FAN_FAILURE_PHY_TYPE                    0x00000000
120 #define SHARED_HW_CFG_FAN_FAILURE_DISABLED                    0x00080000
121 #define SHARED_HW_CFG_FAN_FAILURE_ENABLED                     0x00100000
122
123         u32 power_dissipated;                                   /* 0x11c */
124 #define SHARED_HW_CFG_POWER_DIS_CMN_MASK            0xff000000
125 #define SHARED_HW_CFG_POWER_DIS_CMN_SHIFT           24
126
127 #define SHARED_HW_CFG_POWER_MGNT_SCALE_MASK         0x00ff0000
128 #define SHARED_HW_CFG_POWER_MGNT_SCALE_SHIFT        16
129 #define SHARED_HW_CFG_POWER_MGNT_UNKNOWN_SCALE      0x00000000
130 #define SHARED_HW_CFG_POWER_MGNT_DOT_1_WATT         0x00010000
131 #define SHARED_HW_CFG_POWER_MGNT_DOT_01_WATT        0x00020000
132 #define SHARED_HW_CFG_POWER_MGNT_DOT_001_WATT       0x00030000
133
134         u32 ump_nc_si_config;                                   /* 0x120 */
135 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MASK       0x00000003
136 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_SHIFT      0
137 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MAC        0x00000000
138 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_PHY        0x00000001
139 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MII        0x00000000
140 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_RMII       0x00000002
141
142 #define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_MASK       0x00000f00
143 #define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_SHIFT      8
144
145 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_MASK   0x00ff0000
146 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_SHIFT  16
147 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_NONE   0x00000000
148 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_BCM5221 0x00010000
149
150         u32 board;                                              /* 0x124 */
151 #define SHARED_HW_CFG_BOARD_REV_MASK                0x00FF0000
152 #define SHARED_HW_CFG_BOARD_REV_SHIFT               16
153
154 #define SHARED_HW_CFG_BOARD_MAJOR_VER_MASK          0x0F000000
155 #define SHARED_HW_CFG_BOARD_MAJOR_VER_SHIFT         24
156
157 #define SHARED_HW_CFG_BOARD_MINOR_VER_MASK          0xF0000000
158 #define SHARED_HW_CFG_BOARD_MINOR_VER_SHIFT         28
159
160         u32 reserved;                                           /* 0x128 */
161
162 };
163
164
165 /****************************************************************************
166  * Port HW configuration                                                    *
167  ****************************************************************************/
168 struct port_hw_cfg {                        /* port 0: 0x12c  port 1: 0x2bc */
169
170         u32 pci_id;
171 #define PORT_HW_CFG_PCI_VENDOR_ID_MASK              0xffff0000
172 #define PORT_HW_CFG_PCI_DEVICE_ID_MASK              0x0000ffff
173
174         u32 pci_sub_id;
175 #define PORT_HW_CFG_PCI_SUBSYS_DEVICE_ID_MASK       0xffff0000
176 #define PORT_HW_CFG_PCI_SUBSYS_VENDOR_ID_MASK       0x0000ffff
177
178         u32 power_dissipated;
179 #define PORT_HW_CFG_POWER_DIS_D3_MASK               0xff000000
180 #define PORT_HW_CFG_POWER_DIS_D3_SHIFT              24
181 #define PORT_HW_CFG_POWER_DIS_D2_MASK               0x00ff0000
182 #define PORT_HW_CFG_POWER_DIS_D2_SHIFT              16
183 #define PORT_HW_CFG_POWER_DIS_D1_MASK               0x0000ff00
184 #define PORT_HW_CFG_POWER_DIS_D1_SHIFT              8
185 #define PORT_HW_CFG_POWER_DIS_D0_MASK               0x000000ff
186 #define PORT_HW_CFG_POWER_DIS_D0_SHIFT              0
187
188         u32 power_consumed;
189 #define PORT_HW_CFG_POWER_CONS_D3_MASK              0xff000000
190 #define PORT_HW_CFG_POWER_CONS_D3_SHIFT             24
191 #define PORT_HW_CFG_POWER_CONS_D2_MASK              0x00ff0000
192 #define PORT_HW_CFG_POWER_CONS_D2_SHIFT             16
193 #define PORT_HW_CFG_POWER_CONS_D1_MASK              0x0000ff00
194 #define PORT_HW_CFG_POWER_CONS_D1_SHIFT             8
195 #define PORT_HW_CFG_POWER_CONS_D0_MASK              0x000000ff
196 #define PORT_HW_CFG_POWER_CONS_D0_SHIFT             0
197
198         u32 mac_upper;
199 #define PORT_HW_CFG_UPPERMAC_MASK                   0x0000ffff
200 #define PORT_HW_CFG_UPPERMAC_SHIFT                  0
201         u32 mac_lower;
202
203         u32 iscsi_mac_upper;  /* Upper 16 bits are always zeroes */
204         u32 iscsi_mac_lower;
205
206         u32 rdma_mac_upper;   /* Upper 16 bits are always zeroes */
207         u32 rdma_mac_lower;
208
209         u32 serdes_config;
210 #define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_MASK           0x0000FFFF
211 #define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_SHIFT          0
212
213 #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_MASK              0xFFFF0000
214 #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT             16
215
216
217         u32 Reserved0[16];                                  /* 0x158 */
218
219         /*  for external PHY, or forced mode or during AN */
220         u16 xgxs_config_rx[4];                              /* 0x198 */
221
222         u16 xgxs_config_tx[4];                              /* 0x1A0 */
223
224         u32 Reserved1[64];                                  /* 0x1A8 */
225
226         u32 lane_config;
227 #define PORT_HW_CFG_LANE_SWAP_CFG_MASK              0x0000ffff
228 #define PORT_HW_CFG_LANE_SWAP_CFG_SHIFT             0
229 #define PORT_HW_CFG_LANE_SWAP_CFG_TX_MASK           0x000000ff
230 #define PORT_HW_CFG_LANE_SWAP_CFG_TX_SHIFT          0
231 #define PORT_HW_CFG_LANE_SWAP_CFG_RX_MASK           0x0000ff00
232 #define PORT_HW_CFG_LANE_SWAP_CFG_RX_SHIFT          8
233 #define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK       0x0000c000
234 #define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT      14
235         /* AN and forced */
236 #define PORT_HW_CFG_LANE_SWAP_CFG_01230123          0x00001b1b
237         /* forced only */
238 #define PORT_HW_CFG_LANE_SWAP_CFG_01233210          0x00001be4
239         /* forced only */
240 #define PORT_HW_CFG_LANE_SWAP_CFG_31203120          0x0000d8d8
241         /* forced only */
242 #define PORT_HW_CFG_LANE_SWAP_CFG_32103210          0x0000e4e4
243
244         u32 external_phy_config;
245 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK        0xff000000
246 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_SHIFT       24
247 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT      0x00000000
248 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482     0x01000000
249 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_NOT_CONN    0xff000000
250
251 #define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_MASK        0x00ff0000
252 #define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_SHIFT       16
253
254 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK          0x0000ff00
255 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SHIFT         8
256 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT        0x00000000
257 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8071       0x00000100
258 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072       0x00000200
259 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073       0x00000300
260 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705       0x00000400
261 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706       0x00000500
262 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726       0x00000600
263 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481       0x00000700
264 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101       0x00000800
265 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727       0x00000900
266 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC   0x00000a00
267 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE       0x0000fd00
268 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN      0x0000ff00
269
270 #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK          0x000000ff
271 #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT         0
272
273         u32 speed_capability_mask;
274 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_MASK        0xffff0000
275 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_SHIFT       16
276 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL    0x00010000
277 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF    0x00020000
278 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF   0x00040000
279 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL   0x00080000
280 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_1G          0x00100000
281 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G        0x00200000
282 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10G         0x00400000
283 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_12G         0x00800000
284 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_12_5G       0x01000000
285 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_13G         0x02000000
286 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_15G         0x04000000
287 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_16G         0x08000000
288 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_RESERVED    0xf0000000
289
290 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_MASK        0x0000ffff
291 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_SHIFT       0
292 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_FULL    0x00000001
293 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_HALF    0x00000002
294 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_HALF   0x00000004
295 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_FULL   0x00000008
296 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_1G          0x00000010
297 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_2_5G        0x00000020
298 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10G         0x00000040
299 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_12G         0x00000080
300 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_12_5G       0x00000100
301 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_13G         0x00000200
302 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_15G         0x00000400
303 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_16G         0x00000800
304 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_RESERVED    0x0000f000
305
306         u32 reserved[2];
307
308 };
309
310
311 /****************************************************************************
312  * Shared Feature configuration                                             *
313  ****************************************************************************/
314 struct shared_feat_cfg {                                 /* NVRAM Offset */
315
316         u32 config;                                             /* 0x450 */
317 #define SHARED_FEATURE_BMC_ECHO_MODE_EN             0x00000001
318
319         /*  Use the values from options 47 and 48 instead of the HW default
320           values */
321 #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_DISABLED     0x00000000
322 #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_ENABLED      0x00000002
323
324 #define SHARED_FEATURE_MF_MODE_DISABLED             0x00000100
325
326 };
327
328
329 /****************************************************************************
330  * Port Feature configuration                                               *
331  ****************************************************************************/
332 struct port_feat_cfg {                      /* port 0: 0x454  port 1: 0x4c8 */
333
334         u32 config;
335 #define PORT_FEATURE_BAR1_SIZE_MASK                 0x0000000f
336 #define PORT_FEATURE_BAR1_SIZE_SHIFT                0
337 #define PORT_FEATURE_BAR1_SIZE_DISABLED             0x00000000
338 #define PORT_FEATURE_BAR1_SIZE_64K                  0x00000001
339 #define PORT_FEATURE_BAR1_SIZE_128K                 0x00000002
340 #define PORT_FEATURE_BAR1_SIZE_256K                 0x00000003
341 #define PORT_FEATURE_BAR1_SIZE_512K                 0x00000004
342 #define PORT_FEATURE_BAR1_SIZE_1M                   0x00000005
343 #define PORT_FEATURE_BAR1_SIZE_2M                   0x00000006
344 #define PORT_FEATURE_BAR1_SIZE_4M                   0x00000007
345 #define PORT_FEATURE_BAR1_SIZE_8M                   0x00000008
346 #define PORT_FEATURE_BAR1_SIZE_16M                  0x00000009
347 #define PORT_FEATURE_BAR1_SIZE_32M                  0x0000000a
348 #define PORT_FEATURE_BAR1_SIZE_64M                  0x0000000b
349 #define PORT_FEATURE_BAR1_SIZE_128M                 0x0000000c
350 #define PORT_FEATURE_BAR1_SIZE_256M                 0x0000000d
351 #define PORT_FEATURE_BAR1_SIZE_512M                 0x0000000e
352 #define PORT_FEATURE_BAR1_SIZE_1G                   0x0000000f
353 #define PORT_FEATURE_BAR2_SIZE_MASK                 0x000000f0
354 #define PORT_FEATURE_BAR2_SIZE_SHIFT                4
355 #define PORT_FEATURE_BAR2_SIZE_DISABLED             0x00000000
356 #define PORT_FEATURE_BAR2_SIZE_64K                  0x00000010
357 #define PORT_FEATURE_BAR2_SIZE_128K                 0x00000020
358 #define PORT_FEATURE_BAR2_SIZE_256K                 0x00000030
359 #define PORT_FEATURE_BAR2_SIZE_512K                 0x00000040
360 #define PORT_FEATURE_BAR2_SIZE_1M                   0x00000050
361 #define PORT_FEATURE_BAR2_SIZE_2M                   0x00000060
362 #define PORT_FEATURE_BAR2_SIZE_4M                   0x00000070
363 #define PORT_FEATURE_BAR2_SIZE_8M                   0x00000080
364 #define PORT_FEATURE_BAR2_SIZE_16M                  0x00000090
365 #define PORT_FEATURE_BAR2_SIZE_32M                  0x000000a0
366 #define PORT_FEATURE_BAR2_SIZE_64M                  0x000000b0
367 #define PORT_FEATURE_BAR2_SIZE_128M                 0x000000c0
368 #define PORT_FEATURE_BAR2_SIZE_256M                 0x000000d0
369 #define PORT_FEATURE_BAR2_SIZE_512M                 0x000000e0
370 #define PORT_FEATURE_BAR2_SIZE_1G                   0x000000f0
371 #define PORT_FEATURE_EN_SIZE_MASK                   0x07000000
372 #define PORT_FEATURE_EN_SIZE_SHIFT                  24
373 #define PORT_FEATURE_WOL_ENABLED                    0x01000000
374 #define PORT_FEATURE_MBA_ENABLED                    0x02000000
375 #define PORT_FEATURE_MFW_ENABLED                    0x04000000
376
377         /* Reserved bits: 28-29 */
378         /*  Check the optic vendor via i2c against a list of approved modules
379           in a separate nvram image */
380 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK                   0xE0000000
381 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_SHIFT                  29
382 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_NO_ENFORCEMENT         0x00000000
383 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER       0x20000000
384 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG            0x40000000
385 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_POWER_DOWN             0x60000000
386
387
388         u32 wol_config;
389         /* Default is used when driver sets to "auto" mode */
390 #define PORT_FEATURE_WOL_DEFAULT_MASK               0x00000003
391 #define PORT_FEATURE_WOL_DEFAULT_SHIFT              0
392 #define PORT_FEATURE_WOL_DEFAULT_DISABLE            0x00000000
393 #define PORT_FEATURE_WOL_DEFAULT_MAGIC              0x00000001
394 #define PORT_FEATURE_WOL_DEFAULT_ACPI               0x00000002
395 #define PORT_FEATURE_WOL_DEFAULT_MAGIC_AND_ACPI     0x00000003
396 #define PORT_FEATURE_WOL_RES_PAUSE_CAP              0x00000004
397 #define PORT_FEATURE_WOL_RES_ASYM_PAUSE_CAP         0x00000008
398 #define PORT_FEATURE_WOL_ACPI_UPON_MGMT             0x00000010
399
400         u32 mba_config;
401 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK       0x00000003
402 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_SHIFT      0
403 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_PXE        0x00000000
404 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_RPL        0x00000001
405 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_BOOTP      0x00000002
406 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_ISCSIB     0x00000003
407 #define PORT_FEATURE_MBA_RES_PAUSE_CAP              0x00000100
408 #define PORT_FEATURE_MBA_RES_ASYM_PAUSE_CAP         0x00000200
409 #define PORT_FEATURE_MBA_SETUP_PROMPT_ENABLE        0x00000400
410 #define PORT_FEATURE_MBA_HOTKEY_CTRL_S              0x00000000
411 #define PORT_FEATURE_MBA_HOTKEY_CTRL_B              0x00000800
412 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_MASK          0x000ff000
413 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_SHIFT         12
414 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_DISABLED      0x00000000
415 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_2K            0x00001000
416 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_4K            0x00002000
417 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_8K            0x00003000
418 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_16K           0x00004000
419 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_32K           0x00005000
420 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_64K           0x00006000
421 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_128K          0x00007000
422 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_256K          0x00008000
423 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_512K          0x00009000
424 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_1M            0x0000a000
425 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_2M            0x0000b000
426 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_4M            0x0000c000
427 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_8M            0x0000d000
428 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_16M           0x0000e000
429 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_32M           0x0000f000
430 #define PORT_FEATURE_MBA_MSG_TIMEOUT_MASK           0x00f00000
431 #define PORT_FEATURE_MBA_MSG_TIMEOUT_SHIFT          20
432 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_MASK        0x03000000
433 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_SHIFT       24
434 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_AUTO        0x00000000
435 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_BBS         0x01000000
436 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT18H      0x02000000
437 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT19H      0x03000000
438 #define PORT_FEATURE_MBA_LINK_SPEED_MASK            0x3c000000
439 #define PORT_FEATURE_MBA_LINK_SPEED_SHIFT           26
440 #define PORT_FEATURE_MBA_LINK_SPEED_AUTO            0x00000000
441 #define PORT_FEATURE_MBA_LINK_SPEED_10HD            0x04000000
442 #define PORT_FEATURE_MBA_LINK_SPEED_10FD            0x08000000
443 #define PORT_FEATURE_MBA_LINK_SPEED_100HD           0x0c000000
444 #define PORT_FEATURE_MBA_LINK_SPEED_100FD           0x10000000
445 #define PORT_FEATURE_MBA_LINK_SPEED_1GBPS           0x14000000
446 #define PORT_FEATURE_MBA_LINK_SPEED_2_5GBPS         0x18000000
447 #define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_CX4      0x1c000000
448 #define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_KX4      0x20000000
449 #define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_KR       0x24000000
450 #define PORT_FEATURE_MBA_LINK_SPEED_12GBPS          0x28000000
451 #define PORT_FEATURE_MBA_LINK_SPEED_12_5GBPS        0x2c000000
452 #define PORT_FEATURE_MBA_LINK_SPEED_13GBPS          0x30000000
453 #define PORT_FEATURE_MBA_LINK_SPEED_15GBPS          0x34000000
454 #define PORT_FEATURE_MBA_LINK_SPEED_16GBPS          0x38000000
455
456         u32 bmc_config;
457 #define PORT_FEATURE_BMC_LINK_OVERRIDE_DEFAULT      0x00000000
458 #define PORT_FEATURE_BMC_LINK_OVERRIDE_EN           0x00000001
459
460         u32 mba_vlan_cfg;
461 #define PORT_FEATURE_MBA_VLAN_TAG_MASK              0x0000ffff
462 #define PORT_FEATURE_MBA_VLAN_TAG_SHIFT             0
463 #define PORT_FEATURE_MBA_VLAN_EN                    0x00010000
464
465         u32 resource_cfg;
466 #define PORT_FEATURE_RESOURCE_CFG_VALID             0x00000001
467 #define PORT_FEATURE_RESOURCE_CFG_DIAG              0x00000002
468 #define PORT_FEATURE_RESOURCE_CFG_L2                0x00000004
469 #define PORT_FEATURE_RESOURCE_CFG_ISCSI             0x00000008
470 #define PORT_FEATURE_RESOURCE_CFG_RDMA              0x00000010
471
472         u32 smbus_config;
473         /* Obsolete */
474 #define PORT_FEATURE_SMBUS_EN                       0x00000001
475 #define PORT_FEATURE_SMBUS_ADDR_MASK                0x000000fe
476 #define PORT_FEATURE_SMBUS_ADDR_SHIFT               1
477
478         u32 reserved1;
479
480         u32 link_config;    /* Used as HW defaults for the driver */
481 #define PORT_FEATURE_CONNECTED_SWITCH_MASK          0x03000000
482 #define PORT_FEATURE_CONNECTED_SWITCH_SHIFT         24
483         /* (forced) low speed switch (< 10G) */
484 #define PORT_FEATURE_CON_SWITCH_1G_SWITCH           0x00000000
485         /* (forced) high speed switch (>= 10G) */
486 #define PORT_FEATURE_CON_SWITCH_10G_SWITCH          0x01000000
487 #define PORT_FEATURE_CON_SWITCH_AUTO_DETECT         0x02000000
488 #define PORT_FEATURE_CON_SWITCH_ONE_TIME_DETECT     0x03000000
489
490 #define PORT_FEATURE_LINK_SPEED_MASK                0x000f0000
491 #define PORT_FEATURE_LINK_SPEED_SHIFT               16
492 #define PORT_FEATURE_LINK_SPEED_AUTO                0x00000000
493 #define PORT_FEATURE_LINK_SPEED_10M_FULL            0x00010000
494 #define PORT_FEATURE_LINK_SPEED_10M_HALF            0x00020000
495 #define PORT_FEATURE_LINK_SPEED_100M_HALF           0x00030000
496 #define PORT_FEATURE_LINK_SPEED_100M_FULL           0x00040000
497 #define PORT_FEATURE_LINK_SPEED_1G                  0x00050000
498 #define PORT_FEATURE_LINK_SPEED_2_5G                0x00060000
499 #define PORT_FEATURE_LINK_SPEED_10G_CX4             0x00070000
500 #define PORT_FEATURE_LINK_SPEED_10G_KX4             0x00080000
501 #define PORT_FEATURE_LINK_SPEED_10G_KR              0x00090000
502 #define PORT_FEATURE_LINK_SPEED_12G                 0x000a0000
503 #define PORT_FEATURE_LINK_SPEED_12_5G               0x000b0000
504 #define PORT_FEATURE_LINK_SPEED_13G                 0x000c0000
505 #define PORT_FEATURE_LINK_SPEED_15G                 0x000d0000
506 #define PORT_FEATURE_LINK_SPEED_16G                 0x000e0000
507
508 #define PORT_FEATURE_FLOW_CONTROL_MASK              0x00000700
509 #define PORT_FEATURE_FLOW_CONTROL_SHIFT             8
510 #define PORT_FEATURE_FLOW_CONTROL_AUTO              0x00000000
511 #define PORT_FEATURE_FLOW_CONTROL_TX                0x00000100
512 #define PORT_FEATURE_FLOW_CONTROL_RX                0x00000200
513 #define PORT_FEATURE_FLOW_CONTROL_BOTH              0x00000300
514 #define PORT_FEATURE_FLOW_CONTROL_NONE              0x00000400
515
516         /* The default for MCP link configuration,
517            uses the same defines as link_config */
518         u32 mfw_wol_link_cfg;
519
520         u32 reserved[19];
521
522 };
523
524
525 /****************************************************************************
526  * Device Information                                                       *
527  ****************************************************************************/
528 struct shm_dev_info {                                               /* size */
529
530         u32    bc_rev; /* 8 bits each: major, minor, build */          /* 4 */
531
532         struct shared_hw_cfg     shared_hw_config;                    /* 40 */
533
534         struct port_hw_cfg       port_hw_config[PORT_MAX];     /* 400*2=800 */
535
536         struct shared_feat_cfg   shared_feature_config;                /* 4 */
537
538         struct port_feat_cfg     port_feature_config[PORT_MAX];/* 116*2=232 */
539
540 };
541
542
543 #define FUNC_0                          0
544 #define FUNC_1                          1
545 #define FUNC_2                          2
546 #define FUNC_3                          3
547 #define FUNC_4                          4
548 #define FUNC_5                          5
549 #define FUNC_6                          6
550 #define FUNC_7                          7
551 #define E1_FUNC_MAX                     2
552 #define E1H_FUNC_MAX                    8
553
554 #define VN_0                            0
555 #define VN_1                            1
556 #define VN_2                            2
557 #define VN_3                            3
558 #define E1VN_MAX                        1
559 #define E1HVN_MAX                       4
560
561
562 /* This value (in milliseconds) determines the frequency of the driver
563  * issuing the PULSE message code.  The firmware monitors this periodic
564  * pulse to determine when to switch to an OS-absent mode. */
565 #define DRV_PULSE_PERIOD_MS             250
566
567 /* This value (in milliseconds) determines how long the driver should
568  * wait for an acknowledgement from the firmware before timing out.  Once
569  * the firmware has timed out, the driver will assume there is no firmware
570  * running and there won't be any firmware-driver synchronization during a
571  * driver reset. */
572 #define FW_ACK_TIME_OUT_MS              5000
573
574 #define FW_ACK_POLL_TIME_MS             1
575
576 #define FW_ACK_NUM_OF_POLL      (FW_ACK_TIME_OUT_MS/FW_ACK_POLL_TIME_MS)
577
578 /* LED Blink rate that will achieve ~15.9Hz */
579 #define LED_BLINK_RATE_VAL              480
580
581 /****************************************************************************
582  * Driver <-> FW Mailbox                                                    *
583  ****************************************************************************/
584 struct drv_port_mb {
585
586         u32 link_status;
587         /* Driver should update this field on any link change event */
588
589 #define LINK_STATUS_LINK_FLAG_MASK                      0x00000001
590 #define LINK_STATUS_LINK_UP                             0x00000001
591 #define LINK_STATUS_SPEED_AND_DUPLEX_MASK               0x0000001E
592 #define LINK_STATUS_SPEED_AND_DUPLEX_AN_NOT_COMPLETE    (0<<1)
593 #define LINK_STATUS_SPEED_AND_DUPLEX_10THD              (1<<1)
594 #define LINK_STATUS_SPEED_AND_DUPLEX_10TFD              (2<<1)
595 #define LINK_STATUS_SPEED_AND_DUPLEX_100TXHD            (3<<1)
596 #define LINK_STATUS_SPEED_AND_DUPLEX_100T4              (4<<1)
597 #define LINK_STATUS_SPEED_AND_DUPLEX_100TXFD            (5<<1)
598 #define LINK_STATUS_SPEED_AND_DUPLEX_1000THD            (6<<1)
599 #define LINK_STATUS_SPEED_AND_DUPLEX_1000TFD            (7<<1)
600 #define LINK_STATUS_SPEED_AND_DUPLEX_1000XFD            (7<<1)
601 #define LINK_STATUS_SPEED_AND_DUPLEX_2500THD            (8<<1)
602 #define LINK_STATUS_SPEED_AND_DUPLEX_2500TFD            (9<<1)
603 #define LINK_STATUS_SPEED_AND_DUPLEX_2500XFD            (9<<1)
604 #define LINK_STATUS_SPEED_AND_DUPLEX_10GTFD             (10<<1)
605 #define LINK_STATUS_SPEED_AND_DUPLEX_10GXFD             (10<<1)
606 #define LINK_STATUS_SPEED_AND_DUPLEX_12GTFD             (11<<1)
607 #define LINK_STATUS_SPEED_AND_DUPLEX_12GXFD             (11<<1)
608 #define LINK_STATUS_SPEED_AND_DUPLEX_12_5GTFD           (12<<1)
609 #define LINK_STATUS_SPEED_AND_DUPLEX_12_5GXFD           (12<<1)
610 #define LINK_STATUS_SPEED_AND_DUPLEX_13GTFD             (13<<1)
611 #define LINK_STATUS_SPEED_AND_DUPLEX_13GXFD             (13<<1)
612 #define LINK_STATUS_SPEED_AND_DUPLEX_15GTFD             (14<<1)
613 #define LINK_STATUS_SPEED_AND_DUPLEX_15GXFD             (14<<1)
614 #define LINK_STATUS_SPEED_AND_DUPLEX_16GTFD             (15<<1)
615 #define LINK_STATUS_SPEED_AND_DUPLEX_16GXFD             (15<<1)
616
617 #define LINK_STATUS_AUTO_NEGOTIATE_FLAG_MASK            0x00000020
618 #define LINK_STATUS_AUTO_NEGOTIATE_ENABLED              0x00000020
619
620 #define LINK_STATUS_AUTO_NEGOTIATE_COMPLETE             0x00000040
621 #define LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK        0x00000080
622 #define LINK_STATUS_PARALLEL_DETECTION_USED             0x00000080
623
624 #define LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE        0x00000200
625 #define LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE        0x00000400
626 #define LINK_STATUS_LINK_PARTNER_100T4_CAPABLE          0x00000800
627 #define LINK_STATUS_LINK_PARTNER_100TXFD_CAPABLE        0x00001000
628 #define LINK_STATUS_LINK_PARTNER_100TXHD_CAPABLE        0x00002000
629 #define LINK_STATUS_LINK_PARTNER_10TFD_CAPABLE          0x00004000
630 #define LINK_STATUS_LINK_PARTNER_10THD_CAPABLE          0x00008000
631
632 #define LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK           0x00010000
633 #define LINK_STATUS_TX_FLOW_CONTROL_ENABLED             0x00010000
634
635 #define LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK           0x00020000
636 #define LINK_STATUS_RX_FLOW_CONTROL_ENABLED             0x00020000
637
638 #define LINK_STATUS_LINK_PARTNER_FLOW_CONTROL_MASK      0x000C0000
639 #define LINK_STATUS_LINK_PARTNER_NOT_PAUSE_CAPABLE      (0<<18)
640 #define LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE        (1<<18)
641 #define LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE       (2<<18)
642 #define LINK_STATUS_LINK_PARTNER_BOTH_PAUSE             (3<<18)
643
644 #define LINK_STATUS_SERDES_LINK                         0x00100000
645
646 #define LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE        0x00200000
647 #define LINK_STATUS_LINK_PARTNER_2500XHD_CAPABLE        0x00400000
648 #define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE         0x00800000
649 #define LINK_STATUS_LINK_PARTNER_12GXFD_CAPABLE         0x01000000
650 #define LINK_STATUS_LINK_PARTNER_12_5GXFD_CAPABLE       0x02000000
651 #define LINK_STATUS_LINK_PARTNER_13GXFD_CAPABLE         0x04000000
652 #define LINK_STATUS_LINK_PARTNER_15GXFD_CAPABLE         0x08000000
653 #define LINK_STATUS_LINK_PARTNER_16GXFD_CAPABLE         0x10000000
654
655         u32 port_stx;
656
657         u32 stat_nig_timer;
658
659         /* MCP firmware does not use this field */
660         u32 ext_phy_fw_version;
661
662 };
663
664
665 struct drv_func_mb {
666
667         u32 drv_mb_header;
668 #define DRV_MSG_CODE_MASK                               0xffff0000
669 #define DRV_MSG_CODE_LOAD_REQ                           0x10000000
670 #define DRV_MSG_CODE_LOAD_DONE                          0x11000000
671 #define DRV_MSG_CODE_UNLOAD_REQ_WOL_EN                  0x20000000
672 #define DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS                 0x20010000
673 #define DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP                 0x20020000
674 #define DRV_MSG_CODE_UNLOAD_DONE                        0x21000000
675 #define DRV_MSG_CODE_DCC_OK                             0x30000000
676 #define DRV_MSG_CODE_DCC_FAILURE                        0x31000000
677 #define DRV_MSG_CODE_DIAG_ENTER_REQ                     0x50000000
678 #define DRV_MSG_CODE_DIAG_EXIT_REQ                      0x60000000
679 #define DRV_MSG_CODE_VALIDATE_KEY                       0x70000000
680 #define DRV_MSG_CODE_GET_CURR_KEY                       0x80000000
681 #define DRV_MSG_CODE_GET_UPGRADE_KEY                    0x81000000
682 #define DRV_MSG_CODE_GET_MANUF_KEY                      0x82000000
683 #define DRV_MSG_CODE_LOAD_L2B_PRAM                      0x90000000
684         /*
685          * The optic module verification commands requris bootcode
686          * v5.0.6 or later
687          */
688 #define DRV_MSG_CODE_VRFY_OPT_MDL                       0xa0000000
689 #define REQ_BC_VER_4_VRFY_OPT_MDL                       0x00050006
690
691 #define BIOS_MSG_CODE_LIC_CHALLENGE                     0xff010000
692 #define BIOS_MSG_CODE_LIC_RESPONSE                      0xff020000
693 #define BIOS_MSG_CODE_VIRT_MAC_PRIM                     0xff030000
694 #define BIOS_MSG_CODE_VIRT_MAC_ISCSI                    0xff040000
695
696 #define DRV_MSG_SEQ_NUMBER_MASK                         0x0000ffff
697
698         u32 drv_mb_param;
699
700         u32 fw_mb_header;
701 #define FW_MSG_CODE_MASK                                0xffff0000
702 #define FW_MSG_CODE_DRV_LOAD_COMMON                     0x10100000
703 #define FW_MSG_CODE_DRV_LOAD_PORT                       0x10110000
704 #define FW_MSG_CODE_DRV_LOAD_FUNCTION                   0x10120000
705 #define FW_MSG_CODE_DRV_LOAD_REFUSED                    0x10200000
706 #define FW_MSG_CODE_DRV_LOAD_DONE                       0x11100000
707 #define FW_MSG_CODE_DRV_UNLOAD_COMMON                   0x20100000
708 #define FW_MSG_CODE_DRV_UNLOAD_PORT                     0x20110000
709 #define FW_MSG_CODE_DRV_UNLOAD_FUNCTION                 0x20120000
710 #define FW_MSG_CODE_DRV_UNLOAD_DONE                     0x21100000
711 #define FW_MSG_CODE_DCC_DONE                            0x30100000
712 #define FW_MSG_CODE_DIAG_ENTER_DONE                     0x50100000
713 #define FW_MSG_CODE_DIAG_REFUSE                         0x50200000
714 #define FW_MSG_CODE_DIAG_EXIT_DONE                      0x60100000
715 #define FW_MSG_CODE_VALIDATE_KEY_SUCCESS                0x70100000
716 #define FW_MSG_CODE_VALIDATE_KEY_FAILURE                0x70200000
717 #define FW_MSG_CODE_GET_KEY_DONE                        0x80100000
718 #define FW_MSG_CODE_NO_KEY                              0x80f00000
719 #define FW_MSG_CODE_LIC_INFO_NOT_READY                  0x80f80000
720 #define FW_MSG_CODE_L2B_PRAM_LOADED                     0x90100000
721 #define FW_MSG_CODE_L2B_PRAM_T_LOAD_FAILURE             0x90210000
722 #define FW_MSG_CODE_L2B_PRAM_C_LOAD_FAILURE             0x90220000
723 #define FW_MSG_CODE_L2B_PRAM_X_LOAD_FAILURE             0x90230000
724 #define FW_MSG_CODE_L2B_PRAM_U_LOAD_FAILURE             0x90240000
725 #define FW_MSG_CODE_VRFY_OPT_MDL_SUCCESS                0xa0100000
726 #define FW_MSG_CODE_VRFY_OPT_MDL_INVLD_IMG              0xa0200000
727 #define FW_MSG_CODE_VRFY_OPT_MDL_UNAPPROVED             0xa0300000
728
729 #define FW_MSG_CODE_LIC_CHALLENGE                       0xff010000
730 #define FW_MSG_CODE_LIC_RESPONSE                        0xff020000
731 #define FW_MSG_CODE_VIRT_MAC_PRIM                       0xff030000
732 #define FW_MSG_CODE_VIRT_MAC_ISCSI                      0xff040000
733
734 #define FW_MSG_SEQ_NUMBER_MASK                          0x0000ffff
735
736         u32 fw_mb_param;
737
738         u32 drv_pulse_mb;
739 #define DRV_PULSE_SEQ_MASK                              0x00007fff
740 #define DRV_PULSE_SYSTEM_TIME_MASK                      0xffff0000
741         /* The system time is in the format of
742          * (year-2001)*12*32 + month*32 + day. */
743 #define DRV_PULSE_ALWAYS_ALIVE                          0x00008000
744         /* Indicate to the firmware not to go into the
745          * OS-absent when it is not getting driver pulse.
746          * This is used for debugging as well for PXE(MBA). */
747
748         u32 mcp_pulse_mb;
749 #define MCP_PULSE_SEQ_MASK                              0x00007fff
750 #define MCP_PULSE_ALWAYS_ALIVE                          0x00008000
751         /* Indicates to the driver not to assert due to lack
752          * of MCP response */
753 #define MCP_EVENT_MASK                                  0xffff0000
754 #define MCP_EVENT_OTHER_DRIVER_RESET_REQ                0x00010000
755
756         u32 iscsi_boot_signature;
757         u32 iscsi_boot_block_offset;
758
759         u32 drv_status;
760 #define DRV_STATUS_PMF                                  0x00000001
761
762 #define DRV_STATUS_DCC_EVENT_MASK                       0x0000ff00
763 #define DRV_STATUS_DCC_DISABLE_ENABLE_PF                0x00000100
764 #define DRV_STATUS_DCC_BANDWIDTH_ALLOCATION             0x00000200
765 #define DRV_STATUS_DCC_CHANGE_MAC_ADDRESS               0x00000400
766 #define DRV_STATUS_DCC_RESERVED1                        0x00000800
767 #define DRV_STATUS_DCC_SET_PROTOCOL                     0x00001000
768 #define DRV_STATUS_DCC_SET_PRIORITY                     0x00002000
769
770         u32 virt_mac_upper;
771 #define VIRT_MAC_SIGN_MASK                              0xffff0000
772 #define VIRT_MAC_SIGNATURE                              0x564d0000
773         u32 virt_mac_lower;
774
775 };
776
777
778 /****************************************************************************
779  * Management firmware state                                                *
780  ****************************************************************************/
781 /* Allocate 440 bytes for management firmware */
782 #define MGMTFW_STATE_WORD_SIZE                              110
783
784 struct mgmtfw_state {
785         u32 opaque[MGMTFW_STATE_WORD_SIZE];
786 };
787
788
789 /****************************************************************************
790  * Multi-Function configuration                                             *
791  ****************************************************************************/
792 struct shared_mf_cfg {
793
794         u32 clp_mb;
795 #define SHARED_MF_CLP_SET_DEFAULT                   0x00000000
796         /* set by CLP */
797 #define SHARED_MF_CLP_EXIT                          0x00000001
798         /* set by MCP */
799 #define SHARED_MF_CLP_EXIT_DONE                     0x00010000
800
801 };
802
803 struct port_mf_cfg {
804
805         u32 dynamic_cfg;        /* device control channel */
806 #define PORT_MF_CFG_E1HOV_TAG_MASK                  0x0000ffff
807 #define PORT_MF_CFG_E1HOV_TAG_SHIFT                 0
808 #define PORT_MF_CFG_E1HOV_TAG_DEFAULT               PORT_MF_CFG_E1HOV_TAG_MASK
809
810         u32 reserved[3];
811
812 };
813
814 struct func_mf_cfg {
815
816         u32 config;
817         /* E/R/I/D */
818         /* function 0 of each port cannot be hidden */
819 #define FUNC_MF_CFG_FUNC_HIDE                       0x00000001
820
821 #define FUNC_MF_CFG_PROTOCOL_MASK                   0x00000007
822 #define FUNC_MF_CFG_PROTOCOL_ETHERNET               0x00000002
823 #define FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA     0x00000004
824 #define FUNC_MF_CFG_PROTOCOL_ISCSI                  0x00000006
825 #define FUNC_MF_CFG_PROTOCOL_DEFAULT\
826         FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA
827
828 #define FUNC_MF_CFG_FUNC_DISABLED                   0x00000008
829
830         /* PRI */
831         /* 0 - low priority, 3 - high priority */
832 #define FUNC_MF_CFG_TRANSMIT_PRIORITY_MASK          0x00000300
833 #define FUNC_MF_CFG_TRANSMIT_PRIORITY_SHIFT         8
834 #define FUNC_MF_CFG_TRANSMIT_PRIORITY_DEFAULT       0x00000000
835
836         /* MINBW, MAXBW */
837         /* value range - 0..100, increments in 100Mbps */
838 #define FUNC_MF_CFG_MIN_BW_MASK                     0x00ff0000
839 #define FUNC_MF_CFG_MIN_BW_SHIFT                    16
840 #define FUNC_MF_CFG_MIN_BW_DEFAULT                  0x00000000
841 #define FUNC_MF_CFG_MAX_BW_MASK                     0xff000000
842 #define FUNC_MF_CFG_MAX_BW_SHIFT                    24
843 #define FUNC_MF_CFG_MAX_BW_DEFAULT                  0x64000000
844
845         u32 mac_upper;          /* MAC */
846 #define FUNC_MF_CFG_UPPERMAC_MASK                   0x0000ffff
847 #define FUNC_MF_CFG_UPPERMAC_SHIFT                  0
848 #define FUNC_MF_CFG_UPPERMAC_DEFAULT                FUNC_MF_CFG_UPPERMAC_MASK
849         u32 mac_lower;
850 #define FUNC_MF_CFG_LOWERMAC_DEFAULT                0xffffffff
851
852         u32 e1hov_tag;  /* VNI */
853 #define FUNC_MF_CFG_E1HOV_TAG_MASK                  0x0000ffff
854 #define FUNC_MF_CFG_E1HOV_TAG_SHIFT                 0
855 #define FUNC_MF_CFG_E1HOV_TAG_DEFAULT               FUNC_MF_CFG_E1HOV_TAG_MASK
856
857         u32 reserved[2];
858
859 };
860
861 struct mf_cfg {
862
863         struct shared_mf_cfg    shared_mf_config;
864         struct port_mf_cfg      port_mf_config[PORT_MAX];
865         struct func_mf_cfg      func_mf_config[E1H_FUNC_MAX];
866
867 };
868
869
870 /****************************************************************************
871  * Shared Memory Region                                                     *
872  ****************************************************************************/
873 struct shmem_region {                          /*   SharedMem Offset (size) */
874
875         u32                     validity_map[PORT_MAX];  /* 0x0 (4*2 = 0x8) */
876 #define SHR_MEM_FORMAT_REV_ID                       ('A'<<24)
877 #define SHR_MEM_FORMAT_REV_MASK                     0xff000000
878         /* validity bits */
879 #define SHR_MEM_VALIDITY_PCI_CFG                    0x00100000
880 #define SHR_MEM_VALIDITY_MB                         0x00200000
881 #define SHR_MEM_VALIDITY_DEV_INFO                   0x00400000
882 #define SHR_MEM_VALIDITY_RESERVED                   0x00000007
883         /* One licensing bit should be set */
884 #define SHR_MEM_VALIDITY_LIC_KEY_IN_EFFECT_MASK     0x00000038
885 #define SHR_MEM_VALIDITY_LIC_MANUF_KEY_IN_EFFECT    0x00000008
886 #define SHR_MEM_VALIDITY_LIC_UPGRADE_KEY_IN_EFFECT  0x00000010
887 #define SHR_MEM_VALIDITY_LIC_NO_KEY_IN_EFFECT       0x00000020
888         /* Active MFW */
889 #define SHR_MEM_VALIDITY_ACTIVE_MFW_UNKNOWN         0x00000000
890 #define SHR_MEM_VALIDITY_ACTIVE_MFW_IPMI            0x00000040
891 #define SHR_MEM_VALIDITY_ACTIVE_MFW_UMP             0x00000080
892 #define SHR_MEM_VALIDITY_ACTIVE_MFW_NCSI            0x000000c0
893 #define SHR_MEM_VALIDITY_ACTIVE_MFW_NONE            0x000001c0
894 #define SHR_MEM_VALIDITY_ACTIVE_MFW_MASK            0x000001c0
895
896         struct shm_dev_info     dev_info;                /* 0x8     (0x438) */
897
898         struct license_key      drv_lic_key[PORT_MAX];  /* 0x440 (52*2=0x68) */
899
900         /* FW information (for internal FW use) */
901         u32                     fw_info_fio_offset;    /* 0x4a8       (0x4) */
902         struct mgmtfw_state     mgmtfw_state;          /* 0x4ac     (0x1b8) */
903
904         struct drv_port_mb      port_mb[PORT_MAX];     /* 0x664 (16*2=0x20) */
905         struct drv_func_mb      func_mb[E1H_FUNC_MAX];
906
907         struct mf_cfg           mf_cfg;
908
909 };                                                     /* 0x6dc */
910
911
912 struct shmem2_region {
913
914         u32                     size;
915
916         u32                     dcc_support;
917 #define SHMEM_DCC_SUPPORT_NONE                      0x00000000
918 #define SHMEM_DCC_SUPPORT_DISABLE_ENABLE_PF_TLV     0x00000001
919 #define SHMEM_DCC_SUPPORT_BANDWIDTH_ALLOCATION_TLV  0x00000004
920 #define SHMEM_DCC_SUPPORT_CHANGE_MAC_ADDRESS_TLV    0x00000008
921 #define SHMEM_DCC_SUPPORT_SET_PROTOCOL_TLV          0x00000040
922 #define SHMEM_DCC_SUPPORT_SET_PRIORITY_TLV          0x00000080
923 #define SHMEM_DCC_SUPPORT_DEFAULT                   SHMEM_DCC_SUPPORT_NONE
924
925 };
926
927
928 struct emac_stats {
929     u32     rx_stat_ifhcinoctets;
930     u32     rx_stat_ifhcinbadoctets;
931     u32     rx_stat_etherstatsfragments;
932     u32     rx_stat_ifhcinucastpkts;
933     u32     rx_stat_ifhcinmulticastpkts;
934     u32     rx_stat_ifhcinbroadcastpkts;
935     u32     rx_stat_dot3statsfcserrors;
936     u32     rx_stat_dot3statsalignmenterrors;
937     u32     rx_stat_dot3statscarriersenseerrors;
938     u32     rx_stat_xonpauseframesreceived;
939     u32     rx_stat_xoffpauseframesreceived;
940     u32     rx_stat_maccontrolframesreceived;
941     u32     rx_stat_xoffstateentered;
942     u32     rx_stat_dot3statsframestoolong;
943     u32     rx_stat_etherstatsjabbers;
944     u32     rx_stat_etherstatsundersizepkts;
945     u32     rx_stat_etherstatspkts64octets;
946     u32     rx_stat_etherstatspkts65octetsto127octets;
947     u32     rx_stat_etherstatspkts128octetsto255octets;
948     u32     rx_stat_etherstatspkts256octetsto511octets;
949     u32     rx_stat_etherstatspkts512octetsto1023octets;
950     u32     rx_stat_etherstatspkts1024octetsto1522octets;
951     u32     rx_stat_etherstatspktsover1522octets;
952
953     u32     rx_stat_falsecarriererrors;
954
955     u32     tx_stat_ifhcoutoctets;
956     u32     tx_stat_ifhcoutbadoctets;
957     u32     tx_stat_etherstatscollisions;
958     u32     tx_stat_outxonsent;
959     u32     tx_stat_outxoffsent;
960     u32     tx_stat_flowcontroldone;
961     u32     tx_stat_dot3statssinglecollisionframes;
962     u32     tx_stat_dot3statsmultiplecollisionframes;
963     u32     tx_stat_dot3statsdeferredtransmissions;
964     u32     tx_stat_dot3statsexcessivecollisions;
965     u32     tx_stat_dot3statslatecollisions;
966     u32     tx_stat_ifhcoutucastpkts;
967     u32     tx_stat_ifhcoutmulticastpkts;
968     u32     tx_stat_ifhcoutbroadcastpkts;
969     u32     tx_stat_etherstatspkts64octets;
970     u32     tx_stat_etherstatspkts65octetsto127octets;
971     u32     tx_stat_etherstatspkts128octetsto255octets;
972     u32     tx_stat_etherstatspkts256octetsto511octets;
973     u32     tx_stat_etherstatspkts512octetsto1023octets;
974     u32     tx_stat_etherstatspkts1024octetsto1522octets;
975     u32     tx_stat_etherstatspktsover1522octets;
976     u32     tx_stat_dot3statsinternalmactransmiterrors;
977 };
978
979
980 struct bmac_stats {
981     u32     tx_stat_gtpkt_lo;
982     u32     tx_stat_gtpkt_hi;
983     u32     tx_stat_gtxpf_lo;
984     u32     tx_stat_gtxpf_hi;
985     u32     tx_stat_gtfcs_lo;
986     u32     tx_stat_gtfcs_hi;
987     u32     tx_stat_gtmca_lo;
988     u32     tx_stat_gtmca_hi;
989     u32     tx_stat_gtbca_lo;
990     u32     tx_stat_gtbca_hi;
991     u32     tx_stat_gtfrg_lo;
992     u32     tx_stat_gtfrg_hi;
993     u32     tx_stat_gtovr_lo;
994     u32     tx_stat_gtovr_hi;
995     u32     tx_stat_gt64_lo;
996     u32     tx_stat_gt64_hi;
997     u32     tx_stat_gt127_lo;
998     u32     tx_stat_gt127_hi;
999     u32     tx_stat_gt255_lo;
1000     u32     tx_stat_gt255_hi;
1001     u32     tx_stat_gt511_lo;
1002     u32     tx_stat_gt511_hi;
1003     u32     tx_stat_gt1023_lo;
1004     u32     tx_stat_gt1023_hi;
1005     u32     tx_stat_gt1518_lo;
1006     u32     tx_stat_gt1518_hi;
1007     u32     tx_stat_gt2047_lo;
1008     u32     tx_stat_gt2047_hi;
1009     u32     tx_stat_gt4095_lo;
1010     u32     tx_stat_gt4095_hi;
1011     u32     tx_stat_gt9216_lo;
1012     u32     tx_stat_gt9216_hi;
1013     u32     tx_stat_gt16383_lo;
1014     u32     tx_stat_gt16383_hi;
1015     u32     tx_stat_gtmax_lo;
1016     u32     tx_stat_gtmax_hi;
1017     u32     tx_stat_gtufl_lo;
1018     u32     tx_stat_gtufl_hi;
1019     u32     tx_stat_gterr_lo;
1020     u32     tx_stat_gterr_hi;
1021     u32     tx_stat_gtbyt_lo;
1022     u32     tx_stat_gtbyt_hi;
1023
1024     u32     rx_stat_gr64_lo;
1025     u32     rx_stat_gr64_hi;
1026     u32     rx_stat_gr127_lo;
1027     u32     rx_stat_gr127_hi;
1028     u32     rx_stat_gr255_lo;
1029     u32     rx_stat_gr255_hi;
1030     u32     rx_stat_gr511_lo;
1031     u32     rx_stat_gr511_hi;
1032     u32     rx_stat_gr1023_lo;
1033     u32     rx_stat_gr1023_hi;
1034     u32     rx_stat_gr1518_lo;
1035     u32     rx_stat_gr1518_hi;
1036     u32     rx_stat_gr2047_lo;
1037     u32     rx_stat_gr2047_hi;
1038     u32     rx_stat_gr4095_lo;
1039     u32     rx_stat_gr4095_hi;
1040     u32     rx_stat_gr9216_lo;
1041     u32     rx_stat_gr9216_hi;
1042     u32     rx_stat_gr16383_lo;
1043     u32     rx_stat_gr16383_hi;
1044     u32     rx_stat_grmax_lo;
1045     u32     rx_stat_grmax_hi;
1046     u32     rx_stat_grpkt_lo;
1047     u32     rx_stat_grpkt_hi;
1048     u32     rx_stat_grfcs_lo;
1049     u32     rx_stat_grfcs_hi;
1050     u32     rx_stat_grmca_lo;
1051     u32     rx_stat_grmca_hi;
1052     u32     rx_stat_grbca_lo;
1053     u32     rx_stat_grbca_hi;
1054     u32     rx_stat_grxcf_lo;
1055     u32     rx_stat_grxcf_hi;
1056     u32     rx_stat_grxpf_lo;
1057     u32     rx_stat_grxpf_hi;
1058     u32     rx_stat_grxuo_lo;
1059     u32     rx_stat_grxuo_hi;
1060     u32     rx_stat_grjbr_lo;
1061     u32     rx_stat_grjbr_hi;
1062     u32     rx_stat_grovr_lo;
1063     u32     rx_stat_grovr_hi;
1064     u32     rx_stat_grflr_lo;
1065     u32     rx_stat_grflr_hi;
1066     u32     rx_stat_grmeg_lo;
1067     u32     rx_stat_grmeg_hi;
1068     u32     rx_stat_grmeb_lo;
1069     u32     rx_stat_grmeb_hi;
1070     u32     rx_stat_grbyt_lo;
1071     u32     rx_stat_grbyt_hi;
1072     u32     rx_stat_grund_lo;
1073     u32     rx_stat_grund_hi;
1074     u32     rx_stat_grfrg_lo;
1075     u32     rx_stat_grfrg_hi;
1076     u32     rx_stat_grerb_lo;
1077     u32     rx_stat_grerb_hi;
1078     u32     rx_stat_grfre_lo;
1079     u32     rx_stat_grfre_hi;
1080     u32     rx_stat_gripj_lo;
1081     u32     rx_stat_gripj_hi;
1082 };
1083
1084
1085 union mac_stats {
1086     struct emac_stats   emac_stats;
1087     struct bmac_stats   bmac_stats;
1088 };
1089
1090
1091 struct mac_stx {
1092     /* in_bad_octets */
1093     u32     rx_stat_ifhcinbadoctets_hi;
1094     u32     rx_stat_ifhcinbadoctets_lo;
1095
1096     /* out_bad_octets */
1097     u32     tx_stat_ifhcoutbadoctets_hi;
1098     u32     tx_stat_ifhcoutbadoctets_lo;
1099
1100     /* crc_receive_errors */
1101     u32     rx_stat_dot3statsfcserrors_hi;
1102     u32     rx_stat_dot3statsfcserrors_lo;
1103     /* alignment_errors */
1104     u32     rx_stat_dot3statsalignmenterrors_hi;
1105     u32     rx_stat_dot3statsalignmenterrors_lo;
1106     /* carrier_sense_errors */
1107     u32     rx_stat_dot3statscarriersenseerrors_hi;
1108     u32     rx_stat_dot3statscarriersenseerrors_lo;
1109     /* false_carrier_detections */
1110     u32     rx_stat_falsecarriererrors_hi;
1111     u32     rx_stat_falsecarriererrors_lo;
1112
1113     /* runt_packets_received */
1114     u32     rx_stat_etherstatsundersizepkts_hi;
1115     u32     rx_stat_etherstatsundersizepkts_lo;
1116     /* jabber_packets_received */
1117     u32     rx_stat_dot3statsframestoolong_hi;
1118     u32     rx_stat_dot3statsframestoolong_lo;
1119
1120     /* error_runt_packets_received */
1121     u32     rx_stat_etherstatsfragments_hi;
1122     u32     rx_stat_etherstatsfragments_lo;
1123     /* error_jabber_packets_received */
1124     u32     rx_stat_etherstatsjabbers_hi;
1125     u32     rx_stat_etherstatsjabbers_lo;
1126
1127     /* control_frames_received */
1128     u32     rx_stat_maccontrolframesreceived_hi;
1129     u32     rx_stat_maccontrolframesreceived_lo;
1130     u32     rx_stat_bmac_xpf_hi;
1131     u32     rx_stat_bmac_xpf_lo;
1132     u32     rx_stat_bmac_xcf_hi;
1133     u32     rx_stat_bmac_xcf_lo;
1134
1135     /* xoff_state_entered */
1136     u32     rx_stat_xoffstateentered_hi;
1137     u32     rx_stat_xoffstateentered_lo;
1138     /* pause_xon_frames_received */
1139     u32     rx_stat_xonpauseframesreceived_hi;
1140     u32     rx_stat_xonpauseframesreceived_lo;
1141     /* pause_xoff_frames_received */
1142     u32     rx_stat_xoffpauseframesreceived_hi;
1143     u32     rx_stat_xoffpauseframesreceived_lo;
1144     /* pause_xon_frames_transmitted */
1145     u32     tx_stat_outxonsent_hi;
1146     u32     tx_stat_outxonsent_lo;
1147     /* pause_xoff_frames_transmitted */
1148     u32     tx_stat_outxoffsent_hi;
1149     u32     tx_stat_outxoffsent_lo;
1150     /* flow_control_done */
1151     u32     tx_stat_flowcontroldone_hi;
1152     u32     tx_stat_flowcontroldone_lo;
1153
1154     /* ether_stats_collisions */
1155     u32     tx_stat_etherstatscollisions_hi;
1156     u32     tx_stat_etherstatscollisions_lo;
1157     /* single_collision_transmit_frames */
1158     u32     tx_stat_dot3statssinglecollisionframes_hi;
1159     u32     tx_stat_dot3statssinglecollisionframes_lo;
1160     /* multiple_collision_transmit_frames */
1161     u32     tx_stat_dot3statsmultiplecollisionframes_hi;
1162     u32     tx_stat_dot3statsmultiplecollisionframes_lo;
1163     /* deferred_transmissions */
1164     u32     tx_stat_dot3statsdeferredtransmissions_hi;
1165     u32     tx_stat_dot3statsdeferredtransmissions_lo;
1166     /* excessive_collision_frames */
1167     u32     tx_stat_dot3statsexcessivecollisions_hi;
1168     u32     tx_stat_dot3statsexcessivecollisions_lo;
1169     /* late_collision_frames */
1170     u32     tx_stat_dot3statslatecollisions_hi;
1171     u32     tx_stat_dot3statslatecollisions_lo;
1172
1173     /* frames_transmitted_64_bytes */
1174     u32     tx_stat_etherstatspkts64octets_hi;
1175     u32     tx_stat_etherstatspkts64octets_lo;
1176     /* frames_transmitted_65_127_bytes */
1177     u32     tx_stat_etherstatspkts65octetsto127octets_hi;
1178     u32     tx_stat_etherstatspkts65octetsto127octets_lo;
1179     /* frames_transmitted_128_255_bytes */
1180     u32     tx_stat_etherstatspkts128octetsto255octets_hi;
1181     u32     tx_stat_etherstatspkts128octetsto255octets_lo;
1182     /* frames_transmitted_256_511_bytes */
1183     u32     tx_stat_etherstatspkts256octetsto511octets_hi;
1184     u32     tx_stat_etherstatspkts256octetsto511octets_lo;
1185     /* frames_transmitted_512_1023_bytes */
1186     u32     tx_stat_etherstatspkts512octetsto1023octets_hi;
1187     u32     tx_stat_etherstatspkts512octetsto1023octets_lo;
1188     /* frames_transmitted_1024_1522_bytes */
1189     u32     tx_stat_etherstatspkts1024octetsto1522octets_hi;
1190     u32     tx_stat_etherstatspkts1024octetsto1522octets_lo;
1191     /* frames_transmitted_1523_9022_bytes */
1192     u32     tx_stat_etherstatspktsover1522octets_hi;
1193     u32     tx_stat_etherstatspktsover1522octets_lo;
1194     u32     tx_stat_bmac_2047_hi;
1195     u32     tx_stat_bmac_2047_lo;
1196     u32     tx_stat_bmac_4095_hi;
1197     u32     tx_stat_bmac_4095_lo;
1198     u32     tx_stat_bmac_9216_hi;
1199     u32     tx_stat_bmac_9216_lo;
1200     u32     tx_stat_bmac_16383_hi;
1201     u32     tx_stat_bmac_16383_lo;
1202
1203     /* internal_mac_transmit_errors */
1204     u32     tx_stat_dot3statsinternalmactransmiterrors_hi;
1205     u32     tx_stat_dot3statsinternalmactransmiterrors_lo;
1206
1207     /* if_out_discards */
1208     u32     tx_stat_bmac_ufl_hi;
1209     u32     tx_stat_bmac_ufl_lo;
1210 };
1211
1212
1213 #define MAC_STX_IDX_MAX                     2
1214
1215 struct host_port_stats {
1216     u32            host_port_stats_start;
1217
1218     struct mac_stx mac_stx[MAC_STX_IDX_MAX];
1219
1220     u32            brb_drop_hi;
1221     u32            brb_drop_lo;
1222
1223     u32            host_port_stats_end;
1224 };
1225
1226
1227 struct host_func_stats {
1228     u32     host_func_stats_start;
1229
1230     u32     total_bytes_received_hi;
1231     u32     total_bytes_received_lo;
1232
1233     u32     total_bytes_transmitted_hi;
1234     u32     total_bytes_transmitted_lo;
1235
1236     u32     total_unicast_packets_received_hi;
1237     u32     total_unicast_packets_received_lo;
1238
1239     u32     total_multicast_packets_received_hi;
1240     u32     total_multicast_packets_received_lo;
1241
1242     u32     total_broadcast_packets_received_hi;
1243     u32     total_broadcast_packets_received_lo;
1244
1245     u32     total_unicast_packets_transmitted_hi;
1246     u32     total_unicast_packets_transmitted_lo;
1247
1248     u32     total_multicast_packets_transmitted_hi;
1249     u32     total_multicast_packets_transmitted_lo;
1250
1251     u32     total_broadcast_packets_transmitted_hi;
1252     u32     total_broadcast_packets_transmitted_lo;
1253
1254     u32     valid_bytes_received_hi;
1255     u32     valid_bytes_received_lo;
1256
1257     u32     host_func_stats_end;
1258 };
1259
1260
1261 #define BCM_5710_FW_MAJOR_VERSION                       5
1262 #define BCM_5710_FW_MINOR_VERSION                       2
1263 #define BCM_5710_FW_REVISION_VERSION                    7
1264 #define BCM_5710_FW_ENGINEERING_VERSION                 0
1265 #define BCM_5710_FW_COMPILE_FLAGS                       1
1266
1267
1268 /*
1269  * attention bits
1270  */
1271 struct atten_def_status_block {
1272         __le32 attn_bits;
1273         __le32 attn_bits_ack;
1274         u8 status_block_id;
1275         u8 reserved0;
1276         __le16 attn_bits_index;
1277         __le32 reserved1;
1278 };
1279
1280
1281 /*
1282  * common data for all protocols
1283  */
1284 struct doorbell_hdr {
1285         u8 header;
1286 #define DOORBELL_HDR_RX (0x1<<0)
1287 #define DOORBELL_HDR_RX_SHIFT 0
1288 #define DOORBELL_HDR_DB_TYPE (0x1<<1)
1289 #define DOORBELL_HDR_DB_TYPE_SHIFT 1
1290 #define DOORBELL_HDR_DPM_SIZE (0x3<<2)
1291 #define DOORBELL_HDR_DPM_SIZE_SHIFT 2
1292 #define DOORBELL_HDR_CONN_TYPE (0xF<<4)
1293 #define DOORBELL_HDR_CONN_TYPE_SHIFT 4
1294 };
1295
1296 /*
1297  * doorbell message sent to the chip
1298  */
1299 struct doorbell {
1300 #if defined(__BIG_ENDIAN)
1301         u16 zero_fill2;
1302         u8 zero_fill1;
1303         struct doorbell_hdr header;
1304 #elif defined(__LITTLE_ENDIAN)
1305         struct doorbell_hdr header;
1306         u8 zero_fill1;
1307         u16 zero_fill2;
1308 #endif
1309 };
1310
1311
1312 /*
1313  * doorbell message sent to the chip
1314  */
1315 struct doorbell_set_prod {
1316 #if defined(__BIG_ENDIAN)
1317         u16 prod;
1318         u8 zero_fill1;
1319         struct doorbell_hdr header;
1320 #elif defined(__LITTLE_ENDIAN)
1321         struct doorbell_hdr header;
1322         u8 zero_fill1;
1323         u16 prod;
1324 #endif
1325 };
1326
1327
1328 /*
1329  * IGU driver acknowledgement register
1330  */
1331 struct igu_ack_register {
1332 #if defined(__BIG_ENDIAN)
1333         u16 sb_id_and_flags;
1334 #define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
1335 #define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
1336 #define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
1337 #define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
1338 #define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
1339 #define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
1340 #define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
1341 #define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
1342 #define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
1343 #define IGU_ACK_REGISTER_RESERVED_SHIFT 11
1344         u16 status_block_index;
1345 #elif defined(__LITTLE_ENDIAN)
1346         u16 status_block_index;
1347         u16 sb_id_and_flags;
1348 #define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
1349 #define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
1350 #define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
1351 #define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
1352 #define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
1353 #define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
1354 #define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
1355 #define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
1356 #define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
1357 #define IGU_ACK_REGISTER_RESERVED_SHIFT 11
1358 #endif
1359 };
1360
1361
1362 /*
1363  * IGU driver acknowledgement register
1364  */
1365 struct igu_backward_compatible {
1366         u32 sb_id_and_flags;
1367 #define IGU_BACKWARD_COMPATIBLE_SB_INDEX (0xFFFF<<0)
1368 #define IGU_BACKWARD_COMPATIBLE_SB_INDEX_SHIFT 0
1369 #define IGU_BACKWARD_COMPATIBLE_SB_SELECT (0x1F<<16)
1370 #define IGU_BACKWARD_COMPATIBLE_SB_SELECT_SHIFT 16
1371 #define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS (0x7<<21)
1372 #define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS_SHIFT 21
1373 #define IGU_BACKWARD_COMPATIBLE_BUPDATE (0x1<<24)
1374 #define IGU_BACKWARD_COMPATIBLE_BUPDATE_SHIFT 24
1375 #define IGU_BACKWARD_COMPATIBLE_ENABLE_INT (0x3<<25)
1376 #define IGU_BACKWARD_COMPATIBLE_ENABLE_INT_SHIFT 25
1377 #define IGU_BACKWARD_COMPATIBLE_RESERVED_0 (0x1F<<27)
1378 #define IGU_BACKWARD_COMPATIBLE_RESERVED_0_SHIFT 27
1379         u32 reserved_2;
1380 };
1381
1382
1383 /*
1384  * IGU driver acknowledgement register
1385  */
1386 struct igu_regular {
1387         u32 sb_id_and_flags;
1388 #define IGU_REGULAR_SB_INDEX (0xFFFFF<<0)
1389 #define IGU_REGULAR_SB_INDEX_SHIFT 0
1390 #define IGU_REGULAR_RESERVED0 (0x1<<20)
1391 #define IGU_REGULAR_RESERVED0_SHIFT 20
1392 #define IGU_REGULAR_SEGMENT_ACCESS (0x7<<21)
1393 #define IGU_REGULAR_SEGMENT_ACCESS_SHIFT 21
1394 #define IGU_REGULAR_BUPDATE (0x1<<24)
1395 #define IGU_REGULAR_BUPDATE_SHIFT 24
1396 #define IGU_REGULAR_ENABLE_INT (0x3<<25)
1397 #define IGU_REGULAR_ENABLE_INT_SHIFT 25
1398 #define IGU_REGULAR_RESERVED_1 (0x1<<27)
1399 #define IGU_REGULAR_RESERVED_1_SHIFT 27
1400 #define IGU_REGULAR_CLEANUP_TYPE (0x3<<28)
1401 #define IGU_REGULAR_CLEANUP_TYPE_SHIFT 28
1402 #define IGU_REGULAR_CLEANUP_SET (0x1<<30)
1403 #define IGU_REGULAR_CLEANUP_SET_SHIFT 30
1404 #define IGU_REGULAR_BCLEANUP (0x1<<31)
1405 #define IGU_REGULAR_BCLEANUP_SHIFT 31
1406         u32 reserved_2;
1407 };
1408
1409 /*
1410  * IGU driver acknowledgement register
1411  */
1412 union igu_consprod_reg {
1413         struct igu_regular regular;
1414         struct igu_backward_compatible backward_compatible;
1415 };
1416
1417
1418 /*
1419  * Parser parsing flags field
1420  */
1421 struct parsing_flags {
1422         __le16 flags;
1423 #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE (0x1<<0)
1424 #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE_SHIFT 0
1425 #define PARSING_FLAGS_VLAN (0x1<<1)
1426 #define PARSING_FLAGS_VLAN_SHIFT 1
1427 #define PARSING_FLAGS_EXTRA_VLAN (0x1<<2)
1428 #define PARSING_FLAGS_EXTRA_VLAN_SHIFT 2
1429 #define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL (0x3<<3)
1430 #define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT 3
1431 #define PARSING_FLAGS_IP_OPTIONS (0x1<<5)
1432 #define PARSING_FLAGS_IP_OPTIONS_SHIFT 5
1433 #define PARSING_FLAGS_FRAGMENTATION_STATUS (0x1<<6)
1434 #define PARSING_FLAGS_FRAGMENTATION_STATUS_SHIFT 6
1435 #define PARSING_FLAGS_OVER_IP_PROTOCOL (0x3<<7)
1436 #define PARSING_FLAGS_OVER_IP_PROTOCOL_SHIFT 7
1437 #define PARSING_FLAGS_PURE_ACK_INDICATION (0x1<<9)
1438 #define PARSING_FLAGS_PURE_ACK_INDICATION_SHIFT 9
1439 #define PARSING_FLAGS_TCP_OPTIONS_EXIST (0x1<<10)
1440 #define PARSING_FLAGS_TCP_OPTIONS_EXIST_SHIFT 10
1441 #define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG (0x1<<11)
1442 #define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG_SHIFT 11
1443 #define PARSING_FLAGS_CONNECTION_MATCH (0x1<<12)
1444 #define PARSING_FLAGS_CONNECTION_MATCH_SHIFT 12
1445 #define PARSING_FLAGS_LLC_SNAP (0x1<<13)
1446 #define PARSING_FLAGS_LLC_SNAP_SHIFT 13
1447 #define PARSING_FLAGS_RESERVED0 (0x3<<14)
1448 #define PARSING_FLAGS_RESERVED0_SHIFT 14
1449 };
1450
1451
1452 struct regpair {
1453         __le32 lo;
1454         __le32 hi;
1455 };
1456
1457
1458 /*
1459  * dmae command structure
1460  */
1461 struct dmae_command {
1462         u32 opcode;
1463 #define DMAE_COMMAND_SRC (0x1<<0)
1464 #define DMAE_COMMAND_SRC_SHIFT 0
1465 #define DMAE_COMMAND_DST (0x3<<1)
1466 #define DMAE_COMMAND_DST_SHIFT 1
1467 #define DMAE_COMMAND_C_DST (0x1<<3)
1468 #define DMAE_COMMAND_C_DST_SHIFT 3
1469 #define DMAE_COMMAND_C_TYPE_ENABLE (0x1<<4)
1470 #define DMAE_COMMAND_C_TYPE_ENABLE_SHIFT 4
1471 #define DMAE_COMMAND_C_TYPE_CRC_ENABLE (0x1<<5)
1472 #define DMAE_COMMAND_C_TYPE_CRC_ENABLE_SHIFT 5
1473 #define DMAE_COMMAND_C_TYPE_CRC_OFFSET (0x7<<6)
1474 #define DMAE_COMMAND_C_TYPE_CRC_OFFSET_SHIFT 6
1475 #define DMAE_COMMAND_ENDIANITY (0x3<<9)
1476 #define DMAE_COMMAND_ENDIANITY_SHIFT 9
1477 #define DMAE_COMMAND_PORT (0x1<<11)
1478 #define DMAE_COMMAND_PORT_SHIFT 11
1479 #define DMAE_COMMAND_CRC_RESET (0x1<<12)
1480 #define DMAE_COMMAND_CRC_RESET_SHIFT 12
1481 #define DMAE_COMMAND_SRC_RESET (0x1<<13)
1482 #define DMAE_COMMAND_SRC_RESET_SHIFT 13
1483 #define DMAE_COMMAND_DST_RESET (0x1<<14)
1484 #define DMAE_COMMAND_DST_RESET_SHIFT 14
1485 #define DMAE_COMMAND_E1HVN (0x3<<15)
1486 #define DMAE_COMMAND_E1HVN_SHIFT 15
1487 #define DMAE_COMMAND_RESERVED0 (0x7FFF<<17)
1488 #define DMAE_COMMAND_RESERVED0_SHIFT 17
1489         u32 src_addr_lo;
1490         u32 src_addr_hi;
1491         u32 dst_addr_lo;
1492         u32 dst_addr_hi;
1493 #if defined(__BIG_ENDIAN)
1494         u16 reserved1;
1495         u16 len;
1496 #elif defined(__LITTLE_ENDIAN)
1497         u16 len;
1498         u16 reserved1;
1499 #endif
1500         u32 comp_addr_lo;
1501         u32 comp_addr_hi;
1502         u32 comp_val;
1503         u32 crc32;
1504         u32 crc32_c;
1505 #if defined(__BIG_ENDIAN)
1506         u16 crc16_c;
1507         u16 crc16;
1508 #elif defined(__LITTLE_ENDIAN)
1509         u16 crc16;
1510         u16 crc16_c;
1511 #endif
1512 #if defined(__BIG_ENDIAN)
1513         u16 reserved2;
1514         u16 crc_t10;
1515 #elif defined(__LITTLE_ENDIAN)
1516         u16 crc_t10;
1517         u16 reserved2;
1518 #endif
1519 #if defined(__BIG_ENDIAN)
1520         u16 xsum8;
1521         u16 xsum16;
1522 #elif defined(__LITTLE_ENDIAN)
1523         u16 xsum16;
1524         u16 xsum8;
1525 #endif
1526 };
1527
1528
1529 struct double_regpair {
1530         u32 regpair0_lo;
1531         u32 regpair0_hi;
1532         u32 regpair1_lo;
1533         u32 regpair1_hi;
1534 };
1535
1536
1537 /*
1538  * The eth storm context of Ustorm (configuration part)
1539  */
1540 struct ustorm_eth_st_context_config {
1541 #if defined(__BIG_ENDIAN)
1542         u8 flags;
1543 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT (0x1<<0)
1544 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT_SHIFT 0
1545 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_DYNAMIC_HC (0x1<<1)
1546 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_DYNAMIC_HC_SHIFT 1
1547 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_TPA (0x1<<2)
1548 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_TPA_SHIFT 2
1549 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS (0x1<<3)
1550 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS_SHIFT 3
1551 #define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0 (0xF<<4)
1552 #define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0_SHIFT 4
1553         u8 status_block_id;
1554         u8 clientId;
1555         u8 sb_index_numbers;
1556 #define USTORM_ETH_ST_CONTEXT_CONFIG_CQE_SB_INDEX_NUMBER (0xF<<0)
1557 #define USTORM_ETH_ST_CONTEXT_CONFIG_CQE_SB_INDEX_NUMBER_SHIFT 0
1558 #define USTORM_ETH_ST_CONTEXT_CONFIG_BD_SB_INDEX_NUMBER (0xF<<4)
1559 #define USTORM_ETH_ST_CONTEXT_CONFIG_BD_SB_INDEX_NUMBER_SHIFT 4
1560 #elif defined(__LITTLE_ENDIAN)
1561         u8 sb_index_numbers;
1562 #define USTORM_ETH_ST_CONTEXT_CONFIG_CQE_SB_INDEX_NUMBER (0xF<<0)
1563 #define USTORM_ETH_ST_CONTEXT_CONFIG_CQE_SB_INDEX_NUMBER_SHIFT 0
1564 #define USTORM_ETH_ST_CONTEXT_CONFIG_BD_SB_INDEX_NUMBER (0xF<<4)
1565 #define USTORM_ETH_ST_CONTEXT_CONFIG_BD_SB_INDEX_NUMBER_SHIFT 4
1566         u8 clientId;
1567         u8 status_block_id;
1568         u8 flags;
1569 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT (0x1<<0)
1570 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT_SHIFT 0
1571 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_DYNAMIC_HC (0x1<<1)
1572 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_DYNAMIC_HC_SHIFT 1
1573 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_TPA (0x1<<2)
1574 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_TPA_SHIFT 2
1575 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS (0x1<<3)
1576 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS_SHIFT 3
1577 #define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0 (0xF<<4)
1578 #define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0_SHIFT 4
1579 #endif
1580 #if defined(__BIG_ENDIAN)
1581         u16 bd_buff_size;
1582         u8 statistics_counter_id;
1583         u8 mc_alignment_log_size;
1584 #elif defined(__LITTLE_ENDIAN)
1585         u8 mc_alignment_log_size;
1586         u8 statistics_counter_id;
1587         u16 bd_buff_size;
1588 #endif
1589 #if defined(__BIG_ENDIAN)
1590         u8 __local_sge_prod;
1591         u8 __local_bd_prod;
1592         u16 sge_buff_size;
1593 #elif defined(__LITTLE_ENDIAN)
1594         u16 sge_buff_size;
1595         u8 __local_bd_prod;
1596         u8 __local_sge_prod;
1597 #endif
1598 #if defined(__BIG_ENDIAN)
1599         u16 __sdm_bd_expected_counter;
1600         u8 cstorm_agg_int;
1601         u8 __expected_bds_on_ram;
1602 #elif defined(__LITTLE_ENDIAN)
1603         u8 __expected_bds_on_ram;
1604         u8 cstorm_agg_int;
1605         u16 __sdm_bd_expected_counter;
1606 #endif
1607 #if defined(__BIG_ENDIAN)
1608         u16 __ring_data_ram_addr;
1609         u16 __hc_cstorm_ram_addr;
1610 #elif defined(__LITTLE_ENDIAN)
1611         u16 __hc_cstorm_ram_addr;
1612         u16 __ring_data_ram_addr;
1613 #endif
1614 #if defined(__BIG_ENDIAN)
1615         u8 reserved1;
1616         u8 max_sges_for_packet;
1617         u16 __bd_ring_ram_addr;
1618 #elif defined(__LITTLE_ENDIAN)
1619         u16 __bd_ring_ram_addr;
1620         u8 max_sges_for_packet;
1621         u8 reserved1;
1622 #endif
1623         u32 bd_page_base_lo;
1624         u32 bd_page_base_hi;
1625         u32 sge_page_base_lo;
1626         u32 sge_page_base_hi;
1627         struct regpair reserved2;
1628 };
1629
1630 /*
1631  * The eth Rx Buffer Descriptor
1632  */
1633 struct eth_rx_bd {
1634         __le32 addr_lo;
1635         __le32 addr_hi;
1636 };
1637
1638 /*
1639  * The eth Rx SGE Descriptor
1640  */
1641 struct eth_rx_sge {
1642         __le32 addr_lo;
1643         __le32 addr_hi;
1644 };
1645
1646 /*
1647  * Local BDs and SGEs rings (in ETH)
1648  */
1649 struct eth_local_rx_rings {
1650         struct eth_rx_bd __local_bd_ring[8];
1651         struct eth_rx_sge __local_sge_ring[10];
1652 };
1653
1654 /*
1655  * The eth storm context of Ustorm
1656  */
1657 struct ustorm_eth_st_context {
1658         struct ustorm_eth_st_context_config common;
1659         struct eth_local_rx_rings __rings;
1660 };
1661
1662 /*
1663  * The eth storm context of Tstorm
1664  */
1665 struct tstorm_eth_st_context {
1666         u32 __reserved0[28];
1667 };
1668
1669 /*
1670  * The eth aggregative context section of Xstorm
1671  */
1672 struct xstorm_eth_extra_ag_context_section {
1673 #if defined(__BIG_ENDIAN)
1674         u8 __tcp_agg_vars1;
1675         u8 __reserved50;
1676         u16 __mss;
1677 #elif defined(__LITTLE_ENDIAN)
1678         u16 __mss;
1679         u8 __reserved50;
1680         u8 __tcp_agg_vars1;
1681 #endif
1682         u32 __snd_nxt;
1683         u32 __tx_wnd;
1684         u32 __snd_una;
1685         u32 __reserved53;
1686 #if defined(__BIG_ENDIAN)
1687         u8 __agg_val8_th;
1688         u8 __agg_val8;
1689         u16 __tcp_agg_vars2;
1690 #elif defined(__LITTLE_ENDIAN)
1691         u16 __tcp_agg_vars2;
1692         u8 __agg_val8;
1693         u8 __agg_val8_th;
1694 #endif
1695         u32 __reserved58;
1696         u32 __reserved59;
1697         u32 __reserved60;
1698         u32 __reserved61;
1699 #if defined(__BIG_ENDIAN)
1700         u16 __agg_val7_th;
1701         u16 __agg_val7;
1702 #elif defined(__LITTLE_ENDIAN)
1703         u16 __agg_val7;
1704         u16 __agg_val7_th;
1705 #endif
1706 #if defined(__BIG_ENDIAN)
1707         u8 __tcp_agg_vars5;
1708         u8 __tcp_agg_vars4;
1709         u8 __tcp_agg_vars3;
1710         u8 __reserved62;
1711 #elif defined(__LITTLE_ENDIAN)
1712         u8 __reserved62;
1713         u8 __tcp_agg_vars3;
1714         u8 __tcp_agg_vars4;
1715         u8 __tcp_agg_vars5;
1716 #endif
1717         u32 __tcp_agg_vars6;
1718 #if defined(__BIG_ENDIAN)
1719         u16 __agg_misc6;
1720         u16 __tcp_agg_vars7;
1721 #elif defined(__LITTLE_ENDIAN)
1722         u16 __tcp_agg_vars7;
1723         u16 __agg_misc6;
1724 #endif
1725         u32 __agg_val10;
1726         u32 __agg_val10_th;
1727 #if defined(__BIG_ENDIAN)
1728         u16 __reserved3;
1729         u8 __reserved2;
1730         u8 __da_only_cnt;
1731 #elif defined(__LITTLE_ENDIAN)
1732         u8 __da_only_cnt;
1733         u8 __reserved2;
1734         u16 __reserved3;
1735 #endif
1736 };
1737
1738 /*
1739  * The eth aggregative context of Xstorm
1740  */
1741 struct xstorm_eth_ag_context {
1742 #if defined(__BIG_ENDIAN)
1743         u16 agg_val1;
1744         u8 __agg_vars1;
1745         u8 __state;
1746 #elif defined(__LITTLE_ENDIAN)
1747         u8 __state;
1748         u8 __agg_vars1;
1749         u16 agg_val1;
1750 #endif
1751 #if defined(__BIG_ENDIAN)
1752         u8 cdu_reserved;
1753         u8 __agg_vars4;
1754         u8 __agg_vars3;
1755         u8 __agg_vars2;
1756 #elif defined(__LITTLE_ENDIAN)
1757         u8 __agg_vars2;
1758         u8 __agg_vars3;
1759         u8 __agg_vars4;
1760         u8 cdu_reserved;
1761 #endif
1762         u32 __bd_prod;
1763 #if defined(__BIG_ENDIAN)
1764         u16 __agg_vars5;
1765         u16 __agg_val4_th;
1766 #elif defined(__LITTLE_ENDIAN)
1767         u16 __agg_val4_th;
1768         u16 __agg_vars5;
1769 #endif
1770         struct xstorm_eth_extra_ag_context_section __extra_section;
1771 #if defined(__BIG_ENDIAN)
1772         u16 __agg_vars7;
1773         u8 __agg_val3_th;
1774         u8 __agg_vars6;
1775 #elif defined(__LITTLE_ENDIAN)
1776         u8 __agg_vars6;
1777         u8 __agg_val3_th;
1778         u16 __agg_vars7;
1779 #endif
1780 #if defined(__BIG_ENDIAN)
1781         u16 __agg_val11_th;
1782         u16 __agg_val11;
1783 #elif defined(__LITTLE_ENDIAN)
1784         u16 __agg_val11;
1785         u16 __agg_val11_th;
1786 #endif
1787 #if defined(__BIG_ENDIAN)
1788         u8 __reserved1;
1789         u8 __agg_val6_th;
1790         u16 __agg_val9;
1791 #elif defined(__LITTLE_ENDIAN)
1792         u16 __agg_val9;
1793         u8 __agg_val6_th;
1794         u8 __reserved1;
1795 #endif
1796 #if defined(__BIG_ENDIAN)
1797         u16 __agg_val2_th;
1798         u16 __agg_val2;
1799 #elif defined(__LITTLE_ENDIAN)
1800         u16 __agg_val2;
1801         u16 __agg_val2_th;
1802 #endif
1803         u32 __agg_vars8;
1804 #if defined(__BIG_ENDIAN)
1805         u16 __agg_misc0;
1806         u16 __agg_val4;
1807 #elif defined(__LITTLE_ENDIAN)
1808         u16 __agg_val4;
1809         u16 __agg_misc0;
1810 #endif
1811 #if defined(__BIG_ENDIAN)
1812         u8 __agg_val3;
1813         u8 __agg_val6;
1814         u8 __agg_val5_th;
1815         u8 __agg_val5;
1816 #elif defined(__LITTLE_ENDIAN)
1817         u8 __agg_val5;
1818         u8 __agg_val5_th;
1819         u8 __agg_val6;
1820         u8 __agg_val3;
1821 #endif
1822 #if defined(__BIG_ENDIAN)
1823         u16 __agg_misc1;
1824         u16 __bd_ind_max_val;
1825 #elif defined(__LITTLE_ENDIAN)
1826         u16 __bd_ind_max_val;
1827         u16 __agg_misc1;
1828 #endif
1829         u32 __reserved57;
1830         u32 __agg_misc4;
1831         u32 __agg_misc5;
1832 };
1833
1834 /*
1835  * The eth extra aggregative context section of Tstorm
1836  */
1837 struct tstorm_eth_extra_ag_context_section {
1838         u32 __agg_val1;
1839 #if defined(__BIG_ENDIAN)
1840         u8 __tcp_agg_vars2;
1841         u8 __agg_val3;
1842         u16 __agg_val2;
1843 #elif defined(__LITTLE_ENDIAN)
1844         u16 __agg_val2;
1845         u8 __agg_val3;
1846         u8 __tcp_agg_vars2;
1847 #endif
1848 #if defined(__BIG_ENDIAN)
1849         u16 __agg_val5;
1850         u8 __agg_val6;
1851         u8 __tcp_agg_vars3;
1852 #elif defined(__LITTLE_ENDIAN)
1853         u8 __tcp_agg_vars3;
1854         u8 __agg_val6;
1855         u16 __agg_val5;
1856 #endif
1857         u32 __reserved63;
1858         u32 __reserved64;
1859         u32 __reserved65;
1860         u32 __reserved66;
1861         u32 __reserved67;
1862         u32 __tcp_agg_vars1;
1863         u32 __reserved61;
1864         u32 __reserved62;
1865         u32 __reserved2;
1866 };
1867
1868 /*
1869  * The eth aggregative context of Tstorm
1870  */
1871 struct tstorm_eth_ag_context {
1872 #if defined(__BIG_ENDIAN)
1873         u16 __reserved54;
1874         u8 __agg_vars1;
1875         u8 __state;
1876 #elif defined(__LITTLE_ENDIAN)
1877         u8 __state;
1878         u8 __agg_vars1;
1879         u16 __reserved54;
1880 #endif
1881 #if defined(__BIG_ENDIAN)
1882         u16 __agg_val4;
1883         u16 __agg_vars2;
1884 #elif defined(__LITTLE_ENDIAN)
1885         u16 __agg_vars2;
1886         u16 __agg_val4;
1887 #endif
1888         struct tstorm_eth_extra_ag_context_section __extra_section;
1889 };
1890
1891 /*
1892  * The eth aggregative context of Cstorm
1893  */
1894 struct cstorm_eth_ag_context {
1895         u32 __agg_vars1;
1896 #if defined(__BIG_ENDIAN)
1897         u8 __aux1_th;
1898         u8 __aux1_val;
1899         u16 __agg_vars2;
1900 #elif defined(__LITTLE_ENDIAN)
1901         u16 __agg_vars2;
1902         u8 __aux1_val;
1903         u8 __aux1_th;
1904 #endif
1905         u32 __num_of_treated_packet;
1906         u32 __last_packet_treated;
1907 #if defined(__BIG_ENDIAN)
1908         u16 __reserved58;
1909         u16 __reserved57;
1910 #elif defined(__LITTLE_ENDIAN)
1911         u16 __reserved57;
1912         u16 __reserved58;
1913 #endif
1914 #if defined(__BIG_ENDIAN)
1915         u8 __reserved62;
1916         u8 __reserved61;
1917         u8 __reserved60;
1918         u8 __reserved59;
1919 #elif defined(__LITTLE_ENDIAN)
1920         u8 __reserved59;
1921         u8 __reserved60;
1922         u8 __reserved61;
1923         u8 __reserved62;
1924 #endif
1925 #if defined(__BIG_ENDIAN)
1926         u16 __reserved64;
1927         u16 __reserved63;
1928 #elif defined(__LITTLE_ENDIAN)
1929         u16 __reserved63;
1930         u16 __reserved64;
1931 #endif
1932         u32 __reserved65;
1933 #if defined(__BIG_ENDIAN)
1934         u16 __agg_vars3;
1935         u16 __rq_inv_cnt;
1936 #elif defined(__LITTLE_ENDIAN)
1937         u16 __rq_inv_cnt;
1938         u16 __agg_vars3;
1939 #endif
1940 #if defined(__BIG_ENDIAN)
1941         u16 __packet_index_th;
1942         u16 __packet_index;
1943 #elif defined(__LITTLE_ENDIAN)
1944         u16 __packet_index;
1945         u16 __packet_index_th;
1946 #endif
1947 };
1948
1949 /*
1950  * The eth aggregative context of Ustorm
1951  */
1952 struct ustorm_eth_ag_context {
1953 #if defined(__BIG_ENDIAN)
1954         u8 __aux_counter_flags;
1955         u8 __agg_vars2;
1956         u8 __agg_vars1;
1957         u8 __state;
1958 #elif defined(__LITTLE_ENDIAN)
1959         u8 __state;
1960         u8 __agg_vars1;
1961         u8 __agg_vars2;
1962         u8 __aux_counter_flags;
1963 #endif
1964 #if defined(__BIG_ENDIAN)
1965         u8 cdu_usage;
1966         u8 __agg_misc2;
1967         u16 __agg_misc1;
1968 #elif defined(__LITTLE_ENDIAN)
1969         u16 __agg_misc1;
1970         u8 __agg_misc2;
1971         u8 cdu_usage;
1972 #endif
1973         u32 __agg_misc4;
1974 #if defined(__BIG_ENDIAN)
1975         u8 __agg_val3_th;
1976         u8 __agg_val3;
1977         u16 __agg_misc3;
1978 #elif defined(__LITTLE_ENDIAN)
1979         u16 __agg_misc3;
1980         u8 __agg_val3;
1981         u8 __agg_val3_th;
1982 #endif
1983         u32 __agg_val1;
1984         u32 __agg_misc4_th;
1985 #if defined(__BIG_ENDIAN)
1986         u16 __agg_val2_th;
1987         u16 __agg_val2;
1988 #elif defined(__LITTLE_ENDIAN)
1989         u16 __agg_val2;
1990         u16 __agg_val2_th;
1991 #endif
1992 #if defined(__BIG_ENDIAN)
1993         u16 __reserved2;
1994         u8 __decision_rules;
1995         u8 __decision_rule_enable_bits;
1996 #elif defined(__LITTLE_ENDIAN)
1997         u8 __decision_rule_enable_bits;
1998         u8 __decision_rules;
1999         u16 __reserved2;
2000 #endif
2001 };
2002
2003 /*
2004  * Timers connection context
2005  */
2006 struct timers_block_context {
2007         u32 __reserved_0;
2008         u32 __reserved_1;
2009         u32 __reserved_2;
2010         u32 flags;
2011 #define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS (0x3<<0)
2012 #define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS_SHIFT 0
2013 #define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG (0x1<<2)
2014 #define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG_SHIFT 2
2015 #define __TIMERS_BLOCK_CONTEXT_RESERVED0 (0x1FFFFFFF<<3)
2016 #define __TIMERS_BLOCK_CONTEXT_RESERVED0_SHIFT 3
2017 };
2018
2019 /*
2020  * structure for easy accessibility to assembler
2021  */
2022 struct eth_tx_bd_flags {
2023         u8 as_bitfield;
2024 #define ETH_TX_BD_FLAGS_VLAN_TAG (0x1<<0)
2025 #define ETH_TX_BD_FLAGS_VLAN_TAG_SHIFT 0
2026 #define ETH_TX_BD_FLAGS_IP_CSUM (0x1<<1)
2027 #define ETH_TX_BD_FLAGS_IP_CSUM_SHIFT 1
2028 #define ETH_TX_BD_FLAGS_L4_CSUM (0x1<<2)
2029 #define ETH_TX_BD_FLAGS_L4_CSUM_SHIFT 2
2030 #define ETH_TX_BD_FLAGS_END_BD (0x1<<3)
2031 #define ETH_TX_BD_FLAGS_END_BD_SHIFT 3
2032 #define ETH_TX_BD_FLAGS_START_BD (0x1<<4)
2033 #define ETH_TX_BD_FLAGS_START_BD_SHIFT 4
2034 #define ETH_TX_BD_FLAGS_HDR_POOL (0x1<<5)
2035 #define ETH_TX_BD_FLAGS_HDR_POOL_SHIFT 5
2036 #define ETH_TX_BD_FLAGS_SW_LSO (0x1<<6)
2037 #define ETH_TX_BD_FLAGS_SW_LSO_SHIFT 6
2038 #define ETH_TX_BD_FLAGS_IPV6 (0x1<<7)
2039 #define ETH_TX_BD_FLAGS_IPV6_SHIFT 7
2040 };
2041
2042 /*
2043  * The eth Tx Buffer Descriptor
2044  */
2045 struct eth_tx_start_bd {
2046         __le32 addr_lo;
2047         __le32 addr_hi;
2048         __le16 nbd;
2049         __le16 nbytes;
2050         __le16 vlan;
2051         struct eth_tx_bd_flags bd_flags;
2052         u8 general_data;
2053 #define ETH_TX_START_BD_HDR_NBDS (0x3F<<0)
2054 #define ETH_TX_START_BD_HDR_NBDS_SHIFT 0
2055 #define ETH_TX_START_BD_ETH_ADDR_TYPE (0x3<<6)
2056 #define ETH_TX_START_BD_ETH_ADDR_TYPE_SHIFT 6
2057 };
2058
2059 /*
2060  * Tx regular BD structure
2061  */
2062 struct eth_tx_bd {
2063         u32 addr_lo;
2064         u32 addr_hi;
2065         u16 total_pkt_bytes;
2066         u16 nbytes;
2067         u8 reserved[4];
2068 };
2069
2070 /*
2071  * Tx parsing BD structure for ETH,Relevant in START
2072  */
2073 struct eth_tx_parse_bd {
2074         u8 global_data;
2075 #define ETH_TX_PARSE_BD_IP_HDR_START_OFFSET (0xF<<0)
2076 #define ETH_TX_PARSE_BD_IP_HDR_START_OFFSET_SHIFT 0
2077 #define ETH_TX_PARSE_BD_UDP_CS_FLG (0x1<<4)
2078 #define ETH_TX_PARSE_BD_UDP_CS_FLG_SHIFT 4
2079 #define ETH_TX_PARSE_BD_PSEUDO_CS_WITHOUT_LEN (0x1<<5)
2080 #define ETH_TX_PARSE_BD_PSEUDO_CS_WITHOUT_LEN_SHIFT 5
2081 #define ETH_TX_PARSE_BD_LLC_SNAP_EN (0x1<<6)
2082 #define ETH_TX_PARSE_BD_LLC_SNAP_EN_SHIFT 6
2083 #define ETH_TX_PARSE_BD_NS_FLG (0x1<<7)
2084 #define ETH_TX_PARSE_BD_NS_FLG_SHIFT 7
2085         u8 tcp_flags;
2086 #define ETH_TX_PARSE_BD_FIN_FLG (0x1<<0)
2087 #define ETH_TX_PARSE_BD_FIN_FLG_SHIFT 0
2088 #define ETH_TX_PARSE_BD_SYN_FLG (0x1<<1)
2089 #define ETH_TX_PARSE_BD_SYN_FLG_SHIFT 1
2090 #define ETH_TX_PARSE_BD_RST_FLG (0x1<<2)
2091 #define ETH_TX_PARSE_BD_RST_FLG_SHIFT 2
2092 #define ETH_TX_PARSE_BD_PSH_FLG (0x1<<3)
2093 #define ETH_TX_PARSE_BD_PSH_FLG_SHIFT 3
2094 #define ETH_TX_PARSE_BD_ACK_FLG (0x1<<4)
2095 #define ETH_TX_PARSE_BD_ACK_FLG_SHIFT 4
2096 #define ETH_TX_PARSE_BD_URG_FLG (0x1<<5)
2097 #define ETH_TX_PARSE_BD_URG_FLG_SHIFT 5
2098 #define ETH_TX_PARSE_BD_ECE_FLG (0x1<<6)
2099 #define ETH_TX_PARSE_BD_ECE_FLG_SHIFT 6
2100 #define ETH_TX_PARSE_BD_CWR_FLG (0x1<<7)
2101 #define ETH_TX_PARSE_BD_CWR_FLG_SHIFT 7
2102         u8 ip_hlen;
2103         s8 reserved;
2104         __le16 total_hlen;
2105         __le16 tcp_pseudo_csum;
2106         __le16 lso_mss;
2107         __le16 ip_id;
2108         __le32 tcp_send_seq;
2109 };
2110
2111 /*
2112  * The last BD in the BD memory will hold a pointer to the next BD memory
2113  */
2114 struct eth_tx_next_bd {
2115         __le32 addr_lo;
2116         __le32 addr_hi;
2117         u8 reserved[8];
2118 };
2119
2120 /*
2121  * union for 4 Bd types
2122  */
2123 union eth_tx_bd_types {
2124         struct eth_tx_start_bd start_bd;
2125         struct eth_tx_bd reg_bd;
2126         struct eth_tx_parse_bd parse_bd;
2127         struct eth_tx_next_bd next_bd;
2128 };
2129
2130 /*
2131  * The eth storm context of Xstorm
2132  */
2133 struct xstorm_eth_st_context {
2134         u32 tx_bd_page_base_lo;
2135         u32 tx_bd_page_base_hi;
2136 #if defined(__BIG_ENDIAN)
2137         u16 tx_bd_cons;
2138         u8 statistics_data;
2139 #define XSTORM_ETH_ST_CONTEXT_STATISTICS_COUNTER_ID (0x7F<<0)
2140 #define XSTORM_ETH_ST_CONTEXT_STATISTICS_COUNTER_ID_SHIFT 0
2141 #define XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE (0x1<<7)
2142 #define XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE_SHIFT 7
2143         u8 __local_tx_bd_prod;
2144 #elif defined(__LITTLE_ENDIAN)
2145         u8 __local_tx_bd_prod;
2146         u8 statistics_data;
2147 #define XSTORM_ETH_ST_CONTEXT_STATISTICS_COUNTER_ID (0x7F<<0)
2148 #define XSTORM_ETH_ST_CONTEXT_STATISTICS_COUNTER_ID_SHIFT 0
2149 #define XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE (0x1<<7)
2150 #define XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE_SHIFT 7
2151         u16 tx_bd_cons;
2152 #endif
2153         u32 __reserved1;
2154         u32 __reserved2;
2155 #if defined(__BIG_ENDIAN)
2156         u8 __ram_cache_index;
2157         u8 __double_buffer_client;
2158         u16 __pkt_cons;
2159 #elif defined(__LITTLE_ENDIAN)
2160         u16 __pkt_cons;
2161         u8 __double_buffer_client;
2162         u8 __ram_cache_index;
2163 #endif
2164 #if defined(__BIG_ENDIAN)
2165         u16 __statistics_address;
2166         u16 __gso_next;
2167 #elif defined(__LITTLE_ENDIAN)
2168         u16 __gso_next;
2169         u16 __statistics_address;
2170 #endif
2171 #if defined(__BIG_ENDIAN)
2172         u8 __local_tx_bd_cons;
2173         u8 safc_group_num;
2174         u8 safc_group_en;
2175         u8 __is_eth_conn;
2176 #elif defined(__LITTLE_ENDIAN)
2177         u8 __is_eth_conn;
2178         u8 safc_group_en;
2179         u8 safc_group_num;
2180         u8 __local_tx_bd_cons;
2181 #endif
2182         union eth_tx_bd_types __bds[13];
2183 };
2184
2185 /*
2186  * The eth storm context of Cstorm
2187  */
2188 struct cstorm_eth_st_context {
2189 #if defined(__BIG_ENDIAN)
2190         u16 __reserved0;
2191         u8 sb_index_number;
2192         u8 status_block_id;
2193 #elif defined(__LITTLE_ENDIAN)
2194         u8 status_block_id;
2195         u8 sb_index_number;
2196         u16 __reserved0;
2197 #endif
2198         u32 __reserved1[3];
2199 };
2200
2201 /*
2202  * Ethernet connection context
2203  */
2204 struct eth_context {
2205         struct ustorm_eth_st_context ustorm_st_context;
2206         struct tstorm_eth_st_context tstorm_st_context;
2207         struct xstorm_eth_ag_context xstorm_ag_context;
2208         struct tstorm_eth_ag_context tstorm_ag_context;
2209         struct cstorm_eth_ag_context cstorm_ag_context;
2210         struct ustorm_eth_ag_context ustorm_ag_context;
2211         struct timers_block_context timers_context;
2212         struct xstorm_eth_st_context xstorm_st_context;
2213         struct cstorm_eth_st_context cstorm_st_context;
2214 };
2215
2216
2217 /*
2218  * Ethernet doorbell
2219  */
2220 struct eth_tx_doorbell {
2221 #if defined(__BIG_ENDIAN)
2222         u16 npackets;
2223         u8 params;
2224 #define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
2225 #define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
2226 #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
2227 #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
2228 #define ETH_TX_DOORBELL_SPARE (0x1<<7)
2229 #define ETH_TX_DOORBELL_SPARE_SHIFT 7
2230         struct doorbell_hdr hdr;
2231 #elif defined(__LITTLE_ENDIAN)
2232         struct doorbell_hdr hdr;
2233         u8 params;
2234 #define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
2235 #define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
2236 #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
2237 #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
2238 #define ETH_TX_DOORBELL_SPARE (0x1<<7)
2239 #define ETH_TX_DOORBELL_SPARE_SHIFT 7
2240         u16 npackets;
2241 #endif
2242 };
2243
2244
2245 /*
2246  * cstorm default status block, generated by ustorm
2247  */
2248 struct cstorm_def_status_block_u {
2249         __le16 index_values[HC_USTORM_DEF_SB_NUM_INDICES];
2250         __le16 status_block_index;
2251         u8 func;
2252         u8 status_block_id;
2253         __le32 __flags;
2254 };
2255
2256 /*
2257  * cstorm default status block, generated by cstorm
2258  */
2259 struct cstorm_def_status_block_c {
2260         __le16 index_values[HC_CSTORM_DEF_SB_NUM_INDICES];
2261         __le16 status_block_index;
2262         u8 func;
2263         u8 status_block_id;
2264         __le32 __flags;
2265 };
2266
2267 /*
2268  * xstorm status block
2269  */
2270 struct xstorm_def_status_block {
2271         __le16 index_values[HC_XSTORM_DEF_SB_NUM_INDICES];
2272         __le16 status_block_index;
2273         u8 func;
2274         u8 status_block_id;
2275         __le32 __flags;
2276 };
2277
2278 /*
2279  * tstorm status block
2280  */
2281 struct tstorm_def_status_block {
2282         __le16 index_values[HC_TSTORM_DEF_SB_NUM_INDICES];
2283         __le16 status_block_index;
2284         u8 func;
2285         u8 status_block_id;
2286         __le32 __flags;
2287 };
2288
2289 /*
2290  * host status block
2291  */
2292 struct host_def_status_block {
2293         struct atten_def_status_block atten_status_block;
2294         struct cstorm_def_status_block_u u_def_status_block;
2295         struct cstorm_def_status_block_c c_def_status_block;
2296         struct xstorm_def_status_block x_def_status_block;
2297         struct tstorm_def_status_block t_def_status_block;
2298 };
2299
2300
2301 /*
2302  * cstorm status block, generated by ustorm
2303  */
2304 struct cstorm_status_block_u {
2305         __le16 index_values[HC_USTORM_SB_NUM_INDICES];
2306         __le16 status_block_index;
2307         u8 func;
2308         u8 status_block_id;
2309         __le32 __flags;
2310 };
2311
2312 /*
2313  * cstorm status block, generated by cstorm
2314  */
2315 struct cstorm_status_block_c {
2316         __le16 index_values[HC_CSTORM_SB_NUM_INDICES];
2317         __le16 status_block_index;
2318         u8 func;
2319         u8 status_block_id;
2320         __le32 __flags;
2321 };
2322
2323 /*
2324  * host status block
2325  */
2326 struct host_status_block {
2327         struct cstorm_status_block_u u_status_block;
2328         struct cstorm_status_block_c c_status_block;
2329 };
2330
2331
2332 /*
2333  * The data for RSS setup ramrod
2334  */
2335 struct eth_client_setup_ramrod_data {
2336         u32 client_id;
2337         u8 is_rdma;
2338         u8 is_fcoe;
2339         u16 reserved1;
2340 };
2341
2342
2343 /*
2344  * regular eth FP CQE parameters struct
2345  */
2346 struct eth_fast_path_rx_cqe {
2347         u8 type_error_flags;
2348 #define ETH_FAST_PATH_RX_CQE_TYPE (0x1<<0)
2349 #define ETH_FAST_PATH_RX_CQE_TYPE_SHIFT 0
2350 #define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG (0x1<<1)
2351 #define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG_SHIFT 1
2352 #define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG (0x1<<2)
2353 #define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG_SHIFT 2
2354 #define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG (0x1<<3)
2355 #define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG_SHIFT 3
2356 #define ETH_FAST_PATH_RX_CQE_START_FLG (0x1<<4)
2357 #define ETH_FAST_PATH_RX_CQE_START_FLG_SHIFT 4
2358 #define ETH_FAST_PATH_RX_CQE_END_FLG (0x1<<5)
2359 #define ETH_FAST_PATH_RX_CQE_END_FLG_SHIFT 5
2360 #define ETH_FAST_PATH_RX_CQE_RESERVED0 (0x3<<6)
2361 #define ETH_FAST_PATH_RX_CQE_RESERVED0_SHIFT 6
2362         u8 status_flags;
2363 #define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE (0x7<<0)
2364 #define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE_SHIFT 0
2365 #define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG (0x1<<3)
2366 #define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG_SHIFT 3
2367 #define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG (0x1<<4)
2368 #define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG_SHIFT 4
2369 #define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG (0x1<<5)
2370 #define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG_SHIFT 5
2371 #define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG (0x1<<6)
2372 #define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG_SHIFT 6
2373 #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG (0x1<<7)
2374 #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG_SHIFT 7
2375         u8 placement_offset;
2376         u8 queue_index;
2377         __le32 rss_hash_result;
2378         __le16 vlan_tag;
2379         __le16 pkt_len;
2380         __le16 len_on_bd;
2381         struct parsing_flags pars_flags;
2382         __le16 sgl[8];
2383 };
2384
2385
2386 /*
2387  * The data for RSS setup ramrod
2388  */
2389 struct eth_halt_ramrod_data {
2390         u32 client_id;
2391         u32 reserved0;
2392 };
2393
2394
2395 /*
2396  * The data for statistics query ramrod
2397  */
2398 struct eth_query_ramrod_data {
2399 #if defined(__BIG_ENDIAN)
2400         u8 reserved0;
2401         u8 collect_port;
2402         u16 drv_counter;
2403 #elif defined(__LITTLE_ENDIAN)
2404         u16 drv_counter;
2405         u8 collect_port;
2406         u8 reserved0;
2407 #endif
2408         u32 ctr_id_vector;
2409 };
2410
2411
2412 /*
2413  * Place holder for ramrods protocol specific data
2414  */
2415 struct ramrod_data {
2416         __le32 data_lo;
2417         __le32 data_hi;
2418 };
2419
2420 /*
2421  * union for ramrod data for Ethernet protocol (CQE) (force size of 16 bits)
2422  */
2423 union eth_ramrod_data {
2424         struct ramrod_data general;
2425 };
2426
2427
2428 /*
2429  * Eth Rx Cqe structure- general structure for ramrods
2430  */
2431 struct common_ramrod_eth_rx_cqe {
2432         u8 ramrod_type;
2433 #define COMMON_RAMROD_ETH_RX_CQE_TYPE (0x1<<0)
2434 #define COMMON_RAMROD_ETH_RX_CQE_TYPE_SHIFT 0
2435 #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0 (0x7F<<1)
2436 #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0_SHIFT 1
2437         u8 conn_type;
2438         __le16 reserved1;
2439         __le32 conn_and_cmd_data;
2440 #define COMMON_RAMROD_ETH_RX_CQE_CID (0xFFFFFF<<0)
2441 #define COMMON_RAMROD_ETH_RX_CQE_CID_SHIFT 0
2442 #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID (0xFF<<24)
2443 #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID_SHIFT 24
2444         struct ramrod_data protocol_data;
2445         __le32 reserved2[4];
2446 };
2447
2448 /*
2449  * Rx Last CQE in page (in ETH)
2450  */
2451 struct eth_rx_cqe_next_page {
2452         __le32 addr_lo;
2453         __le32 addr_hi;
2454         __le32 reserved[6];
2455 };
2456
2457 /*
2458  * union for all eth rx cqe types (fix their sizes)
2459  */
2460 union eth_rx_cqe {
2461         struct eth_fast_path_rx_cqe fast_path_cqe;
2462         struct common_ramrod_eth_rx_cqe ramrod_cqe;
2463         struct eth_rx_cqe_next_page next_page_cqe;
2464 };
2465
2466
2467 /*
2468  * common data for all protocols
2469  */
2470 struct spe_hdr {
2471         __le32 conn_and_cmd_data;
2472 #define SPE_HDR_CID (0xFFFFFF<<0)
2473 #define SPE_HDR_CID_SHIFT 0
2474 #define SPE_HDR_CMD_ID (0xFF<<24)
2475 #define SPE_HDR_CMD_ID_SHIFT 24
2476         __le16 type;
2477 #define SPE_HDR_CONN_TYPE (0xFF<<0)
2478 #define SPE_HDR_CONN_TYPE_SHIFT 0
2479 #define SPE_HDR_COMMON_RAMROD (0xFF<<8)
2480 #define SPE_HDR_COMMON_RAMROD_SHIFT 8
2481         __le16 reserved;
2482 };
2483
2484 /*
2485  * Ethernet slow path element
2486  */
2487 union eth_specific_data {
2488         u8 protocol_data[8];
2489         struct regpair mac_config_addr;
2490         struct eth_client_setup_ramrod_data client_setup_ramrod_data;
2491         struct eth_halt_ramrod_data halt_ramrod_data;
2492         struct regpair leading_cqe_addr;
2493         struct regpair update_data_addr;
2494         struct eth_query_ramrod_data query_ramrod_data;
2495 };
2496
2497 /*
2498  * Ethernet slow path element
2499  */
2500 struct eth_spe {
2501         struct spe_hdr hdr;
2502         union eth_specific_data data;
2503 };
2504
2505
2506 /*
2507  * array of 13 bds as appears in the eth xstorm context
2508  */
2509 struct eth_tx_bds_array {
2510         union eth_tx_bd_types bds[13];
2511 };
2512
2513
2514 /*
2515  * Common configuration parameters per function in Tstorm
2516  */
2517 struct tstorm_eth_function_common_config {
2518 #if defined(__BIG_ENDIAN)
2519         u8 leading_client_id;
2520         u8 rss_result_mask;
2521         u16 config_flags;
2522 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY (0x1<<0)
2523 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY_SHIFT 0
2524 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY (0x1<<1)
2525 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY_SHIFT 1
2526 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY (0x1<<2)
2527 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
2528 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
2529 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
2530 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
2531 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
2532 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE (0x1<<7)
2533 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE_SHIFT 7
2534 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM (0x1<<8)
2535 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM_SHIFT 8
2536 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM (0x1<<9)
2537 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM_SHIFT 9
2538 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA (0x1<<10)
2539 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA_SHIFT 10
2540 #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0x1F<<11)
2541 #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 11
2542 #elif defined(__LITTLE_ENDIAN)
2543         u16 config_flags;
2544 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY (0x1<<0)
2545 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY_SHIFT 0
2546 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY (0x1<<1)
2547 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY_SHIFT 1
2548 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY (0x1<<2)
2549 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
2550 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
2551 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
2552 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
2553 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
2554 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE (0x1<<7)
2555 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE_SHIFT 7
2556 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM (0x1<<8)
2557 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM_SHIFT 8
2558 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM (0x1<<9)
2559 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM_SHIFT 9
2560 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA (0x1<<10)
2561 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA_SHIFT 10
2562 #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0x1F<<11)
2563 #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 11
2564         u8 rss_result_mask;
2565         u8 leading_client_id;
2566 #endif
2567         u16 vlan_id[2];
2568 };
2569
2570 /*
2571  * RSS idirection table update configuration
2572  */
2573 struct rss_update_config {
2574 #if defined(__BIG_ENDIAN)
2575         u16 toe_rss_bitmap;
2576         u16 flags;
2577 #define RSS_UPDATE_CONFIG_ETH_UPDATE_ENABLE (0x1<<0)
2578 #define RSS_UPDATE_CONFIG_ETH_UPDATE_ENABLE_SHIFT 0
2579 #define RSS_UPDATE_CONFIG_TOE_UPDATE_ENABLE (0x1<<1)
2580 #define RSS_UPDATE_CONFIG_TOE_UPDATE_ENABLE_SHIFT 1
2581 #define __RSS_UPDATE_CONFIG_RESERVED0 (0x3FFF<<2)
2582 #define __RSS_UPDATE_CONFIG_RESERVED0_SHIFT 2
2583 #elif defined(__LITTLE_ENDIAN)
2584         u16 flags;
2585 #define RSS_UPDATE_CONFIG_ETH_UPDATE_ENABLE (0x1<<0)
2586 #define RSS_UPDATE_CONFIG_ETH_UPDATE_ENABLE_SHIFT 0
2587 #define RSS_UPDATE_CONFIG_TOE_UPDATE_ENABLE (0x1<<1)
2588 #define RSS_UPDATE_CONFIG_TOE_UPDATE_ENABLE_SHIFT 1
2589 #define __RSS_UPDATE_CONFIG_RESERVED0 (0x3FFF<<2)
2590 #define __RSS_UPDATE_CONFIG_RESERVED0_SHIFT 2
2591         u16 toe_rss_bitmap;
2592 #endif
2593         u32 reserved1;
2594 };
2595
2596 /*
2597  * parameters for eth update ramrod
2598  */
2599 struct eth_update_ramrod_data {
2600         struct tstorm_eth_function_common_config func_config;
2601         u8 indirectionTable[128];
2602         struct rss_update_config rss_config;
2603 };
2604
2605
2606 /*
2607  * MAC filtering configuration command header
2608  */
2609 struct mac_configuration_hdr {
2610         u8 length;
2611         u8 offset;
2612         u16 client_id;
2613         u32 reserved1;
2614 };
2615
2616 /*
2617  * MAC address in list for ramrod
2618  */
2619 struct tstorm_cam_entry {
2620         __le16 lsb_mac_addr;
2621         __le16 middle_mac_addr;
2622         __le16 msb_mac_addr;
2623         __le16 flags;
2624 #define TSTORM_CAM_ENTRY_PORT_ID (0x1<<0)
2625 #define TSTORM_CAM_ENTRY_PORT_ID_SHIFT 0
2626 #define TSTORM_CAM_ENTRY_RSRVVAL0 (0x7<<1)
2627 #define TSTORM_CAM_ENTRY_RSRVVAL0_SHIFT 1
2628 #define TSTORM_CAM_ENTRY_RESERVED0 (0xFFF<<4)
2629 #define TSTORM_CAM_ENTRY_RESERVED0_SHIFT 4
2630 };
2631
2632 /*
2633  * MAC filtering: CAM target table entry
2634  */
2635 struct tstorm_cam_target_table_entry {
2636         u8 flags;
2637 #define TSTORM_CAM_TARGET_TABLE_ENTRY_BROADCAST (0x1<<0)
2638 #define TSTORM_CAM_TARGET_TABLE_ENTRY_BROADCAST_SHIFT 0
2639 #define TSTORM_CAM_TARGET_TABLE_ENTRY_OVERRIDE_VLAN_REMOVAL (0x1<<1)
2640 #define TSTORM_CAM_TARGET_TABLE_ENTRY_OVERRIDE_VLAN_REMOVAL_SHIFT 1
2641 #define TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE (0x1<<2)
2642 #define TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE_SHIFT 2
2643 #define TSTORM_CAM_TARGET_TABLE_ENTRY_RDMA_MAC (0x1<<3)
2644 #define TSTORM_CAM_TARGET_TABLE_ENTRY_RDMA_MAC_SHIFT 3
2645 #define TSTORM_CAM_TARGET_TABLE_ENTRY_RESERVED0 (0xF<<4)
2646 #define TSTORM_CAM_TARGET_TABLE_ENTRY_RESERVED0_SHIFT 4
2647         u8 reserved1;
2648         u16 vlan_id;
2649         u32 clients_bit_vector;
2650 };
2651
2652 /*
2653  * MAC address in list for ramrod
2654  */
2655 struct mac_configuration_entry {
2656         struct tstorm_cam_entry cam_entry;
2657         struct tstorm_cam_target_table_entry target_table_entry;
2658 };
2659
2660 /*
2661  * MAC filtering configuration command
2662  */
2663 struct mac_configuration_cmd {
2664         struct mac_configuration_hdr hdr;
2665         struct mac_configuration_entry config_table[64];
2666 };
2667
2668
2669 /*
2670  * MAC address in list for ramrod
2671  */
2672 struct mac_configuration_entry_e1h {
2673         __le16 lsb_mac_addr;
2674         __le16 middle_mac_addr;
2675         __le16 msb_mac_addr;
2676         __le16 vlan_id;
2677         __le16 e1hov_id;
2678         u8 reserved0;
2679         u8 flags;
2680 #define MAC_CONFIGURATION_ENTRY_E1H_PORT (0x1<<0)
2681 #define MAC_CONFIGURATION_ENTRY_E1H_PORT_SHIFT 0
2682 #define MAC_CONFIGURATION_ENTRY_E1H_ACTION_TYPE (0x1<<1)
2683 #define MAC_CONFIGURATION_ENTRY_E1H_ACTION_TYPE_SHIFT 1
2684 #define MAC_CONFIGURATION_ENTRY_E1H_RDMA_MAC (0x1<<2)
2685 #define MAC_CONFIGURATION_ENTRY_E1H_RDMA_MAC_SHIFT 2
2686 #define MAC_CONFIGURATION_ENTRY_E1H_RESERVED1 (0x1F<<3)
2687 #define MAC_CONFIGURATION_ENTRY_E1H_RESERVED1_SHIFT 3
2688         u32 clients_bit_vector;
2689 };
2690
2691 /*
2692  * MAC filtering configuration command
2693  */
2694 struct mac_configuration_cmd_e1h {
2695         struct mac_configuration_hdr hdr;
2696         struct mac_configuration_entry_e1h config_table[32];
2697 };
2698
2699
2700 /*
2701  * approximate-match multicast filtering for E1H per function in Tstorm
2702  */
2703 struct tstorm_eth_approximate_match_multicast_filtering {
2704         u32 mcast_add_hash_bit_array[8];
2705 };
2706
2707
2708 /*
2709  * Configuration parameters per client in Tstorm
2710  */
2711 struct tstorm_eth_client_config {
2712 #if defined(__BIG_ENDIAN)
2713         u8 reserved0;
2714         u8 statistics_counter_id;
2715         u16 mtu;
2716 #elif defined(__LITTLE_ENDIAN)
2717         u16 mtu;
2718         u8 statistics_counter_id;
2719         u8 reserved0;
2720 #endif
2721 #if defined(__BIG_ENDIAN)
2722         u16 drop_flags;
2723 #define TSTORM_ETH_CLIENT_CONFIG_DROP_IP_CS_ERR (0x1<<0)
2724 #define TSTORM_ETH_CLIENT_CONFIG_DROP_IP_CS_ERR_SHIFT 0
2725 #define TSTORM_ETH_CLIENT_CONFIG_DROP_TCP_CS_ERR (0x1<<1)
2726 #define TSTORM_ETH_CLIENT_CONFIG_DROP_TCP_CS_ERR_SHIFT 1
2727 #define TSTORM_ETH_CLIENT_CONFIG_DROP_TTL0 (0x1<<2)
2728 #define TSTORM_ETH_CLIENT_CONFIG_DROP_TTL0_SHIFT 2
2729 #define TSTORM_ETH_CLIENT_CONFIG_DROP_UDP_CS_ERR (0x1<<3)
2730 #define TSTORM_ETH_CLIENT_CONFIG_DROP_UDP_CS_ERR_SHIFT 3
2731 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED2 (0xFFF<<4)
2732 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED2_SHIFT 4
2733         u16 config_flags;
2734 #define TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE (0x1<<0)
2735 #define TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE_SHIFT 0
2736 #define TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE (0x1<<1)
2737 #define TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE_SHIFT 1
2738 #define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE (0x1<<2)
2739 #define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE_SHIFT 2
2740 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED1 (0x1FFF<<3)
2741 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED1_SHIFT 3
2742 #elif defined(__LITTLE_ENDIAN)
2743         u16 config_flags;
2744 #define TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE (0x1<<0)
2745 #define TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE_SHIFT 0
2746 #define TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE (0x1<<1)
2747 #define TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE_SHIFT 1
2748 #define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE (0x1<<2)
2749 #define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE_SHIFT 2
2750 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED1 (0x1FFF<<3)
2751 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED1_SHIFT 3
2752         u16 drop_flags;
2753 #define TSTORM_ETH_CLIENT_CONFIG_DROP_IP_CS_ERR (0x1<<0)
2754 #define TSTORM_ETH_CLIENT_CONFIG_DROP_IP_CS_ERR_SHIFT 0
2755 #define TSTORM_ETH_CLIENT_CONFIG_DROP_TCP_CS_ERR (0x1<<1)
2756 #define TSTORM_ETH_CLIENT_CONFIG_DROP_TCP_CS_ERR_SHIFT 1
2757 #define TSTORM_ETH_CLIENT_CONFIG_DROP_TTL0 (0x1<<2)
2758 #define TSTORM_ETH_CLIENT_CONFIG_DROP_TTL0_SHIFT 2
2759 #define TSTORM_ETH_CLIENT_CONFIG_DROP_UDP_CS_ERR (0x1<<3)
2760 #define TSTORM_ETH_CLIENT_CONFIG_DROP_UDP_CS_ERR_SHIFT 3
2761 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED2 (0xFFF<<4)
2762 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED2_SHIFT 4
2763 #endif
2764 };
2765
2766
2767 /*
2768  * MAC filtering configuration parameters per port in Tstorm
2769  */
2770 struct tstorm_eth_mac_filter_config {
2771         u32 ucast_drop_all;
2772         u32 ucast_accept_all;
2773         u32 mcast_drop_all;
2774         u32 mcast_accept_all;
2775         u32 bcast_drop_all;
2776         u32 bcast_accept_all;
2777         u32 strict_vlan;
2778         u32 vlan_filter[2];
2779         u32 reserved;
2780 };
2781
2782
2783 /*
2784  * common flag to indicate existance of TPA.
2785  */
2786 struct tstorm_eth_tpa_exist {
2787 #if defined(__BIG_ENDIAN)
2788         u16 reserved1;
2789         u8 reserved0;
2790         u8 tpa_exist;
2791 #elif defined(__LITTLE_ENDIAN)
2792         u8 tpa_exist;
2793         u8 reserved0;
2794         u16 reserved1;
2795 #endif
2796         u32 reserved2;
2797 };
2798
2799
2800 /*
2801  * rx rings pause data for E1h only
2802  */
2803 struct ustorm_eth_rx_pause_data_e1h {
2804 #if defined(__BIG_ENDIAN)
2805         u16 bd_thr_low;
2806         u16 cqe_thr_low;
2807 #elif defined(__LITTLE_ENDIAN)
2808         u16 cqe_thr_low;
2809         u16 bd_thr_low;
2810 #endif
2811 #if defined(__BIG_ENDIAN)
2812         u16 cos;
2813         u16 sge_thr_low;
2814 #elif defined(__LITTLE_ENDIAN)
2815         u16 sge_thr_low;
2816         u16 cos;
2817 #endif
2818 #if defined(__BIG_ENDIAN)
2819         u16 bd_thr_high;
2820         u16 cqe_thr_high;
2821 #elif defined(__LITTLE_ENDIAN)
2822         u16 cqe_thr_high;
2823         u16 bd_thr_high;
2824 #endif
2825 #if defined(__BIG_ENDIAN)
2826         u16 reserved0;
2827         u16 sge_thr_high;
2828 #elif defined(__LITTLE_ENDIAN)
2829         u16 sge_thr_high;
2830         u16 reserved0;
2831 #endif
2832 };
2833
2834
2835 /*
2836  * Three RX producers for ETH
2837  */
2838 struct ustorm_eth_rx_producers {
2839 #if defined(__BIG_ENDIAN)
2840         u16 bd_prod;
2841         u16 cqe_prod;
2842 #elif defined(__LITTLE_ENDIAN)
2843         u16 cqe_prod;
2844         u16 bd_prod;
2845 #endif
2846 #if defined(__BIG_ENDIAN)
2847         u16 reserved;
2848         u16 sge_prod;
2849 #elif defined(__LITTLE_ENDIAN)
2850         u16 sge_prod;
2851         u16 reserved;
2852 #endif
2853 };
2854
2855
2856 /*
2857  * per-port SAFC demo variables
2858  */
2859 struct cmng_flags_per_port {
2860         u8 con_number[NUM_OF_PROTOCOLS];
2861         u32 cmng_enables;
2862 #define CMNG_FLAGS_PER_PORT_FAIRNESS_VN (0x1<<0)
2863 #define CMNG_FLAGS_PER_PORT_FAIRNESS_VN_SHIFT 0
2864 #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN (0x1<<1)
2865 #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN_SHIFT 1
2866 #define CMNG_FLAGS_PER_PORT_FAIRNESS_PROTOCOL (0x1<<2)
2867 #define CMNG_FLAGS_PER_PORT_FAIRNESS_PROTOCOL_SHIFT 2
2868 #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_PROTOCOL (0x1<<3)
2869 #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_PROTOCOL_SHIFT 3
2870 #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS (0x1<<4)
2871 #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_SHIFT 4
2872 #define __CMNG_FLAGS_PER_PORT_RESERVED0 (0x7FFFFFF<<5)
2873 #define __CMNG_FLAGS_PER_PORT_RESERVED0_SHIFT 5
2874 };
2875
2876
2877 /*
2878  * per-port rate shaping variables
2879  */
2880 struct rate_shaping_vars_per_port {
2881         u32 rs_periodic_timeout;
2882         u32 rs_threshold;
2883 };
2884
2885 /*
2886  * per-port fairness variables
2887  */
2888 struct fairness_vars_per_port {
2889         u32 upper_bound;
2890         u32 fair_threshold;
2891         u32 fairness_timeout;
2892 };
2893
2894 /*
2895  * per-port SAFC variables
2896  */
2897 struct safc_struct_per_port {
2898 #if defined(__BIG_ENDIAN)
2899         u16 __reserved1;
2900         u8 __reserved0;
2901         u8 safc_timeout_usec;
2902 #elif defined(__LITTLE_ENDIAN)
2903         u8 safc_timeout_usec;
2904         u8 __reserved0;
2905         u16 __reserved1;
2906 #endif
2907         u16 cos_to_pause_mask[NUM_OF_SAFC_BITS];
2908 };
2909
2910 /*
2911  * Per-port congestion management variables
2912  */
2913 struct cmng_struct_per_port {
2914         struct rate_shaping_vars_per_port rs_vars;
2915         struct fairness_vars_per_port fair_vars;
2916         struct safc_struct_per_port safc_vars;
2917         struct cmng_flags_per_port flags;
2918 };
2919
2920
2921 /*
2922  * Dynamic host coalescing init parameters
2923  */
2924 struct dynamic_hc_config {
2925         u32 threshold[3];
2926         u8 shift_per_protocol[HC_USTORM_SB_NUM_INDICES];
2927         u8 hc_timeout0[HC_USTORM_SB_NUM_INDICES];
2928         u8 hc_timeout1[HC_USTORM_SB_NUM_INDICES];
2929         u8 hc_timeout2[HC_USTORM_SB_NUM_INDICES];
2930         u8 hc_timeout3[HC_USTORM_SB_NUM_INDICES];
2931 };
2932
2933
2934 /*
2935  * Protocol-common statistics collected by the Xstorm (per client)
2936  */
2937 struct xstorm_per_client_stats {
2938         __le32 reserved0;
2939         __le32 unicast_pkts_sent;
2940         struct regpair unicast_bytes_sent;
2941         struct regpair multicast_bytes_sent;
2942         __le32 multicast_pkts_sent;
2943         __le32 broadcast_pkts_sent;
2944         struct regpair broadcast_bytes_sent;
2945         __le16 stats_counter;
2946         __le16 reserved1;
2947         __le32 reserved2;
2948 };
2949
2950 /*
2951  * Common statistics collected by the Xstorm (per port)
2952  */
2953 struct xstorm_common_stats {
2954  struct xstorm_per_client_stats client_statistics[MAX_X_STAT_COUNTER_ID];
2955 };
2956
2957 /*
2958  * Protocol-common statistics collected by the Tstorm (per port)
2959  */
2960 struct tstorm_per_port_stats {
2961         __le32 mac_filter_discard;
2962         __le32 xxoverflow_discard;
2963         __le32 brb_truncate_discard;
2964         __le32 mac_discard;
2965 };
2966
2967 /*
2968  * Protocol-common statistics collected by the Tstorm (per client)
2969  */
2970 struct tstorm_per_client_stats {
2971         struct regpair rcv_unicast_bytes;
2972         struct regpair rcv_broadcast_bytes;
2973         struct regpair rcv_multicast_bytes;
2974         struct regpair rcv_error_bytes;
2975         __le32 checksum_discard;
2976         __le32 packets_too_big_discard;
2977         __le32 rcv_unicast_pkts;
2978         __le32 rcv_broadcast_pkts;
2979         __le32 rcv_multicast_pkts;
2980         __le32 no_buff_discard;
2981         __le32 ttl0_discard;
2982         __le16 stats_counter;
2983         __le16 reserved0;
2984 };
2985
2986 /*
2987  * Protocol-common statistics collected by the Tstorm
2988  */
2989 struct tstorm_common_stats {
2990         struct tstorm_per_port_stats port_statistics;
2991  struct tstorm_per_client_stats client_statistics[MAX_T_STAT_COUNTER_ID];
2992 };
2993
2994 /*
2995  * Protocol-common statistics collected by the Ustorm (per client)
2996  */
2997 struct ustorm_per_client_stats {
2998         struct regpair ucast_no_buff_bytes;
2999         struct regpair mcast_no_buff_bytes;
3000         struct regpair bcast_no_buff_bytes;
3001         __le32 ucast_no_buff_pkts;
3002         __le32 mcast_no_buff_pkts;
3003         __le32 bcast_no_buff_pkts;
3004         __le16 stats_counter;
3005         __le16 reserved0;
3006 };
3007
3008 /*
3009  * Protocol-common statistics collected by the Ustorm
3010  */
3011 struct ustorm_common_stats {
3012  struct ustorm_per_client_stats client_statistics[MAX_U_STAT_COUNTER_ID];
3013 };
3014
3015 /*
3016  * Eth statistics query structure for the eth_stats_query ramrod
3017  */
3018 struct eth_stats_query {
3019         struct xstorm_common_stats xstorm_common;
3020         struct tstorm_common_stats tstorm_common;
3021         struct ustorm_common_stats ustorm_common;
3022 };
3023
3024
3025 /*
3026  * per-vnic fairness variables
3027  */
3028 struct fairness_vars_per_vn {
3029         u32 cos_credit_delta[MAX_COS_NUMBER];
3030         u32 protocol_credit_delta[NUM_OF_PROTOCOLS];
3031         u32 vn_credit_delta;
3032         u32 __reserved0;
3033 };
3034
3035
3036 /*
3037  * FW version stored in the Xstorm RAM
3038  */
3039 struct fw_version {
3040 #if defined(__BIG_ENDIAN)
3041         u8 engineering;
3042         u8 revision;
3043         u8 minor;
3044         u8 major;
3045 #elif defined(__LITTLE_ENDIAN)
3046         u8 major;
3047         u8 minor;
3048         u8 revision;
3049         u8 engineering;
3050 #endif
3051         u32 flags;
3052 #define FW_VERSION_OPTIMIZED (0x1<<0)
3053 #define FW_VERSION_OPTIMIZED_SHIFT 0
3054 #define FW_VERSION_BIG_ENDIEN (0x1<<1)
3055 #define FW_VERSION_BIG_ENDIEN_SHIFT 1
3056 #define FW_VERSION_CHIP_VERSION (0x3<<2)
3057 #define FW_VERSION_CHIP_VERSION_SHIFT 2
3058 #define __FW_VERSION_RESERVED (0xFFFFFFF<<4)
3059 #define __FW_VERSION_RESERVED_SHIFT 4
3060 };
3061
3062
3063 /*
3064  * FW version stored in first line of pram
3065  */
3066 struct pram_fw_version {
3067         u8 major;
3068         u8 minor;
3069         u8 revision;
3070         u8 engineering;
3071         u8 flags;
3072 #define PRAM_FW_VERSION_OPTIMIZED (0x1<<0)
3073 #define PRAM_FW_VERSION_OPTIMIZED_SHIFT 0
3074 #define PRAM_FW_VERSION_STORM_ID (0x3<<1)
3075 #define PRAM_FW_VERSION_STORM_ID_SHIFT 1
3076 #define PRAM_FW_VERSION_BIG_ENDIEN (0x1<<3)
3077 #define PRAM_FW_VERSION_BIG_ENDIEN_SHIFT 3
3078 #define PRAM_FW_VERSION_CHIP_VERSION (0x3<<4)
3079 #define PRAM_FW_VERSION_CHIP_VERSION_SHIFT 4
3080 #define __PRAM_FW_VERSION_RESERVED0 (0x3<<6)
3081 #define __PRAM_FW_VERSION_RESERVED0_SHIFT 6
3082 };
3083
3084
3085 /*
3086  * The send queue element
3087  */
3088 struct protocol_common_spe {
3089         struct spe_hdr hdr;
3090         struct regpair phy_address;
3091 };
3092
3093
3094 /*
3095  * a single rate shaping counter. can be used as protocol or vnic counter
3096  */
3097 struct rate_shaping_counter {
3098         u32 quota;
3099 #if defined(__BIG_ENDIAN)
3100         u16 __reserved0;
3101         u16 rate;
3102 #elif defined(__LITTLE_ENDIAN)
3103         u16 rate;
3104         u16 __reserved0;
3105 #endif
3106 };
3107
3108
3109 /*
3110  * per-vnic rate shaping variables
3111  */
3112 struct rate_shaping_vars_per_vn {
3113         struct rate_shaping_counter protocol_counters[NUM_OF_PROTOCOLS];
3114         struct rate_shaping_counter vn_counter;
3115 };
3116
3117
3118 /*
3119  * The send queue element
3120  */
3121 struct slow_path_element {
3122         struct spe_hdr hdr;
3123         u8 protocol_data[8];
3124 };
3125
3126
3127 /*
3128  * eth/toe flags that indicate if to query
3129  */
3130 struct stats_indication_flags {
3131         u32 collect_eth;
3132         u32 collect_toe;
3133 };
3134
3135