xref: /linux/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 /* bnx2x_hsi.h: Qlogic Everest network driver.
2  *
3  * Copyright (c) 2007-2013 Broadcom Corporation
4  * Copyright (c) 2014 QLogic Corporation
5  * All rights reserved
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation.
10  */
11 #ifndef BNX2X_HSI_H
12 #define BNX2X_HSI_H
13 
14 #include "bnx2x_fw_defs.h"
15 #include "bnx2x_mfw_req.h"
16 
17 #define FW_ENCODE_32BIT_PATTERN         0x1e1e1e1e
18 
19 struct license_key {
20 	u32 reserved[6];
21 
22 	u32 max_iscsi_conn;
23 #define BNX2X_MAX_ISCSI_TRGT_CONN_MASK	0xFFFF
24 #define BNX2X_MAX_ISCSI_TRGT_CONN_SHIFT	0
25 #define BNX2X_MAX_ISCSI_INIT_CONN_MASK	0xFFFF0000
26 #define BNX2X_MAX_ISCSI_INIT_CONN_SHIFT	16
27 
28 	u32 reserved_a;
29 
30 	u32 max_fcoe_conn;
31 #define BNX2X_MAX_FCOE_TRGT_CONN_MASK	0xFFFF
32 #define BNX2X_MAX_FCOE_TRGT_CONN_SHIFT	0
33 #define BNX2X_MAX_FCOE_INIT_CONN_MASK	0xFFFF0000
34 #define BNX2X_MAX_FCOE_INIT_CONN_SHIFT	16
35 
36 	u32 reserved_b[4];
37 };
38 
39 /****************************************************************************
40  * Shared HW configuration                                                  *
41  ****************************************************************************/
42 #define PIN_CFG_NA                          0x00000000
43 #define PIN_CFG_GPIO0_P0                    0x00000001
44 #define PIN_CFG_GPIO1_P0                    0x00000002
45 #define PIN_CFG_GPIO2_P0                    0x00000003
46 #define PIN_CFG_GPIO3_P0                    0x00000004
47 #define PIN_CFG_GPIO0_P1                    0x00000005
48 #define PIN_CFG_GPIO1_P1                    0x00000006
49 #define PIN_CFG_GPIO2_P1                    0x00000007
50 #define PIN_CFG_GPIO3_P1                    0x00000008
51 #define PIN_CFG_EPIO0                       0x00000009
52 #define PIN_CFG_EPIO1                       0x0000000a
53 #define PIN_CFG_EPIO2                       0x0000000b
54 #define PIN_CFG_EPIO3                       0x0000000c
55 #define PIN_CFG_EPIO4                       0x0000000d
56 #define PIN_CFG_EPIO5                       0x0000000e
57 #define PIN_CFG_EPIO6                       0x0000000f
58 #define PIN_CFG_EPIO7                       0x00000010
59 #define PIN_CFG_EPIO8                       0x00000011
60 #define PIN_CFG_EPIO9                       0x00000012
61 #define PIN_CFG_EPIO10                      0x00000013
62 #define PIN_CFG_EPIO11                      0x00000014
63 #define PIN_CFG_EPIO12                      0x00000015
64 #define PIN_CFG_EPIO13                      0x00000016
65 #define PIN_CFG_EPIO14                      0x00000017
66 #define PIN_CFG_EPIO15                      0x00000018
67 #define PIN_CFG_EPIO16                      0x00000019
68 #define PIN_CFG_EPIO17                      0x0000001a
69 #define PIN_CFG_EPIO18                      0x0000001b
70 #define PIN_CFG_EPIO19                      0x0000001c
71 #define PIN_CFG_EPIO20                      0x0000001d
72 #define PIN_CFG_EPIO21                      0x0000001e
73 #define PIN_CFG_EPIO22                      0x0000001f
74 #define PIN_CFG_EPIO23                      0x00000020
75 #define PIN_CFG_EPIO24                      0x00000021
76 #define PIN_CFG_EPIO25                      0x00000022
77 #define PIN_CFG_EPIO26                      0x00000023
78 #define PIN_CFG_EPIO27                      0x00000024
79 #define PIN_CFG_EPIO28                      0x00000025
80 #define PIN_CFG_EPIO29                      0x00000026
81 #define PIN_CFG_EPIO30                      0x00000027
82 #define PIN_CFG_EPIO31                      0x00000028
83 
84 /* EPIO definition */
85 #define EPIO_CFG_NA                         0x00000000
86 #define EPIO_CFG_EPIO0                      0x00000001
87 #define EPIO_CFG_EPIO1                      0x00000002
88 #define EPIO_CFG_EPIO2                      0x00000003
89 #define EPIO_CFG_EPIO3                      0x00000004
90 #define EPIO_CFG_EPIO4                      0x00000005
91 #define EPIO_CFG_EPIO5                      0x00000006
92 #define EPIO_CFG_EPIO6                      0x00000007
93 #define EPIO_CFG_EPIO7                      0x00000008
94 #define EPIO_CFG_EPIO8                      0x00000009
95 #define EPIO_CFG_EPIO9                      0x0000000a
96 #define EPIO_CFG_EPIO10                     0x0000000b
97 #define EPIO_CFG_EPIO11                     0x0000000c
98 #define EPIO_CFG_EPIO12                     0x0000000d
99 #define EPIO_CFG_EPIO13                     0x0000000e
100 #define EPIO_CFG_EPIO14                     0x0000000f
101 #define EPIO_CFG_EPIO15                     0x00000010
102 #define EPIO_CFG_EPIO16                     0x00000011
103 #define EPIO_CFG_EPIO17                     0x00000012
104 #define EPIO_CFG_EPIO18                     0x00000013
105 #define EPIO_CFG_EPIO19                     0x00000014
106 #define EPIO_CFG_EPIO20                     0x00000015
107 #define EPIO_CFG_EPIO21                     0x00000016
108 #define EPIO_CFG_EPIO22                     0x00000017
109 #define EPIO_CFG_EPIO23                     0x00000018
110 #define EPIO_CFG_EPIO24                     0x00000019
111 #define EPIO_CFG_EPIO25                     0x0000001a
112 #define EPIO_CFG_EPIO26                     0x0000001b
113 #define EPIO_CFG_EPIO27                     0x0000001c
114 #define EPIO_CFG_EPIO28                     0x0000001d
115 #define EPIO_CFG_EPIO29                     0x0000001e
116 #define EPIO_CFG_EPIO30                     0x0000001f
117 #define EPIO_CFG_EPIO31                     0x00000020
118 
119 struct mac_addr {
120 	u32 upper;
121 	u32 lower;
122 };
123 
124 struct shared_hw_cfg {			 /* NVRAM Offset */
125 	/* Up to 16 bytes of NULL-terminated string */
126 	u8  part_num[16];		    /* 0x104 */
127 
128 	u32 config;			/* 0x114 */
129 	#define SHARED_HW_CFG_MDIO_VOLTAGE_MASK             0x00000001
130 		#define SHARED_HW_CFG_MDIO_VOLTAGE_SHIFT             0
131 		#define SHARED_HW_CFG_MDIO_VOLTAGE_1_2V              0x00000000
132 		#define SHARED_HW_CFG_MDIO_VOLTAGE_2_5V              0x00000001
133 	#define SHARED_HW_CFG_MCP_RST_ON_CORE_RST_EN        0x00000002
134 
135 	#define SHARED_HW_CFG_PORT_SWAP                     0x00000004
136 
137 	#define SHARED_HW_CFG_BEACON_WOL_EN                 0x00000008
138 
139 	#define SHARED_HW_CFG_PCIE_GEN3_DISABLED            0x00000000
140 	#define SHARED_HW_CFG_PCIE_GEN3_ENABLED             0x00000010
141 
142 	#define SHARED_HW_CFG_MFW_SELECT_MASK               0x00000700
143 		#define SHARED_HW_CFG_MFW_SELECT_SHIFT               8
144 	/* Whatever MFW found in NVM
145 	   (if multiple found, priority order is: NC-SI, UMP, IPMI) */
146 		#define SHARED_HW_CFG_MFW_SELECT_DEFAULT             0x00000000
147 		#define SHARED_HW_CFG_MFW_SELECT_NC_SI               0x00000100
148 		#define SHARED_HW_CFG_MFW_SELECT_UMP                 0x00000200
149 		#define SHARED_HW_CFG_MFW_SELECT_IPMI                0x00000300
150 	/* Use SPIO4 as an arbiter between: 0-NC_SI, 1-IPMI
151 	  (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
152 		#define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_IPMI    0x00000400
153 	/* Use SPIO4 as an arbiter between: 0-UMP, 1-IPMI
154 	  (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
155 		#define SHARED_HW_CFG_MFW_SELECT_SPIO4_UMP_IPMI      0x00000500
156 	/* Use SPIO4 as an arbiter between: 0-NC-SI, 1-UMP
157 	  (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
158 		#define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_UMP     0x00000600
159 
160 	#define SHARED_HW_CFG_LED_MODE_MASK                 0x000f0000
161 		#define SHARED_HW_CFG_LED_MODE_SHIFT                 16
162 		#define SHARED_HW_CFG_LED_MAC1                       0x00000000
163 		#define SHARED_HW_CFG_LED_PHY1                       0x00010000
164 		#define SHARED_HW_CFG_LED_PHY2                       0x00020000
165 		#define SHARED_HW_CFG_LED_PHY3                       0x00030000
166 		#define SHARED_HW_CFG_LED_MAC2                       0x00040000
167 		#define SHARED_HW_CFG_LED_PHY4                       0x00050000
168 		#define SHARED_HW_CFG_LED_PHY5                       0x00060000
169 		#define SHARED_HW_CFG_LED_PHY6                       0x00070000
170 		#define SHARED_HW_CFG_LED_MAC3                       0x00080000
171 		#define SHARED_HW_CFG_LED_PHY7                       0x00090000
172 		#define SHARED_HW_CFG_LED_PHY9                       0x000a0000
173 		#define SHARED_HW_CFG_LED_PHY11                      0x000b0000
174 		#define SHARED_HW_CFG_LED_MAC4                       0x000c0000
175 		#define SHARED_HW_CFG_LED_PHY8                       0x000d0000
176 		#define SHARED_HW_CFG_LED_EXTPHY1                    0x000e0000
177 		#define SHARED_HW_CFG_LED_EXTPHY2                    0x000f0000
178 
179 
180 	#define SHARED_HW_CFG_AN_ENABLE_MASK                0x3f000000
181 		#define SHARED_HW_CFG_AN_ENABLE_SHIFT                24
182 		#define SHARED_HW_CFG_AN_ENABLE_CL37                 0x01000000
183 		#define SHARED_HW_CFG_AN_ENABLE_CL73                 0x02000000
184 		#define SHARED_HW_CFG_AN_ENABLE_BAM                  0x04000000
185 		#define SHARED_HW_CFG_AN_ENABLE_PARALLEL_DETECTION   0x08000000
186 		#define SHARED_HW_CFG_AN_EN_SGMII_FIBER_AUTO_DETECT  0x10000000
187 		#define SHARED_HW_CFG_AN_ENABLE_REMOTE_PHY           0x20000000
188 
189 	#define SHARED_HW_CFG_SRIOV_MASK                    0x40000000
190 		#define SHARED_HW_CFG_SRIOV_DISABLED                 0x00000000
191 		#define SHARED_HW_CFG_SRIOV_ENABLED                  0x40000000
192 
193 	#define SHARED_HW_CFG_ATC_MASK                      0x80000000
194 		#define SHARED_HW_CFG_ATC_DISABLED                   0x00000000
195 		#define SHARED_HW_CFG_ATC_ENABLED                    0x80000000
196 
197 	u32 config2;			    /* 0x118 */
198 	/* one time auto detect grace period (in sec) */
199 	#define SHARED_HW_CFG_GRACE_PERIOD_MASK             0x000000ff
200 	#define SHARED_HW_CFG_GRACE_PERIOD_SHIFT                     0
201 
202 	#define SHARED_HW_CFG_PCIE_GEN2_ENABLED             0x00000100
203 	#define SHARED_HW_CFG_PCIE_GEN2_DISABLED            0x00000000
204 
205 	/* The default value for the core clock is 250MHz and it is
206 	   achieved by setting the clock change to 4 */
207 	#define SHARED_HW_CFG_CLOCK_CHANGE_MASK             0x00000e00
208 	#define SHARED_HW_CFG_CLOCK_CHANGE_SHIFT                     9
209 
210 	#define SHARED_HW_CFG_SMBUS_TIMING_MASK             0x00001000
211 		#define SHARED_HW_CFG_SMBUS_TIMING_100KHZ            0x00000000
212 		#define SHARED_HW_CFG_SMBUS_TIMING_400KHZ            0x00001000
213 
214 	#define SHARED_HW_CFG_HIDE_PORT1                    0x00002000
215 
216 	#define SHARED_HW_CFG_WOL_CAPABLE_MASK              0x00004000
217 		#define SHARED_HW_CFG_WOL_CAPABLE_DISABLED           0x00000000
218 		#define SHARED_HW_CFG_WOL_CAPABLE_ENABLED            0x00004000
219 
220 		/* Output low when PERST is asserted */
221 	#define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_MASK       0x00008000
222 		#define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_DISABLED    0x00000000
223 		#define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_ENABLED     0x00008000
224 
225 	#define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_MASK    0x00070000
226 		#define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_SHIFT    16
227 		#define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_HW       0x00000000
228 		#define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_0DB      0x00010000
229 		#define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_3_5DB    0x00020000
230 		#define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_6_0DB    0x00030000
231 
232 	/*  The fan failure mechanism is usually related to the PHY type
233 	      since the power consumption of the board is determined by the PHY.
234 	      Currently, fan is required for most designs with SFX7101, BCM8727
235 	      and BCM8481. If a fan is not required for a board which uses one
236 	      of those PHYs, this field should be set to "Disabled". If a fan is
237 	      required for a different PHY type, this option should be set to
238 	      "Enabled". The fan failure indication is expected on SPIO5 */
239 	#define SHARED_HW_CFG_FAN_FAILURE_MASK              0x00180000
240 		#define SHARED_HW_CFG_FAN_FAILURE_SHIFT              19
241 		#define SHARED_HW_CFG_FAN_FAILURE_PHY_TYPE           0x00000000
242 		#define SHARED_HW_CFG_FAN_FAILURE_DISABLED           0x00080000
243 		#define SHARED_HW_CFG_FAN_FAILURE_ENABLED            0x00100000
244 
245 		/* ASPM Power Management support */
246 	#define SHARED_HW_CFG_ASPM_SUPPORT_MASK             0x00600000
247 		#define SHARED_HW_CFG_ASPM_SUPPORT_SHIFT             21
248 		#define SHARED_HW_CFG_ASPM_SUPPORT_L0S_L1_ENABLED    0x00000000
249 		#define SHARED_HW_CFG_ASPM_SUPPORT_L0S_DISABLED      0x00200000
250 		#define SHARED_HW_CFG_ASPM_SUPPORT_L1_DISABLED       0x00400000
251 		#define SHARED_HW_CFG_ASPM_SUPPORT_L0S_L1_DISABLED   0x00600000
252 
253 	/* The value of PM_TL_IGNORE_REQS (bit0) in PCI register
254 	   tl_control_0 (register 0x2800) */
255 	#define SHARED_HW_CFG_PREVENT_L1_ENTRY_MASK         0x00800000
256 		#define SHARED_HW_CFG_PREVENT_L1_ENTRY_DISABLED      0x00000000
257 		#define SHARED_HW_CFG_PREVENT_L1_ENTRY_ENABLED       0x00800000
258 
259 	#define SHARED_HW_CFG_PORT_MODE_MASK                0x01000000
260 		#define SHARED_HW_CFG_PORT_MODE_2                    0x00000000
261 		#define SHARED_HW_CFG_PORT_MODE_4                    0x01000000
262 
263 	#define SHARED_HW_CFG_PATH_SWAP_MASK                0x02000000
264 		#define SHARED_HW_CFG_PATH_SWAP_DISABLED             0x00000000
265 		#define SHARED_HW_CFG_PATH_SWAP_ENABLED              0x02000000
266 
267 	/*  Set the MDC/MDIO access for the first external phy */
268 	#define SHARED_HW_CFG_MDC_MDIO_ACCESS1_MASK         0x1C000000
269 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS1_SHIFT         26
270 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS1_PHY_TYPE      0x00000000
271 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS1_EMAC0         0x04000000
272 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS1_EMAC1         0x08000000
273 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS1_BOTH          0x0c000000
274 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS1_SWAPPED       0x10000000
275 
276 	/*  Set the MDC/MDIO access for the second external phy */
277 	#define SHARED_HW_CFG_MDC_MDIO_ACCESS2_MASK         0xE0000000
278 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS2_SHIFT         29
279 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS2_PHY_TYPE      0x00000000
280 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS2_EMAC0         0x20000000
281 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS2_EMAC1         0x40000000
282 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS2_BOTH          0x60000000
283 		#define SHARED_HW_CFG_MDC_MDIO_ACCESS2_SWAPPED       0x80000000
284 
285 	u32 config_3;				/* 0x11C */
286 	#define SHARED_HW_CFG_EXTENDED_MF_MODE_MASK         0x00000F00
287 		#define SHARED_HW_CFG_EXTENDED_MF_MODE_SHIFT              8
288 		#define SHARED_HW_CFG_EXTENDED_MF_MODE_NPAR1_DOT_5        0x00000000
289 		#define SHARED_HW_CFG_EXTENDED_MF_MODE_NPAR2_DOT_0        0x00000100
290 
291 	u32 ump_nc_si_config;			/* 0x120 */
292 	#define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MASK       0x00000003
293 		#define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_SHIFT       0
294 		#define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MAC         0x00000000
295 		#define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_PHY         0x00000001
296 		#define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MII         0x00000000
297 		#define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_RMII        0x00000002
298 
299 	#define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_MASK       0x00000f00
300 		#define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_SHIFT       8
301 
302 	#define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_MASK   0x00ff0000
303 		#define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_SHIFT   16
304 		#define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_NONE    0x00000000
305 		#define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_BCM5221 0x00010000
306 
307 	u32 board;			/* 0x124 */
308 	#define SHARED_HW_CFG_E3_I2C_MUX0_MASK              0x0000003F
309 	#define SHARED_HW_CFG_E3_I2C_MUX0_SHIFT                      0
310 	#define SHARED_HW_CFG_E3_I2C_MUX1_MASK              0x00000FC0
311 	#define SHARED_HW_CFG_E3_I2C_MUX1_SHIFT                      6
312 	/* Use the PIN_CFG_XXX defines on top */
313 	#define SHARED_HW_CFG_BOARD_REV_MASK                0x00ff0000
314 	#define SHARED_HW_CFG_BOARD_REV_SHIFT                        16
315 
316 	#define SHARED_HW_CFG_BOARD_MAJOR_VER_MASK          0x0f000000
317 	#define SHARED_HW_CFG_BOARD_MAJOR_VER_SHIFT                  24
318 
319 	#define SHARED_HW_CFG_BOARD_MINOR_VER_MASK          0xf0000000
320 	#define SHARED_HW_CFG_BOARD_MINOR_VER_SHIFT                  28
321 
322 	u32 wc_lane_config;				    /* 0x128 */
323 	#define SHARED_HW_CFG_LANE_SWAP_CFG_MASK            0x0000FFFF
324 		#define SHARED_HW_CFG_LANE_SWAP_CFG_SHIFT            0
325 		#define SHARED_HW_CFG_LANE_SWAP_CFG_32103210         0x00001b1b
326 		#define SHARED_HW_CFG_LANE_SWAP_CFG_32100123         0x00001be4
327 		#define SHARED_HW_CFG_LANE_SWAP_CFG_01233210         0x0000e41b
328 		#define SHARED_HW_CFG_LANE_SWAP_CFG_01230123         0x0000e4e4
329 	#define SHARED_HW_CFG_LANE_SWAP_CFG_TX_MASK         0x000000FF
330 	#define SHARED_HW_CFG_LANE_SWAP_CFG_TX_SHIFT                 0
331 	#define SHARED_HW_CFG_LANE_SWAP_CFG_RX_MASK         0x0000FF00
332 	#define SHARED_HW_CFG_LANE_SWAP_CFG_RX_SHIFT                 8
333 
334 	/* TX lane Polarity swap */
335 	#define SHARED_HW_CFG_TX_LANE0_POL_FLIP_ENABLED     0x00010000
336 	#define SHARED_HW_CFG_TX_LANE1_POL_FLIP_ENABLED     0x00020000
337 	#define SHARED_HW_CFG_TX_LANE2_POL_FLIP_ENABLED     0x00040000
338 	#define SHARED_HW_CFG_TX_LANE3_POL_FLIP_ENABLED     0x00080000
339 	/* TX lane Polarity swap */
340 	#define SHARED_HW_CFG_RX_LANE0_POL_FLIP_ENABLED     0x00100000
341 	#define SHARED_HW_CFG_RX_LANE1_POL_FLIP_ENABLED     0x00200000
342 	#define SHARED_HW_CFG_RX_LANE2_POL_FLIP_ENABLED     0x00400000
343 	#define SHARED_HW_CFG_RX_LANE3_POL_FLIP_ENABLED     0x00800000
344 
345 	/*  Selects the port layout of the board */
346 	#define SHARED_HW_CFG_E3_PORT_LAYOUT_MASK           0x0F000000
347 		#define SHARED_HW_CFG_E3_PORT_LAYOUT_SHIFT           24
348 		#define SHARED_HW_CFG_E3_PORT_LAYOUT_2P_01           0x00000000
349 		#define SHARED_HW_CFG_E3_PORT_LAYOUT_2P_10           0x01000000
350 		#define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_0123         0x02000000
351 		#define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_1032         0x03000000
352 		#define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_2301         0x04000000
353 		#define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_3210         0x05000000
354 };
355 
356 
357 /****************************************************************************
358  * Port HW configuration                                                    *
359  ****************************************************************************/
360 struct port_hw_cfg {		    /* port 0: 0x12c  port 1: 0x2bc */
361 
362 	u32 pci_id;
363 	#define PORT_HW_CFG_PCI_VENDOR_ID_MASK              0xffff0000
364 	#define PORT_HW_CFG_PCI_DEVICE_ID_MASK              0x0000ffff
365 
366 	u32 pci_sub_id;
367 	#define PORT_HW_CFG_PCI_SUBSYS_DEVICE_ID_MASK       0xffff0000
368 	#define PORT_HW_CFG_PCI_SUBSYS_VENDOR_ID_MASK       0x0000ffff
369 
370 	u32 power_dissipated;
371 	#define PORT_HW_CFG_POWER_DIS_D0_MASK               0x000000ff
372 	#define PORT_HW_CFG_POWER_DIS_D0_SHIFT                       0
373 	#define PORT_HW_CFG_POWER_DIS_D1_MASK               0x0000ff00
374 	#define PORT_HW_CFG_POWER_DIS_D1_SHIFT                       8
375 	#define PORT_HW_CFG_POWER_DIS_D2_MASK               0x00ff0000
376 	#define PORT_HW_CFG_POWER_DIS_D2_SHIFT                       16
377 	#define PORT_HW_CFG_POWER_DIS_D3_MASK               0xff000000
378 	#define PORT_HW_CFG_POWER_DIS_D3_SHIFT                       24
379 
380 	u32 power_consumed;
381 	#define PORT_HW_CFG_POWER_CONS_D0_MASK              0x000000ff
382 	#define PORT_HW_CFG_POWER_CONS_D0_SHIFT                      0
383 	#define PORT_HW_CFG_POWER_CONS_D1_MASK              0x0000ff00
384 	#define PORT_HW_CFG_POWER_CONS_D1_SHIFT                      8
385 	#define PORT_HW_CFG_POWER_CONS_D2_MASK              0x00ff0000
386 	#define PORT_HW_CFG_POWER_CONS_D2_SHIFT                      16
387 	#define PORT_HW_CFG_POWER_CONS_D3_MASK              0xff000000
388 	#define PORT_HW_CFG_POWER_CONS_D3_SHIFT                      24
389 
390 	u32 mac_upper;
391 	#define PORT_HW_CFG_UPPERMAC_MASK                   0x0000ffff
392 	#define PORT_HW_CFG_UPPERMAC_SHIFT                           0
393 	u32 mac_lower;
394 
395 	u32 iscsi_mac_upper;  /* Upper 16 bits are always zeroes */
396 	u32 iscsi_mac_lower;
397 
398 	u32 rdma_mac_upper;   /* Upper 16 bits are always zeroes */
399 	u32 rdma_mac_lower;
400 
401 	u32 serdes_config;
402 	#define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_MASK 0x0000ffff
403 	#define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_SHIFT         0
404 
405 	#define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_MASK    0xffff0000
406 	#define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT            16
407 
408 
409 	/*  Default values: 2P-64, 4P-32 */
410 	u32 pf_config;					    /* 0x158 */
411 	#define PORT_HW_CFG_PF_NUM_VF_MASK                  0x0000007F
412 	#define PORT_HW_CFG_PF_NUM_VF_SHIFT                          0
413 
414 	/*  Default values: 17 */
415 	#define PORT_HW_CFG_PF_NUM_MSIX_VECTORS_MASK        0x00007F00
416 	#define PORT_HW_CFG_PF_NUM_MSIX_VECTORS_SHIFT                8
417 
418 	#define PORT_HW_CFG_ENABLE_FLR_MASK                 0x00010000
419 	#define PORT_HW_CFG_FLR_ENABLED                     0x00010000
420 
421 	u32 vf_config;					    /* 0x15C */
422 	#define PORT_HW_CFG_VF_NUM_MSIX_VECTORS_MASK        0x0000007F
423 	#define PORT_HW_CFG_VF_NUM_MSIX_VECTORS_SHIFT                0
424 
425 	#define PORT_HW_CFG_VF_PCI_DEVICE_ID_MASK           0xFFFF0000
426 	#define PORT_HW_CFG_VF_PCI_DEVICE_ID_SHIFT                   16
427 
428 	u32 mf_pci_id;					    /* 0x160 */
429 	#define PORT_HW_CFG_MF_PCI_DEVICE_ID_MASK           0x0000FFFF
430 	#define PORT_HW_CFG_MF_PCI_DEVICE_ID_SHIFT                   0
431 
432 	/*  Controls the TX laser of the SFP+ module */
433 	u32 sfp_ctrl;					    /* 0x164 */
434 	#define PORT_HW_CFG_TX_LASER_MASK                   0x000000FF
435 		#define PORT_HW_CFG_TX_LASER_SHIFT                   0
436 		#define PORT_HW_CFG_TX_LASER_MDIO                    0x00000000
437 		#define PORT_HW_CFG_TX_LASER_GPIO0                   0x00000001
438 		#define PORT_HW_CFG_TX_LASER_GPIO1                   0x00000002
439 		#define PORT_HW_CFG_TX_LASER_GPIO2                   0x00000003
440 		#define PORT_HW_CFG_TX_LASER_GPIO3                   0x00000004
441 
442 	/*  Controls the fault module LED of the SFP+ */
443 	#define PORT_HW_CFG_FAULT_MODULE_LED_MASK           0x0000FF00
444 		#define PORT_HW_CFG_FAULT_MODULE_LED_SHIFT           8
445 		#define PORT_HW_CFG_FAULT_MODULE_LED_GPIO0           0x00000000
446 		#define PORT_HW_CFG_FAULT_MODULE_LED_GPIO1           0x00000100
447 		#define PORT_HW_CFG_FAULT_MODULE_LED_GPIO2           0x00000200
448 		#define PORT_HW_CFG_FAULT_MODULE_LED_GPIO3           0x00000300
449 		#define PORT_HW_CFG_FAULT_MODULE_LED_DISABLED        0x00000400
450 
451 	/*  The output pin TX_DIS that controls the TX laser of the SFP+
452 	  module. Use the PIN_CFG_XXX defines on top */
453 	u32 e3_sfp_ctrl;				    /* 0x168 */
454 	#define PORT_HW_CFG_E3_TX_LASER_MASK                0x000000FF
455 	#define PORT_HW_CFG_E3_TX_LASER_SHIFT                        0
456 
457 	/*  The output pin for SFPP_TYPE which turns on the Fault module LED */
458 	#define PORT_HW_CFG_E3_FAULT_MDL_LED_MASK           0x0000FF00
459 	#define PORT_HW_CFG_E3_FAULT_MDL_LED_SHIFT                   8
460 
461 	/*  The input pin MOD_ABS that indicates whether SFP+ module is
462 	  present or not. Use the PIN_CFG_XXX defines on top */
463 	#define PORT_HW_CFG_E3_MOD_ABS_MASK                 0x00FF0000
464 	#define PORT_HW_CFG_E3_MOD_ABS_SHIFT                         16
465 
466 	/*  The output pin PWRDIS_SFP_X which disable the power of the SFP+
467 	  module. Use the PIN_CFG_XXX defines on top */
468 	#define PORT_HW_CFG_E3_PWR_DIS_MASK                 0xFF000000
469 	#define PORT_HW_CFG_E3_PWR_DIS_SHIFT                         24
470 
471 	/*
472 	 * The input pin which signals module transmit fault. Use the
473 	 * PIN_CFG_XXX defines on top
474 	 */
475 	u32 e3_cmn_pin_cfg;				    /* 0x16C */
476 	#define PORT_HW_CFG_E3_TX_FAULT_MASK                0x000000FF
477 	#define PORT_HW_CFG_E3_TX_FAULT_SHIFT                        0
478 
479 	/*  The output pin which reset the PHY. Use the PIN_CFG_XXX defines on
480 	 top */
481 	#define PORT_HW_CFG_E3_PHY_RESET_MASK               0x0000FF00
482 	#define PORT_HW_CFG_E3_PHY_RESET_SHIFT                       8
483 
484 	/*
485 	 * The output pin which powers down the PHY. Use the PIN_CFG_XXX
486 	 * defines on top
487 	 */
488 	#define PORT_HW_CFG_E3_PWR_DOWN_MASK                0x00FF0000
489 	#define PORT_HW_CFG_E3_PWR_DOWN_SHIFT                        16
490 
491 	/*  The output pin values BSC_SEL which selects the I2C for this port
492 	  in the I2C Mux */
493 	#define PORT_HW_CFG_E3_I2C_MUX0_MASK                0x01000000
494 	#define PORT_HW_CFG_E3_I2C_MUX1_MASK                0x02000000
495 
496 
497 	/*
498 	 * The input pin I_FAULT which indicate over-current has occurred.
499 	 * Use the PIN_CFG_XXX defines on top
500 	 */
501 	u32 e3_cmn_pin_cfg1;				    /* 0x170 */
502 	#define PORT_HW_CFG_E3_OVER_CURRENT_MASK            0x000000FF
503 	#define PORT_HW_CFG_E3_OVER_CURRENT_SHIFT                    0
504 
505 	/*  pause on host ring */
506 	u32 generic_features;                               /* 0x174 */
507 	#define PORT_HW_CFG_PAUSE_ON_HOST_RING_MASK                   0x00000001
508 	#define PORT_HW_CFG_PAUSE_ON_HOST_RING_SHIFT                  0
509 	#define PORT_HW_CFG_PAUSE_ON_HOST_RING_DISABLED               0x00000000
510 	#define PORT_HW_CFG_PAUSE_ON_HOST_RING_ENABLED                0x00000001
511 
512 	/* SFP+ Tx Equalization: NIC recommended and tested value is 0xBEB2
513 	 * LOM recommended and tested value is 0xBEB2. Using a different
514 	 * value means using a value not tested by BRCM
515 	 */
516 	u32 sfi_tap_values;                                 /* 0x178 */
517 	#define PORT_HW_CFG_TX_EQUALIZATION_MASK                      0x0000FFFF
518 	#define PORT_HW_CFG_TX_EQUALIZATION_SHIFT                     0
519 
520 	/* SFP+ Tx driver broadcast IDRIVER: NIC recommended and tested
521 	 * value is 0x2. LOM recommended and tested value is 0x2. Using a
522 	 * different value means using a value not tested by BRCM
523 	 */
524 	#define PORT_HW_CFG_TX_DRV_BROADCAST_MASK                     0x000F0000
525 	#define PORT_HW_CFG_TX_DRV_BROADCAST_SHIFT                    16
526 	/*  Set non-default values for TXFIR in SFP mode. */
527 	#define PORT_HW_CFG_TX_DRV_IFIR_MASK                          0x00F00000
528 	#define PORT_HW_CFG_TX_DRV_IFIR_SHIFT                         20
529 
530 	/*  Set non-default values for IPREDRIVER in SFP mode. */
531 	#define PORT_HW_CFG_TX_DRV_IPREDRIVER_MASK                    0x0F000000
532 	#define PORT_HW_CFG_TX_DRV_IPREDRIVER_SHIFT                   24
533 
534 	/*  Set non-default values for POST2 in SFP mode. */
535 	#define PORT_HW_CFG_TX_DRV_POST2_MASK                         0xF0000000
536 	#define PORT_HW_CFG_TX_DRV_POST2_SHIFT                        28
537 
538 	u32 reserved0[5];				    /* 0x17c */
539 
540 	u32 aeu_int_mask;				    /* 0x190 */
541 
542 	u32 media_type;					    /* 0x194 */
543 	#define PORT_HW_CFG_MEDIA_TYPE_PHY0_MASK            0x000000FF
544 	#define PORT_HW_CFG_MEDIA_TYPE_PHY0_SHIFT                    0
545 
546 	#define PORT_HW_CFG_MEDIA_TYPE_PHY1_MASK            0x0000FF00
547 	#define PORT_HW_CFG_MEDIA_TYPE_PHY1_SHIFT                    8
548 
549 	#define PORT_HW_CFG_MEDIA_TYPE_PHY2_MASK            0x00FF0000
550 	#define PORT_HW_CFG_MEDIA_TYPE_PHY2_SHIFT                    16
551 
552 	/*  4 times 16 bits for all 4 lanes. In case external PHY is present
553 	      (not direct mode), those values will not take effect on the 4 XGXS
554 	      lanes. For some external PHYs (such as 8706 and 8726) the values
555 	      will be used to configure the external PHY  in those cases, not
556 	      all 4 values are needed. */
557 	u16 xgxs_config_rx[4];			/* 0x198 */
558 	u16 xgxs_config_tx[4];			/* 0x1A0 */
559 
560 	/* For storing FCOE mac on shared memory */
561 	u32 fcoe_fip_mac_upper;
562 	#define PORT_HW_CFG_FCOE_UPPERMAC_MASK              0x0000ffff
563 	#define PORT_HW_CFG_FCOE_UPPERMAC_SHIFT                      0
564 	u32 fcoe_fip_mac_lower;
565 
566 	u32 fcoe_wwn_port_name_upper;
567 	u32 fcoe_wwn_port_name_lower;
568 
569 	u32 fcoe_wwn_node_name_upper;
570 	u32 fcoe_wwn_node_name_lower;
571 
572 	u32 Reserved1[49];				    /* 0x1C0 */
573 
574 	/*  Enable RJ45 magjack pair swapping on 10GBase-T PHY (0=default),
575 	      84833 only */
576 	u32 xgbt_phy_cfg;				    /* 0x284 */
577 	#define PORT_HW_CFG_RJ45_PAIR_SWAP_MASK             0x000000FF
578 	#define PORT_HW_CFG_RJ45_PAIR_SWAP_SHIFT                     0
579 
580 		u32 default_cfg;			    /* 0x288 */
581 	#define PORT_HW_CFG_GPIO0_CONFIG_MASK               0x00000003
582 		#define PORT_HW_CFG_GPIO0_CONFIG_SHIFT               0
583 		#define PORT_HW_CFG_GPIO0_CONFIG_NA                  0x00000000
584 		#define PORT_HW_CFG_GPIO0_CONFIG_LOW                 0x00000001
585 		#define PORT_HW_CFG_GPIO0_CONFIG_HIGH                0x00000002
586 		#define PORT_HW_CFG_GPIO0_CONFIG_INPUT               0x00000003
587 
588 	#define PORT_HW_CFG_GPIO1_CONFIG_MASK               0x0000000C
589 		#define PORT_HW_CFG_GPIO1_CONFIG_SHIFT               2
590 		#define PORT_HW_CFG_GPIO1_CONFIG_NA                  0x00000000
591 		#define PORT_HW_CFG_GPIO1_CONFIG_LOW                 0x00000004
592 		#define PORT_HW_CFG_GPIO1_CONFIG_HIGH                0x00000008
593 		#define PORT_HW_CFG_GPIO1_CONFIG_INPUT               0x0000000c
594 
595 	#define PORT_HW_CFG_GPIO2_CONFIG_MASK               0x00000030
596 		#define PORT_HW_CFG_GPIO2_CONFIG_SHIFT               4
597 		#define PORT_HW_CFG_GPIO2_CONFIG_NA                  0x00000000
598 		#define PORT_HW_CFG_GPIO2_CONFIG_LOW                 0x00000010
599 		#define PORT_HW_CFG_GPIO2_CONFIG_HIGH                0x00000020
600 		#define PORT_HW_CFG_GPIO2_CONFIG_INPUT               0x00000030
601 
602 	#define PORT_HW_CFG_GPIO3_CONFIG_MASK               0x000000C0
603 		#define PORT_HW_CFG_GPIO3_CONFIG_SHIFT               6
604 		#define PORT_HW_CFG_GPIO3_CONFIG_NA                  0x00000000
605 		#define PORT_HW_CFG_GPIO3_CONFIG_LOW                 0x00000040
606 		#define PORT_HW_CFG_GPIO3_CONFIG_HIGH                0x00000080
607 		#define PORT_HW_CFG_GPIO3_CONFIG_INPUT               0x000000c0
608 
609 	/*  When KR link is required to be set to force which is not
610 	      KR-compliant, this parameter determine what is the trigger for it.
611 	      When GPIO is selected, low input will force the speed. Currently
612 	      default speed is 1G. In the future, it may be widen to select the
613 	      forced speed in with another parameter. Note when force-1G is
614 	      enabled, it override option 56: Link Speed option. */
615 	#define PORT_HW_CFG_FORCE_KR_ENABLER_MASK           0x00000F00
616 		#define PORT_HW_CFG_FORCE_KR_ENABLER_SHIFT           8
617 		#define PORT_HW_CFG_FORCE_KR_ENABLER_NOT_FORCED      0x00000000
618 		#define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P0        0x00000100
619 		#define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P0        0x00000200
620 		#define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P0        0x00000300
621 		#define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P0        0x00000400
622 		#define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P1        0x00000500
623 		#define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P1        0x00000600
624 		#define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P1        0x00000700
625 		#define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P1        0x00000800
626 		#define PORT_HW_CFG_FORCE_KR_ENABLER_FORCED          0x00000900
627 	/*  Enable to determine with which GPIO to reset the external phy */
628 	#define PORT_HW_CFG_EXT_PHY_GPIO_RST_MASK           0x000F0000
629 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_SHIFT           16
630 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_PHY_TYPE        0x00000000
631 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P0        0x00010000
632 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P0        0x00020000
633 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P0        0x00030000
634 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P0        0x00040000
635 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P1        0x00050000
636 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P1        0x00060000
637 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P1        0x00070000
638 		#define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P1        0x00080000
639 
640 	/*  Enable BAM on KR */
641 	#define PORT_HW_CFG_ENABLE_BAM_ON_KR_MASK           0x00100000
642 	#define PORT_HW_CFG_ENABLE_BAM_ON_KR_SHIFT                   20
643 	#define PORT_HW_CFG_ENABLE_BAM_ON_KR_DISABLED                0x00000000
644 	#define PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED                 0x00100000
645 
646 	/*  Enable Common Mode Sense */
647 	#define PORT_HW_CFG_ENABLE_CMS_MASK                 0x00200000
648 	#define PORT_HW_CFG_ENABLE_CMS_SHIFT                         21
649 	#define PORT_HW_CFG_ENABLE_CMS_DISABLED                      0x00000000
650 	#define PORT_HW_CFG_ENABLE_CMS_ENABLED                       0x00200000
651 
652 	/*  Determine the Serdes electrical interface   */
653 	#define PORT_HW_CFG_NET_SERDES_IF_MASK              0x0F000000
654 	#define PORT_HW_CFG_NET_SERDES_IF_SHIFT                      24
655 	#define PORT_HW_CFG_NET_SERDES_IF_SGMII                      0x00000000
656 	#define PORT_HW_CFG_NET_SERDES_IF_XFI                        0x01000000
657 	#define PORT_HW_CFG_NET_SERDES_IF_SFI                        0x02000000
658 	#define PORT_HW_CFG_NET_SERDES_IF_KR                         0x03000000
659 	#define PORT_HW_CFG_NET_SERDES_IF_DXGXS                      0x04000000
660 	#define PORT_HW_CFG_NET_SERDES_IF_KR2                        0x05000000
661 
662 
663 	u32 speed_capability_mask2;			    /* 0x28C */
664 	#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK       0x0000FFFF
665 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT       0
666 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_10M_FULL    0x00000001
667 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3__           0x00000002
668 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3___          0x00000004
669 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_100M_FULL   0x00000008
670 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_1G          0x00000010
671 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_2_DOT_5G    0x00000020
672 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_10G         0x00000040
673 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_20G         0x00000080
674 
675 	#define PORT_HW_CFG_SPEED_CAPABILITY2_D0_MASK       0xFFFF0000
676 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0_SHIFT       16
677 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0_10M_FULL    0x00010000
678 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0__           0x00020000
679 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0___          0x00040000
680 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0_100M_FULL   0x00080000
681 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0_1G          0x00100000
682 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0_2_DOT_5G    0x00200000
683 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0_10G         0x00400000
684 		#define PORT_HW_CFG_SPEED_CAPABILITY2_D0_20G         0x00800000
685 
686 
687 	/*  In the case where two media types (e.g. copper and fiber) are
688 	      present and electrically active at the same time, PHY Selection
689 	      will determine which of the two PHYs will be designated as the
690 	      Active PHY and used for a connection to the network.  */
691 	u32 multi_phy_config;				    /* 0x290 */
692 	#define PORT_HW_CFG_PHY_SELECTION_MASK              0x00000007
693 		#define PORT_HW_CFG_PHY_SELECTION_SHIFT              0
694 		#define PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT   0x00000000
695 		#define PORT_HW_CFG_PHY_SELECTION_FIRST_PHY          0x00000001
696 		#define PORT_HW_CFG_PHY_SELECTION_SECOND_PHY         0x00000002
697 		#define PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY 0x00000003
698 		#define PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY 0x00000004
699 
700 	/*  When enabled, all second phy nvram parameters will be swapped
701 	      with the first phy parameters */
702 	#define PORT_HW_CFG_PHY_SWAPPED_MASK                0x00000008
703 		#define PORT_HW_CFG_PHY_SWAPPED_SHIFT                3
704 		#define PORT_HW_CFG_PHY_SWAPPED_DISABLED             0x00000000
705 		#define PORT_HW_CFG_PHY_SWAPPED_ENABLED              0x00000008
706 
707 
708 	/*  Address of the second external phy */
709 	u32 external_phy_config2;			    /* 0x294 */
710 	#define PORT_HW_CFG_XGXS_EXT_PHY2_ADDR_MASK         0x000000FF
711 	#define PORT_HW_CFG_XGXS_EXT_PHY2_ADDR_SHIFT                 0
712 
713 	/*  The second XGXS external PHY type */
714 	#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_MASK         0x0000FF00
715 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_SHIFT         8
716 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_DIRECT        0x00000000
717 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8071       0x00000100
718 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8072       0x00000200
719 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8073       0x00000300
720 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8705       0x00000400
721 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8706       0x00000500
722 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8726       0x00000600
723 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8481       0x00000700
724 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_SFX7101       0x00000800
725 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8727       0x00000900
726 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8727_NOC   0x00000a00
727 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84823      0x00000b00
728 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54640      0x00000c00
729 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84833      0x00000d00
730 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54618SE    0x00000e00
731 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8722       0x00000f00
732 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54616      0x00001000
733 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84834      0x00001100
734 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84858      0x00001200
735 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_FAILURE       0x0000fd00
736 		#define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_NOT_CONN      0x0000ff00
737 
738 
739 	/*  4 times 16 bits for all 4 lanes. For some external PHYs (such as
740 	      8706, 8726 and 8727) not all 4 values are needed. */
741 	u16 xgxs_config2_rx[4];				    /* 0x296 */
742 	u16 xgxs_config2_tx[4];				    /* 0x2A0 */
743 
744 	u32 lane_config;
745 	#define PORT_HW_CFG_LANE_SWAP_CFG_MASK              0x0000ffff
746 		#define PORT_HW_CFG_LANE_SWAP_CFG_SHIFT              0
747 		/* AN and forced */
748 		#define PORT_HW_CFG_LANE_SWAP_CFG_01230123           0x00001b1b
749 		/* forced only */
750 		#define PORT_HW_CFG_LANE_SWAP_CFG_01233210           0x00001be4
751 		/* forced only */
752 		#define PORT_HW_CFG_LANE_SWAP_CFG_31203120           0x0000d8d8
753 		/* forced only */
754 		#define PORT_HW_CFG_LANE_SWAP_CFG_32103210           0x0000e4e4
755 	#define PORT_HW_CFG_LANE_SWAP_CFG_TX_MASK           0x000000ff
756 	#define PORT_HW_CFG_LANE_SWAP_CFG_TX_SHIFT                   0
757 	#define PORT_HW_CFG_LANE_SWAP_CFG_RX_MASK           0x0000ff00
758 	#define PORT_HW_CFG_LANE_SWAP_CFG_RX_SHIFT                   8
759 	#define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK       0x0000c000
760 	#define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT               14
761 
762 	/*  Indicate whether to swap the external phy polarity */
763 	#define PORT_HW_CFG_SWAP_PHY_POLARITY_MASK          0x00010000
764 		#define PORT_HW_CFG_SWAP_PHY_POLARITY_DISABLED       0x00000000
765 		#define PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED        0x00010000
766 
767 
768 	u32 external_phy_config;
769 	#define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK          0x000000ff
770 	#define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT                  0
771 
772 	#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK          0x0000ff00
773 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SHIFT          8
774 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT         0x00000000
775 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8071        0x00000100
776 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072        0x00000200
777 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073        0x00000300
778 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705        0x00000400
779 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706        0x00000500
780 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726        0x00000600
781 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481        0x00000700
782 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101        0x00000800
783 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727        0x00000900
784 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC    0x00000a00
785 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823       0x00000b00
786 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54640       0x00000c00
787 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833       0x00000d00
788 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE     0x00000e00
789 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8722        0x00000f00
790 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616       0x00001000
791 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834       0x00001100
792 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858       0x00001200
793 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT_WC      0x0000fc00
794 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE        0x0000fd00
795 		#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN       0x0000ff00
796 
797 	#define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_MASK        0x00ff0000
798 	#define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_SHIFT                16
799 
800 	#define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK        0xff000000
801 		#define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_SHIFT        24
802 		#define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT       0x00000000
803 		#define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482      0x01000000
804 		#define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT_SD    0x02000000
805 		#define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_NOT_CONN     0xff000000
806 
807 	u32 speed_capability_mask;
808 	#define PORT_HW_CFG_SPEED_CAPABILITY_D3_MASK        0x0000ffff
809 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_SHIFT        0
810 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_FULL     0x00000001
811 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_HALF     0x00000002
812 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_HALF    0x00000004
813 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_FULL    0x00000008
814 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_1G           0x00000010
815 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_2_5G         0x00000020
816 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_10G          0x00000040
817 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_20G          0x00000080
818 		#define PORT_HW_CFG_SPEED_CAPABILITY_D3_RESERVED     0x0000f000
819 
820 	#define PORT_HW_CFG_SPEED_CAPABILITY_D0_MASK        0xffff0000
821 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_SHIFT        16
822 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL     0x00010000
823 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF     0x00020000
824 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF    0x00040000
825 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL    0x00080000
826 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_1G           0x00100000
827 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G         0x00200000
828 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_10G          0x00400000
829 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_20G          0x00800000
830 		#define PORT_HW_CFG_SPEED_CAPABILITY_D0_RESERVED     0xf0000000
831 
832 	/*  A place to hold the original MAC address as a backup */
833 	u32 backup_mac_upper;			/* 0x2B4 */
834 	u32 backup_mac_lower;			/* 0x2B8 */
835 
836 };
837 
838 
839 /****************************************************************************
840  * Shared Feature configuration                                             *
841  ****************************************************************************/
842 struct shared_feat_cfg {		 /* NVRAM Offset */
843 
844 	u32 config;			/* 0x450 */
845 	#define SHARED_FEATURE_BMC_ECHO_MODE_EN             0x00000001
846 
847 	/* Use NVRAM values instead of HW default values */
848 	#define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_MASK \
849 							    0x00000002
850 		#define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_DISABLED \
851 								     0x00000000
852 		#define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_ENABLED \
853 								     0x00000002
854 
855 	#define SHARED_FEAT_CFG_NCSI_ID_METHOD_MASK         0x00000008
856 		#define SHARED_FEAT_CFG_NCSI_ID_METHOD_SPIO          0x00000000
857 		#define SHARED_FEAT_CFG_NCSI_ID_METHOD_NVRAM         0x00000008
858 
859 	#define SHARED_FEAT_CFG_NCSI_ID_MASK                0x00000030
860 	#define SHARED_FEAT_CFG_NCSI_ID_SHIFT                        4
861 
862 	/*  Override the OTP back to single function mode. When using GPIO,
863 	      high means only SF, 0 is according to CLP configuration */
864 	#define SHARED_FEAT_CFG_FORCE_SF_MODE_MASK          0x00000700
865 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_SHIFT          8
866 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_MF_ALLOWED     0x00000000
867 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_FORCED_SF      0x00000100
868 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_SPIO4          0x00000200
869 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_SWITCH_INDEPT  0x00000300
870 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_AFEX_MODE      0x00000400
871 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_BD_MODE        0x00000500
872 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_UFP_MODE       0x00000600
873 		#define SHARED_FEAT_CFG_FORCE_SF_MODE_EXTENDED_MODE  0x00000700
874 
875 	/* The interval in seconds between sending LLDP packets. Set to zero
876 	   to disable the feature */
877 	#define SHARED_FEAT_CFG_LLDP_XMIT_INTERVAL_MASK     0x00ff0000
878 	#define SHARED_FEAT_CFG_LLDP_XMIT_INTERVAL_SHIFT             16
879 
880 	/* The assigned device type ID for LLDP usage */
881 	#define SHARED_FEAT_CFG_LLDP_DEVICE_TYPE_ID_MASK    0xff000000
882 	#define SHARED_FEAT_CFG_LLDP_DEVICE_TYPE_ID_SHIFT            24
883 
884 };
885 
886 
887 /****************************************************************************
888  * Port Feature configuration                                               *
889  ****************************************************************************/
890 struct port_feat_cfg {		    /* port 0: 0x454  port 1: 0x4c8 */
891 
892 	u32 config;
893 	#define PORT_FEATURE_BAR1_SIZE_MASK                 0x0000000f
894 		#define PORT_FEATURE_BAR1_SIZE_SHIFT                 0
895 		#define PORT_FEATURE_BAR1_SIZE_DISABLED              0x00000000
896 		#define PORT_FEATURE_BAR1_SIZE_64K                   0x00000001
897 		#define PORT_FEATURE_BAR1_SIZE_128K                  0x00000002
898 		#define PORT_FEATURE_BAR1_SIZE_256K                  0x00000003
899 		#define PORT_FEATURE_BAR1_SIZE_512K                  0x00000004
900 		#define PORT_FEATURE_BAR1_SIZE_1M                    0x00000005
901 		#define PORT_FEATURE_BAR1_SIZE_2M                    0x00000006
902 		#define PORT_FEATURE_BAR1_SIZE_4M                    0x00000007
903 		#define PORT_FEATURE_BAR1_SIZE_8M                    0x00000008
904 		#define PORT_FEATURE_BAR1_SIZE_16M                   0x00000009
905 		#define PORT_FEATURE_BAR1_SIZE_32M                   0x0000000a
906 		#define PORT_FEATURE_BAR1_SIZE_64M                   0x0000000b
907 		#define PORT_FEATURE_BAR1_SIZE_128M                  0x0000000c
908 		#define PORT_FEATURE_BAR1_SIZE_256M                  0x0000000d
909 		#define PORT_FEATURE_BAR1_SIZE_512M                  0x0000000e
910 		#define PORT_FEATURE_BAR1_SIZE_1G                    0x0000000f
911 	#define PORT_FEATURE_BAR2_SIZE_MASK                 0x000000f0
912 		#define PORT_FEATURE_BAR2_SIZE_SHIFT                 4
913 		#define PORT_FEATURE_BAR2_SIZE_DISABLED              0x00000000
914 		#define PORT_FEATURE_BAR2_SIZE_64K                   0x00000010
915 		#define PORT_FEATURE_BAR2_SIZE_128K                  0x00000020
916 		#define PORT_FEATURE_BAR2_SIZE_256K                  0x00000030
917 		#define PORT_FEATURE_BAR2_SIZE_512K                  0x00000040
918 		#define PORT_FEATURE_BAR2_SIZE_1M                    0x00000050
919 		#define PORT_FEATURE_BAR2_SIZE_2M                    0x00000060
920 		#define PORT_FEATURE_BAR2_SIZE_4M                    0x00000070
921 		#define PORT_FEATURE_BAR2_SIZE_8M                    0x00000080
922 		#define PORT_FEATURE_BAR2_SIZE_16M                   0x00000090
923 		#define PORT_FEATURE_BAR2_SIZE_32M                   0x000000a0
924 		#define PORT_FEATURE_BAR2_SIZE_64M                   0x000000b0
925 		#define PORT_FEATURE_BAR2_SIZE_128M                  0x000000c0
926 		#define PORT_FEATURE_BAR2_SIZE_256M                  0x000000d0
927 		#define PORT_FEATURE_BAR2_SIZE_512M                  0x000000e0
928 		#define PORT_FEATURE_BAR2_SIZE_1G                    0x000000f0
929 
930 	#define PORT_FEAT_CFG_DCBX_MASK                     0x00000100
931 		#define PORT_FEAT_CFG_DCBX_DISABLED                  0x00000000
932 		#define PORT_FEAT_CFG_DCBX_ENABLED                   0x00000100
933 
934 		#define PORT_FEAT_CFG_STORAGE_PERSONALITY_MASK        0x00000C00
935 		#define PORT_FEAT_CFG_STORAGE_PERSONALITY_FCOE        0x00000400
936 		#define PORT_FEAT_CFG_STORAGE_PERSONALITY_ISCSI       0x00000800
937 
938 	#define PORT_FEATURE_EN_SIZE_MASK                   0x0f000000
939 	#define PORT_FEATURE_EN_SIZE_SHIFT                           24
940 	#define PORT_FEATURE_WOL_ENABLED                             0x01000000
941 	#define PORT_FEATURE_MBA_ENABLED                             0x02000000
942 	#define PORT_FEATURE_MFW_ENABLED                             0x04000000
943 
944 	/* Advertise expansion ROM even if MBA is disabled */
945 	#define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_MASK        0x08000000
946 		#define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_DISABLED     0x00000000
947 		#define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_ENABLED      0x08000000
948 
949 	/* Check the optic vendor via i2c against a list of approved modules
950 	   in a separate nvram image */
951 	#define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK         0xe0000000
952 		#define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_SHIFT         29
953 		#define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_NO_ENFORCEMENT \
954 								     0x00000000
955 		#define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER \
956 								     0x20000000
957 		#define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG   0x40000000
958 		#define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_POWER_DOWN    0x60000000
959 
960 	u32 wol_config;
961 	/* Default is used when driver sets to "auto" mode */
962 	#define PORT_FEATURE_WOL_DEFAULT_MASK               0x00000003
963 		#define PORT_FEATURE_WOL_DEFAULT_SHIFT               0
964 		#define PORT_FEATURE_WOL_DEFAULT_DISABLE             0x00000000
965 		#define PORT_FEATURE_WOL_DEFAULT_MAGIC               0x00000001
966 		#define PORT_FEATURE_WOL_DEFAULT_ACPI                0x00000002
967 		#define PORT_FEATURE_WOL_DEFAULT_MAGIC_AND_ACPI      0x00000003
968 	#define PORT_FEATURE_WOL_RES_PAUSE_CAP              0x00000004
969 	#define PORT_FEATURE_WOL_RES_ASYM_PAUSE_CAP         0x00000008
970 	#define PORT_FEATURE_WOL_ACPI_UPON_MGMT             0x00000010
971 
972 	u32 mba_config;
973 	#define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK       0x00000007
974 		#define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_SHIFT       0
975 		#define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_PXE         0x00000000
976 		#define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_RPL         0x00000001
977 		#define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_BOOTP       0x00000002
978 		#define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_ISCSIB      0x00000003
979 		#define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_FCOE_BOOT   0x00000004
980 		#define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_NONE        0x00000007
981 
982 	#define PORT_FEATURE_MBA_BOOT_RETRY_MASK            0x00000038
983 	#define PORT_FEATURE_MBA_BOOT_RETRY_SHIFT                    3
984 
985 	#define PORT_FEATURE_MBA_RES_PAUSE_CAP              0x00000100
986 	#define PORT_FEATURE_MBA_RES_ASYM_PAUSE_CAP         0x00000200
987 	#define PORT_FEATURE_MBA_SETUP_PROMPT_ENABLE        0x00000400
988 	#define PORT_FEATURE_MBA_HOTKEY_MASK                0x00000800
989 		#define PORT_FEATURE_MBA_HOTKEY_CTRL_S               0x00000000
990 		#define PORT_FEATURE_MBA_HOTKEY_CTRL_B               0x00000800
991 	#define PORT_FEATURE_MBA_EXP_ROM_SIZE_MASK          0x000ff000
992 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_SHIFT          12
993 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_DISABLED       0x00000000
994 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_2K             0x00001000
995 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_4K             0x00002000
996 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_8K             0x00003000
997 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_16K            0x00004000
998 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_32K            0x00005000
999 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_64K            0x00006000
1000 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_128K           0x00007000
1001 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_256K           0x00008000
1002 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_512K           0x00009000
1003 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_1M             0x0000a000
1004 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_2M             0x0000b000
1005 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_4M             0x0000c000
1006 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_8M             0x0000d000
1007 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_16M            0x0000e000
1008 		#define PORT_FEATURE_MBA_EXP_ROM_SIZE_32M            0x0000f000
1009 	#define PORT_FEATURE_MBA_MSG_TIMEOUT_MASK           0x00f00000
1010 	#define PORT_FEATURE_MBA_MSG_TIMEOUT_SHIFT                   20
1011 	#define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_MASK        0x03000000
1012 		#define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_SHIFT        24
1013 		#define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_AUTO         0x00000000
1014 		#define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_BBS          0x01000000
1015 		#define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT18H       0x02000000
1016 		#define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT19H       0x03000000
1017 	#define PORT_FEATURE_MBA_LINK_SPEED_MASK            0x3c000000
1018 		#define PORT_FEATURE_MBA_LINK_SPEED_SHIFT            26
1019 		#define PORT_FEATURE_MBA_LINK_SPEED_AUTO             0x00000000
1020 		#define PORT_FEATURE_MBA_LINK_SPEED_10HD             0x04000000
1021 		#define PORT_FEATURE_MBA_LINK_SPEED_10FD             0x08000000
1022 		#define PORT_FEATURE_MBA_LINK_SPEED_100HD            0x0c000000
1023 		#define PORT_FEATURE_MBA_LINK_SPEED_100FD            0x10000000
1024 		#define PORT_FEATURE_MBA_LINK_SPEED_1GBPS            0x14000000
1025 		#define PORT_FEATURE_MBA_LINK_SPEED_2_5GBPS          0x18000000
1026 		#define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_CX4       0x1c000000
1027 		#define PORT_FEATURE_MBA_LINK_SPEED_20GBPS           0x20000000
1028 	u32 bmc_config;
1029 	#define PORT_FEATURE_BMC_LINK_OVERRIDE_MASK         0x00000001
1030 		#define PORT_FEATURE_BMC_LINK_OVERRIDE_DEFAULT       0x00000000
1031 		#define PORT_FEATURE_BMC_LINK_OVERRIDE_EN            0x00000001
1032 
1033 	u32 mba_vlan_cfg;
1034 	#define PORT_FEATURE_MBA_VLAN_TAG_MASK              0x0000ffff
1035 	#define PORT_FEATURE_MBA_VLAN_TAG_SHIFT                      0
1036 	#define PORT_FEATURE_MBA_VLAN_EN                    0x00010000
1037 
1038 	u32 resource_cfg;
1039 	#define PORT_FEATURE_RESOURCE_CFG_VALID             0x00000001
1040 	#define PORT_FEATURE_RESOURCE_CFG_DIAG              0x00000002
1041 	#define PORT_FEATURE_RESOURCE_CFG_L2                0x00000004
1042 	#define PORT_FEATURE_RESOURCE_CFG_ISCSI             0x00000008
1043 	#define PORT_FEATURE_RESOURCE_CFG_RDMA              0x00000010
1044 
1045 	u32 smbus_config;
1046 	#define PORT_FEATURE_SMBUS_ADDR_MASK                0x000000fe
1047 	#define PORT_FEATURE_SMBUS_ADDR_SHIFT                        1
1048 
1049 	u32 vf_config;
1050 	#define PORT_FEAT_CFG_VF_BAR2_SIZE_MASK             0x0000000f
1051 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_SHIFT             0
1052 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_DISABLED          0x00000000
1053 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_4K                0x00000001
1054 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_8K                0x00000002
1055 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_16K               0x00000003
1056 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_32K               0x00000004
1057 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_64K               0x00000005
1058 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_128K              0x00000006
1059 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_256K              0x00000007
1060 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_512K              0x00000008
1061 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_1M                0x00000009
1062 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_2M                0x0000000a
1063 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_4M                0x0000000b
1064 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_8M                0x0000000c
1065 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_16M               0x0000000d
1066 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_32M               0x0000000e
1067 		#define PORT_FEAT_CFG_VF_BAR2_SIZE_64M               0x0000000f
1068 
1069 	u32 link_config;    /* Used as HW defaults for the driver */
1070 	#define PORT_FEATURE_CONNECTED_SWITCH_MASK          0x03000000
1071 		#define PORT_FEATURE_CONNECTED_SWITCH_SHIFT          24
1072 		/* (forced) low speed switch (< 10G) */
1073 		#define PORT_FEATURE_CON_SWITCH_1G_SWITCH            0x00000000
1074 		/* (forced) high speed switch (>= 10G) */
1075 		#define PORT_FEATURE_CON_SWITCH_10G_SWITCH           0x01000000
1076 		#define PORT_FEATURE_CON_SWITCH_AUTO_DETECT          0x02000000
1077 		#define PORT_FEATURE_CON_SWITCH_ONE_TIME_DETECT      0x03000000
1078 
1079 	#define PORT_FEATURE_LINK_SPEED_MASK                0x000f0000
1080 		#define PORT_FEATURE_LINK_SPEED_SHIFT                16
1081 		#define PORT_FEATURE_LINK_SPEED_AUTO                 0x00000000
1082 		#define PORT_FEATURE_LINK_SPEED_10M_FULL             0x00010000
1083 		#define PORT_FEATURE_LINK_SPEED_10M_HALF             0x00020000
1084 		#define PORT_FEATURE_LINK_SPEED_100M_HALF            0x00030000
1085 		#define PORT_FEATURE_LINK_SPEED_100M_FULL            0x00040000
1086 		#define PORT_FEATURE_LINK_SPEED_1G                   0x00050000
1087 		#define PORT_FEATURE_LINK_SPEED_2_5G                 0x00060000
1088 		#define PORT_FEATURE_LINK_SPEED_10G_CX4              0x00070000
1089 		#define PORT_FEATURE_LINK_SPEED_20G                  0x00080000
1090 
1091 	#define PORT_FEATURE_FLOW_CONTROL_MASK              0x00000700
1092 		#define PORT_FEATURE_FLOW_CONTROL_SHIFT              8
1093 		#define PORT_FEATURE_FLOW_CONTROL_AUTO               0x00000000
1094 		#define PORT_FEATURE_FLOW_CONTROL_TX                 0x00000100
1095 		#define PORT_FEATURE_FLOW_CONTROL_RX                 0x00000200
1096 		#define PORT_FEATURE_FLOW_CONTROL_BOTH               0x00000300
1097 		#define PORT_FEATURE_FLOW_CONTROL_NONE               0x00000400
1098 
1099 	/* The default for MCP link configuration,
1100 	   uses the same defines as link_config */
1101 	u32 mfw_wol_link_cfg;
1102 
1103 	/* The default for the driver of the second external phy,
1104 	   uses the same defines as link_config */
1105 	u32 link_config2;				    /* 0x47C */
1106 
1107 	/* The default for MCP of the second external phy,
1108 	   uses the same defines as link_config */
1109 	u32 mfw_wol_link_cfg2;				    /* 0x480 */
1110 
1111 
1112 	/*  EEE power saving mode */
1113 	u32 eee_power_mode;                                 /* 0x484 */
1114 	#define PORT_FEAT_CFG_EEE_POWER_MODE_MASK                     0x000000FF
1115 	#define PORT_FEAT_CFG_EEE_POWER_MODE_SHIFT                    0
1116 	#define PORT_FEAT_CFG_EEE_POWER_MODE_DISABLED                 0x00000000
1117 	#define PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED                 0x00000001
1118 	#define PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE               0x00000002
1119 	#define PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY              0x00000003
1120 
1121 
1122 	u32 Reserved2[16];                                  /* 0x488 */
1123 };
1124 
1125 
1126 /****************************************************************************
1127  * Device Information                                                       *
1128  ****************************************************************************/
1129 struct shm_dev_info {				/* size */
1130 
1131 	u32    bc_rev; /* 8 bits each: major, minor, build */	       /* 4 */
1132 
1133 	struct shared_hw_cfg     shared_hw_config;	      /* 40 */
1134 
1135 	struct port_hw_cfg       port_hw_config[PORT_MAX];     /* 400*2=800 */
1136 
1137 	struct shared_feat_cfg   shared_feature_config;		   /* 4 */
1138 
1139 	struct port_feat_cfg     port_feature_config[PORT_MAX];/* 116*2=232 */
1140 
1141 };
1142 
1143 
1144 #if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
1145 	#error "Missing either LITTLE_ENDIAN or BIG_ENDIAN definition."
1146 #endif
1147 
1148 #define FUNC_0              0
1149 #define FUNC_1              1
1150 #define FUNC_2              2
1151 #define FUNC_3              3
1152 #define FUNC_4              4
1153 #define FUNC_5              5
1154 #define FUNC_6              6
1155 #define FUNC_7              7
1156 #define E1_FUNC_MAX         2
1157 #define E1H_FUNC_MAX            8
1158 #define E2_FUNC_MAX         4   /* per path */
1159 
1160 #define VN_0                0
1161 #define VN_1                1
1162 #define VN_2                2
1163 #define VN_3                3
1164 #define E1VN_MAX            1
1165 #define E1HVN_MAX           4
1166 
1167 #define E2_VF_MAX           64  /* HC_REG_VF_CONFIGURATION_SIZE */
1168 /* This value (in milliseconds) determines the frequency of the driver
1169  * issuing the PULSE message code.  The firmware monitors this periodic
1170  * pulse to determine when to switch to an OS-absent mode. */
1171 #define DRV_PULSE_PERIOD_MS     250
1172 
1173 /* This value (in milliseconds) determines how long the driver should
1174  * wait for an acknowledgement from the firmware before timing out.  Once
1175  * the firmware has timed out, the driver will assume there is no firmware
1176  * running and there won't be any firmware-driver synchronization during a
1177  * driver reset. */
1178 #define FW_ACK_TIME_OUT_MS      5000
1179 
1180 #define FW_ACK_POLL_TIME_MS     1
1181 
1182 #define FW_ACK_NUM_OF_POLL  (FW_ACK_TIME_OUT_MS/FW_ACK_POLL_TIME_MS)
1183 
1184 #define MFW_TRACE_SIGNATURE     0x54524342
1185 
1186 /****************************************************************************
1187  * Driver <-> FW Mailbox                                                    *
1188  ****************************************************************************/
1189 struct drv_port_mb {
1190 
1191 	u32 link_status;
1192 	/* Driver should update this field on any link change event */
1193 
1194 	#define LINK_STATUS_NONE				(0<<0)
1195 	#define LINK_STATUS_LINK_FLAG_MASK			0x00000001
1196 	#define LINK_STATUS_LINK_UP				0x00000001
1197 	#define LINK_STATUS_SPEED_AND_DUPLEX_MASK		0x0000001E
1198 	#define LINK_STATUS_SPEED_AND_DUPLEX_AN_NOT_COMPLETE	(0<<1)
1199 	#define LINK_STATUS_SPEED_AND_DUPLEX_10THD		(1<<1)
1200 	#define LINK_STATUS_SPEED_AND_DUPLEX_10TFD		(2<<1)
1201 	#define LINK_STATUS_SPEED_AND_DUPLEX_100TXHD		(3<<1)
1202 	#define LINK_STATUS_SPEED_AND_DUPLEX_100T4		(4<<1)
1203 	#define LINK_STATUS_SPEED_AND_DUPLEX_100TXFD		(5<<1)
1204 	#define LINK_STATUS_SPEED_AND_DUPLEX_1000THD		(6<<1)
1205 	#define LINK_STATUS_SPEED_AND_DUPLEX_1000TFD		(7<<1)
1206 	#define LINK_STATUS_SPEED_AND_DUPLEX_1000XFD		(7<<1)
1207 	#define LINK_STATUS_SPEED_AND_DUPLEX_2500THD		(8<<1)
1208 	#define LINK_STATUS_SPEED_AND_DUPLEX_2500TFD		(9<<1)
1209 	#define LINK_STATUS_SPEED_AND_DUPLEX_2500XFD		(9<<1)
1210 	#define LINK_STATUS_SPEED_AND_DUPLEX_10GTFD		(10<<1)
1211 	#define LINK_STATUS_SPEED_AND_DUPLEX_10GXFD		(10<<1)
1212 	#define LINK_STATUS_SPEED_AND_DUPLEX_20GTFD		(11<<1)
1213 	#define LINK_STATUS_SPEED_AND_DUPLEX_20GXFD		(11<<1)
1214 
1215 	#define LINK_STATUS_AUTO_NEGOTIATE_FLAG_MASK		0x00000020
1216 	#define LINK_STATUS_AUTO_NEGOTIATE_ENABLED		0x00000020
1217 
1218 	#define LINK_STATUS_AUTO_NEGOTIATE_COMPLETE		0x00000040
1219 	#define LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK	0x00000080
1220 	#define LINK_STATUS_PARALLEL_DETECTION_USED		0x00000080
1221 
1222 	#define LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE	0x00000200
1223 	#define LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE	0x00000400
1224 	#define LINK_STATUS_LINK_PARTNER_100T4_CAPABLE		0x00000800
1225 	#define LINK_STATUS_LINK_PARTNER_100TXFD_CAPABLE	0x00001000
1226 	#define LINK_STATUS_LINK_PARTNER_100TXHD_CAPABLE	0x00002000
1227 	#define LINK_STATUS_LINK_PARTNER_10TFD_CAPABLE		0x00004000
1228 	#define LINK_STATUS_LINK_PARTNER_10THD_CAPABLE		0x00008000
1229 
1230 	#define LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK		0x00010000
1231 	#define LINK_STATUS_TX_FLOW_CONTROL_ENABLED		0x00010000
1232 
1233 	#define LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK		0x00020000
1234 	#define LINK_STATUS_RX_FLOW_CONTROL_ENABLED		0x00020000
1235 
1236 	#define LINK_STATUS_LINK_PARTNER_FLOW_CONTROL_MASK	0x000C0000
1237 	#define LINK_STATUS_LINK_PARTNER_NOT_PAUSE_CAPABLE	(0<<18)
1238 	#define LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE	(1<<18)
1239 	#define LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE	(2<<18)
1240 	#define LINK_STATUS_LINK_PARTNER_BOTH_PAUSE		(3<<18)
1241 
1242 	#define LINK_STATUS_SERDES_LINK				0x00100000
1243 
1244 	#define LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE	0x00200000
1245 	#define LINK_STATUS_LINK_PARTNER_2500XHD_CAPABLE	0x00400000
1246 	#define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE		0x00800000
1247 	#define LINK_STATUS_LINK_PARTNER_20GXFD_CAPABLE		0x10000000
1248 
1249 	#define LINK_STATUS_PFC_ENABLED				0x20000000
1250 
1251 	#define LINK_STATUS_PHYSICAL_LINK_FLAG			0x40000000
1252 	#define LINK_STATUS_SFP_TX_FAULT			0x80000000
1253 
1254 	u32 port_stx;
1255 
1256 	u32 stat_nig_timer;
1257 
1258 	/* MCP firmware does not use this field */
1259 	u32 ext_phy_fw_version;
1260 
1261 };
1262 
1263 
1264 struct drv_func_mb {
1265 
1266 	u32 drv_mb_header;
1267 	#define DRV_MSG_CODE_MASK                       0xffff0000
1268 	#define DRV_MSG_CODE_LOAD_REQ                   0x10000000
1269 	#define DRV_MSG_CODE_LOAD_DONE                  0x11000000
1270 	#define DRV_MSG_CODE_UNLOAD_REQ_WOL_EN          0x20000000
1271 	#define DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS         0x20010000
1272 	#define DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP         0x20020000
1273 	#define DRV_MSG_CODE_UNLOAD_DONE                0x21000000
1274 	#define DRV_MSG_CODE_DCC_OK                     0x30000000
1275 	#define DRV_MSG_CODE_DCC_FAILURE                0x31000000
1276 	#define DRV_MSG_CODE_DIAG_ENTER_REQ             0x50000000
1277 	#define DRV_MSG_CODE_DIAG_EXIT_REQ              0x60000000
1278 	#define DRV_MSG_CODE_VALIDATE_KEY               0x70000000
1279 	#define DRV_MSG_CODE_GET_CURR_KEY               0x80000000
1280 	#define DRV_MSG_CODE_GET_UPGRADE_KEY            0x81000000
1281 	#define DRV_MSG_CODE_GET_MANUF_KEY              0x82000000
1282 	#define DRV_MSG_CODE_LOAD_L2B_PRAM              0x90000000
1283 	#define DRV_MSG_CODE_OEM_OK			0x00010000
1284 	#define DRV_MSG_CODE_OEM_FAILURE		0x00020000
1285 	#define DRV_MSG_CODE_OEM_UPDATE_SVID_OK		0x00030000
1286 	#define DRV_MSG_CODE_OEM_UPDATE_SVID_FAILURE	0x00040000
1287 	/*
1288 	 * The optic module verification command requires bootcode
1289 	 * v5.0.6 or later, te specific optic module verification command
1290 	 * requires bootcode v5.2.12 or later
1291 	 */
1292 	#define DRV_MSG_CODE_VRFY_FIRST_PHY_OPT_MDL     0xa0000000
1293 	#define REQ_BC_VER_4_VRFY_FIRST_PHY_OPT_MDL     0x00050006
1294 	#define DRV_MSG_CODE_VRFY_SPECIFIC_PHY_OPT_MDL  0xa1000000
1295 	#define REQ_BC_VER_4_VRFY_SPECIFIC_PHY_OPT_MDL  0x00050234
1296 	#define DRV_MSG_CODE_VRFY_AFEX_SUPPORTED        0xa2000000
1297 	#define REQ_BC_VER_4_VRFY_AFEX_SUPPORTED        0x00070002
1298 	#define REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED   0x00070014
1299 	#define REQ_BC_VER_4_MT_SUPPORTED               0x00070201
1300 	#define REQ_BC_VER_4_PFC_STATS_SUPPORTED        0x00070201
1301 	#define REQ_BC_VER_4_FCOE_FEATURES              0x00070209
1302 
1303 	#define DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG         0xb0000000
1304 	#define DRV_MSG_CODE_DCBX_PMF_DRV_OK            0xb2000000
1305 	#define REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF     0x00070401
1306 
1307 	#define DRV_MSG_CODE_VF_DISABLED_DONE           0xc0000000
1308 
1309 	#define DRV_MSG_CODE_AFEX_DRIVER_SETMAC         0xd0000000
1310 	#define DRV_MSG_CODE_AFEX_LISTGET_ACK           0xd1000000
1311 	#define DRV_MSG_CODE_AFEX_LISTSET_ACK           0xd2000000
1312 	#define DRV_MSG_CODE_AFEX_STATSGET_ACK          0xd3000000
1313 	#define DRV_MSG_CODE_AFEX_VIFSET_ACK            0xd4000000
1314 
1315 	#define DRV_MSG_CODE_DRV_INFO_ACK               0xd8000000
1316 	#define DRV_MSG_CODE_DRV_INFO_NACK              0xd9000000
1317 
1318 	#define DRV_MSG_CODE_EEE_RESULTS_ACK            0xda000000
1319 
1320 	#define DRV_MSG_CODE_RMMOD                      0xdb000000
1321 	#define REQ_BC_VER_4_RMMOD_CMD                  0x0007080f
1322 
1323 	#define DRV_MSG_CODE_SET_MF_BW                  0xe0000000
1324 	#define REQ_BC_VER_4_SET_MF_BW                  0x00060202
1325 	#define DRV_MSG_CODE_SET_MF_BW_ACK              0xe1000000
1326 
1327 	#define DRV_MSG_CODE_LINK_STATUS_CHANGED        0x01000000
1328 
1329 	#define DRV_MSG_CODE_INITIATE_FLR               0x02000000
1330 	#define REQ_BC_VER_4_INITIATE_FLR               0x00070213
1331 
1332 	#define BIOS_MSG_CODE_LIC_CHALLENGE             0xff010000
1333 	#define BIOS_MSG_CODE_LIC_RESPONSE              0xff020000
1334 	#define BIOS_MSG_CODE_VIRT_MAC_PRIM             0xff030000
1335 	#define BIOS_MSG_CODE_VIRT_MAC_ISCSI            0xff040000
1336 
1337 	#define DRV_MSG_SEQ_NUMBER_MASK                 0x0000ffff
1338 
1339 	u32 drv_mb_param;
1340 	#define DRV_MSG_CODE_SET_MF_BW_MIN_MASK         0x00ff0000
1341 	#define DRV_MSG_CODE_SET_MF_BW_MAX_MASK         0xff000000
1342 
1343 	#define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET     0x00000002
1344 
1345 	#define DRV_MSG_CODE_LOAD_REQ_WITH_LFA          0x0000100a
1346 	#define DRV_MSG_CODE_LOAD_REQ_FORCE_LFA         0x00002000
1347 
1348 	u32 fw_mb_header;
1349 	#define FW_MSG_CODE_MASK                        0xffff0000
1350 	#define FW_MSG_CODE_DRV_LOAD_COMMON             0x10100000
1351 	#define FW_MSG_CODE_DRV_LOAD_PORT               0x10110000
1352 	#define FW_MSG_CODE_DRV_LOAD_FUNCTION           0x10120000
1353 	/* Load common chip is supported from bc 6.0.0  */
1354 	#define REQ_BC_VER_4_DRV_LOAD_COMMON_CHIP       0x00060000
1355 	#define FW_MSG_CODE_DRV_LOAD_COMMON_CHIP        0x10130000
1356 
1357 	#define FW_MSG_CODE_DRV_LOAD_REFUSED            0x10200000
1358 	#define FW_MSG_CODE_DRV_LOAD_DONE               0x11100000
1359 	#define FW_MSG_CODE_DRV_UNLOAD_COMMON           0x20100000
1360 	#define FW_MSG_CODE_DRV_UNLOAD_PORT             0x20110000
1361 	#define FW_MSG_CODE_DRV_UNLOAD_FUNCTION         0x20120000
1362 	#define FW_MSG_CODE_DRV_UNLOAD_DONE             0x21100000
1363 	#define FW_MSG_CODE_DCC_DONE                    0x30100000
1364 	#define FW_MSG_CODE_LLDP_DONE                   0x40100000
1365 	#define FW_MSG_CODE_DIAG_ENTER_DONE             0x50100000
1366 	#define FW_MSG_CODE_DIAG_REFUSE                 0x50200000
1367 	#define FW_MSG_CODE_DIAG_EXIT_DONE              0x60100000
1368 	#define FW_MSG_CODE_VALIDATE_KEY_SUCCESS        0x70100000
1369 	#define FW_MSG_CODE_VALIDATE_KEY_FAILURE        0x70200000
1370 	#define FW_MSG_CODE_GET_KEY_DONE                0x80100000
1371 	#define FW_MSG_CODE_NO_KEY                      0x80f00000
1372 	#define FW_MSG_CODE_LIC_INFO_NOT_READY          0x80f80000
1373 	#define FW_MSG_CODE_L2B_PRAM_LOADED             0x90100000
1374 	#define FW_MSG_CODE_L2B_PRAM_T_LOAD_FAILURE     0x90210000
1375 	#define FW_MSG_CODE_L2B_PRAM_C_LOAD_FAILURE     0x90220000
1376 	#define FW_MSG_CODE_L2B_PRAM_X_LOAD_FAILURE     0x90230000
1377 	#define FW_MSG_CODE_L2B_PRAM_U_LOAD_FAILURE     0x90240000
1378 	#define FW_MSG_CODE_VRFY_OPT_MDL_SUCCESS        0xa0100000
1379 	#define FW_MSG_CODE_VRFY_OPT_MDL_INVLD_IMG      0xa0200000
1380 	#define FW_MSG_CODE_VRFY_OPT_MDL_UNAPPROVED     0xa0300000
1381 	#define FW_MSG_CODE_VF_DISABLED_DONE            0xb0000000
1382 	#define FW_MSG_CODE_HW_SET_INVALID_IMAGE        0xb0100000
1383 
1384 	#define FW_MSG_CODE_AFEX_DRIVER_SETMAC_DONE     0xd0100000
1385 	#define FW_MSG_CODE_AFEX_LISTGET_ACK            0xd1100000
1386 	#define FW_MSG_CODE_AFEX_LISTSET_ACK            0xd2100000
1387 	#define FW_MSG_CODE_AFEX_STATSGET_ACK           0xd3100000
1388 	#define FW_MSG_CODE_AFEX_VIFSET_ACK             0xd4100000
1389 
1390 	#define FW_MSG_CODE_DRV_INFO_ACK                0xd8100000
1391 	#define FW_MSG_CODE_DRV_INFO_NACK               0xd9100000
1392 
1393 	#define FW_MSG_CODE_EEE_RESULS_ACK              0xda100000
1394 
1395 	#define FW_MSG_CODE_RMMOD_ACK                   0xdb100000
1396 
1397 	#define FW_MSG_CODE_SET_MF_BW_SENT              0xe0000000
1398 	#define FW_MSG_CODE_SET_MF_BW_DONE              0xe1000000
1399 
1400 	#define FW_MSG_CODE_LINK_CHANGED_ACK            0x01100000
1401 
1402 	#define FW_MSG_CODE_LIC_CHALLENGE               0xff010000
1403 	#define FW_MSG_CODE_LIC_RESPONSE                0xff020000
1404 	#define FW_MSG_CODE_VIRT_MAC_PRIM               0xff030000
1405 	#define FW_MSG_CODE_VIRT_MAC_ISCSI              0xff040000
1406 
1407 	#define FW_MSG_SEQ_NUMBER_MASK                  0x0000ffff
1408 
1409 	u32 fw_mb_param;
1410 
1411 	u32 drv_pulse_mb;
1412 	#define DRV_PULSE_SEQ_MASK                      0x00007fff
1413 	#define DRV_PULSE_SYSTEM_TIME_MASK              0xffff0000
1414 	/*
1415 	 * The system time is in the format of
1416 	 * (year-2001)*12*32 + month*32 + day.
1417 	 */
1418 	#define DRV_PULSE_ALWAYS_ALIVE                  0x00008000
1419 	/*
1420 	 * Indicate to the firmware not to go into the
1421 	 * OS-absent when it is not getting driver pulse.
1422 	 * This is used for debugging as well for PXE(MBA).
1423 	 */
1424 
1425 	u32 mcp_pulse_mb;
1426 	#define MCP_PULSE_SEQ_MASK                      0x00007fff
1427 	#define MCP_PULSE_ALWAYS_ALIVE                  0x00008000
1428 	/* Indicates to the driver not to assert due to lack
1429 	 * of MCP response */
1430 	#define MCP_EVENT_MASK                          0xffff0000
1431 	#define MCP_EVENT_OTHER_DRIVER_RESET_REQ        0x00010000
1432 
1433 	u32 iscsi_boot_signature;
1434 	u32 iscsi_boot_block_offset;
1435 
1436 	u32 drv_status;
1437 	#define DRV_STATUS_PMF                          0x00000001
1438 	#define DRV_STATUS_VF_DISABLED                  0x00000002
1439 	#define DRV_STATUS_SET_MF_BW                    0x00000004
1440 	#define DRV_STATUS_LINK_EVENT                   0x00000008
1441 
1442 	#define DRV_STATUS_OEM_EVENT_MASK               0x00000070
1443 	#define DRV_STATUS_OEM_DISABLE_ENABLE_PF        0x00000010
1444 	#define DRV_STATUS_OEM_BANDWIDTH_ALLOCATION     0x00000020
1445 
1446 	#define DRV_STATUS_OEM_UPDATE_SVID              0x00000080
1447 
1448 	#define DRV_STATUS_DCC_EVENT_MASK               0x0000ff00
1449 	#define DRV_STATUS_DCC_DISABLE_ENABLE_PF        0x00000100
1450 	#define DRV_STATUS_DCC_BANDWIDTH_ALLOCATION     0x00000200
1451 	#define DRV_STATUS_DCC_CHANGE_MAC_ADDRESS       0x00000400
1452 	#define DRV_STATUS_DCC_RESERVED1                0x00000800
1453 	#define DRV_STATUS_DCC_SET_PROTOCOL             0x00001000
1454 	#define DRV_STATUS_DCC_SET_PRIORITY             0x00002000
1455 
1456 	#define DRV_STATUS_DCBX_EVENT_MASK              0x000f0000
1457 	#define DRV_STATUS_DCBX_NEGOTIATION_RESULTS     0x00010000
1458 	#define DRV_STATUS_AFEX_EVENT_MASK              0x03f00000
1459 	#define DRV_STATUS_AFEX_LISTGET_REQ             0x00100000
1460 	#define DRV_STATUS_AFEX_LISTSET_REQ             0x00200000
1461 	#define DRV_STATUS_AFEX_STATSGET_REQ            0x00400000
1462 	#define DRV_STATUS_AFEX_VIFSET_REQ              0x00800000
1463 
1464 	#define DRV_STATUS_DRV_INFO_REQ                 0x04000000
1465 
1466 	#define DRV_STATUS_EEE_NEGOTIATION_RESULTS      0x08000000
1467 
1468 	u32 virt_mac_upper;
1469 	#define VIRT_MAC_SIGN_MASK                      0xffff0000
1470 	#define VIRT_MAC_SIGNATURE                      0x564d0000
1471 	u32 virt_mac_lower;
1472 
1473 };
1474 
1475 
1476 /****************************************************************************
1477  * Management firmware state                                                *
1478  ****************************************************************************/
1479 /* Allocate 440 bytes for management firmware */
1480 #define MGMTFW_STATE_WORD_SIZE                          110
1481 
1482 struct mgmtfw_state {
1483 	u32 opaque[MGMTFW_STATE_WORD_SIZE];
1484 };
1485 
1486 
1487 /****************************************************************************
1488  * Multi-Function configuration                                             *
1489  ****************************************************************************/
1490 struct shared_mf_cfg {
1491 
1492 	u32 clp_mb;
1493 	#define SHARED_MF_CLP_SET_DEFAULT               0x00000000
1494 	/* set by CLP */
1495 	#define SHARED_MF_CLP_EXIT                      0x00000001
1496 	/* set by MCP */
1497 	#define SHARED_MF_CLP_EXIT_DONE                 0x00010000
1498 
1499 };
1500 
1501 struct port_mf_cfg {
1502 
1503 	u32 dynamic_cfg;    /* device control channel */
1504 	#define PORT_MF_CFG_E1HOV_TAG_MASK              0x0000ffff
1505 	#define PORT_MF_CFG_E1HOV_TAG_SHIFT             0
1506 	#define PORT_MF_CFG_E1HOV_TAG_DEFAULT         PORT_MF_CFG_E1HOV_TAG_MASK
1507 
1508 	u32 reserved[1];
1509 
1510 };
1511 
1512 struct func_mf_cfg {
1513 
1514 	u32 config;
1515 	/* E/R/I/D */
1516 	/* function 0 of each port cannot be hidden */
1517 	#define FUNC_MF_CFG_FUNC_HIDE                   0x00000001
1518 
1519 	#define FUNC_MF_CFG_PROTOCOL_MASK               0x00000006
1520 	#define FUNC_MF_CFG_PROTOCOL_FCOE               0x00000000
1521 	#define FUNC_MF_CFG_PROTOCOL_ETHERNET           0x00000002
1522 	#define FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA 0x00000004
1523 	#define FUNC_MF_CFG_PROTOCOL_ISCSI              0x00000006
1524 	#define FUNC_MF_CFG_PROTOCOL_DEFAULT \
1525 				FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA
1526 
1527 	#define FUNC_MF_CFG_FUNC_DISABLED               0x00000008
1528 	#define FUNC_MF_CFG_FUNC_DELETED                0x00000010
1529 
1530 	/* PRI */
1531 	/* 0 - low priority, 3 - high priority */
1532 	#define FUNC_MF_CFG_TRANSMIT_PRIORITY_MASK      0x00000300
1533 	#define FUNC_MF_CFG_TRANSMIT_PRIORITY_SHIFT     8
1534 	#define FUNC_MF_CFG_TRANSMIT_PRIORITY_DEFAULT   0x00000000
1535 
1536 	/* MINBW, MAXBW */
1537 	/* value range - 0..100, increments in 100Mbps */
1538 	#define FUNC_MF_CFG_MIN_BW_MASK                 0x00ff0000
1539 	#define FUNC_MF_CFG_MIN_BW_SHIFT                16
1540 	#define FUNC_MF_CFG_MIN_BW_DEFAULT              0x00000000
1541 	#define FUNC_MF_CFG_MAX_BW_MASK                 0xff000000
1542 	#define FUNC_MF_CFG_MAX_BW_SHIFT                24
1543 	#define FUNC_MF_CFG_MAX_BW_DEFAULT              0x64000000
1544 
1545 	u32 mac_upper;	    /* MAC */
1546 	#define FUNC_MF_CFG_UPPERMAC_MASK               0x0000ffff
1547 	#define FUNC_MF_CFG_UPPERMAC_SHIFT              0
1548 	#define FUNC_MF_CFG_UPPERMAC_DEFAULT           FUNC_MF_CFG_UPPERMAC_MASK
1549 	u32 mac_lower;
1550 	#define FUNC_MF_CFG_LOWERMAC_DEFAULT            0xffffffff
1551 
1552 	u32 e1hov_tag;	/* VNI */
1553 	#define FUNC_MF_CFG_E1HOV_TAG_MASK              0x0000ffff
1554 	#define FUNC_MF_CFG_E1HOV_TAG_SHIFT             0
1555 	#define FUNC_MF_CFG_E1HOV_TAG_DEFAULT         FUNC_MF_CFG_E1HOV_TAG_MASK
1556 
1557 	/* afex default VLAN ID - 12 bits */
1558 	#define FUNC_MF_CFG_AFEX_VLAN_MASK              0x0fff0000
1559 	#define FUNC_MF_CFG_AFEX_VLAN_SHIFT             16
1560 
1561 	u32 afex_config;
1562 	#define FUNC_MF_CFG_AFEX_COS_FILTER_MASK                     0x000000ff
1563 	#define FUNC_MF_CFG_AFEX_COS_FILTER_SHIFT                    0
1564 	#define FUNC_MF_CFG_AFEX_MBA_ENABLED_MASK                    0x0000ff00
1565 	#define FUNC_MF_CFG_AFEX_MBA_ENABLED_SHIFT                   8
1566 	#define FUNC_MF_CFG_AFEX_MBA_ENABLED_VAL                     0x00000100
1567 	#define FUNC_MF_CFG_AFEX_VLAN_MODE_MASK                      0x000f0000
1568 	#define FUNC_MF_CFG_AFEX_VLAN_MODE_SHIFT                     16
1569 
1570 	u32 reserved;
1571 };
1572 
1573 enum mf_cfg_afex_vlan_mode {
1574 	FUNC_MF_CFG_AFEX_VLAN_TRUNK_MODE = 0,
1575 	FUNC_MF_CFG_AFEX_VLAN_ACCESS_MODE,
1576 	FUNC_MF_CFG_AFEX_VLAN_TRUNK_TAG_NATIVE_MODE
1577 };
1578 
1579 /* This structure is not applicable and should not be accessed on 57711 */
1580 struct func_ext_cfg {
1581 	u32 func_cfg;
1582 	#define MACP_FUNC_CFG_FLAGS_MASK                0x0000007F
1583 	#define MACP_FUNC_CFG_FLAGS_SHIFT               0
1584 	#define MACP_FUNC_CFG_FLAGS_ENABLED             0x00000001
1585 	#define MACP_FUNC_CFG_FLAGS_ETHERNET            0x00000002
1586 	#define MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD       0x00000004
1587 	#define MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD        0x00000008
1588 	#define MACP_FUNC_CFG_PAUSE_ON_HOST_RING        0x00000080
1589 
1590 	u32 iscsi_mac_addr_upper;
1591 	u32 iscsi_mac_addr_lower;
1592 
1593 	u32 fcoe_mac_addr_upper;
1594 	u32 fcoe_mac_addr_lower;
1595 
1596 	u32 fcoe_wwn_port_name_upper;
1597 	u32 fcoe_wwn_port_name_lower;
1598 
1599 	u32 fcoe_wwn_node_name_upper;
1600 	u32 fcoe_wwn_node_name_lower;
1601 
1602 	u32 preserve_data;
1603 	#define MF_FUNC_CFG_PRESERVE_L2_MAC             (1<<0)
1604 	#define MF_FUNC_CFG_PRESERVE_ISCSI_MAC          (1<<1)
1605 	#define MF_FUNC_CFG_PRESERVE_FCOE_MAC           (1<<2)
1606 	#define MF_FUNC_CFG_PRESERVE_FCOE_WWN_P         (1<<3)
1607 	#define MF_FUNC_CFG_PRESERVE_FCOE_WWN_N         (1<<4)
1608 	#define MF_FUNC_CFG_PRESERVE_TX_BW              (1<<5)
1609 };
1610 
1611 struct mf_cfg {
1612 
1613 	struct shared_mf_cfg    shared_mf_config;       /* 0x4 */
1614 							/* 0x8*2*2=0x20 */
1615 	struct port_mf_cfg  port_mf_config[NVM_PATH_MAX][PORT_MAX];
1616 	/* for all chips, there are 8 mf functions */
1617 	struct func_mf_cfg  func_mf_config[E1H_FUNC_MAX]; /* 0x18 * 8 = 0xc0 */
1618 	/*
1619 	 * Extended configuration per function  - this array does not exist and
1620 	 * should not be accessed on 57711
1621 	 */
1622 	struct func_ext_cfg func_ext_config[E1H_FUNC_MAX]; /* 0x28 * 8 = 0x140*/
1623 }; /* 0x224 */
1624 
1625 /****************************************************************************
1626  * Shared Memory Region                                                     *
1627  ****************************************************************************/
1628 struct shmem_region {		       /*   SharedMem Offset (size) */
1629 
1630 	u32         validity_map[PORT_MAX];  /* 0x0 (4*2 = 0x8) */
1631 	#define SHR_MEM_FORMAT_REV_MASK                     0xff000000
1632 	#define SHR_MEM_FORMAT_REV_ID                       ('A'<<24)
1633 	/* validity bits */
1634 	#define SHR_MEM_VALIDITY_PCI_CFG                    0x00100000
1635 	#define SHR_MEM_VALIDITY_MB                         0x00200000
1636 	#define SHR_MEM_VALIDITY_DEV_INFO                   0x00400000
1637 	#define SHR_MEM_VALIDITY_RESERVED                   0x00000007
1638 	/* One licensing bit should be set */
1639 	#define SHR_MEM_VALIDITY_LIC_KEY_IN_EFFECT_MASK     0x00000038
1640 	#define SHR_MEM_VALIDITY_LIC_MANUF_KEY_IN_EFFECT    0x00000008
1641 	#define SHR_MEM_VALIDITY_LIC_UPGRADE_KEY_IN_EFFECT  0x00000010
1642 	#define SHR_MEM_VALIDITY_LIC_NO_KEY_IN_EFFECT       0x00000020
1643 	/* Active MFW */
1644 	#define SHR_MEM_VALIDITY_ACTIVE_MFW_UNKNOWN         0x00000000
1645 	#define SHR_MEM_VALIDITY_ACTIVE_MFW_MASK            0x000001c0
1646 	#define SHR_MEM_VALIDITY_ACTIVE_MFW_IPMI            0x00000040
1647 	#define SHR_MEM_VALIDITY_ACTIVE_MFW_UMP             0x00000080
1648 	#define SHR_MEM_VALIDITY_ACTIVE_MFW_NCSI            0x000000c0
1649 	#define SHR_MEM_VALIDITY_ACTIVE_MFW_NONE            0x000001c0
1650 
1651 	struct shm_dev_info dev_info;	     /* 0x8     (0x438) */
1652 
1653 	struct license_key       drv_lic_key[PORT_MAX]; /* 0x440 (52*2=0x68) */
1654 
1655 	/* FW information (for internal FW use) */
1656 	u32         fw_info_fio_offset;		/* 0x4a8       (0x4) */
1657 	struct mgmtfw_state mgmtfw_state;	/* 0x4ac     (0x1b8) */
1658 
1659 	struct drv_port_mb  port_mb[PORT_MAX];	/* 0x664 (16*2=0x20) */
1660 
1661 #ifdef BMAPI
1662 	/* This is a variable length array */
1663 	/* the number of function depends on the chip type */
1664 	struct drv_func_mb func_mb[1];	/* 0x684 (44*2/4/8=0x58/0xb0/0x160) */
1665 #else
1666 	/* the number of function depends on the chip type */
1667 	struct drv_func_mb  func_mb[];	/* 0x684 (44*2/4/8=0x58/0xb0/0x160) */
1668 #endif /* BMAPI */
1669 
1670 }; /* 57710 = 0x6dc | 57711 = 0x7E4 | 57712 = 0x734 */
1671 
1672 /****************************************************************************
1673  * Shared Memory 2 Region                                                   *
1674  ****************************************************************************/
1675 /* The fw_flr_ack is actually built in the following way:                   */
1676 /* 8 bit:  PF ack                                                           */
1677 /* 64 bit: VF ack                                                           */
1678 /* 8 bit:  ios_dis_ack                                                      */
1679 /* In order to maintain endianity in the mailbox hsi, we want to keep using */
1680 /* u32. The fw must have the VF right after the PF since this is how it     */
1681 /* access arrays(it expects always the VF to reside after the PF, and that  */
1682 /* makes the calculation much easier for it. )                              */
1683 /* In order to answer both limitations, and keep the struct small, the code */
1684 /* will abuse the structure defined here to achieve the actual partition    */
1685 /* above                                                                    */
1686 /****************************************************************************/
1687 struct fw_flr_ack {
1688 	u32         pf_ack;
1689 	u32         vf_ack[1];
1690 	u32         iov_dis_ack;
1691 };
1692 
1693 struct fw_flr_mb {
1694 	u32         aggint;
1695 	u32         opgen_addr;
1696 	struct fw_flr_ack ack;
1697 };
1698 
1699 struct eee_remote_vals {
1700 	u32         tx_tw;
1701 	u32         rx_tw;
1702 };
1703 
1704 /**** SUPPORT FOR SHMEM ARRRAYS ***
1705  * The SHMEM HSI is aligned on 32 bit boundaries which makes it difficult to
1706  * define arrays with storage types smaller then unsigned dwords.
1707  * The macros below add generic support for SHMEM arrays with numeric elements
1708  * that can span 2,4,8 or 16 bits. The array underlying type is a 32 bit dword
1709  * array with individual bit-filed elements accessed using shifts and masks.
1710  *
1711  */
1712 
1713 /* eb is the bitwidth of a single element */
1714 #define SHMEM_ARRAY_MASK(eb)		((1<<(eb))-1)
1715 #define SHMEM_ARRAY_ENTRY(i, eb)	((i)/(32/(eb)))
1716 
1717 /* the bit-position macro allows the used to flip the order of the arrays
1718  * elements on a per byte or word boundary.
1719  *
1720  * example: an array with 8 entries each 4 bit wide. This array will fit into
1721  * a single dword. The diagrmas below show the array order of the nibbles.
1722  *
1723  * SHMEM_ARRAY_BITPOS(i, 4, 4) defines the stadard ordering:
1724  *
1725  *                |                |                |               |
1726  *   0    |   1   |   2    |   3   |   4    |   5   |   6   |   7   |
1727  *                |                |                |               |
1728  *
1729  * SHMEM_ARRAY_BITPOS(i, 4, 8) defines a flip ordering per byte:
1730  *
1731  *                |                |                |               |
1732  *   1   |   0    |   3    |   2   |   5    |   4   |   7   |   6   |
1733  *                |                |                |               |
1734  *
1735  * SHMEM_ARRAY_BITPOS(i, 4, 16) defines a flip ordering per word:
1736  *
1737  *                |                |                |               |
1738  *   3   |   2    |   1   |   0    |   7   |   6    |   5   |   4   |
1739  *                |                |                |               |
1740  */
1741 #define SHMEM_ARRAY_BITPOS(i, eb, fb)	\
1742 	((((32/(fb)) - 1 - ((i)/((fb)/(eb))) % (32/(fb))) * (fb)) + \
1743 	(((i)%((fb)/(eb))) * (eb)))
1744 
1745 #define SHMEM_ARRAY_GET(a, i, eb, fb)					\
1746 	((a[SHMEM_ARRAY_ENTRY(i, eb)] >> SHMEM_ARRAY_BITPOS(i, eb, fb)) &  \
1747 	SHMEM_ARRAY_MASK(eb))
1748 
1749 #define SHMEM_ARRAY_SET(a, i, eb, fb, val)				\
1750 do {									   \
1751 	a[SHMEM_ARRAY_ENTRY(i, eb)] &= ~(SHMEM_ARRAY_MASK(eb) <<	   \
1752 	SHMEM_ARRAY_BITPOS(i, eb, fb));					   \
1753 	a[SHMEM_ARRAY_ENTRY(i, eb)] |= (((val) & SHMEM_ARRAY_MASK(eb)) <<  \
1754 	SHMEM_ARRAY_BITPOS(i, eb, fb));					   \
1755 } while (0)
1756 
1757 
1758 /****START OF DCBX STRUCTURES DECLARATIONS****/
1759 #define DCBX_MAX_NUM_PRI_PG_ENTRIES	8
1760 #define DCBX_PRI_PG_BITWIDTH		4
1761 #define DCBX_PRI_PG_FBITS		8
1762 #define DCBX_PRI_PG_GET(a, i)		\
1763 	SHMEM_ARRAY_GET(a, i, DCBX_PRI_PG_BITWIDTH, DCBX_PRI_PG_FBITS)
1764 #define DCBX_PRI_PG_SET(a, i, val)	\
1765 	SHMEM_ARRAY_SET(a, i, DCBX_PRI_PG_BITWIDTH, DCBX_PRI_PG_FBITS, val)
1766 #define DCBX_MAX_NUM_PG_BW_ENTRIES	8
1767 #define DCBX_BW_PG_BITWIDTH		8
1768 #define DCBX_PG_BW_GET(a, i)		\
1769 	SHMEM_ARRAY_GET(a, i, DCBX_BW_PG_BITWIDTH, DCBX_BW_PG_BITWIDTH)
1770 #define DCBX_PG_BW_SET(a, i, val)	\
1771 	SHMEM_ARRAY_SET(a, i, DCBX_BW_PG_BITWIDTH, DCBX_BW_PG_BITWIDTH, val)
1772 #define DCBX_STRICT_PRI_PG		15
1773 #define DCBX_MAX_APP_PROTOCOL		16
1774 #define FCOE_APP_IDX			0
1775 #define ISCSI_APP_IDX			1
1776 #define PREDEFINED_APP_IDX_MAX		2
1777 
1778 
1779 /* Big/Little endian have the same representation. */
1780 struct dcbx_ets_feature {
1781 	/*
1782 	 * For Admin MIB - is this feature supported by the
1783 	 * driver | For Local MIB - should this feature be enabled.
1784 	 */
1785 	u32 enabled;
1786 	u32  pg_bw_tbl[2];
1787 	u32  pri_pg_tbl[1];
1788 };
1789 
1790 /* Driver structure in LE */
1791 struct dcbx_pfc_feature {
1792 #ifdef __BIG_ENDIAN
1793 	u8 pri_en_bitmap;
1794 	#define DCBX_PFC_PRI_0 0x01
1795 	#define DCBX_PFC_PRI_1 0x02
1796 	#define DCBX_PFC_PRI_2 0x04
1797 	#define DCBX_PFC_PRI_3 0x08
1798 	#define DCBX_PFC_PRI_4 0x10
1799 	#define DCBX_PFC_PRI_5 0x20
1800 	#define DCBX_PFC_PRI_6 0x40
1801 	#define DCBX_PFC_PRI_7 0x80
1802 	u8 pfc_caps;
1803 	u8 reserved;
1804 	u8 enabled;
1805 #elif defined(__LITTLE_ENDIAN)
1806 	u8 enabled;
1807 	u8 reserved;
1808 	u8 pfc_caps;
1809 	u8 pri_en_bitmap;
1810 	#define DCBX_PFC_PRI_0 0x01
1811 	#define DCBX_PFC_PRI_1 0x02
1812 	#define DCBX_PFC_PRI_2 0x04
1813 	#define DCBX_PFC_PRI_3 0x08
1814 	#define DCBX_PFC_PRI_4 0x10
1815 	#define DCBX_PFC_PRI_5 0x20
1816 	#define DCBX_PFC_PRI_6 0x40
1817 	#define DCBX_PFC_PRI_7 0x80
1818 #endif
1819 };
1820 
1821 struct dcbx_app_priority_entry {
1822 #ifdef __BIG_ENDIAN
1823 	u16  app_id;
1824 	u8  pri_bitmap;
1825 	u8  appBitfield;
1826 	#define DCBX_APP_ENTRY_VALID         0x01
1827 	#define DCBX_APP_ENTRY_SF_MASK       0xF0
1828 	#define DCBX_APP_ENTRY_SF_SHIFT      4
1829 	#define DCBX_APP_SF_ETH_TYPE         0x10
1830 	#define DCBX_APP_SF_PORT             0x20
1831 	#define DCBX_APP_SF_UDP              0x40
1832 	#define DCBX_APP_SF_DEFAULT          0x80
1833 #elif defined(__LITTLE_ENDIAN)
1834 	u8 appBitfield;
1835 	#define DCBX_APP_ENTRY_VALID         0x01
1836 	#define DCBX_APP_ENTRY_SF_MASK       0xF0
1837 	#define DCBX_APP_ENTRY_SF_SHIFT      4
1838 	#define DCBX_APP_ENTRY_VALID         0x01
1839 	#define DCBX_APP_SF_ETH_TYPE         0x10
1840 	#define DCBX_APP_SF_PORT             0x20
1841 	#define DCBX_APP_SF_UDP              0x40
1842 	#define DCBX_APP_SF_DEFAULT          0x80
1843 	u8  pri_bitmap;
1844 	u16  app_id;
1845 #endif
1846 };
1847 
1848 
1849 /* FW structure in BE */
1850 struct dcbx_app_priority_feature {
1851 #ifdef __BIG_ENDIAN
1852 	u8 reserved;
1853 	u8 default_pri;
1854 	u8 tc_supported;
1855 	u8 enabled;
1856 #elif defined(__LITTLE_ENDIAN)
1857 	u8 enabled;
1858 	u8 tc_supported;
1859 	u8 default_pri;
1860 	u8 reserved;
1861 #endif
1862 	struct dcbx_app_priority_entry  app_pri_tbl[DCBX_MAX_APP_PROTOCOL];
1863 };
1864 
1865 /* FW structure in BE */
1866 struct dcbx_features {
1867 	/* PG feature */
1868 	struct dcbx_ets_feature ets;
1869 	/* PFC feature */
1870 	struct dcbx_pfc_feature pfc;
1871 	/* APP feature */
1872 	struct dcbx_app_priority_feature app;
1873 };
1874 
1875 /* LLDP protocol parameters */
1876 /* FW structure in BE */
1877 struct lldp_params {
1878 #ifdef __BIG_ENDIAN
1879 	u8  msg_fast_tx_interval;
1880 	u8  msg_tx_hold;
1881 	u8  msg_tx_interval;
1882 	u8  admin_status;
1883 	#define LLDP_TX_ONLY  0x01
1884 	#define LLDP_RX_ONLY  0x02
1885 	#define LLDP_TX_RX    0x03
1886 	#define LLDP_DISABLED 0x04
1887 	u8  reserved1;
1888 	u8  tx_fast;
1889 	u8  tx_crd_max;
1890 	u8  tx_crd;
1891 #elif defined(__LITTLE_ENDIAN)
1892 	u8  admin_status;
1893 	#define LLDP_TX_ONLY  0x01
1894 	#define LLDP_RX_ONLY  0x02
1895 	#define LLDP_TX_RX    0x03
1896 	#define LLDP_DISABLED 0x04
1897 	u8  msg_tx_interval;
1898 	u8  msg_tx_hold;
1899 	u8  msg_fast_tx_interval;
1900 	u8  tx_crd;
1901 	u8  tx_crd_max;
1902 	u8  tx_fast;
1903 	u8  reserved1;
1904 #endif
1905 	#define REM_CHASSIS_ID_STAT_LEN 4
1906 	#define REM_PORT_ID_STAT_LEN 4
1907 	/* Holds remote Chassis ID TLV header, subtype and 9B of payload. */
1908 	u32 peer_chassis_id[REM_CHASSIS_ID_STAT_LEN];
1909 	/* Holds remote Port ID TLV header, subtype and 9B of payload. */
1910 	u32 peer_port_id[REM_PORT_ID_STAT_LEN];
1911 };
1912 
1913 struct lldp_dcbx_stat {
1914 	#define LOCAL_CHASSIS_ID_STAT_LEN 2
1915 	#define LOCAL_PORT_ID_STAT_LEN 2
1916 	/* Holds local Chassis ID 8B payload of constant subtype 4. */
1917 	u32 local_chassis_id[LOCAL_CHASSIS_ID_STAT_LEN];
1918 	/* Holds local Port ID 8B payload of constant subtype 3. */
1919 	u32 local_port_id[LOCAL_PORT_ID_STAT_LEN];
1920 	/* Number of DCBX frames transmitted. */
1921 	u32 num_tx_dcbx_pkts;
1922 	/* Number of DCBX frames received. */
1923 	u32 num_rx_dcbx_pkts;
1924 };
1925 
1926 /* ADMIN MIB - DCBX local machine default configuration. */
1927 struct lldp_admin_mib {
1928 	u32     ver_cfg_flags;
1929 	#define DCBX_ETS_CONFIG_TX_ENABLED       0x00000001
1930 	#define DCBX_PFC_CONFIG_TX_ENABLED       0x00000002
1931 	#define DCBX_APP_CONFIG_TX_ENABLED       0x00000004
1932 	#define DCBX_ETS_RECO_TX_ENABLED         0x00000008
1933 	#define DCBX_ETS_RECO_VALID              0x00000010
1934 	#define DCBX_ETS_WILLING                 0x00000020
1935 	#define DCBX_PFC_WILLING                 0x00000040
1936 	#define DCBX_APP_WILLING                 0x00000080
1937 	#define DCBX_VERSION_CEE                 0x00000100
1938 	#define DCBX_VERSION_IEEE                0x00000200
1939 	#define DCBX_DCBX_ENABLED                0x00000400
1940 	#define DCBX_CEE_VERSION_MASK            0x0000f000
1941 	#define DCBX_CEE_VERSION_SHIFT           12
1942 	#define DCBX_CEE_MAX_VERSION_MASK        0x000f0000
1943 	#define DCBX_CEE_MAX_VERSION_SHIFT       16
1944 	struct dcbx_features     features;
1945 };
1946 
1947 /* REMOTE MIB - remote machine DCBX configuration. */
1948 struct lldp_remote_mib {
1949 	u32 prefix_seq_num;
1950 	u32 flags;
1951 	#define DCBX_ETS_TLV_RX                  0x00000001
1952 	#define DCBX_PFC_TLV_RX                  0x00000002
1953 	#define DCBX_APP_TLV_RX                  0x00000004
1954 	#define DCBX_ETS_RX_ERROR                0x00000010
1955 	#define DCBX_PFC_RX_ERROR                0x00000020
1956 	#define DCBX_APP_RX_ERROR                0x00000040
1957 	#define DCBX_ETS_REM_WILLING             0x00000100
1958 	#define DCBX_PFC_REM_WILLING             0x00000200
1959 	#define DCBX_APP_REM_WILLING             0x00000400
1960 	#define DCBX_REMOTE_ETS_RECO_VALID       0x00001000
1961 	#define DCBX_REMOTE_MIB_VALID            0x00002000
1962 	struct dcbx_features features;
1963 	u32 suffix_seq_num;
1964 };
1965 
1966 /* LOCAL MIB - operational DCBX configuration - transmitted on Tx LLDPDU. */
1967 struct lldp_local_mib {
1968 	u32 prefix_seq_num;
1969 	/* Indicates if there is mismatch with negotiation results. */
1970 	u32 error;
1971 	#define DCBX_LOCAL_ETS_ERROR             0x00000001
1972 	#define DCBX_LOCAL_PFC_ERROR             0x00000002
1973 	#define DCBX_LOCAL_APP_ERROR             0x00000004
1974 	#define DCBX_LOCAL_PFC_MISMATCH          0x00000010
1975 	#define DCBX_LOCAL_APP_MISMATCH          0x00000020
1976 	#define DCBX_REMOTE_MIB_ERROR		 0x00000040
1977 	#define DCBX_REMOTE_ETS_TLV_NOT_FOUND    0x00000080
1978 	#define DCBX_REMOTE_PFC_TLV_NOT_FOUND    0x00000100
1979 	#define DCBX_REMOTE_APP_TLV_NOT_FOUND    0x00000200
1980 	struct dcbx_features   features;
1981 	u32 suffix_seq_num;
1982 };
1983 /***END OF DCBX STRUCTURES DECLARATIONS***/
1984 
1985 /***********************************************************/
1986 /*                         Elink section                   */
1987 /***********************************************************/
1988 #define SHMEM_LINK_CONFIG_SIZE 2
1989 struct shmem_lfa {
1990 	u32 req_duplex;
1991 	#define REQ_DUPLEX_PHY0_MASK        0x0000ffff
1992 	#define REQ_DUPLEX_PHY0_SHIFT       0
1993 	#define REQ_DUPLEX_PHY1_MASK        0xffff0000
1994 	#define REQ_DUPLEX_PHY1_SHIFT       16
1995 	u32 req_flow_ctrl;
1996 	#define REQ_FLOW_CTRL_PHY0_MASK     0x0000ffff
1997 	#define REQ_FLOW_CTRL_PHY0_SHIFT    0
1998 	#define REQ_FLOW_CTRL_PHY1_MASK     0xffff0000
1999 	#define REQ_FLOW_CTRL_PHY1_SHIFT    16
2000 	u32 req_line_speed; /* Also determine AutoNeg */
2001 	#define REQ_LINE_SPD_PHY0_MASK      0x0000ffff
2002 	#define REQ_LINE_SPD_PHY0_SHIFT     0
2003 	#define REQ_LINE_SPD_PHY1_MASK      0xffff0000
2004 	#define REQ_LINE_SPD_PHY1_SHIFT     16
2005 	u32 speed_cap_mask[SHMEM_LINK_CONFIG_SIZE];
2006 	u32 additional_config;
2007 	#define REQ_FC_AUTO_ADV_MASK        0x0000ffff
2008 	#define REQ_FC_AUTO_ADV0_SHIFT      0
2009 	#define NO_LFA_DUE_TO_DCC_MASK      0x00010000
2010 	u32 lfa_sts;
2011 	#define LFA_LINK_FLAP_REASON_OFFSET		0
2012 	#define LFA_LINK_FLAP_REASON_MASK		0x000000ff
2013 		#define LFA_LINK_DOWN			    0x1
2014 		#define LFA_LOOPBACK_ENABLED		0x2
2015 		#define LFA_DUPLEX_MISMATCH		    0x3
2016 		#define LFA_MFW_IS_TOO_OLD		    0x4
2017 		#define LFA_LINK_SPEED_MISMATCH		0x5
2018 		#define LFA_FLOW_CTRL_MISMATCH		0x6
2019 		#define LFA_SPEED_CAP_MISMATCH		0x7
2020 		#define LFA_DCC_LFA_DISABLED		0x8
2021 		#define LFA_EEE_MISMATCH		0x9
2022 
2023 	#define LINK_FLAP_AVOIDANCE_COUNT_OFFSET	8
2024 	#define LINK_FLAP_AVOIDANCE_COUNT_MASK		0x0000ff00
2025 
2026 	#define LINK_FLAP_COUNT_OFFSET			16
2027 	#define LINK_FLAP_COUNT_MASK			0x00ff0000
2028 
2029 	#define LFA_FLAGS_MASK				0xff000000
2030 	#define SHMEM_LFA_DONT_CLEAR_STAT		(1<<24)
2031 };
2032 
2033 /* Used to support NSCI get OS driver version
2034  * on driver load the version value will be set
2035  * on driver unload driver value of 0x0 will be set.
2036  */
2037 struct os_drv_ver {
2038 #define DRV_VER_NOT_LOADED			0
2039 
2040 	/* personalties order is important */
2041 #define DRV_PERS_ETHERNET			0
2042 #define DRV_PERS_ISCSI				1
2043 #define DRV_PERS_FCOE				2
2044 
2045 	/* shmem2 struct is constant can't add more personalties here */
2046 #define MAX_DRV_PERS				3
2047 	u32 versions[MAX_DRV_PERS];
2048 };
2049 
2050 struct ncsi_oem_fcoe_features {
2051 	u32 fcoe_features1;
2052 	#define FCOE_FEATURES1_IOS_PER_CONNECTION_MASK          0x0000FFFF
2053 	#define FCOE_FEATURES1_IOS_PER_CONNECTION_OFFSET        0
2054 
2055 	#define FCOE_FEATURES1_LOGINS_PER_PORT_MASK             0xFFFF0000
2056 	#define FCOE_FEATURES1_LOGINS_PER_PORT_OFFSET           16
2057 
2058 	u32 fcoe_features2;
2059 	#define FCOE_FEATURES2_EXCHANGES_MASK                   0x0000FFFF
2060 	#define FCOE_FEATURES2_EXCHANGES_OFFSET                 0
2061 
2062 	#define FCOE_FEATURES2_NPIV_WWN_PER_PORT_MASK           0xFFFF0000
2063 	#define FCOE_FEATURES2_NPIV_WWN_PER_PORT_OFFSET         16
2064 
2065 	u32 fcoe_features3;
2066 	#define FCOE_FEATURES3_TARGETS_SUPPORTED_MASK           0x0000FFFF
2067 	#define FCOE_FEATURES3_TARGETS_SUPPORTED_OFFSET         0
2068 
2069 	#define FCOE_FEATURES3_OUTSTANDING_COMMANDS_MASK        0xFFFF0000
2070 	#define FCOE_FEATURES3_OUTSTANDING_COMMANDS_OFFSET      16
2071 
2072 	u32 fcoe_features4;
2073 	#define FCOE_FEATURES4_FEATURE_SETTINGS_MASK            0x0000000F
2074 	#define FCOE_FEATURES4_FEATURE_SETTINGS_OFFSET          0
2075 };
2076 
2077 enum curr_cfg_method_e {
2078 	CURR_CFG_MET_NONE = 0,  /* default config */
2079 	CURR_CFG_MET_OS = 1,
2080 	CURR_CFG_MET_VENDOR_SPEC = 2,/* e.g. Option ROM, NPAR, O/S Cfg Utils */
2081 };
2082 
2083 #define FC_NPIV_WWPN_SIZE 8
2084 #define FC_NPIV_WWNN_SIZE 8
2085 struct bdn_npiv_settings {
2086 	u8 npiv_wwpn[FC_NPIV_WWPN_SIZE];
2087 	u8 npiv_wwnn[FC_NPIV_WWNN_SIZE];
2088 };
2089 
2090 struct bdn_fc_npiv_cfg {
2091 	/* hdr used internally by the MFW */
2092 	u32 hdr;
2093 	u32 num_of_npiv;
2094 };
2095 
2096 #define MAX_NUMBER_NPIV 64
2097 struct bdn_fc_npiv_tbl {
2098 	struct bdn_fc_npiv_cfg fc_npiv_cfg;
2099 	struct bdn_npiv_settings settings[MAX_NUMBER_NPIV];
2100 };
2101 
2102 struct mdump_driver_info {
2103 	u32 epoc;
2104 	u32 drv_ver;
2105 	u32 fw_ver;
2106 
2107 	u32 valid_dump;
2108 	#define FIRST_DUMP_VALID        (1 << 0)
2109 	#define SECOND_DUMP_VALID       (1 << 1)
2110 
2111 	u32 flags;
2112 	#define ENABLE_ALL_TRIGGERS     (0x7fffffff)
2113 	#define TRIGGER_MDUMP_ONCE      (1 << 31)
2114 };
2115 
2116 struct ncsi_oem_data {
2117 	u32 driver_version[4];
2118 	struct ncsi_oem_fcoe_features ncsi_oem_fcoe_features;
2119 };
2120 
2121 struct shmem2_region {
2122 
2123 	u32 size;					/* 0x0000 */
2124 
2125 	u32 dcc_support;				/* 0x0004 */
2126 	#define SHMEM_DCC_SUPPORT_NONE                      0x00000000
2127 	#define SHMEM_DCC_SUPPORT_DISABLE_ENABLE_PF_TLV     0x00000001
2128 	#define SHMEM_DCC_SUPPORT_BANDWIDTH_ALLOCATION_TLV  0x00000004
2129 	#define SHMEM_DCC_SUPPORT_CHANGE_MAC_ADDRESS_TLV    0x00000008
2130 	#define SHMEM_DCC_SUPPORT_SET_PROTOCOL_TLV          0x00000040
2131 	#define SHMEM_DCC_SUPPORT_SET_PRIORITY_TLV          0x00000080
2132 
2133 	u32 ext_phy_fw_version2[PORT_MAX];		/* 0x0008 */
2134 	/*
2135 	 * For backwards compatibility, if the mf_cfg_addr does not exist
2136 	 * (the size filed is smaller than 0xc) the mf_cfg resides at the
2137 	 * end of struct shmem_region
2138 	 */
2139 	u32 mf_cfg_addr;				/* 0x0010 */
2140 	#define SHMEM_MF_CFG_ADDR_NONE                  0x00000000
2141 
2142 	struct fw_flr_mb flr_mb;			/* 0x0014 */
2143 	u32 dcbx_lldp_params_offset;			/* 0x0028 */
2144 	#define SHMEM_LLDP_DCBX_PARAMS_NONE             0x00000000
2145 	u32 dcbx_neg_res_offset;			/* 0x002c */
2146 	#define SHMEM_DCBX_NEG_RES_NONE			0x00000000
2147 	u32 dcbx_remote_mib_offset;			/* 0x0030 */
2148 	#define SHMEM_DCBX_REMOTE_MIB_NONE              0x00000000
2149 	/*
2150 	 * The other shmemX_base_addr holds the other path's shmem address
2151 	 * required for example in case of common phy init, or for path1 to know
2152 	 * the address of mcp debug trace which is located in offset from shmem
2153 	 * of path0
2154 	 */
2155 	u32 other_shmem_base_addr;			/* 0x0034 */
2156 	u32 other_shmem2_base_addr;			/* 0x0038 */
2157 	/*
2158 	 * mcp_vf_disabled is set by the MCP to indicate the driver about VFs
2159 	 * which were disabled/flred
2160 	 */
2161 	u32 mcp_vf_disabled[E2_VF_MAX / 32];		/* 0x003c */
2162 
2163 	/*
2164 	 * drv_ack_vf_disabled is set by the PF driver to ack handled disabled
2165 	 * VFs
2166 	 */
2167 	u32 drv_ack_vf_disabled[E2_FUNC_MAX][E2_VF_MAX / 32]; /* 0x0044 */
2168 
2169 	u32 dcbx_lldp_dcbx_stat_offset;			/* 0x0064 */
2170 	#define SHMEM_LLDP_DCBX_STAT_NONE               0x00000000
2171 
2172 	/*
2173 	 * edebug_driver_if field is used to transfer messages between edebug
2174 	 * app to the driver through shmem2.
2175 	 *
2176 	 * message format:
2177 	 * bits 0-2 -  function number / instance of driver to perform request
2178 	 * bits 3-5 -  op code / is_ack?
2179 	 * bits 6-63 - data
2180 	 */
2181 	u32 edebug_driver_if[2];			/* 0x0068 */
2182 	#define EDEBUG_DRIVER_IF_OP_CODE_GET_PHYS_ADDR  1
2183 	#define EDEBUG_DRIVER_IF_OP_CODE_GET_BUS_ADDR   2
2184 	#define EDEBUG_DRIVER_IF_OP_CODE_DISABLE_STAT   3
2185 
2186 	u32 nvm_retain_bitmap_addr;			/* 0x0070 */
2187 
2188 	/* afex support of that driver */
2189 	u32 afex_driver_support;			/* 0x0074 */
2190 	#define SHMEM_AFEX_VERSION_MASK                  0x100f
2191 	#define SHMEM_AFEX_SUPPORTED_VERSION_ONE         0x1001
2192 	#define SHMEM_AFEX_REDUCED_DRV_LOADED            0x8000
2193 
2194 	/* driver receives addr in scratchpad to which it should respond */
2195 	u32 afex_scratchpad_addr_to_write[E2_FUNC_MAX];
2196 
2197 	/* generic params from MCP to driver (value depends on the msg sent
2198 	 * to driver
2199 	 */
2200 	u32 afex_param1_to_driver[E2_FUNC_MAX];		/* 0x0088 */
2201 	u32 afex_param2_to_driver[E2_FUNC_MAX];		/* 0x0098 */
2202 
2203 	u32 swim_base_addr;				/* 0x0108 */
2204 	u32 swim_funcs;
2205 	u32 swim_main_cb;
2206 
2207 	/* bitmap notifying which VIF profiles stored in nvram are enabled by
2208 	 * switch
2209 	 */
2210 	u32 afex_profiles_enabled[2];
2211 
2212 	/* generic flags controlled by the driver */
2213 	u32 drv_flags;
2214 	#define DRV_FLAGS_DCB_CONFIGURED		0x0
2215 	#define DRV_FLAGS_DCB_CONFIGURATION_ABORTED	0x1
2216 	#define DRV_FLAGS_DCB_MFW_CONFIGURED	0x2
2217 
2218 	#define DRV_FLAGS_PORT_MASK	((1 << DRV_FLAGS_DCB_CONFIGURED) | \
2219 			(1 << DRV_FLAGS_DCB_CONFIGURATION_ABORTED) | \
2220 			(1 << DRV_FLAGS_DCB_MFW_CONFIGURED))
2221 	/* pointer to extended dev_info shared data copied from nvm image */
2222 	u32 extended_dev_info_shared_addr;
2223 	u32 ncsi_oem_data_addr;
2224 
2225 	u32 ocsd_host_addr; /* initialized by option ROM */
2226 	u32 ocbb_host_addr; /* initialized by option ROM */
2227 	u32 ocsd_req_update_interval; /* initialized by option ROM */
2228 	u32 temperature_in_half_celsius;
2229 	u32 glob_struct_in_host;
2230 
2231 	u32 dcbx_neg_res_ext_offset;
2232 #define SHMEM_DCBX_NEG_RES_EXT_NONE			0x00000000
2233 
2234 	u32 drv_capabilities_flag[E2_FUNC_MAX];
2235 #define DRV_FLAGS_CAPABILITIES_LOADED_SUPPORTED 0x00000001
2236 #define DRV_FLAGS_CAPABILITIES_LOADED_L2        0x00000002
2237 #define DRV_FLAGS_CAPABILITIES_LOADED_FCOE      0x00000004
2238 #define DRV_FLAGS_CAPABILITIES_LOADED_ISCSI     0x00000008
2239 #define DRV_FLAGS_MTU_MASK			0xffff0000
2240 #define DRV_FLAGS_MTU_SHIFT			16
2241 
2242 	u32 extended_dev_info_shared_cfg_size;
2243 
2244 	u32 dcbx_en[PORT_MAX];
2245 
2246 	/* The offset points to the multi threaded meta structure */
2247 	u32 multi_thread_data_offset;
2248 
2249 	/* address of DMAable host address holding values from the drivers */
2250 	u32 drv_info_host_addr_lo;
2251 	u32 drv_info_host_addr_hi;
2252 
2253 	/* general values written by the MFW (such as current version) */
2254 	u32 drv_info_control;
2255 #define DRV_INFO_CONTROL_VER_MASK          0x000000ff
2256 #define DRV_INFO_CONTROL_VER_SHIFT         0
2257 #define DRV_INFO_CONTROL_OP_CODE_MASK      0x0000ff00
2258 #define DRV_INFO_CONTROL_OP_CODE_SHIFT     8
2259 	u32 ibft_host_addr; /* initialized by option ROM */
2260 	struct eee_remote_vals eee_remote_vals[PORT_MAX];
2261 	u32 reserved[E2_FUNC_MAX];
2262 
2263 
2264 	/* the status of EEE auto-negotiation
2265 	 * bits 15:0 the configured tx-lpi entry timer value. Depends on bit 31.
2266 	 * bits 19:16 the supported modes for EEE.
2267 	 * bits 23:20 the speeds advertised for EEE.
2268 	 * bits 27:24 the speeds the Link partner advertised for EEE.
2269 	 * The supported/adv. modes in bits 27:19 originate from the
2270 	 * SHMEM_EEE_XXX_ADV definitions (where XXX is replaced by speed).
2271 	 * bit 28 when 1'b1 EEE was requested.
2272 	 * bit 29 when 1'b1 tx lpi was requested.
2273 	 * bit 30 when 1'b1 EEE was negotiated. Tx lpi will be asserted iff
2274 	 * 30:29 are 2'b11.
2275 	 * bit 31 when 1'b0 bits 15:0 contain a PORT_FEAT_CFG_EEE_ define as
2276 	 * value. When 1'b1 those bits contains a value times 16 microseconds.
2277 	 */
2278 	u32 eee_status[PORT_MAX];
2279 	#define SHMEM_EEE_TIMER_MASK		   0x0000ffff
2280 	#define SHMEM_EEE_SUPPORTED_MASK	   0x000f0000
2281 	#define SHMEM_EEE_SUPPORTED_SHIFT	   16
2282 	#define SHMEM_EEE_ADV_STATUS_MASK	   0x00f00000
2283 		#define SHMEM_EEE_100M_ADV	   (1<<0)
2284 		#define SHMEM_EEE_1G_ADV	   (1<<1)
2285 		#define SHMEM_EEE_10G_ADV	   (1<<2)
2286 	#define SHMEM_EEE_ADV_STATUS_SHIFT	   20
2287 	#define	SHMEM_EEE_LP_ADV_STATUS_MASK	   0x0f000000
2288 	#define SHMEM_EEE_LP_ADV_STATUS_SHIFT	   24
2289 	#define SHMEM_EEE_REQUESTED_BIT		   0x10000000
2290 	#define SHMEM_EEE_LPI_REQUESTED_BIT	   0x20000000
2291 	#define SHMEM_EEE_ACTIVE_BIT		   0x40000000
2292 	#define SHMEM_EEE_TIME_OUTPUT_BIT	   0x80000000
2293 
2294 	u32 sizeof_port_stats;
2295 
2296 	/* Link Flap Avoidance */
2297 	u32 lfa_host_addr[PORT_MAX];
2298 	u32 reserved1;
2299 
2300 	u32 reserved2;				/* Offset 0x148 */
2301 	u32 reserved3;				/* Offset 0x14C */
2302 	u32 reserved4;				/* Offset 0x150 */
2303 	u32 link_attr_sync[PORT_MAX];		/* Offset 0x154 */
2304 	#define LINK_ATTR_SYNC_KR2_ENABLE	0x00000001
2305 	#define LINK_ATTR_84858			0x00000002
2306 	#define LINK_SFP_EEPROM_COMP_CODE_MASK	0x0000ff00
2307 	#define LINK_SFP_EEPROM_COMP_CODE_SHIFT		 8
2308 	#define LINK_SFP_EEPROM_COMP_CODE_SR	0x00001000
2309 	#define LINK_SFP_EEPROM_COMP_CODE_LR	0x00002000
2310 	#define LINK_SFP_EEPROM_COMP_CODE_LRM	0x00004000
2311 
2312 	u32 reserved5[2];
2313 	u32 link_change_count[PORT_MAX];        /* Offset 0x160-0x164 */
2314 	#define LINK_CHANGE_COUNT_MASK 0xff     /* Offset 0x168 */
2315 	/* driver version for each personality */
2316 	struct os_drv_ver func_os_drv_ver[E2_FUNC_MAX]; /* Offset 0x16c */
2317 
2318 	/* Flag to the driver that PF's drv_info_host_addr buffer was read  */
2319 	u32 mfw_drv_indication;
2320 
2321 	/* We use indication for each PF (0..3) */
2322 #define MFW_DRV_IND_READ_DONE_OFFSET(_pf_) (1 << (_pf_))
2323 	union { /* For various OEMs */			/* Offset 0x1a0 */
2324 		u8 storage_boot_prog[E2_FUNC_MAX];
2325 	#define STORAGE_BOOT_PROG_MASK				0x000000FF
2326 	#define STORAGE_BOOT_PROG_NONE				0x00000000
2327 	#define STORAGE_BOOT_PROG_ISCSI_IP_ACQUIRED		0x00000002
2328 	#define STORAGE_BOOT_PROG_FCOE_FABRIC_LOGIN_SUCCESS	0x00000002
2329 	#define STORAGE_BOOT_PROG_TARGET_FOUND			0x00000004
2330 	#define STORAGE_BOOT_PROG_ISCSI_CHAP_SUCCESS		0x00000008
2331 	#define STORAGE_BOOT_PROG_FCOE_LUN_FOUND		0x00000008
2332 	#define STORAGE_BOOT_PROG_LOGGED_INTO_TGT		0x00000010
2333 	#define STORAGE_BOOT_PROG_IMG_DOWNLOADED		0x00000020
2334 	#define STORAGE_BOOT_PROG_OS_HANDOFF			0x00000040
2335 	#define STORAGE_BOOT_PROG_COMPLETED			0x00000080
2336 
2337 		u32 oem_i2c_data_addr;
2338 	};
2339 
2340 	/* 9 entires for the C2S PCP map for each inner VLAN PCP + 1 default */
2341 	/* For PCP values 0-3 use the map lower */
2342 	/* 0xFF000000 - PCP 0, 0x00FF0000 - PCP 1,
2343 	 * 0x0000FF00 - PCP 2, 0x000000FF PCP 3
2344 	 */
2345 	u32 c2s_pcp_map_lower[E2_FUNC_MAX];			/* 0x1a4 */
2346 
2347 	/* For PCP values 4-7 use the map upper */
2348 	/* 0xFF000000 - PCP 4, 0x00FF0000 - PCP 5,
2349 	 * 0x0000FF00 - PCP 6, 0x000000FF PCP 7
2350 	 */
2351 	u32 c2s_pcp_map_upper[E2_FUNC_MAX];			/* 0x1b4 */
2352 
2353 	/* For PCP default value get the MSB byte of the map default */
2354 	u32 c2s_pcp_map_default[E2_FUNC_MAX];			/* 0x1c4 */
2355 
2356 	/* FC_NPIV table offset in NVRAM */
2357 	u32 fc_npiv_nvram_tbl_addr[PORT_MAX];			/* 0x1d4 */
2358 
2359 	/* Shows last method that changed configuration of this device */
2360 	enum curr_cfg_method_e curr_cfg;			/* 0x1dc */
2361 
2362 	/* Storm FW version, shold be kept in the format 0xMMmmbbdd:
2363 	 * MM - Major, mm - Minor, bb - Build ,dd - Drop
2364 	 */
2365 	u32 netproc_fw_ver;					/* 0x1e0 */
2366 
2367 	/* Option ROM SMASH CLP version */
2368 	u32 clp_ver;						/* 0x1e4 */
2369 
2370 	u32 pcie_bus_num;					/* 0x1e8 */
2371 
2372 	u32 sriov_switch_mode;					/* 0x1ec */
2373 	#define SRIOV_SWITCH_MODE_NONE		0x0
2374 	#define SRIOV_SWITCH_MODE_VEB		0x1
2375 	#define SRIOV_SWITCH_MODE_VEPA		0x2
2376 
2377 	u8  rsrv2[E2_FUNC_MAX];					/* 0x1f0 */
2378 
2379 	u32 img_inv_table_addr;	/* Address to INV_TABLE_P */	/* 0x1f4 */
2380 
2381 	u32 mtu_size[E2_FUNC_MAX];				/* 0x1f8 */
2382 
2383 	u32 os_driver_state[E2_FUNC_MAX];			/* 0x208 */
2384 	#define OS_DRIVER_STATE_NOT_LOADED	0 /* not installed */
2385 	#define OS_DRIVER_STATE_LOADING		1 /* transition state */
2386 	#define OS_DRIVER_STATE_DISABLED	2 /* installed but disabled */
2387 	#define OS_DRIVER_STATE_ACTIVE		3 /* installed and active */
2388 
2389 	/* mini dump driver info */
2390 	struct mdump_driver_info drv_info;			/* 0x218 */
2391 };
2392 
2393 
2394 struct emac_stats {
2395 	u32     rx_stat_ifhcinoctets;
2396 	u32     rx_stat_ifhcinbadoctets;
2397 	u32     rx_stat_etherstatsfragments;
2398 	u32     rx_stat_ifhcinucastpkts;
2399 	u32     rx_stat_ifhcinmulticastpkts;
2400 	u32     rx_stat_ifhcinbroadcastpkts;
2401 	u32     rx_stat_dot3statsfcserrors;
2402 	u32     rx_stat_dot3statsalignmenterrors;
2403 	u32     rx_stat_dot3statscarriersenseerrors;
2404 	u32     rx_stat_xonpauseframesreceived;
2405 	u32     rx_stat_xoffpauseframesreceived;
2406 	u32     rx_stat_maccontrolframesreceived;
2407 	u32     rx_stat_xoffstateentered;
2408 	u32     rx_stat_dot3statsframestoolong;
2409 	u32     rx_stat_etherstatsjabbers;
2410 	u32     rx_stat_etherstatsundersizepkts;
2411 	u32     rx_stat_etherstatspkts64octets;
2412 	u32     rx_stat_etherstatspkts65octetsto127octets;
2413 	u32     rx_stat_etherstatspkts128octetsto255octets;
2414 	u32     rx_stat_etherstatspkts256octetsto511octets;
2415 	u32     rx_stat_etherstatspkts512octetsto1023octets;
2416 	u32     rx_stat_etherstatspkts1024octetsto1522octets;
2417 	u32     rx_stat_etherstatspktsover1522octets;
2418 
2419 	u32     rx_stat_falsecarriererrors;
2420 
2421 	u32     tx_stat_ifhcoutoctets;
2422 	u32     tx_stat_ifhcoutbadoctets;
2423 	u32     tx_stat_etherstatscollisions;
2424 	u32     tx_stat_outxonsent;
2425 	u32     tx_stat_outxoffsent;
2426 	u32     tx_stat_flowcontroldone;
2427 	u32     tx_stat_dot3statssinglecollisionframes;
2428 	u32     tx_stat_dot3statsmultiplecollisionframes;
2429 	u32     tx_stat_dot3statsdeferredtransmissions;
2430 	u32     tx_stat_dot3statsexcessivecollisions;
2431 	u32     tx_stat_dot3statslatecollisions;
2432 	u32     tx_stat_ifhcoutucastpkts;
2433 	u32     tx_stat_ifhcoutmulticastpkts;
2434 	u32     tx_stat_ifhcoutbroadcastpkts;
2435 	u32     tx_stat_etherstatspkts64octets;
2436 	u32     tx_stat_etherstatspkts65octetsto127octets;
2437 	u32     tx_stat_etherstatspkts128octetsto255octets;
2438 	u32     tx_stat_etherstatspkts256octetsto511octets;
2439 	u32     tx_stat_etherstatspkts512octetsto1023octets;
2440 	u32     tx_stat_etherstatspkts1024octetsto1522octets;
2441 	u32     tx_stat_etherstatspktsover1522octets;
2442 	u32     tx_stat_dot3statsinternalmactransmiterrors;
2443 };
2444 
2445 
2446 struct bmac1_stats {
2447 	u32	tx_stat_gtpkt_lo;
2448 	u32	tx_stat_gtpkt_hi;
2449 	u32	tx_stat_gtxpf_lo;
2450 	u32	tx_stat_gtxpf_hi;
2451 	u32	tx_stat_gtfcs_lo;
2452 	u32	tx_stat_gtfcs_hi;
2453 	u32	tx_stat_gtmca_lo;
2454 	u32	tx_stat_gtmca_hi;
2455 	u32	tx_stat_gtbca_lo;
2456 	u32	tx_stat_gtbca_hi;
2457 	u32	tx_stat_gtfrg_lo;
2458 	u32	tx_stat_gtfrg_hi;
2459 	u32	tx_stat_gtovr_lo;
2460 	u32	tx_stat_gtovr_hi;
2461 	u32	tx_stat_gt64_lo;
2462 	u32	tx_stat_gt64_hi;
2463 	u32	tx_stat_gt127_lo;
2464 	u32	tx_stat_gt127_hi;
2465 	u32	tx_stat_gt255_lo;
2466 	u32	tx_stat_gt255_hi;
2467 	u32	tx_stat_gt511_lo;
2468 	u32	tx_stat_gt511_hi;
2469 	u32	tx_stat_gt1023_lo;
2470 	u32	tx_stat_gt1023_hi;
2471 	u32	tx_stat_gt1518_lo;
2472 	u32	tx_stat_gt1518_hi;
2473 	u32	tx_stat_gt2047_lo;
2474 	u32	tx_stat_gt2047_hi;
2475 	u32	tx_stat_gt4095_lo;
2476 	u32	tx_stat_gt4095_hi;
2477 	u32	tx_stat_gt9216_lo;
2478 	u32	tx_stat_gt9216_hi;
2479 	u32	tx_stat_gt16383_lo;
2480 	u32	tx_stat_gt16383_hi;
2481 	u32	tx_stat_gtmax_lo;
2482 	u32	tx_stat_gtmax_hi;
2483 	u32	tx_stat_gtufl_lo;
2484 	u32	tx_stat_gtufl_hi;
2485 	u32	tx_stat_gterr_lo;
2486 	u32	tx_stat_gterr_hi;
2487 	u32	tx_stat_gtbyt_lo;
2488 	u32	tx_stat_gtbyt_hi;
2489 
2490 	u32	rx_stat_gr64_lo;
2491 	u32	rx_stat_gr64_hi;
2492 	u32	rx_stat_gr127_lo;
2493 	u32	rx_stat_gr127_hi;
2494 	u32	rx_stat_gr255_lo;
2495 	u32	rx_stat_gr255_hi;
2496 	u32	rx_stat_gr511_lo;
2497 	u32	rx_stat_gr511_hi;
2498 	u32	rx_stat_gr1023_lo;
2499 	u32	rx_stat_gr1023_hi;
2500 	u32	rx_stat_gr1518_lo;
2501 	u32	rx_stat_gr1518_hi;
2502 	u32	rx_stat_gr2047_lo;
2503 	u32	rx_stat_gr2047_hi;
2504 	u32	rx_stat_gr4095_lo;
2505 	u32	rx_stat_gr4095_hi;
2506 	u32	rx_stat_gr9216_lo;
2507 	u32	rx_stat_gr9216_hi;
2508 	u32	rx_stat_gr16383_lo;
2509 	u32	rx_stat_gr16383_hi;
2510 	u32	rx_stat_grmax_lo;
2511 	u32	rx_stat_grmax_hi;
2512 	u32	rx_stat_grpkt_lo;
2513 	u32	rx_stat_grpkt_hi;
2514 	u32	rx_stat_grfcs_lo;
2515 	u32	rx_stat_grfcs_hi;
2516 	u32	rx_stat_grmca_lo;
2517 	u32	rx_stat_grmca_hi;
2518 	u32	rx_stat_grbca_lo;
2519 	u32	rx_stat_grbca_hi;
2520 	u32	rx_stat_grxcf_lo;
2521 	u32	rx_stat_grxcf_hi;
2522 	u32	rx_stat_grxpf_lo;
2523 	u32	rx_stat_grxpf_hi;
2524 	u32	rx_stat_grxuo_lo;
2525 	u32	rx_stat_grxuo_hi;
2526 	u32	rx_stat_grjbr_lo;
2527 	u32	rx_stat_grjbr_hi;
2528 	u32	rx_stat_grovr_lo;
2529 	u32	rx_stat_grovr_hi;
2530 	u32	rx_stat_grflr_lo;
2531 	u32	rx_stat_grflr_hi;
2532 	u32	rx_stat_grmeg_lo;
2533 	u32	rx_stat_grmeg_hi;
2534 	u32	rx_stat_grmeb_lo;
2535 	u32	rx_stat_grmeb_hi;
2536 	u32	rx_stat_grbyt_lo;
2537 	u32	rx_stat_grbyt_hi;
2538 	u32	rx_stat_grund_lo;
2539 	u32	rx_stat_grund_hi;
2540 	u32	rx_stat_grfrg_lo;
2541 	u32	rx_stat_grfrg_hi;
2542 	u32	rx_stat_grerb_lo;
2543 	u32	rx_stat_grerb_hi;
2544 	u32	rx_stat_grfre_lo;
2545 	u32	rx_stat_grfre_hi;
2546 	u32	rx_stat_gripj_lo;
2547 	u32	rx_stat_gripj_hi;
2548 };
2549 
2550 struct bmac2_stats {
2551 	u32	tx_stat_gtpk_lo; /* gtpok */
2552 	u32	tx_stat_gtpk_hi; /* gtpok */
2553 	u32	tx_stat_gtxpf_lo; /* gtpf */
2554 	u32	tx_stat_gtxpf_hi; /* gtpf */
2555 	u32	tx_stat_gtpp_lo; /* NEW BMAC2 */
2556 	u32	tx_stat_gtpp_hi; /* NEW BMAC2 */
2557 	u32	tx_stat_gtfcs_lo;
2558 	u32	tx_stat_gtfcs_hi;
2559 	u32	tx_stat_gtuca_lo; /* NEW BMAC2 */
2560 	u32	tx_stat_gtuca_hi; /* NEW BMAC2 */
2561 	u32	tx_stat_gtmca_lo;
2562 	u32	tx_stat_gtmca_hi;
2563 	u32	tx_stat_gtbca_lo;
2564 	u32	tx_stat_gtbca_hi;
2565 	u32	tx_stat_gtovr_lo;
2566 	u32	tx_stat_gtovr_hi;
2567 	u32	tx_stat_gtfrg_lo;
2568 	u32	tx_stat_gtfrg_hi;
2569 	u32	tx_stat_gtpkt1_lo; /* gtpkt */
2570 	u32	tx_stat_gtpkt1_hi; /* gtpkt */
2571 	u32	tx_stat_gt64_lo;
2572 	u32	tx_stat_gt64_hi;
2573 	u32	tx_stat_gt127_lo;
2574 	u32	tx_stat_gt127_hi;
2575 	u32	tx_stat_gt255_lo;
2576 	u32	tx_stat_gt255_hi;
2577 	u32	tx_stat_gt511_lo;
2578 	u32	tx_stat_gt511_hi;
2579 	u32	tx_stat_gt1023_lo;
2580 	u32	tx_stat_gt1023_hi;
2581 	u32	tx_stat_gt1518_lo;
2582 	u32	tx_stat_gt1518_hi;
2583 	u32	tx_stat_gt2047_lo;
2584 	u32	tx_stat_gt2047_hi;
2585 	u32	tx_stat_gt4095_lo;
2586 	u32	tx_stat_gt4095_hi;
2587 	u32	tx_stat_gt9216_lo;
2588 	u32	tx_stat_gt9216_hi;
2589 	u32	tx_stat_gt16383_lo;
2590 	u32	tx_stat_gt16383_hi;
2591 	u32	tx_stat_gtmax_lo;
2592 	u32	tx_stat_gtmax_hi;
2593 	u32	tx_stat_gtufl_lo;
2594 	u32	tx_stat_gtufl_hi;
2595 	u32	tx_stat_gterr_lo;
2596 	u32	tx_stat_gterr_hi;
2597 	u32	tx_stat_gtbyt_lo;
2598 	u32	tx_stat_gtbyt_hi;
2599 
2600 	u32	rx_stat_gr64_lo;
2601 	u32	rx_stat_gr64_hi;
2602 	u32	rx_stat_gr127_lo;
2603 	u32	rx_stat_gr127_hi;
2604 	u32	rx_stat_gr255_lo;
2605 	u32	rx_stat_gr255_hi;
2606 	u32	rx_stat_gr511_lo;
2607 	u32	rx_stat_gr511_hi;
2608 	u32	rx_stat_gr1023_lo;
2609 	u32	rx_stat_gr1023_hi;
2610 	u32	rx_stat_gr1518_lo;
2611 	u32	rx_stat_gr1518_hi;
2612 	u32	rx_stat_gr2047_lo;
2613 	u32	rx_stat_gr2047_hi;
2614 	u32	rx_stat_gr4095_lo;
2615 	u32	rx_stat_gr4095_hi;
2616 	u32	rx_stat_gr9216_lo;
2617 	u32	rx_stat_gr9216_hi;
2618 	u32	rx_stat_gr16383_lo;
2619 	u32	rx_stat_gr16383_hi;
2620 	u32	rx_stat_grmax_lo;
2621 	u32	rx_stat_grmax_hi;
2622 	u32	rx_stat_grpkt_lo;
2623 	u32	rx_stat_grpkt_hi;
2624 	u32	rx_stat_grfcs_lo;
2625 	u32	rx_stat_grfcs_hi;
2626 	u32	rx_stat_gruca_lo;
2627 	u32	rx_stat_gruca_hi;
2628 	u32	rx_stat_grmca_lo;
2629 	u32	rx_stat_grmca_hi;
2630 	u32	rx_stat_grbca_lo;
2631 	u32	rx_stat_grbca_hi;
2632 	u32	rx_stat_grxpf_lo; /* grpf */
2633 	u32	rx_stat_grxpf_hi; /* grpf */
2634 	u32	rx_stat_grpp_lo;
2635 	u32	rx_stat_grpp_hi;
2636 	u32	rx_stat_grxuo_lo; /* gruo */
2637 	u32	rx_stat_grxuo_hi; /* gruo */
2638 	u32	rx_stat_grjbr_lo;
2639 	u32	rx_stat_grjbr_hi;
2640 	u32	rx_stat_grovr_lo;
2641 	u32	rx_stat_grovr_hi;
2642 	u32	rx_stat_grxcf_lo; /* grcf */
2643 	u32	rx_stat_grxcf_hi; /* grcf */
2644 	u32	rx_stat_grflr_lo;
2645 	u32	rx_stat_grflr_hi;
2646 	u32	rx_stat_grpok_lo;
2647 	u32	rx_stat_grpok_hi;
2648 	u32	rx_stat_grmeg_lo;
2649 	u32	rx_stat_grmeg_hi;
2650 	u32	rx_stat_grmeb_lo;
2651 	u32	rx_stat_grmeb_hi;
2652 	u32	rx_stat_grbyt_lo;
2653 	u32	rx_stat_grbyt_hi;
2654 	u32	rx_stat_grund_lo;
2655 	u32	rx_stat_grund_hi;
2656 	u32	rx_stat_grfrg_lo;
2657 	u32	rx_stat_grfrg_hi;
2658 	u32	rx_stat_grerb_lo; /* grerrbyt */
2659 	u32	rx_stat_grerb_hi; /* grerrbyt */
2660 	u32	rx_stat_grfre_lo; /* grfrerr */
2661 	u32	rx_stat_grfre_hi; /* grfrerr */
2662 	u32	rx_stat_gripj_lo;
2663 	u32	rx_stat_gripj_hi;
2664 };
2665 
2666 struct mstat_stats {
2667 	struct {
2668 		/* OTE MSTAT on E3 has a bug where this register's contents are
2669 		 * actually tx_gtxpok + tx_gtxpf + (possibly)tx_gtxpp
2670 		 */
2671 		u32 tx_gtxpok_lo;
2672 		u32 tx_gtxpok_hi;
2673 		u32 tx_gtxpf_lo;
2674 		u32 tx_gtxpf_hi;
2675 		u32 tx_gtxpp_lo;
2676 		u32 tx_gtxpp_hi;
2677 		u32 tx_gtfcs_lo;
2678 		u32 tx_gtfcs_hi;
2679 		u32 tx_gtuca_lo;
2680 		u32 tx_gtuca_hi;
2681 		u32 tx_gtmca_lo;
2682 		u32 tx_gtmca_hi;
2683 		u32 tx_gtgca_lo;
2684 		u32 tx_gtgca_hi;
2685 		u32 tx_gtpkt_lo;
2686 		u32 tx_gtpkt_hi;
2687 		u32 tx_gt64_lo;
2688 		u32 tx_gt64_hi;
2689 		u32 tx_gt127_lo;
2690 		u32 tx_gt127_hi;
2691 		u32 tx_gt255_lo;
2692 		u32 tx_gt255_hi;
2693 		u32 tx_gt511_lo;
2694 		u32 tx_gt511_hi;
2695 		u32 tx_gt1023_lo;
2696 		u32 tx_gt1023_hi;
2697 		u32 tx_gt1518_lo;
2698 		u32 tx_gt1518_hi;
2699 		u32 tx_gt2047_lo;
2700 		u32 tx_gt2047_hi;
2701 		u32 tx_gt4095_lo;
2702 		u32 tx_gt4095_hi;
2703 		u32 tx_gt9216_lo;
2704 		u32 tx_gt9216_hi;
2705 		u32 tx_gt16383_lo;
2706 		u32 tx_gt16383_hi;
2707 		u32 tx_gtufl_lo;
2708 		u32 tx_gtufl_hi;
2709 		u32 tx_gterr_lo;
2710 		u32 tx_gterr_hi;
2711 		u32 tx_gtbyt_lo;
2712 		u32 tx_gtbyt_hi;
2713 		u32 tx_collisions_lo;
2714 		u32 tx_collisions_hi;
2715 		u32 tx_singlecollision_lo;
2716 		u32 tx_singlecollision_hi;
2717 		u32 tx_multiplecollisions_lo;
2718 		u32 tx_multiplecollisions_hi;
2719 		u32 tx_deferred_lo;
2720 		u32 tx_deferred_hi;
2721 		u32 tx_excessivecollisions_lo;
2722 		u32 tx_excessivecollisions_hi;
2723 		u32 tx_latecollisions_lo;
2724 		u32 tx_latecollisions_hi;
2725 	} stats_tx;
2726 
2727 	struct {
2728 		u32 rx_gr64_lo;
2729 		u32 rx_gr64_hi;
2730 		u32 rx_gr127_lo;
2731 		u32 rx_gr127_hi;
2732 		u32 rx_gr255_lo;
2733 		u32 rx_gr255_hi;
2734 		u32 rx_gr511_lo;
2735 		u32 rx_gr511_hi;
2736 		u32 rx_gr1023_lo;
2737 		u32 rx_gr1023_hi;
2738 		u32 rx_gr1518_lo;
2739 		u32 rx_gr1518_hi;
2740 		u32 rx_gr2047_lo;
2741 		u32 rx_gr2047_hi;
2742 		u32 rx_gr4095_lo;
2743 		u32 rx_gr4095_hi;
2744 		u32 rx_gr9216_lo;
2745 		u32 rx_gr9216_hi;
2746 		u32 rx_gr16383_lo;
2747 		u32 rx_gr16383_hi;
2748 		u32 rx_grpkt_lo;
2749 		u32 rx_grpkt_hi;
2750 		u32 rx_grfcs_lo;
2751 		u32 rx_grfcs_hi;
2752 		u32 rx_gruca_lo;
2753 		u32 rx_gruca_hi;
2754 		u32 rx_grmca_lo;
2755 		u32 rx_grmca_hi;
2756 		u32 rx_grbca_lo;
2757 		u32 rx_grbca_hi;
2758 		u32 rx_grxpf_lo;
2759 		u32 rx_grxpf_hi;
2760 		u32 rx_grxpp_lo;
2761 		u32 rx_grxpp_hi;
2762 		u32 rx_grxuo_lo;
2763 		u32 rx_grxuo_hi;
2764 		u32 rx_grovr_lo;
2765 		u32 rx_grovr_hi;
2766 		u32 rx_grxcf_lo;
2767 		u32 rx_grxcf_hi;
2768 		u32 rx_grflr_lo;
2769 		u32 rx_grflr_hi;
2770 		u32 rx_grpok_lo;
2771 		u32 rx_grpok_hi;
2772 		u32 rx_grbyt_lo;
2773 		u32 rx_grbyt_hi;
2774 		u32 rx_grund_lo;
2775 		u32 rx_grund_hi;
2776 		u32 rx_grfrg_lo;
2777 		u32 rx_grfrg_hi;
2778 		u32 rx_grerb_lo;
2779 		u32 rx_grerb_hi;
2780 		u32 rx_grfre_lo;
2781 		u32 rx_grfre_hi;
2782 
2783 		u32 rx_alignmenterrors_lo;
2784 		u32 rx_alignmenterrors_hi;
2785 		u32 rx_falsecarrier_lo;
2786 		u32 rx_falsecarrier_hi;
2787 		u32 rx_llfcmsgcnt_lo;
2788 		u32 rx_llfcmsgcnt_hi;
2789 	} stats_rx;
2790 };
2791 
2792 union mac_stats {
2793 	struct emac_stats	emac_stats;
2794 	struct bmac1_stats	bmac1_stats;
2795 	struct bmac2_stats	bmac2_stats;
2796 	struct mstat_stats	mstat_stats;
2797 };
2798 
2799 
2800 struct mac_stx {
2801 	/* in_bad_octets */
2802 	u32     rx_stat_ifhcinbadoctets_hi;
2803 	u32     rx_stat_ifhcinbadoctets_lo;
2804 
2805 	/* out_bad_octets */
2806 	u32     tx_stat_ifhcoutbadoctets_hi;
2807 	u32     tx_stat_ifhcoutbadoctets_lo;
2808 
2809 	/* crc_receive_errors */
2810 	u32     rx_stat_dot3statsfcserrors_hi;
2811 	u32     rx_stat_dot3statsfcserrors_lo;
2812 	/* alignment_errors */
2813 	u32     rx_stat_dot3statsalignmenterrors_hi;
2814 	u32     rx_stat_dot3statsalignmenterrors_lo;
2815 	/* carrier_sense_errors */
2816 	u32     rx_stat_dot3statscarriersenseerrors_hi;
2817 	u32     rx_stat_dot3statscarriersenseerrors_lo;
2818 	/* false_carrier_detections */
2819 	u32     rx_stat_falsecarriererrors_hi;
2820 	u32     rx_stat_falsecarriererrors_lo;
2821 
2822 	/* runt_packets_received */
2823 	u32     rx_stat_etherstatsundersizepkts_hi;
2824 	u32     rx_stat_etherstatsundersizepkts_lo;
2825 	/* jabber_packets_received */
2826 	u32     rx_stat_dot3statsframestoolong_hi;
2827 	u32     rx_stat_dot3statsframestoolong_lo;
2828 
2829 	/* error_runt_packets_received */
2830 	u32     rx_stat_etherstatsfragments_hi;
2831 	u32     rx_stat_etherstatsfragments_lo;
2832 	/* error_jabber_packets_received */
2833 	u32     rx_stat_etherstatsjabbers_hi;
2834 	u32     rx_stat_etherstatsjabbers_lo;
2835 
2836 	/* control_frames_received */
2837 	u32     rx_stat_maccontrolframesreceived_hi;
2838 	u32     rx_stat_maccontrolframesreceived_lo;
2839 	u32     rx_stat_mac_xpf_hi;
2840 	u32     rx_stat_mac_xpf_lo;
2841 	u32     rx_stat_mac_xcf_hi;
2842 	u32     rx_stat_mac_xcf_lo;
2843 
2844 	/* xoff_state_entered */
2845 	u32     rx_stat_xoffstateentered_hi;
2846 	u32     rx_stat_xoffstateentered_lo;
2847 	/* pause_xon_frames_received */
2848 	u32     rx_stat_xonpauseframesreceived_hi;
2849 	u32     rx_stat_xonpauseframesreceived_lo;
2850 	/* pause_xoff_frames_received */
2851 	u32     rx_stat_xoffpauseframesreceived_hi;
2852 	u32     rx_stat_xoffpauseframesreceived_lo;
2853 	/* pause_xon_frames_transmitted */
2854 	u32     tx_stat_outxonsent_hi;
2855 	u32     tx_stat_outxonsent_lo;
2856 	/* pause_xoff_frames_transmitted */
2857 	u32     tx_stat_outxoffsent_hi;
2858 	u32     tx_stat_outxoffsent_lo;
2859 	/* flow_control_done */
2860 	u32     tx_stat_flowcontroldone_hi;
2861 	u32     tx_stat_flowcontroldone_lo;
2862 
2863 	/* ether_stats_collisions */
2864 	u32     tx_stat_etherstatscollisions_hi;
2865 	u32     tx_stat_etherstatscollisions_lo;
2866 	/* single_collision_transmit_frames */
2867 	u32     tx_stat_dot3statssinglecollisionframes_hi;
2868 	u32     tx_stat_dot3statssinglecollisionframes_lo;
2869 	/* multiple_collision_transmit_frames */
2870 	u32     tx_stat_dot3statsmultiplecollisionframes_hi;
2871 	u32     tx_stat_dot3statsmultiplecollisionframes_lo;
2872 	/* deferred_transmissions */
2873 	u32     tx_stat_dot3statsdeferredtransmissions_hi;
2874 	u32     tx_stat_dot3statsdeferredtransmissions_lo;
2875 	/* excessive_collision_frames */
2876 	u32     tx_stat_dot3statsexcessivecollisions_hi;
2877 	u32     tx_stat_dot3statsexcessivecollisions_lo;
2878 	/* late_collision_frames */
2879 	u32     tx_stat_dot3statslatecollisions_hi;
2880 	u32     tx_stat_dot3statslatecollisions_lo;
2881 
2882 	/* frames_transmitted_64_bytes */
2883 	u32     tx_stat_etherstatspkts64octets_hi;
2884 	u32     tx_stat_etherstatspkts64octets_lo;
2885 	/* frames_transmitted_65_127_bytes */
2886 	u32     tx_stat_etherstatspkts65octetsto127octets_hi;
2887 	u32     tx_stat_etherstatspkts65octetsto127octets_lo;
2888 	/* frames_transmitted_128_255_bytes */
2889 	u32     tx_stat_etherstatspkts128octetsto255octets_hi;
2890 	u32     tx_stat_etherstatspkts128octetsto255octets_lo;
2891 	/* frames_transmitted_256_511_bytes */
2892 	u32     tx_stat_etherstatspkts256octetsto511octets_hi;
2893 	u32     tx_stat_etherstatspkts256octetsto511octets_lo;
2894 	/* frames_transmitted_512_1023_bytes */
2895 	u32     tx_stat_etherstatspkts512octetsto1023octets_hi;
2896 	u32     tx_stat_etherstatspkts512octetsto1023octets_lo;
2897 	/* frames_transmitted_1024_1522_bytes */
2898 	u32     tx_stat_etherstatspkts1024octetsto1522octets_hi;
2899 	u32     tx_stat_etherstatspkts1024octetsto1522octets_lo;
2900 	/* frames_transmitted_1523_9022_bytes */
2901 	u32     tx_stat_etherstatspktsover1522octets_hi;
2902 	u32     tx_stat_etherstatspktsover1522octets_lo;
2903 	u32     tx_stat_mac_2047_hi;
2904 	u32     tx_stat_mac_2047_lo;
2905 	u32     tx_stat_mac_4095_hi;
2906 	u32     tx_stat_mac_4095_lo;
2907 	u32     tx_stat_mac_9216_hi;
2908 	u32     tx_stat_mac_9216_lo;
2909 	u32     tx_stat_mac_16383_hi;
2910 	u32     tx_stat_mac_16383_lo;
2911 
2912 	/* internal_mac_transmit_errors */
2913 	u32     tx_stat_dot3statsinternalmactransmiterrors_hi;
2914 	u32     tx_stat_dot3statsinternalmactransmiterrors_lo;
2915 
2916 	/* if_out_discards */
2917 	u32     tx_stat_mac_ufl_hi;
2918 	u32     tx_stat_mac_ufl_lo;
2919 };
2920 
2921 
2922 #define MAC_STX_IDX_MAX                     2
2923 
2924 struct host_port_stats {
2925 	u32            host_port_stats_counter;
2926 
2927 	struct mac_stx mac_stx[MAC_STX_IDX_MAX];
2928 
2929 	u32            brb_drop_hi;
2930 	u32            brb_drop_lo;
2931 
2932 	u32            not_used; /* obsolete */
2933 	u32            pfc_frames_tx_hi;
2934 	u32            pfc_frames_tx_lo;
2935 	u32            pfc_frames_rx_hi;
2936 	u32            pfc_frames_rx_lo;
2937 
2938 	u32            eee_lpi_count_hi;
2939 	u32            eee_lpi_count_lo;
2940 };
2941 
2942 
2943 struct host_func_stats {
2944 	u32     host_func_stats_start;
2945 
2946 	u32     total_bytes_received_hi;
2947 	u32     total_bytes_received_lo;
2948 
2949 	u32     total_bytes_transmitted_hi;
2950 	u32     total_bytes_transmitted_lo;
2951 
2952 	u32     total_unicast_packets_received_hi;
2953 	u32     total_unicast_packets_received_lo;
2954 
2955 	u32     total_multicast_packets_received_hi;
2956 	u32     total_multicast_packets_received_lo;
2957 
2958 	u32     total_broadcast_packets_received_hi;
2959 	u32     total_broadcast_packets_received_lo;
2960 
2961 	u32     total_unicast_packets_transmitted_hi;
2962 	u32     total_unicast_packets_transmitted_lo;
2963 
2964 	u32     total_multicast_packets_transmitted_hi;
2965 	u32     total_multicast_packets_transmitted_lo;
2966 
2967 	u32     total_broadcast_packets_transmitted_hi;
2968 	u32     total_broadcast_packets_transmitted_lo;
2969 
2970 	u32     valid_bytes_received_hi;
2971 	u32     valid_bytes_received_lo;
2972 
2973 	u32     host_func_stats_end;
2974 };
2975 
2976 /* VIC definitions */
2977 #define VICSTATST_UIF_INDEX 2
2978 
2979 
2980 /* stats collected for afex.
2981  * NOTE: structure is exactly as expected to be received by the switch.
2982  *       order must remain exactly as is unless protocol changes !
2983  */
2984 struct afex_stats {
2985 	u32 tx_unicast_frames_hi;
2986 	u32 tx_unicast_frames_lo;
2987 	u32 tx_unicast_bytes_hi;
2988 	u32 tx_unicast_bytes_lo;
2989 	u32 tx_multicast_frames_hi;
2990 	u32 tx_multicast_frames_lo;
2991 	u32 tx_multicast_bytes_hi;
2992 	u32 tx_multicast_bytes_lo;
2993 	u32 tx_broadcast_frames_hi;
2994 	u32 tx_broadcast_frames_lo;
2995 	u32 tx_broadcast_bytes_hi;
2996 	u32 tx_broadcast_bytes_lo;
2997 	u32 tx_frames_discarded_hi;
2998 	u32 tx_frames_discarded_lo;
2999 	u32 tx_frames_dropped_hi;
3000 	u32 tx_frames_dropped_lo;
3001 
3002 	u32 rx_unicast_frames_hi;
3003 	u32 rx_unicast_frames_lo;
3004 	u32 rx_unicast_bytes_hi;
3005 	u32 rx_unicast_bytes_lo;
3006 	u32 rx_multicast_frames_hi;
3007 	u32 rx_multicast_frames_lo;
3008 	u32 rx_multicast_bytes_hi;
3009 	u32 rx_multicast_bytes_lo;
3010 	u32 rx_broadcast_frames_hi;
3011 	u32 rx_broadcast_frames_lo;
3012 	u32 rx_broadcast_bytes_hi;
3013 	u32 rx_broadcast_bytes_lo;
3014 	u32 rx_frames_discarded_hi;
3015 	u32 rx_frames_discarded_lo;
3016 	u32 rx_frames_dropped_hi;
3017 	u32 rx_frames_dropped_lo;
3018 };
3019 
3020 #define BCM_5710_FW_MAJOR_VERSION			7
3021 #define BCM_5710_FW_MINOR_VERSION			13
3022 #define BCM_5710_FW_REVISION_VERSION		1
3023 #define BCM_5710_FW_ENGINEERING_VERSION		0
3024 #define BCM_5710_FW_COMPILE_FLAGS			1
3025 
3026 
3027 /*
3028  * attention bits
3029  */
3030 struct atten_sp_status_block {
3031 	__le32 attn_bits;
3032 	__le32 attn_bits_ack;
3033 	u8 status_block_id;
3034 	u8 reserved0;
3035 	__le16 attn_bits_index;
3036 	__le32 reserved1;
3037 };
3038 
3039 
3040 /*
3041  * The eth aggregative context of Cstorm
3042  */
3043 struct cstorm_eth_ag_context {
3044 	u32 __reserved0[10];
3045 };
3046 
3047 
3048 /*
3049  * dmae command structure
3050  */
3051 struct dmae_command {
3052 	u32 opcode;
3053 #define DMAE_COMMAND_SRC (0x1<<0)
3054 #define DMAE_COMMAND_SRC_SHIFT 0
3055 #define DMAE_COMMAND_DST (0x3<<1)
3056 #define DMAE_COMMAND_DST_SHIFT 1
3057 #define DMAE_COMMAND_C_DST (0x1<<3)
3058 #define DMAE_COMMAND_C_DST_SHIFT 3
3059 #define DMAE_COMMAND_C_TYPE_ENABLE (0x1<<4)
3060 #define DMAE_COMMAND_C_TYPE_ENABLE_SHIFT 4
3061 #define DMAE_COMMAND_C_TYPE_CRC_ENABLE (0x1<<5)
3062 #define DMAE_COMMAND_C_TYPE_CRC_ENABLE_SHIFT 5
3063 #define DMAE_COMMAND_C_TYPE_CRC_OFFSET (0x7<<6)
3064 #define DMAE_COMMAND_C_TYPE_CRC_OFFSET_SHIFT 6
3065 #define DMAE_COMMAND_ENDIANITY (0x3<<9)
3066 #define DMAE_COMMAND_ENDIANITY_SHIFT 9
3067 #define DMAE_COMMAND_PORT (0x1<<11)
3068 #define DMAE_COMMAND_PORT_SHIFT 11
3069 #define DMAE_COMMAND_CRC_RESET (0x1<<12)
3070 #define DMAE_COMMAND_CRC_RESET_SHIFT 12
3071 #define DMAE_COMMAND_SRC_RESET (0x1<<13)
3072 #define DMAE_COMMAND_SRC_RESET_SHIFT 13
3073 #define DMAE_COMMAND_DST_RESET (0x1<<14)
3074 #define DMAE_COMMAND_DST_RESET_SHIFT 14
3075 #define DMAE_COMMAND_E1HVN (0x3<<15)
3076 #define DMAE_COMMAND_E1HVN_SHIFT 15
3077 #define DMAE_COMMAND_DST_VN (0x3<<17)
3078 #define DMAE_COMMAND_DST_VN_SHIFT 17
3079 #define DMAE_COMMAND_C_FUNC (0x1<<19)
3080 #define DMAE_COMMAND_C_FUNC_SHIFT 19
3081 #define DMAE_COMMAND_ERR_POLICY (0x3<<20)
3082 #define DMAE_COMMAND_ERR_POLICY_SHIFT 20
3083 #define DMAE_COMMAND_RESERVED0 (0x3FF<<22)
3084 #define DMAE_COMMAND_RESERVED0_SHIFT 22
3085 	u32 src_addr_lo;
3086 	u32 src_addr_hi;
3087 	u32 dst_addr_lo;
3088 	u32 dst_addr_hi;
3089 #if defined(__BIG_ENDIAN)
3090 	u16 opcode_iov;
3091 #define DMAE_COMMAND_SRC_VFID (0x3F<<0)
3092 #define DMAE_COMMAND_SRC_VFID_SHIFT 0
3093 #define DMAE_COMMAND_SRC_VFPF (0x1<<6)
3094 #define DMAE_COMMAND_SRC_VFPF_SHIFT 6
3095 #define DMAE_COMMAND_RESERVED1 (0x1<<7)
3096 #define DMAE_COMMAND_RESERVED1_SHIFT 7
3097 #define DMAE_COMMAND_DST_VFID (0x3F<<8)
3098 #define DMAE_COMMAND_DST_VFID_SHIFT 8
3099 #define DMAE_COMMAND_DST_VFPF (0x1<<14)
3100 #define DMAE_COMMAND_DST_VFPF_SHIFT 14
3101 #define DMAE_COMMAND_RESERVED2 (0x1<<15)
3102 #define DMAE_COMMAND_RESERVED2_SHIFT 15
3103 	u16 len;
3104 #elif defined(__LITTLE_ENDIAN)
3105 	u16 len;
3106 	u16 opcode_iov;
3107 #define DMAE_COMMAND_SRC_VFID (0x3F<<0)
3108 #define DMAE_COMMAND_SRC_VFID_SHIFT 0
3109 #define DMAE_COMMAND_SRC_VFPF (0x1<<6)
3110 #define DMAE_COMMAND_SRC_VFPF_SHIFT 6
3111 #define DMAE_COMMAND_RESERVED1 (0x1<<7)
3112 #define DMAE_COMMAND_RESERVED1_SHIFT 7
3113 #define DMAE_COMMAND_DST_VFID (0x3F<<8)
3114 #define DMAE_COMMAND_DST_VFID_SHIFT 8
3115 #define DMAE_COMMAND_DST_VFPF (0x1<<14)
3116 #define DMAE_COMMAND_DST_VFPF_SHIFT 14
3117 #define DMAE_COMMAND_RESERVED2 (0x1<<15)
3118 #define DMAE_COMMAND_RESERVED2_SHIFT 15
3119 #endif
3120 	u32 comp_addr_lo;
3121 	u32 comp_addr_hi;
3122 	u32 comp_val;
3123 	u32 crc32;
3124 	u32 crc32_c;
3125 #if defined(__BIG_ENDIAN)
3126 	u16 crc16_c;
3127 	u16 crc16;
3128 #elif defined(__LITTLE_ENDIAN)
3129 	u16 crc16;
3130 	u16 crc16_c;
3131 #endif
3132 #if defined(__BIG_ENDIAN)
3133 	u16 reserved3;
3134 	u16 crc_t10;
3135 #elif defined(__LITTLE_ENDIAN)
3136 	u16 crc_t10;
3137 	u16 reserved3;
3138 #endif
3139 #if defined(__BIG_ENDIAN)
3140 	u16 xsum8;
3141 	u16 xsum16;
3142 #elif defined(__LITTLE_ENDIAN)
3143 	u16 xsum16;
3144 	u16 xsum8;
3145 #endif
3146 };
3147 
3148 
3149 /*
3150  * common data for all protocols
3151  */
3152 struct doorbell_hdr {
3153 	u8 header;
3154 #define DOORBELL_HDR_RX (0x1<<0)
3155 #define DOORBELL_HDR_RX_SHIFT 0
3156 #define DOORBELL_HDR_DB_TYPE (0x1<<1)
3157 #define DOORBELL_HDR_DB_TYPE_SHIFT 1
3158 #define DOORBELL_HDR_DPM_SIZE (0x3<<2)
3159 #define DOORBELL_HDR_DPM_SIZE_SHIFT 2
3160 #define DOORBELL_HDR_CONN_TYPE (0xF<<4)
3161 #define DOORBELL_HDR_CONN_TYPE_SHIFT 4
3162 };
3163 
3164 /*
3165  * Ethernet doorbell
3166  */
3167 struct eth_tx_doorbell {
3168 #if defined(__BIG_ENDIAN)
3169 	u16 npackets;
3170 	u8 params;
3171 #define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
3172 #define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
3173 #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
3174 #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
3175 #define ETH_TX_DOORBELL_SPARE (0x1<<7)
3176 #define ETH_TX_DOORBELL_SPARE_SHIFT 7
3177 	struct doorbell_hdr hdr;
3178 #elif defined(__LITTLE_ENDIAN)
3179 	struct doorbell_hdr hdr;
3180 	u8 params;
3181 #define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
3182 #define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
3183 #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
3184 #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
3185 #define ETH_TX_DOORBELL_SPARE (0x1<<7)
3186 #define ETH_TX_DOORBELL_SPARE_SHIFT 7
3187 	u16 npackets;
3188 #endif
3189 };
3190 
3191 
3192 /*
3193  * 3 lines. status block
3194  */
3195 struct hc_status_block_e1x {
3196 	__le16 index_values[HC_SB_MAX_INDICES_E1X];
3197 	__le16 running_index[HC_SB_MAX_SM];
3198 	__le32 rsrv[11];
3199 };
3200 
3201 /*
3202  * host status block
3203  */
3204 struct host_hc_status_block_e1x {
3205 	struct hc_status_block_e1x sb;
3206 };
3207 
3208 
3209 /*
3210  * 3 lines. status block
3211  */
3212 struct hc_status_block_e2 {
3213 	__le16 index_values[HC_SB_MAX_INDICES_E2];
3214 	__le16 running_index[HC_SB_MAX_SM];
3215 	__le32 reserved[11];
3216 };
3217 
3218 /*
3219  * host status block
3220  */
3221 struct host_hc_status_block_e2 {
3222 	struct hc_status_block_e2 sb;
3223 };
3224 
3225 
3226 /*
3227  * 5 lines. slow-path status block
3228  */
3229 struct hc_sp_status_block {
3230 	__le16 index_values[HC_SP_SB_MAX_INDICES];
3231 	__le16 running_index;
3232 	__le16 rsrv;
3233 	u32 rsrv1;
3234 };
3235 
3236 /*
3237  * host status block
3238  */
3239 struct host_sp_status_block {
3240 	struct atten_sp_status_block atten_status_block;
3241 	struct hc_sp_status_block sp_sb;
3242 };
3243 
3244 
3245 /*
3246  * IGU driver acknowledgment register
3247  */
3248 struct igu_ack_register {
3249 #if defined(__BIG_ENDIAN)
3250 	u16 sb_id_and_flags;
3251 #define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
3252 #define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
3253 #define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
3254 #define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
3255 #define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
3256 #define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
3257 #define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
3258 #define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
3259 #define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
3260 #define IGU_ACK_REGISTER_RESERVED_SHIFT 11
3261 	u16 status_block_index;
3262 #elif defined(__LITTLE_ENDIAN)
3263 	u16 status_block_index;
3264 	u16 sb_id_and_flags;
3265 #define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
3266 #define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
3267 #define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
3268 #define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
3269 #define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
3270 #define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
3271 #define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
3272 #define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
3273 #define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
3274 #define IGU_ACK_REGISTER_RESERVED_SHIFT 11
3275 #endif
3276 };
3277 
3278 
3279 /*
3280  * IGU driver acknowledgement register
3281  */
3282 struct igu_backward_compatible {
3283 	u32 sb_id_and_flags;
3284 #define IGU_BACKWARD_COMPATIBLE_SB_INDEX (0xFFFF<<0)
3285 #define IGU_BACKWARD_COMPATIBLE_SB_INDEX_SHIFT 0
3286 #define IGU_BACKWARD_COMPATIBLE_SB_SELECT (0x1F<<16)
3287 #define IGU_BACKWARD_COMPATIBLE_SB_SELECT_SHIFT 16
3288 #define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS (0x7<<21)
3289 #define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS_SHIFT 21
3290 #define IGU_BACKWARD_COMPATIBLE_BUPDATE (0x1<<24)
3291 #define IGU_BACKWARD_COMPATIBLE_BUPDATE_SHIFT 24
3292 #define IGU_BACKWARD_COMPATIBLE_ENABLE_INT (0x3<<25)
3293 #define IGU_BACKWARD_COMPATIBLE_ENABLE_INT_SHIFT 25
3294 #define IGU_BACKWARD_COMPATIBLE_RESERVED_0 (0x1F<<27)
3295 #define IGU_BACKWARD_COMPATIBLE_RESERVED_0_SHIFT 27
3296 	u32 reserved_2;
3297 };
3298 
3299 
3300 /*
3301  * IGU driver acknowledgement register
3302  */
3303 struct igu_regular {
3304 	u32 sb_id_and_flags;
3305 #define IGU_REGULAR_SB_INDEX (0xFFFFF<<0)
3306 #define IGU_REGULAR_SB_INDEX_SHIFT 0
3307 #define IGU_REGULAR_RESERVED0 (0x1<<20)
3308 #define IGU_REGULAR_RESERVED0_SHIFT 20
3309 #define IGU_REGULAR_SEGMENT_ACCESS (0x7<<21)
3310 #define IGU_REGULAR_SEGMENT_ACCESS_SHIFT 21
3311 #define IGU_REGULAR_BUPDATE (0x1<<24)
3312 #define IGU_REGULAR_BUPDATE_SHIFT 24
3313 #define IGU_REGULAR_ENABLE_INT (0x3<<25)
3314 #define IGU_REGULAR_ENABLE_INT_SHIFT 25
3315 #define IGU_REGULAR_RESERVED_1 (0x1<<27)
3316 #define IGU_REGULAR_RESERVED_1_SHIFT 27
3317 #define IGU_REGULAR_CLEANUP_TYPE (0x3<<28)
3318 #define IGU_REGULAR_CLEANUP_TYPE_SHIFT 28
3319 #define IGU_REGULAR_CLEANUP_SET (0x1<<30)
3320 #define IGU_REGULAR_CLEANUP_SET_SHIFT 30
3321 #define IGU_REGULAR_BCLEANUP (0x1<<31)
3322 #define IGU_REGULAR_BCLEANUP_SHIFT 31
3323 	u32 reserved_2;
3324 };
3325 
3326 /*
3327  * IGU driver acknowledgement register
3328  */
3329 union igu_consprod_reg {
3330 	struct igu_regular regular;
3331 	struct igu_backward_compatible backward_compatible;
3332 };
3333 
3334 
3335 /*
3336  * Igu control commands
3337  */
3338 enum igu_ctrl_cmd {
3339 	IGU_CTRL_CMD_TYPE_RD,
3340 	IGU_CTRL_CMD_TYPE_WR,
3341 	MAX_IGU_CTRL_CMD
3342 };
3343 
3344 
3345 /*
3346  * Control register for the IGU command register
3347  */
3348 struct igu_ctrl_reg {
3349 	u32 ctrl_data;
3350 #define IGU_CTRL_REG_ADDRESS (0xFFF<<0)
3351 #define IGU_CTRL_REG_ADDRESS_SHIFT 0
3352 #define IGU_CTRL_REG_FID (0x7F<<12)
3353 #define IGU_CTRL_REG_FID_SHIFT 12
3354 #define IGU_CTRL_REG_RESERVED (0x1<<19)
3355 #define IGU_CTRL_REG_RESERVED_SHIFT 19
3356 #define IGU_CTRL_REG_TYPE (0x1<<20)
3357 #define IGU_CTRL_REG_TYPE_SHIFT 20
3358 #define IGU_CTRL_REG_UNUSED (0x7FF<<21)
3359 #define IGU_CTRL_REG_UNUSED_SHIFT 21
3360 };
3361 
3362 
3363 /*
3364  * Igu interrupt command
3365  */
3366 enum igu_int_cmd {
3367 	IGU_INT_ENABLE,
3368 	IGU_INT_DISABLE,
3369 	IGU_INT_NOP,
3370 	IGU_INT_NOP2,
3371 	MAX_IGU_INT_CMD
3372 };
3373 
3374 
3375 /*
3376  * Igu segments
3377  */
3378 enum igu_seg_access {
3379 	IGU_SEG_ACCESS_NORM,
3380 	IGU_SEG_ACCESS_DEF,
3381 	IGU_SEG_ACCESS_ATTN,
3382 	MAX_IGU_SEG_ACCESS
3383 };
3384 
3385 
3386 /*
3387  * Parser parsing flags field
3388  */
3389 struct parsing_flags {
3390 	__le16 flags;
3391 #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE (0x1<<0)
3392 #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE_SHIFT 0
3393 #define PARSING_FLAGS_VLAN (0x1<<1)
3394 #define PARSING_FLAGS_VLAN_SHIFT 1
3395 #define PARSING_FLAGS_EXTRA_VLAN (0x1<<2)
3396 #define PARSING_FLAGS_EXTRA_VLAN_SHIFT 2
3397 #define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL (0x3<<3)
3398 #define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT 3
3399 #define PARSING_FLAGS_IP_OPTIONS (0x1<<5)
3400 #define PARSING_FLAGS_IP_OPTIONS_SHIFT 5
3401 #define PARSING_FLAGS_FRAGMENTATION_STATUS (0x1<<6)
3402 #define PARSING_FLAGS_FRAGMENTATION_STATUS_SHIFT 6
3403 #define PARSING_FLAGS_OVER_IP_PROTOCOL (0x3<<7)
3404 #define PARSING_FLAGS_OVER_IP_PROTOCOL_SHIFT 7
3405 #define PARSING_FLAGS_PURE_ACK_INDICATION (0x1<<9)
3406 #define PARSING_FLAGS_PURE_ACK_INDICATION_SHIFT 9
3407 #define PARSING_FLAGS_TCP_OPTIONS_EXIST (0x1<<10)
3408 #define PARSING_FLAGS_TCP_OPTIONS_EXIST_SHIFT 10
3409 #define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG (0x1<<11)
3410 #define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG_SHIFT 11
3411 #define PARSING_FLAGS_CONNECTION_MATCH (0x1<<12)
3412 #define PARSING_FLAGS_CONNECTION_MATCH_SHIFT 12
3413 #define PARSING_FLAGS_LLC_SNAP (0x1<<13)
3414 #define PARSING_FLAGS_LLC_SNAP_SHIFT 13
3415 #define PARSING_FLAGS_RESERVED0 (0x3<<14)
3416 #define PARSING_FLAGS_RESERVED0_SHIFT 14
3417 };
3418 
3419 
3420 /*
3421  * Parsing flags for TCP ACK type
3422  */
3423 enum prs_flags_ack_type {
3424 	PRS_FLAG_PUREACK_PIGGY,
3425 	PRS_FLAG_PUREACK_PURE,
3426 	MAX_PRS_FLAGS_ACK_TYPE
3427 };
3428 
3429 
3430 /*
3431  * Parsing flags for Ethernet address type
3432  */
3433 enum prs_flags_eth_addr_type {
3434 	PRS_FLAG_ETHTYPE_NON_UNICAST,
3435 	PRS_FLAG_ETHTYPE_UNICAST,
3436 	MAX_PRS_FLAGS_ETH_ADDR_TYPE
3437 };
3438 
3439 
3440 /*
3441  * Parsing flags for over-ethernet protocol
3442  */
3443 enum prs_flags_over_eth {
3444 	PRS_FLAG_OVERETH_UNKNOWN,
3445 	PRS_FLAG_OVERETH_IPV4,
3446 	PRS_FLAG_OVERETH_IPV6,
3447 	PRS_FLAG_OVERETH_LLCSNAP_UNKNOWN,
3448 	MAX_PRS_FLAGS_OVER_ETH
3449 };
3450 
3451 
3452 /*
3453  * Parsing flags for over-IP protocol
3454  */
3455 enum prs_flags_over_ip {
3456 	PRS_FLAG_OVERIP_UNKNOWN,
3457 	PRS_FLAG_OVERIP_TCP,
3458 	PRS_FLAG_OVERIP_UDP,
3459 	MAX_PRS_FLAGS_OVER_IP
3460 };
3461 
3462 
3463 /*
3464  * SDM operation gen command (generate aggregative interrupt)
3465  */
3466 struct sdm_op_gen {
3467 	__le32 command;
3468 #define SDM_OP_GEN_COMP_PARAM (0x1F<<0)
3469 #define SDM_OP_GEN_COMP_PARAM_SHIFT 0
3470 #define SDM_OP_GEN_COMP_TYPE (0x7<<5)
3471 #define SDM_OP_GEN_COMP_TYPE_SHIFT 5
3472 #define SDM_OP_GEN_AGG_VECT_IDX (0xFF<<8)
3473 #define SDM_OP_GEN_AGG_VECT_IDX_SHIFT 8
3474 #define SDM_OP_GEN_AGG_VECT_IDX_VALID (0x1<<16)
3475 #define SDM_OP_GEN_AGG_VECT_IDX_VALID_SHIFT 16
3476 #define SDM_OP_GEN_RESERVED (0x7FFF<<17)
3477 #define SDM_OP_GEN_RESERVED_SHIFT 17
3478 };
3479 
3480 
3481 /*
3482  * Timers connection context
3483  */
3484 struct timers_block_context {
3485 	u32 __reserved_0;
3486 	u32 __reserved_1;
3487 	u32 __reserved_2;
3488 	u32 flags;
3489 #define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS (0x3<<0)
3490 #define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS_SHIFT 0
3491 #define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG (0x1<<2)
3492 #define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG_SHIFT 2
3493 #define __TIMERS_BLOCK_CONTEXT_RESERVED0 (0x1FFFFFFF<<3)
3494 #define __TIMERS_BLOCK_CONTEXT_RESERVED0_SHIFT 3
3495 };
3496 
3497 
3498 /*
3499  * The eth aggregative context of Tstorm
3500  */
3501 struct tstorm_eth_ag_context {
3502 	u32 __reserved0[14];
3503 };
3504 
3505 
3506 /*
3507  * The eth aggregative context of Ustorm
3508  */
3509 struct ustorm_eth_ag_context {
3510 	u32 __reserved0;
3511 #if defined(__BIG_ENDIAN)
3512 	u8 cdu_usage;
3513 	u8 __reserved2;
3514 	u16 __reserved1;
3515 #elif defined(__LITTLE_ENDIAN)
3516 	u16 __reserved1;
3517 	u8 __reserved2;
3518 	u8 cdu_usage;
3519 #endif
3520 	u32 __reserved3[6];
3521 };
3522 
3523 
3524 /*
3525  * The eth aggregative context of Xstorm
3526  */
3527 struct xstorm_eth_ag_context {
3528 	u32 reserved0;
3529 #if defined(__BIG_ENDIAN)
3530 	u8 cdu_reserved;
3531 	u8 reserved2;
3532 	u16 reserved1;
3533 #elif defined(__LITTLE_ENDIAN)
3534 	u16 reserved1;
3535 	u8 reserved2;
3536 	u8 cdu_reserved;
3537 #endif
3538 	u32 reserved3[30];
3539 };
3540 
3541 
3542 /*
3543  * doorbell message sent to the chip
3544  */
3545 struct doorbell {
3546 #if defined(__BIG_ENDIAN)
3547 	u16 zero_fill2;
3548 	u8 zero_fill1;
3549 	struct doorbell_hdr header;
3550 #elif defined(__LITTLE_ENDIAN)
3551 	struct doorbell_hdr header;
3552 	u8 zero_fill1;
3553 	u16 zero_fill2;
3554 #endif
3555 };
3556 
3557 
3558 /*
3559  * doorbell message sent to the chip
3560  */
3561 struct doorbell_set_prod {
3562 #if defined(__BIG_ENDIAN)
3563 	u16 prod;
3564 	u8 zero_fill1;
3565 	struct doorbell_hdr header;
3566 #elif defined(__LITTLE_ENDIAN)
3567 	struct doorbell_hdr header;
3568 	u8 zero_fill1;
3569 	u16 prod;
3570 #endif
3571 };
3572 
3573 
3574 struct regpair {
3575 	__le32 lo;
3576 	__le32 hi;
3577 };
3578 
3579 struct regpair_native {
3580 	u32 lo;
3581 	u32 hi;
3582 };
3583 
3584 /*
3585  * Classify rule opcodes in E2/E3
3586  */
3587 enum classify_rule {
3588 	CLASSIFY_RULE_OPCODE_MAC,
3589 	CLASSIFY_RULE_OPCODE_VLAN,
3590 	CLASSIFY_RULE_OPCODE_PAIR,
3591 	CLASSIFY_RULE_OPCODE_IMAC_VNI,
3592 	MAX_CLASSIFY_RULE
3593 };
3594 
3595 
3596 /*
3597  * Classify rule types in E2/E3
3598  */
3599 enum classify_rule_action_type {
3600 	CLASSIFY_RULE_REMOVE,
3601 	CLASSIFY_RULE_ADD,
3602 	MAX_CLASSIFY_RULE_ACTION_TYPE
3603 };
3604 
3605 
3606 /*
3607  * client init ramrod data
3608  */
3609 struct client_init_general_data {
3610 	u8 client_id;
3611 	u8 statistics_counter_id;
3612 	u8 statistics_en_flg;
3613 	u8 is_fcoe_flg;
3614 	u8 activate_flg;
3615 	u8 sp_client_id;
3616 	__le16 mtu;
3617 	u8 statistics_zero_flg;
3618 	u8 func_id;
3619 	u8 cos;
3620 	u8 traffic_type;
3621 	u8 fp_hsi_ver;
3622 	u8 reserved0[3];
3623 };
3624 
3625 
3626 /*
3627  * client init rx data
3628  */
3629 struct client_init_rx_data {
3630 	u8 tpa_en;
3631 #define CLIENT_INIT_RX_DATA_TPA_EN_IPV4 (0x1<<0)
3632 #define CLIENT_INIT_RX_DATA_TPA_EN_IPV4_SHIFT 0
3633 #define CLIENT_INIT_RX_DATA_TPA_EN_IPV6 (0x1<<1)
3634 #define CLIENT_INIT_RX_DATA_TPA_EN_IPV6_SHIFT 1
3635 #define CLIENT_INIT_RX_DATA_TPA_MODE (0x1<<2)
3636 #define CLIENT_INIT_RX_DATA_TPA_MODE_SHIFT 2
3637 #define CLIENT_INIT_RX_DATA_RESERVED5 (0x1F<<3)
3638 #define CLIENT_INIT_RX_DATA_RESERVED5_SHIFT 3
3639 	u8 vmqueue_mode_en_flg;
3640 	u8 extra_data_over_sgl_en_flg;
3641 	u8 cache_line_alignment_log_size;
3642 	u8 enable_dynamic_hc;
3643 	u8 max_sges_for_packet;
3644 	u8 client_qzone_id;
3645 	u8 drop_ip_cs_err_flg;
3646 	u8 drop_tcp_cs_err_flg;
3647 	u8 drop_ttl0_flg;
3648 	u8 drop_udp_cs_err_flg;
3649 	u8 inner_vlan_removal_enable_flg;
3650 	u8 outer_vlan_removal_enable_flg;
3651 	u8 status_block_id;
3652 	u8 rx_sb_index_number;
3653 	u8 dont_verify_rings_pause_thr_flg;
3654 	u8 max_tpa_queues;
3655 	u8 silent_vlan_removal_flg;
3656 	__le16 max_bytes_on_bd;
3657 	__le16 sge_buff_size;
3658 	u8 approx_mcast_engine_id;
3659 	u8 rss_engine_id;
3660 	struct regpair bd_page_base;
3661 	struct regpair sge_page_base;
3662 	struct regpair cqe_page_base;
3663 	u8 is_leading_rss;
3664 	u8 is_approx_mcast;
3665 	__le16 max_agg_size;
3666 	__le16 state;
3667 #define CLIENT_INIT_RX_DATA_UCAST_DROP_ALL (0x1<<0)
3668 #define CLIENT_INIT_RX_DATA_UCAST_DROP_ALL_SHIFT 0
3669 #define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_ALL (0x1<<1)
3670 #define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_ALL_SHIFT 1
3671 #define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_UNMATCHED (0x1<<2)
3672 #define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_UNMATCHED_SHIFT 2
3673 #define CLIENT_INIT_RX_DATA_MCAST_DROP_ALL (0x1<<3)
3674 #define CLIENT_INIT_RX_DATA_MCAST_DROP_ALL_SHIFT 3
3675 #define CLIENT_INIT_RX_DATA_MCAST_ACCEPT_ALL (0x1<<4)
3676 #define CLIENT_INIT_RX_DATA_MCAST_ACCEPT_ALL_SHIFT 4
3677 #define CLIENT_INIT_RX_DATA_BCAST_ACCEPT_ALL (0x1<<5)
3678 #define CLIENT_INIT_RX_DATA_BCAST_ACCEPT_ALL_SHIFT 5
3679 #define CLIENT_INIT_RX_DATA_ACCEPT_ANY_VLAN (0x1<<6)
3680 #define CLIENT_INIT_RX_DATA_ACCEPT_ANY_VLAN_SHIFT 6
3681 #define CLIENT_INIT_RX_DATA_RESERVED2 (0x1FF<<7)
3682 #define CLIENT_INIT_RX_DATA_RESERVED2_SHIFT 7
3683 	__le16 cqe_pause_thr_low;
3684 	__le16 cqe_pause_thr_high;
3685 	__le16 bd_pause_thr_low;
3686 	__le16 bd_pause_thr_high;
3687 	__le16 sge_pause_thr_low;
3688 	__le16 sge_pause_thr_high;
3689 	__le16 rx_cos_mask;
3690 	__le16 silent_vlan_value;
3691 	__le16 silent_vlan_mask;
3692 	u8 handle_ptp_pkts_flg;
3693 	u8 reserved6[3];
3694 	__le32 reserved7;
3695 };
3696 
3697 /*
3698  * client init tx data
3699  */
3700 struct client_init_tx_data {
3701 	u8 enforce_security_flg;
3702 	u8 tx_status_block_id;
3703 	u8 tx_sb_index_number;
3704 	u8 tss_leading_client_id;
3705 	u8 tx_switching_flg;
3706 	u8 anti_spoofing_flg;
3707 	__le16 default_vlan;
3708 	struct regpair tx_bd_page_base;
3709 	__le16 state;
3710 #define CLIENT_INIT_TX_DATA_UCAST_ACCEPT_ALL (0x1<<0)
3711 #define CLIENT_INIT_TX_DATA_UCAST_ACCEPT_ALL_SHIFT 0
3712 #define CLIENT_INIT_TX_DATA_MCAST_ACCEPT_ALL (0x1<<1)
3713 #define CLIENT_INIT_TX_DATA_MCAST_ACCEPT_ALL_SHIFT 1
3714 #define CLIENT_INIT_TX_DATA_BCAST_ACCEPT_ALL (0x1<<2)
3715 #define CLIENT_INIT_TX_DATA_BCAST_ACCEPT_ALL_SHIFT 2
3716 #define CLIENT_INIT_TX_DATA_ACCEPT_ANY_VLAN (0x1<<3)
3717 #define CLIENT_INIT_TX_DATA_ACCEPT_ANY_VLAN_SHIFT 3
3718 #define CLIENT_INIT_TX_DATA_RESERVED0 (0xFFF<<4)
3719 #define CLIENT_INIT_TX_DATA_RESERVED0_SHIFT 4
3720 	u8 default_vlan_flg;
3721 	u8 force_default_pri_flg;
3722 	u8 tunnel_lso_inc_ip_id;
3723 	u8 refuse_outband_vlan_flg;
3724 	u8 tunnel_non_lso_pcsum_location;
3725 	u8 tunnel_non_lso_outer_ip_csum_location;
3726 };
3727 
3728 /*
3729  * client init ramrod data
3730  */
3731 struct client_init_ramrod_data {
3732 	struct client_init_general_data general;
3733 	struct client_init_rx_data rx;
3734 	struct client_init_tx_data tx;
3735 };
3736 
3737 
3738 /*
3739  * client update ramrod data
3740  */
3741 struct client_update_ramrod_data {
3742 	u8 client_id;
3743 	u8 func_id;
3744 	u8 inner_vlan_removal_enable_flg;
3745 	u8 inner_vlan_removal_change_flg;
3746 	u8 outer_vlan_removal_enable_flg;
3747 	u8 outer_vlan_removal_change_flg;
3748 	u8 anti_spoofing_enable_flg;
3749 	u8 anti_spoofing_change_flg;
3750 	u8 activate_flg;
3751 	u8 activate_change_flg;
3752 	__le16 default_vlan;
3753 	u8 default_vlan_enable_flg;
3754 	u8 default_vlan_change_flg;
3755 	__le16 silent_vlan_value;
3756 	__le16 silent_vlan_mask;
3757 	u8 silent_vlan_removal_flg;
3758 	u8 silent_vlan_change_flg;
3759 	u8 refuse_outband_vlan_flg;
3760 	u8 refuse_outband_vlan_change_flg;
3761 	u8 tx_switching_flg;
3762 	u8 tx_switching_change_flg;
3763 	u8 handle_ptp_pkts_flg;
3764 	u8 handle_ptp_pkts_change_flg;
3765 	__le16 reserved1;
3766 	__le32 echo;
3767 };
3768 
3769 
3770 /*
3771  * The eth storm context of Cstorm
3772  */
3773 struct cstorm_eth_st_context {
3774 	u32 __reserved0[4];
3775 };
3776 
3777 
3778 struct double_regpair {
3779 	u32 regpair0_lo;
3780 	u32 regpair0_hi;
3781 	u32 regpair1_lo;
3782 	u32 regpair1_hi;
3783 };
3784 
3785 /* 2nd parse bd type used in ethernet tx BDs */
3786 enum eth_2nd_parse_bd_type {
3787 	ETH_2ND_PARSE_BD_TYPE_LSO_TUNNEL,
3788 	MAX_ETH_2ND_PARSE_BD_TYPE
3789 };
3790 
3791 /*
3792  * Ethernet address typesm used in ethernet tx BDs
3793  */
3794 enum eth_addr_type {
3795 	UNKNOWN_ADDRESS,
3796 	UNICAST_ADDRESS,
3797 	MULTICAST_ADDRESS,
3798 	BROADCAST_ADDRESS,
3799 	MAX_ETH_ADDR_TYPE
3800 };
3801 
3802 
3803 /*
3804  *
3805  */
3806 struct eth_classify_cmd_header {
3807 	u8 cmd_general_data;
3808 #define ETH_CLASSIFY_CMD_HEADER_RX_CMD (0x1<<0)
3809 #define ETH_CLASSIFY_CMD_HEADER_RX_CMD_SHIFT 0
3810 #define ETH_CLASSIFY_CMD_HEADER_TX_CMD (0x1<<1)
3811 #define ETH_CLASSIFY_CMD_HEADER_TX_CMD_SHIFT 1
3812 #define ETH_CLASSIFY_CMD_HEADER_OPCODE (0x3<<2)
3813 #define ETH_CLASSIFY_CMD_HEADER_OPCODE_SHIFT 2
3814 #define ETH_CLASSIFY_CMD_HEADER_IS_ADD (0x1<<4)
3815 #define ETH_CLASSIFY_CMD_HEADER_IS_ADD_SHIFT 4
3816 #define ETH_CLASSIFY_CMD_HEADER_RESERVED0 (0x7<<5)
3817 #define ETH_CLASSIFY_CMD_HEADER_RESERVED0_SHIFT 5
3818 	u8 func_id;
3819 	u8 client_id;
3820 	u8 reserved1;
3821 };
3822 
3823 
3824 /*
3825  * header for eth classification config ramrod
3826  */
3827 struct eth_classify_header {
3828 	u8 rule_cnt;
3829 	u8 reserved0;
3830 	__le16 reserved1;
3831 	__le32 echo;
3832 };
3833 
3834 /*
3835  * Command for adding/removing a Inner-MAC/VNI classification rule
3836  */
3837 struct eth_classify_imac_vni_cmd {
3838 	struct eth_classify_cmd_header header;
3839 	__le32 vni;
3840 	__le16 imac_lsb;
3841 	__le16 imac_mid;
3842 	__le16 imac_msb;
3843 	__le16 reserved1;
3844 };
3845 
3846 /*
3847  * Command for adding/removing a MAC classification rule
3848  */
3849 struct eth_classify_mac_cmd {
3850 	struct eth_classify_cmd_header header;
3851 	__le16 reserved0;
3852 	__le16 inner_mac;
3853 	__le16 mac_lsb;
3854 	__le16 mac_mid;
3855 	__le16 mac_msb;
3856 	__le16 reserved1;
3857 };
3858 
3859 
3860 /*
3861  * Command for adding/removing a MAC-VLAN pair classification rule
3862  */
3863 struct eth_classify_pair_cmd {
3864 	struct eth_classify_cmd_header header;
3865 	__le16 reserved0;
3866 	__le16 inner_mac;
3867 	__le16 mac_lsb;
3868 	__le16 mac_mid;
3869 	__le16 mac_msb;
3870 	__le16 vlan;
3871 };
3872 
3873 
3874 /*
3875  * Command for adding/removing a VLAN classification rule
3876  */
3877 struct eth_classify_vlan_cmd {
3878 	struct eth_classify_cmd_header header;
3879 	__le32 reserved0;
3880 	__le32 reserved1;
3881 	__le16 reserved2;
3882 	__le16 vlan;
3883 };
3884 
3885 /*
3886  * Command for adding/removing a VXLAN classification rule
3887  */
3888 
3889 /*
3890  * union for eth classification rule
3891  */
3892 union eth_classify_rule_cmd {
3893 	struct eth_classify_mac_cmd mac;
3894 	struct eth_classify_vlan_cmd vlan;
3895 	struct eth_classify_pair_cmd pair;
3896 	struct eth_classify_imac_vni_cmd imac_vni;
3897 };
3898 
3899 /*
3900  * parameters for eth classification configuration ramrod
3901  */
3902 struct eth_classify_rules_ramrod_data {
3903 	struct eth_classify_header header;
3904 	union eth_classify_rule_cmd rules[CLASSIFY_RULES_COUNT];
3905 };
3906 
3907 
3908 /*
3909  * The data contain client ID need to the ramrod
3910  */
3911 struct eth_common_ramrod_data {
3912 	__le32 client_id;
3913 	__le32 reserved1;
3914 };
3915 
3916 
3917 /*
3918  * The eth storm context of Ustorm
3919  */
3920 struct ustorm_eth_st_context {
3921 	u32 reserved0[52];
3922 };
3923 
3924 /*
3925  * The eth storm context of Tstorm
3926  */
3927 struct tstorm_eth_st_context {
3928 	u32 __reserved0[28];
3929 };
3930 
3931 /*
3932  * The eth storm context of Xstorm
3933  */
3934 struct xstorm_eth_st_context {
3935 	u32 reserved0[60];
3936 };
3937 
3938 /*
3939  * Ethernet connection context
3940  */
3941 struct eth_context {
3942 	struct ustorm_eth_st_context ustorm_st_context;
3943 	struct tstorm_eth_st_context tstorm_st_context;
3944 	struct xstorm_eth_ag_context xstorm_ag_context;
3945 	struct tstorm_eth_ag_context tstorm_ag_context;
3946 	struct cstorm_eth_ag_context cstorm_ag_context;
3947 	struct ustorm_eth_ag_context ustorm_ag_context;
3948 	struct timers_block_context timers_context;
3949 	struct xstorm_eth_st_context xstorm_st_context;
3950 	struct cstorm_eth_st_context cstorm_st_context;
3951 };
3952 
3953 
3954 /*
3955  * union for sgl and raw data.
3956  */
3957 union eth_sgl_or_raw_data {
3958 	__le16 sgl[8];
3959 	u32 raw_data[4];
3960 };
3961 
3962 /*
3963  * eth FP end aggregation CQE parameters struct
3964  */
3965 struct eth_end_agg_rx_cqe {
3966 	u8 type_error_flags;
3967 #define ETH_END_AGG_RX_CQE_TYPE (0x3<<0)
3968 #define ETH_END_AGG_RX_CQE_TYPE_SHIFT 0
3969 #define ETH_END_AGG_RX_CQE_SGL_RAW_SEL (0x1<<2)
3970 #define ETH_END_AGG_RX_CQE_SGL_RAW_SEL_SHIFT 2
3971 #define ETH_END_AGG_RX_CQE_RESERVED0 (0x1F<<3)
3972 #define ETH_END_AGG_RX_CQE_RESERVED0_SHIFT 3
3973 	u8 reserved1;
3974 	u8 queue_index;
3975 	u8 reserved2;
3976 	__le32 timestamp_delta;
3977 	__le16 num_of_coalesced_segs;
3978 	__le16 pkt_len;
3979 	u8 pure_ack_count;
3980 	u8 reserved3;
3981 	__le16 reserved4;
3982 	union eth_sgl_or_raw_data sgl_or_raw_data;
3983 	__le32 reserved5[8];
3984 };
3985 
3986 
3987 /*
3988  * regular eth FP CQE parameters struct
3989  */
3990 struct eth_fast_path_rx_cqe {
3991 	u8 type_error_flags;
3992 #define ETH_FAST_PATH_RX_CQE_TYPE (0x3<<0)
3993 #define ETH_FAST_PATH_RX_CQE_TYPE_SHIFT 0
3994 #define ETH_FAST_PATH_RX_CQE_SGL_RAW_SEL (0x1<<2)
3995 #define ETH_FAST_PATH_RX_CQE_SGL_RAW_SEL_SHIFT 2
3996 #define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG (0x1<<3)
3997 #define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG_SHIFT 3
3998 #define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG (0x1<<4)
3999 #define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG_SHIFT 4
4000 #define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG (0x1<<5)
4001 #define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG_SHIFT 5
4002 #define ETH_FAST_PATH_RX_CQE_PTP_PKT (0x1<<6)
4003 #define ETH_FAST_PATH_RX_CQE_PTP_PKT_SHIFT 6
4004 #define ETH_FAST_PATH_RX_CQE_RESERVED0 (0x1<<7)
4005 #define ETH_FAST_PATH_RX_CQE_RESERVED0_SHIFT 7
4006 	u8 status_flags;
4007 #define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE (0x7<<0)
4008 #define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE_SHIFT 0
4009 #define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG (0x1<<3)
4010 #define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG_SHIFT 3
4011 #define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG (0x1<<4)
4012 #define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG_SHIFT 4
4013 #define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG (0x1<<5)
4014 #define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG_SHIFT 5
4015 #define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG (0x1<<6)
4016 #define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG_SHIFT 6
4017 #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG (0x1<<7)
4018 #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG_SHIFT 7
4019 	u8 queue_index;
4020 	u8 placement_offset;
4021 	__le32 rss_hash_result;
4022 	__le16 vlan_tag;
4023 	__le16 pkt_len_or_gro_seg_len;
4024 	__le16 len_on_bd;
4025 	struct parsing_flags pars_flags;
4026 	union eth_sgl_or_raw_data sgl_or_raw_data;
4027 	u8 tunn_type;
4028 	u8 tunn_inner_hdrs_offset;
4029 	__le16 reserved1;
4030 	__le32 tunn_tenant_id;
4031 	__le32 padding[5];
4032 	u32 marker;
4033 };
4034 
4035 
4036 /*
4037  * Command for setting classification flags for a client
4038  */
4039 struct eth_filter_rules_cmd {
4040 	u8 cmd_general_data;
4041 #define ETH_FILTER_RULES_CMD_RX_CMD (0x1<<0)
4042 #define ETH_FILTER_RULES_CMD_RX_CMD_SHIFT 0
4043 #define ETH_FILTER_RULES_CMD_TX_CMD (0x1<<1)
4044 #define ETH_FILTER_RULES_CMD_TX_CMD_SHIFT 1
4045 #define ETH_FILTER_RULES_CMD_RESERVED0 (0x3F<<2)
4046 #define ETH_FILTER_RULES_CMD_RESERVED0_SHIFT 2
4047 	u8 func_id;
4048 	u8 client_id;
4049 	u8 reserved1;
4050 	__le16 state;
4051 #define ETH_FILTER_RULES_CMD_UCAST_DROP_ALL (0x1<<0)
4052 #define ETH_FILTER_RULES_CMD_UCAST_DROP_ALL_SHIFT 0
4053 #define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_ALL (0x1<<1)
4054 #define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_ALL_SHIFT 1
4055 #define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_UNMATCHED (0x1<<2)
4056 #define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_UNMATCHED_SHIFT 2
4057 #define ETH_FILTER_RULES_CMD_MCAST_DROP_ALL (0x1<<3)
4058 #define ETH_FILTER_RULES_CMD_MCAST_DROP_ALL_SHIFT 3
4059 #define ETH_FILTER_RULES_CMD_MCAST_ACCEPT_ALL (0x1<<4)
4060 #define ETH_FILTER_RULES_CMD_MCAST_ACCEPT_ALL_SHIFT 4
4061 #define ETH_FILTER_RULES_CMD_BCAST_ACCEPT_ALL (0x1<<5)
4062 #define ETH_FILTER_RULES_CMD_BCAST_ACCEPT_ALL_SHIFT 5
4063 #define ETH_FILTER_RULES_CMD_ACCEPT_ANY_VLAN (0x1<<6)
4064 #define ETH_FILTER_RULES_CMD_ACCEPT_ANY_VLAN_SHIFT 6
4065 #define ETH_FILTER_RULES_CMD_RESERVED2 (0x1FF<<7)
4066 #define ETH_FILTER_RULES_CMD_RESERVED2_SHIFT 7
4067 	__le16 reserved3;
4068 	struct regpair reserved4;
4069 };
4070 
4071 
4072 /*
4073  * parameters for eth classification filters ramrod
4074  */
4075 struct eth_filter_rules_ramrod_data {
4076 	struct eth_classify_header header;
4077 	struct eth_filter_rules_cmd rules[FILTER_RULES_COUNT];
4078 };
4079 
4080 /* Hsi version */
4081 enum eth_fp_hsi_ver {
4082 	ETH_FP_HSI_VER_0,
4083 	ETH_FP_HSI_VER_1,
4084 	ETH_FP_HSI_VER_2,
4085 	MAX_ETH_FP_HSI_VER
4086 };
4087 
4088 /*
4089  * parameters for eth classification configuration ramrod
4090  */
4091 struct eth_general_rules_ramrod_data {
4092 	struct eth_classify_header header;
4093 	union eth_classify_rule_cmd rules[CLASSIFY_RULES_COUNT];
4094 };
4095 
4096 
4097 /*
4098  * The data for Halt ramrod
4099  */
4100 struct eth_halt_ramrod_data {
4101 	__le32 client_id;
4102 	__le32 reserved0;
4103 };
4104 
4105 
4106 /*
4107  * destination and source mac address.
4108  */
4109 struct eth_mac_addresses {
4110 #if defined(__BIG_ENDIAN)
4111 	__le16 dst_mid;
4112 	__le16 dst_lo;
4113 #elif defined(__LITTLE_ENDIAN)
4114 	__le16 dst_lo;
4115 	__le16 dst_mid;
4116 #endif
4117 #if defined(__BIG_ENDIAN)
4118 	__le16 src_lo;
4119 	__le16 dst_hi;
4120 #elif defined(__LITTLE_ENDIAN)
4121 	__le16 dst_hi;
4122 	__le16 src_lo;
4123 #endif
4124 #if defined(__BIG_ENDIAN)
4125 	__le16 src_hi;
4126 	__le16 src_mid;
4127 #elif defined(__LITTLE_ENDIAN)
4128 	__le16 src_mid;
4129 	__le16 src_hi;
4130 #endif
4131 };
4132 
4133 /* tunneling related data */
4134 struct eth_tunnel_data {
4135 	__le16 dst_lo;
4136 	__le16 dst_mid;
4137 	__le16 dst_hi;
4138 	__le16 fw_ip_hdr_csum;
4139 	__le16 pseudo_csum;
4140 	u8 ip_hdr_start_inner_w;
4141 	u8 flags;
4142 #define ETH_TUNNEL_DATA_IPV6_OUTER (0x1<<0)
4143 #define ETH_TUNNEL_DATA_IPV6_OUTER_SHIFT 0
4144 #define ETH_TUNNEL_DATA_RESERVED (0x7F<<1)
4145 #define ETH_TUNNEL_DATA_RESERVED_SHIFT 1
4146 };
4147 
4148 /* union for mac addresses and for tunneling data.
4149  * considered as tunneling data only if (tunnel_exist == 1).
4150  */
4151 union eth_mac_addr_or_tunnel_data {
4152 	struct eth_mac_addresses mac_addr;
4153 	struct eth_tunnel_data tunnel_data;
4154 };
4155 
4156 /*Command for setting multicast classification for a client */
4157 struct eth_multicast_rules_cmd {
4158 	u8 cmd_general_data;
4159 #define ETH_MULTICAST_RULES_CMD_RX_CMD (0x1<<0)
4160 #define ETH_MULTICAST_RULES_CMD_RX_CMD_SHIFT 0
4161 #define ETH_MULTICAST_RULES_CMD_TX_CMD (0x1<<1)
4162 #define ETH_MULTICAST_RULES_CMD_TX_CMD_SHIFT 1
4163 #define ETH_MULTICAST_RULES_CMD_IS_ADD (0x1<<2)
4164 #define ETH_MULTICAST_RULES_CMD_IS_ADD_SHIFT 2
4165 #define ETH_MULTICAST_RULES_CMD_RESERVED0 (0x1F<<3)
4166 #define ETH_MULTICAST_RULES_CMD_RESERVED0_SHIFT 3
4167 	u8 func_id;
4168 	u8 bin_id;
4169 	u8 engine_id;
4170 	__le32 reserved2;
4171 	struct regpair reserved3;
4172 };
4173 
4174 /*
4175  * parameters for multicast classification ramrod
4176  */
4177 struct eth_multicast_rules_ramrod_data {
4178 	struct eth_classify_header header;
4179 	struct eth_multicast_rules_cmd rules[MULTICAST_RULES_COUNT];
4180 };
4181 
4182 /*
4183  * Place holder for ramrods protocol specific data
4184  */
4185 struct ramrod_data {
4186 	__le32 data_lo;
4187 	__le32 data_hi;
4188 };
4189 
4190 /*
4191  * union for ramrod data for Ethernet protocol (CQE) (force size of 16 bits)
4192  */
4193 union eth_ramrod_data {
4194 	struct ramrod_data general;
4195 };
4196 
4197 
4198 /*
4199  * RSS toeplitz hash type, as reported in CQE
4200  */
4201 enum eth_rss_hash_type {
4202 	DEFAULT_HASH_TYPE,
4203 	IPV4_HASH_TYPE,
4204 	TCP_IPV4_HASH_TYPE,
4205 	IPV6_HASH_TYPE,
4206 	TCP_IPV6_HASH_TYPE,
4207 	VLAN_PRI_HASH_TYPE,
4208 	E1HOV_PRI_HASH_TYPE,
4209 	DSCP_HASH_TYPE,
4210 	MAX_ETH_RSS_HASH_TYPE
4211 };
4212 
4213 
4214 /*
4215  * Ethernet RSS mode
4216  */
4217 enum eth_rss_mode {
4218 	ETH_RSS_MODE_DISABLED,
4219 	ETH_RSS_MODE_REGULAR,
4220 	ETH_RSS_MODE_VLAN_PRI,
4221 	ETH_RSS_MODE_E1HOV_PRI,
4222 	ETH_RSS_MODE_IP_DSCP,
4223 	MAX_ETH_RSS_MODE
4224 };
4225 
4226 
4227 /*
4228  * parameters for RSS update ramrod (E2)
4229  */
4230 struct eth_rss_update_ramrod_data {
4231 	u8 rss_engine_id;
4232 	u8 rss_mode;
4233 	__le16 capabilities;
4234 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_CAPABILITY (0x1<<0)
4235 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_CAPABILITY_SHIFT 0
4236 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_TCP_CAPABILITY (0x1<<1)
4237 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_TCP_CAPABILITY_SHIFT 1
4238 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_UDP_CAPABILITY (0x1<<2)
4239 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_UDP_CAPABILITY_SHIFT 2
4240 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_VXLAN_CAPABILITY (0x1<<3)
4241 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_VXLAN_CAPABILITY_SHIFT 3
4242 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_CAPABILITY (0x1<<4)
4243 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_CAPABILITY_SHIFT 4
4244 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY (0x1<<5)
4245 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY_SHIFT 5
4246 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY (0x1<<6)
4247 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY_SHIFT 6
4248 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_VXLAN_CAPABILITY (0x1<<7)
4249 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_VXLAN_CAPABILITY_SHIFT 7
4250 #define ETH_RSS_UPDATE_RAMROD_DATA_TUNN_INNER_HDRS_CAPABILITY (0x1<<8)
4251 #define ETH_RSS_UPDATE_RAMROD_DATA_TUNN_INNER_HDRS_CAPABILITY_SHIFT 8
4252 #define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY (0x1<<9)
4253 #define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY_SHIFT 9
4254 #define ETH_RSS_UPDATE_RAMROD_DATA_RESERVED (0x3F<<10)
4255 #define ETH_RSS_UPDATE_RAMROD_DATA_RESERVED_SHIFT 10
4256 	u8 rss_result_mask;
4257 	u8 reserved3;
4258 	__le16 reserved4;
4259 	u8 indirection_table[T_ETH_INDIRECTION_TABLE_SIZE];
4260 	__le32 rss_key[T_ETH_RSS_KEY];
4261 	__le32 echo;
4262 	__le32 reserved5;
4263 };
4264 
4265 
4266 /*
4267  * The eth Rx Buffer Descriptor
4268  */
4269 struct eth_rx_bd {
4270 	__le32 addr_lo;
4271 	__le32 addr_hi;
4272 };
4273 
4274 
4275 /*
4276  * Eth Rx Cqe structure- general structure for ramrods
4277  */
4278 struct common_ramrod_eth_rx_cqe {
4279 	u8 ramrod_type;
4280 #define COMMON_RAMROD_ETH_RX_CQE_TYPE (0x3<<0)
4281 #define COMMON_RAMROD_ETH_RX_CQE_TYPE_SHIFT 0
4282 #define COMMON_RAMROD_ETH_RX_CQE_ERROR (0x1<<2)
4283 #define COMMON_RAMROD_ETH_RX_CQE_ERROR_SHIFT 2
4284 #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0 (0x1F<<3)
4285 #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0_SHIFT 3
4286 	u8 conn_type;
4287 	__le16 reserved1;
4288 	__le32 conn_and_cmd_data;
4289 #define COMMON_RAMROD_ETH_RX_CQE_CID (0xFFFFFF<<0)
4290 #define COMMON_RAMROD_ETH_RX_CQE_CID_SHIFT 0
4291 #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID (0xFF<<24)
4292 #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID_SHIFT 24
4293 	struct ramrod_data protocol_data;
4294 	__le32 echo;
4295 	__le32 reserved2[11];
4296 };
4297 
4298 /*
4299  * Rx Last CQE in page (in ETH)
4300  */
4301 struct eth_rx_cqe_next_page {
4302 	__le32 addr_lo;
4303 	__le32 addr_hi;
4304 	__le32 reserved[14];
4305 };
4306 
4307 /*
4308  * union for all eth rx cqe types (fix their sizes)
4309  */
4310 union eth_rx_cqe {
4311 	struct eth_fast_path_rx_cqe fast_path_cqe;
4312 	struct common_ramrod_eth_rx_cqe ramrod_cqe;
4313 	struct eth_rx_cqe_next_page next_page_cqe;
4314 	struct eth_end_agg_rx_cqe end_agg_cqe;
4315 };
4316 
4317 
4318 /*
4319  * Values for RX ETH CQE type field
4320  */
4321 enum eth_rx_cqe_type {
4322 	RX_ETH_CQE_TYPE_ETH_FASTPATH,
4323 	RX_ETH_CQE_TYPE_ETH_RAMROD,
4324 	RX_ETH_CQE_TYPE_ETH_START_AGG,
4325 	RX_ETH_CQE_TYPE_ETH_STOP_AGG,
4326 	MAX_ETH_RX_CQE_TYPE
4327 };
4328 
4329 
4330 /*
4331  * Type of SGL/Raw field in ETH RX fast path CQE
4332  */
4333 enum eth_rx_fp_sel {
4334 	ETH_FP_CQE_REGULAR,
4335 	ETH_FP_CQE_RAW,
4336 	MAX_ETH_RX_FP_SEL
4337 };
4338 
4339 
4340 /*
4341  * The eth Rx SGE Descriptor
4342  */
4343 struct eth_rx_sge {
4344 	__le32 addr_lo;
4345 	__le32 addr_hi;
4346 };
4347 
4348 
4349 /*
4350  * common data for all protocols
4351  */
4352 struct spe_hdr {
4353 	__le32 conn_and_cmd_data;
4354 #define SPE_HDR_CID (0xFFFFFF<<0)
4355 #define SPE_HDR_CID_SHIFT 0
4356 #define SPE_HDR_CMD_ID (0xFF<<24)
4357 #define SPE_HDR_CMD_ID_SHIFT 24
4358 	__le16 type;
4359 #define SPE_HDR_CONN_TYPE (0xFF<<0)
4360 #define SPE_HDR_CONN_TYPE_SHIFT 0
4361 #define SPE_HDR_FUNCTION_ID (0xFF<<8)
4362 #define SPE_HDR_FUNCTION_ID_SHIFT 8
4363 	__le16 reserved1;
4364 };
4365 
4366 /*
4367  * specific data for ethernet slow path element
4368  */
4369 union eth_specific_data {
4370 	u8 protocol_data[8];
4371 	struct regpair client_update_ramrod_data;
4372 	struct regpair client_init_ramrod_init_data;
4373 	struct eth_halt_ramrod_data halt_ramrod_data;
4374 	struct regpair update_data_addr;
4375 	struct eth_common_ramrod_data common_ramrod_data;
4376 	struct regpair classify_cfg_addr;
4377 	struct regpair filter_cfg_addr;
4378 	struct regpair mcast_cfg_addr;
4379 };
4380 
4381 /*
4382  * Ethernet slow path element
4383  */
4384 struct eth_spe {
4385 	struct spe_hdr hdr;
4386 	union eth_specific_data data;
4387 };
4388 
4389 
4390 /*
4391  * Ethernet command ID for slow path elements
4392  */
4393 enum eth_spqe_cmd_id {
4394 	RAMROD_CMD_ID_ETH_UNUSED,
4395 	RAMROD_CMD_ID_ETH_CLIENT_SETUP,
4396 	RAMROD_CMD_ID_ETH_HALT,
4397 	RAMROD_CMD_ID_ETH_FORWARD_SETUP,
4398 	RAMROD_CMD_ID_ETH_TX_QUEUE_SETUP,
4399 	RAMROD_CMD_ID_ETH_CLIENT_UPDATE,
4400 	RAMROD_CMD_ID_ETH_EMPTY,
4401 	RAMROD_CMD_ID_ETH_TERMINATE,
4402 	RAMROD_CMD_ID_ETH_TPA_UPDATE,
4403 	RAMROD_CMD_ID_ETH_CLASSIFICATION_RULES,
4404 	RAMROD_CMD_ID_ETH_FILTER_RULES,
4405 	RAMROD_CMD_ID_ETH_MULTICAST_RULES,
4406 	RAMROD_CMD_ID_ETH_RSS_UPDATE,
4407 	RAMROD_CMD_ID_ETH_SET_MAC,
4408 	MAX_ETH_SPQE_CMD_ID
4409 };
4410 
4411 
4412 /*
4413  * eth tpa update command
4414  */
4415 enum eth_tpa_update_command {
4416 	TPA_UPDATE_NONE_COMMAND,
4417 	TPA_UPDATE_ENABLE_COMMAND,
4418 	TPA_UPDATE_DISABLE_COMMAND,
4419 	MAX_ETH_TPA_UPDATE_COMMAND
4420 };
4421 
4422 /* In case of LSO over IPv4 tunnel, whether to increment
4423  * IP ID on external IP header or internal IP header
4424  */
4425 enum eth_tunnel_lso_inc_ip_id {
4426 	EXT_HEADER,
4427 	INT_HEADER,
4428 	MAX_ETH_TUNNEL_LSO_INC_IP_ID
4429 };
4430 
4431 /* In case tunnel exist and L4 checksum offload,
4432  * the pseudo checksum location, on packet or on BD.
4433  */
4434 enum eth_tunnel_non_lso_csum_location {
4435 	CSUM_ON_PKT,
4436 	CSUM_ON_BD,
4437 	MAX_ETH_TUNNEL_NON_LSO_CSUM_LOCATION
4438 };
4439 
4440 enum eth_tunn_type {
4441 	TUNN_TYPE_NONE,
4442 	TUNN_TYPE_VXLAN,
4443 	TUNN_TYPE_L2_GRE,
4444 	TUNN_TYPE_IPV4_GRE,
4445 	TUNN_TYPE_IPV6_GRE,
4446 	TUNN_TYPE_L2_GENEVE,
4447 	TUNN_TYPE_IPV4_GENEVE,
4448 	TUNN_TYPE_IPV6_GENEVE,
4449 	MAX_ETH_TUNN_TYPE
4450 };
4451 
4452 /*
4453  * Tx regular BD structure
4454  */
4455 struct eth_tx_bd {
4456 	__le32 addr_lo;
4457 	__le32 addr_hi;
4458 	__le16 total_pkt_bytes;
4459 	__le16 nbytes;
4460 	u8 reserved[4];
4461 };
4462 
4463 
4464 /*
4465  * structure for easy accessibility to assembler
4466  */
4467 struct eth_tx_bd_flags {
4468 	u8 as_bitfield;
4469 #define ETH_TX_BD_FLAGS_IP_CSUM (0x1<<0)
4470 #define ETH_TX_BD_FLAGS_IP_CSUM_SHIFT 0
4471 #define ETH_TX_BD_FLAGS_L4_CSUM (0x1<<1)
4472 #define ETH_TX_BD_FLAGS_L4_CSUM_SHIFT 1
4473 #define ETH_TX_BD_FLAGS_VLAN_MODE (0x3<<2)
4474 #define ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT 2
4475 #define ETH_TX_BD_FLAGS_START_BD (0x1<<4)
4476 #define ETH_TX_BD_FLAGS_START_BD_SHIFT 4
4477 #define ETH_TX_BD_FLAGS_IS_UDP (0x1<<5)
4478 #define ETH_TX_BD_FLAGS_IS_UDP_SHIFT 5
4479 #define ETH_TX_BD_FLAGS_SW_LSO (0x1<<6)
4480 #define ETH_TX_BD_FLAGS_SW_LSO_SHIFT 6
4481 #define ETH_TX_BD_FLAGS_IPV6 (0x1<<7)
4482 #define ETH_TX_BD_FLAGS_IPV6_SHIFT 7
4483 };
4484 
4485 /*
4486  * The eth Tx Buffer Descriptor
4487  */
4488 struct eth_tx_start_bd {
4489 	__le32 addr_lo;
4490 	__le32 addr_hi;
4491 	__le16 nbd;
4492 	__le16 nbytes;
4493 	__le16 vlan_or_ethertype;
4494 	struct eth_tx_bd_flags bd_flags;
4495 	u8 general_data;
4496 #define ETH_TX_START_BD_HDR_NBDS (0x7<<0)
4497 #define ETH_TX_START_BD_HDR_NBDS_SHIFT 0
4498 #define ETH_TX_START_BD_NO_ADDED_TAGS (0x1<<3)
4499 #define ETH_TX_START_BD_NO_ADDED_TAGS_SHIFT 3
4500 #define ETH_TX_START_BD_FORCE_VLAN_MODE (0x1<<4)
4501 #define ETH_TX_START_BD_FORCE_VLAN_MODE_SHIFT 4
4502 #define ETH_TX_START_BD_PARSE_NBDS (0x3<<5)
4503 #define ETH_TX_START_BD_PARSE_NBDS_SHIFT 5
4504 #define ETH_TX_START_BD_TUNNEL_EXIST (0x1<<7)
4505 #define ETH_TX_START_BD_TUNNEL_EXIST_SHIFT 7
4506 };
4507 
4508 /*
4509  * Tx parsing BD structure for ETH E1/E1h
4510  */
4511 struct eth_tx_parse_bd_e1x {
4512 	__le16 global_data;
4513 #define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W (0xF<<0)
4514 #define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W_SHIFT 0
4515 #define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE (0x3<<4)
4516 #define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE_SHIFT 4
4517 #define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN (0x1<<6)
4518 #define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN_SHIFT 6
4519 #define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN (0x1<<7)
4520 #define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT 7
4521 #define ETH_TX_PARSE_BD_E1X_NS_FLG (0x1<<8)
4522 #define ETH_TX_PARSE_BD_E1X_NS_FLG_SHIFT 8
4523 #define ETH_TX_PARSE_BD_E1X_RESERVED0 (0x7F<<9)
4524 #define ETH_TX_PARSE_BD_E1X_RESERVED0_SHIFT 9
4525 	u8 tcp_flags;
4526 #define ETH_TX_PARSE_BD_E1X_FIN_FLG (0x1<<0)
4527 #define ETH_TX_PARSE_BD_E1X_FIN_FLG_SHIFT 0
4528 #define ETH_TX_PARSE_BD_E1X_SYN_FLG (0x1<<1)
4529 #define ETH_TX_PARSE_BD_E1X_SYN_FLG_SHIFT 1
4530 #define ETH_TX_PARSE_BD_E1X_RST_FLG (0x1<<2)
4531 #define ETH_TX_PARSE_BD_E1X_RST_FLG_SHIFT 2
4532 #define ETH_TX_PARSE_BD_E1X_PSH_FLG (0x1<<3)
4533 #define ETH_TX_PARSE_BD_E1X_PSH_FLG_SHIFT 3
4534 #define ETH_TX_PARSE_BD_E1X_ACK_FLG (0x1<<4)
4535 #define ETH_TX_PARSE_BD_E1X_ACK_FLG_SHIFT 4
4536 #define ETH_TX_PARSE_BD_E1X_URG_FLG (0x1<<5)
4537 #define ETH_TX_PARSE_BD_E1X_URG_FLG_SHIFT 5
4538 #define ETH_TX_PARSE_BD_E1X_ECE_FLG (0x1<<6)
4539 #define ETH_TX_PARSE_BD_E1X_ECE_FLG_SHIFT 6
4540 #define ETH_TX_PARSE_BD_E1X_CWR_FLG (0x1<<7)
4541 #define ETH_TX_PARSE_BD_E1X_CWR_FLG_SHIFT 7
4542 	u8 ip_hlen_w;
4543 	__le16 total_hlen_w;
4544 	__le16 tcp_pseudo_csum;
4545 	__le16 lso_mss;
4546 	__le16 ip_id;
4547 	__le32 tcp_send_seq;
4548 };
4549 
4550 /*
4551  * Tx parsing BD structure for ETH E2
4552  */
4553 struct eth_tx_parse_bd_e2 {
4554 	union eth_mac_addr_or_tunnel_data data;
4555 	__le32 parsing_data;
4556 #define ETH_TX_PARSE_BD_E2_L4_HDR_START_OFFSET_W (0x7FF<<0)
4557 #define ETH_TX_PARSE_BD_E2_L4_HDR_START_OFFSET_W_SHIFT 0
4558 #define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW (0xF<<11)
4559 #define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT 11
4560 #define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR (0x1<<15)
4561 #define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR_SHIFT 15
4562 #define ETH_TX_PARSE_BD_E2_LSO_MSS (0x3FFF<<16)
4563 #define ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT 16
4564 #define ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE (0x3<<30)
4565 #define ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT 30
4566 };
4567 
4568 /*
4569  * Tx 2nd parsing BD structure for ETH packet
4570  */
4571 struct eth_tx_parse_2nd_bd {
4572 	__le16 global_data;
4573 #define ETH_TX_PARSE_2ND_BD_IP_HDR_START_OUTER_W (0xF<<0)
4574 #define ETH_TX_PARSE_2ND_BD_IP_HDR_START_OUTER_W_SHIFT 0
4575 #define ETH_TX_PARSE_2ND_BD_RESERVED0 (0x1<<4)
4576 #define ETH_TX_PARSE_2ND_BD_RESERVED0_SHIFT 4
4577 #define ETH_TX_PARSE_2ND_BD_LLC_SNAP_EN (0x1<<5)
4578 #define ETH_TX_PARSE_2ND_BD_LLC_SNAP_EN_SHIFT 5
4579 #define ETH_TX_PARSE_2ND_BD_NS_FLG (0x1<<6)
4580 #define ETH_TX_PARSE_2ND_BD_NS_FLG_SHIFT 6
4581 #define ETH_TX_PARSE_2ND_BD_TUNNEL_UDP_EXIST (0x1<<7)
4582 #define ETH_TX_PARSE_2ND_BD_TUNNEL_UDP_EXIST_SHIFT 7
4583 #define ETH_TX_PARSE_2ND_BD_IP_HDR_LEN_OUTER_W (0x1F<<8)
4584 #define ETH_TX_PARSE_2ND_BD_IP_HDR_LEN_OUTER_W_SHIFT 8
4585 #define ETH_TX_PARSE_2ND_BD_RESERVED1 (0x7<<13)
4586 #define ETH_TX_PARSE_2ND_BD_RESERVED1_SHIFT 13
4587 	u8 bd_type;
4588 #define ETH_TX_PARSE_2ND_BD_TYPE (0xF<<0)
4589 #define ETH_TX_PARSE_2ND_BD_TYPE_SHIFT 0
4590 #define ETH_TX_PARSE_2ND_BD_RESERVED2 (0xF<<4)
4591 #define ETH_TX_PARSE_2ND_BD_RESERVED2_SHIFT 4
4592 	u8 reserved3;
4593 	u8 tcp_flags;
4594 #define ETH_TX_PARSE_2ND_BD_FIN_FLG (0x1<<0)
4595 #define ETH_TX_PARSE_2ND_BD_FIN_FLG_SHIFT 0
4596 #define ETH_TX_PARSE_2ND_BD_SYN_FLG (0x1<<1)
4597 #define ETH_TX_PARSE_2ND_BD_SYN_FLG_SHIFT 1
4598 #define ETH_TX_PARSE_2ND_BD_RST_FLG (0x1<<2)
4599 #define ETH_TX_PARSE_2ND_BD_RST_FLG_SHIFT 2
4600 #define ETH_TX_PARSE_2ND_BD_PSH_FLG (0x1<<3)
4601 #define ETH_TX_PARSE_2ND_BD_PSH_FLG_SHIFT 3
4602 #define ETH_TX_PARSE_2ND_BD_ACK_FLG (0x1<<4)
4603 #define ETH_TX_PARSE_2ND_BD_ACK_FLG_SHIFT 4
4604 #define ETH_TX_PARSE_2ND_BD_URG_FLG (0x1<<5)
4605 #define ETH_TX_PARSE_2ND_BD_URG_FLG_SHIFT 5
4606 #define ETH_TX_PARSE_2ND_BD_ECE_FLG (0x1<<6)
4607 #define ETH_TX_PARSE_2ND_BD_ECE_FLG_SHIFT 6
4608 #define ETH_TX_PARSE_2ND_BD_CWR_FLG (0x1<<7)
4609 #define ETH_TX_PARSE_2ND_BD_CWR_FLG_SHIFT 7
4610 	u8 reserved4;
4611 	u8 tunnel_udp_hdr_start_w;
4612 	u8 fw_ip_hdr_to_payload_w;
4613 	__le16 fw_ip_csum_wo_len_flags_frag;
4614 	__le16 hw_ip_id;
4615 	__le32 tcp_send_seq;
4616 };
4617 
4618 /* The last BD in the BD memory will hold a pointer to the next BD memory */
4619 struct eth_tx_next_bd {
4620 	__le32 addr_lo;
4621 	__le32 addr_hi;
4622 	u8 reserved[8];
4623 };
4624 
4625 /*
4626  * union for 4 Bd types
4627  */
4628 union eth_tx_bd_types {
4629 	struct eth_tx_start_bd start_bd;
4630 	struct eth_tx_bd reg_bd;
4631 	struct eth_tx_parse_bd_e1x parse_bd_e1x;
4632 	struct eth_tx_parse_bd_e2 parse_bd_e2;
4633 	struct eth_tx_parse_2nd_bd parse_2nd_bd;
4634 	struct eth_tx_next_bd next_bd;
4635 };
4636 
4637 /*
4638  * array of 13 bds as appears in the eth xstorm context
4639  */
4640 struct eth_tx_bds_array {
4641 	union eth_tx_bd_types bds[13];
4642 };
4643 
4644 
4645 /*
4646  * VLAN mode on TX BDs
4647  */
4648 enum eth_tx_vlan_type {
4649 	X_ETH_NO_VLAN,
4650 	X_ETH_OUTBAND_VLAN,
4651 	X_ETH_INBAND_VLAN,
4652 	X_ETH_FW_ADDED_VLAN,
4653 	MAX_ETH_TX_VLAN_TYPE
4654 };
4655 
4656 
4657 /*
4658  * Ethernet VLAN filtering mode in E1x
4659  */
4660 enum eth_vlan_filter_mode {
4661 	ETH_VLAN_FILTER_ANY_VLAN,
4662 	ETH_VLAN_FILTER_SPECIFIC_VLAN,
4663 	ETH_VLAN_FILTER_CLASSIFY,
4664 	MAX_ETH_VLAN_FILTER_MODE
4665 };
4666 
4667 
4668 /*
4669  * MAC filtering configuration command header
4670  */
4671 struct mac_configuration_hdr {
4672 	u8 length;
4673 	u8 offset;
4674 	__le16 client_id;
4675 	__le32 echo;
4676 };
4677 
4678 /*
4679  * MAC address in list for ramrod
4680  */
4681 struct mac_configuration_entry {
4682 	__le16 lsb_mac_addr;
4683 	__le16 middle_mac_addr;
4684 	__le16 msb_mac_addr;
4685 	__le16 vlan_id;
4686 	u8 pf_id;
4687 	u8 flags;
4688 #define MAC_CONFIGURATION_ENTRY_ACTION_TYPE (0x1<<0)
4689 #define MAC_CONFIGURATION_ENTRY_ACTION_TYPE_SHIFT 0
4690 #define MAC_CONFIGURATION_ENTRY_RDMA_MAC (0x1<<1)
4691 #define MAC_CONFIGURATION_ENTRY_RDMA_MAC_SHIFT 1
4692 #define MAC_CONFIGURATION_ENTRY_VLAN_FILTERING_MODE (0x3<<2)
4693 #define MAC_CONFIGURATION_ENTRY_VLAN_FILTERING_MODE_SHIFT 2
4694 #define MAC_CONFIGURATION_ENTRY_OVERRIDE_VLAN_REMOVAL (0x1<<4)
4695 #define MAC_CONFIGURATION_ENTRY_OVERRIDE_VLAN_REMOVAL_SHIFT 4
4696 #define MAC_CONFIGURATION_ENTRY_BROADCAST (0x1<<5)
4697 #define MAC_CONFIGURATION_ENTRY_BROADCAST_SHIFT 5
4698 #define MAC_CONFIGURATION_ENTRY_RESERVED1 (0x3<<6)
4699 #define MAC_CONFIGURATION_ENTRY_RESERVED1_SHIFT 6
4700 	__le16 reserved0;
4701 	__le32 clients_bit_vector;
4702 };
4703 
4704 /*
4705  * MAC filtering configuration command
4706  */
4707 struct mac_configuration_cmd {
4708 	struct mac_configuration_hdr hdr;
4709 	struct mac_configuration_entry config_table[64];
4710 };
4711 
4712 
4713 /*
4714  * Set-MAC command type (in E1x)
4715  */
4716 enum set_mac_action_type {
4717 	T_ETH_MAC_COMMAND_INVALIDATE,
4718 	T_ETH_MAC_COMMAND_SET,
4719 	MAX_SET_MAC_ACTION_TYPE
4720 };
4721 
4722 
4723 /*
4724  * Ethernet TPA Modes
4725  */
4726 enum tpa_mode {
4727 	TPA_LRO,
4728 	TPA_GRO,
4729 	MAX_TPA_MODE};
4730 
4731 
4732 /*
4733  * tpa update ramrod data
4734  */
4735 struct tpa_update_ramrod_data {
4736 	u8 update_ipv4;
4737 	u8 update_ipv6;
4738 	u8 client_id;
4739 	u8 max_tpa_queues;
4740 	u8 max_sges_for_packet;
4741 	u8 complete_on_both_clients;
4742 	u8 dont_verify_rings_pause_thr_flg;
4743 	u8 tpa_mode;
4744 	__le16 sge_buff_size;
4745 	__le16 max_agg_size;
4746 	__le32 sge_page_base_lo;
4747 	__le32 sge_page_base_hi;
4748 	__le16 sge_pause_thr_low;
4749 	__le16 sge_pause_thr_high;
4750 };
4751 
4752 
4753 /*
4754  * approximate-match multicast filtering for E1H per function in Tstorm
4755  */
4756 struct tstorm_eth_approximate_match_multicast_filtering {
4757 	u32 mcast_add_hash_bit_array[8];
4758 };
4759 
4760 
4761 /*
4762  * Common configuration parameters per function in Tstorm
4763  */
4764 struct tstorm_eth_function_common_config {
4765 	__le16 config_flags;
4766 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY (0x1<<0)
4767 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY_SHIFT 0
4768 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY (0x1<<1)
4769 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY_SHIFT 1
4770 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY (0x1<<2)
4771 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
4772 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
4773 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
4774 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
4775 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
4776 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE (0x1<<7)
4777 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE_SHIFT 7
4778 #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0xFF<<8)
4779 #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 8
4780 	u8 rss_result_mask;
4781 	u8 reserved1;
4782 	__le16 vlan_id[2];
4783 };
4784 
4785 
4786 /*
4787  * MAC filtering configuration parameters per port in Tstorm
4788  */
4789 struct tstorm_eth_mac_filter_config {
4790 	u32 ucast_drop_all;
4791 	u32 ucast_accept_all;
4792 	u32 mcast_drop_all;
4793 	u32 mcast_accept_all;
4794 	u32 bcast_accept_all;
4795 	u32 vlan_filter[2];
4796 	u32 unmatched_unicast;
4797 };
4798 
4799 
4800 /*
4801  * tx only queue init ramrod data
4802  */
4803 struct tx_queue_init_ramrod_data {
4804 	struct client_init_general_data general;
4805 	struct client_init_tx_data tx;
4806 };
4807 
4808 
4809 /*
4810  * Three RX producers for ETH
4811  */
4812 struct ustorm_eth_rx_producers {
4813 #if defined(__BIG_ENDIAN)
4814 	u16 bd_prod;
4815 	u16 cqe_prod;
4816 #elif defined(__LITTLE_ENDIAN)
4817 	u16 cqe_prod;
4818 	u16 bd_prod;
4819 #endif
4820 #if defined(__BIG_ENDIAN)
4821 	u16 reserved;
4822 	u16 sge_prod;
4823 #elif defined(__LITTLE_ENDIAN)
4824 	u16 sge_prod;
4825 	u16 reserved;
4826 #endif
4827 };
4828 
4829 
4830 /*
4831  * FCoE RX statistics parameters section#0
4832  */
4833 struct fcoe_rx_stat_params_section0 {
4834 	__le32 fcoe_rx_pkt_cnt;
4835 	__le32 fcoe_rx_byte_cnt;
4836 };
4837 
4838 
4839 /*
4840  * FCoE RX statistics parameters section#1
4841  */
4842 struct fcoe_rx_stat_params_section1 {
4843 	__le32 fcoe_ver_cnt;
4844 	__le32 fcoe_rx_drop_pkt_cnt;
4845 };
4846 
4847 
4848 /*
4849  * FCoE RX statistics parameters section#2
4850  */
4851 struct fcoe_rx_stat_params_section2 {
4852 	__le32 fc_crc_cnt;
4853 	__le32 eofa_del_cnt;
4854 	__le32 miss_frame_cnt;
4855 	__le32 seq_timeout_cnt;
4856 	__le32 drop_seq_cnt;
4857 	__le32 fcoe_rx_drop_pkt_cnt;
4858 	__le32 fcp_rx_pkt_cnt;
4859 	__le32 reserved0;
4860 };
4861 
4862 
4863 /*
4864  * FCoE TX statistics parameters
4865  */
4866 struct fcoe_tx_stat_params {
4867 	__le32 fcoe_tx_pkt_cnt;
4868 	__le32 fcoe_tx_byte_cnt;
4869 	__le32 fcp_tx_pkt_cnt;
4870 	__le32 reserved0;
4871 };
4872 
4873 /*
4874  * FCoE statistics parameters
4875  */
4876 struct fcoe_statistics_params {
4877 	struct fcoe_tx_stat_params tx_stat;
4878 	struct fcoe_rx_stat_params_section0 rx_stat0;
4879 	struct fcoe_rx_stat_params_section1 rx_stat1;
4880 	struct fcoe_rx_stat_params_section2 rx_stat2;
4881 };
4882 
4883 
4884 /*
4885  * The data afex vif list ramrod need
4886  */
4887 struct afex_vif_list_ramrod_data {
4888 	u8 afex_vif_list_command;
4889 	u8 func_bit_map;
4890 	__le16 vif_list_index;
4891 	u8 func_to_clear;
4892 	u8 echo;
4893 	__le16 reserved1;
4894 };
4895 
4896 struct c2s_pri_trans_table_entry {
4897 	u8 val[MAX_VLAN_PRIORITIES];
4898 };
4899 
4900 /*
4901  * cfc delete event data
4902  */
4903 struct cfc_del_event_data {
4904 	__le32 cid;
4905 	__le32 reserved0;
4906 	__le32 reserved1;
4907 };
4908 
4909 
4910 /*
4911  * per-port SAFC demo variables
4912  */
4913 struct cmng_flags_per_port {
4914 	u32 cmng_enables;
4915 #define CMNG_FLAGS_PER_PORT_FAIRNESS_VN (0x1<<0)
4916 #define CMNG_FLAGS_PER_PORT_FAIRNESS_VN_SHIFT 0
4917 #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN (0x1<<1)
4918 #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN_SHIFT 1
4919 #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS (0x1<<2)
4920 #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_SHIFT 2
4921 #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_MODE (0x1<<3)
4922 #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_MODE_SHIFT 3
4923 #define __CMNG_FLAGS_PER_PORT_RESERVED0 (0xFFFFFFF<<4)
4924 #define __CMNG_FLAGS_PER_PORT_RESERVED0_SHIFT 4
4925 	u32 __reserved1;
4926 };
4927 
4928 
4929 /*
4930  * per-port rate shaping variables
4931  */
4932 struct rate_shaping_vars_per_port {
4933 	u32 rs_periodic_timeout;
4934 	u32 rs_threshold;
4935 };
4936 
4937 /*
4938  * per-port fairness variables
4939  */
4940 struct fairness_vars_per_port {
4941 	u32 upper_bound;
4942 	u32 fair_threshold;
4943 	u32 fairness_timeout;
4944 	u32 reserved0;
4945 };
4946 
4947 /*
4948  * per-port SAFC variables
4949  */
4950 struct safc_struct_per_port {
4951 #if defined(__BIG_ENDIAN)
4952 	u16 __reserved1;
4953 	u8 __reserved0;
4954 	u8 safc_timeout_usec;
4955 #elif defined(__LITTLE_ENDIAN)
4956 	u8 safc_timeout_usec;
4957 	u8 __reserved0;
4958 	u16 __reserved1;
4959 #endif
4960 	u8 cos_to_traffic_types[MAX_COS_NUMBER];
4961 	u16 cos_to_pause_mask[NUM_OF_SAFC_BITS];
4962 };
4963 
4964 /*
4965  * Per-port congestion management variables
4966  */
4967 struct cmng_struct_per_port {
4968 	struct rate_shaping_vars_per_port rs_vars;
4969 	struct fairness_vars_per_port fair_vars;
4970 	struct safc_struct_per_port safc_vars;
4971 	struct cmng_flags_per_port flags;
4972 };
4973 
4974 /*
4975  * a single rate shaping counter. can be used as protocol or vnic counter
4976  */
4977 struct rate_shaping_counter {
4978 	u32 quota;
4979 #if defined(__BIG_ENDIAN)
4980 	u16 __reserved0;
4981 	u16 rate;
4982 #elif defined(__LITTLE_ENDIAN)
4983 	u16 rate;
4984 	u16 __reserved0;
4985 #endif
4986 };
4987 
4988 /*
4989  * per-vnic rate shaping variables
4990  */
4991 struct rate_shaping_vars_per_vn {
4992 	struct rate_shaping_counter vn_counter;
4993 };
4994 
4995 /*
4996  * per-vnic fairness variables
4997  */
4998 struct fairness_vars_per_vn {
4999 	u32 cos_credit_delta[MAX_COS_NUMBER];
5000 	u32 vn_credit_delta;
5001 	u32 __reserved0;
5002 };
5003 
5004 /*
5005  * cmng port init state
5006  */
5007 struct cmng_vnic {
5008 	struct rate_shaping_vars_per_vn vnic_max_rate[4];
5009 	struct fairness_vars_per_vn vnic_min_rate[4];
5010 };
5011 
5012 /*
5013  * cmng port init state
5014  */
5015 struct cmng_init {
5016 	struct cmng_struct_per_port port;
5017 	struct cmng_vnic vnic;
5018 };
5019 
5020 
5021 /*
5022  * driver parameters for congestion management init, all rates are in Mbps
5023  */
5024 struct cmng_init_input {
5025 	u32 port_rate;
5026 	u16 vnic_min_rate[4];
5027 	u16 vnic_max_rate[4];
5028 	u16 cos_min_rate[MAX_COS_NUMBER];
5029 	u16 cos_to_pause_mask[MAX_COS_NUMBER];
5030 	struct cmng_flags_per_port flags;
5031 };
5032 
5033 
5034 /*
5035  * Protocol-common command ID for slow path elements
5036  */
5037 enum common_spqe_cmd_id {
5038 	RAMROD_CMD_ID_COMMON_UNUSED,
5039 	RAMROD_CMD_ID_COMMON_FUNCTION_START,
5040 	RAMROD_CMD_ID_COMMON_FUNCTION_STOP,
5041 	RAMROD_CMD_ID_COMMON_FUNCTION_UPDATE,
5042 	RAMROD_CMD_ID_COMMON_CFC_DEL,
5043 	RAMROD_CMD_ID_COMMON_CFC_DEL_WB,
5044 	RAMROD_CMD_ID_COMMON_STAT_QUERY,
5045 	RAMROD_CMD_ID_COMMON_STOP_TRAFFIC,
5046 	RAMROD_CMD_ID_COMMON_START_TRAFFIC,
5047 	RAMROD_CMD_ID_COMMON_AFEX_VIF_LISTS,
5048 	RAMROD_CMD_ID_COMMON_SET_TIMESYNC,
5049 	MAX_COMMON_SPQE_CMD_ID
5050 };
5051 
5052 /*
5053  * Per-protocol connection types
5054  */
5055 enum connection_type {
5056 	ETH_CONNECTION_TYPE,
5057 	TOE_CONNECTION_TYPE,
5058 	RDMA_CONNECTION_TYPE,
5059 	ISCSI_CONNECTION_TYPE,
5060 	FCOE_CONNECTION_TYPE,
5061 	RESERVED_CONNECTION_TYPE_0,
5062 	RESERVED_CONNECTION_TYPE_1,
5063 	RESERVED_CONNECTION_TYPE_2,
5064 	NONE_CONNECTION_TYPE,
5065 	MAX_CONNECTION_TYPE
5066 };
5067 
5068 
5069 /*
5070  * Cos modes
5071  */
5072 enum cos_mode {
5073 	OVERRIDE_COS,
5074 	STATIC_COS,
5075 	FW_WRR,
5076 	MAX_COS_MODE
5077 };
5078 
5079 
5080 /*
5081  * Dynamic HC counters set by the driver
5082  */
5083 struct hc_dynamic_drv_counter {
5084 	u32 val[HC_SB_MAX_DYNAMIC_INDICES];
5085 };
5086 
5087 /*
5088  * zone A per-queue data
5089  */
5090 struct cstorm_queue_zone_data {
5091 	struct hc_dynamic_drv_counter hc_dyn_drv_cnt;
5092 	struct regpair reserved[2];
5093 };
5094 
5095 
5096 /*
5097  * Vf-PF channel data in cstorm ram (non-triggered zone)
5098  */
5099 struct vf_pf_channel_zone_data {
5100 	u32 msg_addr_lo;
5101 	u32 msg_addr_hi;
5102 };
5103 
5104 /*
5105  * zone for VF non-triggered data
5106  */
5107 struct non_trigger_vf_zone {
5108 	struct vf_pf_channel_zone_data vf_pf_channel;
5109 };
5110 
5111 /*
5112  * Vf-PF channel trigger zone in cstorm ram
5113  */
5114 struct vf_pf_channel_zone_trigger {
5115 	u8 addr_valid;
5116 };
5117 
5118 /*
5119  * zone that triggers the in-bound interrupt
5120  */
5121 struct trigger_vf_zone {
5122 	struct vf_pf_channel_zone_trigger vf_pf_channel;
5123 	u8 reserved0;
5124 	u16 reserved1;
5125 	u32 reserved2;
5126 };
5127 
5128 /*
5129  * zone B per-VF data
5130  */
5131 struct cstorm_vf_zone_data {
5132 	struct non_trigger_vf_zone non_trigger;
5133 	struct trigger_vf_zone trigger;
5134 };
5135 
5136 
5137 /*
5138  * Dynamic host coalescing init parameters, per state machine
5139  */
5140 struct dynamic_hc_sm_config {
5141 	u32 threshold[3];
5142 	u8 shift_per_protocol[HC_SB_MAX_DYNAMIC_INDICES];
5143 	u8 hc_timeout0[HC_SB_MAX_DYNAMIC_INDICES];
5144 	u8 hc_timeout1[HC_SB_MAX_DYNAMIC_INDICES];
5145 	u8 hc_timeout2[HC_SB_MAX_DYNAMIC_INDICES];
5146 	u8 hc_timeout3[HC_SB_MAX_DYNAMIC_INDICES];
5147 };
5148 
5149 /*
5150  * Dynamic host coalescing init parameters
5151  */
5152 struct dynamic_hc_config {
5153 	struct dynamic_hc_sm_config sm_config[HC_SB_MAX_SM];
5154 };
5155 
5156 
5157 struct e2_integ_data {
5158 #if defined(__BIG_ENDIAN)
5159 	u8 flags;
5160 #define E2_INTEG_DATA_TESTING_EN (0x1<<0)
5161 #define E2_INTEG_DATA_TESTING_EN_SHIFT 0
5162 #define E2_INTEG_DATA_LB_TX (0x1<<1)
5163 #define E2_INTEG_DATA_LB_TX_SHIFT 1
5164 #define E2_INTEG_DATA_COS_TX (0x1<<2)
5165 #define E2_INTEG_DATA_COS_TX_SHIFT 2
5166 #define E2_INTEG_DATA_OPPORTUNISTICQM (0x1<<3)
5167 #define E2_INTEG_DATA_OPPORTUNISTICQM_SHIFT 3
5168 #define E2_INTEG_DATA_DPMTESTRELEASEDQ (0x1<<4)
5169 #define E2_INTEG_DATA_DPMTESTRELEASEDQ_SHIFT 4
5170 #define E2_INTEG_DATA_RESERVED (0x7<<5)
5171 #define E2_INTEG_DATA_RESERVED_SHIFT 5
5172 	u8 cos;
5173 	u8 voq;
5174 	u8 pbf_queue;
5175 #elif defined(__LITTLE_ENDIAN)
5176 	u8 pbf_queue;
5177 	u8 voq;
5178 	u8 cos;
5179 	u8 flags;
5180 #define E2_INTEG_DATA_TESTING_EN (0x1<<0)
5181 #define E2_INTEG_DATA_TESTING_EN_SHIFT 0
5182 #define E2_INTEG_DATA_LB_TX (0x1<<1)
5183 #define E2_INTEG_DATA_LB_TX_SHIFT 1
5184 #define E2_INTEG_DATA_COS_TX (0x1<<2)
5185 #define E2_INTEG_DATA_COS_TX_SHIFT 2
5186 #define E2_INTEG_DATA_OPPORTUNISTICQM (0x1<<3)
5187 #define E2_INTEG_DATA_OPPORTUNISTICQM_SHIFT 3
5188 #define E2_INTEG_DATA_DPMTESTRELEASEDQ (0x1<<4)
5189 #define E2_INTEG_DATA_DPMTESTRELEASEDQ_SHIFT 4
5190 #define E2_INTEG_DATA_RESERVED (0x7<<5)
5191 #define E2_INTEG_DATA_RESERVED_SHIFT 5
5192 #endif
5193 #if defined(__BIG_ENDIAN)
5194 	u16 reserved3;
5195 	u8 reserved2;
5196 	u8 ramEn;
5197 #elif defined(__LITTLE_ENDIAN)
5198 	u8 ramEn;
5199 	u8 reserved2;
5200 	u16 reserved3;
5201 #endif
5202 };
5203 
5204 
5205 /*
5206  * set mac event data
5207  */
5208 struct eth_event_data {
5209 	__le32 echo;
5210 	__le32 reserved0;
5211 	__le32 reserved1;
5212 };
5213 
5214 
5215 /*
5216  * pf-vf event data
5217  */
5218 struct vf_pf_event_data {
5219 	u8 vf_id;
5220 	u8 reserved0;
5221 	__le16 reserved1;
5222 	__le32 msg_addr_lo;
5223 	__le32 msg_addr_hi;
5224 };
5225 
5226 /*
5227  * VF FLR event data
5228  */
5229 struct vf_flr_event_data {
5230 	u8 vf_id;
5231 	u8 reserved0;
5232 	__le16 reserved1;
5233 	__le32 reserved2;
5234 	__le32 reserved3;
5235 };
5236 
5237 /*
5238  * malicious VF event data
5239  */
5240 struct malicious_vf_event_data {
5241 	u8 vf_id;
5242 	u8 err_id;
5243 	__le16 reserved1;
5244 	__le32 reserved2;
5245 	__le32 reserved3;
5246 };
5247 
5248 /*
5249  * vif list event data
5250  */
5251 struct vif_list_event_data {
5252 	u8 func_bit_map;
5253 	u8 echo;
5254 	__le16 reserved0;
5255 	__le32 reserved1;
5256 	__le32 reserved2;
5257 };
5258 
5259 /* function update event data */
5260 struct function_update_event_data {
5261 	u8 echo;
5262 	u8 reserved;
5263 	__le16 reserved0;
5264 	__le32 reserved1;
5265 	__le32 reserved2;
5266 };
5267 
5268 
5269 /* union for all event ring message types */
5270 union event_data {
5271 	struct vf_pf_event_data vf_pf_event;
5272 	struct eth_event_data eth_event;
5273 	struct cfc_del_event_data cfc_del_event;
5274 	struct vf_flr_event_data vf_flr_event;
5275 	struct malicious_vf_event_data malicious_vf_event;
5276 	struct vif_list_event_data vif_list_event;
5277 	struct function_update_event_data function_update_event;
5278 };
5279 
5280 
5281 /*
5282  * per PF event ring data
5283  */
5284 struct event_ring_data {
5285 	struct regpair_native base_addr;
5286 #if defined(__BIG_ENDIAN)
5287 	u8 index_id;
5288 	u8 sb_id;
5289 	u16 producer;
5290 #elif defined(__LITTLE_ENDIAN)
5291 	u16 producer;
5292 	u8 sb_id;
5293 	u8 index_id;
5294 #endif
5295 	u32 reserved0;
5296 };
5297 
5298 
5299 /*
5300  * event ring message element (each element is 128 bits)
5301  */
5302 struct event_ring_msg {
5303 	u8 opcode;
5304 	u8 error;
5305 	u16 reserved1;
5306 	union event_data data;
5307 };
5308 
5309 /*
5310  * event ring next page element (128 bits)
5311  */
5312 struct event_ring_next {
5313 	struct regpair addr;
5314 	u32 reserved[2];
5315 };
5316 
5317 /*
5318  * union for event ring element types (each element is 128 bits)
5319  */
5320 union event_ring_elem {
5321 	struct event_ring_msg message;
5322 	struct event_ring_next next_page;
5323 };
5324 
5325 
5326 /*
5327  * Common event ring opcodes
5328  */
5329 enum event_ring_opcode {
5330 	EVENT_RING_OPCODE_VF_PF_CHANNEL,
5331 	EVENT_RING_OPCODE_FUNCTION_START,
5332 	EVENT_RING_OPCODE_FUNCTION_STOP,
5333 	EVENT_RING_OPCODE_CFC_DEL,
5334 	EVENT_RING_OPCODE_CFC_DEL_WB,
5335 	EVENT_RING_OPCODE_STAT_QUERY,
5336 	EVENT_RING_OPCODE_STOP_TRAFFIC,
5337 	EVENT_RING_OPCODE_START_TRAFFIC,
5338 	EVENT_RING_OPCODE_VF_FLR,
5339 	EVENT_RING_OPCODE_MALICIOUS_VF,
5340 	EVENT_RING_OPCODE_FORWARD_SETUP,
5341 	EVENT_RING_OPCODE_RSS_UPDATE_RULES,
5342 	EVENT_RING_OPCODE_FUNCTION_UPDATE,
5343 	EVENT_RING_OPCODE_AFEX_VIF_LISTS,
5344 	EVENT_RING_OPCODE_SET_MAC,
5345 	EVENT_RING_OPCODE_CLASSIFICATION_RULES,
5346 	EVENT_RING_OPCODE_FILTERS_RULES,
5347 	EVENT_RING_OPCODE_MULTICAST_RULES,
5348 	EVENT_RING_OPCODE_SET_TIMESYNC,
5349 	MAX_EVENT_RING_OPCODE
5350 };
5351 
5352 /*
5353  * Modes for fairness algorithm
5354  */
5355 enum fairness_mode {
5356 	FAIRNESS_COS_WRR_MODE,
5357 	FAIRNESS_COS_ETS_MODE,
5358 	MAX_FAIRNESS_MODE
5359 };
5360 
5361 
5362 /*
5363  * Priority and cos
5364  */
5365 struct priority_cos {
5366 	u8 priority;
5367 	u8 cos;
5368 	__le16 reserved1;
5369 };
5370 
5371 /*
5372  * The data for flow control configuration
5373  */
5374 struct flow_control_configuration {
5375 	struct priority_cos traffic_type_to_priority_cos[MAX_TRAFFIC_TYPES];
5376 	u8 dcb_enabled;
5377 	u8 dcb_version;
5378 	u8 dont_add_pri_0_en;
5379 	u8 reserved1;
5380 	__le32 reserved2;
5381 	u8 dcb_outer_pri[MAX_TRAFFIC_TYPES];
5382 };
5383 
5384 
5385 /*
5386  *
5387  */
5388 struct function_start_data {
5389 	u8 function_mode;
5390 	u8 allow_npar_tx_switching;
5391 	__le16 sd_vlan_tag;
5392 	__le16 vif_id;
5393 	u8 path_id;
5394 	u8 network_cos_mode;
5395 	u8 dmae_cmd_id;
5396 	u8 no_added_tags;
5397 	__le16 reserved0;
5398 	__le32 reserved1;
5399 	u8 inner_clss_vxlan;
5400 	u8 inner_clss_l2gre;
5401 	u8 inner_clss_l2geneve;
5402 	u8 inner_rss;
5403 	__le16 vxlan_dst_port;
5404 	__le16 geneve_dst_port;
5405 	u8 sd_accept_mf_clss_fail;
5406 	u8 sd_accept_mf_clss_fail_match_ethtype;
5407 	__le16 sd_accept_mf_clss_fail_ethtype;
5408 	__le16 sd_vlan_eth_type;
5409 	u8 sd_vlan_force_pri_flg;
5410 	u8 sd_vlan_force_pri_val;
5411 	u8 c2s_pri_tt_valid;
5412 	u8 c2s_pri_default;
5413 	u8 reserved2[6];
5414 	struct c2s_pri_trans_table_entry c2s_pri_trans_table;
5415 };
5416 
5417 struct function_update_data {
5418 	u8 vif_id_change_flg;
5419 	u8 afex_default_vlan_change_flg;
5420 	u8 allowed_priorities_change_flg;
5421 	u8 network_cos_mode_change_flg;
5422 	__le16 vif_id;
5423 	__le16 afex_default_vlan;
5424 	u8 allowed_priorities;
5425 	u8 network_cos_mode;
5426 	u8 lb_mode_en_change_flg;
5427 	u8 lb_mode_en;
5428 	u8 tx_switch_suspend_change_flg;
5429 	u8 tx_switch_suspend;
5430 	u8 echo;
5431 	u8 update_tunn_cfg_flg;
5432 	u8 inner_clss_vxlan;
5433 	u8 inner_clss_l2gre;
5434 	u8 inner_clss_l2geneve;
5435 	u8 inner_rss;
5436 	__le16 vxlan_dst_port;
5437 	__le16 geneve_dst_port;
5438 	u8 sd_vlan_force_pri_change_flg;
5439 	u8 sd_vlan_force_pri_flg;
5440 	u8 sd_vlan_force_pri_val;
5441 	u8 sd_vlan_tag_change_flg;
5442 	u8 sd_vlan_eth_type_change_flg;
5443 	u8 reserved1;
5444 	__le16 sd_vlan_tag;
5445 	__le16 sd_vlan_eth_type;
5446 	__le16 reserved0;
5447 	__le32 reserved2;
5448 };
5449 
5450 /*
5451  * FW version stored in the Xstorm RAM
5452  */
5453 struct fw_version {
5454 #if defined(__BIG_ENDIAN)
5455 	u8 engineering;
5456 	u8 revision;
5457 	u8 minor;
5458 	u8 major;
5459 #elif defined(__LITTLE_ENDIAN)
5460 	u8 major;
5461 	u8 minor;
5462 	u8 revision;
5463 	u8 engineering;
5464 #endif
5465 	u32 flags;
5466 #define FW_VERSION_OPTIMIZED (0x1<<0)
5467 #define FW_VERSION_OPTIMIZED_SHIFT 0
5468 #define FW_VERSION_BIG_ENDIEN (0x1<<1)
5469 #define FW_VERSION_BIG_ENDIEN_SHIFT 1
5470 #define FW_VERSION_CHIP_VERSION (0x3<<2)
5471 #define FW_VERSION_CHIP_VERSION_SHIFT 2
5472 #define __FW_VERSION_RESERVED (0xFFFFFFF<<4)
5473 #define __FW_VERSION_RESERVED_SHIFT 4
5474 };
5475 
5476 /*
5477  * Dynamic Host-Coalescing - Driver(host) counters
5478  */
5479 struct hc_dynamic_sb_drv_counters {
5480 	u32 dynamic_hc_drv_counter[HC_SB_MAX_DYNAMIC_INDICES];
5481 };
5482 
5483 
5484 /*
5485  * 2 bytes. configuration/state parameters for a single protocol index
5486  */
5487 struct hc_index_data {
5488 #if defined(__BIG_ENDIAN)
5489 	u8 flags;
5490 #define HC_INDEX_DATA_SM_ID (0x1<<0)
5491 #define HC_INDEX_DATA_SM_ID_SHIFT 0
5492 #define HC_INDEX_DATA_HC_ENABLED (0x1<<1)
5493 #define HC_INDEX_DATA_HC_ENABLED_SHIFT 1
5494 #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED (0x1<<2)
5495 #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED_SHIFT 2
5496 #define HC_INDEX_DATA_RESERVE (0x1F<<3)
5497 #define HC_INDEX_DATA_RESERVE_SHIFT 3
5498 	u8 timeout;
5499 #elif defined(__LITTLE_ENDIAN)
5500 	u8 timeout;
5501 	u8 flags;
5502 #define HC_INDEX_DATA_SM_ID (0x1<<0)
5503 #define HC_INDEX_DATA_SM_ID_SHIFT 0
5504 #define HC_INDEX_DATA_HC_ENABLED (0x1<<1)
5505 #define HC_INDEX_DATA_HC_ENABLED_SHIFT 1
5506 #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED (0x1<<2)
5507 #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED_SHIFT 2
5508 #define HC_INDEX_DATA_RESERVE (0x1F<<3)
5509 #define HC_INDEX_DATA_RESERVE_SHIFT 3
5510 #endif
5511 };
5512 
5513 
5514 /*
5515  * HC state-machine
5516  */
5517 struct hc_status_block_sm {
5518 #if defined(__BIG_ENDIAN)
5519 	u8 igu_seg_id;
5520 	u8 igu_sb_id;
5521 	u8 timer_value;
5522 	u8 __flags;
5523 #elif defined(__LITTLE_ENDIAN)
5524 	u8 __flags;
5525 	u8 timer_value;
5526 	u8 igu_sb_id;
5527 	u8 igu_seg_id;
5528 #endif
5529 	u32 time_to_expire;
5530 };
5531 
5532 /*
5533  * hold PCI identification variables- used in various places in firmware
5534  */
5535 struct pci_entity {
5536 #if defined(__BIG_ENDIAN)
5537 	u8 vf_valid;
5538 	u8 vf_id;
5539 	u8 vnic_id;
5540 	u8 pf_id;
5541 #elif defined(__LITTLE_ENDIAN)
5542 	u8 pf_id;
5543 	u8 vnic_id;
5544 	u8 vf_id;
5545 	u8 vf_valid;
5546 #endif
5547 };
5548 
5549 /*
5550  * The fast-path status block meta-data, common to all chips
5551  */
5552 struct hc_sb_data {
5553 	struct regpair_native host_sb_addr;
5554 	struct hc_status_block_sm state_machine[HC_SB_MAX_SM];
5555 	struct pci_entity p_func;
5556 #if defined(__BIG_ENDIAN)
5557 	u8 rsrv0;
5558 	u8 state;
5559 	u8 dhc_qzone_id;
5560 	u8 same_igu_sb_1b;
5561 #elif defined(__LITTLE_ENDIAN)
5562 	u8 same_igu_sb_1b;
5563 	u8 dhc_qzone_id;
5564 	u8 state;
5565 	u8 rsrv0;
5566 #endif
5567 	struct regpair_native rsrv1[2];
5568 };
5569 
5570 
5571 /*
5572  * Segment types for host coaslescing
5573  */
5574 enum hc_segment {
5575 	HC_REGULAR_SEGMENT,
5576 	HC_DEFAULT_SEGMENT,
5577 	MAX_HC_SEGMENT
5578 };
5579 
5580 
5581 /*
5582  * The fast-path status block meta-data
5583  */
5584 struct hc_sp_status_block_data {
5585 	struct regpair_native host_sb_addr;
5586 #if defined(__BIG_ENDIAN)
5587 	u8 rsrv1;
5588 	u8 state;
5589 	u8 igu_seg_id;
5590 	u8 igu_sb_id;
5591 #elif defined(__LITTLE_ENDIAN)
5592 	u8 igu_sb_id;
5593 	u8 igu_seg_id;
5594 	u8 state;
5595 	u8 rsrv1;
5596 #endif
5597 	struct pci_entity p_func;
5598 };
5599 
5600 
5601 /*
5602  * The fast-path status block meta-data
5603  */
5604 struct hc_status_block_data_e1x {
5605 	struct hc_index_data index_data[HC_SB_MAX_INDICES_E1X];
5606 	struct hc_sb_data common;
5607 };
5608 
5609 
5610 /*
5611  * The fast-path status block meta-data
5612  */
5613 struct hc_status_block_data_e2 {
5614 	struct hc_index_data index_data[HC_SB_MAX_INDICES_E2];
5615 	struct hc_sb_data common;
5616 };
5617 
5618 
5619 /*
5620  * IGU block operartion modes (in Everest2)
5621  */
5622 enum igu_mode {
5623 	HC_IGU_BC_MODE,
5624 	HC_IGU_NBC_MODE,
5625 	MAX_IGU_MODE
5626 };
5627 
5628 /*
5629  * Inner Headers Classification Type
5630  */
5631 enum inner_clss_type {
5632 	INNER_CLSS_DISABLED,
5633 	INNER_CLSS_USE_VLAN,
5634 	INNER_CLSS_USE_VNI,
5635 	MAX_INNER_CLSS_TYPE};
5636 
5637 /*
5638  * IP versions
5639  */
5640 enum ip_ver {
5641 	IP_V4,
5642 	IP_V6,
5643 	MAX_IP_VER
5644 };
5645 
5646 /*
5647  * Malicious VF error ID
5648  */
5649 enum malicious_vf_error_id {
5650 	MALICIOUS_VF_NO_ERROR,
5651 	VF_PF_CHANNEL_NOT_READY,
5652 	ETH_ILLEGAL_BD_LENGTHS,
5653 	ETH_PACKET_TOO_SHORT,
5654 	ETH_PAYLOAD_TOO_BIG,
5655 	ETH_ILLEGAL_ETH_TYPE,
5656 	ETH_ILLEGAL_LSO_HDR_LEN,
5657 	ETH_TOO_MANY_BDS,
5658 	ETH_ZERO_HDR_NBDS,
5659 	ETH_START_BD_NOT_SET,
5660 	ETH_ILLEGAL_PARSE_NBDS,
5661 	ETH_IPV6_AND_CHECKSUM,
5662 	ETH_VLAN_FLG_INCORRECT,
5663 	ETH_ILLEGAL_LSO_MSS,
5664 	ETH_TUNNEL_NOT_SUPPORTED,
5665 	MAX_MALICIOUS_VF_ERROR_ID
5666 };
5667 
5668 /*
5669  * Multi-function modes
5670  */
5671 enum mf_mode {
5672 	SINGLE_FUNCTION,
5673 	MULTI_FUNCTION_SD,
5674 	MULTI_FUNCTION_SI,
5675 	MULTI_FUNCTION_AFEX,
5676 	MAX_MF_MODE
5677 };
5678 
5679 /*
5680  * Protocol-common statistics collected by the Tstorm (per pf)
5681  */
5682 struct tstorm_per_pf_stats {
5683 	struct regpair rcv_error_bytes;
5684 };
5685 
5686 /*
5687  *
5688  */
5689 struct per_pf_stats {
5690 	struct tstorm_per_pf_stats tstorm_pf_statistics;
5691 };
5692 
5693 
5694 /*
5695  * Protocol-common statistics collected by the Tstorm (per port)
5696  */
5697 struct tstorm_per_port_stats {
5698 	__le32 mac_discard;
5699 	__le32 mac_filter_discard;
5700 	__le32 brb_truncate_discard;
5701 	__le32 mf_tag_discard;
5702 	__le32 packet_drop;
5703 	__le32 reserved;
5704 };
5705 
5706 /*
5707  *
5708  */
5709 struct per_port_stats {
5710 	struct tstorm_per_port_stats tstorm_port_statistics;
5711 };
5712 
5713 
5714 /*
5715  * Protocol-common statistics collected by the Tstorm (per client)
5716  */
5717 struct tstorm_per_queue_stats {
5718 	struct regpair rcv_ucast_bytes;
5719 	__le32 rcv_ucast_pkts;
5720 	__le32 checksum_discard;
5721 	struct regpair rcv_bcast_bytes;
5722 	__le32 rcv_bcast_pkts;
5723 	__le32 pkts_too_big_discard;
5724 	struct regpair rcv_mcast_bytes;
5725 	__le32 rcv_mcast_pkts;
5726 	__le32 ttl0_discard;
5727 	__le16 no_buff_discard;
5728 	__le16 reserved0;
5729 	__le32 reserved1;
5730 };
5731 
5732 /*
5733  * Protocol-common statistics collected by the Ustorm (per client)
5734  */
5735 struct ustorm_per_queue_stats {
5736 	struct regpair ucast_no_buff_bytes;
5737 	struct regpair mcast_no_buff_bytes;
5738 	struct regpair bcast_no_buff_bytes;
5739 	__le32 ucast_no_buff_pkts;
5740 	__le32 mcast_no_buff_pkts;
5741 	__le32 bcast_no_buff_pkts;
5742 	__le32 coalesced_pkts;
5743 	struct regpair coalesced_bytes;
5744 	__le32 coalesced_events;
5745 	__le32 coalesced_aborts;
5746 };
5747 
5748 /*
5749  * Protocol-common statistics collected by the Xstorm (per client)
5750  */
5751 struct xstorm_per_queue_stats {
5752 	struct regpair ucast_bytes_sent;
5753 	struct regpair mcast_bytes_sent;
5754 	struct regpair bcast_bytes_sent;
5755 	__le32 ucast_pkts_sent;
5756 	__le32 mcast_pkts_sent;
5757 	__le32 bcast_pkts_sent;
5758 	__le32 error_drop_pkts;
5759 };
5760 
5761 /*
5762  *
5763  */
5764 struct per_queue_stats {
5765 	struct tstorm_per_queue_stats tstorm_queue_statistics;
5766 	struct ustorm_per_queue_stats ustorm_queue_statistics;
5767 	struct xstorm_per_queue_stats xstorm_queue_statistics;
5768 };
5769 
5770 
5771 /*
5772  * FW version stored in first line of pram
5773  */
5774 struct pram_fw_version {
5775 	u8 major;
5776 	u8 minor;
5777 	u8 revision;
5778 	u8 engineering;
5779 	u8 flags;
5780 #define PRAM_FW_VERSION_OPTIMIZED (0x1<<0)
5781 #define PRAM_FW_VERSION_OPTIMIZED_SHIFT 0
5782 #define PRAM_FW_VERSION_STORM_ID (0x3<<1)
5783 #define PRAM_FW_VERSION_STORM_ID_SHIFT 1
5784 #define PRAM_FW_VERSION_BIG_ENDIEN (0x1<<3)
5785 #define PRAM_FW_VERSION_BIG_ENDIEN_SHIFT 3
5786 #define PRAM_FW_VERSION_CHIP_VERSION (0x3<<4)
5787 #define PRAM_FW_VERSION_CHIP_VERSION_SHIFT 4
5788 #define __PRAM_FW_VERSION_RESERVED0 (0x3<<6)
5789 #define __PRAM_FW_VERSION_RESERVED0_SHIFT 6
5790 };
5791 
5792 
5793 /*
5794  * Ethernet slow path element
5795  */
5796 union protocol_common_specific_data {
5797 	u8 protocol_data[8];
5798 	struct regpair phy_address;
5799 	struct regpair mac_config_addr;
5800 	struct afex_vif_list_ramrod_data afex_vif_list_data;
5801 };
5802 
5803 /*
5804  * The send queue element
5805  */
5806 struct protocol_common_spe {
5807 	struct spe_hdr hdr;
5808 	union protocol_common_specific_data data;
5809 };
5810 
5811 /* The data for the Set Timesync Ramrod */
5812 struct set_timesync_ramrod_data {
5813 	u8 drift_adjust_cmd;
5814 	u8 offset_cmd;
5815 	u8 add_sub_drift_adjust_value;
5816 	u8 drift_adjust_value;
5817 	u32 drift_adjust_period;
5818 	struct regpair offset_delta;
5819 };
5820 
5821 /*
5822  * The send queue element
5823  */
5824 struct slow_path_element {
5825 	struct spe_hdr hdr;
5826 	struct regpair protocol_data;
5827 };
5828 
5829 
5830 /*
5831  * Protocol-common statistics counter
5832  */
5833 struct stats_counter {
5834 	__le16 xstats_counter;
5835 	__le16 reserved0;
5836 	__le32 reserved1;
5837 	__le16 tstats_counter;
5838 	__le16 reserved2;
5839 	__le32 reserved3;
5840 	__le16 ustats_counter;
5841 	__le16 reserved4;
5842 	__le32 reserved5;
5843 	__le16 cstats_counter;
5844 	__le16 reserved6;
5845 	__le32 reserved7;
5846 };
5847 
5848 
5849 /*
5850  *
5851  */
5852 struct stats_query_entry {
5853 	u8 kind;
5854 	u8 index;
5855 	__le16 funcID;
5856 	__le32 reserved;
5857 	struct regpair address;
5858 };
5859 
5860 /*
5861  * statistic command
5862  */
5863 struct stats_query_cmd_group {
5864 	struct stats_query_entry query[STATS_QUERY_CMD_COUNT];
5865 };
5866 
5867 
5868 /*
5869  * statistic command header
5870  */
5871 struct stats_query_header {
5872 	u8 cmd_num;
5873 	u8 reserved0;
5874 	__le16 drv_stats_counter;
5875 	__le32 reserved1;
5876 	struct regpair stats_counters_addrs;
5877 };
5878 
5879 
5880 /*
5881  * Types of statistcis query entry
5882  */
5883 enum stats_query_type {
5884 	STATS_TYPE_QUEUE,
5885 	STATS_TYPE_PORT,
5886 	STATS_TYPE_PF,
5887 	STATS_TYPE_TOE,
5888 	STATS_TYPE_FCOE,
5889 	MAX_STATS_QUERY_TYPE
5890 };
5891 
5892 
5893 /*
5894  * Indicate of the function status block state
5895  */
5896 enum status_block_state {
5897 	SB_DISABLED,
5898 	SB_ENABLED,
5899 	SB_CLEANED,
5900 	MAX_STATUS_BLOCK_STATE
5901 };
5902 
5903 
5904 /*
5905  * Storm IDs (including attentions for IGU related enums)
5906  */
5907 enum storm_id {
5908 	USTORM_ID,
5909 	CSTORM_ID,
5910 	XSTORM_ID,
5911 	TSTORM_ID,
5912 	ATTENTION_ID,
5913 	MAX_STORM_ID
5914 };
5915 
5916 
5917 /*
5918  * Taffic types used in ETS and flow control algorithms
5919  */
5920 enum traffic_type {
5921 	LLFC_TRAFFIC_TYPE_NW,
5922 	LLFC_TRAFFIC_TYPE_FCOE,
5923 	LLFC_TRAFFIC_TYPE_ISCSI,
5924 	MAX_TRAFFIC_TYPE
5925 };
5926 
5927 
5928 /*
5929  * zone A per-queue data
5930  */
5931 struct tstorm_queue_zone_data {
5932 	struct regpair reserved[4];
5933 };
5934 
5935 
5936 /*
5937  * zone B per-VF data
5938  */
5939 struct tstorm_vf_zone_data {
5940 	struct regpair reserved;
5941 };
5942 
5943 /* Add or Subtract Value for Set Timesync Ramrod */
5944 enum ts_add_sub_value {
5945 	TS_SUB_VALUE,
5946 	TS_ADD_VALUE,
5947 	MAX_TS_ADD_SUB_VALUE
5948 };
5949 
5950 /* Drift-Adjust Commands for Set Timesync Ramrod */
5951 enum ts_drift_adjust_cmd {
5952 	TS_DRIFT_ADJUST_KEEP,
5953 	TS_DRIFT_ADJUST_SET,
5954 	TS_DRIFT_ADJUST_RESET,
5955 	MAX_TS_DRIFT_ADJUST_CMD
5956 };
5957 
5958 /* Offset Commands for Set Timesync Ramrod */
5959 enum ts_offset_cmd {
5960 	TS_OFFSET_KEEP,
5961 	TS_OFFSET_INC,
5962 	TS_OFFSET_DEC,
5963 	MAX_TS_OFFSET_CMD
5964 };
5965 
5966  /* zone A per-queue data */
5967 struct ustorm_queue_zone_data {
5968 	struct ustorm_eth_rx_producers eth_rx_producers;
5969 	struct regpair reserved[3];
5970 };
5971 
5972 
5973 /*
5974  * zone B per-VF data
5975  */
5976 struct ustorm_vf_zone_data {
5977 	struct regpair reserved;
5978 };
5979 
5980 
5981 /*
5982  * data per VF-PF channel
5983  */
5984 struct vf_pf_channel_data {
5985 #if defined(__BIG_ENDIAN)
5986 	u16 reserved0;
5987 	u8 valid;
5988 	u8 state;
5989 #elif defined(__LITTLE_ENDIAN)
5990 	u8 state;
5991 	u8 valid;
5992 	u16 reserved0;
5993 #endif
5994 	u32 reserved1;
5995 };
5996 
5997 
5998 /*
5999  * State of VF-PF channel
6000  */
6001 enum vf_pf_channel_state {
6002 	VF_PF_CHANNEL_STATE_READY,
6003 	VF_PF_CHANNEL_STATE_WAITING_FOR_ACK,
6004 	MAX_VF_PF_CHANNEL_STATE
6005 };
6006 
6007 
6008 /*
6009  * vif_list_rule_kind
6010  */
6011 enum vif_list_rule_kind {
6012 	VIF_LIST_RULE_SET,
6013 	VIF_LIST_RULE_GET,
6014 	VIF_LIST_RULE_CLEAR_ALL,
6015 	VIF_LIST_RULE_CLEAR_FUNC,
6016 	MAX_VIF_LIST_RULE_KIND
6017 };
6018 
6019 
6020 /*
6021  * zone A per-queue data
6022  */
6023 struct xstorm_queue_zone_data {
6024 	struct regpair reserved[4];
6025 };
6026 
6027 
6028 /*
6029  * zone B per-VF data
6030  */
6031 struct xstorm_vf_zone_data {
6032 	struct regpair reserved;
6033 };
6034 
6035 #endif /* BNX2X_HSI_H */
6036