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