xref: /linux/drivers/scsi/lpfc/lpfc_hw.h (revision 9399627f340794baebf7e4581470ccb92f019acc)
1dea3101eS /*******************************************************************
2dea3101eS  * This file is part of the Emulex Linux Device Driver for         *
3c44ce173SJames.Smart@Emulex.Com  * Fibre Channel Host Bus Adapters.                                *
43163f725SJames Smart  * Copyright (C) 2004-2008 Emulex.  All rights reserved.           *
5c44ce173SJames.Smart@Emulex.Com  * EMULEX and SLI are trademarks of Emulex.                        *
6dea3101eS  * www.emulex.com                                                  *
7dea3101eS  *                                                                 *
8dea3101eS  * This program is free software; you can redistribute it and/or   *
9c44ce173SJames.Smart@Emulex.Com  * modify it under the terms of version 2 of the GNU General       *
10c44ce173SJames.Smart@Emulex.Com  * Public License as published by the Free Software Foundation.    *
11c44ce173SJames.Smart@Emulex.Com  * This program is distributed in the hope that it will be useful. *
12c44ce173SJames.Smart@Emulex.Com  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
13c44ce173SJames.Smart@Emulex.Com  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
14c44ce173SJames.Smart@Emulex.Com  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
15c44ce173SJames.Smart@Emulex.Com  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
16c44ce173SJames.Smart@Emulex.Com  * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
17c44ce173SJames.Smart@Emulex.Com  * more details, a copy of which can be found in the file COPYING  *
18c44ce173SJames.Smart@Emulex.Com  * included with this package.                                     *
19dea3101eS  *******************************************************************/
20dea3101eS 
21dea3101eS #define FDMI_DID        0xfffffaU
22dea3101eS #define NameServer_DID  0xfffffcU
23dea3101eS #define SCR_DID         0xfffffdU
24dea3101eS #define Fabric_DID      0xfffffeU
25dea3101eS #define Bcast_DID       0xffffffU
26dea3101eS #define Mask_DID        0xffffffU
27dea3101eS #define CT_DID_MASK     0xffff00U
28dea3101eS #define Fabric_DID_MASK 0xfff000U
29dea3101eS #define WELL_KNOWN_DID_MASK 0xfffff0U
30dea3101eS 
31dea3101eS #define PT2PT_LocalID	1
32dea3101eS #define PT2PT_RemoteID	2
33dea3101eS 
34dea3101eS #define FF_DEF_EDTOV          2000	/* Default E_D_TOV (2000ms) */
35dea3101eS #define FF_DEF_ALTOV            15	/* Default AL_TIME (15ms) */
36dea3101eS #define FF_DEF_RATOV             2	/* Default RA_TOV (2s) */
37dea3101eS #define FF_DEF_ARBTOV         1900	/* Default ARB_TOV (1900ms) */
38dea3101eS 
39dea3101eS #define LPFC_BUF_RING0        64	/* Number of buffers to post to RING
40dea3101eS 					   0 */
41dea3101eS 
42dea3101eS #define FCELSSIZE             1024	/* maximum ELS transfer size */
43dea3101eS 
44dea3101eS #define LPFC_FCP_RING            0	/* ring 0 for FCP initiator commands */
45a4bc3379SJames Smart #define LPFC_EXTRA_RING          1	/* ring 1 for other protocols */
46dea3101eS #define LPFC_ELS_RING            2	/* ring 2 for ELS commands */
47dea3101eS #define LPFC_FCP_NEXT_RING       3
48dea3101eS 
49dea3101eS #define SLI2_IOCB_CMD_R0_ENTRIES    172	/* SLI-2 FCP command ring entries */
50dea3101eS #define SLI2_IOCB_RSP_R0_ENTRIES    134	/* SLI-2 FCP response ring entries */
51a4bc3379SJames Smart #define SLI2_IOCB_CMD_R1_ENTRIES      4	/* SLI-2 extra command ring entries */
52a4bc3379SJames Smart #define SLI2_IOCB_RSP_R1_ENTRIES      4	/* SLI-2 extra response ring entries */
53dea3101eS #define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36	/* SLI-2 extra FCP cmd ring entries */
54dea3101eS #define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52	/* SLI-2 extra FCP rsp ring entries */
55dea3101eS #define SLI2_IOCB_CMD_R2_ENTRIES     20	/* SLI-2 ELS command ring entries */
56dea3101eS #define SLI2_IOCB_RSP_R2_ENTRIES     20	/* SLI-2 ELS response ring entries */
57dea3101eS #define SLI2_IOCB_CMD_R3_ENTRIES      0
58dea3101eS #define SLI2_IOCB_RSP_R3_ENTRIES      0
59dea3101eS #define SLI2_IOCB_CMD_R3XTRA_ENTRIES 24
60dea3101eS #define SLI2_IOCB_RSP_R3XTRA_ENTRIES 32
61dea3101eS 
62ed957684SJames Smart #define SLI2_IOCB_CMD_SIZE	32
63ed957684SJames Smart #define SLI2_IOCB_RSP_SIZE	32
64ed957684SJames Smart #define SLI3_IOCB_CMD_SIZE	128
65ed957684SJames Smart #define SLI3_IOCB_RSP_SIZE	64
66ed957684SJames Smart 
6792d7f7b0SJames Smart 
68dea3101eS /* Common Transport structures and definitions */
69dea3101eS 
70dea3101eS union CtRevisionId {
71dea3101eS 	/* Structure is in Big Endian format */
72dea3101eS 	struct {
73dea3101eS 		uint32_t Revision:8;
74dea3101eS 		uint32_t InId:24;
75dea3101eS 	} bits;
76dea3101eS 	uint32_t word;
77dea3101eS };
78dea3101eS 
79dea3101eS union CtCommandResponse {
80dea3101eS 	/* Structure is in Big Endian format */
81dea3101eS 	struct {
82dea3101eS 		uint32_t CmdRsp:16;
83dea3101eS 		uint32_t Size:16;
84dea3101eS 	} bits;
85dea3101eS 	uint32_t word;
86dea3101eS };
87dea3101eS 
8892d7f7b0SJames Smart #define FC4_FEATURE_INIT 0x2
8992d7f7b0SJames Smart #define FC4_FEATURE_TARGET 0x1
9092d7f7b0SJames Smart 
91dea3101eS struct lpfc_sli_ct_request {
92dea3101eS 	/* Structure is in Big Endian format */
93dea3101eS 	union CtRevisionId RevisionId;
94dea3101eS 	uint8_t FsType;
95dea3101eS 	uint8_t FsSubType;
96dea3101eS 	uint8_t Options;
97dea3101eS 	uint8_t Rsrvd1;
98dea3101eS 	union CtCommandResponse CommandResponse;
99dea3101eS 	uint8_t Rsrvd2;
100dea3101eS 	uint8_t ReasonCode;
101dea3101eS 	uint8_t Explanation;
102dea3101eS 	uint8_t VendorUnique;
103dea3101eS 
104dea3101eS 	union {
105dea3101eS 		uint32_t PortID;
106dea3101eS 		struct gid {
107dea3101eS 			uint8_t PortType;	/* for GID_PT requests */
108dea3101eS 			uint8_t DomainScope;
109dea3101eS 			uint8_t AreaScope;
110dea3101eS 			uint8_t Fc4Type;	/* for GID_FT requests */
111dea3101eS 		} gid;
112dea3101eS 		struct rft {
113dea3101eS 			uint32_t PortId;	/* For RFT_ID requests */
114dea3101eS 
115dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
116dea3101eS 			uint32_t rsvd0:16;
117dea3101eS 			uint32_t rsvd1:7;
118dea3101eS 			uint32_t fcpReg:1;	/* Type 8 */
119dea3101eS 			uint32_t rsvd2:2;
120dea3101eS 			uint32_t ipReg:1;	/* Type 5 */
121dea3101eS 			uint32_t rsvd3:5;
122dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
123dea3101eS 			uint32_t rsvd0:16;
124dea3101eS 			uint32_t fcpReg:1;	/* Type 8 */
125dea3101eS 			uint32_t rsvd1:7;
126dea3101eS 			uint32_t rsvd3:5;
127dea3101eS 			uint32_t ipReg:1;	/* Type 5 */
128dea3101eS 			uint32_t rsvd2:2;
129dea3101eS #endif
130dea3101eS 
131dea3101eS 			uint32_t rsvd[7];
132dea3101eS 		} rft;
133dea3101eS 		struct rnn {
134dea3101eS 			uint32_t PortId;	/* For RNN_ID requests */
135dea3101eS 			uint8_t wwnn[8];
136dea3101eS 		} rnn;
137dea3101eS 		struct rsnn {	/* For RSNN_ID requests */
138dea3101eS 			uint8_t wwnn[8];
139dea3101eS 			uint8_t len;
140dea3101eS 			uint8_t symbname[255];
141dea3101eS 		} rsnn;
1427ee5d43eSJames Smart 		struct da_id { /* For DA_ID requests */
1437ee5d43eSJames Smart 			uint32_t port_id;
1447ee5d43eSJames Smart 		} da_id;
14592d7f7b0SJames Smart 		struct rspn {	/* For RSPN_ID requests */
14692d7f7b0SJames Smart 			uint32_t PortId;
14792d7f7b0SJames Smart 			uint8_t len;
14892d7f7b0SJames Smart 			uint8_t symbname[255];
14992d7f7b0SJames Smart 		} rspn;
15092d7f7b0SJames Smart 		struct gff {
15192d7f7b0SJames Smart 			uint32_t PortId;
15292d7f7b0SJames Smart 		} gff;
15392d7f7b0SJames Smart 		struct gff_acc {
15492d7f7b0SJames Smart 			uint8_t fbits[128];
15592d7f7b0SJames Smart 		} gff_acc;
15651ef4c26SJames Smart #define FCP_TYPE_FEATURE_OFFSET 7
15792d7f7b0SJames Smart 		struct rff {
15892d7f7b0SJames Smart 			uint32_t PortId;
15992d7f7b0SJames Smart 			uint8_t reserved[2];
16092d7f7b0SJames Smart 			uint8_t fbits;
16192d7f7b0SJames Smart 			uint8_t type_code;     /* type=8 for FCP */
16292d7f7b0SJames Smart 		} rff;
163dea3101eS 	} un;
164dea3101eS };
165dea3101eS 
166dea3101eS #define  SLI_CT_REVISION        1
16792d7f7b0SJames Smart #define  GID_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
16892d7f7b0SJames Smart 			   sizeof(struct gid))
16992d7f7b0SJames Smart #define  GFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17092d7f7b0SJames Smart 			   sizeof(struct gff))
17192d7f7b0SJames Smart #define  RFT_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17292d7f7b0SJames Smart 			   sizeof(struct rft))
17392d7f7b0SJames Smart #define  RFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17492d7f7b0SJames Smart 			   sizeof(struct rff))
17592d7f7b0SJames Smart #define  RNN_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17692d7f7b0SJames Smart 			   sizeof(struct rnn))
17792d7f7b0SJames Smart #define  RSNN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
17892d7f7b0SJames Smart 			   sizeof(struct rsnn))
1797ee5d43eSJames Smart #define DA_ID_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
1807ee5d43eSJames Smart 			  sizeof(struct da_id))
18192d7f7b0SJames Smart #define  RSPN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
18292d7f7b0SJames Smart 			   sizeof(struct rspn))
183dea3101eS 
184dea3101eS /*
185dea3101eS  * FsType Definitions
186dea3101eS  */
187dea3101eS 
188dea3101eS #define  SLI_CT_MANAGEMENT_SERVICE        0xFA
189dea3101eS #define  SLI_CT_TIME_SERVICE              0xFB
190dea3101eS #define  SLI_CT_DIRECTORY_SERVICE         0xFC
191dea3101eS #define  SLI_CT_FABRIC_CONTROLLER_SERVICE 0xFD
192dea3101eS 
193dea3101eS /*
194dea3101eS  * Directory Service Subtypes
195dea3101eS  */
196dea3101eS 
197dea3101eS #define  SLI_CT_DIRECTORY_NAME_SERVER     0x02
198dea3101eS 
199dea3101eS /*
200dea3101eS  * Response Codes
201dea3101eS  */
202dea3101eS 
203dea3101eS #define  SLI_CT_RESPONSE_FS_RJT           0x8001
204dea3101eS #define  SLI_CT_RESPONSE_FS_ACC           0x8002
205dea3101eS 
206dea3101eS /*
207dea3101eS  * Reason Codes
208dea3101eS  */
209dea3101eS 
210dea3101eS #define  SLI_CT_NO_ADDITIONAL_EXPL	  0x0
211dea3101eS #define  SLI_CT_INVALID_COMMAND           0x01
212dea3101eS #define  SLI_CT_INVALID_VERSION           0x02
213dea3101eS #define  SLI_CT_LOGICAL_ERROR             0x03
214dea3101eS #define  SLI_CT_INVALID_IU_SIZE           0x04
215dea3101eS #define  SLI_CT_LOGICAL_BUSY              0x05
216dea3101eS #define  SLI_CT_PROTOCOL_ERROR            0x07
217dea3101eS #define  SLI_CT_UNABLE_TO_PERFORM_REQ     0x09
218dea3101eS #define  SLI_CT_REQ_NOT_SUPPORTED         0x0b
219dea3101eS #define  SLI_CT_HBA_INFO_NOT_REGISTERED	  0x10
220dea3101eS #define  SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE  0x11
221dea3101eS #define  SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN      0x12
222dea3101eS #define  SLI_CT_HBA_ATTR_NOT_PRESENT	  0x13
223dea3101eS #define  SLI_CT_PORT_INFO_NOT_REGISTERED  0x20
224dea3101eS #define  SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE 0x21
225dea3101eS #define  SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN     0x22
226dea3101eS #define  SLI_CT_VENDOR_UNIQUE             0xff
227dea3101eS 
228dea3101eS /*
229dea3101eS  * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
230dea3101eS  */
231dea3101eS 
232dea3101eS #define  SLI_CT_NO_PORT_ID                0x01
233dea3101eS #define  SLI_CT_NO_PORT_NAME              0x02
234dea3101eS #define  SLI_CT_NO_NODE_NAME              0x03
235dea3101eS #define  SLI_CT_NO_CLASS_OF_SERVICE       0x04
236dea3101eS #define  SLI_CT_NO_IP_ADDRESS             0x05
237dea3101eS #define  SLI_CT_NO_IPA                    0x06
238dea3101eS #define  SLI_CT_NO_FC4_TYPES              0x07
239dea3101eS #define  SLI_CT_NO_SYMBOLIC_PORT_NAME     0x08
240dea3101eS #define  SLI_CT_NO_SYMBOLIC_NODE_NAME     0x09
241dea3101eS #define  SLI_CT_NO_PORT_TYPE              0x0A
242dea3101eS #define  SLI_CT_ACCESS_DENIED             0x10
243dea3101eS #define  SLI_CT_INVALID_PORT_ID           0x11
244dea3101eS #define  SLI_CT_DATABASE_EMPTY            0x12
245dea3101eS 
246dea3101eS /*
247dea3101eS  * Name Server Command Codes
248dea3101eS  */
249dea3101eS 
250dea3101eS #define  SLI_CTNS_GA_NXT      0x0100
251dea3101eS #define  SLI_CTNS_GPN_ID      0x0112
252dea3101eS #define  SLI_CTNS_GNN_ID      0x0113
253dea3101eS #define  SLI_CTNS_GCS_ID      0x0114
254dea3101eS #define  SLI_CTNS_GFT_ID      0x0117
255dea3101eS #define  SLI_CTNS_GSPN_ID     0x0118
256dea3101eS #define  SLI_CTNS_GPT_ID      0x011A
25792d7f7b0SJames Smart #define  SLI_CTNS_GFF_ID      0x011F
258dea3101eS #define  SLI_CTNS_GID_PN      0x0121
259dea3101eS #define  SLI_CTNS_GID_NN      0x0131
260dea3101eS #define  SLI_CTNS_GIP_NN      0x0135
261dea3101eS #define  SLI_CTNS_GIPA_NN     0x0136
262dea3101eS #define  SLI_CTNS_GSNN_NN     0x0139
263dea3101eS #define  SLI_CTNS_GNN_IP      0x0153
264dea3101eS #define  SLI_CTNS_GIPA_IP     0x0156
265dea3101eS #define  SLI_CTNS_GID_FT      0x0171
266dea3101eS #define  SLI_CTNS_GID_PT      0x01A1
267dea3101eS #define  SLI_CTNS_RPN_ID      0x0212
268dea3101eS #define  SLI_CTNS_RNN_ID      0x0213
269dea3101eS #define  SLI_CTNS_RCS_ID      0x0214
270dea3101eS #define  SLI_CTNS_RFT_ID      0x0217
271dea3101eS #define  SLI_CTNS_RSPN_ID     0x0218
272dea3101eS #define  SLI_CTNS_RPT_ID      0x021A
27392d7f7b0SJames Smart #define  SLI_CTNS_RFF_ID      0x021F
274dea3101eS #define  SLI_CTNS_RIP_NN      0x0235
275dea3101eS #define  SLI_CTNS_RIPA_NN     0x0236
276dea3101eS #define  SLI_CTNS_RSNN_NN     0x0239
277dea3101eS #define  SLI_CTNS_DA_ID       0x0300
278dea3101eS 
279dea3101eS /*
280dea3101eS  * Port Types
281dea3101eS  */
282dea3101eS 
283dea3101eS #define  SLI_CTPT_N_PORT      0x01
284dea3101eS #define  SLI_CTPT_NL_PORT     0x02
285dea3101eS #define  SLI_CTPT_FNL_PORT    0x03
286dea3101eS #define  SLI_CTPT_IP          0x04
287dea3101eS #define  SLI_CTPT_FCP         0x08
288dea3101eS #define  SLI_CTPT_NX_PORT     0x7F
289dea3101eS #define  SLI_CTPT_F_PORT      0x81
290dea3101eS #define  SLI_CTPT_FL_PORT     0x82
291dea3101eS #define  SLI_CTPT_E_PORT      0x84
292dea3101eS 
293dea3101eS #define SLI_CT_LAST_ENTRY     0x80000000
294dea3101eS 
295dea3101eS /* Fibre Channel Service Parameter definitions */
296dea3101eS 
297dea3101eS #define FC_PH_4_0   6		/* FC-PH version 4.0 */
298dea3101eS #define FC_PH_4_1   7		/* FC-PH version 4.1 */
299dea3101eS #define FC_PH_4_2   8		/* FC-PH version 4.2 */
300dea3101eS #define FC_PH_4_3   9		/* FC-PH version 4.3 */
301dea3101eS 
302dea3101eS #define FC_PH_LOW   8		/* Lowest supported FC-PH version */
303dea3101eS #define FC_PH_HIGH  9		/* Highest supported FC-PH version */
304dea3101eS #define FC_PH3   0x20		/* FC-PH-3 version */
305dea3101eS 
306dea3101eS #define FF_FRAME_SIZE     2048
307dea3101eS 
308dea3101eS struct lpfc_name {
309f631b4beSAndrew Vasquez 	union {
310f631b4beSAndrew Vasquez 		struct {
311dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
312dea3101eS 			uint8_t nameType:4;	/* FC Word 0, bit 28:31 */
3131de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit
3141de933f3SJames.Smart@Emulex.Com 						   8:11 of IEEE ext */
315dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3161de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit
3171de933f3SJames.Smart@Emulex.Com 						   8:11 of IEEE ext */
318dea3101eS 			uint8_t nameType:4;	/* FC Word 0, bit 28:31 */
319dea3101eS #endif
320dea3101eS 
321dea3101eS #define NAME_IEEE           0x1	/* IEEE name - nameType */
322dea3101eS #define NAME_IEEE_EXT       0x2	/* IEEE extended name */
323dea3101eS #define NAME_FC_TYPE        0x3	/* FC native name type */
324dea3101eS #define NAME_IP_TYPE        0x4	/* IP address */
325dea3101eS #define NAME_CCITT_TYPE     0xC
326dea3101eS #define NAME_CCITT_GR_TYPE  0xE
3271de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextLsb;	/* FC Word 0, bit 16:23, IEEE
3281de933f3SJames.Smart@Emulex.Com 						   extended Lsb */
329dea3101eS 			uint8_t IEEE[6];	/* FC IEEE address */
33068ce1eb5SAndrew Morton 		} s;
331f631b4beSAndrew Vasquez 		uint8_t wwn[8];
33268ce1eb5SAndrew Morton 	} u;
333f631b4beSAndrew Vasquez };
334dea3101eS 
335dea3101eS struct csp {
336dea3101eS 	uint8_t fcphHigh;	/* FC Word 0, byte 0 */
337dea3101eS 	uint8_t fcphLow;
338dea3101eS 	uint8_t bbCreditMsb;
339dea3101eS 	uint8_t bbCreditlsb;	/* FC Word 0, byte 3 */
340dea3101eS 
341dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
34292d7f7b0SJames Smart 	uint16_t request_multiple_Nport:1;	/* FC Word 1, bit 31 */
34392d7f7b0SJames Smart 	uint16_t randomOffset:1;	/* FC Word 1, bit 30 */
34492d7f7b0SJames Smart 	uint16_t response_multiple_NPort:1;	/* FC Word 1, bit 29 */
345dea3101eS 	uint16_t fPort:1;	/* FC Word 1, bit 28 */
346dea3101eS 	uint16_t altBbCredit:1;	/* FC Word 1, bit 27 */
347dea3101eS 	uint16_t edtovResolution:1;	/* FC Word 1, bit 26 */
348dea3101eS 	uint16_t multicast:1;	/* FC Word 1, bit 25 */
349dea3101eS 	uint16_t broadcast:1;	/* FC Word 1, bit 24 */
350dea3101eS 
351dea3101eS 	uint16_t huntgroup:1;	/* FC Word 1, bit 23 */
352dea3101eS 	uint16_t simplex:1;	/* FC Word 1, bit 22 */
353dea3101eS 	uint16_t word1Reserved1:3;	/* FC Word 1, bit 21:19 */
354dea3101eS 	uint16_t dhd:1;		/* FC Word 1, bit 18 */
355dea3101eS 	uint16_t contIncSeqCnt:1;	/* FC Word 1, bit 17 */
356dea3101eS 	uint16_t payloadlength:1;	/* FC Word 1, bit 16 */
357dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
358dea3101eS 	uint16_t broadcast:1;	/* FC Word 1, bit 24 */
359dea3101eS 	uint16_t multicast:1;	/* FC Word 1, bit 25 */
360dea3101eS 	uint16_t edtovResolution:1;	/* FC Word 1, bit 26 */
361dea3101eS 	uint16_t altBbCredit:1;	/* FC Word 1, bit 27 */
362dea3101eS 	uint16_t fPort:1;	/* FC Word 1, bit 28 */
36392d7f7b0SJames Smart 	uint16_t response_multiple_NPort:1;	/* FC Word 1, bit 29 */
364dea3101eS 	uint16_t randomOffset:1;	/* FC Word 1, bit 30 */
36592d7f7b0SJames Smart 	uint16_t request_multiple_Nport:1;	/* FC Word 1, bit 31 */
366dea3101eS 
367dea3101eS 	uint16_t payloadlength:1;	/* FC Word 1, bit 16 */
368dea3101eS 	uint16_t contIncSeqCnt:1;	/* FC Word 1, bit 17 */
369dea3101eS 	uint16_t dhd:1;		/* FC Word 1, bit 18 */
370dea3101eS 	uint16_t word1Reserved1:3;	/* FC Word 1, bit 21:19 */
371dea3101eS 	uint16_t simplex:1;	/* FC Word 1, bit 22 */
372dea3101eS 	uint16_t huntgroup:1;	/* FC Word 1, bit 23 */
373dea3101eS #endif
374dea3101eS 
375dea3101eS 	uint8_t bbRcvSizeMsb;	/* Upper nibble is reserved */
376dea3101eS 	uint8_t bbRcvSizeLsb;	/* FC Word 1, byte 3 */
377dea3101eS 	union {
378dea3101eS 		struct {
379dea3101eS 			uint8_t word2Reserved1;	/* FC Word 2 byte 0 */
380dea3101eS 
381dea3101eS 			uint8_t totalConcurrSeq;	/* FC Word 2 byte 1 */
382dea3101eS 			uint8_t roByCategoryMsb;	/* FC Word 2 byte 2 */
383dea3101eS 
384dea3101eS 			uint8_t roByCategoryLsb;	/* FC Word 2 byte 3 */
385dea3101eS 		} nPort;
386dea3101eS 		uint32_t r_a_tov;	/* R_A_TOV must be in B.E. format */
387dea3101eS 	} w2;
388dea3101eS 
389dea3101eS 	uint32_t e_d_tov;	/* E_D_TOV must be in B.E. format */
390dea3101eS };
391dea3101eS 
392dea3101eS struct class_parms {
393dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
394dea3101eS 	uint8_t classValid:1;	/* FC Word 0, bit 31 */
395dea3101eS 	uint8_t intermix:1;	/* FC Word 0, bit 30 */
396dea3101eS 	uint8_t stackedXparent:1;	/* FC Word 0, bit 29 */
397dea3101eS 	uint8_t stackedLockDown:1;	/* FC Word 0, bit 28 */
398dea3101eS 	uint8_t seqDelivery:1;	/* FC Word 0, bit 27 */
399dea3101eS 	uint8_t word0Reserved1:3;	/* FC Word 0, bit 24:26 */
400dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
401dea3101eS 	uint8_t word0Reserved1:3;	/* FC Word 0, bit 24:26 */
402dea3101eS 	uint8_t seqDelivery:1;	/* FC Word 0, bit 27 */
403dea3101eS 	uint8_t stackedLockDown:1;	/* FC Word 0, bit 28 */
404dea3101eS 	uint8_t stackedXparent:1;	/* FC Word 0, bit 29 */
405dea3101eS 	uint8_t intermix:1;	/* FC Word 0, bit 30 */
406dea3101eS 	uint8_t classValid:1;	/* FC Word 0, bit 31 */
407dea3101eS 
408dea3101eS #endif
409dea3101eS 
410dea3101eS 	uint8_t word0Reserved2;	/* FC Word 0, bit 16:23 */
411dea3101eS 
412dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
413dea3101eS 	uint8_t iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
414dea3101eS 	uint8_t iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
415dea3101eS 	uint8_t iCtlAck0capable:1;	/* FC Word 0, bit 11 */
416dea3101eS 	uint8_t iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
417dea3101eS 	uint8_t word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
418dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
419dea3101eS 	uint8_t word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
420dea3101eS 	uint8_t iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
421dea3101eS 	uint8_t iCtlAck0capable:1;	/* FC Word 0, bit 11 */
422dea3101eS 	uint8_t iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
423dea3101eS 	uint8_t iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
424dea3101eS #endif
425dea3101eS 
426dea3101eS 	uint8_t word0Reserved4;	/* FC Word 0, bit  0: 7 */
427dea3101eS 
428dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
429dea3101eS 	uint8_t rCtlAck0capable:1;	/* FC Word 1, bit 31 */
430dea3101eS 	uint8_t rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
431dea3101eS 	uint8_t rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
432dea3101eS 	uint8_t rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
433dea3101eS 	uint8_t word1Reserved1:1;	/* FC Word 1, bit 26 */
434dea3101eS 	uint8_t rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
435dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
436dea3101eS 	uint8_t rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
437dea3101eS 	uint8_t word1Reserved1:1;	/* FC Word 1, bit 26 */
438dea3101eS 	uint8_t rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
439dea3101eS 	uint8_t rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
440dea3101eS 	uint8_t rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
441dea3101eS 	uint8_t rCtlAck0capable:1;	/* FC Word 1, bit 31 */
442dea3101eS #endif
443dea3101eS 
444dea3101eS 	uint8_t word1Reserved2;	/* FC Word 1, bit 16:23 */
445dea3101eS 	uint8_t rcvDataSizeMsb;	/* FC Word 1, bit  8:15 */
446dea3101eS 	uint8_t rcvDataSizeLsb;	/* FC Word 1, bit  0: 7 */
447dea3101eS 
448dea3101eS 	uint8_t concurrentSeqMsb;	/* FC Word 2, bit 24:31 */
449dea3101eS 	uint8_t concurrentSeqLsb;	/* FC Word 2, bit 16:23 */
450dea3101eS 	uint8_t EeCreditSeqMsb;	/* FC Word 2, bit  8:15 */
451dea3101eS 	uint8_t EeCreditSeqLsb;	/* FC Word 2, bit  0: 7 */
452dea3101eS 
453dea3101eS 	uint8_t openSeqPerXchgMsb;	/* FC Word 3, bit 24:31 */
454dea3101eS 	uint8_t openSeqPerXchgLsb;	/* FC Word 3, bit 16:23 */
455dea3101eS 	uint8_t word3Reserved1;	/* Fc Word 3, bit  8:15 */
456dea3101eS 	uint8_t word3Reserved2;	/* Fc Word 3, bit  0: 7 */
457dea3101eS };
458dea3101eS 
459dea3101eS struct serv_parm {	/* Structure is in Big Endian format */
460dea3101eS 	struct csp cmn;
461dea3101eS 	struct lpfc_name portName;
462dea3101eS 	struct lpfc_name nodeName;
463dea3101eS 	struct class_parms cls1;
464dea3101eS 	struct class_parms cls2;
465dea3101eS 	struct class_parms cls3;
466dea3101eS 	struct class_parms cls4;
467dea3101eS 	uint8_t vendorVersion[16];
468dea3101eS };
469dea3101eS 
470dea3101eS /*
471dea3101eS  *  Extended Link Service LS_COMMAND codes (Payload Word 0)
472dea3101eS  */
473dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
474dea3101eS #define ELS_CMD_MASK      0xffff0000
475dea3101eS #define ELS_RSP_MASK      0xff000000
476dea3101eS #define ELS_CMD_LS_RJT    0x01000000
477dea3101eS #define ELS_CMD_ACC       0x02000000
478dea3101eS #define ELS_CMD_PLOGI     0x03000000
479dea3101eS #define ELS_CMD_FLOGI     0x04000000
480dea3101eS #define ELS_CMD_LOGO      0x05000000
481dea3101eS #define ELS_CMD_ABTX      0x06000000
482dea3101eS #define ELS_CMD_RCS       0x07000000
483dea3101eS #define ELS_CMD_RES       0x08000000
484dea3101eS #define ELS_CMD_RSS       0x09000000
485dea3101eS #define ELS_CMD_RSI       0x0A000000
486dea3101eS #define ELS_CMD_ESTS      0x0B000000
487dea3101eS #define ELS_CMD_ESTC      0x0C000000
488dea3101eS #define ELS_CMD_ADVC      0x0D000000
489dea3101eS #define ELS_CMD_RTV       0x0E000000
490dea3101eS #define ELS_CMD_RLS       0x0F000000
491dea3101eS #define ELS_CMD_ECHO      0x10000000
492dea3101eS #define ELS_CMD_TEST      0x11000000
493dea3101eS #define ELS_CMD_RRQ       0x12000000
494dea3101eS #define ELS_CMD_PRLI      0x20100014
495dea3101eS #define ELS_CMD_PRLO      0x21100014
49682d9a2a2SJames Smart #define ELS_CMD_PRLO_ACC  0x02100014
497dea3101eS #define ELS_CMD_PDISC     0x50000000
498dea3101eS #define ELS_CMD_FDISC     0x51000000
499dea3101eS #define ELS_CMD_ADISC     0x52000000
500dea3101eS #define ELS_CMD_FARP      0x54000000
501dea3101eS #define ELS_CMD_FARPR     0x55000000
5027bb3b137SJamie Wellnitz #define ELS_CMD_RPS       0x56000000
5037bb3b137SJamie Wellnitz #define ELS_CMD_RPL       0x57000000
504dea3101eS #define ELS_CMD_FAN       0x60000000
505dea3101eS #define ELS_CMD_RSCN      0x61040000
506dea3101eS #define ELS_CMD_SCR       0x62000000
507dea3101eS #define ELS_CMD_RNID      0x78000000
5087bb3b137SJamie Wellnitz #define ELS_CMD_LIRR      0x7A000000
509dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
510dea3101eS #define ELS_CMD_MASK      0xffff
511dea3101eS #define ELS_RSP_MASK      0xff
512dea3101eS #define ELS_CMD_LS_RJT    0x01
513dea3101eS #define ELS_CMD_ACC       0x02
514dea3101eS #define ELS_CMD_PLOGI     0x03
515dea3101eS #define ELS_CMD_FLOGI     0x04
516dea3101eS #define ELS_CMD_LOGO      0x05
517dea3101eS #define ELS_CMD_ABTX      0x06
518dea3101eS #define ELS_CMD_RCS       0x07
519dea3101eS #define ELS_CMD_RES       0x08
520dea3101eS #define ELS_CMD_RSS       0x09
521dea3101eS #define ELS_CMD_RSI       0x0A
522dea3101eS #define ELS_CMD_ESTS      0x0B
523dea3101eS #define ELS_CMD_ESTC      0x0C
524dea3101eS #define ELS_CMD_ADVC      0x0D
525dea3101eS #define ELS_CMD_RTV       0x0E
526dea3101eS #define ELS_CMD_RLS       0x0F
527dea3101eS #define ELS_CMD_ECHO      0x10
528dea3101eS #define ELS_CMD_TEST      0x11
529dea3101eS #define ELS_CMD_RRQ       0x12
530dea3101eS #define ELS_CMD_PRLI      0x14001020
531dea3101eS #define ELS_CMD_PRLO      0x14001021
53282d9a2a2SJames Smart #define ELS_CMD_PRLO_ACC  0x14001002
533dea3101eS #define ELS_CMD_PDISC     0x50
534dea3101eS #define ELS_CMD_FDISC     0x51
535dea3101eS #define ELS_CMD_ADISC     0x52
536dea3101eS #define ELS_CMD_FARP      0x54
537dea3101eS #define ELS_CMD_FARPR     0x55
5387bb3b137SJamie Wellnitz #define ELS_CMD_RPS       0x56
5397bb3b137SJamie Wellnitz #define ELS_CMD_RPL       0x57
540dea3101eS #define ELS_CMD_FAN       0x60
541dea3101eS #define ELS_CMD_RSCN      0x0461
542dea3101eS #define ELS_CMD_SCR       0x62
543dea3101eS #define ELS_CMD_RNID      0x78
5447bb3b137SJamie Wellnitz #define ELS_CMD_LIRR      0x7A
545dea3101eS #endif
546dea3101eS 
547dea3101eS /*
548dea3101eS  *  LS_RJT Payload Definition
549dea3101eS  */
550dea3101eS 
551dea3101eS struct ls_rjt {	/* Structure is in Big Endian format */
552dea3101eS 	union {
553dea3101eS 		uint32_t lsRjtError;
554dea3101eS 		struct {
555dea3101eS 			uint8_t lsRjtRsvd0;	/* FC Word 0, bit 24:31 */
556dea3101eS 
557dea3101eS 			uint8_t lsRjtRsnCode;	/* FC Word 0, bit 16:23 */
558dea3101eS 			/* LS_RJT reason codes */
559dea3101eS #define LSRJT_INVALID_CMD     0x01
560dea3101eS #define LSRJT_LOGICAL_ERR     0x03
561dea3101eS #define LSRJT_LOGICAL_BSY     0x05
562dea3101eS #define LSRJT_PROTOCOL_ERR    0x07
563dea3101eS #define LSRJT_UNABLE_TPC      0x09	/* Unable to perform command */
564dea3101eS #define LSRJT_CMD_UNSUPPORTED 0x0B
565dea3101eS #define LSRJT_VENDOR_UNIQUE   0xFF	/* See Byte 3 */
566dea3101eS 
567dea3101eS 			uint8_t lsRjtRsnCodeExp; /* FC Word 0, bit 8:15 */
568dea3101eS 			/* LS_RJT reason explanation */
569dea3101eS #define LSEXP_NOTHING_MORE      0x00
570dea3101eS #define LSEXP_SPARM_OPTIONS     0x01
571dea3101eS #define LSEXP_SPARM_ICTL        0x03
572dea3101eS #define LSEXP_SPARM_RCTL        0x05
573dea3101eS #define LSEXP_SPARM_RCV_SIZE    0x07
574dea3101eS #define LSEXP_SPARM_CONCUR_SEQ  0x09
575dea3101eS #define LSEXP_SPARM_CREDIT      0x0B
576dea3101eS #define LSEXP_INVALID_PNAME     0x0D
577dea3101eS #define LSEXP_INVALID_NNAME     0x0E
578dea3101eS #define LSEXP_INVALID_CSP       0x0F
579dea3101eS #define LSEXP_INVALID_ASSOC_HDR 0x11
580dea3101eS #define LSEXP_ASSOC_HDR_REQ     0x13
581dea3101eS #define LSEXP_INVALID_O_SID     0x15
582dea3101eS #define LSEXP_INVALID_OX_RX     0x17
583dea3101eS #define LSEXP_CMD_IN_PROGRESS   0x19
5847f5f3d0dSJames Smart #define LSEXP_PORT_LOGIN_REQ    0x1E
585dea3101eS #define LSEXP_INVALID_NPORT_ID  0x1F
586dea3101eS #define LSEXP_INVALID_SEQ_ID    0x21
587dea3101eS #define LSEXP_INVALID_XCHG      0x23
588dea3101eS #define LSEXP_INACTIVE_XCHG     0x25
589dea3101eS #define LSEXP_RQ_REQUIRED       0x27
590dea3101eS #define LSEXP_OUT_OF_RESOURCE   0x29
591dea3101eS #define LSEXP_CANT_GIVE_DATA    0x2A
592dea3101eS #define LSEXP_REQ_UNSUPPORTED   0x2C
593dea3101eS 			uint8_t vendorUnique;	/* FC Word 0, bit  0: 7 */
594dea3101eS 		} b;
595dea3101eS 	} un;
596dea3101eS };
597dea3101eS 
598dea3101eS /*
599dea3101eS  *  N_Port Login (FLOGO/PLOGO Request) Payload Definition
600dea3101eS  */
601dea3101eS 
602dea3101eS typedef struct _LOGO {		/* Structure is in Big Endian format */
603dea3101eS 	union {
604dea3101eS 		uint32_t nPortId32;	/* Access nPortId as a word */
605dea3101eS 		struct {
606dea3101eS 			uint8_t word1Reserved1;	/* FC Word 1, bit 31:24 */
607dea3101eS 			uint8_t nPortIdByte0;	/* N_port  ID bit 16:23 */
608dea3101eS 			uint8_t nPortIdByte1;	/* N_port  ID bit  8:15 */
609dea3101eS 			uint8_t nPortIdByte2;	/* N_port  ID bit  0: 7 */
610dea3101eS 		} b;
611dea3101eS 	} un;
612dea3101eS 	struct lpfc_name portName;	/* N_port name field */
613dea3101eS } LOGO;
614dea3101eS 
615dea3101eS /*
616dea3101eS  *  FCP Login (PRLI Request / ACC) Payload Definition
617dea3101eS  */
618dea3101eS 
619dea3101eS #define PRLX_PAGE_LEN   0x10
620dea3101eS #define TPRLO_PAGE_LEN  0x14
621dea3101eS 
622dea3101eS typedef struct _PRLI {		/* Structure is in Big Endian format */
623dea3101eS 	uint8_t prliType;	/* FC Parm Word 0, bit 24:31 */
624dea3101eS 
625dea3101eS #define PRLI_FCP_TYPE 0x08
626dea3101eS 	uint8_t word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
627dea3101eS 
628dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
629dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
630dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
631dea3101eS 	uint8_t estabImagePair:1;	/* FC Parm Word 0, bit 13 */
632dea3101eS 
633dea3101eS 	/*    ACC = imagePairEstablished */
634dea3101eS 	uint8_t word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
635dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
636dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
637dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
638dea3101eS 	uint8_t word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
639dea3101eS 	uint8_t estabImagePair:1;	/* FC Parm Word 0, bit 13 */
640dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
641dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
642dea3101eS 	/*    ACC = imagePairEstablished */
643dea3101eS #endif
644dea3101eS 
645dea3101eS #define PRLI_REQ_EXECUTED     0x1	/* acceptRspCode */
646dea3101eS #define PRLI_NO_RESOURCES     0x2
647dea3101eS #define PRLI_INIT_INCOMPLETE  0x3
648dea3101eS #define PRLI_NO_SUCH_PA       0x4
649dea3101eS #define PRLI_PREDEF_CONFIG    0x5
650dea3101eS #define PRLI_PARTIAL_SUCCESS  0x6
651dea3101eS #define PRLI_INVALID_PAGE_CNT 0x7
652dea3101eS 	uint8_t word0Reserved3;	/* FC Parm Word 0, bit 0:7 */
653dea3101eS 
654dea3101eS 	uint32_t origProcAssoc;	/* FC Parm Word 1, bit 0:31 */
655dea3101eS 
656dea3101eS 	uint32_t respProcAssoc;	/* FC Parm Word 2, bit 0:31 */
657dea3101eS 
658dea3101eS 	uint8_t word3Reserved1;	/* FC Parm Word 3, bit 24:31 */
659dea3101eS 	uint8_t word3Reserved2;	/* FC Parm Word 3, bit 16:23 */
660dea3101eS 
661dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
662dea3101eS 	uint16_t Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
663dea3101eS 	uint16_t Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
664dea3101eS 	uint16_t Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
665dea3101eS 	uint16_t Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
666dea3101eS 	uint16_t Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
667dea3101eS 	uint16_t Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
668dea3101eS 	uint16_t TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
669dea3101eS 	uint16_t Retry:1;	/* FC Parm Word 3, bit  8 */
670dea3101eS 	uint16_t ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
671dea3101eS 	uint16_t dataOverLay:1;	/* FC Parm Word 3, bit  6 */
672dea3101eS 	uint16_t initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
673dea3101eS 	uint16_t targetFunc:1;	/* FC Parm Word 3, bit  4 */
674dea3101eS 	uint16_t cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
675dea3101eS 	uint16_t dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
676dea3101eS 	uint16_t readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
677dea3101eS 	uint16_t writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
678dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
679dea3101eS 	uint16_t Retry:1;	/* FC Parm Word 3, bit  8 */
680dea3101eS 	uint16_t TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
681dea3101eS 	uint16_t Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
682dea3101eS 	uint16_t Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
683dea3101eS 	uint16_t Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
684dea3101eS 	uint16_t Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
685dea3101eS 	uint16_t Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
686dea3101eS 	uint16_t Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
687dea3101eS 	uint16_t writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
688dea3101eS 	uint16_t readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
689dea3101eS 	uint16_t dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
690dea3101eS 	uint16_t cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
691dea3101eS 	uint16_t targetFunc:1;	/* FC Parm Word 3, bit  4 */
692dea3101eS 	uint16_t initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
693dea3101eS 	uint16_t dataOverLay:1;	/* FC Parm Word 3, bit  6 */
694dea3101eS 	uint16_t ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
695dea3101eS #endif
696dea3101eS } PRLI;
697dea3101eS 
698dea3101eS /*
699dea3101eS  *  FCP Logout (PRLO Request / ACC) Payload Definition
700dea3101eS  */
701dea3101eS 
702dea3101eS typedef struct _PRLO {		/* Structure is in Big Endian format */
703dea3101eS 	uint8_t prloType;	/* FC Parm Word 0, bit 24:31 */
704dea3101eS 
705dea3101eS #define PRLO_FCP_TYPE  0x08
706dea3101eS 	uint8_t word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
707dea3101eS 
708dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
709dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
710dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
711dea3101eS 	uint8_t word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
712dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
713dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
714dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
715dea3101eS 	uint8_t word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
716dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
717dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
718dea3101eS #endif
719dea3101eS 
720dea3101eS #define PRLO_REQ_EXECUTED     0x1	/* acceptRspCode */
721dea3101eS #define PRLO_NO_SUCH_IMAGE    0x4
722dea3101eS #define PRLO_INVALID_PAGE_CNT 0x7
723dea3101eS 
724dea3101eS 	uint8_t word0Reserved3;	/* FC Parm Word 0, bit 0:7 */
725dea3101eS 
726dea3101eS 	uint32_t origProcAssoc;	/* FC Parm Word 1, bit 0:31 */
727dea3101eS 
728dea3101eS 	uint32_t respProcAssoc;	/* FC Parm Word 2, bit 0:31 */
729dea3101eS 
730dea3101eS 	uint32_t word3Reserved1;	/* FC Parm Word 3, bit 0:31 */
731dea3101eS } PRLO;
732dea3101eS 
733dea3101eS typedef struct _ADISC {		/* Structure is in Big Endian format */
734dea3101eS 	uint32_t hardAL_PA;
735dea3101eS 	struct lpfc_name portName;
736dea3101eS 	struct lpfc_name nodeName;
737dea3101eS 	uint32_t DID;
738dea3101eS } ADISC;
739dea3101eS 
740dea3101eS typedef struct _FARP {		/* Structure is in Big Endian format */
741dea3101eS 	uint32_t Mflags:8;
742dea3101eS 	uint32_t Odid:24;
743dea3101eS #define FARP_NO_ACTION          0	/* FARP information enclosed, no
744dea3101eS 					   action */
745dea3101eS #define FARP_MATCH_PORT         0x1	/* Match on Responder Port Name */
746dea3101eS #define FARP_MATCH_NODE         0x2	/* Match on Responder Node Name */
747dea3101eS #define FARP_MATCH_IP           0x4	/* Match on IP address, not supported */
748dea3101eS #define FARP_MATCH_IPV4         0x5	/* Match on IPV4 address, not
749dea3101eS 					   supported */
750dea3101eS #define FARP_MATCH_IPV6         0x6	/* Match on IPV6 address, not
751dea3101eS 					   supported */
752dea3101eS 	uint32_t Rflags:8;
753dea3101eS 	uint32_t Rdid:24;
754dea3101eS #define FARP_REQUEST_PLOGI      0x1	/* Request for PLOGI */
755dea3101eS #define FARP_REQUEST_FARPR      0x2	/* Request for FARP Response */
756dea3101eS 	struct lpfc_name OportName;
757dea3101eS 	struct lpfc_name OnodeName;
758dea3101eS 	struct lpfc_name RportName;
759dea3101eS 	struct lpfc_name RnodeName;
760dea3101eS 	uint8_t Oipaddr[16];
761dea3101eS 	uint8_t Ripaddr[16];
762dea3101eS } FARP;
763dea3101eS 
764dea3101eS typedef struct _FAN {		/* Structure is in Big Endian format */
765dea3101eS 	uint32_t Fdid;
766dea3101eS 	struct lpfc_name FportName;
767dea3101eS 	struct lpfc_name FnodeName;
768dea3101eS } FAN;
769dea3101eS 
770dea3101eS typedef struct _SCR {		/* Structure is in Big Endian format */
771dea3101eS 	uint8_t resvd1;
772dea3101eS 	uint8_t resvd2;
773dea3101eS 	uint8_t resvd3;
774dea3101eS 	uint8_t Function;
775dea3101eS #define  SCR_FUNC_FABRIC     0x01
776dea3101eS #define  SCR_FUNC_NPORT      0x02
777dea3101eS #define  SCR_FUNC_FULL       0x03
778dea3101eS #define  SCR_CLEAR           0xff
779dea3101eS } SCR;
780dea3101eS 
781dea3101eS typedef struct _RNID_TOP_DISC {
782dea3101eS 	struct lpfc_name portName;
783dea3101eS 	uint8_t resvd[8];
784dea3101eS 	uint32_t unitType;
785dea3101eS #define RNID_HBA            0x7
786dea3101eS #define RNID_HOST           0xa
787dea3101eS #define RNID_DRIVER         0xd
788dea3101eS 	uint32_t physPort;
789dea3101eS 	uint32_t attachedNodes;
790dea3101eS 	uint16_t ipVersion;
791dea3101eS #define RNID_IPV4           0x1
792dea3101eS #define RNID_IPV6           0x2
793dea3101eS 	uint16_t UDPport;
794dea3101eS 	uint8_t ipAddr[16];
795dea3101eS 	uint16_t resvd1;
796dea3101eS 	uint16_t flags;
797dea3101eS #define RNID_TD_SUPPORT     0x1
798dea3101eS #define RNID_LP_VALID       0x2
799dea3101eS } RNID_TOP_DISC;
800dea3101eS 
801dea3101eS typedef struct _RNID {		/* Structure is in Big Endian format */
802dea3101eS 	uint8_t Format;
803dea3101eS #define RNID_TOPOLOGY_DISC  0xdf
804dea3101eS 	uint8_t CommonLen;
805dea3101eS 	uint8_t resvd1;
806dea3101eS 	uint8_t SpecificLen;
807dea3101eS 	struct lpfc_name portName;
808dea3101eS 	struct lpfc_name nodeName;
809dea3101eS 	union {
810dea3101eS 		RNID_TOP_DISC topologyDisc;	/* topology disc (0xdf) */
811dea3101eS 	} un;
812dea3101eS } RNID;
813dea3101eS 
8147bb3b137SJamie Wellnitz typedef struct  _RPS {		/* Structure is in Big Endian format */
8157bb3b137SJamie Wellnitz 	union {
8167bb3b137SJamie Wellnitz 		uint32_t portNum;
8177bb3b137SJamie Wellnitz 		struct lpfc_name portName;
8187bb3b137SJamie Wellnitz 	} un;
8197bb3b137SJamie Wellnitz } RPS;
8207bb3b137SJamie Wellnitz 
8217bb3b137SJamie Wellnitz typedef struct  _RPS_RSP {	/* Structure is in Big Endian format */
8227bb3b137SJamie Wellnitz 	uint16_t rsvd1;
8237bb3b137SJamie Wellnitz 	uint16_t portStatus;
8247bb3b137SJamie Wellnitz 	uint32_t linkFailureCnt;
8257bb3b137SJamie Wellnitz 	uint32_t lossSyncCnt;
8267bb3b137SJamie Wellnitz 	uint32_t lossSignalCnt;
8277bb3b137SJamie Wellnitz 	uint32_t primSeqErrCnt;
8287bb3b137SJamie Wellnitz 	uint32_t invalidXmitWord;
8297bb3b137SJamie Wellnitz 	uint32_t crcCnt;
8307bb3b137SJamie Wellnitz } RPS_RSP;
8317bb3b137SJamie Wellnitz 
8327bb3b137SJamie Wellnitz typedef struct  _RPL {		/* Structure is in Big Endian format */
8337bb3b137SJamie Wellnitz 	uint32_t maxsize;
8347bb3b137SJamie Wellnitz 	uint32_t index;
8357bb3b137SJamie Wellnitz } RPL;
8367bb3b137SJamie Wellnitz 
8377bb3b137SJamie Wellnitz typedef struct  _PORT_NUM_BLK {
8387bb3b137SJamie Wellnitz 	uint32_t portNum;
8397bb3b137SJamie Wellnitz 	uint32_t portID;
8407bb3b137SJamie Wellnitz 	struct lpfc_name portName;
8417bb3b137SJamie Wellnitz } PORT_NUM_BLK;
8427bb3b137SJamie Wellnitz 
8437bb3b137SJamie Wellnitz typedef struct  _RPL_RSP {	/* Structure is in Big Endian format */
8447bb3b137SJamie Wellnitz 	uint32_t listLen;
8457bb3b137SJamie Wellnitz 	uint32_t index;
8467bb3b137SJamie Wellnitz 	PORT_NUM_BLK port_num_blk;
8477bb3b137SJamie Wellnitz } RPL_RSP;
848dea3101eS 
849dea3101eS /* This is used for RSCN command */
850dea3101eS typedef struct _D_ID {		/* Structure is in Big Endian format */
851dea3101eS 	union {
852dea3101eS 		uint32_t word;
853dea3101eS 		struct {
854dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
855dea3101eS 			uint8_t resv;
856dea3101eS 			uint8_t domain;
857dea3101eS 			uint8_t area;
858dea3101eS 			uint8_t id;
859dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
860dea3101eS 			uint8_t id;
861dea3101eS 			uint8_t area;
862dea3101eS 			uint8_t domain;
863dea3101eS 			uint8_t resv;
864dea3101eS #endif
865dea3101eS 		} b;
866dea3101eS 	} un;
867dea3101eS } D_ID;
868dea3101eS 
869dea3101eS /*
870dea3101eS  *  Structure to define all ELS Payload types
871dea3101eS  */
872dea3101eS 
873dea3101eS typedef struct _ELS_PKT {	/* Structure is in Big Endian format */
874dea3101eS 	uint8_t elsCode;	/* FC Word 0, bit 24:31 */
875dea3101eS 	uint8_t elsByte1;
876dea3101eS 	uint8_t elsByte2;
877dea3101eS 	uint8_t elsByte3;
878dea3101eS 	union {
879dea3101eS 		struct ls_rjt lsRjt;	/* Payload for LS_RJT ELS response */
880dea3101eS 		struct serv_parm logi;	/* Payload for PLOGI/FLOGI/PDISC/ACC */
881dea3101eS 		LOGO logo;	/* Payload for PLOGO/FLOGO/ACC */
882dea3101eS 		PRLI prli;	/* Payload for PRLI/ACC */
883dea3101eS 		PRLO prlo;	/* Payload for PRLO/ACC */
884dea3101eS 		ADISC adisc;	/* Payload for ADISC/ACC */
885dea3101eS 		FARP farp;	/* Payload for FARP/ACC */
886dea3101eS 		FAN fan;	/* Payload for FAN */
887dea3101eS 		SCR scr;	/* Payload for SCR/ACC */
888dea3101eS 		RNID rnid;	/* Payload for RNID */
889dea3101eS 		uint8_t pad[128 - 4];	/* Pad out to payload of 128 bytes */
890dea3101eS 	} un;
891dea3101eS } ELS_PKT;
892dea3101eS 
893dea3101eS /*
894dea3101eS  * FDMI
895dea3101eS  * HBA MAnagement Operations Command Codes
896dea3101eS  */
897dea3101eS #define  SLI_MGMT_GRHL     0x100	/* Get registered HBA list */
898dea3101eS #define  SLI_MGMT_GHAT     0x101	/* Get HBA attributes */
899dea3101eS #define  SLI_MGMT_GRPL     0x102	/* Get registered Port list */
900dea3101eS #define  SLI_MGMT_GPAT     0x110	/* Get Port attributes */
901dea3101eS #define  SLI_MGMT_RHBA     0x200	/* Register HBA */
902dea3101eS #define  SLI_MGMT_RHAT     0x201	/* Register HBA atttributes */
903dea3101eS #define  SLI_MGMT_RPRT     0x210	/* Register Port */
904dea3101eS #define  SLI_MGMT_RPA      0x211	/* Register Port attributes */
905dea3101eS #define  SLI_MGMT_DHBA     0x300	/* De-register HBA */
906dea3101eS #define  SLI_MGMT_DPRT     0x310	/* De-register Port */
907dea3101eS 
908dea3101eS /*
909dea3101eS  * Management Service Subtypes
910dea3101eS  */
911dea3101eS #define  SLI_CT_FDMI_Subtypes     0x10
912dea3101eS 
913dea3101eS /*
914dea3101eS  * HBA Management Service Reject Code
915dea3101eS  */
916dea3101eS #define  REJECT_CODE             0x9	/* Unable to perform command request */
917dea3101eS 
918dea3101eS /*
919dea3101eS  * HBA Management Service Reject Reason Code
920dea3101eS  * Please refer to the Reason Codes above
921dea3101eS  */
922dea3101eS 
923dea3101eS /*
924dea3101eS  * HBA Attribute Types
925dea3101eS  */
926dea3101eS #define  NODE_NAME               0x1
927dea3101eS #define  MANUFACTURER            0x2
928dea3101eS #define  SERIAL_NUMBER           0x3
929dea3101eS #define  MODEL                   0x4
930dea3101eS #define  MODEL_DESCRIPTION       0x5
931dea3101eS #define  HARDWARE_VERSION        0x6
932dea3101eS #define  DRIVER_VERSION          0x7
933dea3101eS #define  OPTION_ROM_VERSION      0x8
934dea3101eS #define  FIRMWARE_VERSION        0x9
935dea3101eS #define  OS_NAME_VERSION	 0xa
936dea3101eS #define  MAX_CT_PAYLOAD_LEN	 0xb
937dea3101eS 
938dea3101eS /*
939dea3101eS  * Port Attrubute Types
940dea3101eS  */
941dea3101eS #define  SUPPORTED_FC4_TYPES     0x1
942dea3101eS #define  SUPPORTED_SPEED         0x2
943dea3101eS #define  PORT_SPEED              0x3
944dea3101eS #define  MAX_FRAME_SIZE          0x4
945dea3101eS #define  OS_DEVICE_NAME          0x5
946dea3101eS #define  HOST_NAME               0x6
947dea3101eS 
948dea3101eS union AttributesDef {
949dea3101eS 	/* Structure is in Big Endian format */
950dea3101eS 	struct {
951dea3101eS 		uint32_t AttrType:16;
952dea3101eS 		uint32_t AttrLen:16;
953dea3101eS 	} bits;
954dea3101eS 	uint32_t word;
955dea3101eS };
956dea3101eS 
957dea3101eS 
958dea3101eS /*
959dea3101eS  * HBA Attribute Entry (8 - 260 bytes)
960dea3101eS  */
961dea3101eS typedef struct {
962dea3101eS 	union AttributesDef ad;
963dea3101eS 	union {
964dea3101eS 		uint32_t VendorSpecific;
965dea3101eS 		uint8_t Manufacturer[64];
966dea3101eS 		uint8_t SerialNumber[64];
967dea3101eS 		uint8_t Model[256];
968dea3101eS 		uint8_t ModelDescription[256];
969dea3101eS 		uint8_t HardwareVersion[256];
970dea3101eS 		uint8_t DriverVersion[256];
971dea3101eS 		uint8_t OptionROMVersion[256];
972dea3101eS 		uint8_t FirmwareVersion[256];
973dea3101eS 		struct lpfc_name NodeName;
974dea3101eS 		uint8_t SupportFC4Types[32];
975dea3101eS 		uint32_t SupportSpeed;
976dea3101eS 		uint32_t PortSpeed;
977dea3101eS 		uint32_t MaxFrameSize;
978dea3101eS 		uint8_t OsDeviceName[256];
979dea3101eS 		uint8_t OsNameVersion[256];
980dea3101eS 		uint32_t MaxCTPayloadLen;
981dea3101eS 		uint8_t HostName[256];
982dea3101eS 	} un;
983dea3101eS } ATTRIBUTE_ENTRY;
984dea3101eS 
985dea3101eS /*
986dea3101eS  * HBA Attribute Block
987dea3101eS  */
988dea3101eS typedef struct {
989dea3101eS 	uint32_t EntryCnt;	/* Number of HBA attribute entries */
990dea3101eS 	ATTRIBUTE_ENTRY Entry;	/* Variable-length array */
991dea3101eS } ATTRIBUTE_BLOCK;
992dea3101eS 
993dea3101eS /*
994dea3101eS  * Port Entry
995dea3101eS  */
996dea3101eS typedef struct {
997dea3101eS 	struct lpfc_name PortName;
998dea3101eS } PORT_ENTRY;
999dea3101eS 
1000dea3101eS /*
1001dea3101eS  * HBA Identifier
1002dea3101eS  */
1003dea3101eS typedef struct {
1004dea3101eS 	struct lpfc_name PortName;
1005dea3101eS } HBA_IDENTIFIER;
1006dea3101eS 
1007dea3101eS /*
1008dea3101eS  * Registered Port List Format
1009dea3101eS  */
1010dea3101eS typedef struct {
1011dea3101eS 	uint32_t EntryCnt;
1012dea3101eS 	PORT_ENTRY pe;		/* Variable-length array */
1013dea3101eS } REG_PORT_LIST;
1014dea3101eS 
1015dea3101eS /*
1016dea3101eS  * Register HBA(RHBA)
1017dea3101eS  */
1018dea3101eS typedef struct {
1019dea3101eS 	HBA_IDENTIFIER hi;
1020dea3101eS 	REG_PORT_LIST rpl;	/* variable-length array */
1021dea3101eS /* ATTRIBUTE_BLOCK   ab; */
1022dea3101eS } REG_HBA;
1023dea3101eS 
1024dea3101eS /*
1025dea3101eS  * Register HBA Attributes (RHAT)
1026dea3101eS  */
1027dea3101eS typedef struct {
1028dea3101eS 	struct lpfc_name HBA_PortName;
1029dea3101eS 	ATTRIBUTE_BLOCK ab;
1030dea3101eS } REG_HBA_ATTRIBUTE;
1031dea3101eS 
1032dea3101eS /*
1033dea3101eS  * Register Port Attributes (RPA)
1034dea3101eS  */
1035dea3101eS typedef struct {
1036dea3101eS 	struct lpfc_name PortName;
1037dea3101eS 	ATTRIBUTE_BLOCK ab;
1038dea3101eS } REG_PORT_ATTRIBUTE;
1039dea3101eS 
1040dea3101eS /*
1041dea3101eS  * Get Registered HBA List (GRHL) Accept Payload Format
1042dea3101eS  */
1043dea3101eS typedef struct {
1044dea3101eS 	uint32_t HBA__Entry_Cnt; /* Number of Registered HBA Identifiers */
1045dea3101eS 	struct lpfc_name HBA_PortName;	/* Variable-length array */
1046dea3101eS } GRHL_ACC_PAYLOAD;
1047dea3101eS 
1048dea3101eS /*
1049dea3101eS  * Get Registered Port List (GRPL) Accept Payload Format
1050dea3101eS  */
1051dea3101eS typedef struct {
1052dea3101eS 	uint32_t RPL_Entry_Cnt;	/* Number of Registered Port Entries */
1053dea3101eS 	PORT_ENTRY Reg_Port_Entry[1];	/* Variable-length array */
1054dea3101eS } GRPL_ACC_PAYLOAD;
1055dea3101eS 
1056dea3101eS /*
1057dea3101eS  * Get Port Attributes (GPAT) Accept Payload Format
1058dea3101eS  */
1059dea3101eS 
1060dea3101eS typedef struct {
1061dea3101eS 	ATTRIBUTE_BLOCK pab;
1062dea3101eS } GPAT_ACC_PAYLOAD;
1063dea3101eS 
1064dea3101eS 
1065dea3101eS /*
1066dea3101eS  *  Begin HBA configuration parameters.
1067dea3101eS  *  The PCI configuration register BAR assignments are:
1068dea3101eS  *  BAR0, offset 0x10 - SLIM base memory address
1069dea3101eS  *  BAR1, offset 0x14 - SLIM base memory high address
1070dea3101eS  *  BAR2, offset 0x18 - REGISTER base memory address
1071dea3101eS  *  BAR3, offset 0x1c - REGISTER base memory high address
1072dea3101eS  *  BAR4, offset 0x20 - BIU I/O registers
1073dea3101eS  *  BAR5, offset 0x24 - REGISTER base io high address
1074dea3101eS  */
1075dea3101eS 
1076dea3101eS /* Number of rings currently used and available. */
1077dea3101eS #define MAX_CONFIGURED_RINGS     3
1078dea3101eS #define MAX_RINGS                4
1079dea3101eS 
1080dea3101eS /* IOCB / Mailbox is owned by FireFly */
1081dea3101eS #define OWN_CHIP        1
1082dea3101eS 
1083dea3101eS /* IOCB / Mailbox is owned by Host */
1084dea3101eS #define OWN_HOST        0
1085dea3101eS 
1086dea3101eS /* Number of 4-byte words in an IOCB. */
1087dea3101eS #define IOCB_WORD_SZ    8
1088dea3101eS 
1089dea3101eS /* defines for type field in fc header */
1090dea3101eS #define FC_ELS_DATA     0x1
1091dea3101eS #define FC_LLC_SNAP     0x5
1092dea3101eS #define FC_FCP_DATA     0x8
1093dea3101eS #define FC_COMMON_TRANSPORT_ULP 0x20
1094dea3101eS 
1095dea3101eS /* defines for rctl field in fc header */
1096dea3101eS #define FC_DEV_DATA     0x0
1097dea3101eS #define FC_UNSOL_CTL    0x2
1098dea3101eS #define FC_SOL_CTL      0x3
1099dea3101eS #define FC_UNSOL_DATA   0x4
1100dea3101eS #define FC_FCP_CMND     0x6
1101dea3101eS #define FC_ELS_REQ      0x22
1102dea3101eS #define FC_ELS_RSP      0x23
1103dea3101eS 
1104dea3101eS /* network headers for Dfctl field */
1105dea3101eS #define FC_NET_HDR      0x20
1106dea3101eS 
1107dea3101eS /* Start FireFly Register definitions */
1108dea3101eS #define PCI_VENDOR_ID_EMULEX        0x10df
1109dea3101eS #define PCI_DEVICE_ID_FIREFLY       0x1ae5
111084774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_VF    0xe100
111184774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_PF    0xe180
1112b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_SMB       0xf011
1113b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_MID       0xf015
1114dea3101eS #define PCI_DEVICE_ID_RFLY          0xf095
1115dea3101eS #define PCI_DEVICE_ID_PFLY          0xf098
1116e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LP101         0xf0a1
1117dea3101eS #define PCI_DEVICE_ID_TFLY          0xf0a5
1118e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_BSMB          0xf0d1
1119e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_BMID          0xf0d5
1120e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZSMB          0xf0e1
1121e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZMID          0xf0e5
1122e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE       0xf0f5
1123e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE_SCSP  0xf0f6
1124e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE_DCSP  0xf0f7
1125b87eab38SJames Smart #define PCI_DEVICE_ID_SAT           0xf100
1126b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_SCSP      0xf111
1127b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_DCSP      0xf112
1128e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_SUPERFLY      0xf700
1129e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_DRAGONFLY     0xf800
1130dea3101eS #define PCI_DEVICE_ID_CENTAUR       0xf900
1131dea3101eS #define PCI_DEVICE_ID_PEGASUS       0xf980
1132dea3101eS #define PCI_DEVICE_ID_THOR          0xfa00
1133dea3101eS #define PCI_DEVICE_ID_VIPER         0xfb00
1134dea3101eS #define PCI_DEVICE_ID_LP10000S      0xfc00
1135e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LP11000S      0xfc10
1136e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LPE11000S     0xfc20
1137b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_S         0xfc40
113884774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_S     0xfc50
1139e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS        0xfd00
1140e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS_SCSP   0xfd11
1141e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS_DCSP   0xfd12
1142e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR        0xfe00
114384774a4dSJames Smart #define PCI_DEVICE_ID_HORNET        0xfe05
1144e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR_SCSP   0xfe11
1145e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR_DCSP   0xfe12
1146dea3101eS 
1147dea3101eS #define JEDEC_ID_ADDRESS            0x0080001c
1148dea3101eS #define FIREFLY_JEDEC_ID            0x1ACC
1149dea3101eS #define SUPERFLY_JEDEC_ID           0x0020
1150dea3101eS #define DRAGONFLY_JEDEC_ID          0x0021
1151dea3101eS #define DRAGONFLY_V2_JEDEC_ID       0x0025
1152dea3101eS #define CENTAUR_2G_JEDEC_ID         0x0026
1153dea3101eS #define CENTAUR_1G_JEDEC_ID         0x0028
1154dea3101eS #define PEGASUS_ORION_JEDEC_ID      0x0036
1155dea3101eS #define PEGASUS_JEDEC_ID            0x0038
1156dea3101eS #define THOR_JEDEC_ID               0x0012
1157dea3101eS #define HELIOS_JEDEC_ID             0x0364
1158dea3101eS #define ZEPHYR_JEDEC_ID             0x0577
1159dea3101eS #define VIPER_JEDEC_ID              0x4838
1160b87eab38SJames Smart #define SATURN_JEDEC_ID             0x1004
116184774a4dSJames Smart #define HORNET_JDEC_ID              0x2057706D
1162dea3101eS 
1163dea3101eS #define JEDEC_ID_MASK               0x0FFFF000
1164dea3101eS #define JEDEC_ID_SHIFT              12
1165dea3101eS #define FC_JEDEC_ID(id)             ((id & JEDEC_ID_MASK) >> JEDEC_ID_SHIFT)
1166dea3101eS 
1167dea3101eS typedef struct {		/* FireFly BIU registers */
1168dea3101eS 	uint32_t hostAtt;	/* See definitions for Host Attention
1169dea3101eS 				   register */
1170dea3101eS 	uint32_t chipAtt;	/* See definitions for Chip Attention
1171dea3101eS 				   register */
1172dea3101eS 	uint32_t hostStatus;	/* See definitions for Host Status register */
1173dea3101eS 	uint32_t hostControl;	/* See definitions for Host Control register */
1174dea3101eS 	uint32_t buiConfig;	/* See definitions for BIU configuration
1175dea3101eS 				   register */
1176dea3101eS } FF_REGS;
1177dea3101eS 
1178dea3101eS /* IO Register size in bytes */
1179dea3101eS #define FF_REG_AREA_SIZE       256
1180dea3101eS 
1181dea3101eS /* Host Attention Register */
1182dea3101eS 
1183dea3101eS #define HA_REG_OFFSET  0	/* Byte offset from register base address */
1184dea3101eS 
1185dea3101eS #define HA_R0RE_REQ    0x00000001	/* Bit  0 */
1186dea3101eS #define HA_R0CE_RSP    0x00000002	/* Bit  1 */
1187dea3101eS #define HA_R0ATT       0x00000008	/* Bit  3 */
1188dea3101eS #define HA_R1RE_REQ    0x00000010	/* Bit  4 */
1189dea3101eS #define HA_R1CE_RSP    0x00000020	/* Bit  5 */
1190dea3101eS #define HA_R1ATT       0x00000080	/* Bit  7 */
1191dea3101eS #define HA_R2RE_REQ    0x00000100	/* Bit  8 */
1192dea3101eS #define HA_R2CE_RSP    0x00000200	/* Bit  9 */
1193dea3101eS #define HA_R2ATT       0x00000800	/* Bit 11 */
1194dea3101eS #define HA_R3RE_REQ    0x00001000	/* Bit 12 */
1195dea3101eS #define HA_R3CE_RSP    0x00002000	/* Bit 13 */
1196dea3101eS #define HA_R3ATT       0x00008000	/* Bit 15 */
1197dea3101eS #define HA_LATT        0x20000000	/* Bit 29 */
1198dea3101eS #define HA_MBATT       0x40000000	/* Bit 30 */
1199dea3101eS #define HA_ERATT       0x80000000	/* Bit 31 */
1200dea3101eS 
1201dea3101eS #define HA_RXRE_REQ    0x00000001	/* Bit  0 */
1202dea3101eS #define HA_RXCE_RSP    0x00000002	/* Bit  1 */
1203dea3101eS #define HA_RXATT       0x00000008	/* Bit  3 */
1204dea3101eS #define HA_RXMASK      0x0000000f
1205dea3101eS 
1206*9399627fSJames Smart #define HA_R0_CLR_MSK	(HA_R0RE_REQ | HA_R0CE_RSP | HA_R0ATT)
1207*9399627fSJames Smart #define HA_R1_CLR_MSK	(HA_R1RE_REQ | HA_R1CE_RSP | HA_R1ATT)
1208*9399627fSJames Smart #define HA_R2_CLR_MSK	(HA_R2RE_REQ | HA_R2CE_RSP | HA_R2ATT)
1209*9399627fSJames Smart #define HA_R3_CLR_MSK	(HA_R3RE_REQ | HA_R3CE_RSP | HA_R3ATT)
1210*9399627fSJames Smart 
1211*9399627fSJames Smart #define HA_R0_POS	3
1212*9399627fSJames Smart #define HA_R1_POS	7
1213*9399627fSJames Smart #define HA_R2_POS	11
1214*9399627fSJames Smart #define HA_R3_POS	15
1215*9399627fSJames Smart #define HA_LE_POS	29
1216*9399627fSJames Smart #define HA_MB_POS	30
1217*9399627fSJames Smart #define HA_ER_POS	31
1218dea3101eS /* Chip Attention Register */
1219dea3101eS 
1220dea3101eS #define CA_REG_OFFSET  4	/* Byte offset from register base address */
1221dea3101eS 
1222dea3101eS #define CA_R0CE_REQ    0x00000001	/* Bit  0 */
1223dea3101eS #define CA_R0RE_RSP    0x00000002	/* Bit  1 */
1224dea3101eS #define CA_R0ATT       0x00000008	/* Bit  3 */
1225dea3101eS #define CA_R1CE_REQ    0x00000010	/* Bit  4 */
1226dea3101eS #define CA_R1RE_RSP    0x00000020	/* Bit  5 */
1227dea3101eS #define CA_R1ATT       0x00000080	/* Bit  7 */
1228dea3101eS #define CA_R2CE_REQ    0x00000100	/* Bit  8 */
1229dea3101eS #define CA_R2RE_RSP    0x00000200	/* Bit  9 */
1230dea3101eS #define CA_R2ATT       0x00000800	/* Bit 11 */
1231dea3101eS #define CA_R3CE_REQ    0x00001000	/* Bit 12 */
1232dea3101eS #define CA_R3RE_RSP    0x00002000	/* Bit 13 */
1233dea3101eS #define CA_R3ATT       0x00008000	/* Bit 15 */
1234dea3101eS #define CA_MBATT       0x40000000	/* Bit 30 */
1235dea3101eS 
1236dea3101eS /* Host Status Register */
1237dea3101eS 
1238dea3101eS #define HS_REG_OFFSET  8	/* Byte offset from register base address */
1239dea3101eS 
1240dea3101eS #define HS_MBRDY       0x00400000	/* Bit 22 */
1241dea3101eS #define HS_FFRDY       0x00800000	/* Bit 23 */
1242dea3101eS #define HS_FFER8       0x01000000	/* Bit 24 */
1243dea3101eS #define HS_FFER7       0x02000000	/* Bit 25 */
1244dea3101eS #define HS_FFER6       0x04000000	/* Bit 26 */
1245dea3101eS #define HS_FFER5       0x08000000	/* Bit 27 */
1246dea3101eS #define HS_FFER4       0x10000000	/* Bit 28 */
1247dea3101eS #define HS_FFER3       0x20000000	/* Bit 29 */
1248dea3101eS #define HS_FFER2       0x40000000	/* Bit 30 */
1249dea3101eS #define HS_FFER1       0x80000000	/* Bit 31 */
125057127f15SJames Smart #define HS_CRIT_TEMP   0x00000100	/* Bit 8  */
125157127f15SJames Smart #define HS_FFERM       0xFF000100	/* Mask for error bits 31:24 and 8 */
1252dea3101eS 
1253dea3101eS /* Host Control Register */
1254dea3101eS 
1255*9399627fSJames Smart #define HC_REG_OFFSET  12	/* Byte offset from register base address */
1256dea3101eS 
1257dea3101eS #define HC_MBINT_ENA   0x00000001	/* Bit  0 */
1258dea3101eS #define HC_R0INT_ENA   0x00000002	/* Bit  1 */
1259dea3101eS #define HC_R1INT_ENA   0x00000004	/* Bit  2 */
1260dea3101eS #define HC_R2INT_ENA   0x00000008	/* Bit  3 */
1261dea3101eS #define HC_R3INT_ENA   0x00000010	/* Bit  4 */
1262dea3101eS #define HC_INITHBI     0x02000000	/* Bit 25 */
1263dea3101eS #define HC_INITMB      0x04000000	/* Bit 26 */
1264dea3101eS #define HC_INITFF      0x08000000	/* Bit 27 */
1265dea3101eS #define HC_LAINT_ENA   0x20000000	/* Bit 29 */
1266dea3101eS #define HC_ERINT_ENA   0x80000000	/* Bit 31 */
1267dea3101eS 
1268*9399627fSJames Smart /* Message Signaled Interrupt eXtension (MSI-X) message identifiers */
1269*9399627fSJames Smart #define MSIX_DFLT_ID	0
1270*9399627fSJames Smart #define MSIX_RNG0_ID	0
1271*9399627fSJames Smart #define MSIX_RNG1_ID	1
1272*9399627fSJames Smart #define MSIX_RNG2_ID	2
1273*9399627fSJames Smart #define MSIX_RNG3_ID	3
1274*9399627fSJames Smart 
1275*9399627fSJames Smart #define MSIX_LINK_ID	4
1276*9399627fSJames Smart #define MSIX_MBOX_ID	5
1277*9399627fSJames Smart 
1278*9399627fSJames Smart #define MSIX_SPARE0_ID	6
1279*9399627fSJames Smart #define MSIX_SPARE1_ID	7
1280*9399627fSJames Smart 
1281dea3101eS /* Mailbox Commands */
1282dea3101eS #define MBX_SHUTDOWN        0x00	/* terminate testing */
1283dea3101eS #define MBX_LOAD_SM         0x01
1284dea3101eS #define MBX_READ_NV         0x02
1285dea3101eS #define MBX_WRITE_NV        0x03
1286dea3101eS #define MBX_RUN_BIU_DIAG    0x04
1287dea3101eS #define MBX_INIT_LINK       0x05
1288dea3101eS #define MBX_DOWN_LINK       0x06
1289dea3101eS #define MBX_CONFIG_LINK     0x07
1290dea3101eS #define MBX_CONFIG_RING     0x09
1291dea3101eS #define MBX_RESET_RING      0x0A
1292dea3101eS #define MBX_READ_CONFIG     0x0B
1293dea3101eS #define MBX_READ_RCONFIG    0x0C
1294dea3101eS #define MBX_READ_SPARM      0x0D
1295dea3101eS #define MBX_READ_STATUS     0x0E
1296dea3101eS #define MBX_READ_RPI        0x0F
1297dea3101eS #define MBX_READ_XRI        0x10
1298dea3101eS #define MBX_READ_REV        0x11
1299dea3101eS #define MBX_READ_LNK_STAT   0x12
1300dea3101eS #define MBX_REG_LOGIN       0x13
1301dea3101eS #define MBX_UNREG_LOGIN     0x14
1302dea3101eS #define MBX_READ_LA         0x15
1303dea3101eS #define MBX_CLEAR_LA        0x16
1304dea3101eS #define MBX_DUMP_MEMORY     0x17
1305dea3101eS #define MBX_DUMP_CONTEXT    0x18
1306dea3101eS #define MBX_RUN_DIAGS       0x19
1307dea3101eS #define MBX_RESTART         0x1A
1308dea3101eS #define MBX_UPDATE_CFG      0x1B
1309dea3101eS #define MBX_DOWN_LOAD       0x1C
1310dea3101eS #define MBX_DEL_LD_ENTRY    0x1D
1311dea3101eS #define MBX_RUN_PROGRAM     0x1E
1312dea3101eS #define MBX_SET_MASK        0x20
131309372820SJames Smart #define MBX_SET_VARIABLE    0x21
1314dea3101eS #define MBX_UNREG_D_ID      0x23
131541415862SJamie Wellnitz #define MBX_KILL_BOARD      0x24
1316dea3101eS #define MBX_CONFIG_FARP     0x25
131741415862SJamie Wellnitz #define MBX_BEACON          0x2A
1318*9399627fSJames Smart #define MBX_CONFIG_MSI      0x30
1319858c9f6cSJames Smart #define MBX_HEARTBEAT       0x31
1320a8adb832SJames Smart #define MBX_WRITE_VPARMS    0x32
1321a8adb832SJames Smart #define MBX_ASYNCEVT_ENABLE 0x33
1322dea3101eS 
132384774a4dSJames Smart #define MBX_PORT_CAPABILITIES 0x3B
132484774a4dSJames Smart #define MBX_PORT_IOV_CONTROL 0x3C
132584774a4dSJames Smart 
1326ed957684SJames Smart #define MBX_CONFIG_HBQ	    0x7C
1327dea3101eS #define MBX_LOAD_AREA       0x81
1328dea3101eS #define MBX_RUN_BIU_DIAG64  0x84
1329dea3101eS #define MBX_CONFIG_PORT     0x88
1330dea3101eS #define MBX_READ_SPARM64    0x8D
1331dea3101eS #define MBX_READ_RPI64      0x8F
1332dea3101eS #define MBX_REG_LOGIN64     0x93
1333dea3101eS #define MBX_READ_LA64       0x95
133492d7f7b0SJames Smart #define MBX_REG_VPI	    0x96
133592d7f7b0SJames Smart #define MBX_UNREG_VPI	    0x97
133692d7f7b0SJames Smart #define MBX_REG_VNPID	    0x96
133792d7f7b0SJames Smart #define MBX_UNREG_VNPID	    0x97
1338dea3101eS 
133909372820SJames Smart #define MBX_WRITE_WWN       0x98
1340dea3101eS #define MBX_SET_DEBUG       0x99
1341dea3101eS #define MBX_LOAD_EXP_ROM    0x9C
1342dea3101eS 
1343dea3101eS #define MBX_MAX_CMDS        0x9D
1344dea3101eS #define MBX_SLI2_CMD_MASK   0x80
1345dea3101eS 
1346dea3101eS /* IOCB Commands */
1347dea3101eS 
1348dea3101eS #define CMD_RCV_SEQUENCE_CX     0x01
1349dea3101eS #define CMD_XMIT_SEQUENCE_CR    0x02
1350dea3101eS #define CMD_XMIT_SEQUENCE_CX    0x03
1351dea3101eS #define CMD_XMIT_BCAST_CN       0x04
1352dea3101eS #define CMD_XMIT_BCAST_CX       0x05
1353dea3101eS #define CMD_QUE_RING_BUF_CN     0x06
1354dea3101eS #define CMD_QUE_XRI_BUF_CX      0x07
1355dea3101eS #define CMD_IOCB_CONTINUE_CN    0x08
1356dea3101eS #define CMD_RET_XRI_BUF_CX      0x09
1357dea3101eS #define CMD_ELS_REQUEST_CR      0x0A
1358dea3101eS #define CMD_ELS_REQUEST_CX      0x0B
1359dea3101eS #define CMD_RCV_ELS_REQ_CX      0x0D
1360dea3101eS #define CMD_ABORT_XRI_CN        0x0E
1361dea3101eS #define CMD_ABORT_XRI_CX        0x0F
1362dea3101eS #define CMD_CLOSE_XRI_CN        0x10
1363dea3101eS #define CMD_CLOSE_XRI_CX        0x11
1364dea3101eS #define CMD_CREATE_XRI_CR       0x12
1365dea3101eS #define CMD_CREATE_XRI_CX       0x13
1366dea3101eS #define CMD_GET_RPI_CN          0x14
1367dea3101eS #define CMD_XMIT_ELS_RSP_CX     0x15
1368dea3101eS #define CMD_GET_RPI_CR          0x16
1369dea3101eS #define CMD_XRI_ABORTED_CX      0x17
1370dea3101eS #define CMD_FCP_IWRITE_CR       0x18
1371dea3101eS #define CMD_FCP_IWRITE_CX       0x19
1372dea3101eS #define CMD_FCP_IREAD_CR        0x1A
1373dea3101eS #define CMD_FCP_IREAD_CX        0x1B
1374dea3101eS #define CMD_FCP_ICMND_CR        0x1C
1375dea3101eS #define CMD_FCP_ICMND_CX        0x1D
1376f5603511SJames Smart #define CMD_FCP_TSEND_CX        0x1F
1377f5603511SJames Smart #define CMD_FCP_TRECEIVE_CX     0x21
1378f5603511SJames Smart #define CMD_FCP_TRSP_CX	        0x23
1379f5603511SJames Smart #define CMD_FCP_AUTO_TRSP_CX    0x29
1380dea3101eS 
1381dea3101eS #define CMD_ADAPTER_MSG         0x20
1382dea3101eS #define CMD_ADAPTER_DUMP        0x22
1383dea3101eS 
1384dea3101eS /*  SLI_2 IOCB Command Set */
1385dea3101eS 
138657127f15SJames Smart #define CMD_ASYNC_STATUS        0x7C
1387dea3101eS #define CMD_RCV_SEQUENCE64_CX   0x81
1388dea3101eS #define CMD_XMIT_SEQUENCE64_CR  0x82
1389dea3101eS #define CMD_XMIT_SEQUENCE64_CX  0x83
1390dea3101eS #define CMD_XMIT_BCAST64_CN     0x84
1391dea3101eS #define CMD_XMIT_BCAST64_CX     0x85
1392dea3101eS #define CMD_QUE_RING_BUF64_CN   0x86
1393dea3101eS #define CMD_QUE_XRI_BUF64_CX    0x87
1394dea3101eS #define CMD_IOCB_CONTINUE64_CN  0x88
1395dea3101eS #define CMD_RET_XRI_BUF64_CX    0x89
1396dea3101eS #define CMD_ELS_REQUEST64_CR    0x8A
1397dea3101eS #define CMD_ELS_REQUEST64_CX    0x8B
1398dea3101eS #define CMD_ABORT_MXRI64_CN     0x8C
1399dea3101eS #define CMD_RCV_ELS_REQ64_CX    0x8D
1400dea3101eS #define CMD_XMIT_ELS_RSP64_CX   0x95
1401dea3101eS #define CMD_FCP_IWRITE64_CR     0x98
1402dea3101eS #define CMD_FCP_IWRITE64_CX     0x99
1403dea3101eS #define CMD_FCP_IREAD64_CR      0x9A
1404dea3101eS #define CMD_FCP_IREAD64_CX      0x9B
1405dea3101eS #define CMD_FCP_ICMND64_CR      0x9C
1406dea3101eS #define CMD_FCP_ICMND64_CX      0x9D
1407f5603511SJames Smart #define CMD_FCP_TSEND64_CX      0x9F
1408f5603511SJames Smart #define CMD_FCP_TRECEIVE64_CX   0xA1
1409f5603511SJames Smart #define CMD_FCP_TRSP64_CX       0xA3
1410dea3101eS 
141176bb24efSJames Smart #define CMD_QUE_XRI64_CX	0xB3
1412ed957684SJames Smart #define CMD_IOCB_RCV_SEQ64_CX	0xB5
1413ed957684SJames Smart #define CMD_IOCB_RCV_ELS64_CX	0xB7
14143163f725SJames Smart #define CMD_IOCB_RET_XRI64_CX	0xB9
1415ed957684SJames Smart #define CMD_IOCB_RCV_CONT64_CX	0xBB
1416ed957684SJames Smart 
1417dea3101eS #define CMD_GEN_REQUEST64_CR    0xC2
1418dea3101eS #define CMD_GEN_REQUEST64_CX    0xC3
1419dea3101eS 
14203163f725SJames Smart /* Unhandled SLI-3 Commands */
14213163f725SJames Smart #define CMD_IOCB_XMIT_MSEQ64_CR		0xB0
14223163f725SJames Smart #define CMD_IOCB_XMIT_MSEQ64_CX		0xB1
14233163f725SJames Smart #define CMD_IOCB_RCV_SEQ_LIST64_CX	0xC1
14243163f725SJames Smart #define CMD_IOCB_RCV_ELS_LIST64_CX	0xCD
14253163f725SJames Smart #define CMD_IOCB_CLOSE_EXTENDED_CN	0xB6
14263163f725SJames Smart #define CMD_IOCB_ABORT_EXTENDED_CN	0xBA
14273163f725SJames Smart #define CMD_IOCB_RET_HBQE64_CN		0xCA
14283163f725SJames Smart #define CMD_IOCB_FCP_IBIDIR64_CR	0xAC
14293163f725SJames Smart #define CMD_IOCB_FCP_IBIDIR64_CX	0xAD
14303163f725SJames Smart #define CMD_IOCB_FCP_ITASKMGT64_CX	0xAF
14313163f725SJames Smart #define CMD_IOCB_LOGENTRY_CN		0x94
14323163f725SJames Smart #define CMD_IOCB_LOGENTRY_ASYNC_CN	0x96
14333163f725SJames Smart 
1434dea3101eS #define CMD_MAX_IOCB_CMD        0xE6
1435dea3101eS #define CMD_IOCB_MASK           0xff
1436dea3101eS 
1437dea3101eS #define MAX_MSG_DATA            28	/* max msg data in CMD_ADAPTER_MSG
1438dea3101eS 					   iocb */
1439dea3101eS #define LPFC_MAX_ADPTMSG         32	/* max msg data */
1440dea3101eS /*
1441dea3101eS  *  Define Status
1442dea3101eS  */
1443dea3101eS #define MBX_SUCCESS                 0
1444dea3101eS #define MBXERR_NUM_RINGS            1
1445dea3101eS #define MBXERR_NUM_IOCBS            2
1446dea3101eS #define MBXERR_IOCBS_EXCEEDED       3
1447dea3101eS #define MBXERR_BAD_RING_NUMBER      4
1448dea3101eS #define MBXERR_MASK_ENTRIES_RANGE   5
1449dea3101eS #define MBXERR_MASKS_EXCEEDED       6
1450dea3101eS #define MBXERR_BAD_PROFILE          7
1451dea3101eS #define MBXERR_BAD_DEF_CLASS        8
1452dea3101eS #define MBXERR_BAD_MAX_RESPONDER    9
1453dea3101eS #define MBXERR_BAD_MAX_ORIGINATOR   10
1454dea3101eS #define MBXERR_RPI_REGISTERED       11
1455dea3101eS #define MBXERR_RPI_FULL             12
1456dea3101eS #define MBXERR_NO_RESOURCES         13
1457dea3101eS #define MBXERR_BAD_RCV_LENGTH       14
1458dea3101eS #define MBXERR_DMA_ERROR            15
1459dea3101eS #define MBXERR_ERROR                16
1460dea3101eS #define MBX_NOT_FINISHED           255
1461dea3101eS 
1462dea3101eS #define MBX_BUSY                   0xffffff /* Attempted cmd to busy Mailbox */
1463dea3101eS #define MBX_TIMEOUT                0xfffffe /* time-out expired waiting for */
1464dea3101eS 
146557127f15SJames Smart #define TEMPERATURE_OFFSET 0xB0	/* Slim offset for critical temperature event */
146657127f15SJames Smart 
1467dea3101eS /*
1468dea3101eS  *    Begin Structure Definitions for Mailbox Commands
1469dea3101eS  */
1470dea3101eS 
1471dea3101eS typedef struct {
1472dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1473dea3101eS 	uint8_t tval;
1474dea3101eS 	uint8_t tmask;
1475dea3101eS 	uint8_t rval;
1476dea3101eS 	uint8_t rmask;
1477dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1478dea3101eS 	uint8_t rmask;
1479dea3101eS 	uint8_t rval;
1480dea3101eS 	uint8_t tmask;
1481dea3101eS 	uint8_t tval;
1482dea3101eS #endif
1483dea3101eS } RR_REG;
1484dea3101eS 
1485dea3101eS struct ulp_bde {
1486dea3101eS 	uint32_t bdeAddress;
1487dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1488dea3101eS 	uint32_t bdeReserved:4;
1489dea3101eS 	uint32_t bdeAddrHigh:4;
1490dea3101eS 	uint32_t bdeSize:24;
1491dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1492dea3101eS 	uint32_t bdeSize:24;
1493dea3101eS 	uint32_t bdeAddrHigh:4;
1494dea3101eS 	uint32_t bdeReserved:4;
1495dea3101eS #endif
1496dea3101eS };
1497dea3101eS 
1498dea3101eS struct ulp_bde64 {	/* SLI-2 */
1499dea3101eS 	union ULP_BDE_TUS {
1500dea3101eS 		uint32_t w;
1501dea3101eS 		struct {
1502dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1503dea3101eS 			uint32_t bdeFlags:8;	/* BDE Flags 0 IS A SUPPORTED
1504dea3101eS 						   VALUE !! */
1505dea3101eS 			uint32_t bdeSize:24;	/* Size of buffer (in bytes) */
1506dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1507dea3101eS 			uint32_t bdeSize:24;	/* Size of buffer (in bytes) */
1508dea3101eS 			uint32_t bdeFlags:8;	/* BDE Flags 0 IS A SUPPORTED
1509dea3101eS 						   VALUE !! */
1510dea3101eS #endif
151134b02dcdSJames Smart #define BUFF_TYPE_BDE_64    0x00	/* BDE (Host_resident) */
151234b02dcdSJames Smart #define BUFF_TYPE_BDE_IMMED 0x01	/* Immediate Data BDE */
151334b02dcdSJames Smart #define BUFF_TYPE_BDE_64P   0x02	/* BDE (Port-resident) */
151434b02dcdSJames Smart #define BUFF_TYPE_BDE_64I   0x08	/* Input BDE (Host-resident) */
151534b02dcdSJames Smart #define BUFF_TYPE_BDE_64IP  0x0A	/* Input BDE (Port-resident) */
151634b02dcdSJames Smart #define BUFF_TYPE_BLP_64    0x40	/* BLP (Host-resident) */
151734b02dcdSJames Smart #define BUFF_TYPE_BLP_64P   0x42	/* BLP (Port-resident) */
1518dea3101eS 		} f;
1519dea3101eS 	} tus;
1520dea3101eS 	uint32_t addrLow;
1521dea3101eS 	uint32_t addrHigh;
1522dea3101eS };
1523dea3101eS 
1524dea3101eS typedef struct ULP_BDL {	/* SLI-2 */
1525dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1526dea3101eS 	uint32_t bdeFlags:8;	/* BDL Flags */
1527dea3101eS 	uint32_t bdeSize:24;	/* Size of BDL array in host memory (bytes) */
1528dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1529dea3101eS 	uint32_t bdeSize:24;	/* Size of BDL array in host memory (bytes) */
1530dea3101eS 	uint32_t bdeFlags:8;	/* BDL Flags */
1531dea3101eS #endif
1532dea3101eS 
1533dea3101eS 	uint32_t addrLow;	/* Address 0:31 */
1534dea3101eS 	uint32_t addrHigh;	/* Address 32:63 */
1535dea3101eS 	uint32_t ulpIoTag32;	/* Can be used for 32 bit I/O Tag */
1536dea3101eS } ULP_BDL;
1537dea3101eS 
1538dea3101eS /* Structure for MB Command LOAD_SM and DOWN_LOAD */
1539dea3101eS 
1540dea3101eS typedef struct {
1541dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1542dea3101eS 	uint32_t rsvd2:25;
1543dea3101eS 	uint32_t acknowledgment:1;
1544dea3101eS 	uint32_t version:1;
1545dea3101eS 	uint32_t erase_or_prog:1;
1546dea3101eS 	uint32_t update_flash:1;
1547dea3101eS 	uint32_t update_ram:1;
1548dea3101eS 	uint32_t method:1;
1549dea3101eS 	uint32_t load_cmplt:1;
1550dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1551dea3101eS 	uint32_t load_cmplt:1;
1552dea3101eS 	uint32_t method:1;
1553dea3101eS 	uint32_t update_ram:1;
1554dea3101eS 	uint32_t update_flash:1;
1555dea3101eS 	uint32_t erase_or_prog:1;
1556dea3101eS 	uint32_t version:1;
1557dea3101eS 	uint32_t acknowledgment:1;
1558dea3101eS 	uint32_t rsvd2:25;
1559dea3101eS #endif
1560dea3101eS 
1561dea3101eS 	uint32_t dl_to_adr_low;
1562dea3101eS 	uint32_t dl_to_adr_high;
1563dea3101eS 	uint32_t dl_len;
1564dea3101eS 	union {
1565dea3101eS 		uint32_t dl_from_mbx_offset;
1566dea3101eS 		struct ulp_bde dl_from_bde;
1567dea3101eS 		struct ulp_bde64 dl_from_bde64;
1568dea3101eS 	} un;
1569dea3101eS 
1570dea3101eS } LOAD_SM_VAR;
1571dea3101eS 
1572dea3101eS /* Structure for MB Command READ_NVPARM (02) */
1573dea3101eS 
1574dea3101eS typedef struct {
1575dea3101eS 	uint32_t rsvd1[3];	/* Read as all one's */
1576dea3101eS 	uint32_t rsvd2;		/* Read as all zero's */
1577dea3101eS 	uint32_t portname[2];	/* N_PORT name */
1578dea3101eS 	uint32_t nodename[2];	/* NODE name */
1579dea3101eS 
1580dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1581dea3101eS 	uint32_t pref_DID:24;
1582dea3101eS 	uint32_t hardAL_PA:8;
1583dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1584dea3101eS 	uint32_t hardAL_PA:8;
1585dea3101eS 	uint32_t pref_DID:24;
1586dea3101eS #endif
1587dea3101eS 
1588dea3101eS 	uint32_t rsvd3[21];	/* Read as all one's */
1589dea3101eS } READ_NV_VAR;
1590dea3101eS 
1591dea3101eS /* Structure for MB Command WRITE_NVPARMS (03) */
1592dea3101eS 
1593dea3101eS typedef struct {
1594dea3101eS 	uint32_t rsvd1[3];	/* Must be all one's */
1595dea3101eS 	uint32_t rsvd2;		/* Must be all zero's */
1596dea3101eS 	uint32_t portname[2];	/* N_PORT name */
1597dea3101eS 	uint32_t nodename[2];	/* NODE name */
1598dea3101eS 
1599dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1600dea3101eS 	uint32_t pref_DID:24;
1601dea3101eS 	uint32_t hardAL_PA:8;
1602dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1603dea3101eS 	uint32_t hardAL_PA:8;
1604dea3101eS 	uint32_t pref_DID:24;
1605dea3101eS #endif
1606dea3101eS 
1607dea3101eS 	uint32_t rsvd3[21];	/* Must be all one's */
1608dea3101eS } WRITE_NV_VAR;
1609dea3101eS 
1610dea3101eS /* Structure for MB Command RUN_BIU_DIAG (04) */
1611dea3101eS /* Structure for MB Command RUN_BIU_DIAG64 (0x84) */
1612dea3101eS 
1613dea3101eS typedef struct {
1614dea3101eS 	uint32_t rsvd1;
1615dea3101eS 	union {
1616dea3101eS 		struct {
1617dea3101eS 			struct ulp_bde xmit_bde;
1618dea3101eS 			struct ulp_bde rcv_bde;
1619dea3101eS 		} s1;
1620dea3101eS 		struct {
1621dea3101eS 			struct ulp_bde64 xmit_bde64;
1622dea3101eS 			struct ulp_bde64 rcv_bde64;
1623dea3101eS 		} s2;
1624dea3101eS 	} un;
1625dea3101eS } BIU_DIAG_VAR;
1626dea3101eS 
1627dea3101eS /* Structure for MB Command INIT_LINK (05) */
1628dea3101eS 
1629dea3101eS typedef struct {
1630dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1631dea3101eS 	uint32_t rsvd1:24;
1632dea3101eS 	uint32_t lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective Reset to */
1633dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1634dea3101eS 	uint32_t lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective Reset to */
1635dea3101eS 	uint32_t rsvd1:24;
1636dea3101eS #endif
1637dea3101eS 
1638dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1639dea3101eS 	uint8_t fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
1640dea3101eS 	uint8_t rsvd2;
1641dea3101eS 	uint16_t link_flags;
1642dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1643dea3101eS 	uint16_t link_flags;
1644dea3101eS 	uint8_t rsvd2;
1645dea3101eS 	uint8_t fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
1646dea3101eS #endif
1647dea3101eS 
1648dea3101eS #define FLAGS_LOCAL_LB               0x01 /* link_flags (=1) ENDEC loopback */
1649dea3101eS #define FLAGS_TOPOLOGY_MODE_LOOP_PT  0x00 /* Attempt loop then pt-pt */
1650dea3101eS #define FLAGS_TOPOLOGY_MODE_PT_PT    0x02 /* Attempt pt-pt only */
1651dea3101eS #define FLAGS_TOPOLOGY_MODE_LOOP     0x04 /* Attempt loop only */
1652dea3101eS #define FLAGS_TOPOLOGY_MODE_PT_LOOP  0x06 /* Attempt pt-pt then loop */
1653ed957684SJames Smart #define	FLAGS_UNREG_LOGIN_ALL	     0x08 /* UNREG_LOGIN all on link down */
1654dea3101eS #define FLAGS_LIRP_LILP              0x80 /* LIRP / LILP is disabled */
1655dea3101eS 
1656dea3101eS #define FLAGS_TOPOLOGY_FAILOVER      0x0400	/* Bit 10 */
1657dea3101eS #define FLAGS_LINK_SPEED             0x0800	/* Bit 11 */
16584b0b91d4SJames Smart #define FLAGS_IMED_ABORT             0x04000	/* Bit 14 */
1659dea3101eS 
1660dea3101eS 	uint32_t link_speed;
1661dea3101eS #define LINK_SPEED_AUTO 0       /* Auto selection */
1662dea3101eS #define LINK_SPEED_1G   1       /* 1 Gigabaud */
1663dea3101eS #define LINK_SPEED_2G   2       /* 2 Gigabaud */
1664dea3101eS #define LINK_SPEED_4G   4       /* 4 Gigabaud */
1665b87eab38SJames Smart #define LINK_SPEED_8G   8       /* 8 Gigabaud */
1666dea3101eS #define LINK_SPEED_10G   16      /* 10 Gigabaud */
1667dea3101eS 
1668dea3101eS } INIT_LINK_VAR;
1669dea3101eS 
1670dea3101eS /* Structure for MB Command DOWN_LINK (06) */
1671dea3101eS 
1672dea3101eS typedef struct {
1673dea3101eS 	uint32_t rsvd1;
1674dea3101eS } DOWN_LINK_VAR;
1675dea3101eS 
1676dea3101eS /* Structure for MB Command CONFIG_LINK (07) */
1677dea3101eS 
1678dea3101eS typedef struct {
1679dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1680dea3101eS 	uint32_t cr:1;
1681dea3101eS 	uint32_t ci:1;
1682dea3101eS 	uint32_t cr_delay:6;
1683dea3101eS 	uint32_t cr_count:8;
1684dea3101eS 	uint32_t rsvd1:8;
1685dea3101eS 	uint32_t MaxBBC:8;
1686dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1687dea3101eS 	uint32_t MaxBBC:8;
1688dea3101eS 	uint32_t rsvd1:8;
1689dea3101eS 	uint32_t cr_count:8;
1690dea3101eS 	uint32_t cr_delay:6;
1691dea3101eS 	uint32_t ci:1;
1692dea3101eS 	uint32_t cr:1;
1693dea3101eS #endif
1694dea3101eS 
1695dea3101eS 	uint32_t myId;
1696dea3101eS 	uint32_t rsvd2;
1697dea3101eS 	uint32_t edtov;
1698dea3101eS 	uint32_t arbtov;
1699dea3101eS 	uint32_t ratov;
1700dea3101eS 	uint32_t rttov;
1701dea3101eS 	uint32_t altov;
1702dea3101eS 	uint32_t crtov;
1703dea3101eS 	uint32_t citov;
1704dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1705dea3101eS 	uint32_t rrq_enable:1;
1706dea3101eS 	uint32_t rrq_immed:1;
1707dea3101eS 	uint32_t rsvd4:29;
1708dea3101eS 	uint32_t ack0_enable:1;
1709dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1710dea3101eS 	uint32_t ack0_enable:1;
1711dea3101eS 	uint32_t rsvd4:29;
1712dea3101eS 	uint32_t rrq_immed:1;
1713dea3101eS 	uint32_t rrq_enable:1;
1714dea3101eS #endif
1715dea3101eS } CONFIG_LINK;
1716dea3101eS 
1717dea3101eS /* Structure for MB Command PART_SLIM (08)
1718dea3101eS  * will be removed since SLI1 is no longer supported!
1719dea3101eS  */
1720dea3101eS typedef struct {
1721dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1722dea3101eS 	uint16_t offCiocb;
1723dea3101eS 	uint16_t numCiocb;
1724dea3101eS 	uint16_t offRiocb;
1725dea3101eS 	uint16_t numRiocb;
1726dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1727dea3101eS 	uint16_t numCiocb;
1728dea3101eS 	uint16_t offCiocb;
1729dea3101eS 	uint16_t numRiocb;
1730dea3101eS 	uint16_t offRiocb;
1731dea3101eS #endif
1732dea3101eS } RING_DEF;
1733dea3101eS 
1734dea3101eS typedef struct {
1735dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1736dea3101eS 	uint32_t unused1:24;
1737dea3101eS 	uint32_t numRing:8;
1738dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1739dea3101eS 	uint32_t numRing:8;
1740dea3101eS 	uint32_t unused1:24;
1741dea3101eS #endif
1742dea3101eS 
1743dea3101eS 	RING_DEF ringdef[4];
1744dea3101eS 	uint32_t hbainit;
1745dea3101eS } PART_SLIM_VAR;
1746dea3101eS 
1747dea3101eS /* Structure for MB Command CONFIG_RING (09) */
1748dea3101eS 
1749dea3101eS typedef struct {
1750dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1751dea3101eS 	uint32_t unused2:6;
1752dea3101eS 	uint32_t recvSeq:1;
1753dea3101eS 	uint32_t recvNotify:1;
1754dea3101eS 	uint32_t numMask:8;
1755dea3101eS 	uint32_t profile:8;
1756dea3101eS 	uint32_t unused1:4;
1757dea3101eS 	uint32_t ring:4;
1758dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1759dea3101eS 	uint32_t ring:4;
1760dea3101eS 	uint32_t unused1:4;
1761dea3101eS 	uint32_t profile:8;
1762dea3101eS 	uint32_t numMask:8;
1763dea3101eS 	uint32_t recvNotify:1;
1764dea3101eS 	uint32_t recvSeq:1;
1765dea3101eS 	uint32_t unused2:6;
1766dea3101eS #endif
1767dea3101eS 
1768dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1769dea3101eS 	uint16_t maxRespXchg;
1770dea3101eS 	uint16_t maxOrigXchg;
1771dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1772dea3101eS 	uint16_t maxOrigXchg;
1773dea3101eS 	uint16_t maxRespXchg;
1774dea3101eS #endif
1775dea3101eS 
1776dea3101eS 	RR_REG rrRegs[6];
1777dea3101eS } CONFIG_RING_VAR;
1778dea3101eS 
1779dea3101eS /* Structure for MB Command RESET_RING (10) */
1780dea3101eS 
1781dea3101eS typedef struct {
1782dea3101eS 	uint32_t ring_no;
1783dea3101eS } RESET_RING_VAR;
1784dea3101eS 
1785dea3101eS /* Structure for MB Command READ_CONFIG (11) */
1786dea3101eS 
1787dea3101eS typedef struct {
1788dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1789dea3101eS 	uint32_t cr:1;
1790dea3101eS 	uint32_t ci:1;
1791dea3101eS 	uint32_t cr_delay:6;
1792dea3101eS 	uint32_t cr_count:8;
1793dea3101eS 	uint32_t InitBBC:8;
1794dea3101eS 	uint32_t MaxBBC:8;
1795dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1796dea3101eS 	uint32_t MaxBBC:8;
1797dea3101eS 	uint32_t InitBBC:8;
1798dea3101eS 	uint32_t cr_count:8;
1799dea3101eS 	uint32_t cr_delay:6;
1800dea3101eS 	uint32_t ci:1;
1801dea3101eS 	uint32_t cr:1;
1802dea3101eS #endif
1803dea3101eS 
1804dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1805dea3101eS 	uint32_t topology:8;
1806dea3101eS 	uint32_t myDid:24;
1807dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1808dea3101eS 	uint32_t myDid:24;
1809dea3101eS 	uint32_t topology:8;
1810dea3101eS #endif
1811dea3101eS 
1812dea3101eS 	/* Defines for topology (defined previously) */
1813dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1814dea3101eS 	uint32_t AR:1;
1815dea3101eS 	uint32_t IR:1;
1816dea3101eS 	uint32_t rsvd1:29;
1817dea3101eS 	uint32_t ack0:1;
1818dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1819dea3101eS 	uint32_t ack0:1;
1820dea3101eS 	uint32_t rsvd1:29;
1821dea3101eS 	uint32_t IR:1;
1822dea3101eS 	uint32_t AR:1;
1823dea3101eS #endif
1824dea3101eS 
1825dea3101eS 	uint32_t edtov;
1826dea3101eS 	uint32_t arbtov;
1827dea3101eS 	uint32_t ratov;
1828dea3101eS 	uint32_t rttov;
1829dea3101eS 	uint32_t altov;
1830dea3101eS 	uint32_t lmt;
183174b72a59SJamie Wellnitz #define LMT_RESERVED  0x000    /* Not used */
183274b72a59SJamie Wellnitz #define LMT_1Gb       0x004
183374b72a59SJamie Wellnitz #define LMT_2Gb       0x008
183474b72a59SJamie Wellnitz #define LMT_4Gb       0x040
183574b72a59SJamie Wellnitz #define LMT_8Gb       0x080
183674b72a59SJamie Wellnitz #define LMT_10Gb      0x100
1837dea3101eS 	uint32_t rsvd2;
1838dea3101eS 	uint32_t rsvd3;
1839dea3101eS 	uint32_t max_xri;
1840dea3101eS 	uint32_t max_iocb;
1841dea3101eS 	uint32_t max_rpi;
1842dea3101eS 	uint32_t avail_xri;
1843dea3101eS 	uint32_t avail_iocb;
1844dea3101eS 	uint32_t avail_rpi;
1845858c9f6cSJames Smart 	uint32_t max_vpi;
1846858c9f6cSJames Smart 	uint32_t rsvd4;
1847858c9f6cSJames Smart 	uint32_t rsvd5;
1848858c9f6cSJames Smart 	uint32_t avail_vpi;
1849dea3101eS } READ_CONFIG_VAR;
1850dea3101eS 
1851dea3101eS /* Structure for MB Command READ_RCONFIG (12) */
1852dea3101eS 
1853dea3101eS typedef struct {
1854dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1855dea3101eS 	uint32_t rsvd2:7;
1856dea3101eS 	uint32_t recvNotify:1;
1857dea3101eS 	uint32_t numMask:8;
1858dea3101eS 	uint32_t profile:8;
1859dea3101eS 	uint32_t rsvd1:4;
1860dea3101eS 	uint32_t ring:4;
1861dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1862dea3101eS 	uint32_t ring:4;
1863dea3101eS 	uint32_t rsvd1:4;
1864dea3101eS 	uint32_t profile:8;
1865dea3101eS 	uint32_t numMask:8;
1866dea3101eS 	uint32_t recvNotify:1;
1867dea3101eS 	uint32_t rsvd2:7;
1868dea3101eS #endif
1869dea3101eS 
1870dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1871dea3101eS 	uint16_t maxResp;
1872dea3101eS 	uint16_t maxOrig;
1873dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1874dea3101eS 	uint16_t maxOrig;
1875dea3101eS 	uint16_t maxResp;
1876dea3101eS #endif
1877dea3101eS 
1878dea3101eS 	RR_REG rrRegs[6];
1879dea3101eS 
1880dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1881dea3101eS 	uint16_t cmdRingOffset;
1882dea3101eS 	uint16_t cmdEntryCnt;
1883dea3101eS 	uint16_t rspRingOffset;
1884dea3101eS 	uint16_t rspEntryCnt;
1885dea3101eS 	uint16_t nextCmdOffset;
1886dea3101eS 	uint16_t rsvd3;
1887dea3101eS 	uint16_t nextRspOffset;
1888dea3101eS 	uint16_t rsvd4;
1889dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1890dea3101eS 	uint16_t cmdEntryCnt;
1891dea3101eS 	uint16_t cmdRingOffset;
1892dea3101eS 	uint16_t rspEntryCnt;
1893dea3101eS 	uint16_t rspRingOffset;
1894dea3101eS 	uint16_t rsvd3;
1895dea3101eS 	uint16_t nextCmdOffset;
1896dea3101eS 	uint16_t rsvd4;
1897dea3101eS 	uint16_t nextRspOffset;
1898dea3101eS #endif
1899dea3101eS } READ_RCONF_VAR;
1900dea3101eS 
1901dea3101eS /* Structure for MB Command READ_SPARM (13) */
1902dea3101eS /* Structure for MB Command READ_SPARM64 (0x8D) */
1903dea3101eS 
1904dea3101eS typedef struct {
1905dea3101eS 	uint32_t rsvd1;
1906dea3101eS 	uint32_t rsvd2;
1907dea3101eS 	union {
1908dea3101eS 		struct ulp_bde sp; /* This BDE points to struct serv_parm
1909dea3101eS 				      structure */
1910dea3101eS 		struct ulp_bde64 sp64;
1911dea3101eS 	} un;
1912ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
1913ed957684SJames Smart 	uint16_t rsvd3;
1914ed957684SJames Smart 	uint16_t vpi;
1915ed957684SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
1916ed957684SJames Smart 	uint16_t vpi;
1917ed957684SJames Smart 	uint16_t rsvd3;
1918ed957684SJames Smart #endif
1919dea3101eS } READ_SPARM_VAR;
1920dea3101eS 
1921dea3101eS /* Structure for MB Command READ_STATUS (14) */
1922dea3101eS 
1923dea3101eS typedef struct {
1924dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1925dea3101eS 	uint32_t rsvd1:31;
1926dea3101eS 	uint32_t clrCounters:1;
1927dea3101eS 	uint16_t activeXriCnt;
1928dea3101eS 	uint16_t activeRpiCnt;
1929dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1930dea3101eS 	uint32_t clrCounters:1;
1931dea3101eS 	uint32_t rsvd1:31;
1932dea3101eS 	uint16_t activeRpiCnt;
1933dea3101eS 	uint16_t activeXriCnt;
1934dea3101eS #endif
1935dea3101eS 
1936dea3101eS 	uint32_t xmitByteCnt;
1937dea3101eS 	uint32_t rcvByteCnt;
1938dea3101eS 	uint32_t xmitFrameCnt;
1939dea3101eS 	uint32_t rcvFrameCnt;
1940dea3101eS 	uint32_t xmitSeqCnt;
1941dea3101eS 	uint32_t rcvSeqCnt;
1942dea3101eS 	uint32_t totalOrigExchanges;
1943dea3101eS 	uint32_t totalRespExchanges;
1944dea3101eS 	uint32_t rcvPbsyCnt;
1945dea3101eS 	uint32_t rcvFbsyCnt;
1946dea3101eS } READ_STATUS_VAR;
1947dea3101eS 
1948dea3101eS /* Structure for MB Command READ_RPI (15) */
1949dea3101eS /* Structure for MB Command READ_RPI64 (0x8F) */
1950dea3101eS 
1951dea3101eS typedef struct {
1952dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1953dea3101eS 	uint16_t nextRpi;
1954dea3101eS 	uint16_t reqRpi;
1955dea3101eS 	uint32_t rsvd2:8;
1956dea3101eS 	uint32_t DID:24;
1957dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1958dea3101eS 	uint16_t reqRpi;
1959dea3101eS 	uint16_t nextRpi;
1960dea3101eS 	uint32_t DID:24;
1961dea3101eS 	uint32_t rsvd2:8;
1962dea3101eS #endif
1963dea3101eS 
1964dea3101eS 	union {
1965dea3101eS 		struct ulp_bde sp;
1966dea3101eS 		struct ulp_bde64 sp64;
1967dea3101eS 	} un;
1968dea3101eS 
1969dea3101eS } READ_RPI_VAR;
1970dea3101eS 
1971dea3101eS /* Structure for MB Command READ_XRI (16) */
1972dea3101eS 
1973dea3101eS typedef struct {
1974dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1975dea3101eS 	uint16_t nextXri;
1976dea3101eS 	uint16_t reqXri;
1977dea3101eS 	uint16_t rsvd1;
1978dea3101eS 	uint16_t rpi;
1979dea3101eS 	uint32_t rsvd2:8;
1980dea3101eS 	uint32_t DID:24;
1981dea3101eS 	uint32_t rsvd3:8;
1982dea3101eS 	uint32_t SID:24;
1983dea3101eS 	uint32_t rsvd4;
1984dea3101eS 	uint8_t seqId;
1985dea3101eS 	uint8_t rsvd5;
1986dea3101eS 	uint16_t seqCount;
1987dea3101eS 	uint16_t oxId;
1988dea3101eS 	uint16_t rxId;
1989dea3101eS 	uint32_t rsvd6:30;
1990dea3101eS 	uint32_t si:1;
1991dea3101eS 	uint32_t exchOrig:1;
1992dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1993dea3101eS 	uint16_t reqXri;
1994dea3101eS 	uint16_t nextXri;
1995dea3101eS 	uint16_t rpi;
1996dea3101eS 	uint16_t rsvd1;
1997dea3101eS 	uint32_t DID:24;
1998dea3101eS 	uint32_t rsvd2:8;
1999dea3101eS 	uint32_t SID:24;
2000dea3101eS 	uint32_t rsvd3:8;
2001dea3101eS 	uint32_t rsvd4;
2002dea3101eS 	uint16_t seqCount;
2003dea3101eS 	uint8_t rsvd5;
2004dea3101eS 	uint8_t seqId;
2005dea3101eS 	uint16_t rxId;
2006dea3101eS 	uint16_t oxId;
2007dea3101eS 	uint32_t exchOrig:1;
2008dea3101eS 	uint32_t si:1;
2009dea3101eS 	uint32_t rsvd6:30;
2010dea3101eS #endif
2011dea3101eS } READ_XRI_VAR;
2012dea3101eS 
2013dea3101eS /* Structure for MB Command READ_REV (17) */
2014dea3101eS 
2015dea3101eS typedef struct {
2016dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2017dea3101eS 	uint32_t cv:1;
2018dea3101eS 	uint32_t rr:1;
2019ed957684SJames Smart 	uint32_t rsvd2:2;
2020ed957684SJames Smart 	uint32_t v3req:1;
2021ed957684SJames Smart 	uint32_t v3rsp:1;
2022ed957684SJames Smart 	uint32_t rsvd1:25;
2023dea3101eS 	uint32_t rv:1;
2024dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2025dea3101eS 	uint32_t rv:1;
2026ed957684SJames Smart 	uint32_t rsvd1:25;
2027ed957684SJames Smart 	uint32_t v3rsp:1;
2028ed957684SJames Smart 	uint32_t v3req:1;
2029ed957684SJames Smart 	uint32_t rsvd2:2;
2030dea3101eS 	uint32_t rr:1;
2031dea3101eS 	uint32_t cv:1;
2032dea3101eS #endif
2033dea3101eS 
2034dea3101eS 	uint32_t biuRev;
2035dea3101eS 	uint32_t smRev;
2036dea3101eS 	union {
2037dea3101eS 		uint32_t smFwRev;
2038dea3101eS 		struct {
2039dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2040dea3101eS 			uint8_t ProgType;
2041dea3101eS 			uint8_t ProgId;
2042dea3101eS 			uint16_t ProgVer:4;
2043dea3101eS 			uint16_t ProgRev:4;
2044dea3101eS 			uint16_t ProgFixLvl:2;
2045dea3101eS 			uint16_t ProgDistType:2;
2046dea3101eS 			uint16_t DistCnt:4;
2047dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2048dea3101eS 			uint16_t DistCnt:4;
2049dea3101eS 			uint16_t ProgDistType:2;
2050dea3101eS 			uint16_t ProgFixLvl:2;
2051dea3101eS 			uint16_t ProgRev:4;
2052dea3101eS 			uint16_t ProgVer:4;
2053dea3101eS 			uint8_t ProgId;
2054dea3101eS 			uint8_t ProgType;
2055dea3101eS #endif
2056dea3101eS 
2057dea3101eS 		} b;
2058dea3101eS 	} un;
2059dea3101eS 	uint32_t endecRev;
2060dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2061dea3101eS 	uint8_t feaLevelHigh;
2062dea3101eS 	uint8_t feaLevelLow;
2063dea3101eS 	uint8_t fcphHigh;
2064dea3101eS 	uint8_t fcphLow;
2065dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2066dea3101eS 	uint8_t fcphLow;
2067dea3101eS 	uint8_t fcphHigh;
2068dea3101eS 	uint8_t feaLevelLow;
2069dea3101eS 	uint8_t feaLevelHigh;
2070dea3101eS #endif
2071dea3101eS 
2072dea3101eS 	uint32_t postKernRev;
2073dea3101eS 	uint32_t opFwRev;
2074dea3101eS 	uint8_t opFwName[16];
2075dea3101eS 	uint32_t sli1FwRev;
2076dea3101eS 	uint8_t sli1FwName[16];
2077dea3101eS 	uint32_t sli2FwRev;
2078dea3101eS 	uint8_t sli2FwName[16];
2079ed957684SJames Smart 	uint32_t sli3Feat;
2080ed957684SJames Smart 	uint32_t RandomData[6];
2081dea3101eS } READ_REV_VAR;
2082dea3101eS 
2083dea3101eS /* Structure for MB Command READ_LINK_STAT (18) */
2084dea3101eS 
2085dea3101eS typedef struct {
2086dea3101eS 	uint32_t rsvd1;
2087dea3101eS 	uint32_t linkFailureCnt;
2088dea3101eS 	uint32_t lossSyncCnt;
2089dea3101eS 
2090dea3101eS 	uint32_t lossSignalCnt;
2091dea3101eS 	uint32_t primSeqErrCnt;
2092dea3101eS 	uint32_t invalidXmitWord;
2093dea3101eS 	uint32_t crcCnt;
2094dea3101eS 	uint32_t primSeqTimeout;
2095dea3101eS 	uint32_t elasticOverrun;
2096dea3101eS 	uint32_t arbTimeout;
2097dea3101eS } READ_LNK_VAR;
2098dea3101eS 
2099dea3101eS /* Structure for MB Command REG_LOGIN (19) */
2100dea3101eS /* Structure for MB Command REG_LOGIN64 (0x93) */
2101dea3101eS 
2102dea3101eS typedef struct {
2103dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2104dea3101eS 	uint16_t rsvd1;
2105dea3101eS 	uint16_t rpi;
2106dea3101eS 	uint32_t rsvd2:8;
2107dea3101eS 	uint32_t did:24;
2108dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2109dea3101eS 	uint16_t rpi;
2110dea3101eS 	uint16_t rsvd1;
2111dea3101eS 	uint32_t did:24;
2112dea3101eS 	uint32_t rsvd2:8;
2113dea3101eS #endif
2114dea3101eS 
2115dea3101eS 	union {
2116dea3101eS 		struct ulp_bde sp;
2117dea3101eS 		struct ulp_bde64 sp64;
2118dea3101eS 	} un;
2119dea3101eS 
2120ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2121ed957684SJames Smart 	uint16_t rsvd6;
2122ed957684SJames Smart 	uint16_t vpi;
2123ed957684SJames Smart #else /* __LITTLE_ENDIAN_BITFIELD */
2124ed957684SJames Smart 	uint16_t vpi;
2125ed957684SJames Smart 	uint16_t rsvd6;
2126ed957684SJames Smart #endif
2127ed957684SJames Smart 
2128dea3101eS } REG_LOGIN_VAR;
2129dea3101eS 
2130dea3101eS /* Word 30 contents for REG_LOGIN */
2131dea3101eS typedef union {
2132dea3101eS 	struct {
2133dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2134dea3101eS 		uint16_t rsvd1:12;
2135dea3101eS 		uint16_t wd30_class:4;
2136dea3101eS 		uint16_t xri;
2137dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2138dea3101eS 		uint16_t xri;
2139dea3101eS 		uint16_t wd30_class:4;
2140dea3101eS 		uint16_t rsvd1:12;
2141dea3101eS #endif
2142dea3101eS 	} f;
2143dea3101eS 	uint32_t word;
2144dea3101eS } REG_WD30;
2145dea3101eS 
2146dea3101eS /* Structure for MB Command UNREG_LOGIN (20) */
2147dea3101eS 
2148dea3101eS typedef struct {
2149dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2150dea3101eS 	uint16_t rsvd1;
2151dea3101eS 	uint16_t rpi;
2152ed957684SJames Smart 	uint32_t rsvd2;
2153ed957684SJames Smart 	uint32_t rsvd3;
2154ed957684SJames Smart 	uint32_t rsvd4;
2155ed957684SJames Smart 	uint32_t rsvd5;
2156ed957684SJames Smart 	uint16_t rsvd6;
2157ed957684SJames Smart 	uint16_t vpi;
2158dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2159dea3101eS 	uint16_t rpi;
2160dea3101eS 	uint16_t rsvd1;
2161ed957684SJames Smart 	uint32_t rsvd2;
2162ed957684SJames Smart 	uint32_t rsvd3;
2163ed957684SJames Smart 	uint32_t rsvd4;
2164ed957684SJames Smart 	uint32_t rsvd5;
2165ed957684SJames Smart 	uint16_t vpi;
2166ed957684SJames Smart 	uint16_t rsvd6;
2167dea3101eS #endif
2168dea3101eS } UNREG_LOGIN_VAR;
2169dea3101eS 
217092d7f7b0SJames Smart /* Structure for MB Command REG_VPI (0x96) */
217192d7f7b0SJames Smart typedef struct {
217292d7f7b0SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
217392d7f7b0SJames Smart 	uint32_t rsvd1;
217492d7f7b0SJames Smart 	uint32_t rsvd2:8;
217592d7f7b0SJames Smart 	uint32_t sid:24;
217692d7f7b0SJames Smart 	uint32_t rsvd3;
217792d7f7b0SJames Smart 	uint32_t rsvd4;
217892d7f7b0SJames Smart 	uint32_t rsvd5;
217992d7f7b0SJames Smart 	uint16_t rsvd6;
218092d7f7b0SJames Smart 	uint16_t vpi;
218192d7f7b0SJames Smart #else	/*  __LITTLE_ENDIAN */
218292d7f7b0SJames Smart 	uint32_t rsvd1;
218392d7f7b0SJames Smart 	uint32_t sid:24;
218492d7f7b0SJames Smart 	uint32_t rsvd2:8;
218592d7f7b0SJames Smart 	uint32_t rsvd3;
218692d7f7b0SJames Smart 	uint32_t rsvd4;
218792d7f7b0SJames Smart 	uint32_t rsvd5;
218892d7f7b0SJames Smart 	uint16_t vpi;
218992d7f7b0SJames Smart 	uint16_t rsvd6;
219092d7f7b0SJames Smart #endif
219192d7f7b0SJames Smart } REG_VPI_VAR;
219292d7f7b0SJames Smart 
219392d7f7b0SJames Smart /* Structure for MB Command UNREG_VPI (0x97) */
219492d7f7b0SJames Smart typedef struct {
219592d7f7b0SJames Smart 	uint32_t rsvd1;
219692d7f7b0SJames Smart 	uint32_t rsvd2;
219792d7f7b0SJames Smart 	uint32_t rsvd3;
219892d7f7b0SJames Smart 	uint32_t rsvd4;
219992d7f7b0SJames Smart 	uint32_t rsvd5;
220092d7f7b0SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
220192d7f7b0SJames Smart 	uint16_t rsvd6;
220292d7f7b0SJames Smart 	uint16_t vpi;
220392d7f7b0SJames Smart #else	/*  __LITTLE_ENDIAN */
220492d7f7b0SJames Smart 	uint16_t vpi;
220592d7f7b0SJames Smart 	uint16_t rsvd6;
220692d7f7b0SJames Smart #endif
220792d7f7b0SJames Smart } UNREG_VPI_VAR;
220892d7f7b0SJames Smart 
2209dea3101eS /* Structure for MB Command UNREG_D_ID (0x23) */
2210dea3101eS 
2211dea3101eS typedef struct {
2212dea3101eS 	uint32_t did;
2213ed957684SJames Smart 	uint32_t rsvd2;
2214ed957684SJames Smart 	uint32_t rsvd3;
2215ed957684SJames Smart 	uint32_t rsvd4;
2216ed957684SJames Smart 	uint32_t rsvd5;
2217ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2218ed957684SJames Smart 	uint16_t rsvd6;
2219ed957684SJames Smart 	uint16_t vpi;
2220ed957684SJames Smart #else
2221ed957684SJames Smart 	uint16_t vpi;
2222ed957684SJames Smart 	uint16_t rsvd6;
2223ed957684SJames Smart #endif
2224dea3101eS } UNREG_D_ID_VAR;
2225dea3101eS 
2226dea3101eS /* Structure for MB Command READ_LA (21) */
2227dea3101eS /* Structure for MB Command READ_LA64 (0x95) */
2228dea3101eS 
2229dea3101eS typedef struct {
2230dea3101eS 	uint32_t eventTag;	/* Event tag */
2231dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
223284774a4dSJames Smart 	uint32_t rsvd1:19;
223384774a4dSJames Smart 	uint32_t fa:1;
223484774a4dSJames Smart 	uint32_t mm:1;		/* Menlo Maintenance mode enabled */
223584774a4dSJames Smart 	uint32_t rx:1;
2236dea3101eS 	uint32_t pb:1;
2237dea3101eS 	uint32_t il:1;
2238dea3101eS 	uint32_t attType:8;
2239dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2240dea3101eS 	uint32_t attType:8;
2241dea3101eS 	uint32_t il:1;
2242dea3101eS 	uint32_t pb:1;
224384774a4dSJames Smart 	uint32_t rx:1;
224484774a4dSJames Smart 	uint32_t mm:1;
224584774a4dSJames Smart 	uint32_t fa:1;
224684774a4dSJames Smart 	uint32_t rsvd1:19;
2247dea3101eS #endif
2248dea3101eS 
2249dea3101eS #define AT_RESERVED    0x00	/* Reserved - attType */
2250dea3101eS #define AT_LINK_UP     0x01	/* Link is up */
2251dea3101eS #define AT_LINK_DOWN   0x02	/* Link is down */
2252dea3101eS 
2253dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2254dea3101eS 	uint8_t granted_AL_PA;
2255dea3101eS 	uint8_t lipAlPs;
2256dea3101eS 	uint8_t lipType;
2257dea3101eS 	uint8_t topology;
2258dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2259dea3101eS 	uint8_t topology;
2260dea3101eS 	uint8_t lipType;
2261dea3101eS 	uint8_t lipAlPs;
2262dea3101eS 	uint8_t granted_AL_PA;
2263dea3101eS #endif
2264dea3101eS 
2265dea3101eS #define TOPOLOGY_PT_PT 0x01	/* Topology is pt-pt / pt-fabric */
2266dea3101eS #define TOPOLOGY_LOOP  0x02	/* Topology is FC-AL */
226784774a4dSJames Smart #define TOPOLOGY_LNK_MENLO_MAINTENANCE 0x05 /* maint mode zephtr to menlo */
2268dea3101eS 
2269dea3101eS 	union {
2270dea3101eS 		struct ulp_bde lilpBde; /* This BDE points to a 128 byte buffer
2271dea3101eS 					   to */
2272dea3101eS 		/* store the LILP AL_PA position map into */
2273dea3101eS 		struct ulp_bde64 lilpBde64;
2274dea3101eS 	} un;
2275dea3101eS 
2276dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2277dea3101eS 	uint32_t Dlu:1;
2278dea3101eS 	uint32_t Dtf:1;
2279dea3101eS 	uint32_t Drsvd2:14;
2280dea3101eS 	uint32_t DlnkSpeed:8;
2281dea3101eS 	uint32_t DnlPort:4;
2282dea3101eS 	uint32_t Dtx:2;
2283dea3101eS 	uint32_t Drx:2;
2284dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2285dea3101eS 	uint32_t Drx:2;
2286dea3101eS 	uint32_t Dtx:2;
2287dea3101eS 	uint32_t DnlPort:4;
2288dea3101eS 	uint32_t DlnkSpeed:8;
2289dea3101eS 	uint32_t Drsvd2:14;
2290dea3101eS 	uint32_t Dtf:1;
2291dea3101eS 	uint32_t Dlu:1;
2292dea3101eS #endif
2293dea3101eS 
2294dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2295dea3101eS 	uint32_t Ulu:1;
2296dea3101eS 	uint32_t Utf:1;
2297dea3101eS 	uint32_t Ursvd2:14;
2298dea3101eS 	uint32_t UlnkSpeed:8;
2299dea3101eS 	uint32_t UnlPort:4;
2300dea3101eS 	uint32_t Utx:2;
2301dea3101eS 	uint32_t Urx:2;
2302dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2303dea3101eS 	uint32_t Urx:2;
2304dea3101eS 	uint32_t Utx:2;
2305dea3101eS 	uint32_t UnlPort:4;
2306dea3101eS 	uint32_t UlnkSpeed:8;
2307dea3101eS 	uint32_t Ursvd2:14;
2308dea3101eS 	uint32_t Utf:1;
2309dea3101eS 	uint32_t Ulu:1;
2310dea3101eS #endif
2311dea3101eS 
2312dea3101eS #define LA_UNKNW_LINK  0x0    /* lnkSpeed */
2313dea3101eS #define LA_1GHZ_LINK   0x04   /* lnkSpeed */
2314dea3101eS #define LA_2GHZ_LINK   0x08   /* lnkSpeed */
2315dea3101eS #define LA_4GHZ_LINK   0x10   /* lnkSpeed */
2316dea3101eS #define LA_8GHZ_LINK   0x20   /* lnkSpeed */
2317dea3101eS #define LA_10GHZ_LINK  0x40   /* lnkSpeed */
2318dea3101eS 
2319dea3101eS } READ_LA_VAR;
2320dea3101eS 
2321dea3101eS /* Structure for MB Command CLEAR_LA (22) */
2322dea3101eS 
2323dea3101eS typedef struct {
2324dea3101eS 	uint32_t eventTag;	/* Event tag */
2325dea3101eS 	uint32_t rsvd1;
2326dea3101eS } CLEAR_LA_VAR;
2327dea3101eS 
2328dea3101eS /* Structure for MB Command DUMP */
2329dea3101eS 
2330dea3101eS typedef struct {
2331dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2332dea3101eS 	uint32_t rsvd:25;
2333dea3101eS 	uint32_t ra:1;
2334dea3101eS 	uint32_t co:1;
2335dea3101eS 	uint32_t cv:1;
2336dea3101eS 	uint32_t type:4;
2337dea3101eS 	uint32_t entry_index:16;
2338dea3101eS 	uint32_t region_id:16;
2339dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2340dea3101eS 	uint32_t type:4;
2341dea3101eS 	uint32_t cv:1;
2342dea3101eS 	uint32_t co:1;
2343dea3101eS 	uint32_t ra:1;
2344dea3101eS 	uint32_t rsvd:25;
2345dea3101eS 	uint32_t region_id:16;
2346dea3101eS 	uint32_t entry_index:16;
2347dea3101eS #endif
2348dea3101eS 
2349dea3101eS 	uint32_t rsvd1;
2350dea3101eS 	uint32_t word_cnt;
2351dea3101eS 	uint32_t resp_offset;
2352dea3101eS } DUMP_VAR;
2353dea3101eS 
2354dea3101eS #define  DMP_MEM_REG             0x1
2355dea3101eS #define  DMP_NV_PARAMS           0x2
2356dea3101eS 
2357dea3101eS #define  DMP_REGION_VPD          0xe
2358dea3101eS #define  DMP_VPD_SIZE            0x400  /* maximum amount of VPD */
2359dea3101eS #define  DMP_RSP_OFFSET          0x14   /* word 5 contains first word of rsp */
2360dea3101eS #define  DMP_RSP_SIZE            0x6C   /* maximum of 27 words of rsp data */
2361dea3101eS 
2362d7c255b2SJames Smart /* Structure for MB Command UPDATE_CFG (0x1B) */
2363d7c255b2SJames Smart 
2364d7c255b2SJames Smart struct update_cfg_var {
2365d7c255b2SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2366d7c255b2SJames Smart 	uint32_t rsvd2:16;
2367d7c255b2SJames Smart 	uint32_t type:8;
2368d7c255b2SJames Smart 	uint32_t rsvd:1;
2369d7c255b2SJames Smart 	uint32_t ra:1;
2370d7c255b2SJames Smart 	uint32_t co:1;
2371d7c255b2SJames Smart 	uint32_t cv:1;
2372d7c255b2SJames Smart 	uint32_t req:4;
2373d7c255b2SJames Smart 	uint32_t entry_length:16;
2374d7c255b2SJames Smart 	uint32_t region_id:16;
2375d7c255b2SJames Smart #else  /*  __LITTLE_ENDIAN_BITFIELD */
2376d7c255b2SJames Smart 	uint32_t req:4;
2377d7c255b2SJames Smart 	uint32_t cv:1;
2378d7c255b2SJames Smart 	uint32_t co:1;
2379d7c255b2SJames Smart 	uint32_t ra:1;
2380d7c255b2SJames Smart 	uint32_t rsvd:1;
2381d7c255b2SJames Smart 	uint32_t type:8;
2382d7c255b2SJames Smart 	uint32_t rsvd2:16;
2383d7c255b2SJames Smart 	uint32_t region_id:16;
2384d7c255b2SJames Smart 	uint32_t entry_length:16;
2385d7c255b2SJames Smart #endif
2386d7c255b2SJames Smart 
2387d7c255b2SJames Smart 	uint32_t resp_info;
2388d7c255b2SJames Smart 	uint32_t byte_cnt;
2389d7c255b2SJames Smart 	uint32_t data_offset;
2390d7c255b2SJames Smart };
2391d7c255b2SJames Smart 
2392ed957684SJames Smart struct hbq_mask {
2393ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2394ed957684SJames Smart 	uint8_t tmatch;
2395ed957684SJames Smart 	uint8_t tmask;
2396ed957684SJames Smart 	uint8_t rctlmatch;
2397ed957684SJames Smart 	uint8_t rctlmask;
2398ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2399ed957684SJames Smart 	uint8_t rctlmask;
2400ed957684SJames Smart 	uint8_t rctlmatch;
2401ed957684SJames Smart 	uint8_t tmask;
2402ed957684SJames Smart 	uint8_t tmatch;
2403ed957684SJames Smart #endif
2404ed957684SJames Smart };
2405ed957684SJames Smart 
2406ed957684SJames Smart 
2407ed957684SJames Smart /* Structure for MB Command CONFIG_HBQ (7c) */
2408ed957684SJames Smart 
2409ed957684SJames Smart struct config_hbq_var {
2410ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2411ed957684SJames Smart 	uint32_t rsvd1      :7;
2412ed957684SJames Smart 	uint32_t recvNotify :1;     /* Receive Notification */
2413ed957684SJames Smart 	uint32_t numMask    :8;     /* # Mask Entries       */
2414ed957684SJames Smart 	uint32_t profile    :8;     /* Selection Profile    */
2415ed957684SJames Smart 	uint32_t rsvd2      :8;
2416ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2417ed957684SJames Smart 	uint32_t rsvd2      :8;
2418ed957684SJames Smart 	uint32_t profile    :8;     /* Selection Profile    */
2419ed957684SJames Smart 	uint32_t numMask    :8;     /* # Mask Entries       */
2420ed957684SJames Smart 	uint32_t recvNotify :1;     /* Receive Notification */
2421ed957684SJames Smart 	uint32_t rsvd1      :7;
2422ed957684SJames Smart #endif
2423ed957684SJames Smart 
2424ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2425ed957684SJames Smart 	uint32_t hbqId      :16;
2426ed957684SJames Smart 	uint32_t rsvd3      :12;
2427ed957684SJames Smart 	uint32_t ringMask   :4;
2428ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2429ed957684SJames Smart 	uint32_t ringMask   :4;
2430ed957684SJames Smart 	uint32_t rsvd3      :12;
2431ed957684SJames Smart 	uint32_t hbqId      :16;
2432ed957684SJames Smart #endif
2433ed957684SJames Smart 
2434ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2435ed957684SJames Smart 	uint32_t entry_count :16;
2436ed957684SJames Smart 	uint32_t rsvd4        :8;
2437ed957684SJames Smart 	uint32_t headerLen    :8;
2438ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2439ed957684SJames Smart 	uint32_t headerLen    :8;
2440ed957684SJames Smart 	uint32_t rsvd4        :8;
2441ed957684SJames Smart 	uint32_t entry_count :16;
2442ed957684SJames Smart #endif
2443ed957684SJames Smart 
2444ed957684SJames Smart 	uint32_t hbqaddrLow;
2445ed957684SJames Smart 	uint32_t hbqaddrHigh;
2446ed957684SJames Smart 
2447ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2448ed957684SJames Smart 	uint32_t rsvd5      :31;
2449ed957684SJames Smart 	uint32_t logEntry   :1;
2450ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2451ed957684SJames Smart 	uint32_t logEntry   :1;
2452ed957684SJames Smart 	uint32_t rsvd5      :31;
2453ed957684SJames Smart #endif
2454ed957684SJames Smart 
2455ed957684SJames Smart 	uint32_t rsvd6;    /* w7 */
2456ed957684SJames Smart 	uint32_t rsvd7;    /* w8 */
2457ed957684SJames Smart 	uint32_t rsvd8;    /* w9 */
2458ed957684SJames Smart 
2459ed957684SJames Smart 	struct hbq_mask hbqMasks[6];
2460ed957684SJames Smart 
2461ed957684SJames Smart 
2462ed957684SJames Smart 	union {
2463ed957684SJames Smart 		uint32_t allprofiles[12];
2464ed957684SJames Smart 
2465ed957684SJames Smart 		struct {
2466ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2467ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2468ed957684SJames Smart 				uint32_t	maxlen		:16;
2469ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2470ed957684SJames Smart 				uint32_t	maxlen		:16;
2471ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2472ed957684SJames Smart 			#endif
2473ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2474ed957684SJames Smart 				uint32_t	rsvd1		:28;
2475ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2476ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2477ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2478ed957684SJames Smart 				uint32_t	rsvd1		:28;
2479ed957684SJames Smart 			#endif
2480ed957684SJames Smart 			uint32_t rsvd[10];
2481ed957684SJames Smart 		} profile2;
2482ed957684SJames Smart 
2483ed957684SJames Smart 		struct {
2484ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2485ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2486ed957684SJames Smart 				uint32_t	maxlen		:16;
2487ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2488ed957684SJames Smart 				uint32_t	maxlen		:16;
2489ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2490ed957684SJames Smart 			#endif
2491ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2492ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
2493ed957684SJames Smart 				uint32_t	rsvd1		:12;
2494ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2495ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2496ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2497ed957684SJames Smart 				uint32_t	rsvd1		:12;
2498ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
2499ed957684SJames Smart 			#endif
2500ed957684SJames Smart 			uint32_t cmdmatch[8];
2501ed957684SJames Smart 
2502ed957684SJames Smart 			uint32_t rsvd[2];
2503ed957684SJames Smart 		} profile3;
2504ed957684SJames Smart 
2505ed957684SJames Smart 		struct {
2506ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2507ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2508ed957684SJames Smart 				uint32_t	maxlen		:16;
2509ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2510ed957684SJames Smart 				uint32_t	maxlen		:16;
2511ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2512ed957684SJames Smart 			#endif
2513ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2514ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
2515ed957684SJames Smart 				uint32_t	rsvd1		:12;
2516ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2517ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2518ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2519ed957684SJames Smart 				uint32_t	rsvd1		:12;
2520ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
2521ed957684SJames Smart 			#endif
2522ed957684SJames Smart 			uint32_t cmdmatch[8];
2523ed957684SJames Smart 
2524ed957684SJames Smart 			uint32_t rsvd[2];
2525ed957684SJames Smart 		} profile5;
2526ed957684SJames Smart 
2527ed957684SJames Smart 	} profiles;
2528ed957684SJames Smart 
2529ed957684SJames Smart };
2530ed957684SJames Smart 
2531ed957684SJames Smart 
2532dea3101eS 
25332e0fef85SJames Smart /* Structure for MB Command CONFIG_PORT (0x88) */
2534dea3101eS typedef struct {
2535ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2536ed957684SJames Smart 	uint32_t cBE       :  1;
2537ed957684SJames Smart 	uint32_t cET       :  1;
2538ed957684SJames Smart 	uint32_t cHpcb     :  1;
2539ed957684SJames Smart 	uint32_t cMA       :  1;
2540ed957684SJames Smart 	uint32_t sli_mode  :  4;
2541ed957684SJames Smart 	uint32_t pcbLen    : 24;       /* bit 23:0  of memory based port
2542ed957684SJames Smart 					* config block */
2543ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2544ed957684SJames Smart 	uint32_t pcbLen    : 24;       /* bit 23:0  of memory based port
2545ed957684SJames Smart 					* config block */
2546ed957684SJames Smart 	uint32_t sli_mode  :  4;
2547ed957684SJames Smart 	uint32_t cMA       :  1;
2548ed957684SJames Smart 	uint32_t cHpcb     :  1;
2549ed957684SJames Smart 	uint32_t cET       :  1;
2550ed957684SJames Smart 	uint32_t cBE       :  1;
2551ed957684SJames Smart #endif
2552ed957684SJames Smart 
2553dea3101eS 	uint32_t pcbLow;       /* bit 31:0  of memory based port config block */
2554dea3101eS 	uint32_t pcbHigh;      /* bit 63:32 of memory based port config block */
2555ed957684SJames Smart 	uint32_t hbainit[6];
2556ed957684SJames Smart 
2557ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2558ed957684SJames Smart 	uint32_t rsvd      : 24;  /* Reserved                             */
2559ed957684SJames Smart 	uint32_t cmv	   :  1;  /* Configure Max VPIs                   */
2560ed957684SJames Smart 	uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
2561ed957684SJames Smart 	uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
2562ed957684SJames Smart 	uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
2563ed957684SJames Smart 	uint32_t cinb      :  1;  /* Enable Interrupt Notification Block  */
2564ed957684SJames Smart 	uint32_t cerbm	   :  1;  /* Configure Enhanced Receive Buf Mgmt  */
2565ed957684SJames Smart 	uint32_t cmx	   :  1;  /* Configure Max XRIs                   */
2566ed957684SJames Smart 	uint32_t cmr	   :  1;  /* Configure Max RPIs                   */
2567ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2568ed957684SJames Smart 	uint32_t cmr	   :  1;  /* Configure Max RPIs                   */
2569ed957684SJames Smart 	uint32_t cmx	   :  1;  /* Configure Max XRIs                   */
2570ed957684SJames Smart 	uint32_t cerbm	   :  1;  /* Configure Enhanced Receive Buf Mgmt  */
2571ed957684SJames Smart 	uint32_t cinb      :  1;  /* Enable Interrupt Notification Block  */
2572ed957684SJames Smart 	uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
2573ed957684SJames Smart 	uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
2574ed957684SJames Smart 	uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
2575ed957684SJames Smart 	uint32_t cmv	   :  1;  /* Configure Max VPIs                   */
2576ed957684SJames Smart 	uint32_t rsvd      : 24;  /* Reserved                             */
2577ed957684SJames Smart #endif
2578ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2579ed957684SJames Smart 	uint32_t rsvd2     : 24;  /* Reserved                             */
2580ed957684SJames Smart 	uint32_t gmv	   :  1;  /* Grant Max VPIs                       */
2581ed957684SJames Smart 	uint32_t gcrp	   :  1;  /* Grant Command Ring Polling           */
2582ed957684SJames Smart 	uint32_t gsah	   :  1;  /* Grant Synchronous Abort Handling     */
2583ed957684SJames Smart 	uint32_t ghbs	   :  1;  /* Grant Host Backing Store             */
2584ed957684SJames Smart 	uint32_t ginb	   :  1;  /* Grant Interrupt Notification Block   */
2585ed957684SJames Smart 	uint32_t gerbm	   :  1;  /* Grant ERBM Request                   */
2586ed957684SJames Smart 	uint32_t gmx	   :  1;  /* Grant Max XRIs                       */
2587ed957684SJames Smart 	uint32_t gmr	   :  1;  /* Grant Max RPIs                       */
2588ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2589ed957684SJames Smart 	uint32_t gmr	   :  1;  /* Grant Max RPIs                       */
2590ed957684SJames Smart 	uint32_t gmx	   :  1;  /* Grant Max XRIs                       */
2591ed957684SJames Smart 	uint32_t gerbm	   :  1;  /* Grant ERBM Request                   */
2592ed957684SJames Smart 	uint32_t ginb	   :  1;  /* Grant Interrupt Notification Block   */
2593ed957684SJames Smart 	uint32_t ghbs	   :  1;  /* Grant Host Backing Store             */
2594ed957684SJames Smart 	uint32_t gsah	   :  1;  /* Grant Synchronous Abort Handling     */
2595ed957684SJames Smart 	uint32_t gcrp	   :  1;  /* Grant Command Ring Polling           */
2596ed957684SJames Smart 	uint32_t gmv	   :  1;  /* Grant Max VPIs                       */
2597ed957684SJames Smart 	uint32_t rsvd2     : 24;  /* Reserved                             */
2598ed957684SJames Smart #endif
2599ed957684SJames Smart 
2600ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2601ed957684SJames Smart 	uint32_t max_rpi   : 16;  /* Max RPIs Port should configure       */
2602ed957684SJames Smart 	uint32_t max_xri   : 16;  /* Max XRIs Port should configure       */
2603ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2604ed957684SJames Smart 	uint32_t max_xri   : 16;  /* Max XRIs Port should configure       */
2605ed957684SJames Smart 	uint32_t max_rpi   : 16;  /* Max RPIs Port should configure       */
2606ed957684SJames Smart #endif
2607ed957684SJames Smart 
2608ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2609ed957684SJames Smart 	uint32_t max_hbq   : 16;  /* Max HBQs Host expect to configure    */
2610ed957684SJames Smart 	uint32_t rsvd3     : 16;  /* Max HBQs Host expect to configure    */
2611ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2612ed957684SJames Smart 	uint32_t rsvd3     : 16;  /* Max HBQs Host expect to configure    */
2613ed957684SJames Smart 	uint32_t max_hbq   : 16;  /* Max HBQs Host expect to configure    */
2614ed957684SJames Smart #endif
2615ed957684SJames Smart 
2616ed957684SJames Smart 	uint32_t rsvd4;           /* Reserved                             */
2617ed957684SJames Smart 
2618ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2619ed957684SJames Smart 	uint32_t rsvd5      : 16;  /* Reserved                             */
2620ed957684SJames Smart 	uint32_t max_vpi    : 16;  /* Max number of virt N-Ports           */
2621ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2622ed957684SJames Smart 	uint32_t max_vpi    : 16;  /* Max number of virt N-Ports           */
2623ed957684SJames Smart 	uint32_t rsvd5      : 16;  /* Reserved                             */
2624ed957684SJames Smart #endif
2625ed957684SJames Smart 
2626dea3101eS } CONFIG_PORT_VAR;
2627dea3101eS 
2628*9399627fSJames Smart /* Structure for MB Command CONFIG_MSI (0x30) */
2629*9399627fSJames Smart struct config_msi_var {
2630*9399627fSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2631*9399627fSJames Smart 	uint32_t dfltMsgNum:8;	/* Default message number            */
2632*9399627fSJames Smart 	uint32_t rsvd1:11;	/* Reserved                          */
2633*9399627fSJames Smart 	uint32_t NID:5;		/* Number of secondary attention IDs */
2634*9399627fSJames Smart 	uint32_t rsvd2:5;	/* Reserved                          */
2635*9399627fSJames Smart 	uint32_t dfltPresent:1;	/* Default message number present    */
2636*9399627fSJames Smart 	uint32_t addFlag:1;	/* Add association flag              */
2637*9399627fSJames Smart 	uint32_t reportFlag:1;	/* Report association flag           */
2638*9399627fSJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
2639*9399627fSJames Smart 	uint32_t reportFlag:1;	/* Report association flag           */
2640*9399627fSJames Smart 	uint32_t addFlag:1;	/* Add association flag              */
2641*9399627fSJames Smart 	uint32_t dfltPresent:1;	/* Default message number present    */
2642*9399627fSJames Smart 	uint32_t rsvd2:5;	/* Reserved                          */
2643*9399627fSJames Smart 	uint32_t NID:5;		/* Number of secondary attention IDs */
2644*9399627fSJames Smart 	uint32_t rsvd1:11;	/* Reserved                          */
2645*9399627fSJames Smart 	uint32_t dfltMsgNum:8;	/* Default message number            */
2646*9399627fSJames Smart #endif
2647*9399627fSJames Smart 	uint32_t attentionConditions[2];
2648*9399627fSJames Smart 	uint8_t  attentionId[16];
2649*9399627fSJames Smart 	uint8_t  messageNumberByHA[64];
2650*9399627fSJames Smart 	uint8_t  messageNumberByID[16];
2651*9399627fSJames Smart 	uint32_t autoClearHA[2];
2652*9399627fSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2653*9399627fSJames Smart 	uint32_t rsvd3:16;
2654*9399627fSJames Smart 	uint32_t autoClearID:16;
2655*9399627fSJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
2656*9399627fSJames Smart 	uint32_t autoClearID:16;
2657*9399627fSJames Smart 	uint32_t rsvd3:16;
2658*9399627fSJames Smart #endif
2659*9399627fSJames Smart 	uint32_t rsvd4;
2660*9399627fSJames Smart };
2661*9399627fSJames Smart 
2662dea3101eS /* SLI-2 Port Control Block */
2663dea3101eS 
2664dea3101eS /* SLIM POINTER */
2665dea3101eS #define SLIMOFF 0x30		/* WORD */
2666dea3101eS 
2667dea3101eS typedef struct _SLI2_RDSC {
2668dea3101eS 	uint32_t cmdEntries;
2669dea3101eS 	uint32_t cmdAddrLow;
2670dea3101eS 	uint32_t cmdAddrHigh;
2671dea3101eS 
2672dea3101eS 	uint32_t rspEntries;
2673dea3101eS 	uint32_t rspAddrLow;
2674dea3101eS 	uint32_t rspAddrHigh;
2675dea3101eS } SLI2_RDSC;
2676dea3101eS 
2677dea3101eS typedef struct _PCB {
2678dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2679dea3101eS 	uint32_t type:8;
2680dea3101eS #define TYPE_NATIVE_SLI2       0x01;
2681dea3101eS 	uint32_t feature:8;
2682dea3101eS #define FEATURE_INITIAL_SLI2   0x01;
2683dea3101eS 	uint32_t rsvd:12;
2684dea3101eS 	uint32_t maxRing:4;
2685dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2686dea3101eS 	uint32_t maxRing:4;
2687dea3101eS 	uint32_t rsvd:12;
2688dea3101eS 	uint32_t feature:8;
2689dea3101eS #define FEATURE_INITIAL_SLI2   0x01;
2690dea3101eS 	uint32_t type:8;
2691dea3101eS #define TYPE_NATIVE_SLI2       0x01;
2692dea3101eS #endif
2693dea3101eS 
2694dea3101eS 	uint32_t mailBoxSize;
2695dea3101eS 	uint32_t mbAddrLow;
2696dea3101eS 	uint32_t mbAddrHigh;
2697dea3101eS 
2698dea3101eS 	uint32_t hgpAddrLow;
2699dea3101eS 	uint32_t hgpAddrHigh;
2700dea3101eS 
2701dea3101eS 	uint32_t pgpAddrLow;
2702dea3101eS 	uint32_t pgpAddrHigh;
2703dea3101eS 	SLI2_RDSC rdsc[MAX_RINGS];
2704dea3101eS } PCB_t;
2705dea3101eS 
2706dea3101eS /* NEW_FEATURE */
2707dea3101eS typedef struct {
2708dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2709dea3101eS 	uint32_t rsvd0:27;
2710dea3101eS 	uint32_t discardFarp:1;
2711dea3101eS 	uint32_t IPEnable:1;
2712dea3101eS 	uint32_t nodeName:1;
2713dea3101eS 	uint32_t portName:1;
2714dea3101eS 	uint32_t filterEnable:1;
2715dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2716dea3101eS 	uint32_t filterEnable:1;
2717dea3101eS 	uint32_t portName:1;
2718dea3101eS 	uint32_t nodeName:1;
2719dea3101eS 	uint32_t IPEnable:1;
2720dea3101eS 	uint32_t discardFarp:1;
2721dea3101eS 	uint32_t rsvd:27;
2722dea3101eS #endif
2723dea3101eS 
2724dea3101eS 	uint8_t portname[8];	/* Used to be struct lpfc_name */
2725dea3101eS 	uint8_t nodename[8];
2726dea3101eS 	uint32_t rsvd1;
2727dea3101eS 	uint32_t rsvd2;
2728dea3101eS 	uint32_t rsvd3;
2729dea3101eS 	uint32_t IPAddress;
2730dea3101eS } CONFIG_FARP_VAR;
2731dea3101eS 
273257127f15SJames Smart /* Structure for MB Command MBX_ASYNCEVT_ENABLE (0x33) */
273357127f15SJames Smart 
273457127f15SJames Smart typedef struct {
273557127f15SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
273657127f15SJames Smart 	uint32_t rsvd:30;
273757127f15SJames Smart 	uint32_t ring:2;	/* Ring for ASYNC_EVENT iocb Bits 0-1*/
273857127f15SJames Smart #else /*  __LITTLE_ENDIAN */
273957127f15SJames Smart 	uint32_t ring:2;	/* Ring for ASYNC_EVENT iocb Bits 0-1*/
274057127f15SJames Smart 	uint32_t rsvd:30;
274157127f15SJames Smart #endif
274257127f15SJames Smart } ASYNCEVT_ENABLE_VAR;
274357127f15SJames Smart 
2744dea3101eS /* Union of all Mailbox Command types */
2745dea3101eS #define MAILBOX_CMD_WSIZE	32
2746dea3101eS #define MAILBOX_CMD_SIZE	(MAILBOX_CMD_WSIZE * sizeof(uint32_t))
2747dea3101eS 
2748dea3101eS typedef union {
2749ed957684SJames Smart 	uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/
2750ed957684SJames Smart 						    * feature/max ring number
2751ed957684SJames Smart 						    */
2752dea3101eS 	LOAD_SM_VAR varLdSM;		/* cmd =  1 (LOAD_SM)        */
2753dea3101eS 	READ_NV_VAR varRDnvp;		/* cmd =  2 (READ_NVPARMS)   */
2754dea3101eS 	WRITE_NV_VAR varWTnvp;		/* cmd =  3 (WRITE_NVPARMS)  */
2755dea3101eS 	BIU_DIAG_VAR varBIUdiag;	/* cmd =  4 (RUN_BIU_DIAG)   */
2756dea3101eS 	INIT_LINK_VAR varInitLnk;	/* cmd =  5 (INIT_LINK)      */
2757dea3101eS 	DOWN_LINK_VAR varDwnLnk;	/* cmd =  6 (DOWN_LINK)      */
2758dea3101eS 	CONFIG_LINK varCfgLnk;		/* cmd =  7 (CONFIG_LINK)    */
2759dea3101eS 	PART_SLIM_VAR varSlim;		/* cmd =  8 (PART_SLIM)      */
2760dea3101eS 	CONFIG_RING_VAR varCfgRing;	/* cmd =  9 (CONFIG_RING)    */
2761dea3101eS 	RESET_RING_VAR varRstRing;	/* cmd = 10 (RESET_RING)     */
2762dea3101eS 	READ_CONFIG_VAR varRdConfig;	/* cmd = 11 (READ_CONFIG)    */
2763dea3101eS 	READ_RCONF_VAR varRdRConfig;	/* cmd = 12 (READ_RCONFIG)   */
2764dea3101eS 	READ_SPARM_VAR varRdSparm;	/* cmd = 13 (READ_SPARM(64)) */
2765dea3101eS 	READ_STATUS_VAR varRdStatus;	/* cmd = 14 (READ_STATUS)    */
2766dea3101eS 	READ_RPI_VAR varRdRPI;		/* cmd = 15 (READ_RPI(64))   */
2767dea3101eS 	READ_XRI_VAR varRdXRI;		/* cmd = 16 (READ_XRI)       */
2768dea3101eS 	READ_REV_VAR varRdRev;		/* cmd = 17 (READ_REV)       */
2769dea3101eS 	READ_LNK_VAR varRdLnk;		/* cmd = 18 (READ_LNK_STAT)  */
2770dea3101eS 	REG_LOGIN_VAR varRegLogin;	/* cmd = 19 (REG_LOGIN(64))  */
2771dea3101eS 	UNREG_LOGIN_VAR varUnregLogin;	/* cmd = 20 (UNREG_LOGIN)    */
2772dea3101eS 	READ_LA_VAR varReadLA;		/* cmd = 21 (READ_LA(64))    */
2773dea3101eS 	CLEAR_LA_VAR varClearLA;	/* cmd = 22 (CLEAR_LA)       */
2774dea3101eS 	DUMP_VAR varDmp;		/* Warm Start DUMP mbx cmd   */
2775dea3101eS 	UNREG_D_ID_VAR varUnregDID;	/* cmd = 0x23 (UNREG_D_ID)   */
2776ed957684SJames Smart 	CONFIG_FARP_VAR varCfgFarp;	/* cmd = 0x25 (CONFIG_FARP)
2777ed957684SJames Smart 					 * NEW_FEATURE
2778ed957684SJames Smart 					 */
2779ed957684SJames Smart 	struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ)  */
2780d7c255b2SJames Smart 	struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/
2781dea3101eS 	CONFIG_PORT_VAR varCfgPort;	/* cmd = 0x88 (CONFIG_PORT)  */
278292d7f7b0SJames Smart 	REG_VPI_VAR varRegVpi;		/* cmd = 0x96 (REG_VPI) */
278392d7f7b0SJames Smart 	UNREG_VPI_VAR varUnregVpi;	/* cmd = 0x97 (UNREG_VPI) */
278457127f15SJames Smart 	ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */
2785*9399627fSJames Smart 	struct config_msi_var varCfgMSI;/* cmd = x30 (CONFIG_MSI)     */
2786dea3101eS } MAILVARIANTS;
2787dea3101eS 
2788dea3101eS /*
2789dea3101eS  * SLI-2 specific structures
2790dea3101eS  */
2791dea3101eS 
27924cc2da1dSJames.Smart@Emulex.Com struct lpfc_hgp {
27934cc2da1dSJames.Smart@Emulex.Com 	__le32 cmdPutInx;
27944cc2da1dSJames.Smart@Emulex.Com 	__le32 rspGetInx;
27954cc2da1dSJames.Smart@Emulex.Com };
2796dea3101eS 
27974cc2da1dSJames.Smart@Emulex.Com struct lpfc_pgp {
27984cc2da1dSJames.Smart@Emulex.Com 	__le32 cmdGetInx;
27994cc2da1dSJames.Smart@Emulex.Com 	__le32 rspPutInx;
28004cc2da1dSJames.Smart@Emulex.Com };
2801dea3101eS 
2802ed957684SJames Smart struct sli2_desc {
2803dea3101eS 	uint32_t unused1[16];
2804ed957684SJames Smart 	struct lpfc_hgp host[MAX_RINGS];
28054cc2da1dSJames.Smart@Emulex.Com 	struct lpfc_pgp port[MAX_RINGS];
2806ed957684SJames Smart };
2807ed957684SJames Smart 
2808ed957684SJames Smart struct sli3_desc {
2809ed957684SJames Smart 	struct lpfc_hgp host[MAX_RINGS];
2810ed957684SJames Smart 	uint32_t reserved[8];
2811ed957684SJames Smart 	uint32_t hbq_put[16];
2812ed957684SJames Smart };
2813ed957684SJames Smart 
2814ed957684SJames Smart struct sli3_pgp {
2815ed957684SJames Smart 	struct lpfc_pgp port[MAX_RINGS];
2816ed957684SJames Smart 	uint32_t hbq_get[16];
2817ed957684SJames Smart };
2818dea3101eS 
281934b02dcdSJames Smart struct sli3_inb_pgp {
282034b02dcdSJames Smart 	uint32_t ha_copy;
282134b02dcdSJames Smart 	uint32_t counter;
282234b02dcdSJames Smart 	struct lpfc_pgp port[MAX_RINGS];
282334b02dcdSJames Smart 	uint32_t hbq_get[16];
282434b02dcdSJames Smart };
282534b02dcdSJames Smart 
282634b02dcdSJames Smart union sli_var {
2827ed957684SJames Smart 	struct sli2_desc	s2;
2828ed957684SJames Smart 	struct sli3_desc	s3;
2829ed957684SJames Smart 	struct sli3_pgp		s3_pgp;
283034b02dcdSJames Smart 	struct sli3_inb_pgp	s3_inb_pgp;
283134b02dcdSJames Smart };
2832dea3101eS 
2833dea3101eS typedef struct {
2834dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2835dea3101eS 	uint16_t mbxStatus;
2836dea3101eS 	uint8_t mbxCommand;
2837dea3101eS 	uint8_t mbxReserved:6;
2838dea3101eS 	uint8_t mbxHc:1;
2839dea3101eS 	uint8_t mbxOwner:1;	/* Low order bit first word */
2840dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2841dea3101eS 	uint8_t mbxOwner:1;	/* Low order bit first word */
2842dea3101eS 	uint8_t mbxHc:1;
2843dea3101eS 	uint8_t mbxReserved:6;
2844dea3101eS 	uint8_t mbxCommand;
2845dea3101eS 	uint16_t mbxStatus;
2846dea3101eS #endif
2847dea3101eS 
2848dea3101eS 	MAILVARIANTS un;
284934b02dcdSJames Smart 	union sli_var us;
2850dea3101eS } MAILBOX_t;
2851dea3101eS 
2852dea3101eS /*
2853dea3101eS  *    Begin Structure Definitions for IOCB Commands
2854dea3101eS  */
2855dea3101eS 
2856dea3101eS typedef struct {
2857dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2858dea3101eS 	uint8_t statAction;
2859dea3101eS 	uint8_t statRsn;
2860dea3101eS 	uint8_t statBaExp;
2861dea3101eS 	uint8_t statLocalError;
2862dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2863dea3101eS 	uint8_t statLocalError;
2864dea3101eS 	uint8_t statBaExp;
2865dea3101eS 	uint8_t statRsn;
2866dea3101eS 	uint8_t statAction;
2867dea3101eS #endif
2868dea3101eS 	/* statRsn  P/F_RJT reason codes */
2869dea3101eS #define RJT_BAD_D_ID       0x01	/* Invalid D_ID field */
2870dea3101eS #define RJT_BAD_S_ID       0x02	/* Invalid S_ID field */
2871dea3101eS #define RJT_UNAVAIL_TEMP   0x03	/* N_Port unavailable temp. */
2872dea3101eS #define RJT_UNAVAIL_PERM   0x04	/* N_Port unavailable perm. */
2873dea3101eS #define RJT_UNSUP_CLASS    0x05	/* Class not supported */
2874dea3101eS #define RJT_DELIM_ERR      0x06	/* Delimiter usage error */
2875dea3101eS #define RJT_UNSUP_TYPE     0x07	/* Type not supported */
2876dea3101eS #define RJT_BAD_CONTROL    0x08	/* Invalid link conrtol */
2877dea3101eS #define RJT_BAD_RCTL       0x09	/* R_CTL invalid */
2878dea3101eS #define RJT_BAD_FCTL       0x0A	/* F_CTL invalid */
2879dea3101eS #define RJT_BAD_OXID       0x0B	/* OX_ID invalid */
2880dea3101eS #define RJT_BAD_RXID       0x0C	/* RX_ID invalid */
2881dea3101eS #define RJT_BAD_SEQID      0x0D	/* SEQ_ID invalid */
2882dea3101eS #define RJT_BAD_DFCTL      0x0E	/* DF_CTL invalid */
2883dea3101eS #define RJT_BAD_SEQCNT     0x0F	/* SEQ_CNT invalid */
2884dea3101eS #define RJT_BAD_PARM       0x10	/* Param. field invalid */
2885dea3101eS #define RJT_XCHG_ERR       0x11	/* Exchange error */
2886dea3101eS #define RJT_PROT_ERR       0x12	/* Protocol error */
2887dea3101eS #define RJT_BAD_LENGTH     0x13	/* Invalid Length */
2888dea3101eS #define RJT_UNEXPECTED_ACK 0x14	/* Unexpected ACK */
2889dea3101eS #define RJT_LOGIN_REQUIRED 0x16	/* Login required */
2890dea3101eS #define RJT_TOO_MANY_SEQ   0x17	/* Excessive sequences */
2891dea3101eS #define RJT_XCHG_NOT_STRT  0x18	/* Exchange not started */
2892dea3101eS #define RJT_UNSUP_SEC_HDR  0x19	/* Security hdr not supported */
2893dea3101eS #define RJT_UNAVAIL_PATH   0x1A	/* Fabric Path not available */
2894dea3101eS #define RJT_VENDOR_UNIQUE  0xFF	/* Vendor unique error */
2895dea3101eS 
2896dea3101eS #define IOERR_SUCCESS                 0x00	/* statLocalError */
2897dea3101eS #define IOERR_MISSING_CONTINUE        0x01
2898dea3101eS #define IOERR_SEQUENCE_TIMEOUT        0x02
2899dea3101eS #define IOERR_INTERNAL_ERROR          0x03
2900dea3101eS #define IOERR_INVALID_RPI             0x04
2901dea3101eS #define IOERR_NO_XRI                  0x05
2902dea3101eS #define IOERR_ILLEGAL_COMMAND         0x06
2903dea3101eS #define IOERR_XCHG_DROPPED            0x07
2904dea3101eS #define IOERR_ILLEGAL_FIELD           0x08
2905dea3101eS #define IOERR_BAD_CONTINUE            0x09
2906dea3101eS #define IOERR_TOO_MANY_BUFFERS        0x0A
2907dea3101eS #define IOERR_RCV_BUFFER_WAITING      0x0B
2908dea3101eS #define IOERR_NO_CONNECTION           0x0C
2909dea3101eS #define IOERR_TX_DMA_FAILED           0x0D
2910dea3101eS #define IOERR_RX_DMA_FAILED           0x0E
2911dea3101eS #define IOERR_ILLEGAL_FRAME           0x0F
2912dea3101eS #define IOERR_EXTRA_DATA              0x10
2913dea3101eS #define IOERR_NO_RESOURCES            0x11
2914dea3101eS #define IOERR_RESERVED                0x12
2915dea3101eS #define IOERR_ILLEGAL_LENGTH          0x13
2916dea3101eS #define IOERR_UNSUPPORTED_FEATURE     0x14
2917dea3101eS #define IOERR_ABORT_IN_PROGRESS       0x15
2918dea3101eS #define IOERR_ABORT_REQUESTED         0x16
2919dea3101eS #define IOERR_RECEIVE_BUFFER_TIMEOUT  0x17
2920dea3101eS #define IOERR_LOOP_OPEN_FAILURE       0x18
2921dea3101eS #define IOERR_RING_RESET              0x19
2922dea3101eS #define IOERR_LINK_DOWN               0x1A
2923dea3101eS #define IOERR_CORRUPTED_DATA          0x1B
2924dea3101eS #define IOERR_CORRUPTED_RPI           0x1C
2925dea3101eS #define IOERR_OUT_OF_ORDER_DATA       0x1D
2926dea3101eS #define IOERR_OUT_OF_ORDER_ACK        0x1E
2927dea3101eS #define IOERR_DUP_FRAME               0x1F
2928dea3101eS #define IOERR_LINK_CONTROL_FRAME      0x20	/* ACK_N received */
2929dea3101eS #define IOERR_BAD_HOST_ADDRESS        0x21
2930dea3101eS #define IOERR_RCV_HDRBUF_WAITING      0x22
2931dea3101eS #define IOERR_MISSING_HDR_BUFFER      0x23
2932dea3101eS #define IOERR_MSEQ_CHAIN_CORRUPTED    0x24
2933dea3101eS #define IOERR_ABORTMULT_REQUESTED     0x25
2934dea3101eS #define IOERR_BUFFER_SHORTAGE         0x28
2935dea3101eS #define IOERR_DEFAULT                 0x29
2936dea3101eS #define IOERR_CNT                     0x2A
2937dea3101eS 
2938dea3101eS #define IOERR_DRVR_MASK               0x100
2939dea3101eS #define IOERR_SLI_DOWN                0x101  /* ulpStatus  - Driver defined */
2940dea3101eS #define IOERR_SLI_BRESET              0x102
2941dea3101eS #define IOERR_SLI_ABORTED             0x103
2942dea3101eS } PARM_ERR;
2943dea3101eS 
2944dea3101eS typedef union {
2945dea3101eS 	struct {
2946dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2947dea3101eS 		uint8_t Rctl;	/* R_CTL field */
2948dea3101eS 		uint8_t Type;	/* TYPE field */
2949dea3101eS 		uint8_t Dfctl;	/* DF_CTL field */
2950dea3101eS 		uint8_t Fctl;	/* Bits 0-7 of IOCB word 5 */
2951dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2952dea3101eS 		uint8_t Fctl;	/* Bits 0-7 of IOCB word 5 */
2953dea3101eS 		uint8_t Dfctl;	/* DF_CTL field */
2954dea3101eS 		uint8_t Type;	/* TYPE field */
2955dea3101eS 		uint8_t Rctl;	/* R_CTL field */
2956dea3101eS #endif
2957dea3101eS 
2958dea3101eS #define BC      0x02		/* Broadcast Received  - Fctl */
2959dea3101eS #define SI      0x04		/* Sequence Initiative */
2960dea3101eS #define LA      0x08		/* Ignore Link Attention state */
2961dea3101eS #define LS      0x80		/* Last Sequence */
2962dea3101eS 	} hcsw;
2963dea3101eS 	uint32_t reserved;
2964dea3101eS } WORD5;
2965dea3101eS 
2966dea3101eS /* IOCB Command template for a generic response */
2967dea3101eS typedef struct {
2968dea3101eS 	uint32_t reserved[4];
2969dea3101eS 	PARM_ERR perr;
2970dea3101eS } GENERIC_RSP;
2971dea3101eS 
2972dea3101eS /* IOCB Command template for XMIT / XMIT_BCAST / RCV_SEQUENCE / XMIT_ELS */
2973dea3101eS typedef struct {
2974dea3101eS 	struct ulp_bde xrsqbde[2];
2975dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
2976dea3101eS 	WORD5 w5;		/* Header control/status word */
2977dea3101eS } XR_SEQ_FIELDS;
2978dea3101eS 
2979dea3101eS /* IOCB Command template for ELS_REQUEST */
2980dea3101eS typedef struct {
2981dea3101eS 	struct ulp_bde elsReq;
2982dea3101eS 	struct ulp_bde elsRsp;
2983dea3101eS 
2984dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2985dea3101eS 	uint32_t word4Rsvd:7;
2986dea3101eS 	uint32_t fl:1;
2987dea3101eS 	uint32_t myID:24;
2988dea3101eS 	uint32_t word5Rsvd:8;
2989dea3101eS 	uint32_t remoteID:24;
2990dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2991dea3101eS 	uint32_t myID:24;
2992dea3101eS 	uint32_t fl:1;
2993dea3101eS 	uint32_t word4Rsvd:7;
2994dea3101eS 	uint32_t remoteID:24;
2995dea3101eS 	uint32_t word5Rsvd:8;
2996dea3101eS #endif
2997dea3101eS } ELS_REQUEST;
2998dea3101eS 
2999dea3101eS /* IOCB Command template for RCV_ELS_REQ */
3000dea3101eS typedef struct {
3001dea3101eS 	struct ulp_bde elsReq[2];
3002dea3101eS 	uint32_t parmRo;
3003dea3101eS 
3004dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3005dea3101eS 	uint32_t word5Rsvd:8;
3006dea3101eS 	uint32_t remoteID:24;
3007dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3008dea3101eS 	uint32_t remoteID:24;
3009dea3101eS 	uint32_t word5Rsvd:8;
3010dea3101eS #endif
3011dea3101eS } RCV_ELS_REQ;
3012dea3101eS 
3013dea3101eS /* IOCB Command template for ABORT / CLOSE_XRI */
3014dea3101eS typedef struct {
3015dea3101eS 	uint32_t rsvd[3];
3016dea3101eS 	uint32_t abortType;
3017dea3101eS #define ABORT_TYPE_ABTX  0x00000000
3018dea3101eS #define ABORT_TYPE_ABTS  0x00000001
3019dea3101eS 	uint32_t parm;
3020dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3021dea3101eS 	uint16_t abortContextTag; /* ulpContext from command to abort/close */
3022dea3101eS 	uint16_t abortIoTag;	/* ulpIoTag from command to abort/close */
3023dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3024dea3101eS 	uint16_t abortIoTag;	/* ulpIoTag from command to abort/close */
3025dea3101eS 	uint16_t abortContextTag; /* ulpContext from command to abort/close */
3026dea3101eS #endif
3027dea3101eS } AC_XRI;
3028dea3101eS 
3029dea3101eS /* IOCB Command template for ABORT_MXRI64 */
3030dea3101eS typedef struct {
3031dea3101eS 	uint32_t rsvd[3];
3032dea3101eS 	uint32_t abortType;
3033dea3101eS 	uint32_t parm;
3034dea3101eS 	uint32_t iotag32;
3035dea3101eS } A_MXRI64;
3036dea3101eS 
3037dea3101eS /* IOCB Command template for GET_RPI */
3038dea3101eS typedef struct {
3039dea3101eS 	uint32_t rsvd[4];
3040dea3101eS 	uint32_t parmRo;
3041dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3042dea3101eS 	uint32_t word5Rsvd:8;
3043dea3101eS 	uint32_t remoteID:24;
3044dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3045dea3101eS 	uint32_t remoteID:24;
3046dea3101eS 	uint32_t word5Rsvd:8;
3047dea3101eS #endif
3048dea3101eS } GET_RPI;
3049dea3101eS 
3050dea3101eS /* IOCB Command template for all FCP Initiator commands */
3051dea3101eS typedef struct {
3052dea3101eS 	struct ulp_bde fcpi_cmnd;	/* FCP_CMND payload descriptor */
3053dea3101eS 	struct ulp_bde fcpi_rsp;	/* Rcv buffer */
3054dea3101eS 	uint32_t fcpi_parm;
3055dea3101eS 	uint32_t fcpi_XRdy;	/* transfer ready for IWRITE */
3056dea3101eS } FCPI_FIELDS;
3057dea3101eS 
3058dea3101eS /* IOCB Command template for all FCP Target commands */
3059dea3101eS typedef struct {
3060dea3101eS 	struct ulp_bde fcpt_Buffer[2];	/* FCP_CMND payload descriptor */
3061dea3101eS 	uint32_t fcpt_Offset;
3062dea3101eS 	uint32_t fcpt_Length;	/* transfer ready for IWRITE */
3063dea3101eS } FCPT_FIELDS;
3064dea3101eS 
3065dea3101eS /* SLI-2 IOCB structure definitions */
3066dea3101eS 
3067dea3101eS /* IOCB Command template for 64 bit XMIT / XMIT_BCAST / XMIT_ELS */
3068dea3101eS typedef struct {
3069dea3101eS 	ULP_BDL bdl;
3070dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3071dea3101eS 	WORD5 w5;		/* Header control/status word */
3072dea3101eS } XMT_SEQ_FIELDS64;
3073dea3101eS 
3074dea3101eS /* IOCB Command template for 64 bit RCV_SEQUENCE64 */
3075dea3101eS typedef struct {
3076dea3101eS 	struct ulp_bde64 rcvBde;
3077dea3101eS 	uint32_t rsvd1;
3078dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3079dea3101eS 	WORD5 w5;		/* Header control/status word */
3080dea3101eS } RCV_SEQ_FIELDS64;
3081dea3101eS 
3082dea3101eS /* IOCB Command template for ELS_REQUEST64 */
3083dea3101eS typedef struct {
3084dea3101eS 	ULP_BDL bdl;
3085dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3086dea3101eS 	uint32_t word4Rsvd:7;
3087dea3101eS 	uint32_t fl:1;
3088dea3101eS 	uint32_t myID:24;
3089dea3101eS 	uint32_t word5Rsvd:8;
3090dea3101eS 	uint32_t remoteID:24;
3091dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3092dea3101eS 	uint32_t myID:24;
3093dea3101eS 	uint32_t fl:1;
3094dea3101eS 	uint32_t word4Rsvd:7;
3095dea3101eS 	uint32_t remoteID:24;
3096dea3101eS 	uint32_t word5Rsvd:8;
3097dea3101eS #endif
3098dea3101eS } ELS_REQUEST64;
3099dea3101eS 
3100dea3101eS /* IOCB Command template for GEN_REQUEST64 */
3101dea3101eS typedef struct {
3102dea3101eS 	ULP_BDL bdl;
3103dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3104dea3101eS 	WORD5 w5;		/* Header control/status word */
3105dea3101eS } GEN_REQUEST64;
3106dea3101eS 
3107dea3101eS /* IOCB Command template for RCV_ELS_REQ64 */
3108dea3101eS typedef struct {
3109dea3101eS 	struct ulp_bde64 elsReq;
3110dea3101eS 	uint32_t rcvd1;
3111dea3101eS 	uint32_t parmRo;
3112dea3101eS 
3113dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3114dea3101eS 	uint32_t word5Rsvd:8;
3115dea3101eS 	uint32_t remoteID:24;
3116dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3117dea3101eS 	uint32_t remoteID:24;
3118dea3101eS 	uint32_t word5Rsvd:8;
3119dea3101eS #endif
3120dea3101eS } RCV_ELS_REQ64;
3121dea3101eS 
31229c2face6SJames Smart /* IOCB Command template for RCV_SEQ64 */
31239c2face6SJames Smart struct rcv_seq64 {
31249c2face6SJames Smart 	struct ulp_bde64 elsReq;
31259c2face6SJames Smart 	uint32_t hbq_1;
31269c2face6SJames Smart 	uint32_t parmRo;
31279c2face6SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
31289c2face6SJames Smart 	uint32_t rctl:8;
31299c2face6SJames Smart 	uint32_t type:8;
31309c2face6SJames Smart 	uint32_t dfctl:8;
31319c2face6SJames Smart 	uint32_t ls:1;
31329c2face6SJames Smart 	uint32_t fs:1;
31339c2face6SJames Smart 	uint32_t rsvd2:3;
31349c2face6SJames Smart 	uint32_t si:1;
31359c2face6SJames Smart 	uint32_t bc:1;
31369c2face6SJames Smart 	uint32_t rsvd3:1;
31379c2face6SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
31389c2face6SJames Smart 	uint32_t rsvd3:1;
31399c2face6SJames Smart 	uint32_t bc:1;
31409c2face6SJames Smart 	uint32_t si:1;
31419c2face6SJames Smart 	uint32_t rsvd2:3;
31429c2face6SJames Smart 	uint32_t fs:1;
31439c2face6SJames Smart 	uint32_t ls:1;
31449c2face6SJames Smart 	uint32_t dfctl:8;
31459c2face6SJames Smart 	uint32_t type:8;
31469c2face6SJames Smart 	uint32_t rctl:8;
31479c2face6SJames Smart #endif
31489c2face6SJames Smart };
31499c2face6SJames Smart 
3150dea3101eS /* IOCB Command template for all 64 bit FCP Initiator commands */
3151dea3101eS typedef struct {
3152dea3101eS 	ULP_BDL bdl;
3153dea3101eS 	uint32_t fcpi_parm;
3154dea3101eS 	uint32_t fcpi_XRdy;	/* transfer ready for IWRITE */
3155dea3101eS } FCPI_FIELDS64;
3156dea3101eS 
3157dea3101eS /* IOCB Command template for all 64 bit FCP Target commands */
3158dea3101eS typedef struct {
3159dea3101eS 	ULP_BDL bdl;
3160dea3101eS 	uint32_t fcpt_Offset;
3161dea3101eS 	uint32_t fcpt_Length;	/* transfer ready for IWRITE */
3162dea3101eS } FCPT_FIELDS64;
3163dea3101eS 
316457127f15SJames Smart /* IOCB Command template for Async Status iocb commands */
316557127f15SJames Smart typedef struct {
316657127f15SJames Smart 	uint32_t rsvd[4];
316757127f15SJames Smart 	uint32_t param;
316857127f15SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
316957127f15SJames Smart 	uint16_t evt_code;		/* High order bits word 5 */
317057127f15SJames Smart 	uint16_t sub_ctxt_tag;		/* Low  order bits word 5 */
317157127f15SJames Smart #else   /*  __LITTLE_ENDIAN_BITFIELD */
317257127f15SJames Smart 	uint16_t sub_ctxt_tag;		/* High order bits word 5 */
317357127f15SJames Smart 	uint16_t evt_code;		/* Low  order bits word 5 */
317457127f15SJames Smart #endif
317557127f15SJames Smart } ASYNCSTAT_FIELDS;
317657127f15SJames Smart #define ASYNC_TEMP_WARN		0x100
317757127f15SJames Smart #define ASYNC_TEMP_SAFE		0x101
317857127f15SJames Smart 
3179ed957684SJames Smart /* IOCB Command template for CMD_IOCB_RCV_ELS64_CX (0xB7)
3180ed957684SJames Smart    or CMD_IOCB_RCV_SEQ64_CX (0xB5) */
3181ed957684SJames Smart 
3182ed957684SJames Smart struct rcv_sli3 {
3183ed957684SJames Smart 	uint32_t word8Rsvd;
3184ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3185ed957684SJames Smart 	uint16_t vpi;
3186ed957684SJames Smart 	uint16_t word9Rsvd;
3187ed957684SJames Smart #else  /*  __LITTLE_ENDIAN */
3188ed957684SJames Smart 	uint16_t word9Rsvd;
3189ed957684SJames Smart 	uint16_t vpi;
3190ed957684SJames Smart #endif
3191ed957684SJames Smart 	uint32_t word10Rsvd;
3192ed957684SJames Smart 	uint32_t acc_len;      /* accumulated length */
3193ed957684SJames Smart 	struct ulp_bde64 bde2;
3194ed957684SJames Smart };
3195ed957684SJames Smart 
319676bb24efSJames Smart /* Structure used for a single HBQ entry */
319776bb24efSJames Smart struct lpfc_hbq_entry {
319876bb24efSJames Smart 	struct ulp_bde64 bde;
319976bb24efSJames Smart 	uint32_t buffer_tag;
320076bb24efSJames Smart };
320192d7f7b0SJames Smart 
320276bb24efSJames Smart /* IOCB Command template for QUE_XRI64_CX (0xB3) command */
320376bb24efSJames Smart typedef struct {
320476bb24efSJames Smart 	struct lpfc_hbq_entry   buff;
320576bb24efSJames Smart 	uint32_t                rsvd;
320676bb24efSJames Smart 	uint32_t		rsvd1;
320776bb24efSJames Smart } QUE_XRI64_CX_FIELDS;
320876bb24efSJames Smart 
320976bb24efSJames Smart struct que_xri64cx_ext_fields {
321076bb24efSJames Smart 	uint32_t	iotag64_low;
321176bb24efSJames Smart 	uint32_t	iotag64_high;
321276bb24efSJames Smart 	uint32_t	ebde_count;
321376bb24efSJames Smart 	uint32_t	rsvd;
321476bb24efSJames Smart 	struct lpfc_hbq_entry	buff[5];
321576bb24efSJames Smart };
321692d7f7b0SJames Smart 
321734b02dcdSJames Smart #define LPFC_EXT_DATA_BDE_COUNT 3
321834b02dcdSJames Smart struct fcp_irw_ext {
321934b02dcdSJames Smart 	uint32_t	io_tag64_low;
322034b02dcdSJames Smart 	uint32_t	io_tag64_high;
322134b02dcdSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
322234b02dcdSJames Smart 	uint8_t		reserved1;
322334b02dcdSJames Smart 	uint8_t		reserved2;
322434b02dcdSJames Smart 	uint8_t		reserved3;
322534b02dcdSJames Smart 	uint8_t		ebde_count;
322634b02dcdSJames Smart #else  /* __LITTLE_ENDIAN */
322734b02dcdSJames Smart 	uint8_t		ebde_count;
322834b02dcdSJames Smart 	uint8_t		reserved3;
322934b02dcdSJames Smart 	uint8_t		reserved2;
323034b02dcdSJames Smart 	uint8_t		reserved1;
323134b02dcdSJames Smart #endif
323234b02dcdSJames Smart 	uint32_t	reserved4;
323334b02dcdSJames Smart 	struct ulp_bde64 rbde;		/* response bde */
323434b02dcdSJames Smart 	struct ulp_bde64 dbde[LPFC_EXT_DATA_BDE_COUNT];	/* data BDE or BPL */
323534b02dcdSJames Smart 	uint8_t icd[32];		/* immediate command data (32 bytes) */
323634b02dcdSJames Smart };
323734b02dcdSJames Smart 
3238dea3101eS typedef struct _IOCB {	/* IOCB structure */
3239dea3101eS 	union {
3240dea3101eS 		GENERIC_RSP grsp;	/* Generic response */
3241dea3101eS 		XR_SEQ_FIELDS xrseq;	/* XMIT / BCAST / RCV_SEQUENCE cmd */
3242dea3101eS 		struct ulp_bde cont[3];	/* up to 3 continuation bdes */
3243dea3101eS 		RCV_ELS_REQ rcvels;	/* RCV_ELS_REQ template */
3244dea3101eS 		AC_XRI acxri;	/* ABORT / CLOSE_XRI template */
3245dea3101eS 		A_MXRI64 amxri;	/* abort multiple xri command overlay */
3246dea3101eS 		GET_RPI getrpi;	/* GET_RPI template */
3247dea3101eS 		FCPI_FIELDS fcpi;	/* FCP Initiator template */
3248dea3101eS 		FCPT_FIELDS fcpt;	/* FCP target template */
3249dea3101eS 
3250dea3101eS 		/* SLI-2 structures */
3251dea3101eS 
3252dea3101eS 		struct ulp_bde64 cont64[2];  /* up to 2 64 bit continuation
3253ed957684SJames Smart 					      * bde_64s */
3254dea3101eS 		ELS_REQUEST64 elsreq64;	/* ELS_REQUEST template */
3255dea3101eS 		GEN_REQUEST64 genreq64;	/* GEN_REQUEST template */
3256dea3101eS 		RCV_ELS_REQ64 rcvels64;	/* RCV_ELS_REQ template */
3257dea3101eS 		XMT_SEQ_FIELDS64 xseq64;	/* XMIT / BCAST cmd */
3258dea3101eS 		FCPI_FIELDS64 fcpi64;	/* FCP 64 bit Initiator template */
3259dea3101eS 		FCPT_FIELDS64 fcpt64;	/* FCP 64 bit target template */
326057127f15SJames Smart 		ASYNCSTAT_FIELDS asyncstat; /* async_status iocb */
326176bb24efSJames Smart 		QUE_XRI64_CX_FIELDS quexri64cx; /* que_xri64_cx fields */
32629c2face6SJames Smart 		struct rcv_seq64 rcvseq64;	/* RCV_SEQ64 and RCV_CONT64 */
3263dea3101eS 
3264dea3101eS 		uint32_t ulpWord[IOCB_WORD_SZ - 2];	/* generic 6 'words' */
3265dea3101eS 	} un;
3266dea3101eS 	union {
3267dea3101eS 		struct {
3268dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3269dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
3270dea3101eS 			uint16_t ulpIoTag;	/* Low  order bits word 6 */
3271dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3272dea3101eS 			uint16_t ulpIoTag;	/* Low  order bits word 6 */
3273dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
3274dea3101eS #endif
3275dea3101eS 		} t1;
3276dea3101eS 		struct {
3277dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3278dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
3279dea3101eS 			uint16_t ulpIoTag1:2;	/* Low  order bits word 6 */
3280dea3101eS 			uint16_t ulpIoTag0:14;	/* Low  order bits word 6 */
3281dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3282dea3101eS 			uint16_t ulpIoTag0:14;	/* Low  order bits word 6 */
3283dea3101eS 			uint16_t ulpIoTag1:2;	/* Low  order bits word 6 */
3284dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
3285dea3101eS #endif
3286dea3101eS 		} t2;
3287dea3101eS 	} un1;
3288dea3101eS #define ulpContext un1.t1.ulpContext
3289dea3101eS #define ulpIoTag   un1.t1.ulpIoTag
3290dea3101eS #define ulpIoTag0  un1.t2.ulpIoTag0
3291dea3101eS 
3292dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3293dea3101eS 	uint32_t ulpTimeout:8;
3294dea3101eS 	uint32_t ulpXS:1;
3295dea3101eS 	uint32_t ulpFCP2Rcvy:1;
3296dea3101eS 	uint32_t ulpPU:2;
3297dea3101eS 	uint32_t ulpIr:1;
3298dea3101eS 	uint32_t ulpClass:3;
3299dea3101eS 	uint32_t ulpCommand:8;
3300dea3101eS 	uint32_t ulpStatus:4;
3301dea3101eS 	uint32_t ulpBdeCount:2;
3302dea3101eS 	uint32_t ulpLe:1;
3303dea3101eS 	uint32_t ulpOwner:1;	/* Low order bit word 7 */
3304dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3305dea3101eS 	uint32_t ulpOwner:1;	/* Low order bit word 7 */
3306dea3101eS 	uint32_t ulpLe:1;
3307dea3101eS 	uint32_t ulpBdeCount:2;
3308dea3101eS 	uint32_t ulpStatus:4;
3309dea3101eS 	uint32_t ulpCommand:8;
3310dea3101eS 	uint32_t ulpClass:3;
3311dea3101eS 	uint32_t ulpIr:1;
3312dea3101eS 	uint32_t ulpPU:2;
3313dea3101eS 	uint32_t ulpFCP2Rcvy:1;
3314dea3101eS 	uint32_t ulpXS:1;
3315dea3101eS 	uint32_t ulpTimeout:8;
3316dea3101eS #endif
331792d7f7b0SJames Smart 
3318ed957684SJames Smart 	union {
3319ed957684SJames Smart 		struct rcv_sli3 rcvsli3; /* words 8 - 15 */
332076bb24efSJames Smart 
332176bb24efSJames Smart 		/* words 8-31 used for que_xri_cx iocb */
332276bb24efSJames Smart 		struct que_xri64cx_ext_fields que_xri64cx_ext_words;
332334b02dcdSJames Smart 		struct fcp_irw_ext fcp_ext;
3324ed957684SJames Smart 		uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */
3325ed957684SJames Smart 	} unsli3;
3326dea3101eS 
3327ed957684SJames Smart #define ulpCt_h ulpXS
3328ed957684SJames Smart #define ulpCt_l ulpFCP2Rcvy
3329ed957684SJames Smart 
3330ed957684SJames Smart #define IOCB_FCP	   1	/* IOCB is used for FCP ELS cmds-ulpRsvByte */
3331ed957684SJames Smart #define IOCB_IP		   2	/* IOCB is used for IP ELS cmds */
3332dea3101eS #define PARM_UNUSED        0	/* PU field (Word 4) not used */
3333dea3101eS #define PARM_REL_OFF       1	/* PU field (Word 4) = R. O. */
3334dea3101eS #define PARM_READ_CHECK    2	/* PU field (Word 4) = Data Transfer Length */
333592d7f7b0SJames Smart #define PARM_NPIV_DID	   3
3336dea3101eS #define CLASS1             0	/* Class 1 */
3337dea3101eS #define CLASS2             1	/* Class 2 */
3338dea3101eS #define CLASS3             2	/* Class 3 */
3339dea3101eS #define CLASS_FCP_INTERMIX 7	/* FCP Data->Cls 1, all else->Cls 2 */
3340dea3101eS 
3341dea3101eS #define IOSTAT_SUCCESS         0x0	/* ulpStatus  - HBA defined */
3342dea3101eS #define IOSTAT_FCP_RSP_ERROR   0x1
3343dea3101eS #define IOSTAT_REMOTE_STOP     0x2
3344dea3101eS #define IOSTAT_LOCAL_REJECT    0x3
3345dea3101eS #define IOSTAT_NPORT_RJT       0x4
3346dea3101eS #define IOSTAT_FABRIC_RJT      0x5
3347dea3101eS #define IOSTAT_NPORT_BSY       0x6
3348dea3101eS #define IOSTAT_FABRIC_BSY      0x7
3349dea3101eS #define IOSTAT_INTERMED_RSP    0x8
3350dea3101eS #define IOSTAT_LS_RJT          0x9
3351dea3101eS #define IOSTAT_BA_RJT          0xA
3352dea3101eS #define IOSTAT_RSVD1           0xB
3353dea3101eS #define IOSTAT_RSVD2           0xC
3354dea3101eS #define IOSTAT_RSVD3           0xD
3355dea3101eS #define IOSTAT_RSVD4           0xE
335692d7f7b0SJames Smart #define IOSTAT_NEED_BUFFER     0xF
3357dea3101eS #define IOSTAT_DRIVER_REJECT   0x10   /* ulpStatus  - Driver defined */
3358dea3101eS #define IOSTAT_DEFAULT         0xF    /* Same as rsvd5 for now */
3359dea3101eS #define IOSTAT_CNT             0x11
3360dea3101eS 
3361dea3101eS } IOCB_t;
3362dea3101eS 
3363dea3101eS 
3364dea3101eS #define SLI1_SLIM_SIZE   (4 * 1024)
3365dea3101eS 
3366dea3101eS /* Up to 498 IOCBs will fit into 16k
3367dea3101eS  * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384
3368dea3101eS  */
3369ed957684SJames Smart #define SLI2_SLIM_SIZE   (64 * 1024)
3370dea3101eS 
3371dea3101eS /* Maximum IOCBs that will fit in SLI2 slim */
3372dea3101eS #define MAX_SLI2_IOCB    498
3373ed957684SJames Smart #define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \
3374ed957684SJames Smart 			    (sizeof(MAILBOX_t) + sizeof(PCB_t)))
3375ed957684SJames Smart 
3376ed957684SJames Smart /* HBQ entries are 4 words each = 4k */
3377ed957684SJames Smart #define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) *  \
3378ed957684SJames Smart 			     lpfc_sli_hbq_count())
3379dea3101eS 
3380dea3101eS struct lpfc_sli2_slim {
3381dea3101eS 	MAILBOX_t mbx;
3382dea3101eS 	PCB_t pcb;
3383ed957684SJames Smart 	IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE];
3384dea3101eS };
3385dea3101eS 
33862e0fef85SJames Smart /*
33872e0fef85SJames Smart  * This function checks PCI device to allow special handling for LC HBAs.
33882e0fef85SJames Smart  *
33892e0fef85SJames Smart  * Parameters:
33902e0fef85SJames Smart  * device : struct pci_dev 's device field
33912e0fef85SJames Smart  *
33922e0fef85SJames Smart  * return 1 => TRUE
33932e0fef85SJames Smart  *        0 => FALSE
33942e0fef85SJames Smart  */
3395dea3101eS static inline int
3396dea3101eS lpfc_is_LC_HBA(unsigned short device)
3397dea3101eS {
3398dea3101eS 	if ((device == PCI_DEVICE_ID_TFLY) ||
3399dea3101eS 	    (device == PCI_DEVICE_ID_PFLY) ||
3400dea3101eS 	    (device == PCI_DEVICE_ID_LP101) ||
3401dea3101eS 	    (device == PCI_DEVICE_ID_BMID) ||
3402dea3101eS 	    (device == PCI_DEVICE_ID_BSMB) ||
3403dea3101eS 	    (device == PCI_DEVICE_ID_ZMID) ||
3404dea3101eS 	    (device == PCI_DEVICE_ID_ZSMB) ||
340509372820SJames Smart 	    (device == PCI_DEVICE_ID_SAT_MID) ||
340609372820SJames Smart 	    (device == PCI_DEVICE_ID_SAT_SMB) ||
3407dea3101eS 	    (device == PCI_DEVICE_ID_RFLY))
3408dea3101eS 		return 1;
3409dea3101eS 	else
3410dea3101eS 		return 0;
3411dea3101eS }
3412858c9f6cSJames Smart 
3413858c9f6cSJames Smart /*
3414858c9f6cSJames Smart  * Determine if an IOCB failed because of a link event or firmware reset.
3415858c9f6cSJames Smart  */
3416858c9f6cSJames Smart 
3417858c9f6cSJames Smart static inline int
3418858c9f6cSJames Smart lpfc_error_lost_link(IOCB_t *iocbp)
3419858c9f6cSJames Smart {
3420858c9f6cSJames Smart 	return (iocbp->ulpStatus == IOSTAT_LOCAL_REJECT &&
3421858c9f6cSJames Smart 		(iocbp->un.ulpWord[4] == IOERR_SLI_ABORTED ||
3422858c9f6cSJames Smart 		 iocbp->un.ulpWord[4] == IOERR_LINK_DOWN ||
3423858c9f6cSJames Smart 		 iocbp->un.ulpWord[4] == IOERR_SLI_DOWN));
3424858c9f6cSJames Smart }
342584774a4dSJames Smart 
342684774a4dSJames Smart #define MENLO_TRANSPORT_TYPE 0xfe
342784774a4dSJames Smart #define MENLO_CONTEXT 0
342884774a4dSJames Smart #define MENLO_PU 3
342984774a4dSJames Smart #define MENLO_TIMEOUT 30
343084774a4dSJames Smart #define SETVAR_MLOMNT 0x103107
343184774a4dSJames Smart #define SETVAR_MLORST 0x103007
3432