blob: 037860ecc3434cffca9ee555846ae21dbe8600ab [file] [log] [blame]
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001/* bnx2x_hsi.h: Broadcom Everest network driver.
2 *
Yuval Mintz247fa822013-01-14 05:11:50 +00003 * Copyright (c) 2007-2013 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 */
Dmitry Kravkov523224a2010-10-06 03:23:26 +00009#ifndef BNX2X_HSI_H
10#define BNX2X_HSI_H
11
12#include "bnx2x_fw_defs.h"
Barak Witkowski2e499d32012-06-26 01:31:19 +000013#include "bnx2x_mfw_req.h"
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +020014
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +030015#define FW_ENCODE_32BIT_PATTERN 0x1e1e1e1e
Vladislav Zolotarov2ba45142011-01-31 14:39:17 +000016
Michael Chane2513062009-10-10 13:46:58 +000017struct license_key {
18 u32 reserved[6];
19
Vladislav Zolotarov2ba45142011-01-31 14:39:17 +000020 u32 max_iscsi_conn;
21#define BNX2X_MAX_ISCSI_TRGT_CONN_MASK 0xFFFF
22#define BNX2X_MAX_ISCSI_TRGT_CONN_SHIFT 0
23#define BNX2X_MAX_ISCSI_INIT_CONN_MASK 0xFFFF0000
24#define BNX2X_MAX_ISCSI_INIT_CONN_SHIFT 16
Michael Chane2513062009-10-10 13:46:58 +000025
Vladislav Zolotarov2ba45142011-01-31 14:39:17 +000026 u32 reserved_a;
27
28 u32 max_fcoe_conn;
29#define BNX2X_MAX_FCOE_TRGT_CONN_MASK 0xFFFF
30#define BNX2X_MAX_FCOE_TRGT_CONN_SHIFT 0
31#define BNX2X_MAX_FCOE_INIT_CONN_MASK 0xFFFF0000
32#define BNX2X_MAX_FCOE_INIT_CONN_SHIFT 16
33
34 u32 reserved_b[4];
Michael Chane2513062009-10-10 13:46:58 +000035};
36
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +020037/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +030038 * Shared HW configuration *
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +020039 ****************************************************************************/
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +030040#define PIN_CFG_NA 0x00000000
41#define PIN_CFG_GPIO0_P0 0x00000001
42#define PIN_CFG_GPIO1_P0 0x00000002
43#define PIN_CFG_GPIO2_P0 0x00000003
44#define PIN_CFG_GPIO3_P0 0x00000004
45#define PIN_CFG_GPIO0_P1 0x00000005
46#define PIN_CFG_GPIO1_P1 0x00000006
47#define PIN_CFG_GPIO2_P1 0x00000007
48#define PIN_CFG_GPIO3_P1 0x00000008
49#define PIN_CFG_EPIO0 0x00000009
50#define PIN_CFG_EPIO1 0x0000000a
51#define PIN_CFG_EPIO2 0x0000000b
52#define PIN_CFG_EPIO3 0x0000000c
53#define PIN_CFG_EPIO4 0x0000000d
54#define PIN_CFG_EPIO5 0x0000000e
55#define PIN_CFG_EPIO6 0x0000000f
56#define PIN_CFG_EPIO7 0x00000010
57#define PIN_CFG_EPIO8 0x00000011
58#define PIN_CFG_EPIO9 0x00000012
59#define PIN_CFG_EPIO10 0x00000013
60#define PIN_CFG_EPIO11 0x00000014
61#define PIN_CFG_EPIO12 0x00000015
62#define PIN_CFG_EPIO13 0x00000016
63#define PIN_CFG_EPIO14 0x00000017
64#define PIN_CFG_EPIO15 0x00000018
65#define PIN_CFG_EPIO16 0x00000019
66#define PIN_CFG_EPIO17 0x0000001a
67#define PIN_CFG_EPIO18 0x0000001b
68#define PIN_CFG_EPIO19 0x0000001c
69#define PIN_CFG_EPIO20 0x0000001d
70#define PIN_CFG_EPIO21 0x0000001e
71#define PIN_CFG_EPIO22 0x0000001f
72#define PIN_CFG_EPIO23 0x00000020
73#define PIN_CFG_EPIO24 0x00000021
74#define PIN_CFG_EPIO25 0x00000022
75#define PIN_CFG_EPIO26 0x00000023
76#define PIN_CFG_EPIO27 0x00000024
77#define PIN_CFG_EPIO28 0x00000025
78#define PIN_CFG_EPIO29 0x00000026
79#define PIN_CFG_EPIO30 0x00000027
80#define PIN_CFG_EPIO31 0x00000028
81
82/* EPIO definition */
83#define EPIO_CFG_NA 0x00000000
84#define EPIO_CFG_EPIO0 0x00000001
85#define EPIO_CFG_EPIO1 0x00000002
86#define EPIO_CFG_EPIO2 0x00000003
87#define EPIO_CFG_EPIO3 0x00000004
88#define EPIO_CFG_EPIO4 0x00000005
89#define EPIO_CFG_EPIO5 0x00000006
90#define EPIO_CFG_EPIO6 0x00000007
91#define EPIO_CFG_EPIO7 0x00000008
92#define EPIO_CFG_EPIO8 0x00000009
93#define EPIO_CFG_EPIO9 0x0000000a
94#define EPIO_CFG_EPIO10 0x0000000b
95#define EPIO_CFG_EPIO11 0x0000000c
96#define EPIO_CFG_EPIO12 0x0000000d
97#define EPIO_CFG_EPIO13 0x0000000e
98#define EPIO_CFG_EPIO14 0x0000000f
99#define EPIO_CFG_EPIO15 0x00000010
100#define EPIO_CFG_EPIO16 0x00000011
101#define EPIO_CFG_EPIO17 0x00000012
102#define EPIO_CFG_EPIO18 0x00000013
103#define EPIO_CFG_EPIO19 0x00000014
104#define EPIO_CFG_EPIO20 0x00000015
105#define EPIO_CFG_EPIO21 0x00000016
106#define EPIO_CFG_EPIO22 0x00000017
107#define EPIO_CFG_EPIO23 0x00000018
108#define EPIO_CFG_EPIO24 0x00000019
109#define EPIO_CFG_EPIO25 0x0000001a
110#define EPIO_CFG_EPIO26 0x0000001b
111#define EPIO_CFG_EPIO27 0x0000001c
112#define EPIO_CFG_EPIO28 0x0000001d
113#define EPIO_CFG_EPIO29 0x0000001e
114#define EPIO_CFG_EPIO30 0x0000001f
115#define EPIO_CFG_EPIO31 0x00000020
116
117
118struct shared_hw_cfg { /* NVRAM Offset */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200119 /* Up to 16 bytes of NULL-terminated string */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300120 u8 part_num[16]; /* 0x104 */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200121
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300122 u32 config; /* 0x114 */
123 #define SHARED_HW_CFG_MDIO_VOLTAGE_MASK 0x00000001
124 #define SHARED_HW_CFG_MDIO_VOLTAGE_SHIFT 0
125 #define SHARED_HW_CFG_MDIO_VOLTAGE_1_2V 0x00000000
126 #define SHARED_HW_CFG_MDIO_VOLTAGE_2_5V 0x00000001
127 #define SHARED_HW_CFG_MCP_RST_ON_CORE_RST_EN 0x00000002
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200128
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300129 #define SHARED_HW_CFG_PORT_SWAP 0x00000004
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200130
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300131 #define SHARED_HW_CFG_BEACON_WOL_EN 0x00000008
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200132
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300133 #define SHARED_HW_CFG_PCIE_GEN3_DISABLED 0x00000000
134 #define SHARED_HW_CFG_PCIE_GEN3_ENABLED 0x00000010
135
136 #define SHARED_HW_CFG_MFW_SELECT_MASK 0x00000700
137 #define SHARED_HW_CFG_MFW_SELECT_SHIFT 8
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200138 /* Whatever MFW found in NVM
139 (if multiple found, priority order is: NC-SI, UMP, IPMI) */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300140 #define SHARED_HW_CFG_MFW_SELECT_DEFAULT 0x00000000
141 #define SHARED_HW_CFG_MFW_SELECT_NC_SI 0x00000100
142 #define SHARED_HW_CFG_MFW_SELECT_UMP 0x00000200
143 #define SHARED_HW_CFG_MFW_SELECT_IPMI 0x00000300
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200144 /* Use SPIO4 as an arbiter between: 0-NC_SI, 1-IPMI
145 (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300146 #define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_IPMI 0x00000400
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200147 /* Use SPIO4 as an arbiter between: 0-UMP, 1-IPMI
148 (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300149 #define SHARED_HW_CFG_MFW_SELECT_SPIO4_UMP_IPMI 0x00000500
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200150 /* Use SPIO4 as an arbiter between: 0-NC-SI, 1-UMP
151 (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300152 #define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_UMP 0x00000600
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200153
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300154 #define SHARED_HW_CFG_LED_MODE_MASK 0x000f0000
155 #define SHARED_HW_CFG_LED_MODE_SHIFT 16
156 #define SHARED_HW_CFG_LED_MAC1 0x00000000
157 #define SHARED_HW_CFG_LED_PHY1 0x00010000
158 #define SHARED_HW_CFG_LED_PHY2 0x00020000
159 #define SHARED_HW_CFG_LED_PHY3 0x00030000
160 #define SHARED_HW_CFG_LED_MAC2 0x00040000
161 #define SHARED_HW_CFG_LED_PHY4 0x00050000
162 #define SHARED_HW_CFG_LED_PHY5 0x00060000
163 #define SHARED_HW_CFG_LED_PHY6 0x00070000
164 #define SHARED_HW_CFG_LED_MAC3 0x00080000
165 #define SHARED_HW_CFG_LED_PHY7 0x00090000
166 #define SHARED_HW_CFG_LED_PHY9 0x000a0000
167 #define SHARED_HW_CFG_LED_PHY11 0x000b0000
168 #define SHARED_HW_CFG_LED_MAC4 0x000c0000
169 #define SHARED_HW_CFG_LED_PHY8 0x000d0000
170 #define SHARED_HW_CFG_LED_EXTPHY1 0x000e0000
Yaniv Rosner7f02c4a2010-09-07 11:41:23 +0000171
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200172
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300173 #define SHARED_HW_CFG_AN_ENABLE_MASK 0x3f000000
174 #define SHARED_HW_CFG_AN_ENABLE_SHIFT 24
175 #define SHARED_HW_CFG_AN_ENABLE_CL37 0x01000000
176 #define SHARED_HW_CFG_AN_ENABLE_CL73 0x02000000
177 #define SHARED_HW_CFG_AN_ENABLE_BAM 0x04000000
178 #define SHARED_HW_CFG_AN_ENABLE_PARALLEL_DETECTION 0x08000000
179 #define SHARED_HW_CFG_AN_EN_SGMII_FIBER_AUTO_DETECT 0x10000000
180 #define SHARED_HW_CFG_AN_ENABLE_REMOTE_PHY 0x20000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200181
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300182 #define SHARED_HW_CFG_SRIOV_MASK 0x40000000
183 #define SHARED_HW_CFG_SRIOV_DISABLED 0x00000000
184 #define SHARED_HW_CFG_SRIOV_ENABLED 0x40000000
185
186 #define SHARED_HW_CFG_ATC_MASK 0x80000000
187 #define SHARED_HW_CFG_ATC_DISABLED 0x00000000
188 #define SHARED_HW_CFG_ATC_ENABLED 0x80000000
189
190 u32 config2; /* 0x118 */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200191 /* one time auto detect grace period (in sec) */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300192 #define SHARED_HW_CFG_GRACE_PERIOD_MASK 0x000000ff
193 #define SHARED_HW_CFG_GRACE_PERIOD_SHIFT 0
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200194
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300195 #define SHARED_HW_CFG_PCIE_GEN2_ENABLED 0x00000100
196 #define SHARED_HW_CFG_PCIE_GEN2_DISABLED 0x00000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200197
198 /* The default value for the core clock is 250MHz and it is
199 achieved by setting the clock change to 4 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300200 #define SHARED_HW_CFG_CLOCK_CHANGE_MASK 0x00000e00
201 #define SHARED_HW_CFG_CLOCK_CHANGE_SHIFT 9
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200202
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300203 #define SHARED_HW_CFG_SMBUS_TIMING_MASK 0x00001000
204 #define SHARED_HW_CFG_SMBUS_TIMING_100KHZ 0x00000000
205 #define SHARED_HW_CFG_SMBUS_TIMING_400KHZ 0x00001000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200206
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300207 #define SHARED_HW_CFG_HIDE_PORT1 0x00002000
208
209 #define SHARED_HW_CFG_WOL_CAPABLE_MASK 0x00004000
210 #define SHARED_HW_CFG_WOL_CAPABLE_DISABLED 0x00000000
211 #define SHARED_HW_CFG_WOL_CAPABLE_ENABLED 0x00004000
212
213 /* Output low when PERST is asserted */
214 #define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_MASK 0x00008000
215 #define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_DISABLED 0x00000000
216 #define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_ENABLED 0x00008000
217
218 #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_MASK 0x00070000
219 #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_SHIFT 16
220 #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_HW 0x00000000
221 #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_0DB 0x00010000
222 #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_3_5DB 0x00020000
223 #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_6_0DB 0x00030000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200224
Eilon Greensteinfd4ef402009-07-21 05:47:27 +0000225 /* The fan failure mechanism is usually related to the PHY type
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300226 since the power consumption of the board is determined by the PHY.
227 Currently, fan is required for most designs with SFX7101, BCM8727
228 and BCM8481. If a fan is not required for a board which uses one
229 of those PHYs, this field should be set to "Disabled". If a fan is
230 required for a different PHY type, this option should be set to
231 "Enabled". The fan failure indication is expected on SPIO5 */
232 #define SHARED_HW_CFG_FAN_FAILURE_MASK 0x00180000
233 #define SHARED_HW_CFG_FAN_FAILURE_SHIFT 19
234 #define SHARED_HW_CFG_FAN_FAILURE_PHY_TYPE 0x00000000
235 #define SHARED_HW_CFG_FAN_FAILURE_DISABLED 0x00080000
236 #define SHARED_HW_CFG_FAN_FAILURE_ENABLED 0x00100000
Eilon Greensteinfd4ef402009-07-21 05:47:27 +0000237
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300238 /* ASPM Power Management support */
239 #define SHARED_HW_CFG_ASPM_SUPPORT_MASK 0x00600000
240 #define SHARED_HW_CFG_ASPM_SUPPORT_SHIFT 21
241 #define SHARED_HW_CFG_ASPM_SUPPORT_L0S_L1_ENABLED 0x00000000
242 #define SHARED_HW_CFG_ASPM_SUPPORT_L0S_DISABLED 0x00200000
243 #define SHARED_HW_CFG_ASPM_SUPPORT_L1_DISABLED 0x00400000
244 #define SHARED_HW_CFG_ASPM_SUPPORT_L0S_L1_DISABLED 0x00600000
Yaniv Rosnere10bc842010-09-07 11:40:50 +0000245
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300246 /* The value of PM_TL_IGNORE_REQS (bit0) in PCI register
247 tl_control_0 (register 0x2800) */
248 #define SHARED_HW_CFG_PREVENT_L1_ENTRY_MASK 0x00800000
249 #define SHARED_HW_CFG_PREVENT_L1_ENTRY_DISABLED 0x00000000
250 #define SHARED_HW_CFG_PREVENT_L1_ENTRY_ENABLED 0x00800000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200251
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300252 #define SHARED_HW_CFG_PORT_MODE_MASK 0x01000000
253 #define SHARED_HW_CFG_PORT_MODE_2 0x00000000
254 #define SHARED_HW_CFG_PORT_MODE_4 0x01000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200255
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300256 #define SHARED_HW_CFG_PATH_SWAP_MASK 0x02000000
257 #define SHARED_HW_CFG_PATH_SWAP_DISABLED 0x00000000
258 #define SHARED_HW_CFG_PATH_SWAP_ENABLED 0x02000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200259
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300260 /* Set the MDC/MDIO access for the first external phy */
261 #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_MASK 0x1C000000
262 #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_SHIFT 26
263 #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_PHY_TYPE 0x00000000
264 #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_EMAC0 0x04000000
265 #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_EMAC1 0x08000000
266 #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_BOTH 0x0c000000
267 #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_SWAPPED 0x10000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200268
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300269 /* Set the MDC/MDIO access for the second external phy */
270 #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_MASK 0xE0000000
271 #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_SHIFT 29
272 #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_PHY_TYPE 0x00000000
273 #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_EMAC0 0x20000000
274 #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_EMAC1 0x40000000
275 #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_BOTH 0x60000000
276 #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_SWAPPED 0x80000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200277
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200278
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300279 u32 power_dissipated; /* 0x11c */
280 #define SHARED_HW_CFG_POWER_MGNT_SCALE_MASK 0x00ff0000
281 #define SHARED_HW_CFG_POWER_MGNT_SCALE_SHIFT 16
282 #define SHARED_HW_CFG_POWER_MGNT_UNKNOWN_SCALE 0x00000000
283 #define SHARED_HW_CFG_POWER_MGNT_DOT_1_WATT 0x00010000
284 #define SHARED_HW_CFG_POWER_MGNT_DOT_01_WATT 0x00020000
285 #define SHARED_HW_CFG_POWER_MGNT_DOT_001_WATT 0x00030000
Eilon Greenstein35b19ba2009-02-12 08:36:47 +0000286
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300287 #define SHARED_HW_CFG_POWER_DIS_CMN_MASK 0xff000000
288 #define SHARED_HW_CFG_POWER_DIS_CMN_SHIFT 24
Eilon Greenstein35b19ba2009-02-12 08:36:47 +0000289
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300290 u32 ump_nc_si_config; /* 0x120 */
291 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MASK 0x00000003
292 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_SHIFT 0
293 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MAC 0x00000000
294 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_PHY 0x00000001
295 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MII 0x00000000
296 #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_RMII 0x00000002
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200297
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300298 #define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_MASK 0x00000f00
299 #define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_SHIFT 8
300
301 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_MASK 0x00ff0000
302 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_SHIFT 16
303 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_NONE 0x00000000
304 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_BCM5221 0x00010000
305
306 u32 board; /* 0x124 */
307 #define SHARED_HW_CFG_E3_I2C_MUX0_MASK 0x0000003F
308 #define SHARED_HW_CFG_E3_I2C_MUX0_SHIFT 0
309 #define SHARED_HW_CFG_E3_I2C_MUX1_MASK 0x00000FC0
310 #define SHARED_HW_CFG_E3_I2C_MUX1_SHIFT 6
311 /* Use the PIN_CFG_XXX defines on top */
312 #define SHARED_HW_CFG_BOARD_REV_MASK 0x00ff0000
313 #define SHARED_HW_CFG_BOARD_REV_SHIFT 16
314
315 #define SHARED_HW_CFG_BOARD_MAJOR_VER_MASK 0x0f000000
316 #define SHARED_HW_CFG_BOARD_MAJOR_VER_SHIFT 24
317
318 #define SHARED_HW_CFG_BOARD_MINOR_VER_MASK 0xf0000000
319 #define SHARED_HW_CFG_BOARD_MINOR_VER_SHIFT 28
320
321 u32 wc_lane_config; /* 0x128 */
322 #define SHARED_HW_CFG_LANE_SWAP_CFG_MASK 0x0000FFFF
323 #define SHARED_HW_CFG_LANE_SWAP_CFG_SHIFT 0
324 #define SHARED_HW_CFG_LANE_SWAP_CFG_32103210 0x00001b1b
325 #define SHARED_HW_CFG_LANE_SWAP_CFG_32100123 0x00001be4
326 #define SHARED_HW_CFG_LANE_SWAP_CFG_01233210 0x0000e41b
327 #define SHARED_HW_CFG_LANE_SWAP_CFG_01230123 0x0000e4e4
328 #define SHARED_HW_CFG_LANE_SWAP_CFG_TX_MASK 0x000000FF
329 #define SHARED_HW_CFG_LANE_SWAP_CFG_TX_SHIFT 0
330 #define SHARED_HW_CFG_LANE_SWAP_CFG_RX_MASK 0x0000FF00
331 #define SHARED_HW_CFG_LANE_SWAP_CFG_RX_SHIFT 8
332
333 /* TX lane Polarity swap */
334 #define SHARED_HW_CFG_TX_LANE0_POL_FLIP_ENABLED 0x00010000
335 #define SHARED_HW_CFG_TX_LANE1_POL_FLIP_ENABLED 0x00020000
336 #define SHARED_HW_CFG_TX_LANE2_POL_FLIP_ENABLED 0x00040000
337 #define SHARED_HW_CFG_TX_LANE3_POL_FLIP_ENABLED 0x00080000
338 /* TX lane Polarity swap */
339 #define SHARED_HW_CFG_RX_LANE0_POL_FLIP_ENABLED 0x00100000
340 #define SHARED_HW_CFG_RX_LANE1_POL_FLIP_ENABLED 0x00200000
341 #define SHARED_HW_CFG_RX_LANE2_POL_FLIP_ENABLED 0x00400000
342 #define SHARED_HW_CFG_RX_LANE3_POL_FLIP_ENABLED 0x00800000
343
344 /* Selects the port layout of the board */
345 #define SHARED_HW_CFG_E3_PORT_LAYOUT_MASK 0x0F000000
346 #define SHARED_HW_CFG_E3_PORT_LAYOUT_SHIFT 24
347 #define SHARED_HW_CFG_E3_PORT_LAYOUT_2P_01 0x00000000
348 #define SHARED_HW_CFG_E3_PORT_LAYOUT_2P_10 0x01000000
349 #define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_0123 0x02000000
350 #define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_1032 0x03000000
351 #define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_2301 0x04000000
352 #define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_3210 0x05000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200353};
354
Eliezer Tamirf1410642008-02-28 11:51:50 -0800355
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200356/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300357 * Port HW configuration *
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200358 ****************************************************************************/
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300359struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200360
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200361 u32 pci_id;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300362 #define PORT_HW_CFG_PCI_VENDOR_ID_MASK 0xffff0000
363 #define PORT_HW_CFG_PCI_DEVICE_ID_MASK 0x0000ffff
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200364
365 u32 pci_sub_id;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300366 #define PORT_HW_CFG_PCI_SUBSYS_DEVICE_ID_MASK 0xffff0000
367 #define PORT_HW_CFG_PCI_SUBSYS_VENDOR_ID_MASK 0x0000ffff
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200368
369 u32 power_dissipated;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300370 #define PORT_HW_CFG_POWER_DIS_D0_MASK 0x000000ff
371 #define PORT_HW_CFG_POWER_DIS_D0_SHIFT 0
372 #define PORT_HW_CFG_POWER_DIS_D1_MASK 0x0000ff00
373 #define PORT_HW_CFG_POWER_DIS_D1_SHIFT 8
374 #define PORT_HW_CFG_POWER_DIS_D2_MASK 0x00ff0000
375 #define PORT_HW_CFG_POWER_DIS_D2_SHIFT 16
376 #define PORT_HW_CFG_POWER_DIS_D3_MASK 0xff000000
377 #define PORT_HW_CFG_POWER_DIS_D3_SHIFT 24
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200378
379 u32 power_consumed;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300380 #define PORT_HW_CFG_POWER_CONS_D0_MASK 0x000000ff
381 #define PORT_HW_CFG_POWER_CONS_D0_SHIFT 0
382 #define PORT_HW_CFG_POWER_CONS_D1_MASK 0x0000ff00
383 #define PORT_HW_CFG_POWER_CONS_D1_SHIFT 8
384 #define PORT_HW_CFG_POWER_CONS_D2_MASK 0x00ff0000
385 #define PORT_HW_CFG_POWER_CONS_D2_SHIFT 16
386 #define PORT_HW_CFG_POWER_CONS_D3_MASK 0xff000000
387 #define PORT_HW_CFG_POWER_CONS_D3_SHIFT 24
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200388
389 u32 mac_upper;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300390 #define PORT_HW_CFG_UPPERMAC_MASK 0x0000ffff
391 #define PORT_HW_CFG_UPPERMAC_SHIFT 0
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200392 u32 mac_lower;
393
394 u32 iscsi_mac_upper; /* Upper 16 bits are always zeroes */
395 u32 iscsi_mac_lower;
396
397 u32 rdma_mac_upper; /* Upper 16 bits are always zeroes */
398 u32 rdma_mac_lower;
399
400 u32 serdes_config;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300401 #define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_MASK 0x0000ffff
402 #define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_SHIFT 0
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200403
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300404 #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_MASK 0xffff0000
405 #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT 16
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200406
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200407
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300408 /* Default values: 2P-64, 4P-32 */
409 u32 pf_config; /* 0x158 */
410 #define PORT_HW_CFG_PF_NUM_VF_MASK 0x0000007F
411 #define PORT_HW_CFG_PF_NUM_VF_SHIFT 0
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200412
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300413 /* Default values: 17 */
414 #define PORT_HW_CFG_PF_NUM_MSIX_VECTORS_MASK 0x00007F00
415 #define PORT_HW_CFG_PF_NUM_MSIX_VECTORS_SHIFT 8
Yaniv Rosner020c7e32011-05-31 21:28:43 +0000416
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300417 #define PORT_HW_CFG_ENABLE_FLR_MASK 0x00010000
418 #define PORT_HW_CFG_FLR_ENABLED 0x00010000
Yaniv Rosner020c7e32011-05-31 21:28:43 +0000419
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300420 u32 vf_config; /* 0x15C */
421 #define PORT_HW_CFG_VF_NUM_MSIX_VECTORS_MASK 0x0000007F
422 #define PORT_HW_CFG_VF_NUM_MSIX_VECTORS_SHIFT 0
Yaniv Rosner1ac9e422011-05-31 21:26:11 +0000423
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300424 #define PORT_HW_CFG_VF_PCI_DEVICE_ID_MASK 0xFFFF0000
425 #define PORT_HW_CFG_VF_PCI_DEVICE_ID_SHIFT 16
Yaniv Rosner1ac9e422011-05-31 21:26:11 +0000426
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300427 u32 mf_pci_id; /* 0x160 */
428 #define PORT_HW_CFG_MF_PCI_DEVICE_ID_MASK 0x0000FFFF
429 #define PORT_HW_CFG_MF_PCI_DEVICE_ID_SHIFT 0
Yaniv Rosner1ac9e422011-05-31 21:26:11 +0000430
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300431 /* Controls the TX laser of the SFP+ module */
432 u32 sfp_ctrl; /* 0x164 */
433 #define PORT_HW_CFG_TX_LASER_MASK 0x000000FF
434 #define PORT_HW_CFG_TX_LASER_SHIFT 0
435 #define PORT_HW_CFG_TX_LASER_MDIO 0x00000000
436 #define PORT_HW_CFG_TX_LASER_GPIO0 0x00000001
437 #define PORT_HW_CFG_TX_LASER_GPIO1 0x00000002
438 #define PORT_HW_CFG_TX_LASER_GPIO2 0x00000003
439 #define PORT_HW_CFG_TX_LASER_GPIO3 0x00000004
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200440
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300441 /* Controls the fault module LED of the SFP+ */
442 #define PORT_HW_CFG_FAULT_MODULE_LED_MASK 0x0000FF00
443 #define PORT_HW_CFG_FAULT_MODULE_LED_SHIFT 8
444 #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO0 0x00000000
445 #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO1 0x00000100
446 #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO2 0x00000200
447 #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO3 0x00000300
448 #define PORT_HW_CFG_FAULT_MODULE_LED_DISABLED 0x00000400
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200449
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300450 /* The output pin TX_DIS that controls the TX laser of the SFP+
451 module. Use the PIN_CFG_XXX defines on top */
452 u32 e3_sfp_ctrl; /* 0x168 */
453 #define PORT_HW_CFG_E3_TX_LASER_MASK 0x000000FF
454 #define PORT_HW_CFG_E3_TX_LASER_SHIFT 0
Yaniv Rosnera8db5b42011-01-31 04:22:28 +0000455
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300456 /* The output pin for SFPP_TYPE which turns on the Fault module LED */
457 #define PORT_HW_CFG_E3_FAULT_MDL_LED_MASK 0x0000FF00
458 #define PORT_HW_CFG_E3_FAULT_MDL_LED_SHIFT 8
Yaniv Rosnera8db5b42011-01-31 04:22:28 +0000459
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300460 /* The input pin MOD_ABS that indicates whether SFP+ module is
461 present or not. Use the PIN_CFG_XXX defines on top */
462 #define PORT_HW_CFG_E3_MOD_ABS_MASK 0x00FF0000
463 #define PORT_HW_CFG_E3_MOD_ABS_SHIFT 16
Yaniv Rosnera8db5b42011-01-31 04:22:28 +0000464
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300465 /* The output pin PWRDIS_SFP_X which disable the power of the SFP+
466 module. Use the PIN_CFG_XXX defines on top */
467 #define PORT_HW_CFG_E3_PWR_DIS_MASK 0xFF000000
468 #define PORT_HW_CFG_E3_PWR_DIS_SHIFT 24
Yaniv Rosnera8db5b42011-01-31 04:22:28 +0000469
470 /*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300471 * The input pin which signals module transmit fault. Use the
472 * PIN_CFG_XXX defines on top
Yaniv Rosnera8db5b42011-01-31 04:22:28 +0000473 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300474 u32 e3_cmn_pin_cfg; /* 0x16C */
475 #define PORT_HW_CFG_E3_TX_FAULT_MASK 0x000000FF
476 #define PORT_HW_CFG_E3_TX_FAULT_SHIFT 0
477
478 /* The output pin which reset the PHY. Use the PIN_CFG_XXX defines on
479 top */
480 #define PORT_HW_CFG_E3_PHY_RESET_MASK 0x0000FF00
481 #define PORT_HW_CFG_E3_PHY_RESET_SHIFT 8
482
483 /*
484 * The output pin which powers down the PHY. Use the PIN_CFG_XXX
485 * defines on top
486 */
487 #define PORT_HW_CFG_E3_PWR_DOWN_MASK 0x00FF0000
488 #define PORT_HW_CFG_E3_PWR_DOWN_SHIFT 16
489
490 /* The output pin values BSC_SEL which selects the I2C for this port
491 in the I2C Mux */
492 #define PORT_HW_CFG_E3_I2C_MUX0_MASK 0x01000000
493 #define PORT_HW_CFG_E3_I2C_MUX1_MASK 0x02000000
494
495
496 /*
497 * The input pin I_FAULT which indicate over-current has occurred.
498 * Use the PIN_CFG_XXX defines on top
499 */
500 u32 e3_cmn_pin_cfg1; /* 0x170 */
501 #define PORT_HW_CFG_E3_OVER_CURRENT_MASK 0x000000FF
502 #define PORT_HW_CFG_E3_OVER_CURRENT_SHIFT 0
Yuval Mintz79642112012-12-02 04:05:50 +0000503
504 /* pause on host ring */
505 u32 generic_features; /* 0x174 */
506 #define PORT_HW_CFG_PAUSE_ON_HOST_RING_MASK 0x00000001
507 #define PORT_HW_CFG_PAUSE_ON_HOST_RING_SHIFT 0
508 #define PORT_HW_CFG_PAUSE_ON_HOST_RING_DISABLED 0x00000000
509 #define PORT_HW_CFG_PAUSE_ON_HOST_RING_ENABLED 0x00000001
510
511 u32 reserved0[6]; /* 0x178 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300512
513 u32 aeu_int_mask; /* 0x190 */
514
515 u32 media_type; /* 0x194 */
516 #define PORT_HW_CFG_MEDIA_TYPE_PHY0_MASK 0x000000FF
517 #define PORT_HW_CFG_MEDIA_TYPE_PHY0_SHIFT 0
518
519 #define PORT_HW_CFG_MEDIA_TYPE_PHY1_MASK 0x0000FF00
520 #define PORT_HW_CFG_MEDIA_TYPE_PHY1_SHIFT 8
521
522 #define PORT_HW_CFG_MEDIA_TYPE_PHY2_MASK 0x00FF0000
523 #define PORT_HW_CFG_MEDIA_TYPE_PHY2_SHIFT 16
524
525 /* 4 times 16 bits for all 4 lanes. In case external PHY is present
526 (not direct mode), those values will not take effect on the 4 XGXS
527 lanes. For some external PHYs (such as 8706 and 8726) the values
528 will be used to configure the external PHY in those cases, not
529 all 4 values are needed. */
530 u16 xgxs_config_rx[4]; /* 0x198 */
531 u16 xgxs_config_tx[4]; /* 0x1A0 */
532
533 /* For storing FCOE mac on shared memory */
534 u32 fcoe_fip_mac_upper;
535 #define PORT_HW_CFG_FCOE_UPPERMAC_MASK 0x0000ffff
536 #define PORT_HW_CFG_FCOE_UPPERMAC_SHIFT 0
537 u32 fcoe_fip_mac_lower;
538
539 u32 fcoe_wwn_port_name_upper;
540 u32 fcoe_wwn_port_name_lower;
541
542 u32 fcoe_wwn_node_name_upper;
543 u32 fcoe_wwn_node_name_lower;
544
Yaniv Rosner0520e632011-07-05 01:06:59 +0000545 u32 Reserved1[49]; /* 0x1C0 */
546
547 /* Enable RJ45 magjack pair swapping on 10GBase-T PHY (0=default),
548 84833 only */
549 u32 xgbt_phy_cfg; /* 0x284 */
550 #define PORT_HW_CFG_RJ45_PAIR_SWAP_MASK 0x000000FF
551 #define PORT_HW_CFG_RJ45_PAIR_SWAP_SHIFT 0
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300552
553 u32 default_cfg; /* 0x288 */
554 #define PORT_HW_CFG_GPIO0_CONFIG_MASK 0x00000003
555 #define PORT_HW_CFG_GPIO0_CONFIG_SHIFT 0
556 #define PORT_HW_CFG_GPIO0_CONFIG_NA 0x00000000
557 #define PORT_HW_CFG_GPIO0_CONFIG_LOW 0x00000001
558 #define PORT_HW_CFG_GPIO0_CONFIG_HIGH 0x00000002
559 #define PORT_HW_CFG_GPIO0_CONFIG_INPUT 0x00000003
560
561 #define PORT_HW_CFG_GPIO1_CONFIG_MASK 0x0000000C
562 #define PORT_HW_CFG_GPIO1_CONFIG_SHIFT 2
563 #define PORT_HW_CFG_GPIO1_CONFIG_NA 0x00000000
564 #define PORT_HW_CFG_GPIO1_CONFIG_LOW 0x00000004
565 #define PORT_HW_CFG_GPIO1_CONFIG_HIGH 0x00000008
566 #define PORT_HW_CFG_GPIO1_CONFIG_INPUT 0x0000000c
567
568 #define PORT_HW_CFG_GPIO2_CONFIG_MASK 0x00000030
569 #define PORT_HW_CFG_GPIO2_CONFIG_SHIFT 4
570 #define PORT_HW_CFG_GPIO2_CONFIG_NA 0x00000000
571 #define PORT_HW_CFG_GPIO2_CONFIG_LOW 0x00000010
572 #define PORT_HW_CFG_GPIO2_CONFIG_HIGH 0x00000020
573 #define PORT_HW_CFG_GPIO2_CONFIG_INPUT 0x00000030
574
575 #define PORT_HW_CFG_GPIO3_CONFIG_MASK 0x000000C0
576 #define PORT_HW_CFG_GPIO3_CONFIG_SHIFT 6
577 #define PORT_HW_CFG_GPIO3_CONFIG_NA 0x00000000
578 #define PORT_HW_CFG_GPIO3_CONFIG_LOW 0x00000040
579 #define PORT_HW_CFG_GPIO3_CONFIG_HIGH 0x00000080
580 #define PORT_HW_CFG_GPIO3_CONFIG_INPUT 0x000000c0
581
582 /* When KR link is required to be set to force which is not
583 KR-compliant, this parameter determine what is the trigger for it.
584 When GPIO is selected, low input will force the speed. Currently
585 default speed is 1G. In the future, it may be widen to select the
586 forced speed in with another parameter. Note when force-1G is
587 enabled, it override option 56: Link Speed option. */
588 #define PORT_HW_CFG_FORCE_KR_ENABLER_MASK 0x00000F00
589 #define PORT_HW_CFG_FORCE_KR_ENABLER_SHIFT 8
590 #define PORT_HW_CFG_FORCE_KR_ENABLER_NOT_FORCED 0x00000000
591 #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P0 0x00000100
592 #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P0 0x00000200
593 #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P0 0x00000300
594 #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P0 0x00000400
595 #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P1 0x00000500
596 #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P1 0x00000600
597 #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P1 0x00000700
598 #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P1 0x00000800
599 #define PORT_HW_CFG_FORCE_KR_ENABLER_FORCED 0x00000900
600 /* Enable to determine with which GPIO to reset the external phy */
601 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_MASK 0x000F0000
602 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_SHIFT 16
603 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_PHY_TYPE 0x00000000
604 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P0 0x00010000
605 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P0 0x00020000
606 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P0 0x00030000
607 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P0 0x00040000
608 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P1 0x00050000
609 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P1 0x00060000
610 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P1 0x00070000
611 #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P1 0x00080000
612
Yaniv Rosner121839b2010-11-01 05:32:38 +0000613 /* Enable BAM on KR */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300614 #define PORT_HW_CFG_ENABLE_BAM_ON_KR_MASK 0x00100000
615 #define PORT_HW_CFG_ENABLE_BAM_ON_KR_SHIFT 20
616 #define PORT_HW_CFG_ENABLE_BAM_ON_KR_DISABLED 0x00000000
617 #define PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED 0x00100000
Yaniv Rosner121839b2010-11-01 05:32:38 +0000618
Yaniv Rosner1bef68e2011-01-31 04:22:46 +0000619 /* Enable Common Mode Sense */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300620 #define PORT_HW_CFG_ENABLE_CMS_MASK 0x00200000
621 #define PORT_HW_CFG_ENABLE_CMS_SHIFT 21
622 #define PORT_HW_CFG_ENABLE_CMS_DISABLED 0x00000000
623 #define PORT_HW_CFG_ENABLE_CMS_ENABLED 0x00200000
624
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300625 /* Determine the Serdes electrical interface */
626 #define PORT_HW_CFG_NET_SERDES_IF_MASK 0x0F000000
627 #define PORT_HW_CFG_NET_SERDES_IF_SHIFT 24
628 #define PORT_HW_CFG_NET_SERDES_IF_SGMII 0x00000000
629 #define PORT_HW_CFG_NET_SERDES_IF_XFI 0x01000000
630 #define PORT_HW_CFG_NET_SERDES_IF_SFI 0x02000000
631 #define PORT_HW_CFG_NET_SERDES_IF_KR 0x03000000
632 #define PORT_HW_CFG_NET_SERDES_IF_DXGXS 0x04000000
633 #define PORT_HW_CFG_NET_SERDES_IF_KR2 0x05000000
634
Yaniv Rosner1bef68e2011-01-31 04:22:46 +0000635
Yaniv Rosnera22f0782010-09-07 11:41:20 +0000636 u32 speed_capability_mask2; /* 0x28C */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300637 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF
638 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0
639 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_10M_FULL 0x00000001
640 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3__ 0x00000002
641 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3___ 0x00000004
642 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_100M_FULL 0x00000008
643 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_1G 0x00000010
644 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_2_DOT_5G 0x00000020
645 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_10G 0x00000040
646 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_20G 0x00000080
Yaniv Rosnera22f0782010-09-07 11:41:20 +0000647
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300648 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_MASK 0xFFFF0000
649 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_SHIFT 16
650 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_10M_FULL 0x00010000
651 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0__ 0x00020000
652 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0___ 0x00040000
653 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_100M_FULL 0x00080000
654 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_1G 0x00100000
655 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_2_DOT_5G 0x00200000
656 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_10G 0x00400000
657 #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_20G 0x00800000
Yaniv Rosnera22f0782010-09-07 11:41:20 +0000658
659
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300660 /* In the case where two media types (e.g. copper and fiber) are
661 present and electrically active at the same time, PHY Selection
662 will determine which of the two PHYs will be designated as the
663 Active PHY and used for a connection to the network. */
664 u32 multi_phy_config; /* 0x290 */
665 #define PORT_HW_CFG_PHY_SELECTION_MASK 0x00000007
666 #define PORT_HW_CFG_PHY_SELECTION_SHIFT 0
667 #define PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT 0x00000000
668 #define PORT_HW_CFG_PHY_SELECTION_FIRST_PHY 0x00000001
669 #define PORT_HW_CFG_PHY_SELECTION_SECOND_PHY 0x00000002
670 #define PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY 0x00000003
671 #define PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY 0x00000004
Yaniv Rosnera22f0782010-09-07 11:41:20 +0000672
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300673 /* When enabled, all second phy nvram parameters will be swapped
674 with the first phy parameters */
675 #define PORT_HW_CFG_PHY_SWAPPED_MASK 0x00000008
676 #define PORT_HW_CFG_PHY_SWAPPED_SHIFT 3
677 #define PORT_HW_CFG_PHY_SWAPPED_DISABLED 0x00000000
678 #define PORT_HW_CFG_PHY_SWAPPED_ENABLED 0x00000008
Yaniv Rosnera22f0782010-09-07 11:41:20 +0000679
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300680
681 /* Address of the second external phy */
682 u32 external_phy_config2; /* 0x294 */
683 #define PORT_HW_CFG_XGXS_EXT_PHY2_ADDR_MASK 0x000000FF
684 #define PORT_HW_CFG_XGXS_EXT_PHY2_ADDR_SHIFT 0
685
686 /* The second XGXS external PHY type */
687 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_MASK 0x0000FF00
688 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_SHIFT 8
689 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_DIRECT 0x00000000
690 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8071 0x00000100
691 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8072 0x00000200
692 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8073 0x00000300
693 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8705 0x00000400
694 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8706 0x00000500
695 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8726 0x00000600
696 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8481 0x00000700
697 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_SFX7101 0x00000800
698 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8727 0x00000900
699 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8727_NOC 0x00000a00
700 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84823 0x00000b00
701 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54640 0x00000c00
702 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84833 0x00000d00
Yaniv Rosner52c4d6c2011-07-05 01:06:34 +0000703 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54618SE 0x00000e00
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300704 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8722 0x00000f00
Yaniv Rosner3756a892011-08-23 06:33:24 +0000705 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54616 0x00001000
Yaniv Rosner0f6bb032012-11-27 03:46:32 +0000706 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84834 0x00001100
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300707 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_FAILURE 0x0000fd00
708 #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_NOT_CONN 0x0000ff00
709
710
711 /* 4 times 16 bits for all 4 lanes. For some external PHYs (such as
712 8706, 8726 and 8727) not all 4 values are needed. */
713 u16 xgxs_config2_rx[4]; /* 0x296 */
714 u16 xgxs_config2_tx[4]; /* 0x2A0 */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200715
716 u32 lane_config;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300717 #define PORT_HW_CFG_LANE_SWAP_CFG_MASK 0x0000ffff
718 #define PORT_HW_CFG_LANE_SWAP_CFG_SHIFT 0
719 /* AN and forced */
720 #define PORT_HW_CFG_LANE_SWAP_CFG_01230123 0x00001b1b
721 /* forced only */
722 #define PORT_HW_CFG_LANE_SWAP_CFG_01233210 0x00001be4
723 /* forced only */
724 #define PORT_HW_CFG_LANE_SWAP_CFG_31203120 0x0000d8d8
725 /* forced only */
726 #define PORT_HW_CFG_LANE_SWAP_CFG_32103210 0x0000e4e4
727 #define PORT_HW_CFG_LANE_SWAP_CFG_TX_MASK 0x000000ff
728 #define PORT_HW_CFG_LANE_SWAP_CFG_TX_SHIFT 0
729 #define PORT_HW_CFG_LANE_SWAP_CFG_RX_MASK 0x0000ff00
730 #define PORT_HW_CFG_LANE_SWAP_CFG_RX_SHIFT 8
731 #define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK 0x0000c000
732 #define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT 14
Dmitry Kravkov523224a2010-10-06 03:23:26 +0000733
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300734 /* Indicate whether to swap the external phy polarity */
735 #define PORT_HW_CFG_SWAP_PHY_POLARITY_MASK 0x00010000
736 #define PORT_HW_CFG_SWAP_PHY_POLARITY_DISABLED 0x00000000
737 #define PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED 0x00010000
738
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200739
740 u32 external_phy_config;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300741 #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK 0x000000ff
742 #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT 0
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200743
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300744 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK 0x0000ff00
745 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SHIFT 8
746 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT 0x00000000
747 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8071 0x00000100
748 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072 0x00000200
749 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073 0x00000300
750 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705 0x00000400
751 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706 0x00000500
752 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726 0x00000600
753 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481 0x00000700
754 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101 0x00000800
755 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 0x00000900
756 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC 0x00000a00
757 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823 0x00000b00
758 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54640 0x00000c00
759 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833 0x00000d00
Yaniv Rosner52c4d6c2011-07-05 01:06:34 +0000760 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE 0x00000e00
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300761 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8722 0x00000f00
Yaniv Rosner3756a892011-08-23 06:33:24 +0000762 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616 0x00001000
Yaniv Rosner0f6bb032012-11-27 03:46:32 +0000763 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834 0x00001100
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300764 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT_WC 0x0000fc00
765 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE 0x0000fd00
766 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN 0x0000ff00
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200767
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300768 #define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_MASK 0x00ff0000
769 #define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_SHIFT 16
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200770
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300771 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK 0xff000000
772 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_SHIFT 24
773 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT 0x00000000
774 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482 0x01000000
775 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT_SD 0x02000000
776 #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_NOT_CONN 0xff000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200777
778 u32 speed_capability_mask;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300779 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_MASK 0x0000ffff
780 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_SHIFT 0
781 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_FULL 0x00000001
782 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_HALF 0x00000002
783 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_HALF 0x00000004
784 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_FULL 0x00000008
785 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_1G 0x00000010
786 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_2_5G 0x00000020
787 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10G 0x00000040
788 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_20G 0x00000080
789 #define PORT_HW_CFG_SPEED_CAPABILITY_D3_RESERVED 0x0000f000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200790
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300791 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_MASK 0xffff0000
792 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_SHIFT 16
793 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL 0x00010000
794 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF 0x00020000
795 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF 0x00040000
796 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL 0x00080000
797 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_1G 0x00100000
798 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G 0x00200000
799 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10G 0x00400000
800 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_20G 0x00800000
801 #define PORT_HW_CFG_SPEED_CAPABILITY_D0_RESERVED 0xf0000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200802
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300803 /* A place to hold the original MAC address as a backup */
804 u32 backup_mac_upper; /* 0x2B4 */
805 u32 backup_mac_lower; /* 0x2B8 */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200806
807};
808
Eliezer Tamirf1410642008-02-28 11:51:50 -0800809
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200810/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300811 * Shared Feature configuration *
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200812 ****************************************************************************/
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300813struct shared_feat_cfg { /* NVRAM Offset */
Eliezer Tamirf1410642008-02-28 11:51:50 -0800814
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300815 u32 config; /* 0x450 */
816 #define SHARED_FEATURE_BMC_ECHO_MODE_EN 0x00000001
Eilon Greenstein589abe32009-02-12 08:36:55 +0000817
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300818 /* Use NVRAM values instead of HW default values */
819 #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_MASK \
820 0x00000002
821 #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_DISABLED \
822 0x00000000
823 #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_ENABLED \
824 0x00000002
Eilon Greenstein589abe32009-02-12 08:36:55 +0000825
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300826 #define SHARED_FEAT_CFG_NCSI_ID_METHOD_MASK 0x00000008
827 #define SHARED_FEAT_CFG_NCSI_ID_METHOD_SPIO 0x00000000
828 #define SHARED_FEAT_CFG_NCSI_ID_METHOD_NVRAM 0x00000008
829
830 #define SHARED_FEAT_CFG_NCSI_ID_MASK 0x00000030
831 #define SHARED_FEAT_CFG_NCSI_ID_SHIFT 4
832
833 /* Override the OTP back to single function mode. When using GPIO,
834 high means only SF, 0 is according to CLP configuration */
835 #define SHARED_FEAT_CFG_FORCE_SF_MODE_MASK 0x00000700
836 #define SHARED_FEAT_CFG_FORCE_SF_MODE_SHIFT 8
837 #define SHARED_FEAT_CFG_FORCE_SF_MODE_MF_ALLOWED 0x00000000
838 #define SHARED_FEAT_CFG_FORCE_SF_MODE_FORCED_SF 0x00000100
839 #define SHARED_FEAT_CFG_FORCE_SF_MODE_SPIO4 0x00000200
840 #define SHARED_FEAT_CFG_FORCE_SF_MODE_SWITCH_INDEPT 0x00000300
Barak Witkowskia3348722012-04-23 03:04:46 +0000841 #define SHARED_FEAT_CFG_FORCE_SF_MODE_AFEX_MODE 0x00000400
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300842
843 /* The interval in seconds between sending LLDP packets. Set to zero
844 to disable the feature */
845 #define SHARED_FEAT_CFG_LLDP_XMIT_INTERVAL_MASK 0x00ff0000
846 #define SHARED_FEAT_CFG_LLDP_XMIT_INTERVAL_SHIFT 16
847
848 /* The assigned device type ID for LLDP usage */
849 #define SHARED_FEAT_CFG_LLDP_DEVICE_TYPE_ID_MASK 0xff000000
850 #define SHARED_FEAT_CFG_LLDP_DEVICE_TYPE_ID_SHIFT 24
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200851
852};
853
854
855/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300856 * Port Feature configuration *
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200857 ****************************************************************************/
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300858struct port_feat_cfg { /* port 0: 0x454 port 1: 0x4c8 */
Eliezer Tamirf1410642008-02-28 11:51:50 -0800859
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200860 u32 config;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300861 #define PORT_FEATURE_BAR1_SIZE_MASK 0x0000000f
862 #define PORT_FEATURE_BAR1_SIZE_SHIFT 0
863 #define PORT_FEATURE_BAR1_SIZE_DISABLED 0x00000000
864 #define PORT_FEATURE_BAR1_SIZE_64K 0x00000001
865 #define PORT_FEATURE_BAR1_SIZE_128K 0x00000002
866 #define PORT_FEATURE_BAR1_SIZE_256K 0x00000003
867 #define PORT_FEATURE_BAR1_SIZE_512K 0x00000004
868 #define PORT_FEATURE_BAR1_SIZE_1M 0x00000005
869 #define PORT_FEATURE_BAR1_SIZE_2M 0x00000006
870 #define PORT_FEATURE_BAR1_SIZE_4M 0x00000007
871 #define PORT_FEATURE_BAR1_SIZE_8M 0x00000008
872 #define PORT_FEATURE_BAR1_SIZE_16M 0x00000009
873 #define PORT_FEATURE_BAR1_SIZE_32M 0x0000000a
874 #define PORT_FEATURE_BAR1_SIZE_64M 0x0000000b
875 #define PORT_FEATURE_BAR1_SIZE_128M 0x0000000c
876 #define PORT_FEATURE_BAR1_SIZE_256M 0x0000000d
877 #define PORT_FEATURE_BAR1_SIZE_512M 0x0000000e
878 #define PORT_FEATURE_BAR1_SIZE_1G 0x0000000f
879 #define PORT_FEATURE_BAR2_SIZE_MASK 0x000000f0
880 #define PORT_FEATURE_BAR2_SIZE_SHIFT 4
881 #define PORT_FEATURE_BAR2_SIZE_DISABLED 0x00000000
882 #define PORT_FEATURE_BAR2_SIZE_64K 0x00000010
883 #define PORT_FEATURE_BAR2_SIZE_128K 0x00000020
884 #define PORT_FEATURE_BAR2_SIZE_256K 0x00000030
885 #define PORT_FEATURE_BAR2_SIZE_512K 0x00000040
886 #define PORT_FEATURE_BAR2_SIZE_1M 0x00000050
887 #define PORT_FEATURE_BAR2_SIZE_2M 0x00000060
888 #define PORT_FEATURE_BAR2_SIZE_4M 0x00000070
889 #define PORT_FEATURE_BAR2_SIZE_8M 0x00000080
890 #define PORT_FEATURE_BAR2_SIZE_16M 0x00000090
891 #define PORT_FEATURE_BAR2_SIZE_32M 0x000000a0
892 #define PORT_FEATURE_BAR2_SIZE_64M 0x000000b0
893 #define PORT_FEATURE_BAR2_SIZE_128M 0x000000c0
894 #define PORT_FEATURE_BAR2_SIZE_256M 0x000000d0
895 #define PORT_FEATURE_BAR2_SIZE_512M 0x000000e0
896 #define PORT_FEATURE_BAR2_SIZE_1G 0x000000f0
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200897
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300898 #define PORT_FEAT_CFG_DCBX_MASK 0x00000100
899 #define PORT_FEAT_CFG_DCBX_DISABLED 0x00000000
900 #define PORT_FEAT_CFG_DCBX_ENABLED 0x00000100
Eilon Greenstein4d295db2009-07-21 05:47:47 +0000901
Yuval Mintz4ba76992013-01-14 05:11:45 +0000902 #define PORT_FEAT_CFG_STORAGE_PERSONALITY_MASK 0x00000C00
903 #define PORT_FEAT_CFG_STORAGE_PERSONALITY_FCOE 0x00000400
904 #define PORT_FEAT_CFG_STORAGE_PERSONALITY_ISCSI 0x00000800
905
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300906 #define PORT_FEATURE_EN_SIZE_MASK 0x0f000000
907 #define PORT_FEATURE_EN_SIZE_SHIFT 24
908 #define PORT_FEATURE_WOL_ENABLED 0x01000000
909 #define PORT_FEATURE_MBA_ENABLED 0x02000000
910 #define PORT_FEATURE_MFW_ENABLED 0x04000000
911
912 /* Advertise expansion ROM even if MBA is disabled */
913 #define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_MASK 0x08000000
914 #define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_DISABLED 0x00000000
915 #define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_ENABLED 0x08000000
916
917 /* Check the optic vendor via i2c against a list of approved modules
918 in a separate nvram image */
919 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK 0xe0000000
920 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_SHIFT 29
921 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_NO_ENFORCEMENT \
922 0x00000000
923 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER \
924 0x20000000
925 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG 0x40000000
926 #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_POWER_DOWN 0x60000000
Eilon Greenstein589abe32009-02-12 08:36:55 +0000927
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200928 u32 wol_config;
929 /* Default is used when driver sets to "auto" mode */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300930 #define PORT_FEATURE_WOL_DEFAULT_MASK 0x00000003
931 #define PORT_FEATURE_WOL_DEFAULT_SHIFT 0
932 #define PORT_FEATURE_WOL_DEFAULT_DISABLE 0x00000000
933 #define PORT_FEATURE_WOL_DEFAULT_MAGIC 0x00000001
934 #define PORT_FEATURE_WOL_DEFAULT_ACPI 0x00000002
935 #define PORT_FEATURE_WOL_DEFAULT_MAGIC_AND_ACPI 0x00000003
936 #define PORT_FEATURE_WOL_RES_PAUSE_CAP 0x00000004
937 #define PORT_FEATURE_WOL_RES_ASYM_PAUSE_CAP 0x00000008
938 #define PORT_FEATURE_WOL_ACPI_UPON_MGMT 0x00000010
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200939
940 u32 mba_config;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300941 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK 0x00000007
942 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_SHIFT 0
943 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_PXE 0x00000000
944 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_RPL 0x00000001
945 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_BOOTP 0x00000002
946 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_ISCSIB 0x00000003
947 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_FCOE_BOOT 0x00000004
948 #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_NONE 0x00000007
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200949
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300950 #define PORT_FEATURE_MBA_BOOT_RETRY_MASK 0x00000038
951 #define PORT_FEATURE_MBA_BOOT_RETRY_SHIFT 3
952
953 #define PORT_FEATURE_MBA_RES_PAUSE_CAP 0x00000100
954 #define PORT_FEATURE_MBA_RES_ASYM_PAUSE_CAP 0x00000200
955 #define PORT_FEATURE_MBA_SETUP_PROMPT_ENABLE 0x00000400
956 #define PORT_FEATURE_MBA_HOTKEY_MASK 0x00000800
957 #define PORT_FEATURE_MBA_HOTKEY_CTRL_S 0x00000000
958 #define PORT_FEATURE_MBA_HOTKEY_CTRL_B 0x00000800
959 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_MASK 0x000ff000
960 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_SHIFT 12
961 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_DISABLED 0x00000000
962 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_2K 0x00001000
963 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_4K 0x00002000
964 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_8K 0x00003000
965 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_16K 0x00004000
966 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_32K 0x00005000
967 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_64K 0x00006000
968 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_128K 0x00007000
969 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_256K 0x00008000
970 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_512K 0x00009000
971 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_1M 0x0000a000
972 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_2M 0x0000b000
973 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_4M 0x0000c000
974 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_8M 0x0000d000
975 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_16M 0x0000e000
976 #define PORT_FEATURE_MBA_EXP_ROM_SIZE_32M 0x0000f000
977 #define PORT_FEATURE_MBA_MSG_TIMEOUT_MASK 0x00f00000
978 #define PORT_FEATURE_MBA_MSG_TIMEOUT_SHIFT 20
979 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_MASK 0x03000000
980 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_SHIFT 24
981 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_AUTO 0x00000000
982 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_BBS 0x01000000
983 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT18H 0x02000000
984 #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT19H 0x03000000
985 #define PORT_FEATURE_MBA_LINK_SPEED_MASK 0x3c000000
986 #define PORT_FEATURE_MBA_LINK_SPEED_SHIFT 26
987 #define PORT_FEATURE_MBA_LINK_SPEED_AUTO 0x00000000
988 #define PORT_FEATURE_MBA_LINK_SPEED_10HD 0x04000000
989 #define PORT_FEATURE_MBA_LINK_SPEED_10FD 0x08000000
990 #define PORT_FEATURE_MBA_LINK_SPEED_100HD 0x0c000000
991 #define PORT_FEATURE_MBA_LINK_SPEED_100FD 0x10000000
992 #define PORT_FEATURE_MBA_LINK_SPEED_1GBPS 0x14000000
993 #define PORT_FEATURE_MBA_LINK_SPEED_2_5GBPS 0x18000000
994 #define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_CX4 0x1c000000
995 #define PORT_FEATURE_MBA_LINK_SPEED_20GBPS 0x20000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +0200996 u32 bmc_config;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300997 #define PORT_FEATURE_BMC_LINK_OVERRIDE_MASK 0x00000001
998 #define PORT_FEATURE_BMC_LINK_OVERRIDE_DEFAULT 0x00000000
999 #define PORT_FEATURE_BMC_LINK_OVERRIDE_EN 0x00000001
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001000
1001 u32 mba_vlan_cfg;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001002 #define PORT_FEATURE_MBA_VLAN_TAG_MASK 0x0000ffff
1003 #define PORT_FEATURE_MBA_VLAN_TAG_SHIFT 0
1004 #define PORT_FEATURE_MBA_VLAN_EN 0x00010000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001005
1006 u32 resource_cfg;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001007 #define PORT_FEATURE_RESOURCE_CFG_VALID 0x00000001
1008 #define PORT_FEATURE_RESOURCE_CFG_DIAG 0x00000002
1009 #define PORT_FEATURE_RESOURCE_CFG_L2 0x00000004
1010 #define PORT_FEATURE_RESOURCE_CFG_ISCSI 0x00000008
1011 #define PORT_FEATURE_RESOURCE_CFG_RDMA 0x00000010
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001012
1013 u32 smbus_config;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001014 #define PORT_FEATURE_SMBUS_ADDR_MASK 0x000000fe
1015 #define PORT_FEATURE_SMBUS_ADDR_SHIFT 1
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001016
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001017 u32 vf_config;
1018 #define PORT_FEAT_CFG_VF_BAR2_SIZE_MASK 0x0000000f
1019 #define PORT_FEAT_CFG_VF_BAR2_SIZE_SHIFT 0
1020 #define PORT_FEAT_CFG_VF_BAR2_SIZE_DISABLED 0x00000000
1021 #define PORT_FEAT_CFG_VF_BAR2_SIZE_4K 0x00000001
1022 #define PORT_FEAT_CFG_VF_BAR2_SIZE_8K 0x00000002
1023 #define PORT_FEAT_CFG_VF_BAR2_SIZE_16K 0x00000003
1024 #define PORT_FEAT_CFG_VF_BAR2_SIZE_32K 0x00000004
1025 #define PORT_FEAT_CFG_VF_BAR2_SIZE_64K 0x00000005
1026 #define PORT_FEAT_CFG_VF_BAR2_SIZE_128K 0x00000006
1027 #define PORT_FEAT_CFG_VF_BAR2_SIZE_256K 0x00000007
1028 #define PORT_FEAT_CFG_VF_BAR2_SIZE_512K 0x00000008
1029 #define PORT_FEAT_CFG_VF_BAR2_SIZE_1M 0x00000009
1030 #define PORT_FEAT_CFG_VF_BAR2_SIZE_2M 0x0000000a
1031 #define PORT_FEAT_CFG_VF_BAR2_SIZE_4M 0x0000000b
1032 #define PORT_FEAT_CFG_VF_BAR2_SIZE_8M 0x0000000c
1033 #define PORT_FEAT_CFG_VF_BAR2_SIZE_16M 0x0000000d
1034 #define PORT_FEAT_CFG_VF_BAR2_SIZE_32M 0x0000000e
1035 #define PORT_FEAT_CFG_VF_BAR2_SIZE_64M 0x0000000f
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001036
1037 u32 link_config; /* Used as HW defaults for the driver */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001038 #define PORT_FEATURE_CONNECTED_SWITCH_MASK 0x03000000
1039 #define PORT_FEATURE_CONNECTED_SWITCH_SHIFT 24
1040 /* (forced) low speed switch (< 10G) */
1041 #define PORT_FEATURE_CON_SWITCH_1G_SWITCH 0x00000000
1042 /* (forced) high speed switch (>= 10G) */
1043 #define PORT_FEATURE_CON_SWITCH_10G_SWITCH 0x01000000
1044 #define PORT_FEATURE_CON_SWITCH_AUTO_DETECT 0x02000000
1045 #define PORT_FEATURE_CON_SWITCH_ONE_TIME_DETECT 0x03000000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001046
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001047 #define PORT_FEATURE_LINK_SPEED_MASK 0x000f0000
1048 #define PORT_FEATURE_LINK_SPEED_SHIFT 16
1049 #define PORT_FEATURE_LINK_SPEED_AUTO 0x00000000
1050 #define PORT_FEATURE_LINK_SPEED_10M_FULL 0x00010000
1051 #define PORT_FEATURE_LINK_SPEED_10M_HALF 0x00020000
1052 #define PORT_FEATURE_LINK_SPEED_100M_HALF 0x00030000
1053 #define PORT_FEATURE_LINK_SPEED_100M_FULL 0x00040000
1054 #define PORT_FEATURE_LINK_SPEED_1G 0x00050000
1055 #define PORT_FEATURE_LINK_SPEED_2_5G 0x00060000
1056 #define PORT_FEATURE_LINK_SPEED_10G_CX4 0x00070000
1057 #define PORT_FEATURE_LINK_SPEED_20G 0x00080000
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001058
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001059 #define PORT_FEATURE_FLOW_CONTROL_MASK 0x00000700
1060 #define PORT_FEATURE_FLOW_CONTROL_SHIFT 8
1061 #define PORT_FEATURE_FLOW_CONTROL_AUTO 0x00000000
1062 #define PORT_FEATURE_FLOW_CONTROL_TX 0x00000100
1063 #define PORT_FEATURE_FLOW_CONTROL_RX 0x00000200
1064 #define PORT_FEATURE_FLOW_CONTROL_BOTH 0x00000300
1065 #define PORT_FEATURE_FLOW_CONTROL_NONE 0x00000400
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001066
1067 /* The default for MCP link configuration,
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001068 uses the same defines as link_config */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001069 u32 mfw_wol_link_cfg;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001070
Yaniv Rosnera22f0782010-09-07 11:41:20 +00001071 /* The default for the driver of the second external phy,
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001072 uses the same defines as link_config */
1073 u32 link_config2; /* 0x47C */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001074
Yaniv Rosnera22f0782010-09-07 11:41:20 +00001075 /* The default for MCP of the second external phy,
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001076 uses the same defines as link_config */
1077 u32 mfw_wol_link_cfg2; /* 0x480 */
Yaniv Rosnera22f0782010-09-07 11:41:20 +00001078
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001079
Yuval Mintzc8c60d82012-06-06 17:13:07 +00001080 /* EEE power saving mode */
1081 u32 eee_power_mode; /* 0x484 */
1082 #define PORT_FEAT_CFG_EEE_POWER_MODE_MASK 0x000000FF
1083 #define PORT_FEAT_CFG_EEE_POWER_MODE_SHIFT 0
1084 #define PORT_FEAT_CFG_EEE_POWER_MODE_DISABLED 0x00000000
1085 #define PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED 0x00000001
1086 #define PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE 0x00000002
1087 #define PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY 0x00000003
1088
1089
1090 u32 Reserved2[16]; /* 0x488 */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001091};
1092
1093
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001094/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001095 * Device Information *
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001096 ****************************************************************************/
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001097struct shm_dev_info { /* size */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001098
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001099 u32 bc_rev; /* 8 bits each: major, minor, build */ /* 4 */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001100
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001101 struct shared_hw_cfg shared_hw_config; /* 40 */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001102
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001103 struct port_hw_cfg port_hw_config[PORT_MAX]; /* 400*2=800 */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001104
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001105 struct shared_feat_cfg shared_feature_config; /* 4 */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001106
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001107 struct port_feat_cfg port_feature_config[PORT_MAX];/* 116*2=232 */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001108
1109};
1110
1111
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001112#if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
1113 #error "Missing either LITTLE_ENDIAN or BIG_ENDIAN definition."
1114#endif
Eilon Greensteinad8d3942008-06-23 20:29:02 -07001115
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001116#define FUNC_0 0
1117#define FUNC_1 1
1118#define FUNC_2 2
1119#define FUNC_3 3
1120#define FUNC_4 4
1121#define FUNC_5 5
1122#define FUNC_6 6
1123#define FUNC_7 7
1124#define E1_FUNC_MAX 2
1125#define E1H_FUNC_MAX 8
1126#define E2_FUNC_MAX 4 /* per path */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001127
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001128#define VN_0 0
1129#define VN_1 1
1130#define VN_2 2
1131#define VN_3 3
1132#define E1VN_MAX 1
1133#define E1HVN_MAX 4
1134
1135#define E2_VF_MAX 64 /* HC_REG_VF_CONFIGURATION_SIZE */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001136/* This value (in milliseconds) determines the frequency of the driver
1137 * issuing the PULSE message code. The firmware monitors this periodic
1138 * pulse to determine when to switch to an OS-absent mode. */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001139#define DRV_PULSE_PERIOD_MS 250
Eliezer Tamirf1410642008-02-28 11:51:50 -08001140
1141/* This value (in milliseconds) determines how long the driver should
1142 * wait for an acknowledgement from the firmware before timing out. Once
1143 * the firmware has timed out, the driver will assume there is no firmware
1144 * running and there won't be any firmware-driver synchronization during a
1145 * driver reset. */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001146#define FW_ACK_TIME_OUT_MS 5000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001147
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001148#define FW_ACK_POLL_TIME_MS 1
Eliezer Tamirf1410642008-02-28 11:51:50 -08001149
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001150#define FW_ACK_NUM_OF_POLL (FW_ACK_TIME_OUT_MS/FW_ACK_POLL_TIME_MS)
Eliezer Tamirf1410642008-02-28 11:51:50 -08001151
Dmitry Kravkovde128802012-03-18 10:33:45 +00001152#define MFW_TRACE_SIGNATURE 0x54524342
1153
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001154/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001155 * Driver <-> FW Mailbox *
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001156 ****************************************************************************/
Eliezer Tamirf1410642008-02-28 11:51:50 -08001157struct drv_port_mb {
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001158
Eliezer Tamirf1410642008-02-28 11:51:50 -08001159 u32 link_status;
1160 /* Driver should update this field on any link change event */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001161
Yuval Mintzd0b8a6f2012-06-20 19:05:18 +00001162 #define LINK_STATUS_NONE (0<<0)
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001163 #define LINK_STATUS_LINK_FLAG_MASK 0x00000001
1164 #define LINK_STATUS_LINK_UP 0x00000001
1165 #define LINK_STATUS_SPEED_AND_DUPLEX_MASK 0x0000001E
1166 #define LINK_STATUS_SPEED_AND_DUPLEX_AN_NOT_COMPLETE (0<<1)
1167 #define LINK_STATUS_SPEED_AND_DUPLEX_10THD (1<<1)
1168 #define LINK_STATUS_SPEED_AND_DUPLEX_10TFD (2<<1)
1169 #define LINK_STATUS_SPEED_AND_DUPLEX_100TXHD (3<<1)
1170 #define LINK_STATUS_SPEED_AND_DUPLEX_100T4 (4<<1)
1171 #define LINK_STATUS_SPEED_AND_DUPLEX_100TXFD (5<<1)
1172 #define LINK_STATUS_SPEED_AND_DUPLEX_1000THD (6<<1)
1173 #define LINK_STATUS_SPEED_AND_DUPLEX_1000TFD (7<<1)
1174 #define LINK_STATUS_SPEED_AND_DUPLEX_1000XFD (7<<1)
1175 #define LINK_STATUS_SPEED_AND_DUPLEX_2500THD (8<<1)
1176 #define LINK_STATUS_SPEED_AND_DUPLEX_2500TFD (9<<1)
1177 #define LINK_STATUS_SPEED_AND_DUPLEX_2500XFD (9<<1)
1178 #define LINK_STATUS_SPEED_AND_DUPLEX_10GTFD (10<<1)
1179 #define LINK_STATUS_SPEED_AND_DUPLEX_10GXFD (10<<1)
1180 #define LINK_STATUS_SPEED_AND_DUPLEX_20GTFD (11<<1)
1181 #define LINK_STATUS_SPEED_AND_DUPLEX_20GXFD (11<<1)
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001182
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001183 #define LINK_STATUS_AUTO_NEGOTIATE_FLAG_MASK 0x00000020
1184 #define LINK_STATUS_AUTO_NEGOTIATE_ENABLED 0x00000020
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001185
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001186 #define LINK_STATUS_AUTO_NEGOTIATE_COMPLETE 0x00000040
1187 #define LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK 0x00000080
1188 #define LINK_STATUS_PARALLEL_DETECTION_USED 0x00000080
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001189
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001190 #define LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE 0x00000200
1191 #define LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE 0x00000400
1192 #define LINK_STATUS_LINK_PARTNER_100T4_CAPABLE 0x00000800
1193 #define LINK_STATUS_LINK_PARTNER_100TXFD_CAPABLE 0x00001000
1194 #define LINK_STATUS_LINK_PARTNER_100TXHD_CAPABLE 0x00002000
1195 #define LINK_STATUS_LINK_PARTNER_10TFD_CAPABLE 0x00004000
1196 #define LINK_STATUS_LINK_PARTNER_10THD_CAPABLE 0x00008000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001197
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001198 #define LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK 0x00010000
1199 #define LINK_STATUS_TX_FLOW_CONTROL_ENABLED 0x00010000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001200
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001201 #define LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK 0x00020000
1202 #define LINK_STATUS_RX_FLOW_CONTROL_ENABLED 0x00020000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001203
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001204 #define LINK_STATUS_LINK_PARTNER_FLOW_CONTROL_MASK 0x000C0000
1205 #define LINK_STATUS_LINK_PARTNER_NOT_PAUSE_CAPABLE (0<<18)
1206 #define LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE (1<<18)
1207 #define LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE (2<<18)
1208 #define LINK_STATUS_LINK_PARTNER_BOTH_PAUSE (3<<18)
Eliezer Tamirf1410642008-02-28 11:51:50 -08001209
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001210 #define LINK_STATUS_SERDES_LINK 0x00100000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001211
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001212 #define LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE 0x00200000
1213 #define LINK_STATUS_LINK_PARTNER_2500XHD_CAPABLE 0x00400000
1214 #define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE 0x00800000
1215 #define LINK_STATUS_LINK_PARTNER_20GXFD_CAPABLE 0x10000000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001216
Yaniv Rosnerb8d6d082011-07-05 01:06:27 +00001217 #define LINK_STATUS_PFC_ENABLED 0x20000000
1218
Yaniv Rosnerde6f3372011-08-02 22:59:25 +00001219 #define LINK_STATUS_PHYSICAL_LINK_FLAG 0x40000000
Yuval Mintzd0b8a6f2012-06-20 19:05:18 +00001220 #define LINK_STATUS_SFP_TX_FAULT 0x80000000
Yaniv Rosnerde6f3372011-08-02 22:59:25 +00001221
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001222 u32 port_stx;
1223
Eilon Greensteinde832a52009-02-12 08:36:33 +00001224 u32 stat_nig_timer;
1225
Eilon Greensteina35da8d2009-02-12 08:37:02 +00001226 /* MCP firmware does not use this field */
1227 u32 ext_phy_fw_version;
Eliezer Tamirf1410642008-02-28 11:51:50 -08001228
1229};
1230
1231
1232struct drv_func_mb {
1233
1234 u32 drv_mb_header;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001235 #define DRV_MSG_CODE_MASK 0xffff0000
1236 #define DRV_MSG_CODE_LOAD_REQ 0x10000000
1237 #define DRV_MSG_CODE_LOAD_DONE 0x11000000
1238 #define DRV_MSG_CODE_UNLOAD_REQ_WOL_EN 0x20000000
1239 #define DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS 0x20010000
1240 #define DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP 0x20020000
1241 #define DRV_MSG_CODE_UNLOAD_DONE 0x21000000
1242 #define DRV_MSG_CODE_DCC_OK 0x30000000
1243 #define DRV_MSG_CODE_DCC_FAILURE 0x31000000
1244 #define DRV_MSG_CODE_DIAG_ENTER_REQ 0x50000000
1245 #define DRV_MSG_CODE_DIAG_EXIT_REQ 0x60000000
1246 #define DRV_MSG_CODE_VALIDATE_KEY 0x70000000
1247 #define DRV_MSG_CODE_GET_CURR_KEY 0x80000000
1248 #define DRV_MSG_CODE_GET_UPGRADE_KEY 0x81000000
1249 #define DRV_MSG_CODE_GET_MANUF_KEY 0x82000000
1250 #define DRV_MSG_CODE_LOAD_L2B_PRAM 0x90000000
Eilon Greenstein4d295db2009-07-21 05:47:47 +00001251 /*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001252 * The optic module verification command requires bootcode
1253 * v5.0.6 or later, te specific optic module verification command
1254 * requires bootcode v5.2.12 or later
Eilon Greenstein4d295db2009-07-21 05:47:47 +00001255 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001256 #define DRV_MSG_CODE_VRFY_FIRST_PHY_OPT_MDL 0xa0000000
1257 #define REQ_BC_VER_4_VRFY_FIRST_PHY_OPT_MDL 0x00050006
1258 #define DRV_MSG_CODE_VRFY_SPECIFIC_PHY_OPT_MDL 0xa1000000
1259 #define REQ_BC_VER_4_VRFY_SPECIFIC_PHY_OPT_MDL 0x00050234
Barak Witkowskia3348722012-04-23 03:04:46 +00001260 #define DRV_MSG_CODE_VRFY_AFEX_SUPPORTED 0xa2000000
1261 #define REQ_BC_VER_4_VRFY_AFEX_SUPPORTED 0x00070002
Yaniv Rosner85242ee2011-07-05 01:06:53 +00001262 #define REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED 0x00070014
Yaniv Rosner55386fe82012-11-27 03:46:30 +00001263 #define REQ_BC_VER_4_MT_SUPPORTED 0x00070201
Barak Witkowski0e898dd2011-12-05 21:52:22 +00001264 #define REQ_BC_VER_4_PFC_STATS_SUPPORTED 0x00070201
Barak Witkowski2e499d32012-06-26 01:31:19 +00001265 #define REQ_BC_VER_4_FCOE_FEATURES 0x00070209
Eliezer Tamirf1410642008-02-28 11:51:50 -08001266
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001267 #define DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG 0xb0000000
1268 #define DRV_MSG_CODE_DCBX_PMF_DRV_OK 0xb2000000
Barak Witkowski98768792012-06-19 07:48:31 +00001269 #define REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF 0x00070401
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001270
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001271 #define DRV_MSG_CODE_VF_DISABLED_DONE 0xc0000000
Barak Witkowskia3348722012-04-23 03:04:46 +00001272
1273 #define DRV_MSG_CODE_AFEX_DRIVER_SETMAC 0xd0000000
1274 #define DRV_MSG_CODE_AFEX_LISTGET_ACK 0xd1000000
1275 #define DRV_MSG_CODE_AFEX_LISTSET_ACK 0xd2000000
1276 #define DRV_MSG_CODE_AFEX_STATSGET_ACK 0xd3000000
1277 #define DRV_MSG_CODE_AFEX_VIFSET_ACK 0xd4000000
1278
Barak Witkowski1d187b32011-12-05 22:41:50 +00001279 #define DRV_MSG_CODE_DRV_INFO_ACK 0xd8000000
1280 #define DRV_MSG_CODE_DRV_INFO_NACK 0xd9000000
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001281
Yuval Mintzc8c60d82012-06-06 17:13:07 +00001282 #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000
1283
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001284 #define DRV_MSG_CODE_SET_MF_BW 0xe0000000
1285 #define REQ_BC_VER_4_SET_MF_BW 0x00060202
1286 #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000
1287
1288 #define DRV_MSG_CODE_LINK_STATUS_CHANGED 0x01000000
1289
Yuval Mintz452427b2012-03-26 20:47:07 +00001290 #define DRV_MSG_CODE_INITIATE_FLR 0x02000000
1291 #define REQ_BC_VER_4_INITIATE_FLR 0x00070213
1292
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001293 #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000
1294 #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000
1295 #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000
1296 #define BIOS_MSG_CODE_VIRT_MAC_ISCSI 0xff040000
1297
1298 #define DRV_MSG_SEQ_NUMBER_MASK 0x0000ffff
Eliezer Tamirf1410642008-02-28 11:51:50 -08001299
1300 u32 drv_mb_param;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001301 #define DRV_MSG_CODE_SET_MF_BW_MIN_MASK 0x00ff0000
1302 #define DRV_MSG_CODE_SET_MF_BW_MAX_MASK 0xff000000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001303
Yuval Mintz5d07d862012-09-13 02:56:21 +00001304 #define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET 0x00000002
1305
1306 #define DRV_MSG_CODE_LOAD_REQ_WITH_LFA 0x0000100a
Eliezer Tamirf1410642008-02-28 11:51:50 -08001307 u32 fw_mb_header;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001308 #define FW_MSG_CODE_MASK 0xffff0000
1309 #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000
1310 #define FW_MSG_CODE_DRV_LOAD_PORT 0x10110000
1311 #define FW_MSG_CODE_DRV_LOAD_FUNCTION 0x10120000
1312 /* Load common chip is supported from bc 6.0.0 */
1313 #define REQ_BC_VER_4_DRV_LOAD_COMMON_CHIP 0x00060000
1314 #define FW_MSG_CODE_DRV_LOAD_COMMON_CHIP 0x10130000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001315
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001316 #define FW_MSG_CODE_DRV_LOAD_REFUSED 0x10200000
1317 #define FW_MSG_CODE_DRV_LOAD_DONE 0x11100000
1318 #define FW_MSG_CODE_DRV_UNLOAD_COMMON 0x20100000
1319 #define FW_MSG_CODE_DRV_UNLOAD_PORT 0x20110000
1320 #define FW_MSG_CODE_DRV_UNLOAD_FUNCTION 0x20120000
1321 #define FW_MSG_CODE_DRV_UNLOAD_DONE 0x21100000
1322 #define FW_MSG_CODE_DCC_DONE 0x30100000
1323 #define FW_MSG_CODE_LLDP_DONE 0x40100000
1324 #define FW_MSG_CODE_DIAG_ENTER_DONE 0x50100000
1325 #define FW_MSG_CODE_DIAG_REFUSE 0x50200000
1326 #define FW_MSG_CODE_DIAG_EXIT_DONE 0x60100000
1327 #define FW_MSG_CODE_VALIDATE_KEY_SUCCESS 0x70100000
1328 #define FW_MSG_CODE_VALIDATE_KEY_FAILURE 0x70200000
1329 #define FW_MSG_CODE_GET_KEY_DONE 0x80100000
1330 #define FW_MSG_CODE_NO_KEY 0x80f00000
1331 #define FW_MSG_CODE_LIC_INFO_NOT_READY 0x80f80000
1332 #define FW_MSG_CODE_L2B_PRAM_LOADED 0x90100000
1333 #define FW_MSG_CODE_L2B_PRAM_T_LOAD_FAILURE 0x90210000
1334 #define FW_MSG_CODE_L2B_PRAM_C_LOAD_FAILURE 0x90220000
1335 #define FW_MSG_CODE_L2B_PRAM_X_LOAD_FAILURE 0x90230000
1336 #define FW_MSG_CODE_L2B_PRAM_U_LOAD_FAILURE 0x90240000
1337 #define FW_MSG_CODE_VRFY_OPT_MDL_SUCCESS 0xa0100000
1338 #define FW_MSG_CODE_VRFY_OPT_MDL_INVLD_IMG 0xa0200000
1339 #define FW_MSG_CODE_VRFY_OPT_MDL_UNAPPROVED 0xa0300000
1340 #define FW_MSG_CODE_VF_DISABLED_DONE 0xb0000000
Barak Witkowskia3348722012-04-23 03:04:46 +00001341 #define FW_MSG_CODE_HW_SET_INVALID_IMAGE 0xb0100000
1342
1343 #define FW_MSG_CODE_AFEX_DRIVER_SETMAC_DONE 0xd0100000
1344 #define FW_MSG_CODE_AFEX_LISTGET_ACK 0xd1100000
1345 #define FW_MSG_CODE_AFEX_LISTSET_ACK 0xd2100000
1346 #define FW_MSG_CODE_AFEX_STATSGET_ACK 0xd3100000
1347 #define FW_MSG_CODE_AFEX_VIFSET_ACK 0xd4100000
1348
Barak Witkowski1d187b32011-12-05 22:41:50 +00001349 #define FW_MSG_CODE_DRV_INFO_ACK 0xd8100000
1350 #define FW_MSG_CODE_DRV_INFO_NACK 0xd9100000
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001351
Yuval Mintzc8c60d82012-06-06 17:13:07 +00001352 #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000
1353
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001354 #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000
1355 #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000
1356
1357 #define FW_MSG_CODE_LINK_CHANGED_ACK 0x01100000
1358
1359 #define FW_MSG_CODE_LIC_CHALLENGE 0xff010000
1360 #define FW_MSG_CODE_LIC_RESPONSE 0xff020000
1361 #define FW_MSG_CODE_VIRT_MAC_PRIM 0xff030000
1362 #define FW_MSG_CODE_VIRT_MAC_ISCSI 0xff040000
1363
1364 #define FW_MSG_SEQ_NUMBER_MASK 0x0000ffff
Eliezer Tamirf1410642008-02-28 11:51:50 -08001365
1366 u32 fw_mb_param;
1367
1368 u32 drv_pulse_mb;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001369 #define DRV_PULSE_SEQ_MASK 0x00007fff
1370 #define DRV_PULSE_SYSTEM_TIME_MASK 0xffff0000
1371 /*
1372 * The system time is in the format of
1373 * (year-2001)*12*32 + month*32 + day.
1374 */
1375 #define DRV_PULSE_ALWAYS_ALIVE 0x00008000
1376 /*
1377 * Indicate to the firmware not to go into the
Eliezer Tamirf1410642008-02-28 11:51:50 -08001378 * OS-absent when it is not getting driver pulse.
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001379 * This is used for debugging as well for PXE(MBA).
1380 */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001381
1382 u32 mcp_pulse_mb;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001383 #define MCP_PULSE_SEQ_MASK 0x00007fff
1384 #define MCP_PULSE_ALWAYS_ALIVE 0x00008000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001385 /* Indicates to the driver not to assert due to lack
1386 * of MCP response */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001387 #define MCP_EVENT_MASK 0xffff0000
1388 #define MCP_EVENT_OTHER_DRIVER_RESET_REQ 0x00010000
Eliezer Tamirf1410642008-02-28 11:51:50 -08001389
1390 u32 iscsi_boot_signature;
1391 u32 iscsi_boot_block_offset;
1392
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001393 u32 drv_status;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001394 #define DRV_STATUS_PMF 0x00000001
1395 #define DRV_STATUS_VF_DISABLED 0x00000002
1396 #define DRV_STATUS_SET_MF_BW 0x00000004
1397 #define DRV_STATUS_LINK_EVENT 0x00000008
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001398
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001399 #define DRV_STATUS_DCC_EVENT_MASK 0x0000ff00
1400 #define DRV_STATUS_DCC_DISABLE_ENABLE_PF 0x00000100
1401 #define DRV_STATUS_DCC_BANDWIDTH_ALLOCATION 0x00000200
1402 #define DRV_STATUS_DCC_CHANGE_MAC_ADDRESS 0x00000400
1403 #define DRV_STATUS_DCC_RESERVED1 0x00000800
1404 #define DRV_STATUS_DCC_SET_PROTOCOL 0x00001000
1405 #define DRV_STATUS_DCC_SET_PRIORITY 0x00002000
1406
1407 #define DRV_STATUS_DCBX_EVENT_MASK 0x000f0000
1408 #define DRV_STATUS_DCBX_NEGOTIATION_RESULTS 0x00010000
Barak Witkowskia3348722012-04-23 03:04:46 +00001409 #define DRV_STATUS_AFEX_EVENT_MASK 0x03f00000
1410 #define DRV_STATUS_AFEX_LISTGET_REQ 0x00100000
1411 #define DRV_STATUS_AFEX_LISTSET_REQ 0x00200000
1412 #define DRV_STATUS_AFEX_STATSGET_REQ 0x00400000
1413 #define DRV_STATUS_AFEX_VIFSET_REQ 0x00800000
1414
Barak Witkowski1d187b32011-12-05 22:41:50 +00001415 #define DRV_STATUS_DRV_INFO_REQ 0x04000000
Eilon Greenstein2691d512009-08-12 08:22:08 +00001416
Yuval Mintzc8c60d82012-06-06 17:13:07 +00001417 #define DRV_STATUS_EEE_NEGOTIATION_RESULTS 0x08000000
1418
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001419 u32 virt_mac_upper;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001420 #define VIRT_MAC_SIGN_MASK 0xffff0000
1421 #define VIRT_MAC_SIGNATURE 0x564d0000
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001422 u32 virt_mac_lower;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001423
1424};
1425
1426
1427/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001428 * Management firmware state *
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001429 ****************************************************************************/
Eliezer Tamirf1410642008-02-28 11:51:50 -08001430/* Allocate 440 bytes for management firmware */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001431#define MGMTFW_STATE_WORD_SIZE 110
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001432
1433struct mgmtfw_state {
1434 u32 opaque[MGMTFW_STATE_WORD_SIZE];
1435};
1436
1437
1438/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001439 * Multi-Function configuration *
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001440 ****************************************************************************/
1441struct shared_mf_cfg {
1442
1443 u32 clp_mb;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001444 #define SHARED_MF_CLP_SET_DEFAULT 0x00000000
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001445 /* set by CLP */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001446 #define SHARED_MF_CLP_EXIT 0x00000001
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001447 /* set by MCP */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001448 #define SHARED_MF_CLP_EXIT_DONE 0x00010000
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001449
1450};
1451
1452struct port_mf_cfg {
1453
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001454 u32 dynamic_cfg; /* device control channel */
1455 #define PORT_MF_CFG_E1HOV_TAG_MASK 0x0000ffff
1456 #define PORT_MF_CFG_E1HOV_TAG_SHIFT 0
1457 #define PORT_MF_CFG_E1HOV_TAG_DEFAULT PORT_MF_CFG_E1HOV_TAG_MASK
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001458
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00001459 u32 reserved[1];
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001460
1461};
1462
1463struct func_mf_cfg {
1464
1465 u32 config;
1466 /* E/R/I/D */
1467 /* function 0 of each port cannot be hidden */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001468 #define FUNC_MF_CFG_FUNC_HIDE 0x00000001
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001469
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001470 #define FUNC_MF_CFG_PROTOCOL_MASK 0x00000006
1471 #define FUNC_MF_CFG_PROTOCOL_FCOE 0x00000000
1472 #define FUNC_MF_CFG_PROTOCOL_ETHERNET 0x00000002
1473 #define FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA 0x00000004
1474 #define FUNC_MF_CFG_PROTOCOL_ISCSI 0x00000006
1475 #define FUNC_MF_CFG_PROTOCOL_DEFAULT \
1476 FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001477
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001478 #define FUNC_MF_CFG_FUNC_DISABLED 0x00000008
1479 #define FUNC_MF_CFG_FUNC_DELETED 0x00000010
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001480
1481 /* PRI */
1482 /* 0 - low priority, 3 - high priority */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001483 #define FUNC_MF_CFG_TRANSMIT_PRIORITY_MASK 0x00000300
1484 #define FUNC_MF_CFG_TRANSMIT_PRIORITY_SHIFT 8
1485 #define FUNC_MF_CFG_TRANSMIT_PRIORITY_DEFAULT 0x00000000
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001486
1487 /* MINBW, MAXBW */
1488 /* value range - 0..100, increments in 100Mbps */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001489 #define FUNC_MF_CFG_MIN_BW_MASK 0x00ff0000
1490 #define FUNC_MF_CFG_MIN_BW_SHIFT 16
1491 #define FUNC_MF_CFG_MIN_BW_DEFAULT 0x00000000
1492 #define FUNC_MF_CFG_MAX_BW_MASK 0xff000000
1493 #define FUNC_MF_CFG_MAX_BW_SHIFT 24
1494 #define FUNC_MF_CFG_MAX_BW_DEFAULT 0x64000000
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001495
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001496 u32 mac_upper; /* MAC */
1497 #define FUNC_MF_CFG_UPPERMAC_MASK 0x0000ffff
1498 #define FUNC_MF_CFG_UPPERMAC_SHIFT 0
1499 #define FUNC_MF_CFG_UPPERMAC_DEFAULT FUNC_MF_CFG_UPPERMAC_MASK
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001500 u32 mac_lower;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001501 #define FUNC_MF_CFG_LOWERMAC_DEFAULT 0xffffffff
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001502
1503 u32 e1hov_tag; /* VNI */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001504 #define FUNC_MF_CFG_E1HOV_TAG_MASK 0x0000ffff
1505 #define FUNC_MF_CFG_E1HOV_TAG_SHIFT 0
1506 #define FUNC_MF_CFG_E1HOV_TAG_DEFAULT FUNC_MF_CFG_E1HOV_TAG_MASK
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001507
Barak Witkowskia3348722012-04-23 03:04:46 +00001508 /* afex default VLAN ID - 12 bits */
1509 #define FUNC_MF_CFG_AFEX_VLAN_MASK 0x0fff0000
1510 #define FUNC_MF_CFG_AFEX_VLAN_SHIFT 16
1511
1512 u32 afex_config;
1513 #define FUNC_MF_CFG_AFEX_COS_FILTER_MASK 0x000000ff
1514 #define FUNC_MF_CFG_AFEX_COS_FILTER_SHIFT 0
1515 #define FUNC_MF_CFG_AFEX_MBA_ENABLED_MASK 0x0000ff00
1516 #define FUNC_MF_CFG_AFEX_MBA_ENABLED_SHIFT 8
1517 #define FUNC_MF_CFG_AFEX_MBA_ENABLED_VAL 0x00000100
1518 #define FUNC_MF_CFG_AFEX_VLAN_MODE_MASK 0x000f0000
1519 #define FUNC_MF_CFG_AFEX_VLAN_MODE_SHIFT 16
1520
1521 u32 reserved;
1522};
1523
1524enum mf_cfg_afex_vlan_mode {
1525 FUNC_MF_CFG_AFEX_VLAN_TRUNK_MODE = 0,
1526 FUNC_MF_CFG_AFEX_VLAN_ACCESS_MODE,
1527 FUNC_MF_CFG_AFEX_VLAN_TRUNK_TAG_NATIVE_MODE
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001528};
1529
Dmitry Kravkov0793f83f2010-12-01 12:39:28 -08001530/* This structure is not applicable and should not be accessed on 57711 */
1531struct func_ext_cfg {
1532 u32 func_cfg;
Yuval Mintz79642112012-12-02 04:05:50 +00001533 #define MACP_FUNC_CFG_FLAGS_MASK 0x0000007F
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001534 #define MACP_FUNC_CFG_FLAGS_SHIFT 0
1535 #define MACP_FUNC_CFG_FLAGS_ENABLED 0x00000001
1536 #define MACP_FUNC_CFG_FLAGS_ETHERNET 0x00000002
1537 #define MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD 0x00000004
1538 #define MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD 0x00000008
Yuval Mintz79642112012-12-02 04:05:50 +00001539 #define MACP_FUNC_CFG_PAUSE_ON_HOST_RING 0x00000080
Dmitry Kravkov0793f83f2010-12-01 12:39:28 -08001540
1541 u32 iscsi_mac_addr_upper;
1542 u32 iscsi_mac_addr_lower;
1543
1544 u32 fcoe_mac_addr_upper;
1545 u32 fcoe_mac_addr_lower;
1546
1547 u32 fcoe_wwn_port_name_upper;
1548 u32 fcoe_wwn_port_name_lower;
1549
1550 u32 fcoe_wwn_node_name_upper;
1551 u32 fcoe_wwn_node_name_lower;
1552
1553 u32 preserve_data;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001554 #define MF_FUNC_CFG_PRESERVE_L2_MAC (1<<0)
1555 #define MF_FUNC_CFG_PRESERVE_ISCSI_MAC (1<<1)
1556 #define MF_FUNC_CFG_PRESERVE_FCOE_MAC (1<<2)
1557 #define MF_FUNC_CFG_PRESERVE_FCOE_WWN_P (1<<3)
1558 #define MF_FUNC_CFG_PRESERVE_FCOE_WWN_N (1<<4)
1559 #define MF_FUNC_CFG_PRESERVE_TX_BW (1<<5)
Dmitry Kravkov0793f83f2010-12-01 12:39:28 -08001560};
1561
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001562struct mf_cfg {
1563
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001564 struct shared_mf_cfg shared_mf_config; /* 0x4 */
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00001565 /* 0x8*2*2=0x20 */
1566 struct port_mf_cfg port_mf_config[NVM_PATH_MAX][PORT_MAX];
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001567 /* for all chips, there are 8 mf functions */
1568 struct func_mf_cfg func_mf_config[E1H_FUNC_MAX]; /* 0x18 * 8 = 0xc0 */
1569 /*
1570 * Extended configuration per function - this array does not exist and
1571 * should not be accessed on 57711
1572 */
1573 struct func_ext_cfg func_ext_config[E1H_FUNC_MAX]; /* 0x28 * 8 = 0x140*/
1574}; /* 0x224 */
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001575
1576/****************************************************************************
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001577 * Shared Memory Region *
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001578 ****************************************************************************/
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001579struct shmem_region { /* SharedMem Offset (size) */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001580
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001581 u32 validity_map[PORT_MAX]; /* 0x0 (4*2 = 0x8) */
1582 #define SHR_MEM_FORMAT_REV_MASK 0xff000000
1583 #define SHR_MEM_FORMAT_REV_ID ('A'<<24)
Eliezer Tamirf1410642008-02-28 11:51:50 -08001584 /* validity bits */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001585 #define SHR_MEM_VALIDITY_PCI_CFG 0x00100000
1586 #define SHR_MEM_VALIDITY_MB 0x00200000
1587 #define SHR_MEM_VALIDITY_DEV_INFO 0x00400000
1588 #define SHR_MEM_VALIDITY_RESERVED 0x00000007
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001589 /* One licensing bit should be set */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001590 #define SHR_MEM_VALIDITY_LIC_KEY_IN_EFFECT_MASK 0x00000038
1591 #define SHR_MEM_VALIDITY_LIC_MANUF_KEY_IN_EFFECT 0x00000008
1592 #define SHR_MEM_VALIDITY_LIC_UPGRADE_KEY_IN_EFFECT 0x00000010
1593 #define SHR_MEM_VALIDITY_LIC_NO_KEY_IN_EFFECT 0x00000020
Eliezer Tamirf1410642008-02-28 11:51:50 -08001594 /* Active MFW */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001595 #define SHR_MEM_VALIDITY_ACTIVE_MFW_UNKNOWN 0x00000000
1596 #define SHR_MEM_VALIDITY_ACTIVE_MFW_MASK 0x000001c0
1597 #define SHR_MEM_VALIDITY_ACTIVE_MFW_IPMI 0x00000040
1598 #define SHR_MEM_VALIDITY_ACTIVE_MFW_UMP 0x00000080
1599 #define SHR_MEM_VALIDITY_ACTIVE_MFW_NCSI 0x000000c0
1600 #define SHR_MEM_VALIDITY_ACTIVE_MFW_NONE 0x000001c0
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001601
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001602 struct shm_dev_info dev_info; /* 0x8 (0x438) */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001603
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001604 struct license_key drv_lic_key[PORT_MAX]; /* 0x440 (52*2=0x68) */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001605
1606 /* FW information (for internal FW use) */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001607 u32 fw_info_fio_offset; /* 0x4a8 (0x4) */
1608 struct mgmtfw_state mgmtfw_state; /* 0x4ac (0x1b8) */
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001609
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001610 struct drv_port_mb port_mb[PORT_MAX]; /* 0x664 (16*2=0x20) */
1611
1612#ifdef BMAPI
1613 /* This is a variable length array */
1614 /* the number of function depends on the chip type */
1615 struct drv_func_mb func_mb[1]; /* 0x684 (44*2/4/8=0x58/0xb0/0x160) */
1616#else
1617 /* the number of function depends on the chip type */
1618 struct drv_func_mb func_mb[]; /* 0x684 (44*2/4/8=0x58/0xb0/0x160) */
1619#endif /* BMAPI */
Eilon Greenstein34f80b02008-06-23 20:33:01 -07001620
Dmitry Kravkov523224a2010-10-06 03:23:26 +00001621}; /* 57710 = 0x6dc | 57711 = 0x7E4 | 57712 = 0x734 */
Eliezer Tamirf1410642008-02-28 11:51:50 -08001622
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001623/****************************************************************************
1624 * Shared Memory 2 Region *
1625 ****************************************************************************/
1626/* The fw_flr_ack is actually built in the following way: */
1627/* 8 bit: PF ack */
1628/* 64 bit: VF ack */
1629/* 8 bit: ios_dis_ack */
1630/* In order to maintain endianity in the mailbox hsi, we want to keep using */
1631/* u32. The fw must have the VF right after the PF since this is how it */
1632/* access arrays(it expects always the VF to reside after the PF, and that */
1633/* makes the calculation much easier for it. ) */
1634/* In order to answer both limitations, and keep the struct small, the code */
1635/* will abuse the structure defined here to achieve the actual partition */
1636/* above */
1637/****************************************************************************/
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00001638struct fw_flr_ack {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001639 u32 pf_ack;
1640 u32 vf_ack[1];
1641 u32 iov_dis_ack;
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00001642};
Dmitry Kravkov523224a2010-10-06 03:23:26 +00001643
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00001644struct fw_flr_mb {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001645 u32 aggint;
1646 u32 opgen_addr;
1647 struct fw_flr_ack ack;
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00001648};
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001649
Yuval Mintzc8c60d82012-06-06 17:13:07 +00001650struct eee_remote_vals {
1651 u32 tx_tw;
1652 u32 rx_tw;
1653};
1654
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001655/**** SUPPORT FOR SHMEM ARRRAYS ***
1656 * The SHMEM HSI is aligned on 32 bit boundaries which makes it difficult to
1657 * define arrays with storage types smaller then unsigned dwords.
1658 * The macros below add generic support for SHMEM arrays with numeric elements
1659 * that can span 2,4,8 or 16 bits. The array underlying type is a 32 bit dword
1660 * array with individual bit-filed elements accessed using shifts and masks.
1661 *
1662 */
1663
1664/* eb is the bitwidth of a single element */
1665#define SHMEM_ARRAY_MASK(eb) ((1<<(eb))-1)
1666#define SHMEM_ARRAY_ENTRY(i, eb) ((i)/(32/(eb)))
1667
1668/* the bit-position macro allows the used to flip the order of the arrays
1669 * elements on a per byte or word boundary.
1670 *
1671 * example: an array with 8 entries each 4 bit wide. This array will fit into
1672 * a single dword. The diagrmas below show the array order of the nibbles.
1673 *
1674 * SHMEM_ARRAY_BITPOS(i, 4, 4) defines the stadard ordering:
1675 *
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001676 * | | | |
1677 * 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
1678 * | | | |
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001679 *
1680 * SHMEM_ARRAY_BITPOS(i, 4, 8) defines a flip ordering per byte:
1681 *
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001682 * | | | |
1683 * 1 | 0 | 3 | 2 | 5 | 4 | 7 | 6 |
1684 * | | | |
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001685 *
1686 * SHMEM_ARRAY_BITPOS(i, 4, 16) defines a flip ordering per word:
1687 *
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001688 * | | | |
1689 * 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 |
1690 * | | | |
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001691 */
1692#define SHMEM_ARRAY_BITPOS(i, eb, fb) \
1693 ((((32/(fb)) - 1 - ((i)/((fb)/(eb))) % (32/(fb))) * (fb)) + \
1694 (((i)%((fb)/(eb))) * (eb)))
1695
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001696#define SHMEM_ARRAY_GET(a, i, eb, fb) \
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001697 ((a[SHMEM_ARRAY_ENTRY(i, eb)] >> SHMEM_ARRAY_BITPOS(i, eb, fb)) & \
1698 SHMEM_ARRAY_MASK(eb))
1699
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001700#define SHMEM_ARRAY_SET(a, i, eb, fb, val) \
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001701do { \
1702 a[SHMEM_ARRAY_ENTRY(i, eb)] &= ~(SHMEM_ARRAY_MASK(eb) << \
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001703 SHMEM_ARRAY_BITPOS(i, eb, fb)); \
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001704 a[SHMEM_ARRAY_ENTRY(i, eb)] |= (((val) & SHMEM_ARRAY_MASK(eb)) << \
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001705 SHMEM_ARRAY_BITPOS(i, eb, fb)); \
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001706} while (0)
1707
1708
1709/****START OF DCBX STRUCTURES DECLARATIONS****/
1710#define DCBX_MAX_NUM_PRI_PG_ENTRIES 8
1711#define DCBX_PRI_PG_BITWIDTH 4
1712#define DCBX_PRI_PG_FBITS 8
1713#define DCBX_PRI_PG_GET(a, i) \
1714 SHMEM_ARRAY_GET(a, i, DCBX_PRI_PG_BITWIDTH, DCBX_PRI_PG_FBITS)
1715#define DCBX_PRI_PG_SET(a, i, val) \
1716 SHMEM_ARRAY_SET(a, i, DCBX_PRI_PG_BITWIDTH, DCBX_PRI_PG_FBITS, val)
1717#define DCBX_MAX_NUM_PG_BW_ENTRIES 8
1718#define DCBX_BW_PG_BITWIDTH 8
1719#define DCBX_PG_BW_GET(a, i) \
1720 SHMEM_ARRAY_GET(a, i, DCBX_BW_PG_BITWIDTH, DCBX_BW_PG_BITWIDTH)
1721#define DCBX_PG_BW_SET(a, i, val) \
1722 SHMEM_ARRAY_SET(a, i, DCBX_BW_PG_BITWIDTH, DCBX_BW_PG_BITWIDTH, val)
1723#define DCBX_STRICT_PRI_PG 15
1724#define DCBX_MAX_APP_PROTOCOL 16
1725#define FCOE_APP_IDX 0
1726#define ISCSI_APP_IDX 1
1727#define PREDEFINED_APP_IDX_MAX 2
1728
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001729
1730/* Big/Little endian have the same representation. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001731struct dcbx_ets_feature {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001732 /*
1733 * For Admin MIB - is this feature supported by the
1734 * driver | For Local MIB - should this feature be enabled.
1735 */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001736 u32 enabled;
1737 u32 pg_bw_tbl[2];
1738 u32 pri_pg_tbl[1];
1739};
1740
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001741/* Driver structure in LE */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001742struct dcbx_pfc_feature {
1743#ifdef __BIG_ENDIAN
1744 u8 pri_en_bitmap;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001745 #define DCBX_PFC_PRI_0 0x01
1746 #define DCBX_PFC_PRI_1 0x02
1747 #define DCBX_PFC_PRI_2 0x04
1748 #define DCBX_PFC_PRI_3 0x08
1749 #define DCBX_PFC_PRI_4 0x10
1750 #define DCBX_PFC_PRI_5 0x20
1751 #define DCBX_PFC_PRI_6 0x40
1752 #define DCBX_PFC_PRI_7 0x80
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001753 u8 pfc_caps;
1754 u8 reserved;
1755 u8 enabled;
1756#elif defined(__LITTLE_ENDIAN)
1757 u8 enabled;
1758 u8 reserved;
1759 u8 pfc_caps;
1760 u8 pri_en_bitmap;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001761 #define DCBX_PFC_PRI_0 0x01
1762 #define DCBX_PFC_PRI_1 0x02
1763 #define DCBX_PFC_PRI_2 0x04
1764 #define DCBX_PFC_PRI_3 0x08
1765 #define DCBX_PFC_PRI_4 0x10
1766 #define DCBX_PFC_PRI_5 0x20
1767 #define DCBX_PFC_PRI_6 0x40
1768 #define DCBX_PFC_PRI_7 0x80
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001769#endif
1770};
1771
1772struct dcbx_app_priority_entry {
1773#ifdef __BIG_ENDIAN
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001774 u16 app_id;
1775 u8 pri_bitmap;
1776 u8 appBitfield;
1777 #define DCBX_APP_ENTRY_VALID 0x01
1778 #define DCBX_APP_ENTRY_SF_MASK 0x30
1779 #define DCBX_APP_ENTRY_SF_SHIFT 4
1780 #define DCBX_APP_SF_ETH_TYPE 0x10
1781 #define DCBX_APP_SF_PORT 0x20
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001782#elif defined(__LITTLE_ENDIAN)
1783 u8 appBitfield;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001784 #define DCBX_APP_ENTRY_VALID 0x01
1785 #define DCBX_APP_ENTRY_SF_MASK 0x30
1786 #define DCBX_APP_ENTRY_SF_SHIFT 4
1787 #define DCBX_APP_SF_ETH_TYPE 0x10
1788 #define DCBX_APP_SF_PORT 0x20
1789 u8 pri_bitmap;
1790 u16 app_id;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001791#endif
1792};
1793
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001794
1795/* FW structure in BE */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001796struct dcbx_app_priority_feature {
1797#ifdef __BIG_ENDIAN
1798 u8 reserved;
1799 u8 default_pri;
1800 u8 tc_supported;
1801 u8 enabled;
1802#elif defined(__LITTLE_ENDIAN)
1803 u8 enabled;
1804 u8 tc_supported;
1805 u8 default_pri;
1806 u8 reserved;
1807#endif
1808 struct dcbx_app_priority_entry app_pri_tbl[DCBX_MAX_APP_PROTOCOL];
1809};
1810
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001811/* FW structure in BE */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001812struct dcbx_features {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001813 /* PG feature */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001814 struct dcbx_ets_feature ets;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001815 /* PFC feature */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001816 struct dcbx_pfc_feature pfc;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001817 /* APP feature */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001818 struct dcbx_app_priority_feature app;
1819};
1820
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001821/* LLDP protocol parameters */
1822/* FW structure in BE */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001823struct lldp_params {
1824#ifdef __BIG_ENDIAN
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001825 u8 msg_fast_tx_interval;
1826 u8 msg_tx_hold;
1827 u8 msg_tx_interval;
1828 u8 admin_status;
1829 #define LLDP_TX_ONLY 0x01
1830 #define LLDP_RX_ONLY 0x02
1831 #define LLDP_TX_RX 0x03
1832 #define LLDP_DISABLED 0x04
1833 u8 reserved1;
1834 u8 tx_fast;
1835 u8 tx_crd_max;
1836 u8 tx_crd;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001837#elif defined(__LITTLE_ENDIAN)
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001838 u8 admin_status;
1839 #define LLDP_TX_ONLY 0x01
1840 #define LLDP_RX_ONLY 0x02
1841 #define LLDP_TX_RX 0x03
1842 #define LLDP_DISABLED 0x04
1843 u8 msg_tx_interval;
1844 u8 msg_tx_hold;
1845 u8 msg_fast_tx_interval;
1846 u8 tx_crd;
1847 u8 tx_crd_max;
1848 u8 tx_fast;
1849 u8 reserved1;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001850#endif
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001851 #define REM_CHASSIS_ID_STAT_LEN 4
1852 #define REM_PORT_ID_STAT_LEN 4
1853 /* Holds remote Chassis ID TLV header, subtype and 9B of payload. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001854 u32 peer_chassis_id[REM_CHASSIS_ID_STAT_LEN];
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001855 /* Holds remote Port ID TLV header, subtype and 9B of payload. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001856 u32 peer_port_id[REM_PORT_ID_STAT_LEN];
1857};
1858
1859struct lldp_dcbx_stat {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001860 #define LOCAL_CHASSIS_ID_STAT_LEN 2
1861 #define LOCAL_PORT_ID_STAT_LEN 2
1862 /* Holds local Chassis ID 8B payload of constant subtype 4. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001863 u32 local_chassis_id[LOCAL_CHASSIS_ID_STAT_LEN];
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001864 /* Holds local Port ID 8B payload of constant subtype 3. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001865 u32 local_port_id[LOCAL_PORT_ID_STAT_LEN];
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001866 /* Number of DCBX frames transmitted. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001867 u32 num_tx_dcbx_pkts;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001868 /* Number of DCBX frames received. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001869 u32 num_rx_dcbx_pkts;
1870};
1871
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001872/* ADMIN MIB - DCBX local machine default configuration. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001873struct lldp_admin_mib {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001874 u32 ver_cfg_flags;
1875 #define DCBX_ETS_CONFIG_TX_ENABLED 0x00000001
1876 #define DCBX_PFC_CONFIG_TX_ENABLED 0x00000002
1877 #define DCBX_APP_CONFIG_TX_ENABLED 0x00000004
1878 #define DCBX_ETS_RECO_TX_ENABLED 0x00000008
1879 #define DCBX_ETS_RECO_VALID 0x00000010
1880 #define DCBX_ETS_WILLING 0x00000020
1881 #define DCBX_PFC_WILLING 0x00000040
1882 #define DCBX_APP_WILLING 0x00000080
1883 #define DCBX_VERSION_CEE 0x00000100
1884 #define DCBX_VERSION_IEEE 0x00000200
1885 #define DCBX_DCBX_ENABLED 0x00000400
1886 #define DCBX_CEE_VERSION_MASK 0x0000f000
1887 #define DCBX_CEE_VERSION_SHIFT 12
1888 #define DCBX_CEE_MAX_VERSION_MASK 0x000f0000
1889 #define DCBX_CEE_MAX_VERSION_SHIFT 16
1890 struct dcbx_features features;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001891};
1892
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001893/* REMOTE MIB - remote machine DCBX configuration. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001894struct lldp_remote_mib {
1895 u32 prefix_seq_num;
1896 u32 flags;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001897 #define DCBX_ETS_TLV_RX 0x00000001
1898 #define DCBX_PFC_TLV_RX 0x00000002
1899 #define DCBX_APP_TLV_RX 0x00000004
1900 #define DCBX_ETS_RX_ERROR 0x00000010
1901 #define DCBX_PFC_RX_ERROR 0x00000020
1902 #define DCBX_APP_RX_ERROR 0x00000040
1903 #define DCBX_ETS_REM_WILLING 0x00000100
1904 #define DCBX_PFC_REM_WILLING 0x00000200
1905 #define DCBX_APP_REM_WILLING 0x00000400
1906 #define DCBX_REMOTE_ETS_RECO_VALID 0x00001000
1907 #define DCBX_REMOTE_MIB_VALID 0x00002000
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001908 struct dcbx_features features;
1909 u32 suffix_seq_num;
1910};
1911
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001912/* LOCAL MIB - operational DCBX configuration - transmitted on Tx LLDPDU. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001913struct lldp_local_mib {
1914 u32 prefix_seq_num;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001915 /* Indicates if there is mismatch with negotiation results. */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001916 u32 error;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001917 #define DCBX_LOCAL_ETS_ERROR 0x00000001
1918 #define DCBX_LOCAL_PFC_ERROR 0x00000002
1919 #define DCBX_LOCAL_APP_ERROR 0x00000004
1920 #define DCBX_LOCAL_PFC_MISMATCH 0x00000010
1921 #define DCBX_LOCAL_APP_MISMATCH 0x00000020
Dmitry Kravkov6debea82011-07-19 01:42:04 +00001922 #define DCBX_REMOTE_MIB_ERROR 0x00000040
Dmitry Kravkov910b2202012-03-18 10:33:42 +00001923 #define DCBX_REMOTE_ETS_TLV_NOT_FOUND 0x00000080
1924 #define DCBX_REMOTE_PFC_TLV_NOT_FOUND 0x00000100
1925 #define DCBX_REMOTE_APP_TLV_NOT_FOUND 0x00000200
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001926 struct dcbx_features features;
1927 u32 suffix_seq_num;
1928};
1929/***END OF DCBX STRUCTURES DECLARATIONS***/
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02001930
Yaniv Rosnerd3a8f132012-09-13 02:56:20 +00001931/***********************************************************/
1932/* Elink section */
1933/***********************************************************/
1934#define SHMEM_LINK_CONFIG_SIZE 2
1935struct shmem_lfa {
1936 u32 req_duplex;
1937 #define REQ_DUPLEX_PHY0_MASK 0x0000ffff
1938 #define REQ_DUPLEX_PHY0_SHIFT 0
1939 #define REQ_DUPLEX_PHY1_MASK 0xffff0000
1940 #define REQ_DUPLEX_PHY1_SHIFT 16
1941 u32 req_flow_ctrl;
1942 #define REQ_FLOW_CTRL_PHY0_MASK 0x0000ffff
1943 #define REQ_FLOW_CTRL_PHY0_SHIFT 0
1944 #define REQ_FLOW_CTRL_PHY1_MASK 0xffff0000
1945 #define REQ_FLOW_CTRL_PHY1_SHIFT 16
1946 u32 req_line_speed; /* Also determine AutoNeg */
1947 #define REQ_LINE_SPD_PHY0_MASK 0x0000ffff
1948 #define REQ_LINE_SPD_PHY0_SHIFT 0
1949 #define REQ_LINE_SPD_PHY1_MASK 0xffff0000
1950 #define REQ_LINE_SPD_PHY1_SHIFT 16
1951 u32 speed_cap_mask[SHMEM_LINK_CONFIG_SIZE];
1952 u32 additional_config;
1953 #define REQ_FC_AUTO_ADV_MASK 0x0000ffff
1954 #define REQ_FC_AUTO_ADV0_SHIFT 0
1955 #define NO_LFA_DUE_TO_DCC_MASK 0x00010000
1956 u32 lfa_sts;
1957 #define LFA_LINK_FLAP_REASON_OFFSET 0
1958 #define LFA_LINK_FLAP_REASON_MASK 0x000000ff
1959 #define LFA_LINK_DOWN 0x1
1960 #define LFA_LOOPBACK_ENABLED 0x2
1961 #define LFA_DUPLEX_MISMATCH 0x3
1962 #define LFA_MFW_IS_TOO_OLD 0x4
1963 #define LFA_LINK_SPEED_MISMATCH 0x5
1964 #define LFA_FLOW_CTRL_MISMATCH 0x6
1965 #define LFA_SPEED_CAP_MISMATCH 0x7
1966 #define LFA_DCC_LFA_DISABLED 0x8
1967 #define LFA_EEE_MISMATCH 0x9
1968
1969 #define LINK_FLAP_AVOIDANCE_COUNT_OFFSET 8
1970 #define LINK_FLAP_AVOIDANCE_COUNT_MASK 0x0000ff00
1971
1972 #define LINK_FLAP_COUNT_OFFSET 16
1973 #define LINK_FLAP_COUNT_MASK 0x00ff0000
1974
1975 #define LFA_FLAGS_MASK 0xff000000
1976 #define SHMEM_LFA_DONT_CLEAR_STAT (1<<24)
1977};
1978
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001979struct ncsi_oem_fcoe_features {
1980 u32 fcoe_features1;
1981 #define FCOE_FEATURES1_IOS_PER_CONNECTION_MASK 0x0000FFFF
1982 #define FCOE_FEATURES1_IOS_PER_CONNECTION_OFFSET 0
1983
1984 #define FCOE_FEATURES1_LOGINS_PER_PORT_MASK 0xFFFF0000
1985 #define FCOE_FEATURES1_LOGINS_PER_PORT_OFFSET 16
1986
1987 u32 fcoe_features2;
1988 #define FCOE_FEATURES2_EXCHANGES_MASK 0x0000FFFF
1989 #define FCOE_FEATURES2_EXCHANGES_OFFSET 0
1990
1991 #define FCOE_FEATURES2_NPIV_WWN_PER_PORT_MASK 0xFFFF0000
1992 #define FCOE_FEATURES2_NPIV_WWN_PER_PORT_OFFSET 16
1993
1994 u32 fcoe_features3;
1995 #define FCOE_FEATURES3_TARGETS_SUPPORTED_MASK 0x0000FFFF
1996 #define FCOE_FEATURES3_TARGETS_SUPPORTED_OFFSET 0
1997
1998 #define FCOE_FEATURES3_OUTSTANDING_COMMANDS_MASK 0xFFFF0000
1999 #define FCOE_FEATURES3_OUTSTANDING_COMMANDS_OFFSET 16
2000
2001 u32 fcoe_features4;
2002 #define FCOE_FEATURES4_FEATURE_SETTINGS_MASK 0x0000000F
2003 #define FCOE_FEATURES4_FEATURE_SETTINGS_OFFSET 0
2004};
2005
2006struct ncsi_oem_data {
2007 u32 driver_version[4];
2008 struct ncsi_oem_fcoe_features ncsi_oem_fcoe_features;
2009};
2010
Eilon Greenstein2691d512009-08-12 08:22:08 +00002011struct shmem2_region {
2012
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002013 u32 size; /* 0x0000 */
Eilon Greenstein2691d512009-08-12 08:22:08 +00002014
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002015 u32 dcc_support; /* 0x0004 */
2016 #define SHMEM_DCC_SUPPORT_NONE 0x00000000
2017 #define SHMEM_DCC_SUPPORT_DISABLE_ENABLE_PF_TLV 0x00000001
2018 #define SHMEM_DCC_SUPPORT_BANDWIDTH_ALLOCATION_TLV 0x00000004
2019 #define SHMEM_DCC_SUPPORT_CHANGE_MAC_ADDRESS_TLV 0x00000008
2020 #define SHMEM_DCC_SUPPORT_SET_PROTOCOL_TLV 0x00000040
2021 #define SHMEM_DCC_SUPPORT_SET_PRIORITY_TLV 0x00000080
2022
2023 u32 ext_phy_fw_version2[PORT_MAX]; /* 0x0008 */
Yaniv Rosnera22f0782010-09-07 11:41:20 +00002024 /*
2025 * For backwards compatibility, if the mf_cfg_addr does not exist
2026 * (the size filed is smaller than 0xc) the mf_cfg resides at the
2027 * end of struct shmem_region
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002028 */
2029 u32 mf_cfg_addr; /* 0x0010 */
2030 #define SHMEM_MF_CFG_ADDR_NONE 0x00000000
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00002031
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002032 struct fw_flr_mb flr_mb; /* 0x0014 */
2033 u32 dcbx_lldp_params_offset; /* 0x0028 */
2034 #define SHMEM_LLDP_DCBX_PARAMS_NONE 0x00000000
2035 u32 dcbx_neg_res_offset; /* 0x002c */
2036 #define SHMEM_DCBX_NEG_RES_NONE 0x00000000
2037 u32 dcbx_remote_mib_offset; /* 0x0030 */
2038 #define SHMEM_DCBX_REMOTE_MIB_NONE 0x00000000
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00002039 /*
2040 * The other shmemX_base_addr holds the other path's shmem address
2041 * required for example in case of common phy init, or for path1 to know
2042 * the address of mcp debug trace which is located in offset from shmem
2043 * of path0
Yaniv Rosnera22f0782010-09-07 11:41:20 +00002044 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002045 u32 other_shmem_base_addr; /* 0x0034 */
2046 u32 other_shmem2_base_addr; /* 0x0038 */
2047 /*
2048 * mcp_vf_disabled is set by the MCP to indicate the driver about VFs
2049 * which were disabled/flred
2050 */
2051 u32 mcp_vf_disabled[E2_VF_MAX / 32]; /* 0x003c */
2052
2053 /*
2054 * drv_ack_vf_disabled is set by the PF driver to ack handled disabled
2055 * VFs
2056 */
2057 u32 drv_ack_vf_disabled[E2_FUNC_MAX][E2_VF_MAX / 32]; /* 0x0044 */
2058
2059 u32 dcbx_lldp_dcbx_stat_offset; /* 0x0064 */
2060 #define SHMEM_LLDP_DCBX_STAT_NONE 0x00000000
2061
2062 /*
2063 * edebug_driver_if field is used to transfer messages between edebug
2064 * app to the driver through shmem2.
2065 *
2066 * message format:
2067 * bits 0-2 - function number / instance of driver to perform request
2068 * bits 3-5 - op code / is_ack?
2069 * bits 6-63 - data
2070 */
2071 u32 edebug_driver_if[2]; /* 0x0068 */
2072 #define EDEBUG_DRIVER_IF_OP_CODE_GET_PHYS_ADDR 1
2073 #define EDEBUG_DRIVER_IF_OP_CODE_GET_BUS_ADDR 2
2074 #define EDEBUG_DRIVER_IF_OP_CODE_DISABLE_STAT 3
2075
2076 u32 nvm_retain_bitmap_addr; /* 0x0070 */
2077
Barak Witkowskia3348722012-04-23 03:04:46 +00002078 /* afex support of that driver */
2079 u32 afex_driver_support; /* 0x0074 */
2080 #define SHMEM_AFEX_VERSION_MASK 0x100f
2081 #define SHMEM_AFEX_SUPPORTED_VERSION_ONE 0x1001
2082 #define SHMEM_AFEX_REDUCED_DRV_LOADED 0x8000
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002083
Barak Witkowskia3348722012-04-23 03:04:46 +00002084 /* driver receives addr in scratchpad to which it should respond */
2085 u32 afex_scratchpad_addr_to_write[E2_FUNC_MAX];
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002086
Barak Witkowskia3348722012-04-23 03:04:46 +00002087 /* generic params from MCP to driver (value depends on the msg sent
2088 * to driver
2089 */
2090 u32 afex_param1_to_driver[E2_FUNC_MAX]; /* 0x0088 */
2091 u32 afex_param2_to_driver[E2_FUNC_MAX]; /* 0x0098 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002092
2093 u32 swim_base_addr; /* 0x0108 */
2094 u32 swim_funcs;
2095 u32 swim_main_cb;
2096
Barak Witkowskia3348722012-04-23 03:04:46 +00002097 /* bitmap notifying which VIF profiles stored in nvram are enabled by
2098 * switch
2099 */
2100 u32 afex_profiles_enabled[2];
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002101
2102 /* generic flags controlled by the driver */
2103 u32 drv_flags;
Barak Witkowski4c704892012-12-02 04:05:47 +00002104 #define DRV_FLAGS_DCB_CONFIGURED 0x0
2105 #define DRV_FLAGS_DCB_CONFIGURATION_ABORTED 0x1
2106 #define DRV_FLAGS_DCB_MFW_CONFIGURED 0x2
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002107
Barak Witkowski4c704892012-12-02 04:05:47 +00002108 #define DRV_FLAGS_PORT_MASK ((1 << DRV_FLAGS_DCB_CONFIGURED) | \
2109 (1 << DRV_FLAGS_DCB_CONFIGURATION_ABORTED) | \
2110 (1 << DRV_FLAGS_DCB_MFW_CONFIGURED))
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002111 /* pointer to extended dev_info shared data copied from nvm image */
2112 u32 extended_dev_info_shared_addr;
2113 u32 ncsi_oem_data_addr;
2114
Barak Witkowski1d187b32011-12-05 22:41:50 +00002115 u32 ocsd_host_addr; /* initialized by option ROM */
2116 u32 ocbb_host_addr; /* initialized by option ROM */
2117 u32 ocsd_req_update_interval; /* initialized by option ROM */
2118 u32 temperature_in_half_celsius;
2119 u32 glob_struct_in_host;
2120
2121 u32 dcbx_neg_res_ext_offset;
2122#define SHMEM_DCBX_NEG_RES_EXT_NONE 0x00000000
2123
2124 u32 drv_capabilities_flag[E2_FUNC_MAX];
2125#define DRV_FLAGS_CAPABILITIES_LOADED_SUPPORTED 0x00000001
2126#define DRV_FLAGS_CAPABILITIES_LOADED_L2 0x00000002
2127#define DRV_FLAGS_CAPABILITIES_LOADED_FCOE 0x00000004
2128#define DRV_FLAGS_CAPABILITIES_LOADED_ISCSI 0x00000008
2129
2130 u32 extended_dev_info_shared_cfg_size;
2131
2132 u32 dcbx_en[PORT_MAX];
2133
2134 /* The offset points to the multi threaded meta structure */
2135 u32 multi_thread_data_offset;
2136
2137 /* address of DMAable host address holding values from the drivers */
2138 u32 drv_info_host_addr_lo;
2139 u32 drv_info_host_addr_hi;
2140
2141 /* general values written by the MFW (such as current version) */
2142 u32 drv_info_control;
2143#define DRV_INFO_CONTROL_VER_MASK 0x000000ff
2144#define DRV_INFO_CONTROL_VER_SHIFT 0
2145#define DRV_INFO_CONTROL_OP_CODE_MASK 0x0000ff00
2146#define DRV_INFO_CONTROL_OP_CODE_SHIFT 8
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00002147 u32 ibft_host_addr; /* initialized by option ROM */
Yuval Mintzc8c60d82012-06-06 17:13:07 +00002148 struct eee_remote_vals eee_remote_vals[PORT_MAX];
2149 u32 reserved[E2_FUNC_MAX];
2150
2151
2152 /* the status of EEE auto-negotiation
2153 * bits 15:0 the configured tx-lpi entry timer value. Depends on bit 31.
2154 * bits 19:16 the supported modes for EEE.
2155 * bits 23:20 the speeds advertised for EEE.
2156 * bits 27:24 the speeds the Link partner advertised for EEE.
2157 * The supported/adv. modes in bits 27:19 originate from the
2158 * SHMEM_EEE_XXX_ADV definitions (where XXX is replaced by speed).
2159 * bit 28 when 1'b1 EEE was requested.
2160 * bit 29 when 1'b1 tx lpi was requested.
2161 * bit 30 when 1'b1 EEE was negotiated. Tx lpi will be asserted iff
2162 * 30:29 are 2'b11.
2163 * bit 31 when 1'b0 bits 15:0 contain a PORT_FEAT_CFG_EEE_ define as
2164 * value. When 1'b1 those bits contains a value times 16 microseconds.
2165 */
2166 u32 eee_status[PORT_MAX];
2167 #define SHMEM_EEE_TIMER_MASK 0x0000ffff
2168 #define SHMEM_EEE_SUPPORTED_MASK 0x000f0000
2169 #define SHMEM_EEE_SUPPORTED_SHIFT 16
2170 #define SHMEM_EEE_ADV_STATUS_MASK 0x00f00000
2171 #define SHMEM_EEE_100M_ADV (1<<0)
2172 #define SHMEM_EEE_1G_ADV (1<<1)
2173 #define SHMEM_EEE_10G_ADV (1<<2)
2174 #define SHMEM_EEE_ADV_STATUS_SHIFT 20
2175 #define SHMEM_EEE_LP_ADV_STATUS_MASK 0x0f000000
2176 #define SHMEM_EEE_LP_ADV_STATUS_SHIFT 24
2177 #define SHMEM_EEE_REQUESTED_BIT 0x10000000
2178 #define SHMEM_EEE_LPI_REQUESTED_BIT 0x20000000
2179 #define SHMEM_EEE_ACTIVE_BIT 0x40000000
2180 #define SHMEM_EEE_TIME_OUTPUT_BIT 0x80000000
2181
2182 u32 sizeof_port_stats;
Yaniv Rosnerb884d952012-11-27 03:46:28 +00002183
2184 /* Link Flap Avoidance */
2185 u32 lfa_host_addr[PORT_MAX];
2186 u32 reserved1;
2187
2188 u32 reserved2; /* Offset 0x148 */
2189 u32 reserved3; /* Offset 0x14C */
2190 u32 reserved4; /* Offset 0x150 */
Yaniv Rosner4e7b4992012-11-27 03:46:29 +00002191 u32 link_attr_sync[PORT_MAX]; /* Offset 0x154 */
2192 #define LINK_ATTR_SYNC_KR2_ENABLE (1<<0)
Eilon Greenstein2691d512009-08-12 08:22:08 +00002193};
2194
2195
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002196struct emac_stats {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002197 u32 rx_stat_ifhcinoctets;
2198 u32 rx_stat_ifhcinbadoctets;
2199 u32 rx_stat_etherstatsfragments;
2200 u32 rx_stat_ifhcinucastpkts;
2201 u32 rx_stat_ifhcinmulticastpkts;
2202 u32 rx_stat_ifhcinbroadcastpkts;
2203 u32 rx_stat_dot3statsfcserrors;
2204 u32 rx_stat_dot3statsalignmenterrors;
2205 u32 rx_stat_dot3statscarriersenseerrors;
2206 u32 rx_stat_xonpauseframesreceived;
2207 u32 rx_stat_xoffpauseframesreceived;
2208 u32 rx_stat_maccontrolframesreceived;
2209 u32 rx_stat_xoffstateentered;
2210 u32 rx_stat_dot3statsframestoolong;
2211 u32 rx_stat_etherstatsjabbers;
2212 u32 rx_stat_etherstatsundersizepkts;
2213 u32 rx_stat_etherstatspkts64octets;
2214 u32 rx_stat_etherstatspkts65octetsto127octets;
2215 u32 rx_stat_etherstatspkts128octetsto255octets;
2216 u32 rx_stat_etherstatspkts256octetsto511octets;
2217 u32 rx_stat_etherstatspkts512octetsto1023octets;
2218 u32 rx_stat_etherstatspkts1024octetsto1522octets;
2219 u32 rx_stat_etherstatspktsover1522octets;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002220
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002221 u32 rx_stat_falsecarriererrors;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002222
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002223 u32 tx_stat_ifhcoutoctets;
2224 u32 tx_stat_ifhcoutbadoctets;
2225 u32 tx_stat_etherstatscollisions;
2226 u32 tx_stat_outxonsent;
2227 u32 tx_stat_outxoffsent;
2228 u32 tx_stat_flowcontroldone;
2229 u32 tx_stat_dot3statssinglecollisionframes;
2230 u32 tx_stat_dot3statsmultiplecollisionframes;
2231 u32 tx_stat_dot3statsdeferredtransmissions;
2232 u32 tx_stat_dot3statsexcessivecollisions;
2233 u32 tx_stat_dot3statslatecollisions;
2234 u32 tx_stat_ifhcoutucastpkts;
2235 u32 tx_stat_ifhcoutmulticastpkts;
2236 u32 tx_stat_ifhcoutbroadcastpkts;
2237 u32 tx_stat_etherstatspkts64octets;
2238 u32 tx_stat_etherstatspkts65octetsto127octets;
2239 u32 tx_stat_etherstatspkts128octetsto255octets;
2240 u32 tx_stat_etherstatspkts256octetsto511octets;
2241 u32 tx_stat_etherstatspkts512octetsto1023octets;
2242 u32 tx_stat_etherstatspkts1024octetsto1522octets;
2243 u32 tx_stat_etherstatspktsover1522octets;
2244 u32 tx_stat_dot3statsinternalmactransmiterrors;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002245};
2246
2247
Dmitry Kravkov523224a2010-10-06 03:23:26 +00002248struct bmac1_stats {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002249 u32 tx_stat_gtpkt_lo;
2250 u32 tx_stat_gtpkt_hi;
2251 u32 tx_stat_gtxpf_lo;
2252 u32 tx_stat_gtxpf_hi;
2253 u32 tx_stat_gtfcs_lo;
2254 u32 tx_stat_gtfcs_hi;
2255 u32 tx_stat_gtmca_lo;
2256 u32 tx_stat_gtmca_hi;
2257 u32 tx_stat_gtbca_lo;
2258 u32 tx_stat_gtbca_hi;
2259 u32 tx_stat_gtfrg_lo;
2260 u32 tx_stat_gtfrg_hi;
2261 u32 tx_stat_gtovr_lo;
2262 u32 tx_stat_gtovr_hi;
2263 u32 tx_stat_gt64_lo;
2264 u32 tx_stat_gt64_hi;
2265 u32 tx_stat_gt127_lo;
2266 u32 tx_stat_gt127_hi;
2267 u32 tx_stat_gt255_lo;
2268 u32 tx_stat_gt255_hi;
2269 u32 tx_stat_gt511_lo;
2270 u32 tx_stat_gt511_hi;
2271 u32 tx_stat_gt1023_lo;
2272 u32 tx_stat_gt1023_hi;
2273 u32 tx_stat_gt1518_lo;
2274 u32 tx_stat_gt1518_hi;
2275 u32 tx_stat_gt2047_lo;
2276 u32 tx_stat_gt2047_hi;
2277 u32 tx_stat_gt4095_lo;
2278 u32 tx_stat_gt4095_hi;
2279 u32 tx_stat_gt9216_lo;
2280 u32 tx_stat_gt9216_hi;
2281 u32 tx_stat_gt16383_lo;
2282 u32 tx_stat_gt16383_hi;
2283 u32 tx_stat_gtmax_lo;
2284 u32 tx_stat_gtmax_hi;
2285 u32 tx_stat_gtufl_lo;
2286 u32 tx_stat_gtufl_hi;
2287 u32 tx_stat_gterr_lo;
2288 u32 tx_stat_gterr_hi;
2289 u32 tx_stat_gtbyt_lo;
2290 u32 tx_stat_gtbyt_hi;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002291
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002292 u32 rx_stat_gr64_lo;
2293 u32 rx_stat_gr64_hi;
2294 u32 rx_stat_gr127_lo;
2295 u32 rx_stat_gr127_hi;
2296 u32 rx_stat_gr255_lo;
2297 u32 rx_stat_gr255_hi;
2298 u32 rx_stat_gr511_lo;
2299 u32 rx_stat_gr511_hi;
2300 u32 rx_stat_gr1023_lo;
2301 u32 rx_stat_gr1023_hi;
2302 u32 rx_stat_gr1518_lo;
2303 u32 rx_stat_gr1518_hi;
2304 u32 rx_stat_gr2047_lo;
2305 u32 rx_stat_gr2047_hi;
2306 u32 rx_stat_gr4095_lo;
2307 u32 rx_stat_gr4095_hi;
2308 u32 rx_stat_gr9216_lo;
2309 u32 rx_stat_gr9216_hi;
2310 u32 rx_stat_gr16383_lo;
2311 u32 rx_stat_gr16383_hi;
2312 u32 rx_stat_grmax_lo;
2313 u32 rx_stat_grmax_hi;
2314 u32 rx_stat_grpkt_lo;
2315 u32 rx_stat_grpkt_hi;
2316 u32 rx_stat_grfcs_lo;
2317 u32 rx_stat_grfcs_hi;
2318 u32 rx_stat_grmca_lo;
2319 u32 rx_stat_grmca_hi;
2320 u32 rx_stat_grbca_lo;
2321 u32 rx_stat_grbca_hi;
2322 u32 rx_stat_grxcf_lo;
2323 u32 rx_stat_grxcf_hi;
2324 u32 rx_stat_grxpf_lo;
2325 u32 rx_stat_grxpf_hi;
2326 u32 rx_stat_grxuo_lo;
2327 u32 rx_stat_grxuo_hi;
2328 u32 rx_stat_grjbr_lo;
2329 u32 rx_stat_grjbr_hi;
2330 u32 rx_stat_grovr_lo;
2331 u32 rx_stat_grovr_hi;
2332 u32 rx_stat_grflr_lo;
2333 u32 rx_stat_grflr_hi;
2334 u32 rx_stat_grmeg_lo;
2335 u32 rx_stat_grmeg_hi;
2336 u32 rx_stat_grmeb_lo;
2337 u32 rx_stat_grmeb_hi;
2338 u32 rx_stat_grbyt_lo;
2339 u32 rx_stat_grbyt_hi;
2340 u32 rx_stat_grund_lo;
2341 u32 rx_stat_grund_hi;
2342 u32 rx_stat_grfrg_lo;
2343 u32 rx_stat_grfrg_hi;
2344 u32 rx_stat_grerb_lo;
2345 u32 rx_stat_grerb_hi;
2346 u32 rx_stat_grfre_lo;
2347 u32 rx_stat_grfre_hi;
2348 u32 rx_stat_gripj_lo;
2349 u32 rx_stat_gripj_hi;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002350};
2351
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00002352struct bmac2_stats {
2353 u32 tx_stat_gtpk_lo; /* gtpok */
2354 u32 tx_stat_gtpk_hi; /* gtpok */
2355 u32 tx_stat_gtxpf_lo; /* gtpf */
2356 u32 tx_stat_gtxpf_hi; /* gtpf */
2357 u32 tx_stat_gtpp_lo; /* NEW BMAC2 */
2358 u32 tx_stat_gtpp_hi; /* NEW BMAC2 */
2359 u32 tx_stat_gtfcs_lo;
2360 u32 tx_stat_gtfcs_hi;
2361 u32 tx_stat_gtuca_lo; /* NEW BMAC2 */
2362 u32 tx_stat_gtuca_hi; /* NEW BMAC2 */
2363 u32 tx_stat_gtmca_lo;
2364 u32 tx_stat_gtmca_hi;
2365 u32 tx_stat_gtbca_lo;
2366 u32 tx_stat_gtbca_hi;
2367 u32 tx_stat_gtovr_lo;
2368 u32 tx_stat_gtovr_hi;
2369 u32 tx_stat_gtfrg_lo;
2370 u32 tx_stat_gtfrg_hi;
2371 u32 tx_stat_gtpkt1_lo; /* gtpkt */
2372 u32 tx_stat_gtpkt1_hi; /* gtpkt */
2373 u32 tx_stat_gt64_lo;
2374 u32 tx_stat_gt64_hi;
2375 u32 tx_stat_gt127_lo;
2376 u32 tx_stat_gt127_hi;
2377 u32 tx_stat_gt255_lo;
2378 u32 tx_stat_gt255_hi;
2379 u32 tx_stat_gt511_lo;
2380 u32 tx_stat_gt511_hi;
2381 u32 tx_stat_gt1023_lo;
2382 u32 tx_stat_gt1023_hi;
2383 u32 tx_stat_gt1518_lo;
2384 u32 tx_stat_gt1518_hi;
2385 u32 tx_stat_gt2047_lo;
2386 u32 tx_stat_gt2047_hi;
2387 u32 tx_stat_gt4095_lo;
2388 u32 tx_stat_gt4095_hi;
2389 u32 tx_stat_gt9216_lo;
2390 u32 tx_stat_gt9216_hi;
2391 u32 tx_stat_gt16383_lo;
2392 u32 tx_stat_gt16383_hi;
2393 u32 tx_stat_gtmax_lo;
2394 u32 tx_stat_gtmax_hi;
2395 u32 tx_stat_gtufl_lo;
2396 u32 tx_stat_gtufl_hi;
2397 u32 tx_stat_gterr_lo;
2398 u32 tx_stat_gterr_hi;
2399 u32 tx_stat_gtbyt_lo;
2400 u32 tx_stat_gtbyt_hi;
2401
2402 u32 rx_stat_gr64_lo;
2403 u32 rx_stat_gr64_hi;
2404 u32 rx_stat_gr127_lo;
2405 u32 rx_stat_gr127_hi;
2406 u32 rx_stat_gr255_lo;
2407 u32 rx_stat_gr255_hi;
2408 u32 rx_stat_gr511_lo;
2409 u32 rx_stat_gr511_hi;
2410 u32 rx_stat_gr1023_lo;
2411 u32 rx_stat_gr1023_hi;
2412 u32 rx_stat_gr1518_lo;
2413 u32 rx_stat_gr1518_hi;
2414 u32 rx_stat_gr2047_lo;
2415 u32 rx_stat_gr2047_hi;
2416 u32 rx_stat_gr4095_lo;
2417 u32 rx_stat_gr4095_hi;
2418 u32 rx_stat_gr9216_lo;
2419 u32 rx_stat_gr9216_hi;
2420 u32 rx_stat_gr16383_lo;
2421 u32 rx_stat_gr16383_hi;
2422 u32 rx_stat_grmax_lo;
2423 u32 rx_stat_grmax_hi;
2424 u32 rx_stat_grpkt_lo;
2425 u32 rx_stat_grpkt_hi;
2426 u32 rx_stat_grfcs_lo;
2427 u32 rx_stat_grfcs_hi;
2428 u32 rx_stat_gruca_lo;
2429 u32 rx_stat_gruca_hi;
2430 u32 rx_stat_grmca_lo;
2431 u32 rx_stat_grmca_hi;
2432 u32 rx_stat_grbca_lo;
2433 u32 rx_stat_grbca_hi;
2434 u32 rx_stat_grxpf_lo; /* grpf */
2435 u32 rx_stat_grxpf_hi; /* grpf */
2436 u32 rx_stat_grpp_lo;
2437 u32 rx_stat_grpp_hi;
2438 u32 rx_stat_grxuo_lo; /* gruo */
2439 u32 rx_stat_grxuo_hi; /* gruo */
2440 u32 rx_stat_grjbr_lo;
2441 u32 rx_stat_grjbr_hi;
2442 u32 rx_stat_grovr_lo;
2443 u32 rx_stat_grovr_hi;
2444 u32 rx_stat_grxcf_lo; /* grcf */
2445 u32 rx_stat_grxcf_hi; /* grcf */
2446 u32 rx_stat_grflr_lo;
2447 u32 rx_stat_grflr_hi;
2448 u32 rx_stat_grpok_lo;
2449 u32 rx_stat_grpok_hi;
2450 u32 rx_stat_grmeg_lo;
2451 u32 rx_stat_grmeg_hi;
2452 u32 rx_stat_grmeb_lo;
2453 u32 rx_stat_grmeb_hi;
2454 u32 rx_stat_grbyt_lo;
2455 u32 rx_stat_grbyt_hi;
2456 u32 rx_stat_grund_lo;
2457 u32 rx_stat_grund_hi;
2458 u32 rx_stat_grfrg_lo;
2459 u32 rx_stat_grfrg_hi;
2460 u32 rx_stat_grerb_lo; /* grerrbyt */
2461 u32 rx_stat_grerb_hi; /* grerrbyt */
2462 u32 rx_stat_grfre_lo; /* grfrerr */
2463 u32 rx_stat_grfre_hi; /* grfrerr */
2464 u32 rx_stat_gripj_lo;
2465 u32 rx_stat_gripj_hi;
2466};
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002467
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002468struct mstat_stats {
2469 struct {
2470 /* OTE MSTAT on E3 has a bug where this register's contents are
2471 * actually tx_gtxpok + tx_gtxpf + (possibly)tx_gtxpp
2472 */
2473 u32 tx_gtxpok_lo;
2474 u32 tx_gtxpok_hi;
2475 u32 tx_gtxpf_lo;
2476 u32 tx_gtxpf_hi;
2477 u32 tx_gtxpp_lo;
2478 u32 tx_gtxpp_hi;
2479 u32 tx_gtfcs_lo;
2480 u32 tx_gtfcs_hi;
2481 u32 tx_gtuca_lo;
2482 u32 tx_gtuca_hi;
2483 u32 tx_gtmca_lo;
2484 u32 tx_gtmca_hi;
2485 u32 tx_gtgca_lo;
2486 u32 tx_gtgca_hi;
2487 u32 tx_gtpkt_lo;
2488 u32 tx_gtpkt_hi;
2489 u32 tx_gt64_lo;
2490 u32 tx_gt64_hi;
2491 u32 tx_gt127_lo;
2492 u32 tx_gt127_hi;
2493 u32 tx_gt255_lo;
2494 u32 tx_gt255_hi;
2495 u32 tx_gt511_lo;
2496 u32 tx_gt511_hi;
2497 u32 tx_gt1023_lo;
2498 u32 tx_gt1023_hi;
2499 u32 tx_gt1518_lo;
2500 u32 tx_gt1518_hi;
2501 u32 tx_gt2047_lo;
2502 u32 tx_gt2047_hi;
2503 u32 tx_gt4095_lo;
2504 u32 tx_gt4095_hi;
2505 u32 tx_gt9216_lo;
2506 u32 tx_gt9216_hi;
2507 u32 tx_gt16383_lo;
2508 u32 tx_gt16383_hi;
2509 u32 tx_gtufl_lo;
2510 u32 tx_gtufl_hi;
2511 u32 tx_gterr_lo;
2512 u32 tx_gterr_hi;
2513 u32 tx_gtbyt_lo;
2514 u32 tx_gtbyt_hi;
2515 u32 tx_collisions_lo;
2516 u32 tx_collisions_hi;
2517 u32 tx_singlecollision_lo;
2518 u32 tx_singlecollision_hi;
2519 u32 tx_multiplecollisions_lo;
2520 u32 tx_multiplecollisions_hi;
2521 u32 tx_deferred_lo;
2522 u32 tx_deferred_hi;
2523 u32 tx_excessivecollisions_lo;
2524 u32 tx_excessivecollisions_hi;
2525 u32 tx_latecollisions_lo;
2526 u32 tx_latecollisions_hi;
2527 } stats_tx;
2528
2529 struct {
2530 u32 rx_gr64_lo;
2531 u32 rx_gr64_hi;
2532 u32 rx_gr127_lo;
2533 u32 rx_gr127_hi;
2534 u32 rx_gr255_lo;
2535 u32 rx_gr255_hi;
2536 u32 rx_gr511_lo;
2537 u32 rx_gr511_hi;
2538 u32 rx_gr1023_lo;
2539 u32 rx_gr1023_hi;
2540 u32 rx_gr1518_lo;
2541 u32 rx_gr1518_hi;
2542 u32 rx_gr2047_lo;
2543 u32 rx_gr2047_hi;
2544 u32 rx_gr4095_lo;
2545 u32 rx_gr4095_hi;
2546 u32 rx_gr9216_lo;
2547 u32 rx_gr9216_hi;
2548 u32 rx_gr16383_lo;
2549 u32 rx_gr16383_hi;
2550 u32 rx_grpkt_lo;
2551 u32 rx_grpkt_hi;
2552 u32 rx_grfcs_lo;
2553 u32 rx_grfcs_hi;
2554 u32 rx_gruca_lo;
2555 u32 rx_gruca_hi;
2556 u32 rx_grmca_lo;
2557 u32 rx_grmca_hi;
2558 u32 rx_grbca_lo;
2559 u32 rx_grbca_hi;
2560 u32 rx_grxpf_lo;
2561 u32 rx_grxpf_hi;
2562 u32 rx_grxpp_lo;
2563 u32 rx_grxpp_hi;
2564 u32 rx_grxuo_lo;
2565 u32 rx_grxuo_hi;
2566 u32 rx_grovr_lo;
2567 u32 rx_grovr_hi;
2568 u32 rx_grxcf_lo;
2569 u32 rx_grxcf_hi;
2570 u32 rx_grflr_lo;
2571 u32 rx_grflr_hi;
2572 u32 rx_grpok_lo;
2573 u32 rx_grpok_hi;
2574 u32 rx_grbyt_lo;
2575 u32 rx_grbyt_hi;
2576 u32 rx_grund_lo;
2577 u32 rx_grund_hi;
2578 u32 rx_grfrg_lo;
2579 u32 rx_grfrg_hi;
2580 u32 rx_grerb_lo;
2581 u32 rx_grerb_hi;
2582 u32 rx_grfre_lo;
2583 u32 rx_grfre_hi;
2584
2585 u32 rx_alignmenterrors_lo;
2586 u32 rx_alignmenterrors_hi;
2587 u32 rx_falsecarrier_lo;
2588 u32 rx_falsecarrier_hi;
2589 u32 rx_llfcmsgcnt_lo;
2590 u32 rx_llfcmsgcnt_hi;
2591 } stats_rx;
2592};
2593
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002594union mac_stats {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002595 struct emac_stats emac_stats;
2596 struct bmac1_stats bmac1_stats;
2597 struct bmac2_stats bmac2_stats;
2598 struct mstat_stats mstat_stats;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002599};
2600
2601
2602struct mac_stx {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002603 /* in_bad_octets */
2604 u32 rx_stat_ifhcinbadoctets_hi;
2605 u32 rx_stat_ifhcinbadoctets_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002606
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002607 /* out_bad_octets */
2608 u32 tx_stat_ifhcoutbadoctets_hi;
2609 u32 tx_stat_ifhcoutbadoctets_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002610
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002611 /* crc_receive_errors */
2612 u32 rx_stat_dot3statsfcserrors_hi;
2613 u32 rx_stat_dot3statsfcserrors_lo;
2614 /* alignment_errors */
2615 u32 rx_stat_dot3statsalignmenterrors_hi;
2616 u32 rx_stat_dot3statsalignmenterrors_lo;
2617 /* carrier_sense_errors */
2618 u32 rx_stat_dot3statscarriersenseerrors_hi;
2619 u32 rx_stat_dot3statscarriersenseerrors_lo;
2620 /* false_carrier_detections */
2621 u32 rx_stat_falsecarriererrors_hi;
2622 u32 rx_stat_falsecarriererrors_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002623
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002624 /* runt_packets_received */
2625 u32 rx_stat_etherstatsundersizepkts_hi;
2626 u32 rx_stat_etherstatsundersizepkts_lo;
2627 /* jabber_packets_received */
2628 u32 rx_stat_dot3statsframestoolong_hi;
2629 u32 rx_stat_dot3statsframestoolong_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002630
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002631 /* error_runt_packets_received */
2632 u32 rx_stat_etherstatsfragments_hi;
2633 u32 rx_stat_etherstatsfragments_lo;
2634 /* error_jabber_packets_received */
2635 u32 rx_stat_etherstatsjabbers_hi;
2636 u32 rx_stat_etherstatsjabbers_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002637
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002638 /* control_frames_received */
2639 u32 rx_stat_maccontrolframesreceived_hi;
2640 u32 rx_stat_maccontrolframesreceived_lo;
2641 u32 rx_stat_mac_xpf_hi;
2642 u32 rx_stat_mac_xpf_lo;
2643 u32 rx_stat_mac_xcf_hi;
2644 u32 rx_stat_mac_xcf_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002645
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002646 /* xoff_state_entered */
2647 u32 rx_stat_xoffstateentered_hi;
2648 u32 rx_stat_xoffstateentered_lo;
2649 /* pause_xon_frames_received */
2650 u32 rx_stat_xonpauseframesreceived_hi;
2651 u32 rx_stat_xonpauseframesreceived_lo;
2652 /* pause_xoff_frames_received */
2653 u32 rx_stat_xoffpauseframesreceived_hi;
2654 u32 rx_stat_xoffpauseframesreceived_lo;
2655 /* pause_xon_frames_transmitted */
2656 u32 tx_stat_outxonsent_hi;
2657 u32 tx_stat_outxonsent_lo;
2658 /* pause_xoff_frames_transmitted */
2659 u32 tx_stat_outxoffsent_hi;
2660 u32 tx_stat_outxoffsent_lo;
2661 /* flow_control_done */
2662 u32 tx_stat_flowcontroldone_hi;
2663 u32 tx_stat_flowcontroldone_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002664
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002665 /* ether_stats_collisions */
2666 u32 tx_stat_etherstatscollisions_hi;
2667 u32 tx_stat_etherstatscollisions_lo;
2668 /* single_collision_transmit_frames */
2669 u32 tx_stat_dot3statssinglecollisionframes_hi;
2670 u32 tx_stat_dot3statssinglecollisionframes_lo;
2671 /* multiple_collision_transmit_frames */
2672 u32 tx_stat_dot3statsmultiplecollisionframes_hi;
2673 u32 tx_stat_dot3statsmultiplecollisionframes_lo;
2674 /* deferred_transmissions */
2675 u32 tx_stat_dot3statsdeferredtransmissions_hi;
2676 u32 tx_stat_dot3statsdeferredtransmissions_lo;
2677 /* excessive_collision_frames */
2678 u32 tx_stat_dot3statsexcessivecollisions_hi;
2679 u32 tx_stat_dot3statsexcessivecollisions_lo;
2680 /* late_collision_frames */
2681 u32 tx_stat_dot3statslatecollisions_hi;
2682 u32 tx_stat_dot3statslatecollisions_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002683
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002684 /* frames_transmitted_64_bytes */
2685 u32 tx_stat_etherstatspkts64octets_hi;
2686 u32 tx_stat_etherstatspkts64octets_lo;
2687 /* frames_transmitted_65_127_bytes */
2688 u32 tx_stat_etherstatspkts65octetsto127octets_hi;
2689 u32 tx_stat_etherstatspkts65octetsto127octets_lo;
2690 /* frames_transmitted_128_255_bytes */
2691 u32 tx_stat_etherstatspkts128octetsto255octets_hi;
2692 u32 tx_stat_etherstatspkts128octetsto255octets_lo;
2693 /* frames_transmitted_256_511_bytes */
2694 u32 tx_stat_etherstatspkts256octetsto511octets_hi;
2695 u32 tx_stat_etherstatspkts256octetsto511octets_lo;
2696 /* frames_transmitted_512_1023_bytes */
2697 u32 tx_stat_etherstatspkts512octetsto1023octets_hi;
2698 u32 tx_stat_etherstatspkts512octetsto1023octets_lo;
2699 /* frames_transmitted_1024_1522_bytes */
2700 u32 tx_stat_etherstatspkts1024octetsto1522octets_hi;
2701 u32 tx_stat_etherstatspkts1024octetsto1522octets_lo;
2702 /* frames_transmitted_1523_9022_bytes */
2703 u32 tx_stat_etherstatspktsover1522octets_hi;
2704 u32 tx_stat_etherstatspktsover1522octets_lo;
2705 u32 tx_stat_mac_2047_hi;
2706 u32 tx_stat_mac_2047_lo;
2707 u32 tx_stat_mac_4095_hi;
2708 u32 tx_stat_mac_4095_lo;
2709 u32 tx_stat_mac_9216_hi;
2710 u32 tx_stat_mac_9216_lo;
2711 u32 tx_stat_mac_16383_hi;
2712 u32 tx_stat_mac_16383_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002713
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002714 /* internal_mac_transmit_errors */
2715 u32 tx_stat_dot3statsinternalmactransmiterrors_hi;
2716 u32 tx_stat_dot3statsinternalmactransmiterrors_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002717
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002718 /* if_out_discards */
2719 u32 tx_stat_mac_ufl_hi;
2720 u32 tx_stat_mac_ufl_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002721};
2722
2723
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002724#define MAC_STX_IDX_MAX 2
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002725
2726struct host_port_stats {
Barak Witkowski0e898dd2011-12-05 21:52:22 +00002727 u32 host_port_stats_counter;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002728
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002729 struct mac_stx mac_stx[MAC_STX_IDX_MAX];
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002730
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002731 u32 brb_drop_hi;
2732 u32 brb_drop_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002733
Barak Witkowski0e898dd2011-12-05 21:52:22 +00002734 u32 not_used; /* obsolete */
2735 u32 pfc_frames_tx_hi;
2736 u32 pfc_frames_tx_lo;
2737 u32 pfc_frames_rx_hi;
2738 u32 pfc_frames_rx_lo;
Yuval Mintzc8c60d82012-06-06 17:13:07 +00002739
2740 u32 eee_lpi_count_hi;
2741 u32 eee_lpi_count_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002742};
2743
2744
2745struct host_func_stats {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002746 u32 host_func_stats_start;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002747
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002748 u32 total_bytes_received_hi;
2749 u32 total_bytes_received_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002750
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002751 u32 total_bytes_transmitted_hi;
2752 u32 total_bytes_transmitted_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002753
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002754 u32 total_unicast_packets_received_hi;
2755 u32 total_unicast_packets_received_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002756
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002757 u32 total_multicast_packets_received_hi;
2758 u32 total_multicast_packets_received_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002759
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002760 u32 total_broadcast_packets_received_hi;
2761 u32 total_broadcast_packets_received_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002762
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002763 u32 total_unicast_packets_transmitted_hi;
2764 u32 total_unicast_packets_transmitted_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002765
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002766 u32 total_multicast_packets_transmitted_hi;
2767 u32 total_multicast_packets_transmitted_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002768
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002769 u32 total_broadcast_packets_transmitted_hi;
2770 u32 total_broadcast_packets_transmitted_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002771
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002772 u32 valid_bytes_received_hi;
2773 u32 valid_bytes_received_lo;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002774
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002775 u32 host_func_stats_end;
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07002776};
Eilon Greenstein34f80b02008-06-23 20:33:01 -07002777
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002778/* VIC definitions */
2779#define VICSTATST_UIF_INDEX 2
Eilon Greenstein34f80b02008-06-23 20:33:01 -07002780
Barak Witkowskia3348722012-04-23 03:04:46 +00002781
2782/* stats collected for afex.
2783 * NOTE: structure is exactly as expected to be received by the switch.
2784 * order must remain exactly as is unless protocol changes !
2785 */
2786struct afex_stats {
2787 u32 tx_unicast_frames_hi;
2788 u32 tx_unicast_frames_lo;
2789 u32 tx_unicast_bytes_hi;
2790 u32 tx_unicast_bytes_lo;
2791 u32 tx_multicast_frames_hi;
2792 u32 tx_multicast_frames_lo;
2793 u32 tx_multicast_bytes_hi;
2794 u32 tx_multicast_bytes_lo;
2795 u32 tx_broadcast_frames_hi;
2796 u32 tx_broadcast_frames_lo;
2797 u32 tx_broadcast_bytes_hi;
2798 u32 tx_broadcast_bytes_lo;
2799 u32 tx_frames_discarded_hi;
2800 u32 tx_frames_discarded_lo;
2801 u32 tx_frames_dropped_hi;
2802 u32 tx_frames_dropped_lo;
2803
2804 u32 rx_unicast_frames_hi;
2805 u32 rx_unicast_frames_lo;
2806 u32 rx_unicast_bytes_hi;
2807 u32 rx_unicast_bytes_lo;
2808 u32 rx_multicast_frames_hi;
2809 u32 rx_multicast_frames_lo;
2810 u32 rx_multicast_bytes_hi;
2811 u32 rx_multicast_bytes_lo;
2812 u32 rx_broadcast_frames_hi;
2813 u32 rx_broadcast_frames_lo;
2814 u32 rx_broadcast_bytes_hi;
2815 u32 rx_broadcast_bytes_lo;
2816 u32 rx_frames_discarded_hi;
2817 u32 rx_frames_discarded_lo;
2818 u32 rx_frames_dropped_hi;
2819 u32 rx_frames_dropped_lo;
2820};
2821
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002822#define BCM_5710_FW_MAJOR_VERSION 7
Yuval Mintz96bed4b2012-10-01 03:46:19 +00002823#define BCM_5710_FW_MINOR_VERSION 8
2824#define BCM_5710_FW_REVISION_VERSION 2
Barak Witkowskia3348722012-04-23 03:04:46 +00002825#define BCM_5710_FW_ENGINEERING_VERSION 0
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02002826#define BCM_5710_FW_COMPILE_FLAGS 1
2827
2828
2829/*
2830 * attention bits
2831 */
Dmitry Kravkov523224a2010-10-06 03:23:26 +00002832struct atten_sp_status_block {
Eilon Greenstein4781bfa2009-02-12 08:38:17 +00002833 __le32 attn_bits;
2834 __le32 attn_bits_ack;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02002835 u8 status_block_id;
2836 u8 reserved0;
Eilon Greenstein4781bfa2009-02-12 08:38:17 +00002837 __le16 attn_bits_index;
2838 __le32 reserved1;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02002839};
2840
2841
2842/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002843 * The eth aggregative context of Cstorm
2844 */
2845struct cstorm_eth_ag_context {
2846 u32 __reserved0[10];
2847};
2848
2849
2850/*
2851 * dmae command structure
2852 */
2853struct dmae_command {
2854 u32 opcode;
2855#define DMAE_COMMAND_SRC (0x1<<0)
2856#define DMAE_COMMAND_SRC_SHIFT 0
2857#define DMAE_COMMAND_DST (0x3<<1)
2858#define DMAE_COMMAND_DST_SHIFT 1
2859#define DMAE_COMMAND_C_DST (0x1<<3)
2860#define DMAE_COMMAND_C_DST_SHIFT 3
2861#define DMAE_COMMAND_C_TYPE_ENABLE (0x1<<4)
2862#define DMAE_COMMAND_C_TYPE_ENABLE_SHIFT 4
2863#define DMAE_COMMAND_C_TYPE_CRC_ENABLE (0x1<<5)
2864#define DMAE_COMMAND_C_TYPE_CRC_ENABLE_SHIFT 5
2865#define DMAE_COMMAND_C_TYPE_CRC_OFFSET (0x7<<6)
2866#define DMAE_COMMAND_C_TYPE_CRC_OFFSET_SHIFT 6
2867#define DMAE_COMMAND_ENDIANITY (0x3<<9)
2868#define DMAE_COMMAND_ENDIANITY_SHIFT 9
2869#define DMAE_COMMAND_PORT (0x1<<11)
2870#define DMAE_COMMAND_PORT_SHIFT 11
2871#define DMAE_COMMAND_CRC_RESET (0x1<<12)
2872#define DMAE_COMMAND_CRC_RESET_SHIFT 12
2873#define DMAE_COMMAND_SRC_RESET (0x1<<13)
2874#define DMAE_COMMAND_SRC_RESET_SHIFT 13
2875#define DMAE_COMMAND_DST_RESET (0x1<<14)
2876#define DMAE_COMMAND_DST_RESET_SHIFT 14
2877#define DMAE_COMMAND_E1HVN (0x3<<15)
2878#define DMAE_COMMAND_E1HVN_SHIFT 15
2879#define DMAE_COMMAND_DST_VN (0x3<<17)
2880#define DMAE_COMMAND_DST_VN_SHIFT 17
2881#define DMAE_COMMAND_C_FUNC (0x1<<19)
2882#define DMAE_COMMAND_C_FUNC_SHIFT 19
2883#define DMAE_COMMAND_ERR_POLICY (0x3<<20)
2884#define DMAE_COMMAND_ERR_POLICY_SHIFT 20
2885#define DMAE_COMMAND_RESERVED0 (0x3FF<<22)
2886#define DMAE_COMMAND_RESERVED0_SHIFT 22
2887 u32 src_addr_lo;
2888 u32 src_addr_hi;
2889 u32 dst_addr_lo;
2890 u32 dst_addr_hi;
2891#if defined(__BIG_ENDIAN)
2892 u16 opcode_iov;
2893#define DMAE_COMMAND_SRC_VFID (0x3F<<0)
2894#define DMAE_COMMAND_SRC_VFID_SHIFT 0
2895#define DMAE_COMMAND_SRC_VFPF (0x1<<6)
2896#define DMAE_COMMAND_SRC_VFPF_SHIFT 6
2897#define DMAE_COMMAND_RESERVED1 (0x1<<7)
2898#define DMAE_COMMAND_RESERVED1_SHIFT 7
2899#define DMAE_COMMAND_DST_VFID (0x3F<<8)
2900#define DMAE_COMMAND_DST_VFID_SHIFT 8
2901#define DMAE_COMMAND_DST_VFPF (0x1<<14)
2902#define DMAE_COMMAND_DST_VFPF_SHIFT 14
2903#define DMAE_COMMAND_RESERVED2 (0x1<<15)
2904#define DMAE_COMMAND_RESERVED2_SHIFT 15
2905 u16 len;
2906#elif defined(__LITTLE_ENDIAN)
2907 u16 len;
2908 u16 opcode_iov;
2909#define DMAE_COMMAND_SRC_VFID (0x3F<<0)
2910#define DMAE_COMMAND_SRC_VFID_SHIFT 0
2911#define DMAE_COMMAND_SRC_VFPF (0x1<<6)
2912#define DMAE_COMMAND_SRC_VFPF_SHIFT 6
2913#define DMAE_COMMAND_RESERVED1 (0x1<<7)
2914#define DMAE_COMMAND_RESERVED1_SHIFT 7
2915#define DMAE_COMMAND_DST_VFID (0x3F<<8)
2916#define DMAE_COMMAND_DST_VFID_SHIFT 8
2917#define DMAE_COMMAND_DST_VFPF (0x1<<14)
2918#define DMAE_COMMAND_DST_VFPF_SHIFT 14
2919#define DMAE_COMMAND_RESERVED2 (0x1<<15)
2920#define DMAE_COMMAND_RESERVED2_SHIFT 15
2921#endif
2922 u32 comp_addr_lo;
2923 u32 comp_addr_hi;
2924 u32 comp_val;
2925 u32 crc32;
2926 u32 crc32_c;
2927#if defined(__BIG_ENDIAN)
2928 u16 crc16_c;
2929 u16 crc16;
2930#elif defined(__LITTLE_ENDIAN)
2931 u16 crc16;
2932 u16 crc16_c;
2933#endif
2934#if defined(__BIG_ENDIAN)
2935 u16 reserved3;
2936 u16 crc_t10;
2937#elif defined(__LITTLE_ENDIAN)
2938 u16 crc_t10;
2939 u16 reserved3;
2940#endif
2941#if defined(__BIG_ENDIAN)
2942 u16 xsum8;
2943 u16 xsum16;
2944#elif defined(__LITTLE_ENDIAN)
2945 u16 xsum16;
2946 u16 xsum8;
2947#endif
2948};
2949
2950
2951/*
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02002952 * common data for all protocols
2953 */
2954struct doorbell_hdr {
2955 u8 header;
2956#define DOORBELL_HDR_RX (0x1<<0)
2957#define DOORBELL_HDR_RX_SHIFT 0
2958#define DOORBELL_HDR_DB_TYPE (0x1<<1)
2959#define DOORBELL_HDR_DB_TYPE_SHIFT 1
2960#define DOORBELL_HDR_DPM_SIZE (0x3<<2)
2961#define DOORBELL_HDR_DPM_SIZE_SHIFT 2
2962#define DOORBELL_HDR_CONN_TYPE (0xF<<4)
2963#define DOORBELL_HDR_CONN_TYPE_SHIFT 4
2964};
2965
2966/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002967 * Ethernet doorbell
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02002968 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002969struct eth_tx_doorbell {
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02002970#if defined(__BIG_ENDIAN)
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002971 u16 npackets;
2972 u8 params;
2973#define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
2974#define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
2975#define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
2976#define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
2977#define ETH_TX_DOORBELL_SPARE (0x1<<7)
2978#define ETH_TX_DOORBELL_SPARE_SHIFT 7
2979 struct doorbell_hdr hdr;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02002980#elif defined(__LITTLE_ENDIAN)
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03002981 struct doorbell_hdr hdr;
2982 u8 params;
2983#define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
2984#define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
2985#define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
2986#define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
2987#define ETH_TX_DOORBELL_SPARE (0x1<<7)
2988#define ETH_TX_DOORBELL_SPARE_SHIFT 7
2989 u16 npackets;
Eilon Greensteinca003922009-08-12 22:53:28 -07002990#endif
2991};
2992
2993
2994/*
Dmitry Kravkov523224a2010-10-06 03:23:26 +00002995 * 3 lines. status block
2996 */
2997struct hc_status_block_e1x {
2998 __le16 index_values[HC_SB_MAX_INDICES_E1X];
2999 __le16 running_index[HC_SB_MAX_SM];
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003000 __le32 rsrv[11];
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003001};
3002
3003/*
3004 * host status block
3005 */
3006struct host_hc_status_block_e1x {
3007 struct hc_status_block_e1x sb;
3008};
3009
3010
3011/*
3012 * 3 lines. status block
3013 */
3014struct hc_status_block_e2 {
3015 __le16 index_values[HC_SB_MAX_INDICES_E2];
3016 __le16 running_index[HC_SB_MAX_SM];
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003017 __le32 reserved[11];
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003018};
3019
3020/*
3021 * host status block
3022 */
3023struct host_hc_status_block_e2 {
3024 struct hc_status_block_e2 sb;
3025};
3026
3027
3028/*
3029 * 5 lines. slow-path status block
3030 */
3031struct hc_sp_status_block {
3032 __le16 index_values[HC_SP_SB_MAX_INDICES];
3033 __le16 running_index;
3034 __le16 rsrv;
3035 u32 rsrv1;
3036};
3037
3038/*
3039 * host status block
3040 */
3041struct host_sp_status_block {
3042 struct atten_sp_status_block atten_status_block;
3043 struct hc_sp_status_block sp_sb;
3044};
3045
3046
3047/*
3048 * IGU driver acknowledgment register
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003049 */
3050struct igu_ack_register {
3051#if defined(__BIG_ENDIAN)
3052 u16 sb_id_and_flags;
3053#define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
3054#define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
3055#define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
3056#define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
3057#define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
3058#define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
3059#define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
3060#define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
3061#define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
3062#define IGU_ACK_REGISTER_RESERVED_SHIFT 11
3063 u16 status_block_index;
3064#elif defined(__LITTLE_ENDIAN)
3065 u16 status_block_index;
3066 u16 sb_id_and_flags;
3067#define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
3068#define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
3069#define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
3070#define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
3071#define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
3072#define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
3073#define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
3074#define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
3075#define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
3076#define IGU_ACK_REGISTER_RESERVED_SHIFT 11
3077#endif
3078};
3079
3080
3081/*
Eilon Greensteinca003922009-08-12 22:53:28 -07003082 * IGU driver acknowledgement register
3083 */
3084struct igu_backward_compatible {
3085 u32 sb_id_and_flags;
3086#define IGU_BACKWARD_COMPATIBLE_SB_INDEX (0xFFFF<<0)
3087#define IGU_BACKWARD_COMPATIBLE_SB_INDEX_SHIFT 0
3088#define IGU_BACKWARD_COMPATIBLE_SB_SELECT (0x1F<<16)
3089#define IGU_BACKWARD_COMPATIBLE_SB_SELECT_SHIFT 16
3090#define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS (0x7<<21)
3091#define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS_SHIFT 21
3092#define IGU_BACKWARD_COMPATIBLE_BUPDATE (0x1<<24)
3093#define IGU_BACKWARD_COMPATIBLE_BUPDATE_SHIFT 24
3094#define IGU_BACKWARD_COMPATIBLE_ENABLE_INT (0x3<<25)
3095#define IGU_BACKWARD_COMPATIBLE_ENABLE_INT_SHIFT 25
3096#define IGU_BACKWARD_COMPATIBLE_RESERVED_0 (0x1F<<27)
3097#define IGU_BACKWARD_COMPATIBLE_RESERVED_0_SHIFT 27
3098 u32 reserved_2;
3099};
3100
3101
3102/*
3103 * IGU driver acknowledgement register
3104 */
3105struct igu_regular {
3106 u32 sb_id_and_flags;
3107#define IGU_REGULAR_SB_INDEX (0xFFFFF<<0)
3108#define IGU_REGULAR_SB_INDEX_SHIFT 0
3109#define IGU_REGULAR_RESERVED0 (0x1<<20)
3110#define IGU_REGULAR_RESERVED0_SHIFT 20
3111#define IGU_REGULAR_SEGMENT_ACCESS (0x7<<21)
3112#define IGU_REGULAR_SEGMENT_ACCESS_SHIFT 21
3113#define IGU_REGULAR_BUPDATE (0x1<<24)
3114#define IGU_REGULAR_BUPDATE_SHIFT 24
3115#define IGU_REGULAR_ENABLE_INT (0x3<<25)
3116#define IGU_REGULAR_ENABLE_INT_SHIFT 25
3117#define IGU_REGULAR_RESERVED_1 (0x1<<27)
3118#define IGU_REGULAR_RESERVED_1_SHIFT 27
3119#define IGU_REGULAR_CLEANUP_TYPE (0x3<<28)
3120#define IGU_REGULAR_CLEANUP_TYPE_SHIFT 28
3121#define IGU_REGULAR_CLEANUP_SET (0x1<<30)
3122#define IGU_REGULAR_CLEANUP_SET_SHIFT 30
3123#define IGU_REGULAR_BCLEANUP (0x1<<31)
3124#define IGU_REGULAR_BCLEANUP_SHIFT 31
3125 u32 reserved_2;
3126};
3127
3128/*
3129 * IGU driver acknowledgement register
3130 */
3131union igu_consprod_reg {
3132 struct igu_regular regular;
3133 struct igu_backward_compatible backward_compatible;
3134};
3135
3136
3137/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003138 * Igu control commands
3139 */
3140enum igu_ctrl_cmd {
3141 IGU_CTRL_CMD_TYPE_RD,
3142 IGU_CTRL_CMD_TYPE_WR,
3143 MAX_IGU_CTRL_CMD
3144};
3145
3146
3147/*
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00003148 * Control register for the IGU command register
3149 */
3150struct igu_ctrl_reg {
3151 u32 ctrl_data;
3152#define IGU_CTRL_REG_ADDRESS (0xFFF<<0)
3153#define IGU_CTRL_REG_ADDRESS_SHIFT 0
3154#define IGU_CTRL_REG_FID (0x7F<<12)
3155#define IGU_CTRL_REG_FID_SHIFT 12
3156#define IGU_CTRL_REG_RESERVED (0x1<<19)
3157#define IGU_CTRL_REG_RESERVED_SHIFT 19
3158#define IGU_CTRL_REG_TYPE (0x1<<20)
3159#define IGU_CTRL_REG_TYPE_SHIFT 20
3160#define IGU_CTRL_REG_UNUSED (0x7FF<<21)
3161#define IGU_CTRL_REG_UNUSED_SHIFT 21
3162};
3163
3164
3165/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003166 * Igu interrupt command
3167 */
3168enum igu_int_cmd {
3169 IGU_INT_ENABLE,
3170 IGU_INT_DISABLE,
3171 IGU_INT_NOP,
3172 IGU_INT_NOP2,
3173 MAX_IGU_INT_CMD
3174};
3175
3176
3177/*
3178 * Igu segments
3179 */
3180enum igu_seg_access {
3181 IGU_SEG_ACCESS_NORM,
3182 IGU_SEG_ACCESS_DEF,
3183 IGU_SEG_ACCESS_ATTN,
3184 MAX_IGU_SEG_ACCESS
3185};
3186
3187
3188/*
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003189 * Parser parsing flags field
3190 */
3191struct parsing_flags {
Eilon Greenstein4781bfa2009-02-12 08:38:17 +00003192 __le16 flags;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003193#define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE (0x1<<0)
3194#define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE_SHIFT 0
Eilon Greenstein34f80b02008-06-23 20:33:01 -07003195#define PARSING_FLAGS_VLAN (0x1<<1)
3196#define PARSING_FLAGS_VLAN_SHIFT 1
3197#define PARSING_FLAGS_EXTRA_VLAN (0x1<<2)
3198#define PARSING_FLAGS_EXTRA_VLAN_SHIFT 2
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003199#define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL (0x3<<3)
3200#define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT 3
3201#define PARSING_FLAGS_IP_OPTIONS (0x1<<5)
3202#define PARSING_FLAGS_IP_OPTIONS_SHIFT 5
3203#define PARSING_FLAGS_FRAGMENTATION_STATUS (0x1<<6)
3204#define PARSING_FLAGS_FRAGMENTATION_STATUS_SHIFT 6
3205#define PARSING_FLAGS_OVER_IP_PROTOCOL (0x3<<7)
3206#define PARSING_FLAGS_OVER_IP_PROTOCOL_SHIFT 7
3207#define PARSING_FLAGS_PURE_ACK_INDICATION (0x1<<9)
3208#define PARSING_FLAGS_PURE_ACK_INDICATION_SHIFT 9
3209#define PARSING_FLAGS_TCP_OPTIONS_EXIST (0x1<<10)
3210#define PARSING_FLAGS_TCP_OPTIONS_EXIST_SHIFT 10
3211#define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG (0x1<<11)
3212#define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG_SHIFT 11
3213#define PARSING_FLAGS_CONNECTION_MATCH (0x1<<12)
3214#define PARSING_FLAGS_CONNECTION_MATCH_SHIFT 12
3215#define PARSING_FLAGS_LLC_SNAP (0x1<<13)
3216#define PARSING_FLAGS_LLC_SNAP_SHIFT 13
3217#define PARSING_FLAGS_RESERVED0 (0x3<<14)
3218#define PARSING_FLAGS_RESERVED0_SHIFT 14
3219};
3220
3221
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003222/*
3223 * Parsing flags for TCP ACK type
3224 */
3225enum prs_flags_ack_type {
3226 PRS_FLAG_PUREACK_PIGGY,
3227 PRS_FLAG_PUREACK_PURE,
3228 MAX_PRS_FLAGS_ACK_TYPE
Eilon Greenstein34f80b02008-06-23 20:33:01 -07003229};
3230
3231
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003232/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003233 * Parsing flags for Ethernet address type
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003234 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003235enum prs_flags_eth_addr_type {
3236 PRS_FLAG_ETHTYPE_NON_UNICAST,
3237 PRS_FLAG_ETHTYPE_UNICAST,
3238 MAX_PRS_FLAGS_ETH_ADDR_TYPE
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003239};
3240
3241
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003242/*
3243 * Parsing flags for over-ethernet protocol
3244 */
3245enum prs_flags_over_eth {
3246 PRS_FLAG_OVERETH_UNKNOWN,
3247 PRS_FLAG_OVERETH_IPV4,
3248 PRS_FLAG_OVERETH_IPV6,
3249 PRS_FLAG_OVERETH_LLCSNAP_UNKNOWN,
3250 MAX_PRS_FLAGS_OVER_ETH
3251};
3252
3253
3254/*
3255 * Parsing flags for over-IP protocol
3256 */
3257enum prs_flags_over_ip {
3258 PRS_FLAG_OVERIP_UNKNOWN,
3259 PRS_FLAG_OVERIP_TCP,
3260 PRS_FLAG_OVERIP_UDP,
3261 MAX_PRS_FLAGS_OVER_IP
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003262};
3263
3264
3265/*
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003266 * SDM operation gen command (generate aggregative interrupt)
Eilon Greenstein34f80b02008-06-23 20:33:01 -07003267 */
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003268struct sdm_op_gen {
3269 __le32 command;
3270#define SDM_OP_GEN_COMP_PARAM (0x1F<<0)
3271#define SDM_OP_GEN_COMP_PARAM_SHIFT 0
3272#define SDM_OP_GEN_COMP_TYPE (0x7<<5)
3273#define SDM_OP_GEN_COMP_TYPE_SHIFT 5
3274#define SDM_OP_GEN_AGG_VECT_IDX (0xFF<<8)
3275#define SDM_OP_GEN_AGG_VECT_IDX_SHIFT 8
3276#define SDM_OP_GEN_AGG_VECT_IDX_VALID (0x1<<16)
3277#define SDM_OP_GEN_AGG_VECT_IDX_VALID_SHIFT 16
3278#define SDM_OP_GEN_RESERVED (0x7FFF<<17)
3279#define SDM_OP_GEN_RESERVED_SHIFT 17
Eilon Greenstein34f80b02008-06-23 20:33:01 -07003280};
3281
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003282
3283/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003284 * Timers connection context
Eilon Greenstein34f80b02008-06-23 20:33:01 -07003285 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003286struct timers_block_context {
3287 u32 __reserved_0;
3288 u32 __reserved_1;
3289 u32 __reserved_2;
3290 u32 flags;
3291#define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS (0x3<<0)
3292#define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS_SHIFT 0
3293#define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG (0x1<<2)
3294#define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG_SHIFT 2
3295#define __TIMERS_BLOCK_CONTEXT_RESERVED0 (0x1FFFFFFF<<3)
3296#define __TIMERS_BLOCK_CONTEXT_RESERVED0_SHIFT 3
Eilon Greenstein34f80b02008-06-23 20:33:01 -07003297};
3298
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003299
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003300/*
3301 * The eth aggregative context of Tstorm
3302 */
3303struct tstorm_eth_ag_context {
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003304 u32 __reserved0[14];
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003305};
3306
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003307
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003308/*
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003309 * The eth aggregative context of Ustorm
3310 */
3311struct ustorm_eth_ag_context {
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003312 u32 __reserved0;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003313#if defined(__BIG_ENDIAN)
3314 u8 cdu_usage;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003315 u8 __reserved2;
3316 u16 __reserved1;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003317#elif defined(__LITTLE_ENDIAN)
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003318 u16 __reserved1;
3319 u8 __reserved2;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003320 u8 cdu_usage;
3321#endif
Dmitry Kravkov523224a2010-10-06 03:23:26 +00003322 u32 __reserved3[6];
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003323};
3324
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003325
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003326/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003327 * The eth aggregative context of Xstorm
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003328 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003329struct xstorm_eth_ag_context {
3330 u32 reserved0;
3331#if defined(__BIG_ENDIAN)
3332 u8 cdu_reserved;
3333 u8 reserved2;
3334 u16 reserved1;
3335#elif defined(__LITTLE_ENDIAN)
3336 u16 reserved1;
3337 u8 reserved2;
3338 u8 cdu_reserved;
3339#endif
3340 u32 reserved3[30];
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02003341};
3342
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003343
3344/*
3345 * doorbell message sent to the chip
3346 */
3347struct doorbell {
3348#if defined(__BIG_ENDIAN)
3349 u16 zero_fill2;
3350 u8 zero_fill1;
3351 struct doorbell_hdr header;
3352#elif defined(__LITTLE_ENDIAN)
3353 struct doorbell_hdr header;
3354 u8 zero_fill1;
3355 u16 zero_fill2;
3356#endif
3357};
3358
3359
3360/*
3361 * doorbell message sent to the chip
3362 */
3363struct doorbell_set_prod {
3364#if defined(__BIG_ENDIAN)
3365 u16 prod;
3366 u8 zero_fill1;
3367 struct doorbell_hdr header;
3368#elif defined(__LITTLE_ENDIAN)
3369 struct doorbell_hdr header;
3370 u8 zero_fill1;
3371 u16 prod;
3372#endif
3373};
3374
3375
3376struct regpair {
3377 __le32 lo;
3378 __le32 hi;
3379};
3380
Yuval Mintz86564c32013-01-23 03:21:50 +00003381struct regpair_native {
3382 u32 lo;
3383 u32 hi;
3384};
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003385
3386/*
3387 * Classify rule opcodes in E2/E3
3388 */
3389enum classify_rule {
3390 CLASSIFY_RULE_OPCODE_MAC,
3391 CLASSIFY_RULE_OPCODE_VLAN,
3392 CLASSIFY_RULE_OPCODE_PAIR,
3393 MAX_CLASSIFY_RULE
3394};
3395
3396
3397/*
3398 * Classify rule types in E2/E3
3399 */
3400enum classify_rule_action_type {
3401 CLASSIFY_RULE_REMOVE,
3402 CLASSIFY_RULE_ADD,
3403 MAX_CLASSIFY_RULE_ACTION_TYPE
3404};
3405
3406
3407/*
3408 * client init ramrod data
3409 */
3410struct client_init_general_data {
3411 u8 client_id;
3412 u8 statistics_counter_id;
3413 u8 statistics_en_flg;
3414 u8 is_fcoe_flg;
3415 u8 activate_flg;
3416 u8 sp_client_id;
3417 __le16 mtu;
3418 u8 statistics_zero_flg;
3419 u8 func_id;
3420 u8 cos;
3421 u8 traffic_type;
3422 u32 reserved0;
3423};
3424
3425
3426/*
3427 * client init rx data
3428 */
3429struct client_init_rx_data {
3430 u8 tpa_en;
3431#define CLIENT_INIT_RX_DATA_TPA_EN_IPV4 (0x1<<0)
3432#define CLIENT_INIT_RX_DATA_TPA_EN_IPV4_SHIFT 0
3433#define CLIENT_INIT_RX_DATA_TPA_EN_IPV6 (0x1<<1)
3434#define CLIENT_INIT_RX_DATA_TPA_EN_IPV6_SHIFT 1
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00003435#define CLIENT_INIT_RX_DATA_TPA_MODE (0x1<<2)
3436#define CLIENT_INIT_RX_DATA_TPA_MODE_SHIFT 2
3437#define CLIENT_INIT_RX_DATA_RESERVED5 (0x1F<<3)
3438#define CLIENT_INIT_RX_DATA_RESERVED5_SHIFT 3
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003439 u8 vmqueue_mode_en_flg;
3440 u8 extra_data_over_sgl_en_flg;
3441 u8 cache_line_alignment_log_size;
3442 u8 enable_dynamic_hc;
3443 u8 max_sges_for_packet;
3444 u8 client_qzone_id;
3445 u8 drop_ip_cs_err_flg;
3446 u8 drop_tcp_cs_err_flg;
3447 u8 drop_ttl0_flg;
3448 u8 drop_udp_cs_err_flg;
3449 u8 inner_vlan_removal_enable_flg;
3450 u8 outer_vlan_removal_enable_flg;
3451 u8 status_block_id;
3452 u8 rx_sb_index_number;
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00003453 u8 dont_verify_rings_pause_thr_flg;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003454 u8 max_tpa_queues;
3455 u8 silent_vlan_removal_flg;
3456 __le16 max_bytes_on_bd;
3457 __le16 sge_buff_size;
3458 u8 approx_mcast_engine_id;
3459 u8 rss_engine_id;
3460 struct regpair bd_page_base;
3461 struct regpair sge_page_base;
3462 struct regpair cqe_page_base;
3463 u8 is_leading_rss;
3464 u8 is_approx_mcast;
3465 __le16 max_agg_size;
3466 __le16 state;
3467#define CLIENT_INIT_RX_DATA_UCAST_DROP_ALL (0x1<<0)
3468#define CLIENT_INIT_RX_DATA_UCAST_DROP_ALL_SHIFT 0
3469#define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_ALL (0x1<<1)
3470#define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_ALL_SHIFT 1
3471#define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_UNMATCHED (0x1<<2)
3472#define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_UNMATCHED_SHIFT 2
3473#define CLIENT_INIT_RX_DATA_MCAST_DROP_ALL (0x1<<3)
3474#define CLIENT_INIT_RX_DATA_MCAST_DROP_ALL_SHIFT 3
3475#define CLIENT_INIT_RX_DATA_MCAST_ACCEPT_ALL (0x1<<4)
3476#define CLIENT_INIT_RX_DATA_MCAST_ACCEPT_ALL_SHIFT 4
3477#define CLIENT_INIT_RX_DATA_BCAST_ACCEPT_ALL (0x1<<5)
3478#define CLIENT_INIT_RX_DATA_BCAST_ACCEPT_ALL_SHIFT 5
3479#define CLIENT_INIT_RX_DATA_ACCEPT_ANY_VLAN (0x1<<6)
3480#define CLIENT_INIT_RX_DATA_ACCEPT_ANY_VLAN_SHIFT 6
3481#define CLIENT_INIT_RX_DATA_RESERVED2 (0x1FF<<7)
3482#define CLIENT_INIT_RX_DATA_RESERVED2_SHIFT 7
3483 __le16 cqe_pause_thr_low;
3484 __le16 cqe_pause_thr_high;
3485 __le16 bd_pause_thr_low;
3486 __le16 bd_pause_thr_high;
3487 __le16 sge_pause_thr_low;
3488 __le16 sge_pause_thr_high;
3489 __le16 rx_cos_mask;
3490 __le16 silent_vlan_value;
3491 __le16 silent_vlan_mask;
3492 __le32 reserved6[2];
3493};
3494
3495/*
3496 * client init tx data
3497 */
3498struct client_init_tx_data {
3499 u8 enforce_security_flg;
3500 u8 tx_status_block_id;
3501 u8 tx_sb_index_number;
3502 u8 tss_leading_client_id;
3503 u8 tx_switching_flg;
3504 u8 anti_spoofing_flg;
3505 __le16 default_vlan;
3506 struct regpair tx_bd_page_base;
3507 __le16 state;
3508#define CLIENT_INIT_TX_DATA_UCAST_ACCEPT_ALL (0x1<<0)
3509#define CLIENT_INIT_TX_DATA_UCAST_ACCEPT_ALL_SHIFT 0
3510#define CLIENT_INIT_TX_DATA_MCAST_ACCEPT_ALL (0x1<<1)
3511#define CLIENT_INIT_TX_DATA_MCAST_ACCEPT_ALL_SHIFT 1
3512#define CLIENT_INIT_TX_DATA_BCAST_ACCEPT_ALL (0x1<<2)
3513#define CLIENT_INIT_TX_DATA_BCAST_ACCEPT_ALL_SHIFT 2
3514#define CLIENT_INIT_TX_DATA_ACCEPT_ANY_VLAN (0x1<<3)
3515#define CLIENT_INIT_TX_DATA_ACCEPT_ANY_VLAN_SHIFT 3
3516#define CLIENT_INIT_TX_DATA_RESERVED1 (0xFFF<<4)
3517#define CLIENT_INIT_TX_DATA_RESERVED1_SHIFT 4
3518 u8 default_vlan_flg;
Barak Witkowskia3348722012-04-23 03:04:46 +00003519 u8 force_default_pri_flg;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003520 __le32 reserved3;
3521};
3522
3523/*
3524 * client init ramrod data
3525 */
3526struct client_init_ramrod_data {
3527 struct client_init_general_data general;
3528 struct client_init_rx_data rx;
3529 struct client_init_tx_data tx;
3530};
3531
3532
3533/*
3534 * client update ramrod data
3535 */
3536struct client_update_ramrod_data {
3537 u8 client_id;
3538 u8 func_id;
3539 u8 inner_vlan_removal_enable_flg;
3540 u8 inner_vlan_removal_change_flg;
3541 u8 outer_vlan_removal_enable_flg;
3542 u8 outer_vlan_removal_change_flg;
3543 u8 anti_spoofing_enable_flg;
3544 u8 anti_spoofing_change_flg;
3545 u8 activate_flg;
3546 u8 activate_change_flg;
3547 __le16 default_vlan;
3548 u8 default_vlan_enable_flg;
3549 u8 default_vlan_change_flg;
3550 __le16 silent_vlan_value;
3551 __le16 silent_vlan_mask;
3552 u8 silent_vlan_removal_flg;
3553 u8 silent_vlan_change_flg;
3554 __le32 echo;
3555};
3556
3557
3558/*
3559 * The eth storm context of Cstorm
3560 */
3561struct cstorm_eth_st_context {
3562 u32 __reserved0[4];
3563};
3564
3565
3566struct double_regpair {
3567 u32 regpair0_lo;
3568 u32 regpair0_hi;
3569 u32 regpair1_lo;
3570 u32 regpair1_hi;
3571};
3572
3573
3574/*
3575 * Ethernet address typesm used in ethernet tx BDs
3576 */
3577enum eth_addr_type {
3578 UNKNOWN_ADDRESS,
3579 UNICAST_ADDRESS,
3580 MULTICAST_ADDRESS,
3581 BROADCAST_ADDRESS,
3582 MAX_ETH_ADDR_TYPE
3583};
3584
3585
3586/*
3587 *
3588 */
3589struct eth_classify_cmd_header {
3590 u8 cmd_general_data;
3591#define ETH_CLASSIFY_CMD_HEADER_RX_CMD (0x1<<0)
3592#define ETH_CLASSIFY_CMD_HEADER_RX_CMD_SHIFT 0
3593#define ETH_CLASSIFY_CMD_HEADER_TX_CMD (0x1<<1)
3594#define ETH_CLASSIFY_CMD_HEADER_TX_CMD_SHIFT 1
3595#define ETH_CLASSIFY_CMD_HEADER_OPCODE (0x3<<2)
3596#define ETH_CLASSIFY_CMD_HEADER_OPCODE_SHIFT 2
3597#define ETH_CLASSIFY_CMD_HEADER_IS_ADD (0x1<<4)
3598#define ETH_CLASSIFY_CMD_HEADER_IS_ADD_SHIFT 4
3599#define ETH_CLASSIFY_CMD_HEADER_RESERVED0 (0x7<<5)
3600#define ETH_CLASSIFY_CMD_HEADER_RESERVED0_SHIFT 5
3601 u8 func_id;
3602 u8 client_id;
3603 u8 reserved1;
3604};
3605
3606
3607/*
3608 * header for eth classification config ramrod
3609 */
3610struct eth_classify_header {
3611 u8 rule_cnt;
3612 u8 reserved0;
3613 __le16 reserved1;
3614 __le32 echo;
3615};
3616
3617
3618/*
3619 * Command for adding/removing a MAC classification rule
3620 */
3621struct eth_classify_mac_cmd {
3622 struct eth_classify_cmd_header header;
3623 __le32 reserved0;
3624 __le16 mac_lsb;
3625 __le16 mac_mid;
3626 __le16 mac_msb;
3627 __le16 reserved1;
3628};
3629
3630
3631/*
3632 * Command for adding/removing a MAC-VLAN pair classification rule
3633 */
3634struct eth_classify_pair_cmd {
3635 struct eth_classify_cmd_header header;
3636 __le32 reserved0;
3637 __le16 mac_lsb;
3638 __le16 mac_mid;
3639 __le16 mac_msb;
3640 __le16 vlan;
3641};
3642
3643
3644/*
3645 * Command for adding/removing a VLAN classification rule
3646 */
3647struct eth_classify_vlan_cmd {
3648 struct eth_classify_cmd_header header;
3649 __le32 reserved0;
3650 __le32 reserved1;
3651 __le16 reserved2;
3652 __le16 vlan;
3653};
3654
3655/*
3656 * union for eth classification rule
3657 */
3658union eth_classify_rule_cmd {
3659 struct eth_classify_mac_cmd mac;
3660 struct eth_classify_vlan_cmd vlan;
3661 struct eth_classify_pair_cmd pair;
3662};
3663
3664/*
3665 * parameters for eth classification configuration ramrod
3666 */
3667struct eth_classify_rules_ramrod_data {
3668 struct eth_classify_header header;
3669 union eth_classify_rule_cmd rules[CLASSIFY_RULES_COUNT];
3670};
3671
3672
3673/*
3674 * The data contain client ID need to the ramrod
3675 */
3676struct eth_common_ramrod_data {
3677 __le32 client_id;
3678 __le32 reserved1;
3679};
3680
3681
3682/*
3683 * The eth storm context of Ustorm
3684 */
3685struct ustorm_eth_st_context {
3686 u32 reserved0[52];
3687};
3688
3689/*
3690 * The eth storm context of Tstorm
3691 */
3692struct tstorm_eth_st_context {
3693 u32 __reserved0[28];
3694};
3695
3696/*
3697 * The eth storm context of Xstorm
3698 */
3699struct xstorm_eth_st_context {
3700 u32 reserved0[60];
3701};
3702
3703/*
3704 * Ethernet connection context
3705 */
3706struct eth_context {
3707 struct ustorm_eth_st_context ustorm_st_context;
3708 struct tstorm_eth_st_context tstorm_st_context;
3709 struct xstorm_eth_ag_context xstorm_ag_context;
3710 struct tstorm_eth_ag_context tstorm_ag_context;
3711 struct cstorm_eth_ag_context cstorm_ag_context;
3712 struct ustorm_eth_ag_context ustorm_ag_context;
3713 struct timers_block_context timers_context;
3714 struct xstorm_eth_st_context xstorm_st_context;
3715 struct cstorm_eth_st_context cstorm_st_context;
3716};
3717
3718
3719/*
3720 * union for sgl and raw data.
3721 */
3722union eth_sgl_or_raw_data {
3723 __le16 sgl[8];
3724 u32 raw_data[4];
3725};
3726
3727/*
3728 * eth FP end aggregation CQE parameters struct
3729 */
3730struct eth_end_agg_rx_cqe {
3731 u8 type_error_flags;
3732#define ETH_END_AGG_RX_CQE_TYPE (0x3<<0)
3733#define ETH_END_AGG_RX_CQE_TYPE_SHIFT 0
3734#define ETH_END_AGG_RX_CQE_SGL_RAW_SEL (0x1<<2)
3735#define ETH_END_AGG_RX_CQE_SGL_RAW_SEL_SHIFT 2
3736#define ETH_END_AGG_RX_CQE_RESERVED0 (0x1F<<3)
3737#define ETH_END_AGG_RX_CQE_RESERVED0_SHIFT 3
3738 u8 reserved1;
3739 u8 queue_index;
3740 u8 reserved2;
3741 __le32 timestamp_delta;
3742 __le16 num_of_coalesced_segs;
3743 __le16 pkt_len;
3744 u8 pure_ack_count;
3745 u8 reserved3;
3746 __le16 reserved4;
3747 union eth_sgl_or_raw_data sgl_or_raw_data;
3748 __le32 reserved5[8];
3749};
3750
3751
3752/*
3753 * regular eth FP CQE parameters struct
3754 */
3755struct eth_fast_path_rx_cqe {
3756 u8 type_error_flags;
3757#define ETH_FAST_PATH_RX_CQE_TYPE (0x3<<0)
3758#define ETH_FAST_PATH_RX_CQE_TYPE_SHIFT 0
3759#define ETH_FAST_PATH_RX_CQE_SGL_RAW_SEL (0x1<<2)
3760#define ETH_FAST_PATH_RX_CQE_SGL_RAW_SEL_SHIFT 2
3761#define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG (0x1<<3)
3762#define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG_SHIFT 3
3763#define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG (0x1<<4)
3764#define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG_SHIFT 4
3765#define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG (0x1<<5)
3766#define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG_SHIFT 5
3767#define ETH_FAST_PATH_RX_CQE_RESERVED0 (0x3<<6)
3768#define ETH_FAST_PATH_RX_CQE_RESERVED0_SHIFT 6
3769 u8 status_flags;
3770#define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE (0x7<<0)
3771#define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE_SHIFT 0
3772#define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG (0x1<<3)
3773#define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG_SHIFT 3
3774#define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG (0x1<<4)
3775#define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG_SHIFT 4
3776#define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG (0x1<<5)
3777#define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG_SHIFT 5
3778#define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG (0x1<<6)
3779#define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG_SHIFT 6
3780#define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG (0x1<<7)
3781#define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG_SHIFT 7
3782 u8 queue_index;
3783 u8 placement_offset;
3784 __le32 rss_hash_result;
3785 __le16 vlan_tag;
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00003786 __le16 pkt_len_or_gro_seg_len;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003787 __le16 len_on_bd;
3788 struct parsing_flags pars_flags;
3789 union eth_sgl_or_raw_data sgl_or_raw_data;
3790 __le32 reserved1[8];
3791};
3792
3793
3794/*
3795 * Command for setting classification flags for a client
3796 */
3797struct eth_filter_rules_cmd {
3798 u8 cmd_general_data;
3799#define ETH_FILTER_RULES_CMD_RX_CMD (0x1<<0)
3800#define ETH_FILTER_RULES_CMD_RX_CMD_SHIFT 0
3801#define ETH_FILTER_RULES_CMD_TX_CMD (0x1<<1)
3802#define ETH_FILTER_RULES_CMD_TX_CMD_SHIFT 1
3803#define ETH_FILTER_RULES_CMD_RESERVED0 (0x3F<<2)
3804#define ETH_FILTER_RULES_CMD_RESERVED0_SHIFT 2
3805 u8 func_id;
3806 u8 client_id;
3807 u8 reserved1;
3808 __le16 state;
3809#define ETH_FILTER_RULES_CMD_UCAST_DROP_ALL (0x1<<0)
3810#define ETH_FILTER_RULES_CMD_UCAST_DROP_ALL_SHIFT 0
3811#define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_ALL (0x1<<1)
3812#define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_ALL_SHIFT 1
3813#define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_UNMATCHED (0x1<<2)
3814#define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_UNMATCHED_SHIFT 2
3815#define ETH_FILTER_RULES_CMD_MCAST_DROP_ALL (0x1<<3)
3816#define ETH_FILTER_RULES_CMD_MCAST_DROP_ALL_SHIFT 3
3817#define ETH_FILTER_RULES_CMD_MCAST_ACCEPT_ALL (0x1<<4)
3818#define ETH_FILTER_RULES_CMD_MCAST_ACCEPT_ALL_SHIFT 4
3819#define ETH_FILTER_RULES_CMD_BCAST_ACCEPT_ALL (0x1<<5)
3820#define ETH_FILTER_RULES_CMD_BCAST_ACCEPT_ALL_SHIFT 5
3821#define ETH_FILTER_RULES_CMD_ACCEPT_ANY_VLAN (0x1<<6)
3822#define ETH_FILTER_RULES_CMD_ACCEPT_ANY_VLAN_SHIFT 6
3823#define ETH_FILTER_RULES_CMD_RESERVED2 (0x1FF<<7)
3824#define ETH_FILTER_RULES_CMD_RESERVED2_SHIFT 7
3825 __le16 reserved3;
3826 struct regpair reserved4;
3827};
3828
3829
3830/*
3831 * parameters for eth classification filters ramrod
3832 */
3833struct eth_filter_rules_ramrod_data {
3834 struct eth_classify_header header;
3835 struct eth_filter_rules_cmd rules[FILTER_RULES_COUNT];
3836};
3837
3838
3839/*
3840 * parameters for eth classification configuration ramrod
3841 */
3842struct eth_general_rules_ramrod_data {
3843 struct eth_classify_header header;
3844 union eth_classify_rule_cmd rules[CLASSIFY_RULES_COUNT];
3845};
3846
3847
3848/*
3849 * The data for Halt ramrod
3850 */
3851struct eth_halt_ramrod_data {
3852 __le32 client_id;
3853 __le32 reserved0;
3854};
3855
3856
3857/*
3858 * Command for setting multicast classification for a client
3859 */
3860struct eth_multicast_rules_cmd {
3861 u8 cmd_general_data;
3862#define ETH_MULTICAST_RULES_CMD_RX_CMD (0x1<<0)
3863#define ETH_MULTICAST_RULES_CMD_RX_CMD_SHIFT 0
3864#define ETH_MULTICAST_RULES_CMD_TX_CMD (0x1<<1)
3865#define ETH_MULTICAST_RULES_CMD_TX_CMD_SHIFT 1
3866#define ETH_MULTICAST_RULES_CMD_IS_ADD (0x1<<2)
3867#define ETH_MULTICAST_RULES_CMD_IS_ADD_SHIFT 2
3868#define ETH_MULTICAST_RULES_CMD_RESERVED0 (0x1F<<3)
3869#define ETH_MULTICAST_RULES_CMD_RESERVED0_SHIFT 3
3870 u8 func_id;
3871 u8 bin_id;
3872 u8 engine_id;
3873 __le32 reserved2;
3874 struct regpair reserved3;
3875};
3876
3877
3878/*
3879 * parameters for multicast classification ramrod
3880 */
3881struct eth_multicast_rules_ramrod_data {
3882 struct eth_classify_header header;
3883 struct eth_multicast_rules_cmd rules[MULTICAST_RULES_COUNT];
3884};
3885
3886
3887/*
3888 * Place holder for ramrods protocol specific data
3889 */
3890struct ramrod_data {
3891 __le32 data_lo;
3892 __le32 data_hi;
3893};
3894
3895/*
3896 * union for ramrod data for Ethernet protocol (CQE) (force size of 16 bits)
3897 */
3898union eth_ramrod_data {
3899 struct ramrod_data general;
3900};
3901
3902
3903/*
3904 * RSS toeplitz hash type, as reported in CQE
3905 */
3906enum eth_rss_hash_type {
3907 DEFAULT_HASH_TYPE,
3908 IPV4_HASH_TYPE,
3909 TCP_IPV4_HASH_TYPE,
3910 IPV6_HASH_TYPE,
3911 TCP_IPV6_HASH_TYPE,
3912 VLAN_PRI_HASH_TYPE,
3913 E1HOV_PRI_HASH_TYPE,
3914 DSCP_HASH_TYPE,
3915 MAX_ETH_RSS_HASH_TYPE
3916};
3917
3918
3919/*
3920 * Ethernet RSS mode
3921 */
3922enum eth_rss_mode {
3923 ETH_RSS_MODE_DISABLED,
3924 ETH_RSS_MODE_REGULAR,
3925 ETH_RSS_MODE_VLAN_PRI,
3926 ETH_RSS_MODE_E1HOV_PRI,
3927 ETH_RSS_MODE_IP_DSCP,
3928 MAX_ETH_RSS_MODE
3929};
3930
3931
3932/*
3933 * parameters for RSS update ramrod (E2)
3934 */
3935struct eth_rss_update_ramrod_data {
3936 u8 rss_engine_id;
3937 u8 capabilities;
3938#define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_CAPABILITY (0x1<<0)
3939#define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_CAPABILITY_SHIFT 0
3940#define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_TCP_CAPABILITY (0x1<<1)
3941#define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_TCP_CAPABILITY_SHIFT 1
3942#define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_UDP_CAPABILITY (0x1<<2)
3943#define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_UDP_CAPABILITY_SHIFT 2
3944#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_CAPABILITY (0x1<<3)
3945#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_CAPABILITY_SHIFT 3
3946#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY (0x1<<4)
3947#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY_SHIFT 4
3948#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY (0x1<<5)
3949#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY_SHIFT 5
Yuval Mintz96bed4b2012-10-01 03:46:19 +00003950#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY (0x1<<7)
3951#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY_SHIFT 7
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03003952 u8 rss_result_mask;
3953 u8 rss_mode;
3954 __le32 __reserved2;
3955 u8 indirection_table[T_ETH_INDIRECTION_TABLE_SIZE];
3956 __le32 rss_key[T_ETH_RSS_KEY];
3957 __le32 echo;
3958 __le32 reserved3;
3959};
3960
3961
3962/*
3963 * The eth Rx Buffer Descriptor
3964 */
3965struct eth_rx_bd {
3966 __le32 addr_lo;
3967 __le32 addr_hi;
3968};
3969
3970
3971/*
3972 * Eth Rx Cqe structure- general structure for ramrods
3973 */
3974struct common_ramrod_eth_rx_cqe {
3975 u8 ramrod_type;
3976#define COMMON_RAMROD_ETH_RX_CQE_TYPE (0x3<<0)
3977#define COMMON_RAMROD_ETH_RX_CQE_TYPE_SHIFT 0
3978#define COMMON_RAMROD_ETH_RX_CQE_ERROR (0x1<<2)
3979#define COMMON_RAMROD_ETH_RX_CQE_ERROR_SHIFT 2
3980#define COMMON_RAMROD_ETH_RX_CQE_RESERVED0 (0x1F<<3)
3981#define COMMON_RAMROD_ETH_RX_CQE_RESERVED0_SHIFT 3
3982 u8 conn_type;
3983 __le16 reserved1;
3984 __le32 conn_and_cmd_data;
3985#define COMMON_RAMROD_ETH_RX_CQE_CID (0xFFFFFF<<0)
3986#define COMMON_RAMROD_ETH_RX_CQE_CID_SHIFT 0
3987#define COMMON_RAMROD_ETH_RX_CQE_CMD_ID (0xFF<<24)
3988#define COMMON_RAMROD_ETH_RX_CQE_CMD_ID_SHIFT 24
3989 struct ramrod_data protocol_data;
3990 __le32 echo;
3991 __le32 reserved2[11];
3992};
3993
3994/*
3995 * Rx Last CQE in page (in ETH)
3996 */
3997struct eth_rx_cqe_next_page {
3998 __le32 addr_lo;
3999 __le32 addr_hi;
4000 __le32 reserved[14];
4001};
4002
4003/*
4004 * union for all eth rx cqe types (fix their sizes)
4005 */
4006union eth_rx_cqe {
4007 struct eth_fast_path_rx_cqe fast_path_cqe;
4008 struct common_ramrod_eth_rx_cqe ramrod_cqe;
4009 struct eth_rx_cqe_next_page next_page_cqe;
4010 struct eth_end_agg_rx_cqe end_agg_cqe;
4011};
4012
4013
4014/*
4015 * Values for RX ETH CQE type field
4016 */
4017enum eth_rx_cqe_type {
4018 RX_ETH_CQE_TYPE_ETH_FASTPATH,
4019 RX_ETH_CQE_TYPE_ETH_RAMROD,
4020 RX_ETH_CQE_TYPE_ETH_START_AGG,
4021 RX_ETH_CQE_TYPE_ETH_STOP_AGG,
4022 MAX_ETH_RX_CQE_TYPE
4023};
4024
4025
4026/*
4027 * Type of SGL/Raw field in ETH RX fast path CQE
4028 */
4029enum eth_rx_fp_sel {
4030 ETH_FP_CQE_REGULAR,
4031 ETH_FP_CQE_RAW,
4032 MAX_ETH_RX_FP_SEL
4033};
4034
4035
4036/*
4037 * The eth Rx SGE Descriptor
4038 */
4039struct eth_rx_sge {
4040 __le32 addr_lo;
4041 __le32 addr_hi;
4042};
4043
4044
4045/*
4046 * common data for all protocols
4047 */
4048struct spe_hdr {
4049 __le32 conn_and_cmd_data;
4050#define SPE_HDR_CID (0xFFFFFF<<0)
4051#define SPE_HDR_CID_SHIFT 0
4052#define SPE_HDR_CMD_ID (0xFF<<24)
4053#define SPE_HDR_CMD_ID_SHIFT 24
4054 __le16 type;
4055#define SPE_HDR_CONN_TYPE (0xFF<<0)
4056#define SPE_HDR_CONN_TYPE_SHIFT 0
4057#define SPE_HDR_FUNCTION_ID (0xFF<<8)
4058#define SPE_HDR_FUNCTION_ID_SHIFT 8
4059 __le16 reserved1;
4060};
4061
4062/*
4063 * specific data for ethernet slow path element
4064 */
4065union eth_specific_data {
4066 u8 protocol_data[8];
4067 struct regpair client_update_ramrod_data;
4068 struct regpair client_init_ramrod_init_data;
4069 struct eth_halt_ramrod_data halt_ramrod_data;
4070 struct regpair update_data_addr;
4071 struct eth_common_ramrod_data common_ramrod_data;
4072 struct regpair classify_cfg_addr;
4073 struct regpair filter_cfg_addr;
4074 struct regpair mcast_cfg_addr;
4075};
4076
4077/*
4078 * Ethernet slow path element
4079 */
4080struct eth_spe {
4081 struct spe_hdr hdr;
4082 union eth_specific_data data;
4083};
4084
4085
4086/*
4087 * Ethernet command ID for slow path elements
4088 */
4089enum eth_spqe_cmd_id {
4090 RAMROD_CMD_ID_ETH_UNUSED,
4091 RAMROD_CMD_ID_ETH_CLIENT_SETUP,
4092 RAMROD_CMD_ID_ETH_HALT,
4093 RAMROD_CMD_ID_ETH_FORWARD_SETUP,
4094 RAMROD_CMD_ID_ETH_TX_QUEUE_SETUP,
4095 RAMROD_CMD_ID_ETH_CLIENT_UPDATE,
4096 RAMROD_CMD_ID_ETH_EMPTY,
4097 RAMROD_CMD_ID_ETH_TERMINATE,
4098 RAMROD_CMD_ID_ETH_TPA_UPDATE,
4099 RAMROD_CMD_ID_ETH_CLASSIFICATION_RULES,
4100 RAMROD_CMD_ID_ETH_FILTER_RULES,
4101 RAMROD_CMD_ID_ETH_MULTICAST_RULES,
4102 RAMROD_CMD_ID_ETH_RSS_UPDATE,
4103 RAMROD_CMD_ID_ETH_SET_MAC,
4104 MAX_ETH_SPQE_CMD_ID
4105};
4106
4107
4108/*
4109 * eth tpa update command
4110 */
4111enum eth_tpa_update_command {
4112 TPA_UPDATE_NONE_COMMAND,
4113 TPA_UPDATE_ENABLE_COMMAND,
4114 TPA_UPDATE_DISABLE_COMMAND,
4115 MAX_ETH_TPA_UPDATE_COMMAND
4116};
4117
4118
4119/*
4120 * Tx regular BD structure
4121 */
4122struct eth_tx_bd {
4123 __le32 addr_lo;
4124 __le32 addr_hi;
4125 __le16 total_pkt_bytes;
4126 __le16 nbytes;
4127 u8 reserved[4];
4128};
4129
4130
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004131/*
Eilon Greenstein33471622008-08-13 15:59:08 -07004132 * structure for easy accessibility to assembler
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004133 */
4134struct eth_tx_bd_flags {
4135 u8 as_bitfield;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004136#define ETH_TX_BD_FLAGS_IP_CSUM (0x1<<0)
4137#define ETH_TX_BD_FLAGS_IP_CSUM_SHIFT 0
4138#define ETH_TX_BD_FLAGS_L4_CSUM (0x1<<1)
4139#define ETH_TX_BD_FLAGS_L4_CSUM_SHIFT 1
4140#define ETH_TX_BD_FLAGS_VLAN_MODE (0x3<<2)
4141#define ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT 2
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004142#define ETH_TX_BD_FLAGS_START_BD (0x1<<4)
4143#define ETH_TX_BD_FLAGS_START_BD_SHIFT 4
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004144#define ETH_TX_BD_FLAGS_IS_UDP (0x1<<5)
4145#define ETH_TX_BD_FLAGS_IS_UDP_SHIFT 5
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004146#define ETH_TX_BD_FLAGS_SW_LSO (0x1<<6)
4147#define ETH_TX_BD_FLAGS_SW_LSO_SHIFT 6
4148#define ETH_TX_BD_FLAGS_IPV6 (0x1<<7)
4149#define ETH_TX_BD_FLAGS_IPV6_SHIFT 7
4150};
4151
4152/*
4153 * The eth Tx Buffer Descriptor
4154 */
Eilon Greensteinca003922009-08-12 22:53:28 -07004155struct eth_tx_start_bd {
Eilon Greenstein4781bfa2009-02-12 08:38:17 +00004156 __le32 addr_lo;
4157 __le32 addr_hi;
4158 __le16 nbd;
4159 __le16 nbytes;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004160 __le16 vlan_or_ethertype;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004161 struct eth_tx_bd_flags bd_flags;
4162 u8 general_data;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004163#define ETH_TX_START_BD_HDR_NBDS (0xF<<0)
Eilon Greensteinca003922009-08-12 22:53:28 -07004164#define ETH_TX_START_BD_HDR_NBDS_SHIFT 0
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004165#define ETH_TX_START_BD_FORCE_VLAN_MODE (0x1<<4)
4166#define ETH_TX_START_BD_FORCE_VLAN_MODE_SHIFT 4
Yuval Mintz96bed4b2012-10-01 03:46:19 +00004167#define ETH_TX_START_BD_PARSE_NBDS (0x3<<5)
4168#define ETH_TX_START_BD_PARSE_NBDS_SHIFT 5
4169#define ETH_TX_START_BD_RESREVED (0x1<<7)
4170#define ETH_TX_START_BD_RESREVED_SHIFT 7
Eilon Greensteinca003922009-08-12 22:53:28 -07004171};
4172
4173/*
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004174 * Tx parsing BD structure for ETH E1/E1h
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004175 */
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004176struct eth_tx_parse_bd_e1x {
Yuval Mintz96bed4b2012-10-01 03:46:19 +00004177 __le16 global_data;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004178#define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W (0xF<<0)
4179#define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W_SHIFT 0
Yuval Mintz96bed4b2012-10-01 03:46:19 +00004180#define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE (0x3<<4)
4181#define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE_SHIFT 4
4182#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN (0x1<<6)
4183#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN_SHIFT 6
4184#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN (0x1<<7)
4185#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT 7
4186#define ETH_TX_PARSE_BD_E1X_NS_FLG (0x1<<8)
4187#define ETH_TX_PARSE_BD_E1X_NS_FLG_SHIFT 8
4188#define ETH_TX_PARSE_BD_E1X_RESERVED0 (0x7F<<9)
4189#define ETH_TX_PARSE_BD_E1X_RESERVED0_SHIFT 9
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004190 u8 tcp_flags;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004191#define ETH_TX_PARSE_BD_E1X_FIN_FLG (0x1<<0)
4192#define ETH_TX_PARSE_BD_E1X_FIN_FLG_SHIFT 0
4193#define ETH_TX_PARSE_BD_E1X_SYN_FLG (0x1<<1)
4194#define ETH_TX_PARSE_BD_E1X_SYN_FLG_SHIFT 1
4195#define ETH_TX_PARSE_BD_E1X_RST_FLG (0x1<<2)
4196#define ETH_TX_PARSE_BD_E1X_RST_FLG_SHIFT 2
4197#define ETH_TX_PARSE_BD_E1X_PSH_FLG (0x1<<3)
4198#define ETH_TX_PARSE_BD_E1X_PSH_FLG_SHIFT 3
4199#define ETH_TX_PARSE_BD_E1X_ACK_FLG (0x1<<4)
4200#define ETH_TX_PARSE_BD_E1X_ACK_FLG_SHIFT 4
4201#define ETH_TX_PARSE_BD_E1X_URG_FLG (0x1<<5)
4202#define ETH_TX_PARSE_BD_E1X_URG_FLG_SHIFT 5
4203#define ETH_TX_PARSE_BD_E1X_ECE_FLG (0x1<<6)
4204#define ETH_TX_PARSE_BD_E1X_ECE_FLG_SHIFT 6
4205#define ETH_TX_PARSE_BD_E1X_CWR_FLG (0x1<<7)
4206#define ETH_TX_PARSE_BD_E1X_CWR_FLG_SHIFT 7
4207 u8 ip_hlen_w;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004208 __le16 total_hlen_w;
Eilon Greenstein4781bfa2009-02-12 08:38:17 +00004209 __le16 tcp_pseudo_csum;
Eilon Greensteinca003922009-08-12 22:53:28 -07004210 __le16 lso_mss;
Eilon Greenstein4781bfa2009-02-12 08:38:17 +00004211 __le16 ip_id;
4212 __le32 tcp_send_seq;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004213};
4214
4215/*
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00004216 * Tx parsing BD structure for ETH E2
4217 */
4218struct eth_tx_parse_bd_e2 {
4219 __le16 dst_mac_addr_lo;
4220 __le16 dst_mac_addr_mid;
4221 __le16 dst_mac_addr_hi;
4222 __le16 src_mac_addr_lo;
4223 __le16 src_mac_addr_mid;
4224 __le16 src_mac_addr_hi;
4225 __le32 parsing_data;
Yuval Mintz96bed4b2012-10-01 03:46:19 +00004226#define ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W (0x7FF<<0)
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00004227#define ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT 0
Yuval Mintz96bed4b2012-10-01 03:46:19 +00004228#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW (0xF<<11)
4229#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT 11
4230#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR (0x1<<15)
4231#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR_SHIFT 15
4232#define ETH_TX_PARSE_BD_E2_LSO_MSS (0x3FFF<<16)
4233#define ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT 16
4234#define ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE (0x3<<30)
4235#define ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT 30
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00004236};
4237
4238/*
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004239 * The last BD in the BD memory will hold a pointer to the next BD memory
4240 */
4241struct eth_tx_next_bd {
Eilon Greensteinca003922009-08-12 22:53:28 -07004242 __le32 addr_lo;
4243 __le32 addr_hi;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004244 u8 reserved[8];
4245};
4246
4247/*
Eilon Greensteinca003922009-08-12 22:53:28 -07004248 * union for 4 Bd types
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004249 */
4250union eth_tx_bd_types {
Eilon Greensteinca003922009-08-12 22:53:28 -07004251 struct eth_tx_start_bd start_bd;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004252 struct eth_tx_bd reg_bd;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004253 struct eth_tx_parse_bd_e1x parse_bd_e1x;
Dmitry Kravkovf2e08992010-10-06 03:28:26 +00004254 struct eth_tx_parse_bd_e2 parse_bd_e2;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004255 struct eth_tx_next_bd next_bd;
4256};
4257
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004258/*
Eilon Greensteinca003922009-08-12 22:53:28 -07004259 * array of 13 bds as appears in the eth xstorm context
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004260 */
Eilon Greensteinca003922009-08-12 22:53:28 -07004261struct eth_tx_bds_array {
4262 union eth_tx_bd_types bds[13];
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004263};
4264
4265
4266/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004267 * VLAN mode on TX BDs
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004268 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004269enum eth_tx_vlan_type {
4270 X_ETH_NO_VLAN,
4271 X_ETH_OUTBAND_VLAN,
4272 X_ETH_INBAND_VLAN,
4273 X_ETH_FW_ADDED_VLAN,
4274 MAX_ETH_TX_VLAN_TYPE
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004275};
4276
Eilon Greensteinca003922009-08-12 22:53:28 -07004277
4278/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004279 * Ethernet VLAN filtering mode in E1x
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004280 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004281enum eth_vlan_filter_mode {
4282 ETH_VLAN_FILTER_ANY_VLAN,
4283 ETH_VLAN_FILTER_SPECIFIC_VLAN,
4284 ETH_VLAN_FILTER_CLASSIFY,
4285 MAX_ETH_VLAN_FILTER_MODE
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004286};
4287
4288
4289/*
4290 * MAC filtering configuration command header
4291 */
4292struct mac_configuration_hdr {
Eilon Greenstein8d9c5f32009-02-15 23:24:08 -08004293 u8 length;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004294 u8 offset;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004295 __le16 client_id;
4296 __le32 echo;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004297};
4298
4299/*
4300 * MAC address in list for ramrod
4301 */
4302struct mac_configuration_entry {
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004303 __le16 lsb_mac_addr;
4304 __le16 middle_mac_addr;
4305 __le16 msb_mac_addr;
4306 __le16 vlan_id;
4307 u8 pf_id;
4308 u8 flags;
4309#define MAC_CONFIGURATION_ENTRY_ACTION_TYPE (0x1<<0)
4310#define MAC_CONFIGURATION_ENTRY_ACTION_TYPE_SHIFT 0
4311#define MAC_CONFIGURATION_ENTRY_RDMA_MAC (0x1<<1)
4312#define MAC_CONFIGURATION_ENTRY_RDMA_MAC_SHIFT 1
4313#define MAC_CONFIGURATION_ENTRY_VLAN_FILTERING_MODE (0x3<<2)
4314#define MAC_CONFIGURATION_ENTRY_VLAN_FILTERING_MODE_SHIFT 2
4315#define MAC_CONFIGURATION_ENTRY_OVERRIDE_VLAN_REMOVAL (0x1<<4)
4316#define MAC_CONFIGURATION_ENTRY_OVERRIDE_VLAN_REMOVAL_SHIFT 4
4317#define MAC_CONFIGURATION_ENTRY_BROADCAST (0x1<<5)
4318#define MAC_CONFIGURATION_ENTRY_BROADCAST_SHIFT 5
4319#define MAC_CONFIGURATION_ENTRY_RESERVED1 (0x3<<6)
4320#define MAC_CONFIGURATION_ENTRY_RESERVED1_SHIFT 6
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004321 __le16 reserved0;
4322 __le32 clients_bit_vector;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004323};
4324
4325/*
4326 * MAC filtering configuration command
4327 */
4328struct mac_configuration_cmd {
4329 struct mac_configuration_hdr hdr;
4330 struct mac_configuration_entry config_table[64];
4331};
4332
4333
4334/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004335 * Set-MAC command type (in E1x)
4336 */
4337enum set_mac_action_type {
4338 T_ETH_MAC_COMMAND_INVALIDATE,
4339 T_ETH_MAC_COMMAND_SET,
4340 MAX_SET_MAC_ACTION_TYPE
4341};
4342
4343
4344/*
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00004345 * Ethernet TPA Modes
4346 */
4347enum tpa_mode {
4348 TPA_LRO,
4349 TPA_GRO,
4350 MAX_TPA_MODE};
4351
4352
4353/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004354 * tpa update ramrod data
4355 */
4356struct tpa_update_ramrod_data {
4357 u8 update_ipv4;
4358 u8 update_ipv6;
4359 u8 client_id;
4360 u8 max_tpa_queues;
4361 u8 max_sges_for_packet;
4362 u8 complete_on_both_clients;
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00004363 u8 dont_verify_rings_pause_thr_flg;
4364 u8 tpa_mode;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004365 __le16 sge_buff_size;
4366 __le16 max_agg_size;
4367 __le32 sge_page_base_lo;
4368 __le32 sge_page_base_hi;
4369 __le16 sge_pause_thr_low;
4370 __le16 sge_pause_thr_high;
4371};
4372
4373
4374/*
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004375 * approximate-match multicast filtering for E1H per function in Tstorm
4376 */
4377struct tstorm_eth_approximate_match_multicast_filtering {
4378 u32 mcast_add_hash_bit_array[8];
4379};
4380
4381
4382/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004383 * Common configuration parameters per function in Tstorm
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004384 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004385struct tstorm_eth_function_common_config {
4386 __le16 config_flags;
4387#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY (0x1<<0)
4388#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY_SHIFT 0
4389#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY (0x1<<1)
4390#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY_SHIFT 1
4391#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY (0x1<<2)
4392#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
4393#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
4394#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
4395#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
4396#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
4397#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE (0x1<<7)
4398#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE_SHIFT 7
4399#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0xFF<<8)
4400#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 8
4401 u8 rss_result_mask;
4402 u8 reserved1;
4403 __le16 vlan_id[2];
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004404};
4405
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004406
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004407/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004408 * MAC filtering configuration parameters per port in Tstorm
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004409 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004410struct tstorm_eth_mac_filter_config {
Yuval Mintz86564c32013-01-23 03:21:50 +00004411 u32 ucast_drop_all;
4412 u32 ucast_accept_all;
4413 u32 mcast_drop_all;
4414 u32 mcast_accept_all;
4415 u32 bcast_accept_all;
4416 u32 vlan_filter[2];
4417 u32 unmatched_unicast;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004418};
4419
4420
4421/*
4422 * tx only queue init ramrod data
4423 */
4424struct tx_queue_init_ramrod_data {
4425 struct client_init_general_data general;
4426 struct client_init_tx_data tx;
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004427};
4428
4429
4430/*
Eilon Greenstein8d9c5f32009-02-15 23:24:08 -08004431 * Three RX producers for ETH
4432 */
4433struct ustorm_eth_rx_producers {
4434#if defined(__BIG_ENDIAN)
4435 u16 bd_prod;
4436 u16 cqe_prod;
4437#elif defined(__LITTLE_ENDIAN)
4438 u16 cqe_prod;
4439 u16 bd_prod;
4440#endif
4441#if defined(__BIG_ENDIAN)
4442 u16 reserved;
4443 u16 sge_prod;
4444#elif defined(__LITTLE_ENDIAN)
4445 u16 sge_prod;
4446 u16 reserved;
4447#endif
4448};
4449
4450
4451/*
Barak Witkowski50f0a562011-12-05 21:52:23 +00004452 * FCoE RX statistics parameters section#0
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004453 */
Barak Witkowski50f0a562011-12-05 21:52:23 +00004454struct fcoe_rx_stat_params_section0 {
4455 __le32 fcoe_rx_pkt_cnt;
4456 __le32 fcoe_rx_byte_cnt;
4457};
4458
4459
4460/*
4461 * FCoE RX statistics parameters section#1
4462 */
4463struct fcoe_rx_stat_params_section1 {
4464 __le32 fcoe_ver_cnt;
4465 __le32 fcoe_rx_drop_pkt_cnt;
4466};
4467
4468
4469/*
4470 * FCoE RX statistics parameters section#2
4471 */
4472struct fcoe_rx_stat_params_section2 {
4473 __le32 fc_crc_cnt;
4474 __le32 eofa_del_cnt;
4475 __le32 miss_frame_cnt;
4476 __le32 seq_timeout_cnt;
4477 __le32 drop_seq_cnt;
4478 __le32 fcoe_rx_drop_pkt_cnt;
4479 __le32 fcp_rx_pkt_cnt;
4480 __le32 reserved0;
4481};
4482
4483
4484/*
4485 * FCoE TX statistics parameters
4486 */
4487struct fcoe_tx_stat_params {
4488 __le32 fcoe_tx_pkt_cnt;
4489 __le32 fcoe_tx_byte_cnt;
4490 __le32 fcp_tx_pkt_cnt;
4491 __le32 reserved0;
4492};
4493
4494/*
4495 * FCoE statistics parameters
4496 */
4497struct fcoe_statistics_params {
4498 struct fcoe_tx_stat_params tx_stat;
4499 struct fcoe_rx_stat_params_section0 rx_stat0;
4500 struct fcoe_rx_stat_params_section1 rx_stat1;
4501 struct fcoe_rx_stat_params_section2 rx_stat2;
4502};
4503
4504
4505/*
Barak Witkowskia3348722012-04-23 03:04:46 +00004506 * The data afex vif list ramrod need
4507 */
4508struct afex_vif_list_ramrod_data {
4509 u8 afex_vif_list_command;
4510 u8 func_bit_map;
4511 __le16 vif_list_index;
4512 u8 func_to_clear;
4513 u8 echo;
4514 __le16 reserved1;
4515};
4516
4517
4518/*
Barak Witkowski50f0a562011-12-05 21:52:23 +00004519 * cfc delete event data
Barak Witkowskia3348722012-04-23 03:04:46 +00004520 */
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004521struct cfc_del_event_data {
4522 u32 cid;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004523 u32 reserved0;
4524 u32 reserved1;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004525};
4526
4527
4528/*
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004529 * per-port SAFC demo variables
4530 */
4531struct cmng_flags_per_port {
Eilon Greenstein8a1c38d2009-02-12 08:36:40 +00004532 u32 cmng_enables;
4533#define CMNG_FLAGS_PER_PORT_FAIRNESS_VN (0x1<<0)
4534#define CMNG_FLAGS_PER_PORT_FAIRNESS_VN_SHIFT 0
4535#define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN (0x1<<1)
4536#define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN_SHIFT 1
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004537#define CMNG_FLAGS_PER_PORT_FAIRNESS_COS (0x1<<2)
4538#define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_SHIFT 2
4539#define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_MODE (0x1<<3)
4540#define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_MODE_SHIFT 3
4541#define __CMNG_FLAGS_PER_PORT_RESERVED0 (0xFFFFFFF<<4)
4542#define __CMNG_FLAGS_PER_PORT_RESERVED0_SHIFT 4
4543 u32 __reserved1;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004544};
4545
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004546
4547/*
4548 * per-port rate shaping variables
4549 */
4550struct rate_shaping_vars_per_port {
4551 u32 rs_periodic_timeout;
4552 u32 rs_threshold;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004553};
4554
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004555/*
4556 * per-port fairness variables
4557 */
4558struct fairness_vars_per_port {
4559 u32 upper_bound;
4560 u32 fair_threshold;
4561 u32 fairness_timeout;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004562 u32 reserved0;
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004563};
4564
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004565/*
4566 * per-port SAFC variables
4567 */
4568struct safc_struct_per_port {
4569#if defined(__BIG_ENDIAN)
Eilon Greenstein8d9c5f32009-02-15 23:24:08 -08004570 u16 __reserved1;
4571 u8 __reserved0;
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004572 u8 safc_timeout_usec;
4573#elif defined(__LITTLE_ENDIAN)
4574 u8 safc_timeout_usec;
Eilon Greenstein8d9c5f32009-02-15 23:24:08 -08004575 u8 __reserved0;
4576 u16 __reserved1;
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004577#endif
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004578 u8 cos_to_traffic_types[MAX_COS_NUMBER];
Eilon Greenstein8d9c5f32009-02-15 23:24:08 -08004579 u16 cos_to_pause_mask[NUM_OF_SAFC_BITS];
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004580};
4581
Eilon Greenstein34f80b02008-06-23 20:33:01 -07004582/*
4583 * Per-port congestion management variables
4584 */
4585struct cmng_struct_per_port {
4586 struct rate_shaping_vars_per_port rs_vars;
4587 struct fairness_vars_per_port fair_vars;
4588 struct safc_struct_per_port safc_vars;
4589 struct cmng_flags_per_port flags;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004590};
4591
Yuval Mintzb475d782012-04-03 18:41:29 +00004592/*
4593 * a single rate shaping counter. can be used as protocol or vnic counter
4594 */
4595struct rate_shaping_counter {
4596 u32 quota;
4597#if defined(__BIG_ENDIAN)
4598 u16 __reserved0;
4599 u16 rate;
4600#elif defined(__LITTLE_ENDIAN)
4601 u16 rate;
4602 u16 __reserved0;
4603#endif
4604};
4605
4606/*
4607 * per-vnic rate shaping variables
4608 */
4609struct rate_shaping_vars_per_vn {
4610 struct rate_shaping_counter vn_counter;
4611};
4612
4613/*
4614 * per-vnic fairness variables
4615 */
4616struct fairness_vars_per_vn {
4617 u32 cos_credit_delta[MAX_COS_NUMBER];
4618 u32 vn_credit_delta;
4619 u32 __reserved0;
4620};
4621
4622/*
4623 * cmng port init state
4624 */
4625struct cmng_vnic {
4626 struct rate_shaping_vars_per_vn vnic_max_rate[4];
4627 struct fairness_vars_per_vn vnic_min_rate[4];
4628};
4629
4630/*
4631 * cmng port init state
4632 */
4633struct cmng_init {
4634 struct cmng_struct_per_port port;
4635 struct cmng_vnic vnic;
4636};
4637
4638
4639/*
4640 * driver parameters for congestion management init, all rates are in Mbps
4641 */
4642struct cmng_init_input {
4643 u32 port_rate;
4644 u16 vnic_min_rate[4];
4645 u16 vnic_max_rate[4];
4646 u16 cos_min_rate[MAX_COS_NUMBER];
4647 u16 cos_to_pause_mask[MAX_COS_NUMBER];
4648 struct cmng_flags_per_port flags;
4649};
4650
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004651
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004652/*
4653 * Protocol-common command ID for slow path elements
4654 */
4655enum common_spqe_cmd_id {
4656 RAMROD_CMD_ID_COMMON_UNUSED,
4657 RAMROD_CMD_ID_COMMON_FUNCTION_START,
4658 RAMROD_CMD_ID_COMMON_FUNCTION_STOP,
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00004659 RAMROD_CMD_ID_COMMON_FUNCTION_UPDATE,
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004660 RAMROD_CMD_ID_COMMON_CFC_DEL,
4661 RAMROD_CMD_ID_COMMON_CFC_DEL_WB,
4662 RAMROD_CMD_ID_COMMON_STAT_QUERY,
4663 RAMROD_CMD_ID_COMMON_STOP_TRAFFIC,
4664 RAMROD_CMD_ID_COMMON_START_TRAFFIC,
Barak Witkowskia3348722012-04-23 03:04:46 +00004665 RAMROD_CMD_ID_COMMON_AFEX_VIF_LISTS,
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004666 MAX_COMMON_SPQE_CMD_ID
4667};
4668
4669
4670/*
4671 * Per-protocol connection types
4672 */
4673enum connection_type {
4674 ETH_CONNECTION_TYPE,
4675 TOE_CONNECTION_TYPE,
4676 RDMA_CONNECTION_TYPE,
4677 ISCSI_CONNECTION_TYPE,
4678 FCOE_CONNECTION_TYPE,
4679 RESERVED_CONNECTION_TYPE_0,
4680 RESERVED_CONNECTION_TYPE_1,
4681 RESERVED_CONNECTION_TYPE_2,
4682 NONE_CONNECTION_TYPE,
4683 MAX_CONNECTION_TYPE
4684};
4685
4686
4687/*
4688 * Cos modes
4689 */
4690enum cos_mode {
4691 OVERRIDE_COS,
4692 STATIC_COS,
4693 FW_WRR,
4694 MAX_COS_MODE
4695};
4696
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004697
4698/*
4699 * Dynamic HC counters set by the driver
4700 */
4701struct hc_dynamic_drv_counter {
4702 u32 val[HC_SB_MAX_DYNAMIC_INDICES];
4703};
4704
4705/*
4706 * zone A per-queue data
4707 */
4708struct cstorm_queue_zone_data {
4709 struct hc_dynamic_drv_counter hc_dyn_drv_cnt;
4710 struct regpair reserved[2];
4711};
4712
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004713
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004714/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004715 * Vf-PF channel data in cstorm ram (non-triggered zone)
Eilon Greensteinca003922009-08-12 22:53:28 -07004716 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004717struct vf_pf_channel_zone_data {
4718 u32 msg_addr_lo;
4719 u32 msg_addr_hi;
4720};
4721
4722/*
4723 * zone for VF non-triggered data
4724 */
4725struct non_trigger_vf_zone {
4726 struct vf_pf_channel_zone_data vf_pf_channel;
4727};
4728
4729/*
4730 * Vf-PF channel trigger zone in cstorm ram
4731 */
4732struct vf_pf_channel_zone_trigger {
4733 u8 addr_valid;
4734};
4735
4736/*
4737 * zone that triggers the in-bound interrupt
4738 */
4739struct trigger_vf_zone {
4740#if defined(__BIG_ENDIAN)
4741 u16 reserved1;
4742 u8 reserved0;
4743 struct vf_pf_channel_zone_trigger vf_pf_channel;
4744#elif defined(__LITTLE_ENDIAN)
4745 struct vf_pf_channel_zone_trigger vf_pf_channel;
4746 u8 reserved0;
4747 u16 reserved1;
4748#endif
4749 u32 reserved2;
4750};
4751
4752/*
4753 * zone B per-VF data
4754 */
4755struct cstorm_vf_zone_data {
4756 struct non_trigger_vf_zone non_trigger;
4757 struct trigger_vf_zone trigger;
4758};
4759
4760
4761/*
4762 * Dynamic host coalescing init parameters, per state machine
4763 */
4764struct dynamic_hc_sm_config {
Eilon Greensteinca003922009-08-12 22:53:28 -07004765 u32 threshold[3];
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004766 u8 shift_per_protocol[HC_SB_MAX_DYNAMIC_INDICES];
4767 u8 hc_timeout0[HC_SB_MAX_DYNAMIC_INDICES];
4768 u8 hc_timeout1[HC_SB_MAX_DYNAMIC_INDICES];
4769 u8 hc_timeout2[HC_SB_MAX_DYNAMIC_INDICES];
4770 u8 hc_timeout3[HC_SB_MAX_DYNAMIC_INDICES];
Eilon Greensteinca003922009-08-12 22:53:28 -07004771};
4772
Eilon Greensteinca003922009-08-12 22:53:28 -07004773/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004774 * Dynamic host coalescing init parameters
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004775 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004776struct dynamic_hc_config {
4777 struct dynamic_hc_sm_config sm_config[HC_SB_MAX_SM];
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004778};
4779
Yitchak Gertnerbb2a0f72008-06-23 20:33:36 -07004780
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004781struct e2_integ_data {
4782#if defined(__BIG_ENDIAN)
4783 u8 flags;
4784#define E2_INTEG_DATA_TESTING_EN (0x1<<0)
4785#define E2_INTEG_DATA_TESTING_EN_SHIFT 0
4786#define E2_INTEG_DATA_LB_TX (0x1<<1)
4787#define E2_INTEG_DATA_LB_TX_SHIFT 1
4788#define E2_INTEG_DATA_COS_TX (0x1<<2)
4789#define E2_INTEG_DATA_COS_TX_SHIFT 2
4790#define E2_INTEG_DATA_OPPORTUNISTICQM (0x1<<3)
4791#define E2_INTEG_DATA_OPPORTUNISTICQM_SHIFT 3
4792#define E2_INTEG_DATA_DPMTESTRELEASEDQ (0x1<<4)
4793#define E2_INTEG_DATA_DPMTESTRELEASEDQ_SHIFT 4
4794#define E2_INTEG_DATA_RESERVED (0x7<<5)
4795#define E2_INTEG_DATA_RESERVED_SHIFT 5
4796 u8 cos;
4797 u8 voq;
4798 u8 pbf_queue;
4799#elif defined(__LITTLE_ENDIAN)
4800 u8 pbf_queue;
4801 u8 voq;
4802 u8 cos;
4803 u8 flags;
4804#define E2_INTEG_DATA_TESTING_EN (0x1<<0)
4805#define E2_INTEG_DATA_TESTING_EN_SHIFT 0
4806#define E2_INTEG_DATA_LB_TX (0x1<<1)
4807#define E2_INTEG_DATA_LB_TX_SHIFT 1
4808#define E2_INTEG_DATA_COS_TX (0x1<<2)
4809#define E2_INTEG_DATA_COS_TX_SHIFT 2
4810#define E2_INTEG_DATA_OPPORTUNISTICQM (0x1<<3)
4811#define E2_INTEG_DATA_OPPORTUNISTICQM_SHIFT 3
4812#define E2_INTEG_DATA_DPMTESTRELEASEDQ (0x1<<4)
4813#define E2_INTEG_DATA_DPMTESTRELEASEDQ_SHIFT 4
4814#define E2_INTEG_DATA_RESERVED (0x7<<5)
4815#define E2_INTEG_DATA_RESERVED_SHIFT 5
4816#endif
4817#if defined(__BIG_ENDIAN)
4818 u16 reserved3;
4819 u8 reserved2;
4820 u8 ramEn;
4821#elif defined(__LITTLE_ENDIAN)
4822 u8 ramEn;
4823 u8 reserved2;
4824 u16 reserved3;
4825#endif
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02004826};
4827
4828
4829/*
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004830 * set mac event data
4831 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004832struct eth_event_data {
4833 u32 echo;
4834 u32 reserved0;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004835 u32 reserved1;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004836};
4837
4838
4839/*
4840 * pf-vf event data
4841 */
4842struct vf_pf_event_data {
4843 u8 vf_id;
4844 u8 reserved0;
4845 u16 reserved1;
4846 u32 msg_addr_lo;
4847 u32 msg_addr_hi;
4848};
4849
4850/*
4851 * VF FLR event data
4852 */
4853struct vf_flr_event_data {
4854 u8 vf_id;
4855 u8 reserved0;
4856 u16 reserved1;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004857 u32 reserved2;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004858 u32 reserved3;
4859};
4860
4861/*
4862 * malicious VF event data
4863 */
4864struct malicious_vf_event_data {
4865 u8 vf_id;
4866 u8 reserved0;
4867 u16 reserved1;
4868 u32 reserved2;
4869 u32 reserved3;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004870};
4871
4872/*
Barak Witkowskia3348722012-04-23 03:04:46 +00004873 * vif list event data
4874 */
4875struct vif_list_event_data {
4876 u8 func_bit_map;
4877 u8 echo;
4878 __le16 reserved0;
4879 __le32 reserved1;
4880 __le32 reserved2;
4881};
4882
Merav Sicronbabc6722012-11-07 00:45:47 +00004883/* function update event data */
4884struct function_update_event_data {
4885 u8 echo;
4886 u8 reserved;
4887 __le16 reserved0;
4888 __le32 reserved1;
4889 __le32 reserved2;
4890};
4891
4892
4893/* union for all event ring message types */
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004894union event_data {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004895 struct vf_pf_event_data vf_pf_event;
4896 struct eth_event_data eth_event;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004897 struct cfc_del_event_data cfc_del_event;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004898 struct vf_flr_event_data vf_flr_event;
4899 struct malicious_vf_event_data malicious_vf_event;
Barak Witkowskia3348722012-04-23 03:04:46 +00004900 struct vif_list_event_data vif_list_event;
Merav Sicronbabc6722012-11-07 00:45:47 +00004901 struct function_update_event_data function_update_event;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004902};
4903
4904
4905/*
4906 * per PF event ring data
4907 */
4908struct event_ring_data {
Yuval Mintz86564c32013-01-23 03:21:50 +00004909 struct regpair_native base_addr;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004910#if defined(__BIG_ENDIAN)
4911 u8 index_id;
4912 u8 sb_id;
4913 u16 producer;
4914#elif defined(__LITTLE_ENDIAN)
4915 u16 producer;
4916 u8 sb_id;
4917 u8 index_id;
4918#endif
4919 u32 reserved0;
4920};
4921
4922
4923/*
4924 * event ring message element (each element is 128 bits)
4925 */
4926struct event_ring_msg {
4927 u8 opcode;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004928 u8 error;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00004929 u16 reserved1;
4930 union event_data data;
4931};
4932
4933/*
4934 * event ring next page element (128 bits)
4935 */
4936struct event_ring_next {
4937 struct regpair addr;
4938 u32 reserved[2];
4939};
4940
4941/*
4942 * union for event ring element types (each element is 128 bits)
4943 */
4944union event_ring_elem {
4945 struct event_ring_msg message;
4946 struct event_ring_next next_page;
4947};
4948
4949
4950/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004951 * Common event ring opcodes
4952 */
4953enum event_ring_opcode {
4954 EVENT_RING_OPCODE_VF_PF_CHANNEL,
4955 EVENT_RING_OPCODE_FUNCTION_START,
4956 EVENT_RING_OPCODE_FUNCTION_STOP,
4957 EVENT_RING_OPCODE_CFC_DEL,
4958 EVENT_RING_OPCODE_CFC_DEL_WB,
4959 EVENT_RING_OPCODE_STAT_QUERY,
4960 EVENT_RING_OPCODE_STOP_TRAFFIC,
4961 EVENT_RING_OPCODE_START_TRAFFIC,
4962 EVENT_RING_OPCODE_VF_FLR,
4963 EVENT_RING_OPCODE_MALICIOUS_VF,
4964 EVENT_RING_OPCODE_FORWARD_SETUP,
4965 EVENT_RING_OPCODE_RSS_UPDATE_RULES,
Dmitry Kravkov621b4d62012-02-20 09:59:08 +00004966 EVENT_RING_OPCODE_FUNCTION_UPDATE,
Barak Witkowskia3348722012-04-23 03:04:46 +00004967 EVENT_RING_OPCODE_AFEX_VIF_LISTS,
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004968 EVENT_RING_OPCODE_SET_MAC,
4969 EVENT_RING_OPCODE_CLASSIFICATION_RULES,
4970 EVENT_RING_OPCODE_FILTERS_RULES,
4971 EVENT_RING_OPCODE_MULTICAST_RULES,
4972 MAX_EVENT_RING_OPCODE
4973};
4974
4975
4976/*
4977 * Modes for fairness algorithm
4978 */
4979enum fairness_mode {
4980 FAIRNESS_COS_WRR_MODE,
4981 FAIRNESS_COS_ETS_MODE,
4982 MAX_FAIRNESS_MODE
4983};
4984
4985
4986/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004987 * Priority and cos
4988 */
4989struct priority_cos {
4990 u8 priority;
4991 u8 cos;
4992 __le16 reserved1;
4993};
4994
4995/*
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00004996 * The data for flow control configuration
4997 */
4998struct flow_control_configuration {
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03004999 struct priority_cos traffic_type_to_priority_cos[MAX_TRAFFIC_TYPES];
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00005000 u8 dcb_enabled;
5001 u8 dcb_version;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005002 u8 dont_add_pri_0_en;
5003 u8 reserved1;
5004 __le32 reserved2;
5005};
5006
5007
5008/*
5009 *
5010 */
5011struct function_start_data {
Yuval Mintz96bed4b2012-10-01 03:46:19 +00005012 u8 function_mode;
5013 u8 reserved;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005014 __le16 sd_vlan_tag;
Barak Witkowskia3348722012-04-23 03:04:46 +00005015 __le16 vif_id;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005016 u8 path_id;
5017 u8 network_cos_mode;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00005018};
5019
5020
Barak Witkowskia3348722012-04-23 03:04:46 +00005021struct function_update_data {
5022 u8 vif_id_change_flg;
5023 u8 afex_default_vlan_change_flg;
5024 u8 allowed_priorities_change_flg;
5025 u8 network_cos_mode_change_flg;
5026 __le16 vif_id;
5027 __le16 afex_default_vlan;
5028 u8 allowed_priorities;
5029 u8 network_cos_mode;
5030 u8 lb_mode_en;
Merav Sicronbabc6722012-11-07 00:45:47 +00005031 u8 tx_switch_suspend_change_flg;
5032 u8 tx_switch_suspend;
5033 u8 echo;
5034 __le16 reserved1;
Barak Witkowskia3348722012-04-23 03:04:46 +00005035};
5036
5037
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00005038/*
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005039 * FW version stored in the Xstorm RAM
5040 */
5041struct fw_version {
5042#if defined(__BIG_ENDIAN)
Eilon Greenstein8d9c5f32009-02-15 23:24:08 -08005043 u8 engineering;
5044 u8 revision;
5045 u8 minor;
5046 u8 major;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005047#elif defined(__LITTLE_ENDIAN)
Eilon Greenstein8d9c5f32009-02-15 23:24:08 -08005048 u8 major;
5049 u8 minor;
5050 u8 revision;
5051 u8 engineering;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005052#endif
5053 u32 flags;
5054#define FW_VERSION_OPTIMIZED (0x1<<0)
5055#define FW_VERSION_OPTIMIZED_SHIFT 0
5056#define FW_VERSION_BIG_ENDIEN (0x1<<1)
5057#define FW_VERSION_BIG_ENDIEN_SHIFT 1
Eilon Greenstein34f80b02008-06-23 20:33:01 -07005058#define FW_VERSION_CHIP_VERSION (0x3<<2)
5059#define FW_VERSION_CHIP_VERSION_SHIFT 2
5060#define __FW_VERSION_RESERVED (0xFFFFFFF<<4)
5061#define __FW_VERSION_RESERVED_SHIFT 4
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005062};
5063
5064
5065/*
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005066 * Dynamic Host-Coalescing - Driver(host) counters
5067 */
5068struct hc_dynamic_sb_drv_counters {
5069 u32 dynamic_hc_drv_counter[HC_SB_MAX_DYNAMIC_INDICES];
5070};
5071
5072
5073/*
5074 * 2 bytes. configuration/state parameters for a single protocol index
5075 */
5076struct hc_index_data {
5077#if defined(__BIG_ENDIAN)
5078 u8 flags;
5079#define HC_INDEX_DATA_SM_ID (0x1<<0)
5080#define HC_INDEX_DATA_SM_ID_SHIFT 0
5081#define HC_INDEX_DATA_HC_ENABLED (0x1<<1)
5082#define HC_INDEX_DATA_HC_ENABLED_SHIFT 1
5083#define HC_INDEX_DATA_DYNAMIC_HC_ENABLED (0x1<<2)
5084#define HC_INDEX_DATA_DYNAMIC_HC_ENABLED_SHIFT 2
5085#define HC_INDEX_DATA_RESERVE (0x1F<<3)
5086#define HC_INDEX_DATA_RESERVE_SHIFT 3
5087 u8 timeout;
5088#elif defined(__LITTLE_ENDIAN)
5089 u8 timeout;
5090 u8 flags;
5091#define HC_INDEX_DATA_SM_ID (0x1<<0)
5092#define HC_INDEX_DATA_SM_ID_SHIFT 0
5093#define HC_INDEX_DATA_HC_ENABLED (0x1<<1)
5094#define HC_INDEX_DATA_HC_ENABLED_SHIFT 1
5095#define HC_INDEX_DATA_DYNAMIC_HC_ENABLED (0x1<<2)
5096#define HC_INDEX_DATA_DYNAMIC_HC_ENABLED_SHIFT 2
5097#define HC_INDEX_DATA_RESERVE (0x1F<<3)
5098#define HC_INDEX_DATA_RESERVE_SHIFT 3
5099#endif
5100};
5101
5102
5103/*
5104 * HC state-machine
5105 */
5106struct hc_status_block_sm {
5107#if defined(__BIG_ENDIAN)
5108 u8 igu_seg_id;
5109 u8 igu_sb_id;
5110 u8 timer_value;
5111 u8 __flags;
5112#elif defined(__LITTLE_ENDIAN)
5113 u8 __flags;
5114 u8 timer_value;
5115 u8 igu_sb_id;
5116 u8 igu_seg_id;
5117#endif
5118 u32 time_to_expire;
5119};
5120
5121/*
5122 * hold PCI identification variables- used in various places in firmware
5123 */
5124struct pci_entity {
5125#if defined(__BIG_ENDIAN)
5126 u8 vf_valid;
5127 u8 vf_id;
5128 u8 vnic_id;
5129 u8 pf_id;
5130#elif defined(__LITTLE_ENDIAN)
5131 u8 pf_id;
5132 u8 vnic_id;
5133 u8 vf_id;
5134 u8 vf_valid;
5135#endif
5136};
5137
5138/*
5139 * The fast-path status block meta-data, common to all chips
5140 */
5141struct hc_sb_data {
Yuval Mintz86564c32013-01-23 03:21:50 +00005142 struct regpair_native host_sb_addr;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005143 struct hc_status_block_sm state_machine[HC_SB_MAX_SM];
5144 struct pci_entity p_func;
5145#if defined(__BIG_ENDIAN)
5146 u8 rsrv0;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005147 u8 state;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005148 u8 dhc_qzone_id;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005149 u8 same_igu_sb_1b;
5150#elif defined(__LITTLE_ENDIAN)
5151 u8 same_igu_sb_1b;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005152 u8 dhc_qzone_id;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005153 u8 state;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005154 u8 rsrv0;
5155#endif
Yuval Mintz86564c32013-01-23 03:21:50 +00005156 struct regpair_native rsrv1[2];
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005157};
5158
5159
5160/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005161 * Segment types for host coaslescing
5162 */
5163enum hc_segment {
5164 HC_REGULAR_SEGMENT,
5165 HC_DEFAULT_SEGMENT,
5166 MAX_HC_SEGMENT
5167};
5168
5169
5170/*
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005171 * The fast-path status block meta-data
5172 */
5173struct hc_sp_status_block_data {
Yuval Mintz86564c32013-01-23 03:21:50 +00005174 struct regpair_native host_sb_addr;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005175#if defined(__BIG_ENDIAN)
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005176 u8 rsrv1;
5177 u8 state;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005178 u8 igu_seg_id;
5179 u8 igu_sb_id;
5180#elif defined(__LITTLE_ENDIAN)
5181 u8 igu_sb_id;
5182 u8 igu_seg_id;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005183 u8 state;
5184 u8 rsrv1;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005185#endif
5186 struct pci_entity p_func;
5187};
5188
5189
5190/*
5191 * The fast-path status block meta-data
5192 */
5193struct hc_status_block_data_e1x {
5194 struct hc_index_data index_data[HC_SB_MAX_INDICES_E1X];
5195 struct hc_sb_data common;
5196};
5197
5198
5199/*
5200 * The fast-path status block meta-data
5201 */
5202struct hc_status_block_data_e2 {
5203 struct hc_index_data index_data[HC_SB_MAX_INDICES_E2];
5204 struct hc_sb_data common;
5205};
5206
5207
5208/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005209 * IGU block operartion modes (in Everest2)
5210 */
5211enum igu_mode {
5212 HC_IGU_BC_MODE,
5213 HC_IGU_NBC_MODE,
5214 MAX_IGU_MODE
5215};
5216
5217
5218/*
5219 * IP versions
5220 */
5221enum ip_ver {
5222 IP_V4,
5223 IP_V6,
5224 MAX_IP_VER
5225};
5226
5227
5228/*
5229 * Multi-function modes
5230 */
5231enum mf_mode {
5232 SINGLE_FUNCTION,
5233 MULTI_FUNCTION_SD,
5234 MULTI_FUNCTION_SI,
Barak Witkowskia3348722012-04-23 03:04:46 +00005235 MULTI_FUNCTION_AFEX,
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005236 MAX_MF_MODE
5237};
5238
5239/*
5240 * Protocol-common statistics collected by the Tstorm (per pf)
5241 */
5242struct tstorm_per_pf_stats {
5243 struct regpair rcv_error_bytes;
5244};
5245
5246/*
5247 *
5248 */
5249struct per_pf_stats {
5250 struct tstorm_per_pf_stats tstorm_pf_statistics;
5251};
5252
5253
5254/*
5255 * Protocol-common statistics collected by the Tstorm (per port)
5256 */
5257struct tstorm_per_port_stats {
5258 __le32 mac_discard;
5259 __le32 mac_filter_discard;
5260 __le32 brb_truncate_discard;
5261 __le32 mf_tag_discard;
5262 __le32 packet_drop;
5263 __le32 reserved;
5264};
5265
5266/*
5267 *
5268 */
5269struct per_port_stats {
5270 struct tstorm_per_port_stats tstorm_port_statistics;
5271};
5272
5273
5274/*
5275 * Protocol-common statistics collected by the Tstorm (per client)
5276 */
5277struct tstorm_per_queue_stats {
5278 struct regpair rcv_ucast_bytes;
5279 __le32 rcv_ucast_pkts;
5280 __le32 checksum_discard;
5281 struct regpair rcv_bcast_bytes;
5282 __le32 rcv_bcast_pkts;
5283 __le32 pkts_too_big_discard;
5284 struct regpair rcv_mcast_bytes;
5285 __le32 rcv_mcast_pkts;
5286 __le32 ttl0_discard;
5287 __le16 no_buff_discard;
5288 __le16 reserved0;
5289 __le32 reserved1;
5290};
5291
5292/*
5293 * Protocol-common statistics collected by the Ustorm (per client)
5294 */
5295struct ustorm_per_queue_stats {
5296 struct regpair ucast_no_buff_bytes;
5297 struct regpair mcast_no_buff_bytes;
5298 struct regpair bcast_no_buff_bytes;
5299 __le32 ucast_no_buff_pkts;
5300 __le32 mcast_no_buff_pkts;
5301 __le32 bcast_no_buff_pkts;
5302 __le32 coalesced_pkts;
5303 struct regpair coalesced_bytes;
5304 __le32 coalesced_events;
5305 __le32 coalesced_aborts;
5306};
5307
5308/*
5309 * Protocol-common statistics collected by the Xstorm (per client)
5310 */
5311struct xstorm_per_queue_stats {
5312 struct regpair ucast_bytes_sent;
5313 struct regpair mcast_bytes_sent;
5314 struct regpair bcast_bytes_sent;
5315 __le32 ucast_pkts_sent;
5316 __le32 mcast_pkts_sent;
5317 __le32 bcast_pkts_sent;
5318 __le32 error_drop_pkts;
5319};
5320
5321/*
5322 *
5323 */
5324struct per_queue_stats {
5325 struct tstorm_per_queue_stats tstorm_queue_statistics;
5326 struct ustorm_per_queue_stats ustorm_queue_statistics;
5327 struct xstorm_per_queue_stats xstorm_queue_statistics;
5328};
5329
5330
5331/*
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005332 * FW version stored in first line of pram
5333 */
5334struct pram_fw_version {
Eilon Greenstein8d9c5f32009-02-15 23:24:08 -08005335 u8 major;
5336 u8 minor;
5337 u8 revision;
5338 u8 engineering;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005339 u8 flags;
5340#define PRAM_FW_VERSION_OPTIMIZED (0x1<<0)
5341#define PRAM_FW_VERSION_OPTIMIZED_SHIFT 0
5342#define PRAM_FW_VERSION_STORM_ID (0x3<<1)
5343#define PRAM_FW_VERSION_STORM_ID_SHIFT 1
5344#define PRAM_FW_VERSION_BIG_ENDIEN (0x1<<3)
5345#define PRAM_FW_VERSION_BIG_ENDIEN_SHIFT 3
Eilon Greenstein34f80b02008-06-23 20:33:01 -07005346#define PRAM_FW_VERSION_CHIP_VERSION (0x3<<4)
5347#define PRAM_FW_VERSION_CHIP_VERSION_SHIFT 4
5348#define __PRAM_FW_VERSION_RESERVED0 (0x3<<6)
5349#define __PRAM_FW_VERSION_RESERVED0_SHIFT 6
5350};
5351
5352
5353/*
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005354 * Ethernet slow path element
5355 */
5356union protocol_common_specific_data {
5357 u8 protocol_data[8];
5358 struct regpair phy_address;
5359 struct regpair mac_config_addr;
Barak Witkowskia3348722012-04-23 03:04:46 +00005360 struct afex_vif_list_ramrod_data afex_vif_list_data;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005361};
5362
5363/*
Eilon Greensteinca003922009-08-12 22:53:28 -07005364 * The send queue element
5365 */
5366struct protocol_common_spe {
5367 struct spe_hdr hdr;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005368 union protocol_common_specific_data data;
Eilon Greensteinca003922009-08-12 22:53:28 -07005369};
5370
5371
5372/*
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005373 * The send queue element
5374 */
5375struct slow_path_element {
5376 struct spe_hdr hdr;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005377 struct regpair protocol_data;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005378};
5379
5380
5381/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005382 * Protocol-common statistics counter
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005383 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005384struct stats_counter {
5385 __le16 xstats_counter;
5386 __le16 reserved0;
5387 __le32 reserved1;
5388 __le16 tstats_counter;
5389 __le16 reserved2;
5390 __le32 reserved3;
5391 __le16 ustats_counter;
5392 __le16 reserved4;
5393 __le32 reserved5;
5394 __le16 cstats_counter;
5395 __le16 reserved6;
5396 __le32 reserved7;
Eliezer Tamira2fbb9e2007-11-15 20:09:02 +02005397};
5398
5399
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005400/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005401 *
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005402 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005403struct stats_query_entry {
5404 u8 kind;
5405 u8 index;
5406 __le16 funcID;
5407 __le32 reserved;
5408 struct regpair address;
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005409};
5410
5411/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005412 * statistic command
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005413 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005414struct stats_query_cmd_group {
5415 struct stats_query_entry query[STATS_QUERY_CMD_COUNT];
5416};
5417
5418
5419/*
5420 * statistic command header
5421 */
5422struct stats_query_header {
5423 u8 cmd_num;
5424 u8 reserved0;
5425 __le16 drv_stats_counter;
5426 __le32 reserved1;
5427 struct regpair stats_counters_addrs;
5428};
5429
5430
5431/*
5432 * Types of statistcis query entry
5433 */
5434enum stats_query_type {
5435 STATS_TYPE_QUEUE,
5436 STATS_TYPE_PORT,
5437 STATS_TYPE_PF,
5438 STATS_TYPE_TOE,
5439 STATS_TYPE_FCOE,
5440 MAX_STATS_QUERY_TYPE
5441};
5442
5443
5444/*
5445 * Indicate of the function status block state
5446 */
5447enum status_block_state {
5448 SB_DISABLED,
5449 SB_ENABLED,
5450 SB_CLEANED,
5451 MAX_STATUS_BLOCK_STATE
5452};
5453
5454
5455/*
5456 * Storm IDs (including attentions for IGU related enums)
5457 */
5458enum storm_id {
5459 USTORM_ID,
5460 CSTORM_ID,
5461 XSTORM_ID,
5462 TSTORM_ID,
5463 ATTENTION_ID,
5464 MAX_STORM_ID
5465};
5466
5467
5468/*
5469 * Taffic types used in ETS and flow control algorithms
5470 */
5471enum traffic_type {
5472 LLFC_TRAFFIC_TYPE_NW,
5473 LLFC_TRAFFIC_TYPE_FCOE,
5474 LLFC_TRAFFIC_TYPE_ISCSI,
5475 MAX_TRAFFIC_TYPE
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005476};
5477
5478
5479/*
5480 * zone A per-queue data
5481 */
5482struct tstorm_queue_zone_data {
5483 struct regpair reserved[4];
5484};
5485
5486
5487/*
5488 * zone B per-VF data
5489 */
5490struct tstorm_vf_zone_data {
5491 struct regpair reserved;
5492};
5493
5494
5495/*
5496 * zone A per-queue data
5497 */
5498struct ustorm_queue_zone_data {
5499 struct ustorm_eth_rx_producers eth_rx_producers;
5500 struct regpair reserved[3];
5501};
5502
5503
5504/*
5505 * zone B per-VF data
5506 */
5507struct ustorm_vf_zone_data {
5508 struct regpair reserved;
5509};
5510
5511
5512/*
5513 * data per VF-PF channel
5514 */
5515struct vf_pf_channel_data {
5516#if defined(__BIG_ENDIAN)
5517 u16 reserved0;
5518 u8 valid;
5519 u8 state;
5520#elif defined(__LITTLE_ENDIAN)
5521 u8 state;
5522 u8 valid;
5523 u16 reserved0;
5524#endif
5525 u32 reserved1;
5526};
5527
5528
5529/*
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03005530 * State of VF-PF channel
5531 */
5532enum vf_pf_channel_state {
5533 VF_PF_CHANNEL_STATE_READY,
5534 VF_PF_CHANNEL_STATE_WAITING_FOR_ACK,
5535 MAX_VF_PF_CHANNEL_STATE
5536};
5537
5538
5539/*
Barak Witkowskia3348722012-04-23 03:04:46 +00005540 * vif_list_rule_kind
5541 */
5542enum vif_list_rule_kind {
5543 VIF_LIST_RULE_SET,
5544 VIF_LIST_RULE_GET,
5545 VIF_LIST_RULE_CLEAR_ALL,
5546 VIF_LIST_RULE_CLEAR_FUNC,
5547 MAX_VIF_LIST_RULE_KIND
5548};
5549
5550
5551/*
Dmitry Kravkov523224a2010-10-06 03:23:26 +00005552 * zone A per-queue data
5553 */
5554struct xstorm_queue_zone_data {
5555 struct regpair reserved[4];
5556};
5557
5558
5559/*
5560 * zone B per-VF data
5561 */
5562struct xstorm_vf_zone_data {
5563 struct regpair reserved;
5564};
5565
5566#endif /* BNX2X_HSI_H */