1 /****************************************************************************
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  *
21  * Copyright 2014 QLogic Corporation
22  * The contents of this file are subject to the terms of the
23  * QLogic End User License (the "License").
24  * You may not use this file except in compliance with the License.
25  *
26  * You can obtain a copy of the License at
27  * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/
28  * QLogic_End_User_Software_License.txt
29  * See the License for the specific language governing permissions
30  * and limitations under the License.
31  *
32 *
33 * FILE NAME:       ncsi_types.h
34 *
35 * DESCRIPTION:
36 *
37 * CONVENTIONS:
38 *
39 * AUTHOR:          Tim Sharp
40 *
41 * CREATION DATE:
42 *
43 * REVISION HISTORY
44 *
45 *   When        Who     What
46 *   -------------------------------------------------------------------------
47 ****************************************************************************/
48 
49 
50 #ifndef NCSI_BASIC_TYPES_H
51 #define NCSI_BASIC_TYPES_H
52 
53 #include "bcmtype.h"
54 #include "license.h"    // needed by shmem.h
55 #include "mcp_shmem.h"
56 
57 #define NCSI_TYPES_INTERFACE_REV   0x0010
58 /*----------------------------------------------------------------------------
59 ------------------------------ include files ---------------------------------
60 ----------------------------------------------------------------------------*/
61 // Currently only E2 support 2 PATH. To make data structure same for all chips,
62 // we make sure data structure fit all 2 paths regardless of the chips
63 #define PATH_SUPPORTED          2
64 
65 #define NCSI_MAC_ADDRESS_MAX    4
66 #define NCSI_VLAN_TAG_COUNT     2
67 
68 
69 #define NCSI_HEADER_REV (0x01)
70 
71 /*----------------------------------------------------------------------------
72 ------------------------------ local definitions -----------------------------
73 
74 structs, unions, typedefs, #defines, etc belong here...
75 
76 ----------------------------------------------------------------------------*/
77 #define INTEGRATED_WITH_BOOTCODE
78 
79 typedef u8_t*           pu8_t;
80 typedef u16_t*          pu16_t;
81 typedef u32_t*          pu32_t;
82 typedef void*           pVoid_t;
83 
84 
85 #define NCSI_TYPES_MILLISEC_TO_MICROSEC_MULTIPLIER          1000
86 
87 
88 #define NCSI_TYPES_CHANNEL_ID_MASK                          0x000000C0
89 #define NCSI_TYPES_MAGIC_NUMBER                             0xA5A5A5A5
90 
91 #define NCSI_LANDMARK_SIGNATURE                             0x01234567
92 #define NCSI_TYPES_MAX_MCP_FTQ_DEPTH_OS_PRESENT             (5 << 12)    // set depth to 5 entries
93 #define NCSI_TYPES_MAX_MCP_FTQ_DEPTH_OS_ABSENT              (32 << 12)   // set depth to 32 entries
94 
95 #define NCSI_TYPES_MAX_L2_PKT_SIZE                          1514            /* max Ethernet frame size for IMD */
96 #define NCSI_TYPES_MAX_L2_PKT_SIZE_PLUS_VLAN                1518            /* max Ethernet frame size for IMD */
97 #define NCSI_TYPES_MIN_L2_PKT_SIZE                          60              /* min Ethernet frame size */
98 
99 #define UMP_BCNT_FRAGMENT_AND_ALIGNMENT_ADJUSTMENT          5 /* 3 bytes for fragment
100                                                             rounding and 2 more for
101                                                             the +2 alignment.  The
102                                                             CRC is not included here */
103 #define SIZEOF_CRC                                          4
104 #define SIZEOF_MAC_ADDRESS                                  6
105 
106 
107 
108 #define SUCCESS                                             0
109 #define FAILURE                                             1
110 
111 #define STATUS_OK                                                  0
112 #define STATUS_ERROR                                               1
113 
114 
115 #define NCSI_TYPES_MIN_UMP_CMD_RSP_FRAME_SIZE  60
116 
117 
118 #define MDIO_PHY_ADDR(X)             ( ( (X) & 0x1F ) << 21 )
119 #define MDIO_PHY_REG(X)              ( ( (X) & 0x1F ) << 16 )
120 
121 
122 /*****************************************************************************
123 
124     The NCSI version type is based on the format used in the get version
125     command, and is intended to allow the struct value to be copied directly
126     into the packet structure byte for byte without processing.
127 
128 *****************************************************************************/
129 
130 typedef struct NcsiVersion
131 #if defined (BIG_ENDIAN)
132 {
133     u8_t    Major;
134     u8_t    Minor;
135     u8_t    Update;
136     u8_t    Alpha1;
137     u8_t    Reserved0;
138     u8_t    Reserved1;
139     u8_t    Reserved2;
140     u8_t    Alpha2;
141 }NcsiVersion_t;
142 #elif defined (LITTLE_ENDIAN)
143 {
144     u8_t    Alpha1;
145     u8_t    Update;
146     u8_t    Minor;
147     u8_t    Major;
148     u8_t    Alpha2;
149     u8_t    Reserved2;
150     u8_t    Reserved1;
151     u8_t    Reserved0;
152 }NcsiVersion_t;
153 #endif // ENDIAN
154 
155 /*****************************************************************************
156 
157 *****************************************************************************/
158 
159 
160 typedef struct NcsiMacAddr
161 #if defined (BIG_ENDIAN)
162 {
163     u16_t   High;
164     u16_t   LowHigh;
165     u16_t   LowLow;
166 
167 } NcsiMacAddr_t;
168 #elif defined (LITTLE_ENDIAN)
169 {
170     u16_t   LowHigh;
171     u16_t   High;
172 
173     u16_t   LowLow;
174 	u8_t	NcsiMacAddr_padding_16;	// padding fields added
175 	u8_t	NcsiMacAddr_padding_24;	// padding fields added
176 } NcsiMacAddr_t;
177 #endif // ENDIAN
178 
179 
180 
181 typedef struct UmpMacAddr
182 {
183     u32_t   High;
184     u32_t   Low;
185 } UmpMacAddr_t;                                                 // 8 bytes total
186 
187 
188 typedef UmpMacAddr_t* pUmpMacAddr_t;
189 
190 typedef struct MacAddrConfig
191 {
192     u32_t        IsEnabled;
193     UmpMacAddr_t    Addr;
194 
195 } MacAddrConfig_t;                                              //12 bytes total
196 
197 
198 
199 /*****************************************************************************
200 
201 UmpVlan_t
202 
203     Structure definition for vlan tag
204 
205 *****************************************************************************/
206 typedef struct UmpVlan
207 #if defined (BIG_ENDIAN)
208 {
209     u16_t   IsEnabled;           //
210     u16_t   TagControlInfo ;     // tag control info
211         #define VLAN_TAG_VID_FIELD_MASK     (0x0FFF << 0)
212         #define VLAN_TAG_PRI_FIELD_MASK     (0xE000 << 0)
213         #define VLAN_TAG_CFI_FIELD_MASK     (0x1000 << 0)
214 
215 } UmpVlan_t;                                                    // 4 bytes total
216 #elif defined (LITTLE_ENDIAN)
217 {
218     u16_t   TagControlInfo ;     // tag control info
219     u16_t   IsEnabled;           //
220         #define VLAN_TAG_VID_FIELD_MASK     (0x0FFF << 0)
221         #define VLAN_TAG_PRI_FIELD_MASK     (0xE000 << 0)
222         #define VLAN_TAG_CFI_FIELD_MASK     (0x1000 << 0)
223 
224 } UmpVlan_t;                                                    // 4 bytes total
225 #endif // ENDIAN
226 
227 typedef UmpVlan_t* pVlanTag_t;
228 
229 
230 /*****************************************************************************
231 
232 *****************************************************************************/
233 
234 
235 typedef struct PktErrorStat_t
236 {
237     u32_t    EgressPktsDroppedNoSaMatch;
238     u32_t    IngressPktsDroppedVlanMis;
239     u32_t    CmdsDroppedSizeErr;
240     u32_t    CmdsDroppedChanPkgIdErr;
241     u32_t    CmdsDroppedNcsiHdrRevErr;
242 
243 } PktErrorStat_t;
244 
245 
246 typedef struct UmpDebugData
247 #if defined (BIG_ENDIAN)
248 {
249     u32_t    LandMark;
250     u32_t    GlobalResetCount;
251     u32_t    NcsiCmdDataAddr;
252     u32_t    UmpRxDataAddr;
253     u32_t    UmpTxDataAddr;
254     u16_t    TxDescErrCount;
255     u16_t    LoopBackPktCount;
256 
257 } UmpDebugData_t;
258 #elif defined (LITTLE_ENDIAN)
259 {
260     u32_t    LandMark;
261     u32_t    GlobalResetCount;
262     u32_t    NcsiCmdDataAddr;
263     u32_t    UmpRxDataAddr;
264     u32_t    UmpTxDataAddr;
265     u16_t    LoopBackPktCount;
266     u16_t    TxDescErrCount;
267 
268 } UmpDebugData_t;
269 #endif // ENDIAN
270 
271 typedef UmpDebugData_t * UmpDebugDataPtr_t;
272 
273 /*****************************************************************************
274 
275 *****************************************************************************/
276 typedef struct CmdPktCnt
277 {
278     u32_t   Rx;           //  Num of valid cmds rx by cmd proc
279     u32_t   Dropped;      //  Num of cmds dropped by cmd proc
280     u32_t   CmdTypeErrs;  //  Num of cmds that have had cmd type err
281     u32_t   ChkSumErrs;   //  Num of cmds that have failed checksum calc
282     u64_t   TotalRxPkts;  //  total of all cmd pkts rx
283     u64_t   TotalTxPkts;  //  total of all control pkts sent
284     u64_t   TotalRxBytes; //  total of all cmd pkts rx
285     u64_t   TotalTxBytes; //  total of all control pkts sent
286     u32_t   AensSent;     //  count of all aens sent
287 
288 } CmdPktCnt_t;
289 
290 typedef struct EgressPktCnt
291 {
292     u32_t   TotalPktHigh;       // 0-3      count of all ump mgmt pkts rx
293     u32_t   TotalPktLow;       // 0-3      count of all ump mgmt pkts rx
294     u32_t   TotalDropped;    // 12-15    count of all ump pkts dropped regardless of type
295     u32_t   ChannelStateErr; // 16-19    count of all ump mgmt pkts rx while channel is disabled
296     u32_t   UnderSized;      // 20-23    count of all ump rx pkts whose bcnt was less than 60 bytes
297     u32_t   OverSized;       // 24-27    count of all ump rx pkts whose bcnt was greater than 1514 bytes
298 
299 } EgressPktCnt_t;
300 
301 typedef struct IngressPktCnt
302 {
303     u32_t   TotalPkt;        // 0-3    count of all packets received on the mcp ftq
304     u32_t   TotalDropped;    // 4-7    count of all packets dropped for any reason
305     u32_t   OverSizedErr;    // 8-11   count of all packets dropped due to being undersized
306     u32_t   UnderSizedErr;   // 12-15  count of all packets dropped due to being oversized
307     u32_t   ChannelStateErr; // 16-19  count of all packets dropped because rx when chan disabled
308 
309 } IngressPktCnt_t;
310 
311 typedef struct SmbusErrCnt
312 #if defined (BIG_ENDIAN)
313 {
314     u8_t      slave_rd_event;            //  SLAVE_RD_EVENT
315     u8_t      slave_start_busy;          //  SLAVE_START_BUSY
316     u8_t      slave_arp_event;           //  SLAVE_ARP_EVENT
317     u8_t      master_rx_event;           //  MASTER_RX_EVENT
318 
319     u8_t      slave_tx_underrun;         //  SLAVE_TX_UNDERRUN
320     u8_t      slave_rx_threshold_hit;    //  SLAVE_RX_THRESHOLD_HIT
321     u8_t      slave_rx_fifo_full;        //  SLAVE_RX_FIFO_FULL
322     u8_t      master_tx_underrun;        //  MASTER_TX_UNDERRUN
323 
324     u8_t      master_rx_threshold_hit;   //  MASTER_RX_THRESHOLD_HIT
325     u8_t      master_rx_fifo_full;       //  MASTER_RX_FIFO_FULL
326     u8_t      fifo_overflow;             //  FIFO overflow
327     u8_t      transaction_error;         //  General SMBUS transaction err
328 
329     u8_t      pec_error;                 //  PEC error
330     u8_t      illegal_pkt_len;           //  rx pkt len > max len
331     u8_t      lost_arbitration;          //  Lost Arbitration
332     u8_t      slave_off_line;            //  slave device is off-line, NACK detected after (slave address) first byte
333 
334     u8_t      slave_busy;                //  slave device maybe busy, NACK detected after byte other than first
335     u8_t      slave_bus_timeout;         //  slave device held bus for more then 25ms
336     u8_t      master_busy_timeout;       //  Master Start Busy for > 200 msec
337     u8_t      unused;
338 } SmbusErrCnt_t;
339 #elif defined (LITTLE_ENDIAN)
340 {
341     u8_t      master_rx_event;           //  MASTER_RX_EVENT
342     u8_t      slave_arp_event;           //  SLAVE_ARP_EVENT
343     u8_t      slave_start_busy;          //  SLAVE_START_BUSY
344     u8_t      slave_rd_event;            //  SLAVE_RD_EVENT
345 
346     u8_t      master_tx_underrun;        //  MASTER_TX_UNDERRUN
347     u8_t      slave_rx_threshold_hit;    //  SLAVE_RX_THRESHOLD_HIT
348     u8_t      slave_rx_fifo_full;        //  SLAVE_RX_FIFO_FULL
349     u8_t      slave_tx_underrun;         //  SLAVE_TX_UNDERRUN
350 
351     u8_t      transaction_error;         //  General SMBUS transaction err
352     u8_t      fifo_overflow;             //  FIFO overflow
353     u8_t      master_rx_fifo_full;       //  MASTER_RX_FIFO_FULL
354     u8_t      master_rx_threshold_hit;   //  MASTER_RX_THRESHOLD_HIT
355 
356     u8_t      slave_off_line;            //  slave device is off-line, NACK detected after (slave address) first byte
357     u8_t      lost_arbitration;          //  Lost Arbitration
358     u8_t      illegal_pkt_len;           //  rx pkt len > max len
359     u8_t      pec_error;                 //  PEC error
360 
361     u8_t      unused;
362     u8_t      master_busy_timeout;       //  Master Start Busy for > 200 msec
363     u8_t      slave_bus_timeout;         //  slave device held bus for more then 25ms
364     u8_t      slave_busy;                //  slave device maybe busy, NACK detected after byte other than first
365 } SmbusErrCnt_t;
366 #endif // ENDIAN
367 
368 
369 typedef struct UmpStatistics
370 {
371     CmdPktCnt_t NcsiCmdPktCnts;
372     union
373     {
374         EgressPktCnt_t BMC2MCP;
375         SmbusErrCnt_t  smbus_err_cnts;
376     };
377     IngressPktCnt_t MCP2BMC;
378 } UmpStatistics_t;
379 
380 
381 typedef struct ChannelState
382 {
383     u32_t    Ready         :1; // 1b= ready, 0b = not ready
384     u32_t    InitialState  :1; // 1b= in intial state, 0b = not in initial state
385     u32_t    TxPtEnabled   :1; // 1b = tx pass through enabled, 0b = not enabled
386     u32_t    RxPtEnabled   :1; // 1b = rx pass through enabled, 0b = not enabled
387 
388 } ChannelState_t;
389 
390 
391 
392 /*****************************************************************************
393 
394 UmpPortConfig_t
395 
396     this structure definition is for the container of IMD configured data that
397     is saved and used in recovery from soft reset, and is returned in response
398     to the get parameters ump cmd.  This struct also stores the pointer to the
399     saved rsp frm also used in error recovery.
400 
401     Note that this definition is using the cmd pkt desc ptr for the prev rsp
402     frm.  This is valid.
403 
404 *****************************************************************************/
405 typedef struct UmpPortConfigFlag
406 #if defined (BIG_ENDIAN)
407 {
408     u32_t                             :11;
409     u32_t    NetwBmcPassthruDisabled  :1;     // enabled by default, can be forced disabled by OEM command
410     u32_t    VntagEnabled             :1;
411     u32_t    InvalidHiGigLen          :1;     // This is set ONLY if HI_GIG header is 12
412 
413     u32_t    PerformReset             :1;    //#define UMPTX_FLAG_CHANNEL_RESET_PENDING   (1<<4)  // IMD channel reset has been rx
414     u32_t    LinkStateChange          :1;    // indicates change in link state was detected on invocation
415 
416     u32_t    DriverStateChange        :1;    // indicates change in driver state was detected while processing port reset
417     u32_t    DriverPresent            :1;
418     u32_t    ChannelSpecificReset     :1;
419     u32_t    Exceed375MaFlag          :1;
420 
421     u32_t    OsPresentFlag            :1;            // used to store "actual" state of flag during testing
422     u32_t    HostBmcPassthruEnabled   :1;
423     u32_t    ResetPending             :1; //10        TRUE=channel reset pending
424     u32_t    VlanEnabled              :1; //9         TRUE=VlAN enabled
425 
426     u32_t    LinkForcedByBmc          :1; //8         TRUE=link config forced by IMD
427     u32_t    HiGigMode                :1; //7         This is set ONLY if HI_GIG header is non-zero
428     u32_t    BroadcastFilterEnabled   :1; //6         FALSE=dis, TRUE=en
429     u32_t    MulticastFilterEnabled   :1; //5         FALSE=dis, TRUE=en
430 
431     u32_t    InitialState             :1; //4         1b= in intial state, 0b = not in initial state
432     u32_t    Ready                    :1; //3         1b= ready, 0b = not ready
433     u32_t    EgressPassThruEnabled    :1; //2         1b = tx pass through enabled, 0b = not enabled
434     u32_t    ChannelEnabled           :1; //1        FALSE=dis, 1=en
435 } UmpPortConfigFlag_t;
436 #elif defined (LITTLE_ENDIAN)
437 {
438     u32_t    ChannelEnabled           :1; //1        FALSE=dis, 1=en
439     u32_t    EgressPassThruEnabled    :1; //2         1b = tx pass through enabled, 0b = not enabled
440     u32_t    Ready                    :1; //3         1b= ready, 0b = not ready
441     u32_t    InitialState             :1; //4         1b= in intial state, 0b = not in initial state
442     u32_t    MulticastFilterEnabled   :1; //5         FALSE=dis, TRUE=en
443     u32_t    BroadcastFilterEnabled   :1; //6         FALSE=dis, TRUE=en
444     u32_t    HiGigMode                :1; //7         This is set ONLY if HI_GIG header is non-zero
445     u32_t    LinkForcedByBmc          :1; //8         TRUE=link config forced by IMD
446     u32_t    VlanEnabled              :1; //9         TRUE=VlAN enabled
447     u32_t    ResetPending             :1; //10        TRUE=channel reset pending
448     u32_t    HostBmcPassthruEnabled   :1;
449     u32_t    OsPresentFlag            :1;            // used to store "actual" state of flag during testing
450     u32_t    Exceed375MaFlag          :1;
451     u32_t    ChannelSpecificReset     :1;
452     u32_t    DriverPresent            :1;
453     u32_t    DriverStateChange        :1;    // indicates change in driver state was detected while processing port reset
454     u32_t    LinkStateChange          :1;    // indicates change in link state was detected on invocation
455     u32_t    PerformReset             :1;    //#define UMPTX_FLAG_CHANNEL_RESET_PENDING   (1<<4)  // IMD channel reset has been rx
456     u32_t    InvalidHiGigLen          :1;     // This is set ONLY if HI_GIG header is 12
457     u32_t    VntagEnabled             :1;
458     u32_t    NetwBmcPassthruDisabled  :1;     // enabled by default, can be forced disabled by OEM command
459     u32_t                             :11;
460 } UmpPortConfigFlag_t;
461 #endif // ENDIAN
462 
463 typedef struct UmpPortConfig
464 #if defined (BIG_ENDIAN)
465 {
466 
467     UmpPortConfigFlag_t Flags;
468     u32_t            ResetCount           : 12;
469     u32_t            McId                : 4;       // id provided by mc in aen enable
470     u32_t            AenConfig           : 4;       //
471     u32_t            BroadcastFilter     : 4;       //
472     u32_t            MulticastFilter     : 4;       //
473     u32_t            VlanConfiguration   : 4;       //
474 
475     u32_t            LinkSettingsFromBmc;
476     u32_t            OemLinkSettingsFromBmc;
477 
478     MacAddrConfig_t  MacAddr[NCSI_MAC_ADDRESS_MAX];    //60 Bytes (4 * 12 bytes each)
479     UmpVlan_t        VlanTag[NCSI_VLAN_TAG_COUNT];     //68 Bytes (2 * 4 bytes each)
480     u32_t            LinkStatus;                       //72 BYtes
481 
482 } UmpPortConfig_t;                                        //72 bytes total
483 #elif defined (LITTLE_ENDIAN)
484 {
485 
486     UmpPortConfigFlag_t Flags;
487     u32_t            VlanConfiguration   : 4;       //
488     u32_t            MulticastFilter     : 4;       //
489     u32_t            BroadcastFilter     : 4;       //
490     u32_t            AenConfig           : 4;       //
491     u32_t            McId                : 4;       // id provided by mc in aen enable
492     u32_t            ResetCount           : 12;
493 
494     u32_t            LinkSettingsFromBmc;
495     u32_t            OemLinkSettingsFromBmc;
496 
497     MacAddrConfig_t  MacAddr[NCSI_MAC_ADDRESS_MAX];  //60 Bytes (4 * 12 bytes each)
498     UmpVlan_t        VlanTag[NCSI_VLAN_TAG_COUNT];     //68 Bytes (2 * 4 bytes each)
499     u32_t            LinkStatus;                       //72 BYtes
500 
501 } UmpPortConfig_t;                                        //72 bytes total
502 #endif // ENDIAN
503 
504 typedef struct
505 #if defined (BIG_ENDIAN)
506 {
507     u8_t  vif_id;
508     u8_t  allowed_priorities;
509     u16_t default_vlan_tag;
510 }vntag_cfg_t;
511 #elif defined (LITTLE_ENDIAN)
512 {
513     u16_t default_vlan_tag;
514     u8_t  allowed_priorities;
515     u8_t  vif_id;
516 }vntag_cfg_t;
517 #endif
518 
519 /*****************************************************************************
520 
521     This data structure is intended to encapsulate runtime debug data that
522     could be accessed from a host based diagnostics program, as well as an
523     embedded debug ump command.
524 
525 *****************************************************************************/
526 typedef struct NcsiChannelData
527 {
528     UmpStatistics_t     Statistics;              // 72 bytes
529     UmpPortConfig_t        Config;               //current config state data-80 bytes
530     vntag_cfg_t         VntagCfg;
531 } NcsiChannelData_t;                               // 152 bytes total
532 
533 typedef struct SrcMacAddr
534 {
535     u32_t   chnl    : 8;
536     u32_t   addr_hi : 24;
537     u32_t   addr_lo;
538 } SrcMacAddr_t;
539 
540 #define HOST_SRC_ADDR_HIST_SIZE       8
541 
542 typedef struct HostSrcMacBuff
543 {
544     u32_t current_index;
545     SrcMacAddr_t  host_addr[HOST_SRC_ADDR_HIST_SIZE];
546 } HostSrcMacBuff_t;
547 
548 #if defined (BIG_ENDIAN)
549 typedef NcsiChannelData_t* pNcsiChannelData_t;
550 #else
551 // define pointer as 32-bit value to ease diag encoding
552 typedef u32_t    pNcsiChannelData_t;
553 #endif
554 
555 typedef struct PackageState
556 #if defined (BIG_ENDIAN)
557 {
558     u32_t                        :12;
559     u32_t    DellOemCmdSupport   :1;
560 
561     u32_t                        :1;
562     u32_t    PrevResetType       :8;
563             #define NCSI_RESET_TYPE_CHANNEL0_RESET      0           // driver events D0
564             #define NCSI_RESET_TYPE_CHANNEL1_RESET      1           // driver events D0
565             #define NCSI_RESET_TYPE_COLD_START          0xAA        // POR from D3 hot
566             #define NCSI_RESET_TYPE_WARM_START          0xBB        // OOB, and possibly POR from D3 cold
567 
568     u32_t    ControlPacketSeen   :1;
569     u32_t    LoopBackPktActive   :1;
570 
571     u32_t    LoopBackEnabled     :1;
572     u32_t    SmbusMode           :1; // 1b indicates SMBUS instead of RMII is being used
573     u32_t    SmbusFix            :1; // 1b indicates SMBUS tx fifo is fixed in HW
574     u32_t    Ready               :1; // 1b= ready, 0b = not ready
575 
576     u32_t    Selected            :1; // 1b= selected, 0b = not selected
577     u32_t    DeselectPending     :1; // 1b= waiting for ingress fifo to become empty
578     u32_t    HwArbEnabled        :1; // 1b = HW arb in use, 0b = manual selection in use
579     u32_t    FcDisabled          :1; //FALSE=dis, TRUE=en
580 
581 } PackageState_t;
582 #elif defined (LITTLE_ENDIAN)
583 {
584 
585     u32_t    FcDisabled          :1; //FALSE=dis, TRUE=en
586     u32_t    HwArbEnabled        :1; // 1b = HW arb in use, 0b = manual selection in use
587     u32_t    DeselectPending     :1; // 1b= waiting for ingress fifo to become empty
588     u32_t    Selected            :1; // 1b= selected, 0b = not selected
589     u32_t    Ready               :1; // 1b= ready, 0b = not ready
590     u32_t    SmbusFix            :1; // 1b indicates SMBUS tx fifo is fixed in HW
591     u32_t    SmbusMode           :1; // 1b indicates SMBUS instead of RMII is being used
592     u32_t    LoopBackEnabled     :1;
593     u32_t    LoopBackPktActive   :1;
594     u32_t    ControlPacketSeen   :1;
595     u32_t    PrevResetType        :8;
596             #define NCSI_RESET_TYPE_CHANNEL0_RESET      0           // driver events D0
597             #define NCSI_RESET_TYPE_CHANNEL1_RESET      1           // driver events D0
598             #define NCSI_RESET_TYPE_COLD_START          0xAA        // POR from D3 hot
599             #define NCSI_RESET_TYPE_WARM_START          0xBB        // OOB, and possibly POR from D3 cold
600     u32_t                        :1;
601     u32_t    DellOemCmdSupport   :1;
602     u32_t                        :12;
603 } PackageState_t;
604 #endif // ENDIAN
605 
606 /*****************************************************************************
607 
608 
609 *****************************************************************************/
610 #define UMP_SELECTION_STATE_DESELECTED    FALSE
611 #define UMP_SELECTION_STATE_SELECTED      TRUE
612 
613 typedef struct NcsiPersistentData
614 {
615 
616     UmpDebugData_t          Debug;                      // 76 bytes
617     u32_t                PackageId;                  // 92
618 
619     pNcsiChannelData_t      pChannelSpecific[PATH_SUPPORTED * PORT_MAX]; //8 bytes
620 
621     PackageState_t          PackageState;               // 132 bytes
622     NcsiChannelData_t       ChannelData[PORT_MAX];                // 420 bytes total  288 bytes (2 data blocks)
623     HostSrcMacBuff_t    *   pHostSrcBuff;
624 } NcsiPersistentData_t;                                 // 284 bytes total
625 
626 
627 #if defined (BIG_ENDIAN)
628 typedef NcsiPersistentData_t* pNcsiPersistentData_t;
629 #else
630 // define pointer as 32-bit value to ease diag encoding
631 typedef u32_t            pNcsiPersistentData_t;
632 #endif
633 
634 #define   pNcsiPersistentData ((NcsiPersistentData_t *)&SHMEM(PATH_0)->mgmtfw_state)
635 
636 typedef enum NcsiLibraryEntryType
637 {
638 
639     NCSI_MAIN_LIB_MCP_SHARED_MEM_POINTER    = 0         ,
640     NCSI_MAIN_LIB_MCP_REG_POINTER                       ,
641     NCSI_MAIN_LIB_MEM_FILL                              ,
642     NCSI_MAIN_LIB_MEM_CMP                               ,
643     NCSI_MAIN_LIB_MEM_COPY_BYTES                        ,
644     NCSI_MAIN_LIB_DELAY_US                              ,
645     NCSI_MAIN_LIB_FW_HACK                               ,
646     NCSI_MAIN_LIB_GET_LINK_STATUS_WORD                  ,
647     NCSI_MAIN_LIB_GET_OS_STATUS_WORD                    ,
648     NCSI_MAIN_LIB_GET_PORT_RESET_STATUS                 ,
649     NCSI_MAIN_LIB_HANDLE_PORT_RESET                     ,
650 
651     NCSI_MAIN_LIB_GET_LOW_POWER_LINK_FLAG               ,
652     NCSI_MAIN_LIB_SET_LOW_POWER_LINK_FLAG               ,
653     NCSI_MAIN_LIB_SET_OS_STATUS_FLAG                    ,
654 
655 
656     NCSI_RX_LIB_COMPLETE_EGRESS_PACKET_TRANSFER         ,
657     NCSI_RX_LIB_ALLOCATE_EGRESS_BUFFER                  ,
658     NCSI_RX_LIB_INITIALIZE_CHANNEL_RESOURCES            ,
659     NCSI_RX_LIB_INITIALIZE                              ,
660 
661     NCSI_TX_LIB_INITIALIZE                              ,
662     NCSI_TX_LIB_GET_INGRESS_BUFFER_ADDRESS              ,
663     NCSI_TX_LIB_FREE_INGRESS_PACKET_BUFFER              ,
664     NCSI_TX_LIB_VALIDATE_INGRESS_PACKET             ,
665 
666     NCSI_CMD_LIB_INITIALIZE                             ,
667     NCSI_CMD_LIB_DISABLE_VLAN_FILTER                    ,
668     NCSI_CMD_LIB_ENABLE_VLAN_FILTER                     ,
669     NCSI_CMD_LIB_SET_VLAN_MODE                          ,
670     NCSI_CMD_LIB_DISABLE_VLAN                           ,
671     NCSI_CMD_LIB_GET_UPDATED_STATISTICS        ,
672     NCSI_CMD_LIB_ENABLE_CHANNEL                         ,
673     NCSI_CMD_LIB_ENABLE_BROADCAST_PACKET_FILTERING      ,
674     NCSI_CMD_LIB_DISABLE_BROADCAST_PACKET_FILTERING     ,
675     NCSI_CMD_LIB_DISABLE_MULTICAST_PACKET_FILTERING     ,
676     NCSI_CMD_LIB_ENABLE_MULTICAST_PACKET_FILTERING      ,
677     NCSI_CMD_LIB_SET_MAC_ADDRESS                        ,
678     NCSI_CMD_LIB_DISABLE_CHANNEL                        ,
679     NCSI_CMD_LIB_CLEAR_MAC_ADDRESS                      ,
680 
681 #if 0
682     NCSI_CMD_LIB_GET_PCI_DEVICE_ID                      ,
683     NCSI_CMD_LIB_GET_PCI_VENDOR_ID                      ,
684     NCSI_CMD_LIB_GET_PCI_SUBSYSTEM_ID                   ,
685     NCSI_CMD_LIB_GET_PCI_SUBSYSTEMVENDOR_ID             ,
686     NCSI_CMD_LIB_GET_HOST_MAC_ADDRESS                   ,
687     NCSI_CMD_LIB_GET_GET_BC_REV                         ,
688 
689 #else
690     NCSI_CMD_LIB_GET_NCSI_PARAMETER                     ,
691 #endif
692 
693     NCSI_CMD_LIB_SET_LINK                               ,
694     NCSI_CMD_LIB_GET_LINK_STATUS                        ,
695     NCSI_CMD_LIB_SET_VIRTUAL_MAC_ADDRESS                ,
696     NCSI_LIB_SIZE
697 
698 }NcsiLibraryEntry_t;
699 
700 
701 
702 
703 extern u32_t NcsiMain_Mem_Cmp                    (pu8_t, pu8_t, u32_t);
704 extern void     NcsiMain_Delay_Usec                 (u32_t);
705 extern void     NcsiMain_Mem_Fill                   (u8_t, pu8_t, u32_t);
706 extern void     NcsiMain_Mem_Copy_Bytes             (pu8_t, pu8_t, u32_t);
707 
708 #endif
709 
710 
711 
712 
713