1ad8a962ac1da0a61b6f9fc3165d58218eeee9ce
[deb_dpdk.git] / drivers / net / qede / base / mcp_public.h
1 /*
2  * Copyright (c) 2016 QLogic Corporation.
3  * All rights reserved.
4  * www.qlogic.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8
9 /****************************************************************************
10  *
11  * Name:        mcp_public.h
12  *
13  * Description: MCP public data
14  *
15  * Created:     13/01/2013 yanivr
16  *
17  ****************************************************************************/
18
19 #ifndef MCP_PUBLIC_H
20 #define MCP_PUBLIC_H
21
22 #define VF_MAX_STATIC 192       /* In case of AH */
23
24 #define MCP_GLOB_PATH_MAX       2
25 #define MCP_PORT_MAX            2       /* Global */
26 #define MCP_GLOB_PORT_MAX       4       /* Global */
27 #define MCP_GLOB_FUNC_MAX       16      /* Global */
28
29 typedef u32 offsize_t;      /* In DWORDS !!! */
30 /* Offset from the beginning of the MCP scratchpad */
31 #define OFFSIZE_OFFSET_SHIFT    0
32 #define OFFSIZE_OFFSET_MASK     0x0000ffff
33 /* Size of specific element (not the whole array if any) */
34 #define OFFSIZE_SIZE_SHIFT      16
35 #define OFFSIZE_SIZE_MASK       0xffff0000
36
37 /* SECTION_OFFSET is calculating the offset in bytes out of offsize */
38 #define SECTION_OFFSET(_offsize)        \
39         ((((_offsize & OFFSIZE_OFFSET_MASK) >> OFFSIZE_OFFSET_SHIFT) << 2))
40
41 /* SECTION_SIZE is calculating the size in bytes out of offsize */
42 #define SECTION_SIZE(_offsize)          \
43         (((_offsize & OFFSIZE_SIZE_MASK) >> OFFSIZE_SIZE_SHIFT) << 2)
44
45 /* SECTION_ADDR returns the GRC addr of a section, given offsize and index
46  * within section
47  */
48 #define SECTION_ADDR(_offsize, idx)     \
49         (MCP_REG_SCRATCH +              \
50          SECTION_OFFSET(_offsize) + (SECTION_SIZE(_offsize) * idx))
51
52 /* SECTION_OFFSIZE_ADDR returns the GRC addr to the offsize address. Use
53  * offsetof, since the OFFSETUP collide with the firmware definition
54  */
55 #define SECTION_OFFSIZE_ADDR(_pub_base, _section) \
56         (_pub_base + offsetof(struct mcp_public_data, sections[_section]))
57 /* PHY configuration */
58 struct eth_phy_cfg {
59 /* 0 = autoneg, 1000/10000/20000/25000/40000/50000/100000 */
60         u32 speed;
61 #define ETH_SPEED_AUTONEG   0
62 #define ETH_SPEED_SMARTLINQ  0x8
63
64         u32 pause;      /* bitmask */
65 #define ETH_PAUSE_NONE          0x0
66 #define ETH_PAUSE_AUTONEG       0x1
67 #define ETH_PAUSE_RX            0x2
68 #define ETH_PAUSE_TX            0x4
69
70         u32 adv_speed;      /* Default should be the speed_cap_mask */
71         u32 loopback_mode;
72 #define ETH_LOOPBACK_NONE                (0)
73 /* Serdes loopback. In AH, it refers to Near End */
74 #define ETH_LOOPBACK_INT_PHY             (1)
75 #define ETH_LOOPBACK_EXT_PHY             (2) /* External PHY Loopback */
76 /* External Loopback (Require loopback plug) */
77 #define ETH_LOOPBACK_EXT                 (3)
78 #define ETH_LOOPBACK_MAC                 (4) /* MAC Loopback - not supported */
79 #define ETH_LOOPBACK_CNIG_AH_ONLY_0123   (5) /* Port to itself */
80 #define ETH_LOOPBACK_CNIG_AH_ONLY_2301   (6) /* Port to Port */
81 #define ETH_LOOPBACK_PCS_AH_ONLY         (7) /* PCS loopback (TX to RX) */
82 /* Loop RX packet from PCS to TX */
83 #define ETH_LOOPBACK_REVERSE_MAC_AH_ONLY (8)
84 /* Remote Serdes Loopback (RX to TX) */
85 #define ETH_LOOPBACK_INT_PHY_FEA_AH_ONLY (9)
86
87         /* Used to configure the EEE Tx LPI timer, has several modes of
88          * operation, according to bits 29:28
89          * 2'b00: Timer will be configured by nvram, output will be the value
90          *        from nvram.
91          * 2'b01: Timer will be configured by nvram, output will be in
92          *        16xmicroseconds.
93          * 2'b10: bits 1:0 contain an nvram value which will be used instead
94          *        of the one located in the nvram. Output will be that value.
95          * 2'b11: bits 19:0 contain the idle timer in microseconds; output
96          *        will be in 16xmicroseconds.
97          * Bits 31:30 should be 2'b11 in order for EEE to be enabled.
98          */
99         u32 eee_mode;
100 #define EEE_MODE_TIMER_USEC_MASK        (0x000fffff)
101 #define EEE_MODE_TIMER_USEC_OFFSET      (0)
102 #define EEE_MODE_TIMER_USEC_BALANCED_TIME       (0xa00)
103 #define EEE_MODE_TIMER_USEC_AGGRESSIVE_TIME     (0x100)
104 #define EEE_MODE_TIMER_USEC_LATENCY_TIME        (0x6000)
105 /* Set by the driver to request status timer will be in microseconds and and not
106  * in EEE policy definition
107  */
108 #define EEE_MODE_OUTPUT_TIME            (1 << 28)
109 /* Set by the driver to override default nvm timer */
110 #define EEE_MODE_OVERRIDE_NVRAM         (1 << 29)
111 #define EEE_MODE_ENABLE_LPI             (1 << 30) /* Set when */
112 #define EEE_MODE_ADV_LPI                (1 << 31) /* Set when EEE is enabled */
113 };
114
115 struct port_mf_cfg {
116         u32 dynamic_cfg;    /* device control channel */
117 #define PORT_MF_CFG_OV_TAG_MASK              0x0000ffff
118 #define PORT_MF_CFG_OV_TAG_SHIFT             0
119 #define PORT_MF_CFG_OV_TAG_DEFAULT         PORT_MF_CFG_OV_TAG_MASK
120
121         u32 reserved[1];
122 };
123
124 /* DO NOT add new fields in the middle
125  * MUST be synced with struct pmm_stats_map
126  */
127 struct eth_stats {
128         u64 r64;        /* 0x00 (Offset 0x00 ) RX 64-byte frame counter*/
129         u64 r127; /* 0x01 (Offset 0x08 ) RX 65 to 127 byte frame counter*/
130         u64 r255; /* 0x02 (Offset 0x10 ) RX 128 to 255 byte frame counter*/
131         u64 r511; /* 0x03 (Offset 0x18 ) RX 256 to 511 byte frame counter*/
132         u64 r1023; /* 0x04 (Offset 0x20 ) RX 512 to 1023 byte frame counter*/
133 /* 0x05 (Offset 0x28 ) RX 1024 to 1518 byte frame counter */
134         u64 r1518;
135         union {
136                 struct { /* bb */
137 /* 0x06 (Offset 0x30 ) RX 1519 to 1522 byte VLAN-tagged frame counter */
138                         u64 r1522;
139 /* 0x07 (Offset 0x38 ) RX 1519 to 2047 byte frame counter*/
140                         u64 r2047;
141 /* 0x08 (Offset 0x40 ) RX 2048 to 4095 byte frame counter*/
142                         u64 r4095;
143 /* 0x09 (Offset 0x48 ) RX 4096 to 9216 byte frame counter*/
144                         u64 r9216;
145 /* 0x0A (Offset 0x50 ) RX 9217 to 16383 byte frame counter */
146                         u64 r16383;
147                 } bb0;
148                 struct { /* ah */
149                         u64 unused1;
150 /* 0x07 (Offset 0x38 ) RX 1519 to max byte frame counter*/
151                         u64 r1519_to_max;
152                         u64 unused2;
153                         u64 unused3;
154                         u64 unused4;
155                 } ah0;
156         } u0;
157         u64 rfcs;       /* 0x0F (Offset 0x58 ) RX FCS error frame counter*/
158         u64 rxcf;       /* 0x10 (Offset 0x60 ) RX control frame counter*/
159         u64 rxpf;       /* 0x11 (Offset 0x68 ) RX pause frame counter*/
160         u64 rxpp;       /* 0x12 (Offset 0x70 ) RX PFC frame counter*/
161         u64 raln;       /* 0x16 (Offset 0x78 ) RX alignment error counter*/
162         u64 rfcr;       /* 0x19 (Offset 0x80 ) RX false carrier counter */
163         u64 rovr;       /* 0x1A (Offset 0x88 ) RX oversized frame counter*/
164         u64 rjbr;       /* 0x1B (Offset 0x90 ) RX jabber frame counter */
165         u64 rund;       /* 0x34 (Offset 0x98 ) RX undersized frame counter */
166         u64 rfrg;       /* 0x35 (Offset 0xa0 ) RX fragment counter */
167         u64 t64;        /* 0x40 (Offset 0xa8 ) TX 64-byte frame counter */
168         u64 t127; /* 0x41 (Offset 0xb0 ) TX 65 to 127 byte frame counter */
169         u64 t255; /* 0x42 (Offset 0xb8 ) TX 128 to 255 byte frame counter*/
170         u64 t511; /* 0x43 (Offset 0xc0 ) TX 256 to 511 byte frame counter*/
171         u64 t1023; /* 0x44 (Offset 0xc8 ) TX 512 to 1023 byte frame counter*/
172 /* 0x45 (Offset 0xd0 ) TX 1024 to 1518 byte frame counter */
173         u64 t1518;
174         union {
175                 struct { /* bb */
176 /* 0x47 (Offset 0xd8 ) TX 1519 to 2047 byte frame counter */
177                         u64 t2047;
178 /* 0x48 (Offset 0xe0 ) TX 2048 to 4095 byte frame counter */
179                         u64 t4095;
180 /* 0x49 (Offset 0xe8 ) TX 4096 to 9216 byte frame counter */
181                         u64 t9216;
182 /* 0x4A (Offset 0xf0 ) TX 9217 to 16383 byte frame counter */
183                         u64 t16383;
184                 } bb1;
185                 struct { /* ah */
186 /* 0x47 (Offset 0xd8 ) TX 1519 to max byte frame counter */
187                         u64 t1519_to_max;
188                         u64 unused6;
189                         u64 unused7;
190                         u64 unused8;
191                 } ah1;
192         } u1;
193         u64 txpf;       /* 0x50 (Offset 0xf8 ) TX pause frame counter */
194         u64 txpp;       /* 0x51 (Offset 0x100) TX PFC frame counter */
195 /* 0x6C (Offset 0x108) Transmit Logical Type LLFC message counter */
196         union {
197                 struct { /* bb */
198 /* 0x6C (Offset 0x108) Transmit Logical Type LLFC message counter */
199                         u64 tlpiec;
200 /* 0x6E (Offset 0x110) Transmit Total Collision Counter */
201                         u64 tncl;
202                 } bb2;
203                 struct { /* ah */
204                         u64 unused9;
205                         u64 unused10;
206                 } ah2;
207         } u2;
208         u64 rbyte;      /* 0x3d (Offset 0x118) RX byte counter */
209         u64 rxuca;      /* 0x0c (Offset 0x120) RX UC frame counter */
210         u64 rxmca;      /* 0x0d (Offset 0x128) RX MC frame counter */
211         u64 rxbca;      /* 0x0e (Offset 0x130) RX BC frame counter */
212 /* 0x22 (Offset 0x138) RX good frame (good CRC, not oversized, no ERROR) */
213         u64 rxpok;
214         u64 tbyte;      /* 0x6f (Offset 0x140) TX byte counter */
215         u64 txuca;      /* 0x4d (Offset 0x148) TX UC frame counter */
216         u64 txmca;      /* 0x4e (Offset 0x150) TX MC frame counter */
217         u64 txbca;      /* 0x4f (Offset 0x158) TX BC frame counter */
218         u64 txcf;       /* 0x54 (Offset 0x160) TX control frame counter */
219 /* HSI - Cannot add more stats to this struct. If needed, then need to open new
220  * struct
221  */
222
223 };
224
225 struct brb_stats {
226         u64 brb_truncate[8];
227         u64 brb_discard[8];
228 };
229
230 struct port_stats {
231         struct brb_stats brb;
232         struct eth_stats eth;
233 };
234
235 /*----+------------------------------------------------------------------------
236  * C  | Number and | Ports in| Ports in|2 PHY-s |# of ports|# of engines
237  * h  | rate of    | team #1 | team #2 |are used|per path  | (paths)
238  * i  | physical   |         |         |        |          | enabled
239  * p  | ports      |         |         |        |          |
240  *====+============+=========+=========+========+==========+===================
241  * BB | 1x100G     | This is special mode, where there are actually 2 HW func
242  * BB | 2x10/20Gbps| 0,1     | NA      |  No    | 1        | 1
243  * BB | 2x40 Gbps  | 0,1     | NA      |  Yes   | 1        | 1
244  * BB | 2x50Gbps   | 0,1     | NA      |  No    | 1        | 1
245  * BB | 4x10Gbps   | 0,2     | 1,3     |  No    | 1/2      | 1,2 (2 is optional)
246  * BB | 4x10Gbps   | 0,1     | 2,3     |  No    | 1/2      | 1,2 (2 is optional)
247  * BB | 4x10Gbps   | 0,3     | 1,2     |  No    | 1/2      | 1,2 (2 is optional)
248  * BB | 4x10Gbps   | 0,1,2,3 | NA      |  No    | 1        | 1
249  * AH | 2x10/20Gbps| 0,1     | NA      |  NA    | 1        | NA
250  * AH | 4x10Gbps   | 0,1     | 2,3     |  NA    | 2        | NA
251  * AH | 4x10Gbps   | 0,2     | 1,3     |  NA    | 2        | NA
252  * AH | 4x10Gbps   | 0,3     | 1,2     |  NA    | 2        | NA
253  * AH | 4x10Gbps   | 0,1,2,3 | NA      |  NA    | 1        | NA
254  *====+============+=========+=========+========+==========+===================
255  */
256
257 #define CMT_TEAM0 0
258 #define CMT_TEAM1 1
259 #define CMT_TEAM_MAX 2
260
261 struct couple_mode_teaming {
262         u8 port_cmt[MCP_GLOB_PORT_MAX];
263 #define PORT_CMT_IN_TEAM            (1 << 0)
264
265 #define PORT_CMT_PORT_ROLE          (1 << 1)
266 #define PORT_CMT_PORT_INACTIVE      (0 << 1)
267 #define PORT_CMT_PORT_ACTIVE        (1 << 1)
268
269 #define PORT_CMT_TEAM_MASK          (1 << 2)
270 #define PORT_CMT_TEAM0              (0 << 2)
271 #define PORT_CMT_TEAM1              (1 << 2)
272 };
273
274 /**************************************
275  *     LLDP and DCBX HSI structures
276  **************************************/
277 #define LLDP_CHASSIS_ID_STAT_LEN 4
278 #define LLDP_PORT_ID_STAT_LEN 4
279 #define DCBX_MAX_APP_PROTOCOL           32
280 #define MAX_SYSTEM_LLDP_TLV_DATA    32
281
282 typedef enum _lldp_agent_e {
283         LLDP_NEAREST_BRIDGE = 0,
284         LLDP_NEAREST_NON_TPMR_BRIDGE,
285         LLDP_NEAREST_CUSTOMER_BRIDGE,
286         LLDP_MAX_LLDP_AGENTS
287 } lldp_agent_e;
288
289 struct lldp_config_params_s {
290         u32 config;
291 #define LLDP_CONFIG_TX_INTERVAL_MASK        0x000000ff
292 #define LLDP_CONFIG_TX_INTERVAL_SHIFT       0
293 #define LLDP_CONFIG_HOLD_MASK               0x00000f00
294 #define LLDP_CONFIG_HOLD_SHIFT              8
295 #define LLDP_CONFIG_MAX_CREDIT_MASK         0x0000f000
296 #define LLDP_CONFIG_MAX_CREDIT_SHIFT        12
297 #define LLDP_CONFIG_ENABLE_RX_MASK          0x40000000
298 #define LLDP_CONFIG_ENABLE_RX_SHIFT         30
299 #define LLDP_CONFIG_ENABLE_TX_MASK          0x80000000
300 #define LLDP_CONFIG_ENABLE_TX_SHIFT         31
301         /* Holds local Chassis ID TLV header, subtype and 9B of payload.
302          * If firtst byte is 0, then we will use default chassis ID
303          */
304         u32 local_chassis_id[LLDP_CHASSIS_ID_STAT_LEN];
305         /* Holds local Port ID TLV header, subtype and 9B of payload.
306          * If firtst byte is 0, then we will use default port ID
307         */
308         u32 local_port_id[LLDP_PORT_ID_STAT_LEN];
309 };
310
311 struct lldp_status_params_s {
312         u32 prefix_seq_num;
313         u32 status; /* TBD */
314         /* Holds remote Chassis ID TLV header, subtype and 9B of payload. */
315         u32 peer_chassis_id[LLDP_CHASSIS_ID_STAT_LEN];
316         /* Holds remote Port ID TLV header, subtype and 9B of payload. */
317         u32 peer_port_id[LLDP_PORT_ID_STAT_LEN];
318         u32 suffix_seq_num;
319 };
320
321 struct dcbx_ets_feature {
322         u32 flags;
323 #define DCBX_ETS_ENABLED_MASK                   0x00000001
324 #define DCBX_ETS_ENABLED_SHIFT                  0
325 #define DCBX_ETS_WILLING_MASK                   0x00000002
326 #define DCBX_ETS_WILLING_SHIFT                  1
327 #define DCBX_ETS_ERROR_MASK                     0x00000004
328 #define DCBX_ETS_ERROR_SHIFT                    2
329 #define DCBX_ETS_CBS_MASK                       0x00000008
330 #define DCBX_ETS_CBS_SHIFT                      3
331 #define DCBX_ETS_MAX_TCS_MASK                   0x000000f0
332 #define DCBX_ETS_MAX_TCS_SHIFT                  4
333 #define DCBX_OOO_TC_MASK                        0x00000f00
334 #define DCBX_OOO_TC_SHIFT                       8
335 /* Entries in tc table are orginized that the left most is pri 0, right most is
336  * prio 7
337  */
338
339         u32  pri_tc_tbl[1];
340 /* Fixed TCP OOO TC usage is deprecated and used only for driver backward
341  * compatibility
342  */
343 #define DCBX_TCP_OOO_TC                         (4)
344 #define DCBX_TCP_OOO_K2_4PORT_TC                (3)
345
346 #define NIG_ETS_ISCSI_OOO_CLIENT_OFFSET         (DCBX_TCP_OOO_TC + 1)
347 #define DCBX_CEE_STRICT_PRIORITY                0xf
348 /* Entries in tc table are orginized that the left most is pri 0, right most is
349  * prio 7
350  */
351
352         u32  tc_bw_tbl[2];
353 /* Entries in tc table are orginized that the left most is pri 0, right most is
354  * prio 7
355  */
356
357         u32  tc_tsa_tbl[2];
358 #define DCBX_ETS_TSA_STRICT                     0
359 #define DCBX_ETS_TSA_CBS                        1
360 #define DCBX_ETS_TSA_ETS                        2
361 };
362
363 struct dcbx_app_priority_entry {
364         u32 entry;
365 #define DCBX_APP_PRI_MAP_MASK       0x000000ff
366 #define DCBX_APP_PRI_MAP_SHIFT      0
367 #define DCBX_APP_PRI_0              0x01
368 #define DCBX_APP_PRI_1              0x02
369 #define DCBX_APP_PRI_2              0x04
370 #define DCBX_APP_PRI_3              0x08
371 #define DCBX_APP_PRI_4              0x10
372 #define DCBX_APP_PRI_5              0x20
373 #define DCBX_APP_PRI_6              0x40
374 #define DCBX_APP_PRI_7              0x80
375 #define DCBX_APP_SF_MASK            0x00000300
376 #define DCBX_APP_SF_SHIFT           8
377 #define DCBX_APP_SF_ETHTYPE         0
378 #define DCBX_APP_SF_PORT            1
379 #define DCBX_APP_SF_IEEE_MASK       0x0000f000
380 #define DCBX_APP_SF_IEEE_SHIFT      12
381 #define DCBX_APP_SF_IEEE_RESERVED   0
382 #define DCBX_APP_SF_IEEE_ETHTYPE    1
383 #define DCBX_APP_SF_IEEE_TCP_PORT   2
384 #define DCBX_APP_SF_IEEE_UDP_PORT   3
385 #define DCBX_APP_SF_IEEE_TCP_UDP_PORT 4
386
387 #define DCBX_APP_PROTOCOL_ID_MASK   0xffff0000
388 #define DCBX_APP_PROTOCOL_ID_SHIFT  16
389 };
390
391
392 /* FW structure in BE */
393 struct dcbx_app_priority_feature {
394         u32 flags;
395 #define DCBX_APP_ENABLED_MASK           0x00000001
396 #define DCBX_APP_ENABLED_SHIFT          0
397 #define DCBX_APP_WILLING_MASK           0x00000002
398 #define DCBX_APP_WILLING_SHIFT          1
399 #define DCBX_APP_ERROR_MASK             0x00000004
400 #define DCBX_APP_ERROR_SHIFT            2
401         /* Not in use
402         #define DCBX_APP_DEFAULT_PRI_MASK       0x00000f00
403         #define DCBX_APP_DEFAULT_PRI_SHIFT      8
404         */
405 #define DCBX_APP_MAX_TCS_MASK           0x0000f000
406 #define DCBX_APP_MAX_TCS_SHIFT          12
407 #define DCBX_APP_NUM_ENTRIES_MASK       0x00ff0000
408 #define DCBX_APP_NUM_ENTRIES_SHIFT      16
409         struct dcbx_app_priority_entry  app_pri_tbl[DCBX_MAX_APP_PROTOCOL];
410 };
411
412 /* FW structure in BE */
413 struct dcbx_features {
414         /* PG feature */
415         struct dcbx_ets_feature ets;
416         /* PFC feature */
417         u32 pfc;
418 #define DCBX_PFC_PRI_EN_BITMAP_MASK             0x000000ff
419 #define DCBX_PFC_PRI_EN_BITMAP_SHIFT            0
420 #define DCBX_PFC_PRI_EN_BITMAP_PRI_0            0x01
421 #define DCBX_PFC_PRI_EN_BITMAP_PRI_1            0x02
422 #define DCBX_PFC_PRI_EN_BITMAP_PRI_2            0x04
423 #define DCBX_PFC_PRI_EN_BITMAP_PRI_3            0x08
424 #define DCBX_PFC_PRI_EN_BITMAP_PRI_4            0x10
425 #define DCBX_PFC_PRI_EN_BITMAP_PRI_5            0x20
426 #define DCBX_PFC_PRI_EN_BITMAP_PRI_6            0x40
427 #define DCBX_PFC_PRI_EN_BITMAP_PRI_7            0x80
428
429 #define DCBX_PFC_FLAGS_MASK                     0x0000ff00
430 #define DCBX_PFC_FLAGS_SHIFT                    8
431 #define DCBX_PFC_CAPS_MASK                      0x00000f00
432 #define DCBX_PFC_CAPS_SHIFT                     8
433 #define DCBX_PFC_MBC_MASK                       0x00004000
434 #define DCBX_PFC_MBC_SHIFT                      14
435 #define DCBX_PFC_WILLING_MASK                   0x00008000
436 #define DCBX_PFC_WILLING_SHIFT                  15
437 #define DCBX_PFC_ENABLED_MASK                   0x00010000
438 #define DCBX_PFC_ENABLED_SHIFT                  16
439 #define DCBX_PFC_ERROR_MASK                     0x00020000
440 #define DCBX_PFC_ERROR_SHIFT                    17
441
442         /* APP feature */
443         struct dcbx_app_priority_feature app;
444 };
445
446 struct dcbx_local_params {
447         u32 config;
448 #define DCBX_CONFIG_VERSION_MASK            0x00000007
449 #define DCBX_CONFIG_VERSION_SHIFT           0
450 #define DCBX_CONFIG_VERSION_DISABLED        0
451 #define DCBX_CONFIG_VERSION_IEEE            1
452 #define DCBX_CONFIG_VERSION_CEE             2
453 #define DCBX_CONFIG_VERSION_STATIC          4
454
455         u32 flags;
456         struct dcbx_features features;
457 };
458
459 struct dcbx_mib {
460         u32 prefix_seq_num;
461         u32 flags;
462         /*
463         #define DCBX_CONFIG_VERSION_MASK            0x00000007
464         #define DCBX_CONFIG_VERSION_SHIFT           0
465         #define DCBX_CONFIG_VERSION_DISABLED        0
466         #define DCBX_CONFIG_VERSION_IEEE            1
467         #define DCBX_CONFIG_VERSION_CEE             2
468         #define DCBX_CONFIG_VERSION_STATIC          4
469         */
470         struct dcbx_features features;
471         u32 suffix_seq_num;
472 };
473
474 struct lldp_system_tlvs_buffer_s {
475         u16 valid;
476         u16 length;
477         u32 data[MAX_SYSTEM_LLDP_TLV_DATA];
478 };
479
480 struct dcb_dscp_map {
481         u32 flags;
482 #define DCB_DSCP_ENABLE_MASK                    0x1
483 #define DCB_DSCP_ENABLE_SHIFT                   0
484 #define DCB_DSCP_ENABLE                         1
485         u32 dscp_pri_map[8];
486 };
487
488 /**************************************/
489 /*                                    */
490 /*     P U B L I C      G L O B A L   */
491 /*                                    */
492 /**************************************/
493 struct public_global {
494         u32 max_path;       /* 32bit is wasty, but this will be used often */
495 /* (Global) 32bit is wasty, but this will be used often */
496         u32 max_ports;
497 #define MODE_1P 1               /* TBD - NEED TO THINK OF A BETTER NAME */
498 #define MODE_2P 2
499 #define MODE_3P 3
500 #define MODE_4P 4
501         u32 debug_mb_offset;
502         u32 phymod_dbg_mb_offset;
503         struct couple_mode_teaming cmt;
504 /* Temperature in Celcius (-255C / +255C), measured every second. */
505         s32 internal_temperature;
506         u32 mfw_ver;
507         u32 running_bundle_id;
508         s32 external_temperature;
509         u32 mdump_reason;
510 #define MDUMP_REASON_INTERNAL_ERROR     (1 << 0)
511 #define MDUMP_REASON_EXTERNAL_TRIGGER   (1 << 1)
512 #define MDUMP_REASON_DUMP_AGED          (1 << 2)
513         u32 ext_phy_upgrade_fw;
514 #define EXT_PHY_FW_UPGRADE_STATUS_MASK          (0x0000ffff)
515 #define EXT_PHY_FW_UPGRADE_STATUS_SHIFT         (0)
516 #define EXT_PHY_FW_UPGRADE_STATUS_IN_PROGRESS   (1)
517 #define EXT_PHY_FW_UPGRADE_STATUS_FAILED        (2)
518 #define EXT_PHY_FW_UPGRADE_STATUS_SUCCESS       (3)
519 #define EXT_PHY_FW_UPGRADE_TYPE_MASK            (0xffff0000)
520 #define EXT_PHY_FW_UPGRADE_TYPE_SHIFT           (16)
521 };
522
523 /**************************************/
524 /*                                    */
525 /*     P U B L I C      P A T H       */
526 /*                                    */
527 /**************************************/
528
529 /****************************************************************************
530  * Shared Memory 2 Region                                                   *
531  ****************************************************************************/
532 /* The fw_flr_ack is actually built in the following way:                   */
533 /* 8 bit:  PF ack                                                           */
534 /* 128 bit: VF ack                                                           */
535 /* 8 bit:  ios_dis_ack                                                      */
536 /* In order to maintain endianity in the mailbox hsi, we want to keep using */
537 /* u32. The fw must have the VF right after the PF since this is how it     */
538 /* access arrays(it expects always the VF to reside after the PF, and that  */
539 /* makes the calculation much easier for it. )                              */
540 /* In order to answer both limitations, and keep the struct small, the code */
541 /* will abuse the structure defined here to achieve the actual partition    */
542 /* above                                                                    */
543 /****************************************************************************/
544 struct fw_flr_mb {
545         u32 aggint;
546         u32 opgen_addr;
547         u32 accum_ack;      /* 0..15:PF, 16..207:VF, 256..271:IOV_DIS */
548 #define ACCUM_ACK_PF_BASE       0
549 #define ACCUM_ACK_PF_SHIFT      0
550
551 #define ACCUM_ACK_VF_BASE       8
552 #define ACCUM_ACK_VF_SHIFT      3
553
554 #define ACCUM_ACK_IOV_DIS_BASE  256
555 #define ACCUM_ACK_IOV_DIS_SHIFT 8
556
557 };
558
559 struct public_path {
560         struct fw_flr_mb flr_mb;
561         /*
562          * mcp_vf_disabled is set by the MCP to indicate the driver about VFs
563          * which were disabled/flred
564          */
565         u32 mcp_vf_disabled[VF_MAX_STATIC / 32];    /* 0x003c */
566
567 /* Reset on mcp reset, and incremented for eveny process kill event. */
568         u32 process_kill;
569 #define PROCESS_KILL_COUNTER_MASK               0x0000ffff
570 #define PROCESS_KILL_COUNTER_SHIFT              0
571 #define PROCESS_KILL_GLOB_AEU_BIT_MASK          0xffff0000
572 #define PROCESS_KILL_GLOB_AEU_BIT_SHIFT         16
573 #define GLOBAL_AEU_BIT(aeu_reg_id, aeu_bit) (aeu_reg_id * 32 + aeu_bit)
574 };
575
576 /**************************************/
577 /*                                    */
578 /*     P U B L I C      P O R T       */
579 /*                                    */
580 /**************************************/
581 #define FC_NPIV_WWPN_SIZE 8
582 #define FC_NPIV_WWNN_SIZE 8
583 struct dci_npiv_settings {
584         u8 npiv_wwpn[FC_NPIV_WWPN_SIZE];
585         u8 npiv_wwnn[FC_NPIV_WWNN_SIZE];
586 };
587
588 struct dci_fc_npiv_cfg {
589         /* hdr used internally by the MFW */
590         u32 hdr;
591         u32 num_of_npiv;
592 };
593
594 #define MAX_NUMBER_NPIV 64
595 struct dci_fc_npiv_tbl {
596         struct dci_fc_npiv_cfg fc_npiv_cfg;
597         struct dci_npiv_settings settings[MAX_NUMBER_NPIV];
598 };
599
600 /****************************************************************************
601  * Driver <-> FW Mailbox                                                    *
602  ****************************************************************************/
603
604 struct public_port {
605         u32 validity_map;   /* 0x0 (4*2 = 0x8) */
606
607         /* validity bits */
608 #define MCP_VALIDITY_PCI_CFG                    0x00100000
609 #define MCP_VALIDITY_MB                         0x00200000
610 #define MCP_VALIDITY_DEV_INFO                   0x00400000
611 #define MCP_VALIDITY_RESERVED                   0x00000007
612
613         /* One licensing bit should be set */
614 /* yaniv - tbd ? license */
615 #define MCP_VALIDITY_LIC_KEY_IN_EFFECT_MASK     0x00000038
616 #define MCP_VALIDITY_LIC_MANUF_KEY_IN_EFFECT    0x00000008
617 #define MCP_VALIDITY_LIC_UPGRADE_KEY_IN_EFFECT  0x00000010
618 #define MCP_VALIDITY_LIC_NO_KEY_IN_EFFECT       0x00000020
619
620         /* Active MFW */
621 #define MCP_VALIDITY_ACTIVE_MFW_UNKNOWN         0x00000000
622 #define MCP_VALIDITY_ACTIVE_MFW_MASK            0x000001c0
623 #define MCP_VALIDITY_ACTIVE_MFW_NCSI            0x00000040
624 #define MCP_VALIDITY_ACTIVE_MFW_NONE            0x000001c0
625
626         u32 link_status;
627 #define LINK_STATUS_LINK_UP                             0x00000001
628 #define LINK_STATUS_SPEED_AND_DUPLEX_MASK               0x0000001e
629 #define LINK_STATUS_SPEED_AND_DUPLEX_1000THD            (1 << 1)
630 #define LINK_STATUS_SPEED_AND_DUPLEX_1000TFD            (2 << 1)
631 #define LINK_STATUS_SPEED_AND_DUPLEX_10G                (3 << 1)
632 #define LINK_STATUS_SPEED_AND_DUPLEX_20G                (4 << 1)
633 #define LINK_STATUS_SPEED_AND_DUPLEX_40G                (5 << 1)
634 #define LINK_STATUS_SPEED_AND_DUPLEX_50G                (6 << 1)
635 #define LINK_STATUS_SPEED_AND_DUPLEX_100G               (7 << 1)
636 #define LINK_STATUS_SPEED_AND_DUPLEX_25G                (8 << 1)
637 #define LINK_STATUS_AUTO_NEGOTIATE_ENABLED              0x00000020
638 #define LINK_STATUS_AUTO_NEGOTIATE_COMPLETE             0x00000040
639 #define LINK_STATUS_PARALLEL_DETECTION_USED             0x00000080
640 #define LINK_STATUS_PFC_ENABLED                         0x00000100
641 #define LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE        0x00000200
642 #define LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE        0x00000400
643 #define LINK_STATUS_LINK_PARTNER_10G_CAPABLE            0x00000800
644 #define LINK_STATUS_LINK_PARTNER_20G_CAPABLE            0x00001000
645 #define LINK_STATUS_LINK_PARTNER_40G_CAPABLE            0x00002000
646 #define LINK_STATUS_LINK_PARTNER_50G_CAPABLE            0x00004000
647 #define LINK_STATUS_LINK_PARTNER_100G_CAPABLE           0x00008000
648 #define LINK_STATUS_LINK_PARTNER_25G_CAPABLE            0x00010000
649 #define LINK_STATUS_LINK_PARTNER_FLOW_CONTROL_MASK      0x000C0000
650 #define LINK_STATUS_LINK_PARTNER_NOT_PAUSE_CAPABLE      (0 << 18)
651 #define LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE        (1 << 18)
652 #define LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE       (2 << 18)
653 #define LINK_STATUS_LINK_PARTNER_BOTH_PAUSE             (3 << 18)
654 #define LINK_STATUS_SFP_TX_FAULT                        0x00100000
655 #define LINK_STATUS_TX_FLOW_CONTROL_ENABLED             0x00200000
656 #define LINK_STATUS_RX_FLOW_CONTROL_ENABLED             0x00400000
657 #define LINK_STATUS_RX_SIGNAL_PRESENT                   0x00800000
658 #define LINK_STATUS_MAC_LOCAL_FAULT                     0x01000000
659 #define LINK_STATUS_MAC_REMOTE_FAULT                    0x02000000
660 #define LINK_STATUS_UNSUPPORTED_SPD_REQ                 0x04000000
661 #define LINK_STATUS_FEC_MODE_MASK                       0x38000000
662 #define LINK_STATUS_FEC_MODE_NONE                       (0 << 27)
663 #define LINK_STATUS_FEC_MODE_FIRECODE_CL74              (1 << 27)
664 #define LINK_STATUS_FEC_MODE_RS_CL91                    (2 << 27)
665 #define LINK_STATUS_EXT_PHY_LINK_UP                     0x40000000
666
667         u32 link_status1;
668         u32 ext_phy_fw_version;
669 /* Points to struct eth_phy_cfg (For READ-ONLY) */
670         u32 drv_phy_cfg_addr;
671
672         u32 port_stx;
673
674         u32 stat_nig_timer;
675
676         struct port_mf_cfg port_mf_config;
677         struct port_stats stats;
678
679         u32 media_type;
680 #define MEDIA_UNSPECIFIED       0x0
681 #define MEDIA_SFPP_10G_FIBER    0x1     /* Use MEDIA_MODULE_FIBER instead */
682 #define MEDIA_XFP_FIBER         0x2     /* Use MEDIA_MODULE_FIBER instead */
683 #define MEDIA_DA_TWINAX         0x3
684 #define MEDIA_BASE_T            0x4
685 #define MEDIA_SFP_1G_FIBER      0x5     /* Use MEDIA_MODULE_FIBER instead */
686 #define MEDIA_MODULE_FIBER      0x6
687 #define MEDIA_KR                0xf0
688 #define MEDIA_NOT_PRESENT       0xff
689
690         u32 lfa_status;
691 #define LFA_LINK_FLAP_REASON_OFFSET             0
692 #define LFA_LINK_FLAP_REASON_MASK               0x000000ff
693 #define LFA_NO_REASON                                   (0 << 0)
694 #define LFA_LINK_DOWN                                   (1 << 0)
695 #define LFA_FORCE_INIT                                  (1 << 1)
696 #define LFA_LOOPBACK_MISMATCH                           (1 << 2)
697 #define LFA_SPEED_MISMATCH                              (1 << 3)
698 #define LFA_FLOW_CTRL_MISMATCH                          (1 << 4)
699 #define LFA_ADV_SPEED_MISMATCH                          (1 << 5)
700 #define LINK_FLAP_AVOIDANCE_COUNT_OFFSET        8
701 #define LINK_FLAP_AVOIDANCE_COUNT_MASK          0x0000ff00
702 #define LINK_FLAP_COUNT_OFFSET                  16
703 #define LINK_FLAP_COUNT_MASK                    0x00ff0000
704
705         u32 link_change_count;
706
707         /* LLDP params */
708 /* offset: 536 bytes? */
709         struct lldp_config_params_s lldp_config_params[LLDP_MAX_LLDP_AGENTS];
710         struct lldp_status_params_s lldp_status_params[LLDP_MAX_LLDP_AGENTS];
711         struct lldp_system_tlvs_buffer_s system_lldp_tlvs_buf;
712
713         /* DCBX related MIB */
714         struct dcbx_local_params local_admin_dcbx_mib;
715         struct dcbx_mib remote_dcbx_mib;
716         struct dcbx_mib operational_dcbx_mib;
717
718 /* FC_NPIV table offset & size in NVRAM value of 0 means not present */
719
720         u32 fc_npiv_nvram_tbl_addr;
721         u32 fc_npiv_nvram_tbl_size;
722         u32 transceiver_data;
723 #define ETH_TRANSCEIVER_STATE_MASK                      0x000000FF
724 #define ETH_TRANSCEIVER_STATE_SHIFT                     0x00000000
725 #define ETH_TRANSCEIVER_STATE_UNPLUGGED                 0x00000000
726 #define ETH_TRANSCEIVER_STATE_PRESENT                   0x00000001
727 #define ETH_TRANSCEIVER_STATE_VALID                     0x00000003
728 #define ETH_TRANSCEIVER_STATE_UPDATING                  0x00000008
729 #define ETH_TRANSCEIVER_TYPE_MASK                       0x0000FF00
730 #define ETH_TRANSCEIVER_TYPE_SHIFT                      0x00000008
731 #define ETH_TRANSCEIVER_TYPE_NONE                       0x00000000
732 #define ETH_TRANSCEIVER_TYPE_UNKNOWN                    0x000000FF
733 /* 1G Passive copper cable */
734 #define ETH_TRANSCEIVER_TYPE_1G_PCC                     0x01
735 /* 1G Active copper cable  */
736 #define ETH_TRANSCEIVER_TYPE_1G_ACC                     0x02
737 #define ETH_TRANSCEIVER_TYPE_1G_LX                      0x03
738 #define ETH_TRANSCEIVER_TYPE_1G_SX                      0x04
739 #define ETH_TRANSCEIVER_TYPE_10G_SR                     0x05
740 #define ETH_TRANSCEIVER_TYPE_10G_LR                     0x06
741 #define ETH_TRANSCEIVER_TYPE_10G_LRM                    0x07
742 #define ETH_TRANSCEIVER_TYPE_10G_ER                     0x08
743 /* 10G Passive copper cable */
744 #define ETH_TRANSCEIVER_TYPE_10G_PCC                    0x09
745 /* 10G Active copper cable  */
746 #define ETH_TRANSCEIVER_TYPE_10G_ACC                    0x0a
747 #define ETH_TRANSCEIVER_TYPE_XLPPI                      0x0b
748 #define ETH_TRANSCEIVER_TYPE_40G_LR4                    0x0c
749 #define ETH_TRANSCEIVER_TYPE_40G_SR4                    0x0d
750 #define ETH_TRANSCEIVER_TYPE_40G_CR4                    0x0e
751 /* Active optical cable */
752 #define ETH_TRANSCEIVER_TYPE_100G_AOC                   0x0f
753 #define ETH_TRANSCEIVER_TYPE_100G_SR4                   0x10
754 #define ETH_TRANSCEIVER_TYPE_100G_LR4                   0x11
755 #define ETH_TRANSCEIVER_TYPE_100G_ER4                   0x12
756 /* Active copper cable */
757 #define ETH_TRANSCEIVER_TYPE_100G_ACC                   0x13
758 #define ETH_TRANSCEIVER_TYPE_100G_CR4                   0x14
759 #define ETH_TRANSCEIVER_TYPE_4x10G_SR                   0x15
760 /* 25G Passive copper cable - short */
761 #define ETH_TRANSCEIVER_TYPE_25G_CA_N                   0x16
762 /* 25G Active copper cable  - short */
763 #define ETH_TRANSCEIVER_TYPE_25G_ACC_S                  0x17
764 /* 25G Passive copper cable - medium */
765 #define ETH_TRANSCEIVER_TYPE_25G_CA_S                   0x18
766 /* 25G Active copper cable  - medium */
767 #define ETH_TRANSCEIVER_TYPE_25G_ACC_M                  0x19
768 /* 25G Passive copper cable - long */
769 #define ETH_TRANSCEIVER_TYPE_25G_CA_L                   0x1a
770 /* 25G Active copper cable  - long */
771 #define ETH_TRANSCEIVER_TYPE_25G_ACC_L                  0x1b
772 #define ETH_TRANSCEIVER_TYPE_25G_SR                     0x1c
773 #define ETH_TRANSCEIVER_TYPE_25G_LR                     0x1d
774 #define ETH_TRANSCEIVER_TYPE_25G_AOC                    0x1e
775
776 #define ETH_TRANSCEIVER_TYPE_4x10G                      0x1f
777 #define ETH_TRANSCEIVER_TYPE_4x25G_CR                   0x20
778 #define ETH_TRANSCEIVER_TYPE_MULTI_RATE_10G_40G_SR      0x30
779 #define ETH_TRANSCEIVER_TYPE_MULTI_RATE_10G_40G_CR      0x31
780 #define ETH_TRANSCEIVER_TYPE_MULTI_RATE_10G_40G_LR      0x32
781 #define ETH_TRANSCEIVER_TYPE_MULTI_RATE_40G_100G_SR     0x33
782 #define ETH_TRANSCEIVER_TYPE_MULTI_RATE_40G_100G_CR     0x34
783 #define ETH_TRANSCEIVER_TYPE_MULTI_RATE_40G_100G_LR     0x35
784 #define ETH_TRANSCEIVER_TYPE_MULTI_RATE_40G_100G_AOC    0x36
785         u32 wol_info;
786         u32 wol_pkt_len;
787         u32 wol_pkt_details;
788         struct dcb_dscp_map dcb_dscp_map;
789
790         /* the status of EEE auto-negotiation
791          * bits 19:0 the configured tx-lpi entry timer value. Depends on bit 31.
792          * bits 23:20 the speeds advertised for EEE.
793          * bits 27:24 the speeds the Link partner advertised for EEE.
794          * The supported/adv. modes in bits 27:19 originate from the
795          * SHMEM_EEE_XXX_ADV definitions (where XXX is replaced by speed).
796          * bit 28 when 1'b1 EEE was requested.
797          * bit 29 when 1'b1 tx lpi was requested.
798          * bit 30 when 1'b1 EEE was negotiated. Tx lpi will be asserted if 30:29
799          *        are 2'b11.
800          * bit 31 - When 1'b0 bits 15:0 contain
801          *          NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_XXX define as value.
802          *          When 1'b1 those bits contains a value times 16 microseconds.
803          */
804         u32 eee_status;
805 #define EEE_TIMER_MASK          0x000fffff
806 #define EEE_ADV_STATUS_MASK     0x00f00000
807 #define EEE_1G_ADV      (1 << 1)
808 #define EEE_10G_ADV     (1 << 2)
809 #define EEE_ADV_STATUS_SHIFT    20
810 #define EEE_LP_ADV_STATUS_MASK  0x0f000000
811 #define EEE_LP_ADV_STATUS_SHIFT 24
812 #define EEE_REQUESTED_BIT       0x10000000
813 #define EEE_LPI_REQUESTED_BIT   0x20000000
814 #define EEE_ACTIVE_BIT          0x40000000
815 #define EEE_TIME_OUTPUT_BIT     0x80000000
816
817         u32 eee_remote; /* Used for EEE in LLDP */
818 #define EEE_REMOTE_TW_TX_MASK   0x0000ffff
819 #define EEE_REMOTE_TW_TX_SHIFT  0
820 #define EEE_REMOTE_TW_RX_MASK   0xffff0000
821 #define EEE_REMOTE_TW_RX_SHIFT  16
822 };
823
824 /**************************************/
825 /*                                    */
826 /*     P U B L I C      F U N C       */
827 /*                                    */
828 /**************************************/
829
830 struct public_func {
831         u32 iscsi_boot_signature;
832         u32 iscsi_boot_block_offset;
833
834         /* MTU size per funciton is needed for the OV feature */
835         u32 mtu_size;
836 /* 9 entires for the C2S PCP map for each inner VLAN PCP + 1 default */
837
838         /* For PCP values 0-3 use the map lower */
839         /* 0xFF000000 - PCP 0, 0x00FF0000 - PCP 1,
840          * 0x0000FF00 - PCP 2, 0x000000FF PCP 3
841          */
842         u32 c2s_pcp_map_lower;
843         /* For PCP values 4-7 use the map upper */
844         /* 0xFF000000 - PCP 4, 0x00FF0000 - PCP 5,
845          * 0x0000FF00 - PCP 6, 0x000000FF PCP 7
846         */
847         u32 c2s_pcp_map_upper;
848
849         /* For PCP default value get the MSB byte of the map default */
850         u32 c2s_pcp_map_default;
851
852         u32 reserved[4];
853
854         /* replace old mf_cfg */
855         u32 config;
856         /* E/R/I/D */
857         /* function 0 of each port cannot be hidden */
858 #define FUNC_MF_CFG_FUNC_HIDE                   0x00000001
859 #define FUNC_MF_CFG_PAUSE_ON_HOST_RING          0x00000002
860 #define FUNC_MF_CFG_PAUSE_ON_HOST_RING_SHIFT    0x00000001
861
862
863 #define FUNC_MF_CFG_PROTOCOL_MASK               0x000000f0
864 #define FUNC_MF_CFG_PROTOCOL_SHIFT              4
865 #define FUNC_MF_CFG_PROTOCOL_ETHERNET           0x00000000
866 #define FUNC_MF_CFG_PROTOCOL_ISCSI              0x00000010
867 #define FUNC_MF_CFG_PROTOCOL_FCOE               0x00000020
868 #define FUNC_MF_CFG_PROTOCOL_ROCE               0x00000030
869 #define FUNC_MF_CFG_PROTOCOL_MAX                0x00000030
870
871         /* MINBW, MAXBW */
872         /* value range - 0..100, increments in 1 %  */
873 #define FUNC_MF_CFG_MIN_BW_MASK                 0x0000ff00
874 #define FUNC_MF_CFG_MIN_BW_SHIFT                8
875 #define FUNC_MF_CFG_MIN_BW_DEFAULT              0x00000000
876 #define FUNC_MF_CFG_MAX_BW_MASK                 0x00ff0000
877 #define FUNC_MF_CFG_MAX_BW_SHIFT                16
878 #define FUNC_MF_CFG_MAX_BW_DEFAULT              0x00640000
879
880         u32 status;
881 #define FUNC_STATUS_VLINK_DOWN                  0x00000001
882
883         u32 mac_upper;      /* MAC */
884 #define FUNC_MF_CFG_UPPERMAC_MASK               0x0000ffff
885 #define FUNC_MF_CFG_UPPERMAC_SHIFT              0
886 #define FUNC_MF_CFG_UPPERMAC_DEFAULT            FUNC_MF_CFG_UPPERMAC_MASK
887         u32 mac_lower;
888 #define FUNC_MF_CFG_LOWERMAC_DEFAULT            0xffffffff
889
890         u32 fcoe_wwn_port_name_upper;
891         u32 fcoe_wwn_port_name_lower;
892
893         u32 fcoe_wwn_node_name_upper;
894         u32 fcoe_wwn_node_name_lower;
895
896         u32 ovlan_stag;     /* tags */
897 #define FUNC_MF_CFG_OV_STAG_MASK              0x0000ffff
898 #define FUNC_MF_CFG_OV_STAG_SHIFT             0
899 #define FUNC_MF_CFG_OV_STAG_DEFAULT           FUNC_MF_CFG_OV_STAG_MASK
900
901         u32 pf_allocation; /* vf per pf */
902
903         u32 preserve_data; /* Will be used bt CCM */
904
905         u32 driver_last_activity_ts;
906
907         /*
908          * drv_ack_vf_disabled is set by the PF driver to ack handled disabled
909          * VFs
910          */
911         u32 drv_ack_vf_disabled[VF_MAX_STATIC / 32];    /* 0x0044 */
912
913         u32 drv_id;
914 #define DRV_ID_PDA_COMP_VER_MASK        0x0000ffff
915 #define DRV_ID_PDA_COMP_VER_SHIFT       0
916
917 #define LOAD_REQ_HSI_VERSION            2
918 #define DRV_ID_MCP_HSI_VER_MASK         0x00ff0000
919 #define DRV_ID_MCP_HSI_VER_SHIFT        16
920 #define DRV_ID_MCP_HSI_VER_CURRENT      (LOAD_REQ_HSI_VERSION << \
921                                          DRV_ID_MCP_HSI_VER_SHIFT)
922
923 #define DRV_ID_DRV_TYPE_MASK            0x7f000000
924 #define DRV_ID_DRV_TYPE_SHIFT           24
925 #define DRV_ID_DRV_TYPE_UNKNOWN         (0 << DRV_ID_DRV_TYPE_SHIFT)
926 #define DRV_ID_DRV_TYPE_LINUX           (1 << DRV_ID_DRV_TYPE_SHIFT)
927 #define DRV_ID_DRV_TYPE_WINDOWS         (2 << DRV_ID_DRV_TYPE_SHIFT)
928 #define DRV_ID_DRV_TYPE_DIAG            (3 << DRV_ID_DRV_TYPE_SHIFT)
929 #define DRV_ID_DRV_TYPE_PREBOOT         (4 << DRV_ID_DRV_TYPE_SHIFT)
930 #define DRV_ID_DRV_TYPE_SOLARIS         (5 << DRV_ID_DRV_TYPE_SHIFT)
931 #define DRV_ID_DRV_TYPE_VMWARE          (6 << DRV_ID_DRV_TYPE_SHIFT)
932 #define DRV_ID_DRV_TYPE_FREEBSD         (7 << DRV_ID_DRV_TYPE_SHIFT)
933 #define DRV_ID_DRV_TYPE_AIX             (8 << DRV_ID_DRV_TYPE_SHIFT)
934
935 #define DRV_ID_DRV_INIT_HW_MASK         0x80000000
936 #define DRV_ID_DRV_INIT_HW_SHIFT        31
937 #define DRV_ID_DRV_INIT_HW_FLAG         (1 << DRV_ID_DRV_INIT_HW_SHIFT)
938 };
939
940 /**************************************/
941 /*                                    */
942 /*     P U B L I C       M B          */
943 /*                                    */
944 /**************************************/
945 /* This is the only section that the driver can write to, and each */
946 /* Basically each driver request to set feature parameters,
947  * will be done using a different command, which will be linked
948  * to a specific data structure from the union below.
949  * For huge strucuture, the common blank structure should be used.
950  */
951
952 struct mcp_mac {
953         u32 mac_upper;      /* Upper 16 bits are always zeroes */
954         u32 mac_lower;
955 };
956
957 struct mcp_val64 {
958         u32 lo;
959         u32 hi;
960 };
961
962 struct mcp_file_att {
963         u32 nvm_start_addr;
964         u32 len;
965 };
966
967 struct bist_nvm_image_att {
968         u32 return_code;
969         u32 image_type;         /* Image type */
970         u32 nvm_start_addr;     /* NVM address of the image */
971         u32 len;                /* Include CRC */
972 };
973
974 #define MCP_DRV_VER_STR_SIZE 16
975 #define MCP_DRV_VER_STR_SIZE_DWORD (MCP_DRV_VER_STR_SIZE / sizeof(u32))
976 #define MCP_DRV_NVM_BUF_LEN 32
977 struct drv_version_stc {
978         u32 version;
979         u8 name[MCP_DRV_VER_STR_SIZE - 4];
980 };
981
982 /* statistics for ncsi */
983 struct lan_stats_stc {
984         u64 ucast_rx_pkts;
985         u64 ucast_tx_pkts;
986         u32 fcs_err;
987         u32 rserved;
988 };
989
990 struct fcoe_stats_stc {
991         u64 rx_pkts;
992         u64 tx_pkts;
993         u32 fcs_err;
994         u32 login_failure;
995 };
996
997 struct iscsi_stats_stc {
998         u64 rx_pdus;
999         u64 tx_pdus;
1000         u64 rx_bytes;
1001         u64 tx_bytes;
1002 };
1003
1004 struct rdma_stats_stc {
1005         u64 rx_pkts;
1006         u64 tx_pkts;
1007         u64 rx_bytes;
1008         u64 tx_bytes;
1009 };
1010
1011 struct ocbb_data_stc {
1012         u32 ocbb_host_addr;
1013         u32 ocsd_host_addr;
1014         u32 ocsd_req_update_interval;
1015 };
1016
1017 #define MAX_NUM_OF_SENSORS                      7
1018 #define MFW_SENSOR_LOCATION_INTERNAL            1
1019 #define MFW_SENSOR_LOCATION_EXTERNAL            2
1020 #define MFW_SENSOR_LOCATION_SFP                 3
1021
1022 #define SENSOR_LOCATION_SHIFT                   0
1023 #define SENSOR_LOCATION_MASK                    0x000000ff
1024 #define THRESHOLD_HIGH_SHIFT                    8
1025 #define THRESHOLD_HIGH_MASK                     0x0000ff00
1026 #define CRITICAL_TEMPERATURE_SHIFT              16
1027 #define CRITICAL_TEMPERATURE_MASK               0x00ff0000
1028 #define CURRENT_TEMP_SHIFT                      24
1029 #define CURRENT_TEMP_MASK                       0xff000000
1030 struct temperature_status_stc {
1031         u32 num_of_sensors;
1032         u32 sensor[MAX_NUM_OF_SENSORS];
1033 };
1034
1035 /* crash dump configuration header */
1036 struct mdump_config_stc {
1037         u32 version;
1038         u32 config;
1039         u32 epoc;
1040         u32 num_of_logs;
1041         u32 valid_logs;
1042 };
1043
1044 enum resource_id_enum {
1045         RESOURCE_NUM_SB_E               =       0,
1046         RESOURCE_NUM_L2_QUEUE_E         =       1,
1047         RESOURCE_NUM_VPORT_E            =       2,
1048         RESOURCE_NUM_VMQ_E              =       3,
1049 /* Not a real resource!! it's a factor used to calculate others */
1050         RESOURCE_FACTOR_NUM_RSS_PF_E    =       4,
1051 /* Not a real resource!! it's a factor used to calculate others */
1052         RESOURCE_FACTOR_RSS_PER_VF_E    =       5,
1053         RESOURCE_NUM_RL_E               =       6,
1054         RESOURCE_NUM_PQ_E               =       7,
1055         RESOURCE_NUM_VF_E               =       8,
1056         RESOURCE_VFC_FILTER_E           =       9,
1057         RESOURCE_ILT_E                  =       10,
1058         RESOURCE_CQS_E                  =       11,
1059         RESOURCE_GFT_PROFILES_E         =       12,
1060         RESOURCE_NUM_TC_E               =       13,
1061         RESOURCE_NUM_RSS_ENGINES_E      =       14,
1062         RESOURCE_LL2_QUEUE_E            =       15,
1063         RESOURCE_RDMA_STATS_QUEUE_E     =       16,
1064         RESOURCE_BDQ_E                  =       17,
1065         RESOURCE_MAX_NUM,
1066         RESOURCE_NUM_INVALID            =       0xFFFFFFFF
1067 };
1068
1069 /* Resource ID is to be filled by the driver in the MB request
1070  * Size, offset & flags to be filled by the MFW in the MB response
1071  */
1072 struct resource_info {
1073         enum resource_id_enum res_id;
1074         u32 size; /* number of allocated resources */
1075         u32 offset; /* Offset of the 1st resource */
1076         u32 vf_size;
1077         u32 vf_offset;
1078         u32 flags;
1079 #define RESOURCE_ELEMENT_STRICT (1 << 0)
1080 };
1081
1082 #define DRV_ROLE_NONE           0
1083 #define DRV_ROLE_PREBOOT        1
1084 #define DRV_ROLE_OS             2
1085 #define DRV_ROLE_KDUMP          3
1086
1087 struct load_req_stc {
1088         u32 drv_ver_0;
1089         u32 drv_ver_1;
1090         u32 fw_ver;
1091         u32 misc0;
1092 #define LOAD_REQ_ROLE_MASK              0x000000FF
1093 #define LOAD_REQ_ROLE_SHIFT             0
1094 #define LOAD_REQ_LOCK_TO_MASK           0x0000FF00
1095 #define LOAD_REQ_LOCK_TO_SHIFT          8
1096 #define LOAD_REQ_LOCK_TO_DEFAULT        0
1097 #define LOAD_REQ_LOCK_TO_NONE           255
1098 #define LOAD_REQ_FORCE_MASK             0x000F0000
1099 #define LOAD_REQ_FORCE_SHIFT            16
1100 #define LOAD_REQ_FORCE_NONE             0
1101 #define LOAD_REQ_FORCE_PF               1
1102 #define LOAD_REQ_FORCE_ALL              2
1103 #define LOAD_REQ_FLAGS0_MASK            0x00F00000
1104 #define LOAD_REQ_FLAGS0_SHIFT           20
1105 #define LOAD_REQ_FLAGS0_AVOID_RESET     (0x1 << 0)
1106 };
1107
1108 struct load_rsp_stc {
1109         u32 drv_ver_0;
1110         u32 drv_ver_1;
1111         u32 fw_ver;
1112         u32 misc0;
1113 #define LOAD_RSP_ROLE_MASK              0x000000FF
1114 #define LOAD_RSP_ROLE_SHIFT             0
1115 #define LOAD_RSP_HSI_MASK               0x0000FF00
1116 #define LOAD_RSP_HSI_SHIFT              8
1117 #define LOAD_RSP_FLAGS0_MASK            0x000F0000
1118 #define LOAD_RSP_FLAGS0_SHIFT           16
1119 #define LOAD_RSP_FLAGS0_DRV_EXISTS      (0x1 << 0)
1120 };
1121
1122 union drv_union_data {
1123         struct mcp_mac wol_mac; /* UNLOAD_DONE */
1124
1125 /* This configuration should be set by the driver for the LINK_SET command. */
1126
1127         struct eth_phy_cfg drv_phy_cfg;
1128
1129         struct mcp_val64 val64; /* For PHY / AVS commands */
1130
1131         u8 raw_data[MCP_DRV_NVM_BUF_LEN];
1132
1133         struct mcp_file_att file_att;
1134
1135         u32 ack_vf_disabled[VF_MAX_STATIC / 32];
1136
1137         struct drv_version_stc drv_version;
1138
1139         struct lan_stats_stc lan_stats;
1140         struct fcoe_stats_stc fcoe_stats;
1141         struct iscsi_stats_stc iscsi_stats;
1142         struct rdma_stats_stc rdma_stats;
1143         struct ocbb_data_stc ocbb_info;
1144         struct temperature_status_stc temp_info;
1145         struct resource_info resource;
1146         struct bist_nvm_image_att nvm_image_att;
1147         struct mdump_config_stc mdump_config;
1148         u32 dword;
1149
1150         struct load_req_stc load_req;
1151         struct load_rsp_stc load_rsp;
1152         /* ... */
1153 };
1154
1155 struct public_drv_mb {
1156         u32 drv_mb_header;
1157 #define DRV_MSG_CODE_MASK                       0xffff0000
1158 #define DRV_MSG_CODE_LOAD_REQ                   0x10000000
1159 #define DRV_MSG_CODE_LOAD_DONE                  0x11000000
1160 #define DRV_MSG_CODE_INIT_HW                    0x12000000
1161 #define DRV_MSG_CODE_CANCEL_LOAD_REQ            0x13000000
1162 #define DRV_MSG_CODE_UNLOAD_REQ                 0x20000000
1163 #define DRV_MSG_CODE_UNLOAD_DONE                0x21000000
1164 #define DRV_MSG_CODE_INIT_PHY                   0x22000000
1165         /* Params - FORCE - Reinitialize the link regardless of LFA */
1166         /*        - DONT_CARE - Don't flap the link if up */
1167 #define DRV_MSG_CODE_LINK_RESET                 0x23000000
1168
1169         /* Vitaly: LLDP commands */
1170 #define DRV_MSG_CODE_SET_LLDP                   0x24000000
1171 #define DRV_MSG_CODE_SET_DCBX                   0x25000000
1172         /* OneView feature driver HSI*/
1173 #define DRV_MSG_CODE_OV_UPDATE_CURR_CFG         0x26000000
1174 #define DRV_MSG_CODE_OV_UPDATE_BUS_NUM          0x27000000
1175 #define DRV_MSG_CODE_OV_UPDATE_BOOT_PROGRESS    0x28000000
1176 #define DRV_MSG_CODE_OV_UPDATE_STORM_FW_VER     0x29000000
1177 #define DRV_MSG_CODE_NIG_DRAIN                  0x30000000
1178 #define DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE     0x31000000
1179 #define DRV_MSG_CODE_BW_UPDATE_ACK              0x32000000
1180 #define DRV_MSG_CODE_OV_UPDATE_MTU              0x33000000
1181 /* DRV_MB Param: driver version supp, FW_MB param: MFW version supp,
1182  * data: struct resource_info
1183  */
1184 #define DRV_MSG_GET_RESOURCE_ALLOC_MSG          0x34000000
1185 #define DRV_MSG_SET_RESOURCE_VALUE_MSG          0x35000000
1186
1187 /*deprecated don't use*/
1188 #define DRV_MSG_CODE_INITIATE_FLR_DEPRECATED    0x02000000
1189 #define DRV_MSG_CODE_INITIATE_PF_FLR            0x02010000
1190 #define DRV_MSG_CODE_VF_DISABLED_DONE           0xc0000000
1191 #define DRV_MSG_CODE_CFG_VF_MSIX                0xc0010000
1192 /* Param is either DRV_MB_PARAM_NVM_PUT_FILE_BEGIN_MFW/IMAGE */
1193 #define DRV_MSG_CODE_NVM_PUT_FILE_BEGIN         0x00010000
1194 /* Param should be set to the transaction size (up to 64 bytes) */
1195 #define DRV_MSG_CODE_NVM_PUT_FILE_DATA          0x00020000
1196 /* MFW will place the file offset and len in file_att struct */
1197 #define DRV_MSG_CODE_NVM_GET_FILE_ATT           0x00030000
1198 /* Read 32bytes of nvram data. Param is [0:23] â€“ Offset [24:31] â€“
1199  * Len in Bytes
1200  */
1201 #define DRV_MSG_CODE_NVM_READ_NVRAM             0x00050000
1202 /* Writes up to 32Bytes to nvram. Param is [0:23] â€“ Offset [24:31] â€“
1203  * Len in Bytes. In case this address is in the range of secured file in
1204  * secured mode, the operation will fail
1205  */
1206 #define DRV_MSG_CODE_NVM_WRITE_NVRAM            0x00060000
1207 /* Delete a file from nvram. Param is image_type. */
1208 #define DRV_MSG_CODE_NVM_DEL_FILE               0x00080000
1209 /* Reset MCP when no NVM operation is going on, and no drivers are loaded.
1210  * In case operation succeed, MCP will not ack back.
1211  */
1212 #define DRV_MSG_CODE_MCP_RESET                  0x00090000
1213 /* Temporary command to set secure mode, where the param is 0 (None secure) /
1214  * 1 (Secure) / 2 (Full-Secure)
1215  */
1216 #define DRV_MSG_CODE_SET_SECURE_MODE            0x000a0000
1217 /* Param: [0:15] - Address, [16:18] - lane# (0/1/2/3 - for single lane,
1218  * 4/5 - for dual lanes, 6 - for all lanes, [28] - PMD reg, [29] - select port,
1219  * [30:31] - port
1220  */
1221 #define DRV_MSG_CODE_PHY_RAW_READ               0x000b0000
1222 /* Param: [0:15] - Address, [16:18] - lane# (0/1/2/3 - for single lane,
1223  * 4/5 - for dual lanes, 6 - for all lanes, [28] - PMD reg, [29] - select port,
1224  * [30:31] - port
1225  */
1226 #define DRV_MSG_CODE_PHY_RAW_WRITE              0x000c0000
1227 /* Param: [0:15] - Address, [30:31] - port */
1228 #define DRV_MSG_CODE_PHY_CORE_READ              0x000d0000
1229 /* Param: [0:15] - Address, [30:31] - port */
1230 #define DRV_MSG_CODE_PHY_CORE_WRITE             0x000e0000
1231 /* Param: [0:3] - version, [4:15] - name (null terminated) */
1232 #define DRV_MSG_CODE_SET_VERSION                0x000f0000
1233 /* Halts the MCP. To resume MCP, user will need to use
1234  * MCP_REG_CPU_STATE/MCP_REG_CPU_MODE registers.
1235  */
1236 #define DRV_MSG_CODE_MCP_HALT                   0x00100000
1237 /* Set virtual mac address, params [31:6] - reserved, [5:4] - type,
1238  * [3:0] - func, drv_data[7:0] - MAC/WWNN/WWPN
1239  */
1240 #define DRV_MSG_CODE_SET_VMAC                   0x00110000
1241 /* Set virtual mac address, params [31:6] - reserved, [5:4] - type,
1242  * [3:0] - func, drv_data[7:0] - MAC/WWNN/WWPN
1243  */
1244 #define DRV_MSG_CODE_GET_VMAC                   0x00120000
1245 #define DRV_MSG_CODE_VMAC_TYPE_SHIFT            4
1246 #define DRV_MSG_CODE_VMAC_TYPE_MASK             0x30
1247 #define DRV_MSG_CODE_VMAC_TYPE_MAC              1
1248 #define DRV_MSG_CODE_VMAC_TYPE_WWNN             2
1249 #define DRV_MSG_CODE_VMAC_TYPE_WWPN             3
1250 /* Get statistics from pf, params [31:4] - reserved, [3:0] - stats type */
1251 #define DRV_MSG_CODE_GET_STATS                  0x00130000
1252 #define DRV_MSG_CODE_STATS_TYPE_LAN             1
1253 #define DRV_MSG_CODE_STATS_TYPE_FCOE            2
1254 #define DRV_MSG_CODE_STATS_TYPE_ISCSI           3
1255 #define DRV_MSG_CODE_STATS_TYPE_RDMA            4
1256 /* Host shall provide buffer and size for MFW  */
1257 #define DRV_MSG_CODE_PMD_DIAG_DUMP              0x00140000
1258 /* Host shall provide buffer and size for MFW  */
1259 #define DRV_MSG_CODE_PMD_DIAG_EYE               0x00150000
1260 /* Param: [0:1] - Port, [2:7] - read size, [8:15] - I2C address,
1261  * [16:31] - offset
1262  */
1263 #define DRV_MSG_CODE_TRANSCEIVER_READ           0x00160000
1264 /* Param: [0:1] - Port, [2:7] - write size, [8:15] - I2C address,
1265  * [16:31] - offset
1266  */
1267 #define DRV_MSG_CODE_TRANSCEIVER_WRITE          0x00170000
1268 /* indicate OCBB related information */
1269 #define DRV_MSG_CODE_OCBB_DATA                  0x00180000
1270 /* Set function BW, params[15:8] - min, params[7:0] - max */
1271 #define DRV_MSG_CODE_SET_BW                     0x00190000
1272 #define BW_MAX_MASK                             0x000000ff
1273 #define BW_MAX_SHIFT                            0
1274 #define BW_MIN_MASK                             0x0000ff00
1275 #define BW_MIN_SHIFT                            8
1276
1277 /* When param is set to 1, all parities will be masked(disabled). When params
1278  * are set to 0, parities will be unmasked again.
1279  */
1280 #define DRV_MSG_CODE_MASK_PARITIES              0x001a0000
1281 /* param[0] - Simulate fan failure,  param[1] - simulate over temp. */
1282 #define DRV_MSG_CODE_INDUCE_FAILURE             0x001b0000
1283 #define DRV_MSG_FAN_FAILURE_TYPE                (1 << 0)
1284 #define DRV_MSG_TEMPERATURE_FAILURE_TYPE        (1 << 1)
1285 /* Param: [0:15] - gpio number */
1286 #define DRV_MSG_CODE_GPIO_READ                  0x001c0000
1287 /* Param: [0:15] - gpio number, [16:31] - gpio value */
1288 #define DRV_MSG_CODE_GPIO_WRITE                 0x001d0000
1289 /* Param: [0:7] - test enum, [8:15] - image index, [16:31] - reserved */
1290 #define DRV_MSG_CODE_BIST_TEST                  0x001e0000
1291 #define DRV_MSG_CODE_GET_TEMPERATURE            0x001f0000
1292
1293 /* Set LED mode  params :0 operational, 1 LED turn ON, 2 LED turn OFF */
1294 #define DRV_MSG_CODE_SET_LED_MODE               0x00200000
1295 /* drv_data[7:0] - EPOC in seconds, drv_data[15:8] -
1296  * driver version (MAJ MIN BUILD SUB)
1297  */
1298 #define DRV_MSG_CODE_TIMESTAMP                  0x00210000
1299 /* This is an empty mailbox just return OK*/
1300 #define DRV_MSG_CODE_EMPTY_MB                   0x00220000
1301
1302 /* Param[0:4] - resource number (0-31), Param[5:7] - opcode,
1303  * param[15:8] - age
1304  */
1305 #define DRV_MSG_CODE_RESOURCE_CMD               0x00230000
1306
1307 #define RESOURCE_CMD_REQ_RESC_MASK              0x0000001F
1308 #define RESOURCE_CMD_REQ_RESC_SHIFT             0
1309 #define RESOURCE_CMD_REQ_OPCODE_MASK            0x000000E0
1310 #define RESOURCE_CMD_REQ_OPCODE_SHIFT           5
1311 /* request resource ownership with default aging */
1312 #define RESOURCE_OPCODE_REQ                     1
1313 /* request resource ownership without aging */
1314 #define RESOURCE_OPCODE_REQ_WO_AGING            2
1315 /* request resource ownership with specific aging timer (in seconds) */
1316 #define RESOURCE_OPCODE_REQ_W_AGING             3
1317 #define RESOURCE_OPCODE_RELEASE                 4 /* release resource */
1318 /* force resource release */
1319 #define RESOURCE_OPCODE_FORCE_RELEASE           5
1320 #define RESOURCE_CMD_REQ_AGE_MASK               0x0000FF00
1321 #define RESOURCE_CMD_REQ_AGE_SHIFT              8
1322
1323 #define RESOURCE_CMD_RSP_OWNER_MASK             0x000000FF
1324 #define RESOURCE_CMD_RSP_OWNER_SHIFT            0
1325 #define RESOURCE_CMD_RSP_OPCODE_MASK            0x00000700
1326 #define RESOURCE_CMD_RSP_OPCODE_SHIFT           8
1327 /* resource is free and granted to requester */
1328 #define RESOURCE_OPCODE_GNT                     1
1329 /* resource is busy, param[7:0] indicates owner as follow 0-15 = PF0-15,
1330  * 16 = MFW, 17 = diag over serial
1331  */
1332 #define RESOURCE_OPCODE_BUSY                    2
1333 /* indicate release request was acknowledged */
1334 #define RESOURCE_OPCODE_RELEASED                3
1335 /* indicate release request was previously received by other owner */
1336 #define RESOURCE_OPCODE_RELEASED_PREVIOUS       4
1337 /* indicate wrong owner during release */
1338 #define RESOURCE_OPCODE_WRONG_OWNER             5
1339 #define RESOURCE_OPCODE_UNKNOWN_CMD             255
1340
1341 /* dedicate resource 0 for dump */
1342 #define RESOURCE_DUMP                           0
1343
1344 #define DRV_MSG_CODE_GET_MBA_VERSION            0x00240000 /* Get MBA version */
1345 /* Send crash dump commands with param[3:0] - opcode */
1346 #define DRV_MSG_CODE_MDUMP_CMD                  0x00250000
1347 #define MDUMP_DRV_PARAM_OPCODE_MASK             0x0000000f
1348 /* acknowledge reception of error indication */
1349 #define DRV_MSG_CODE_MDUMP_ACK                  0x01
1350 /* set epoc and personality as follow: drv_data[3:0] - epoch,
1351  * drv_data[7:4] - personality
1352  */
1353 #define DRV_MSG_CODE_MDUMP_SET_VALUES           0x02
1354 /* trigger crash dump procedure */
1355 #define DRV_MSG_CODE_MDUMP_TRIGGER              0x03
1356 /* Request valid logs and config words */
1357 #define DRV_MSG_CODE_MDUMP_GET_CONFIG           0x04
1358 /* Set triggers mask. drv_mb_param should indicate (bitwise) which
1359  * trigger enabled
1360  */
1361 #define DRV_MSG_CODE_MDUMP_SET_ENABLE           0x05
1362 /* Clear all logs */
1363 #define DRV_MSG_CODE_MDUMP_CLEAR_LOGS           0x06
1364 #define DRV_MSG_CODE_MEM_ECC_EVENTS             0x00260000 /* Param: None */
1365 /* Param: [0:15] - gpio number */
1366 #define DRV_MSG_CODE_GPIO_INFO                  0x00270000
1367 /* Value will be placed in union */
1368 #define DRV_MSG_CODE_EXT_PHY_READ               0x00280000
1369 /* Value should be placed in union */
1370 #define DRV_MSG_CODE_EXT_PHY_WRITE              0x00290000
1371 #define DRV_MB_PARAM_ADDR_SHIFT                 0
1372 #define DRV_MB_PARAM_ADDR_MASK                  0x0000FFFF
1373 #define DRV_MB_PARAM_DEVAD_SHIFT                16
1374 #define DRV_MB_PARAM_DEVAD_MASK                 0x001F0000
1375 #define DRV_MB_PARAM_PORT_SHIFT                 21
1376 #define DRV_MB_PARAM_PORT_MASK                  0x00600000
1377 #define DRV_MSG_CODE_EXT_PHY_FW_UPGRADE         0x002a0000
1378
1379 #define DRV_MSG_SEQ_NUMBER_MASK                 0x0000ffff
1380
1381         u32 drv_mb_param;
1382         /* UNLOAD_REQ params */
1383 #define DRV_MB_PARAM_UNLOAD_WOL_UNKNOWN         0x00000000
1384 #define DRV_MB_PARAM_UNLOAD_WOL_MCP             0x00000001
1385 #define DRV_MB_PARAM_UNLOAD_WOL_DISABLED        0x00000002
1386 #define DRV_MB_PARAM_UNLOAD_WOL_ENABLED         0x00000003
1387
1388         /* UNLOAD_DONE_params */
1389 #define DRV_MB_PARAM_UNLOAD_NON_D3_POWER        0x00000001
1390
1391         /* INIT_PHY params */
1392 #define DRV_MB_PARAM_INIT_PHY_FORCE             0x00000001
1393 #define DRV_MB_PARAM_INIT_PHY_DONT_CARE         0x00000002
1394
1395         /* LLDP / DCBX params*/
1396 #define DRV_MB_PARAM_LLDP_SEND_MASK             0x00000001
1397 #define DRV_MB_PARAM_LLDP_SEND_SHIFT            0
1398 #define DRV_MB_PARAM_LLDP_AGENT_MASK            0x00000006
1399 #define DRV_MB_PARAM_LLDP_AGENT_SHIFT           1
1400 #define DRV_MB_PARAM_DCBX_NOTIFY_MASK           0x00000008
1401 #define DRV_MB_PARAM_DCBX_NOTIFY_SHIFT          3
1402
1403 #define DRV_MB_PARAM_NIG_DRAIN_PERIOD_MS_MASK   0x000000FF
1404 #define DRV_MB_PARAM_NIG_DRAIN_PERIOD_MS_SHIFT  0
1405
1406 #define DRV_MB_PARAM_NVM_PUT_FILE_BEGIN_MFW     0x1
1407 #define DRV_MB_PARAM_NVM_PUT_FILE_BEGIN_IMAGE   0x2
1408
1409 #define DRV_MB_PARAM_NVM_OFFSET_SHIFT           0
1410 #define DRV_MB_PARAM_NVM_OFFSET_MASK            0x00FFFFFF
1411 #define DRV_MB_PARAM_NVM_LEN_SHIFT              24
1412 #define DRV_MB_PARAM_NVM_LEN_MASK               0xFF000000
1413
1414 #define DRV_MB_PARAM_PHY_ADDR_SHIFT             0
1415 #define DRV_MB_PARAM_PHY_ADDR_MASK              0x1FF0FFFF
1416 #define DRV_MB_PARAM_PHY_LANE_SHIFT             16
1417 #define DRV_MB_PARAM_PHY_LANE_MASK              0x000F0000
1418 #define DRV_MB_PARAM_PHY_SELECT_PORT_SHIFT      29
1419 #define DRV_MB_PARAM_PHY_SELECT_PORT_MASK       0x20000000
1420 #define DRV_MB_PARAM_PHY_PORT_SHIFT             30
1421 #define DRV_MB_PARAM_PHY_PORT_MASK              0xc0000000
1422
1423 #define DRV_MB_PARAM_PHYMOD_LANE_SHIFT          0
1424 #define DRV_MB_PARAM_PHYMOD_LANE_MASK           0x000000FF
1425 #define DRV_MB_PARAM_PHYMOD_SIZE_SHIFT          8
1426 #define DRV_MB_PARAM_PHYMOD_SIZE_MASK           0x000FFF00
1427         /* configure vf MSIX params*/
1428 #define DRV_MB_PARAM_CFG_VF_MSIX_VF_ID_SHIFT    0
1429 #define DRV_MB_PARAM_CFG_VF_MSIX_VF_ID_MASK     0x000000FF
1430 #define DRV_MB_PARAM_CFG_VF_MSIX_SB_NUM_SHIFT   8
1431 #define DRV_MB_PARAM_CFG_VF_MSIX_SB_NUM_MASK    0x0000FF00
1432
1433         /* OneView configuration parametres */
1434 #define DRV_MB_PARAM_OV_CURR_CFG_SHIFT          0
1435 #define DRV_MB_PARAM_OV_CURR_CFG_MASK           0x0000000F
1436 #define DRV_MB_PARAM_OV_CURR_CFG_NONE           0
1437 #define DRV_MB_PARAM_OV_CURR_CFG_OS                     1
1438 #define DRV_MB_PARAM_OV_CURR_CFG_VENDOR_SPEC    2
1439 #define DRV_MB_PARAM_OV_CURR_CFG_OTHER          3
1440 #define DRV_MB_PARAM_OV_CURR_CFG_VC_CLP         4
1441 #define DRV_MB_PARAM_OV_CURR_CFG_CNU            5
1442 #define DRV_MB_PARAM_OV_CURR_CFG_DCI            6
1443 #define DRV_MB_PARAM_OV_CURR_CFG_HII            7
1444
1445 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_SHIFT                          0
1446 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_MASK                   0x000000FF
1447 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_NONE                           (1 << 0)
1448 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_ISCSI_IP_ACQUIRED              (1 << 1)
1449 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_FCOE_FABRIC_LOGIN_SUCCESS      (1 << 1)
1450 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_TRARGET_FOUND                  (1 << 2)
1451 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_ISCSI_CHAP_SUCCESS             (1 << 3)
1452 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_FCOE_LUN_FOUND                 (1 << 3)
1453 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_LOGGED_INTO_TGT                (1 << 4)
1454 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_IMG_DOWNLOADED                 (1 << 5)
1455 #define DRV_MB_PARAM_OV_UPDATE_BOOT_PROG_OS_HANDOFF                     (1 << 6)
1456 #define DRV_MB_PARAM_OV_UPDATE_BOOT_COMPLETED                           0
1457
1458 #define DRV_MB_PARAM_OV_PCI_BUS_NUM_SHIFT                               0
1459 #define DRV_MB_PARAM_OV_PCI_BUS_NUM_MASK                0x000000FF
1460
1461 #define DRV_MB_PARAM_OV_STORM_FW_VER_SHIFT              0
1462 #define DRV_MB_PARAM_OV_STORM_FW_VER_MASK                       0xFFFFFFFF
1463 #define DRV_MB_PARAM_OV_STORM_FW_VER_MAJOR_MASK         0xFF000000
1464 #define DRV_MB_PARAM_OV_STORM_FW_VER_MINOR_MASK         0x00FF0000
1465 #define DRV_MB_PARAM_OV_STORM_FW_VER_BUILD_MASK         0x0000FF00
1466 #define DRV_MB_PARAM_OV_STORM_FW_VER_DROP_MASK          0x000000FF
1467
1468 #define DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE_SHIFT               0
1469 #define DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE_MASK                0xF
1470 #define DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE_UNKNOWN             0x1
1471 /* Not Installed*/
1472 #define DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE_NOT_LOADED  0x2
1473 #define DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE_LOADING             0x3
1474 /* installed but disabled by user/admin/OS */
1475 #define DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE_DISABLED    0x4
1476 /* installed and active */
1477 #define DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE_ACTIVE              0x5
1478
1479 #define DRV_MB_PARAM_OV_MTU_SIZE_SHIFT          0
1480 #define DRV_MB_PARAM_OV_MTU_SIZE_MASK           0xFFFFFFFF
1481
1482 #define DRV_MB_PARAM_SET_LED_MODE_OPER          0x0
1483 #define DRV_MB_PARAM_SET_LED_MODE_ON            0x1
1484 #define DRV_MB_PARAM_SET_LED_MODE_OFF           0x2
1485
1486 #define DRV_MB_PARAM_TRANSCEIVER_PORT_SHIFT             0
1487 #define DRV_MB_PARAM_TRANSCEIVER_PORT_MASK              0x00000003
1488 #define DRV_MB_PARAM_TRANSCEIVER_SIZE_SHIFT             2
1489 #define DRV_MB_PARAM_TRANSCEIVER_SIZE_MASK              0x000000FC
1490 #define DRV_MB_PARAM_TRANSCEIVER_I2C_ADDRESS_SHIFT      8
1491 #define DRV_MB_PARAM_TRANSCEIVER_I2C_ADDRESS_MASK       0x0000FF00
1492 #define DRV_MB_PARAM_TRANSCEIVER_OFFSET_SHIFT           16
1493 #define DRV_MB_PARAM_TRANSCEIVER_OFFSET_MASK            0xFFFF0000
1494
1495 #define DRV_MB_PARAM_GPIO_NUMBER_SHIFT          0
1496 #define DRV_MB_PARAM_GPIO_NUMBER_MASK           0x0000FFFF
1497 #define DRV_MB_PARAM_GPIO_VALUE_SHIFT           16
1498 #define DRV_MB_PARAM_GPIO_VALUE_MASK            0xFFFF0000
1499 #define DRV_MB_PARAM_GPIO_DIRECTION_SHIFT       16
1500 #define DRV_MB_PARAM_GPIO_DIRECTION_MASK        0x00FF0000
1501 #define DRV_MB_PARAM_GPIO_CTRL_SHIFT            24
1502 #define DRV_MB_PARAM_GPIO_CTRL_MASK             0xFF000000
1503
1504         /* Resource Allocation params - Driver version support*/
1505 #define DRV_MB_PARAM_RESOURCE_ALLOC_VERSION_MAJOR_MASK  0xFFFF0000
1506 #define DRV_MB_PARAM_RESOURCE_ALLOC_VERSION_MAJOR_SHIFT         16
1507 #define DRV_MB_PARAM_RESOURCE_ALLOC_VERSION_MINOR_MASK  0x0000FFFF
1508 #define DRV_MB_PARAM_RESOURCE_ALLOC_VERSION_MINOR_SHIFT         0
1509
1510 #define DRV_MB_PARAM_BIST_UNKNOWN_TEST          0
1511 #define DRV_MB_PARAM_BIST_REGISTER_TEST         1
1512 #define DRV_MB_PARAM_BIST_CLOCK_TEST            2
1513 #define DRV_MB_PARAM_BIST_NVM_TEST_NUM_IMAGES           3
1514 #define DRV_MB_PARAM_BIST_NVM_TEST_IMAGE_BY_INDEX       4
1515
1516 #define DRV_MB_PARAM_BIST_RC_UNKNOWN            0
1517 #define DRV_MB_PARAM_BIST_RC_PASSED             1
1518 #define DRV_MB_PARAM_BIST_RC_FAILED             2
1519 #define DRV_MB_PARAM_BIST_RC_INVALID_PARAMETER          3
1520
1521 #define DRV_MB_PARAM_BIST_TEST_INDEX_SHIFT      0
1522 #define DRV_MB_PARAM_BIST_TEST_INDEX_MASK       0x000000FF
1523 #define DRV_MB_PARAM_BIST_TEST_IMAGE_INDEX_SHIFT      8
1524 #define DRV_MB_PARAM_BIST_TEST_IMAGE_INDEX_MASK       0x0000FF00
1525
1526         u32 fw_mb_header;
1527 #define FW_MSG_CODE_MASK                        0xffff0000
1528 #define FW_MSG_CODE_UNSUPPORTED                 0x00000000
1529 #define FW_MSG_CODE_DRV_LOAD_ENGINE             0x10100000
1530 #define FW_MSG_CODE_DRV_LOAD_PORT               0x10110000
1531 #define FW_MSG_CODE_DRV_LOAD_FUNCTION           0x10120000
1532 #define FW_MSG_CODE_DRV_LOAD_REFUSED_PDA        0x10200000
1533 #define FW_MSG_CODE_DRV_LOAD_REFUSED_HSI_1      0x10210000
1534 #define FW_MSG_CODE_DRV_LOAD_REFUSED_DIAG       0x10220000
1535 #define FW_MSG_CODE_DRV_LOAD_REFUSED_HSI        0x10230000
1536 #define FW_MSG_CODE_DRV_LOAD_REFUSED_REQUIRES_FORCE 0x10300000
1537 #define FW_MSG_CODE_DRV_LOAD_REFUSED_REJECT     0x10310000
1538 #define FW_MSG_CODE_DRV_LOAD_DONE               0x11100000
1539 #define FW_MSG_CODE_DRV_UNLOAD_ENGINE           0x20110000
1540 #define FW_MSG_CODE_DRV_UNLOAD_PORT             0x20120000
1541 #define FW_MSG_CODE_DRV_UNLOAD_FUNCTION         0x20130000
1542 #define FW_MSG_CODE_DRV_UNLOAD_DONE             0x21100000
1543 #define FW_MSG_CODE_INIT_PHY_DONE               0x21200000
1544 #define FW_MSG_CODE_INIT_PHY_ERR_INVALID_ARGS   0x21300000
1545 #define FW_MSG_CODE_LINK_RESET_DONE             0x23000000
1546 #define FW_MSG_CODE_SET_LLDP_DONE               0x24000000
1547 #define FW_MSG_CODE_SET_LLDP_UNSUPPORTED_AGENT  0x24010000
1548 #define FW_MSG_CODE_SET_DCBX_DONE               0x25000000
1549 #define FW_MSG_CODE_UPDATE_CURR_CFG_DONE        0x26000000
1550 #define FW_MSG_CODE_UPDATE_BUS_NUM_DONE         0x27000000
1551 #define FW_MSG_CODE_UPDATE_BOOT_PROGRESS_DONE   0x28000000
1552 #define FW_MSG_CODE_UPDATE_STORM_FW_VER_DONE    0x29000000
1553 #define FW_MSG_CODE_UPDATE_DRIVER_STATE_DONE    0x31000000
1554 #define FW_MSG_CODE_DRV_MSG_CODE_BW_UPDATE_DONE 0x32000000
1555 #define FW_MSG_CODE_DRV_MSG_CODE_MTU_SIZE_DONE  0x33000000
1556 #define FW_MSG_CODE_RESOURCE_ALLOC_OK           0x34000000
1557 #define FW_MSG_CODE_RESOURCE_ALLOC_UNKNOWN      0x35000000
1558 #define FW_MSG_CODE_RESOURCE_ALLOC_DEPRECATED   0x36000000
1559 #define FW_MSG_CODE_RESOURCE_ALLOC_GEN_ERR      0x37000000
1560 #define FW_MSG_CODE_NIG_DRAIN_DONE              0x30000000
1561 #define FW_MSG_CODE_VF_DISABLED_DONE            0xb0000000
1562 #define FW_MSG_CODE_DRV_CFG_VF_MSIX_DONE        0xb0010000
1563 #define FW_MSG_CODE_FLR_ACK                     0x02000000
1564 #define FW_MSG_CODE_FLR_NACK                    0x02100000
1565 #define FW_MSG_CODE_SET_DRIVER_DONE             0x02200000
1566 #define FW_MSG_CODE_SET_VMAC_SUCCESS            0x02300000
1567 #define FW_MSG_CODE_SET_VMAC_FAIL               0x02400000
1568
1569 #define FW_MSG_CODE_NVM_OK                      0x00010000
1570 #define FW_MSG_CODE_NVM_INVALID_MODE            0x00020000
1571 #define FW_MSG_CODE_NVM_PREV_CMD_WAS_NOT_FINISHED       0x00030000
1572 #define FW_MSG_CODE_NVM_FAILED_TO_ALLOCATE_PAGE 0x00040000
1573 #define FW_MSG_CODE_NVM_INVALID_DIR_FOUND       0x00050000
1574 #define FW_MSG_CODE_NVM_PAGE_NOT_FOUND          0x00060000
1575 #define FW_MSG_CODE_NVM_FAILED_PARSING_BNDLE_HEADER 0x00070000
1576 #define FW_MSG_CODE_NVM_FAILED_PARSING_IMAGE_HEADER 0x00080000
1577 #define FW_MSG_CODE_NVM_PARSING_OUT_OF_SYNC     0x00090000
1578 #define FW_MSG_CODE_NVM_FAILED_UPDATING_DIR     0x000a0000
1579 #define FW_MSG_CODE_NVM_FAILED_TO_FREE_PAGE     0x000b0000
1580 #define FW_MSG_CODE_NVM_FILE_NOT_FOUND          0x000c0000
1581 #define FW_MSG_CODE_NVM_OPERATION_FAILED        0x000d0000
1582 #define FW_MSG_CODE_NVM_FAILED_UNALIGNED        0x000e0000
1583 #define FW_MSG_CODE_NVM_BAD_OFFSET              0x000f0000
1584 #define FW_MSG_CODE_NVM_BAD_SIGNATURE           0x00100000
1585 #define FW_MSG_CODE_NVM_FILE_READ_ONLY          0x00200000
1586 #define FW_MSG_CODE_NVM_UNKNOWN_FILE            0x00300000
1587 #define FW_MSG_CODE_NVM_PUT_FILE_FINISH_OK      0x00400000
1588 /* MFW reject "mcp reset" command if one of the drivers is up */
1589 #define FW_MSG_CODE_MCP_RESET_REJECT            0x00600000
1590 #define FW_MSG_CODE_NVM_FAILED_CALC_HASH        0x00310000
1591 #define FW_MSG_CODE_NVM_PUBLIC_KEY_MISSING      0x00320000
1592 #define FW_MSG_CODE_NVM_INVALID_PUBLIC_KEY      0x00330000
1593
1594 #define FW_MSG_CODE_PHY_OK                      0x00110000
1595 #define FW_MSG_CODE_PHY_ERROR                   0x00120000
1596 #define FW_MSG_CODE_SET_SECURE_MODE_ERROR       0x00130000
1597 #define FW_MSG_CODE_SET_SECURE_MODE_OK          0x00140000
1598 #define FW_MSG_MODE_PHY_PRIVILEGE_ERROR         0x00150000
1599 #define FW_MSG_CODE_OK                          0x00160000
1600 #define FW_MSG_CODE_LED_MODE_INVALID            0x00170000
1601 #define FW_MSG_CODE_PHY_DIAG_OK                 0x00160000
1602 #define FW_MSG_CODE_PHY_DIAG_ERROR              0x00170000
1603 #define FW_MSG_CODE_INIT_HW_FAILED_TO_ALLOCATE_PAGE     0x00040000
1604 #define FW_MSG_CODE_INIT_HW_FAILED_BAD_STATE    0x00170000
1605 #define FW_MSG_CODE_INIT_HW_FAILED_TO_SET_WINDOW 0x000d0000
1606 #define FW_MSG_CODE_INIT_HW_FAILED_NO_IMAGE     0x000c0000
1607 #define FW_MSG_CODE_INIT_HW_FAILED_VERSION_MISMATCH     0x00100000
1608 #define FW_MSG_CODE_TRANSCEIVER_DIAG_OK                 0x00160000
1609 #define FW_MSG_CODE_TRANSCEIVER_DIAG_ERROR              0x00170000
1610 #define FW_MSG_CODE_TRANSCEIVER_NOT_PRESENT             0x00020000
1611 #define FW_MSG_CODE_TRANSCEIVER_BAD_BUFFER_SIZE         0x000f0000
1612 #define FW_MSG_CODE_GPIO_OK                     0x00160000
1613 #define FW_MSG_CODE_GPIO_DIRECTION_ERR          0x00170000
1614 #define FW_MSG_CODE_GPIO_CTRL_ERR               0x00020000
1615 #define FW_MSG_CODE_GPIO_INVALID                0x000f0000
1616 #define FW_MSG_CODE_GPIO_INVALID_VALUE          0x00050000
1617 #define FW_MSG_CODE_BIST_TEST_INVALID           0x000f0000
1618 #define FW_MSG_CODE_EXTPHY_INVALID_IMAGE_HEADER 0x00700000
1619 #define FW_MSG_CODE_EXTPHY_INVALID_PHY_TYPE     0x00710000
1620 #define FW_MSG_CODE_EXTPHY_OPERATION_FAILED     0x00720000
1621 #define FW_MSG_CODE_EXTPHY_NO_PHY_DETECTED      0x00730000
1622 #define FW_MSG_CODE_RECOVERY_MODE               0x00740000
1623
1624         /* mdump related response codes */
1625 #define FW_MSG_CODE_MDUMP_NO_IMAGE_FOUND        0x00010000
1626 #define FW_MSG_CODE_MDUMP_ALLOC_FAILED          0x00020000
1627 #define FW_MSG_CODE_MDUMP_INVALID_CMD           0x00030000
1628 #define FW_MSG_CODE_MDUMP_IN_PROGRESS           0x00040000
1629 #define FW_MSG_CODE_MDUMP_WRITE_FAILED          0x00050000
1630
1631 #define FW_MSG_SEQ_NUMBER_MASK                  0x0000ffff
1632
1633
1634         u32 fw_mb_param;
1635 /* Resource Allocation params - MFW  version support */
1636 #define FW_MB_PARAM_RESOURCE_ALLOC_VERSION_MAJOR_MASK   0xFFFF0000
1637 #define FW_MB_PARAM_RESOURCE_ALLOC_VERSION_MAJOR_SHIFT          16
1638 #define FW_MB_PARAM_RESOURCE_ALLOC_VERSION_MINOR_MASK   0x0000FFFF
1639 #define FW_MB_PARAM_RESOURCE_ALLOC_VERSION_MINOR_SHIFT          0
1640
1641
1642         u32 drv_pulse_mb;
1643 #define DRV_PULSE_SEQ_MASK                      0x00007fff
1644 #define DRV_PULSE_SYSTEM_TIME_MASK              0xffff0000
1645         /*
1646          * The system time is in the format of
1647          * (year-2001)*12*32 + month*32 + day.
1648          */
1649 #define DRV_PULSE_ALWAYS_ALIVE                  0x00008000
1650         /*
1651          * Indicate to the firmware not to go into the
1652          * OS-absent when it is not getting driver pulse.
1653          * This is used for debugging as well for PXE(MBA).
1654          */
1655
1656         u32 mcp_pulse_mb;
1657 #define MCP_PULSE_SEQ_MASK                      0x00007fff
1658 #define MCP_PULSE_ALWAYS_ALIVE                  0x00008000
1659         /* Indicates to the driver not to assert due to lack
1660          * of MCP response
1661          */
1662 #define MCP_EVENT_MASK                          0xffff0000
1663 #define MCP_EVENT_OTHER_DRIVER_RESET_REQ        0x00010000
1664
1665 /* The union data is used by the driver to pass parameters to the scratchpad. */
1666
1667         union drv_union_data union_data;
1668
1669 };
1670
1671 /* MFW - DRV MB */
1672 /**********************************************************************
1673  * Description
1674  *   Incremental Aggregative
1675  *   8-bit MFW counter per message
1676  *   8-bit ack-counter per message
1677  * Capabilities
1678  *   Provides up to 256 aggregative message per type
1679  *   Provides 4 message types in dword
1680  *   Message type pointers to byte offset
1681  *   Backward Compatibility by using sizeof for the counters.
1682  *   No lock requires for 32bit messages
1683  * Limitations:
1684  * In case of messages greater than 32bit, a dedicated mechanism(e.g lock)
1685  * is required to prevent data corruption.
1686  **********************************************************************/
1687 enum MFW_DRV_MSG_TYPE {
1688         MFW_DRV_MSG_LINK_CHANGE,
1689         MFW_DRV_MSG_FLR_FW_ACK_FAILED,
1690         MFW_DRV_MSG_VF_DISABLED,
1691         MFW_DRV_MSG_LLDP_DATA_UPDATED,
1692         MFW_DRV_MSG_DCBX_REMOTE_MIB_UPDATED,
1693         MFW_DRV_MSG_DCBX_OPERATIONAL_MIB_UPDATED,
1694         MFW_DRV_MSG_ERROR_RECOVERY,
1695         MFW_DRV_MSG_BW_UPDATE,
1696         MFW_DRV_MSG_S_TAG_UPDATE,
1697         MFW_DRV_MSG_GET_LAN_STATS,
1698         MFW_DRV_MSG_GET_FCOE_STATS,
1699         MFW_DRV_MSG_GET_ISCSI_STATS,
1700         MFW_DRV_MSG_GET_RDMA_STATS,
1701         MFW_DRV_MSG_FAILURE_DETECTED,
1702         MFW_DRV_MSG_TRANSCEIVER_STATE_CHANGE,
1703         MFW_DRV_MSG_CRITICAL_ERROR_OCCURRED,
1704         MFW_DRV_MSG_EEE_NEGOTIATION_COMPLETE,
1705         MFW_DRV_MSG_MAX
1706 };
1707
1708 #define MFW_DRV_MSG_MAX_DWORDS(msgs)    (((msgs - 1) >> 2) + 1)
1709 #define MFW_DRV_MSG_DWORD(msg_id)       (msg_id >> 2)
1710 #define MFW_DRV_MSG_OFFSET(msg_id)      ((msg_id & 0x3) << 3)
1711 #define MFW_DRV_MSG_MASK(msg_id)        (0xff << MFW_DRV_MSG_OFFSET(msg_id))
1712
1713 #ifdef BIG_ENDIAN               /* Like MFW */
1714 #define DRV_ACK_MSG(msg_p, msg_id) \
1715 ((u8)((u8 *)msg_p)[msg_id]++;)
1716 #else
1717 #define DRV_ACK_MSG(msg_p, msg_id) \
1718 ((u8)((u8 *)msg_p)[((msg_id & ~3) | ((~msg_id) & 3))]++;)
1719 #endif
1720
1721 #define MFW_DRV_UPDATE(shmem_func, msg_id) \
1722 ((u8)((u8 *)(MFW_MB_P(shmem_func)->msg))[msg_id]++;)
1723
1724 struct public_mfw_mb {
1725         u32 sup_msgs;       /* Assigend with MFW_DRV_MSG_MAX */
1726 /* Incremented by the MFW */
1727         u32 msg[MFW_DRV_MSG_MAX_DWORDS(MFW_DRV_MSG_MAX)];
1728 /* Incremented by the driver */
1729         u32 ack[MFW_DRV_MSG_MAX_DWORDS(MFW_DRV_MSG_MAX)];
1730 };
1731
1732 /**************************************/
1733 /*                                    */
1734 /*     P U B L I C       D A T A      */
1735 /*                                    */
1736 /**************************************/
1737 enum public_sections {
1738         PUBLIC_DRV_MB,      /* Points to the first drv_mb of path0 */
1739         PUBLIC_MFW_MB,      /* Points to the first mfw_mb of path0 */
1740         PUBLIC_GLOBAL,
1741         PUBLIC_PATH,
1742         PUBLIC_PORT,
1743         PUBLIC_FUNC,
1744         PUBLIC_MAX_SECTIONS
1745 };
1746
1747 struct drv_ver_info_stc {
1748         u32 ver;
1749         u8 name[32];
1750 };
1751
1752 /* Runtime data needs about 1/2K. We use 2K to be on the safe side.
1753  * Please make sure data does not exceed this size.
1754  */
1755 #define NUM_RUNTIME_DWORDS 16
1756 struct drv_init_hw_stc {
1757         u32 init_hw_bitmask[NUM_RUNTIME_DWORDS];
1758         u32 init_hw_data[NUM_RUNTIME_DWORDS * 32];
1759 };
1760
1761 struct mcp_public_data {
1762         /* The sections fields is an array */
1763         u32 num_sections;
1764         offsize_t sections[PUBLIC_MAX_SECTIONS];
1765         struct public_drv_mb drv_mb[MCP_GLOB_FUNC_MAX];
1766         struct public_mfw_mb mfw_mb[MCP_GLOB_FUNC_MAX];
1767         struct public_global global;
1768         struct public_path path[MCP_GLOB_PATH_MAX];
1769         struct public_port port[MCP_GLOB_PORT_MAX];
1770         struct public_func func[MCP_GLOB_FUNC_MAX];
1771 };
1772
1773 #define I2C_TRANSCEIVER_ADDR    0xa0
1774 #define MAX_I2C_TRANSACTION_SIZE        16
1775 #define MAX_I2C_TRANSCEIVER_PAGE_SIZE   256
1776
1777 #endif                          /* MCP_PUBLIC_H */