xref: /linux/drivers/scsi/lpfc/lpfc_hw.h (revision cb69f7decc3777822b240c46890a209df288c7bb)
1dea3101eS /*******************************************************************
2dea3101eS  * This file is part of the Emulex Linux Device Driver for         *
3c44ce173SJames.Smart@Emulex.Com  * Fibre Channel Host Bus Adapters.                                *
44fede78fSJames Smart  * Copyright (C) 2004-2010 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 
676d368e53SJames Smart #define LPFC_UNREG_ALL_RPIS_VPORT	0xffff
686d368e53SJames Smart #define LPFC_UNREG_ALL_DFLT_RPIS	0xffffffff
6992d7f7b0SJames Smart 
70ddcc50f0SJames Smart /* vendor ID used in SCSI netlink calls */
71ddcc50f0SJames Smart #define LPFC_NL_VENDOR_ID (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX)
72ddcc50f0SJames Smart 
73dea3101eS /* Common Transport structures and definitions */
74dea3101eS 
75dea3101eS union CtRevisionId {
76dea3101eS 	/* Structure is in Big Endian format */
77dea3101eS 	struct {
78dea3101eS 		uint32_t Revision:8;
79dea3101eS 		uint32_t InId:24;
80dea3101eS 	} bits;
81dea3101eS 	uint32_t word;
82dea3101eS };
83dea3101eS 
84dea3101eS union CtCommandResponse {
85dea3101eS 	/* Structure is in Big Endian format */
86dea3101eS 	struct {
87dea3101eS 		uint32_t CmdRsp:16;
88dea3101eS 		uint32_t Size:16;
89dea3101eS 	} bits;
90dea3101eS 	uint32_t word;
91dea3101eS };
92dea3101eS 
9392d7f7b0SJames Smart #define FC4_FEATURE_INIT 0x2
9492d7f7b0SJames Smart #define FC4_FEATURE_TARGET 0x1
9592d7f7b0SJames Smart 
96dea3101eS struct lpfc_sli_ct_request {
97dea3101eS 	/* Structure is in Big Endian format */
98dea3101eS 	union CtRevisionId RevisionId;
99dea3101eS 	uint8_t FsType;
100dea3101eS 	uint8_t FsSubType;
101dea3101eS 	uint8_t Options;
102dea3101eS 	uint8_t Rsrvd1;
103dea3101eS 	union CtCommandResponse CommandResponse;
104dea3101eS 	uint8_t Rsrvd2;
105dea3101eS 	uint8_t ReasonCode;
106dea3101eS 	uint8_t Explanation;
107dea3101eS 	uint8_t VendorUnique;
108dea3101eS 
109dea3101eS 	union {
110dea3101eS 		uint32_t PortID;
111dea3101eS 		struct gid {
112dea3101eS 			uint8_t PortType;	/* for GID_PT requests */
113dea3101eS 			uint8_t DomainScope;
114dea3101eS 			uint8_t AreaScope;
115dea3101eS 			uint8_t Fc4Type;	/* for GID_FT requests */
116dea3101eS 		} gid;
117dea3101eS 		struct rft {
118dea3101eS 			uint32_t PortId;	/* For RFT_ID requests */
119dea3101eS 
120dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
121dea3101eS 			uint32_t rsvd0:16;
122dea3101eS 			uint32_t rsvd1:7;
123dea3101eS 			uint32_t fcpReg:1;	/* Type 8 */
124dea3101eS 			uint32_t rsvd2:2;
125dea3101eS 			uint32_t ipReg:1;	/* Type 5 */
126dea3101eS 			uint32_t rsvd3:5;
127dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
128dea3101eS 			uint32_t rsvd0:16;
129dea3101eS 			uint32_t fcpReg:1;	/* Type 8 */
130dea3101eS 			uint32_t rsvd1:7;
131dea3101eS 			uint32_t rsvd3:5;
132dea3101eS 			uint32_t ipReg:1;	/* Type 5 */
133dea3101eS 			uint32_t rsvd2:2;
134dea3101eS #endif
135dea3101eS 
136dea3101eS 			uint32_t rsvd[7];
137dea3101eS 		} rft;
138dea3101eS 		struct rnn {
139dea3101eS 			uint32_t PortId;	/* For RNN_ID requests */
140dea3101eS 			uint8_t wwnn[8];
141dea3101eS 		} rnn;
142dea3101eS 		struct rsnn {	/* For RSNN_ID requests */
143dea3101eS 			uint8_t wwnn[8];
144dea3101eS 			uint8_t len;
145dea3101eS 			uint8_t symbname[255];
146dea3101eS 		} rsnn;
1477ee5d43eSJames Smart 		struct da_id { /* For DA_ID requests */
1487ee5d43eSJames Smart 			uint32_t port_id;
1497ee5d43eSJames Smart 		} da_id;
15092d7f7b0SJames Smart 		struct rspn {	/* For RSPN_ID requests */
15192d7f7b0SJames Smart 			uint32_t PortId;
15292d7f7b0SJames Smart 			uint8_t len;
15392d7f7b0SJames Smart 			uint8_t symbname[255];
15492d7f7b0SJames Smart 		} rspn;
15592d7f7b0SJames Smart 		struct gff {
15692d7f7b0SJames Smart 			uint32_t PortId;
15792d7f7b0SJames Smart 		} gff;
15892d7f7b0SJames Smart 		struct gff_acc {
15992d7f7b0SJames Smart 			uint8_t fbits[128];
16092d7f7b0SJames Smart 		} gff_acc;
16151ef4c26SJames Smart #define FCP_TYPE_FEATURE_OFFSET 7
16292d7f7b0SJames Smart 		struct rff {
16392d7f7b0SJames Smart 			uint32_t PortId;
16492d7f7b0SJames Smart 			uint8_t reserved[2];
16592d7f7b0SJames Smart 			uint8_t fbits;
16692d7f7b0SJames Smart 			uint8_t type_code;     /* type=8 for FCP */
16792d7f7b0SJames Smart 		} rff;
168dea3101eS 	} un;
169dea3101eS };
170dea3101eS 
171dea3101eS #define  SLI_CT_REVISION        1
17292d7f7b0SJames Smart #define  GID_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17392d7f7b0SJames Smart 			   sizeof(struct gid))
17492d7f7b0SJames Smart #define  GFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17592d7f7b0SJames Smart 			   sizeof(struct gff))
17692d7f7b0SJames Smart #define  RFT_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17792d7f7b0SJames Smart 			   sizeof(struct rft))
17892d7f7b0SJames Smart #define  RFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17992d7f7b0SJames Smart 			   sizeof(struct rff))
18092d7f7b0SJames Smart #define  RNN_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
18192d7f7b0SJames Smart 			   sizeof(struct rnn))
18292d7f7b0SJames Smart #define  RSNN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
18392d7f7b0SJames Smart 			   sizeof(struct rsnn))
1847ee5d43eSJames Smart #define DA_ID_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
1857ee5d43eSJames Smart 			  sizeof(struct da_id))
18692d7f7b0SJames Smart #define  RSPN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
18792d7f7b0SJames Smart 			   sizeof(struct rspn))
188dea3101eS 
189dea3101eS /*
190dea3101eS  * FsType Definitions
191dea3101eS  */
192dea3101eS 
193dea3101eS #define  SLI_CT_MANAGEMENT_SERVICE        0xFA
194dea3101eS #define  SLI_CT_TIME_SERVICE              0xFB
195dea3101eS #define  SLI_CT_DIRECTORY_SERVICE         0xFC
196dea3101eS #define  SLI_CT_FABRIC_CONTROLLER_SERVICE 0xFD
197dea3101eS 
198dea3101eS /*
199dea3101eS  * Directory Service Subtypes
200dea3101eS  */
201dea3101eS 
202dea3101eS #define  SLI_CT_DIRECTORY_NAME_SERVER     0x02
203dea3101eS 
204dea3101eS /*
205dea3101eS  * Response Codes
206dea3101eS  */
207dea3101eS 
208dea3101eS #define  SLI_CT_RESPONSE_FS_RJT           0x8001
209dea3101eS #define  SLI_CT_RESPONSE_FS_ACC           0x8002
210dea3101eS 
211dea3101eS /*
212dea3101eS  * Reason Codes
213dea3101eS  */
214dea3101eS 
215dea3101eS #define  SLI_CT_NO_ADDITIONAL_EXPL	  0x0
216dea3101eS #define  SLI_CT_INVALID_COMMAND           0x01
217dea3101eS #define  SLI_CT_INVALID_VERSION           0x02
218dea3101eS #define  SLI_CT_LOGICAL_ERROR             0x03
219dea3101eS #define  SLI_CT_INVALID_IU_SIZE           0x04
220dea3101eS #define  SLI_CT_LOGICAL_BUSY              0x05
221dea3101eS #define  SLI_CT_PROTOCOL_ERROR            0x07
222dea3101eS #define  SLI_CT_UNABLE_TO_PERFORM_REQ     0x09
223dea3101eS #define  SLI_CT_REQ_NOT_SUPPORTED         0x0b
224dea3101eS #define  SLI_CT_HBA_INFO_NOT_REGISTERED	  0x10
225dea3101eS #define  SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE  0x11
226dea3101eS #define  SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN      0x12
227dea3101eS #define  SLI_CT_HBA_ATTR_NOT_PRESENT	  0x13
228dea3101eS #define  SLI_CT_PORT_INFO_NOT_REGISTERED  0x20
229dea3101eS #define  SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE 0x21
230dea3101eS #define  SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN     0x22
231dea3101eS #define  SLI_CT_VENDOR_UNIQUE             0xff
232dea3101eS 
233dea3101eS /*
234dea3101eS  * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
235dea3101eS  */
236dea3101eS 
237dea3101eS #define  SLI_CT_NO_PORT_ID                0x01
238dea3101eS #define  SLI_CT_NO_PORT_NAME              0x02
239dea3101eS #define  SLI_CT_NO_NODE_NAME              0x03
240dea3101eS #define  SLI_CT_NO_CLASS_OF_SERVICE       0x04
241dea3101eS #define  SLI_CT_NO_IP_ADDRESS             0x05
242dea3101eS #define  SLI_CT_NO_IPA                    0x06
243dea3101eS #define  SLI_CT_NO_FC4_TYPES              0x07
244dea3101eS #define  SLI_CT_NO_SYMBOLIC_PORT_NAME     0x08
245dea3101eS #define  SLI_CT_NO_SYMBOLIC_NODE_NAME     0x09
246dea3101eS #define  SLI_CT_NO_PORT_TYPE              0x0A
247dea3101eS #define  SLI_CT_ACCESS_DENIED             0x10
248dea3101eS #define  SLI_CT_INVALID_PORT_ID           0x11
249dea3101eS #define  SLI_CT_DATABASE_EMPTY            0x12
250dea3101eS 
251dea3101eS /*
252dea3101eS  * Name Server Command Codes
253dea3101eS  */
254dea3101eS 
255dea3101eS #define  SLI_CTNS_GA_NXT      0x0100
256dea3101eS #define  SLI_CTNS_GPN_ID      0x0112
257dea3101eS #define  SLI_CTNS_GNN_ID      0x0113
258dea3101eS #define  SLI_CTNS_GCS_ID      0x0114
259dea3101eS #define  SLI_CTNS_GFT_ID      0x0117
260dea3101eS #define  SLI_CTNS_GSPN_ID     0x0118
261dea3101eS #define  SLI_CTNS_GPT_ID      0x011A
26292d7f7b0SJames Smart #define  SLI_CTNS_GFF_ID      0x011F
263dea3101eS #define  SLI_CTNS_GID_PN      0x0121
264dea3101eS #define  SLI_CTNS_GID_NN      0x0131
265dea3101eS #define  SLI_CTNS_GIP_NN      0x0135
266dea3101eS #define  SLI_CTNS_GIPA_NN     0x0136
267dea3101eS #define  SLI_CTNS_GSNN_NN     0x0139
268dea3101eS #define  SLI_CTNS_GNN_IP      0x0153
269dea3101eS #define  SLI_CTNS_GIPA_IP     0x0156
270dea3101eS #define  SLI_CTNS_GID_FT      0x0171
271dea3101eS #define  SLI_CTNS_GID_PT      0x01A1
272dea3101eS #define  SLI_CTNS_RPN_ID      0x0212
273dea3101eS #define  SLI_CTNS_RNN_ID      0x0213
274dea3101eS #define  SLI_CTNS_RCS_ID      0x0214
275dea3101eS #define  SLI_CTNS_RFT_ID      0x0217
276dea3101eS #define  SLI_CTNS_RSPN_ID     0x0218
277dea3101eS #define  SLI_CTNS_RPT_ID      0x021A
27892d7f7b0SJames Smart #define  SLI_CTNS_RFF_ID      0x021F
279dea3101eS #define  SLI_CTNS_RIP_NN      0x0235
280dea3101eS #define  SLI_CTNS_RIPA_NN     0x0236
281dea3101eS #define  SLI_CTNS_RSNN_NN     0x0239
282dea3101eS #define  SLI_CTNS_DA_ID       0x0300
283dea3101eS 
284dea3101eS /*
285dea3101eS  * Port Types
286dea3101eS  */
287dea3101eS 
288dea3101eS #define  SLI_CTPT_N_PORT      0x01
289dea3101eS #define  SLI_CTPT_NL_PORT     0x02
290dea3101eS #define  SLI_CTPT_FNL_PORT    0x03
291dea3101eS #define  SLI_CTPT_IP          0x04
292dea3101eS #define  SLI_CTPT_FCP         0x08
293dea3101eS #define  SLI_CTPT_NX_PORT     0x7F
294dea3101eS #define  SLI_CTPT_F_PORT      0x81
295dea3101eS #define  SLI_CTPT_FL_PORT     0x82
296dea3101eS #define  SLI_CTPT_E_PORT      0x84
297dea3101eS 
298dea3101eS #define SLI_CT_LAST_ENTRY     0x80000000
299dea3101eS 
300dea3101eS /* Fibre Channel Service Parameter definitions */
301dea3101eS 
302dea3101eS #define FC_PH_4_0   6		/* FC-PH version 4.0 */
303dea3101eS #define FC_PH_4_1   7		/* FC-PH version 4.1 */
304dea3101eS #define FC_PH_4_2   8		/* FC-PH version 4.2 */
305dea3101eS #define FC_PH_4_3   9		/* FC-PH version 4.3 */
306dea3101eS 
307dea3101eS #define FC_PH_LOW   8		/* Lowest supported FC-PH version */
308dea3101eS #define FC_PH_HIGH  9		/* Highest supported FC-PH version */
309dea3101eS #define FC_PH3   0x20		/* FC-PH-3 version */
310dea3101eS 
311dea3101eS #define FF_FRAME_SIZE     2048
312dea3101eS 
313dea3101eS struct lpfc_name {
314f631b4beSAndrew Vasquez 	union {
315f631b4beSAndrew Vasquez 		struct {
316dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
317dea3101eS 			uint8_t nameType:4;	/* FC Word 0, bit 28:31 */
3181de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit
3191de933f3SJames.Smart@Emulex.Com 						   8:11 of IEEE ext */
320dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3211de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit
3221de933f3SJames.Smart@Emulex.Com 						   8:11 of IEEE ext */
323dea3101eS 			uint8_t nameType:4;	/* FC Word 0, bit 28:31 */
324dea3101eS #endif
325dea3101eS 
326dea3101eS #define NAME_IEEE           0x1	/* IEEE name - nameType */
327dea3101eS #define NAME_IEEE_EXT       0x2	/* IEEE extended name */
328dea3101eS #define NAME_FC_TYPE        0x3	/* FC native name type */
329dea3101eS #define NAME_IP_TYPE        0x4	/* IP address */
330dea3101eS #define NAME_CCITT_TYPE     0xC
331dea3101eS #define NAME_CCITT_GR_TYPE  0xE
3321de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextLsb;	/* FC Word 0, bit 16:23, IEEE
3331de933f3SJames.Smart@Emulex.Com 						   extended Lsb */
334dea3101eS 			uint8_t IEEE[6];	/* FC IEEE address */
33568ce1eb5SAndrew Morton 		} s;
336f631b4beSAndrew Vasquez 		uint8_t wwn[8];
33768ce1eb5SAndrew Morton 	} u;
338f631b4beSAndrew Vasquez };
339dea3101eS 
340dea3101eS struct csp {
341dea3101eS 	uint8_t fcphHigh;	/* FC Word 0, byte 0 */
342dea3101eS 	uint8_t fcphLow;
343dea3101eS 	uint8_t bbCreditMsb;
344dea3101eS 	uint8_t bbCreditlsb;	/* FC Word 0, byte 3 */
345dea3101eS 
34692494144SJames Smart /*
34792494144SJames Smart  * Word 1 Bit 31 in common service parameter is overloaded.
34892494144SJames Smart  * Word 1 Bit 31 in FLOGI request is multiple NPort request
34992494144SJames Smart  * Word 1 Bit 31 in FLOGI response is clean address bit
35092494144SJames Smart  */
35192494144SJames Smart #define clean_address_bit request_multiple_Nport /* Word 1, bit 31 */
352dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
35392d7f7b0SJames Smart 	uint16_t request_multiple_Nport:1;	/* FC Word 1, bit 31 */
35492d7f7b0SJames Smart 	uint16_t randomOffset:1;	/* FC Word 1, bit 30 */
35592d7f7b0SJames Smart 	uint16_t response_multiple_NPort:1;	/* FC Word 1, bit 29 */
356dea3101eS 	uint16_t fPort:1;	/* FC Word 1, bit 28 */
357dea3101eS 	uint16_t altBbCredit:1;	/* FC Word 1, bit 27 */
358dea3101eS 	uint16_t edtovResolution:1;	/* FC Word 1, bit 26 */
359dea3101eS 	uint16_t multicast:1;	/* FC Word 1, bit 25 */
360dea3101eS 	uint16_t broadcast:1;	/* FC Word 1, bit 24 */
361dea3101eS 
362dea3101eS 	uint16_t huntgroup:1;	/* FC Word 1, bit 23 */
363dea3101eS 	uint16_t simplex:1;	/* FC Word 1, bit 22 */
364dea3101eS 	uint16_t word1Reserved1:3;	/* FC Word 1, bit 21:19 */
365dea3101eS 	uint16_t dhd:1;		/* FC Word 1, bit 18 */
366dea3101eS 	uint16_t contIncSeqCnt:1;	/* FC Word 1, bit 17 */
367dea3101eS 	uint16_t payloadlength:1;	/* FC Word 1, bit 16 */
368dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
369dea3101eS 	uint16_t broadcast:1;	/* FC Word 1, bit 24 */
370dea3101eS 	uint16_t multicast:1;	/* FC Word 1, bit 25 */
371dea3101eS 	uint16_t edtovResolution:1;	/* FC Word 1, bit 26 */
372dea3101eS 	uint16_t altBbCredit:1;	/* FC Word 1, bit 27 */
373dea3101eS 	uint16_t fPort:1;	/* FC Word 1, bit 28 */
37492d7f7b0SJames Smart 	uint16_t response_multiple_NPort:1;	/* FC Word 1, bit 29 */
375dea3101eS 	uint16_t randomOffset:1;	/* FC Word 1, bit 30 */
37692d7f7b0SJames Smart 	uint16_t request_multiple_Nport:1;	/* FC Word 1, bit 31 */
377dea3101eS 
378dea3101eS 	uint16_t payloadlength:1;	/* FC Word 1, bit 16 */
379dea3101eS 	uint16_t contIncSeqCnt:1;	/* FC Word 1, bit 17 */
380dea3101eS 	uint16_t dhd:1;		/* FC Word 1, bit 18 */
381dea3101eS 	uint16_t word1Reserved1:3;	/* FC Word 1, bit 21:19 */
382dea3101eS 	uint16_t simplex:1;	/* FC Word 1, bit 22 */
383dea3101eS 	uint16_t huntgroup:1;	/* FC Word 1, bit 23 */
384dea3101eS #endif
385dea3101eS 
386dea3101eS 	uint8_t bbRcvSizeMsb;	/* Upper nibble is reserved */
387dea3101eS 	uint8_t bbRcvSizeLsb;	/* FC Word 1, byte 3 */
388dea3101eS 	union {
389dea3101eS 		struct {
390dea3101eS 			uint8_t word2Reserved1;	/* FC Word 2 byte 0 */
391dea3101eS 
392dea3101eS 			uint8_t totalConcurrSeq;	/* FC Word 2 byte 1 */
393dea3101eS 			uint8_t roByCategoryMsb;	/* FC Word 2 byte 2 */
394dea3101eS 
395dea3101eS 			uint8_t roByCategoryLsb;	/* FC Word 2 byte 3 */
396dea3101eS 		} nPort;
397dea3101eS 		uint32_t r_a_tov;	/* R_A_TOV must be in B.E. format */
398dea3101eS 	} w2;
399dea3101eS 
400dea3101eS 	uint32_t e_d_tov;	/* E_D_TOV must be in B.E. format */
401dea3101eS };
402dea3101eS 
403dea3101eS struct class_parms {
404dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
405dea3101eS 	uint8_t classValid:1;	/* FC Word 0, bit 31 */
406dea3101eS 	uint8_t intermix:1;	/* FC Word 0, bit 30 */
407dea3101eS 	uint8_t stackedXparent:1;	/* FC Word 0, bit 29 */
408dea3101eS 	uint8_t stackedLockDown:1;	/* FC Word 0, bit 28 */
409dea3101eS 	uint8_t seqDelivery:1;	/* FC Word 0, bit 27 */
410dea3101eS 	uint8_t word0Reserved1:3;	/* FC Word 0, bit 24:26 */
411dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
412dea3101eS 	uint8_t word0Reserved1:3;	/* FC Word 0, bit 24:26 */
413dea3101eS 	uint8_t seqDelivery:1;	/* FC Word 0, bit 27 */
414dea3101eS 	uint8_t stackedLockDown:1;	/* FC Word 0, bit 28 */
415dea3101eS 	uint8_t stackedXparent:1;	/* FC Word 0, bit 29 */
416dea3101eS 	uint8_t intermix:1;	/* FC Word 0, bit 30 */
417dea3101eS 	uint8_t classValid:1;	/* FC Word 0, bit 31 */
418dea3101eS 
419dea3101eS #endif
420dea3101eS 
421dea3101eS 	uint8_t word0Reserved2;	/* FC Word 0, bit 16:23 */
422dea3101eS 
423dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
424dea3101eS 	uint8_t iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
425dea3101eS 	uint8_t iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
426dea3101eS 	uint8_t iCtlAck0capable:1;	/* FC Word 0, bit 11 */
427dea3101eS 	uint8_t iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
428dea3101eS 	uint8_t word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
429dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
430dea3101eS 	uint8_t word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
431dea3101eS 	uint8_t iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
432dea3101eS 	uint8_t iCtlAck0capable:1;	/* FC Word 0, bit 11 */
433dea3101eS 	uint8_t iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
434dea3101eS 	uint8_t iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
435dea3101eS #endif
436dea3101eS 
437dea3101eS 	uint8_t word0Reserved4;	/* FC Word 0, bit  0: 7 */
438dea3101eS 
439dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
440dea3101eS 	uint8_t rCtlAck0capable:1;	/* FC Word 1, bit 31 */
441dea3101eS 	uint8_t rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
442dea3101eS 	uint8_t rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
443dea3101eS 	uint8_t rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
444dea3101eS 	uint8_t word1Reserved1:1;	/* FC Word 1, bit 26 */
445dea3101eS 	uint8_t rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
446dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
447dea3101eS 	uint8_t rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
448dea3101eS 	uint8_t word1Reserved1:1;	/* FC Word 1, bit 26 */
449dea3101eS 	uint8_t rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
450dea3101eS 	uint8_t rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
451dea3101eS 	uint8_t rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
452dea3101eS 	uint8_t rCtlAck0capable:1;	/* FC Word 1, bit 31 */
453dea3101eS #endif
454dea3101eS 
455dea3101eS 	uint8_t word1Reserved2;	/* FC Word 1, bit 16:23 */
456dea3101eS 	uint8_t rcvDataSizeMsb;	/* FC Word 1, bit  8:15 */
457dea3101eS 	uint8_t rcvDataSizeLsb;	/* FC Word 1, bit  0: 7 */
458dea3101eS 
459dea3101eS 	uint8_t concurrentSeqMsb;	/* FC Word 2, bit 24:31 */
460dea3101eS 	uint8_t concurrentSeqLsb;	/* FC Word 2, bit 16:23 */
461dea3101eS 	uint8_t EeCreditSeqMsb;	/* FC Word 2, bit  8:15 */
462dea3101eS 	uint8_t EeCreditSeqLsb;	/* FC Word 2, bit  0: 7 */
463dea3101eS 
464dea3101eS 	uint8_t openSeqPerXchgMsb;	/* FC Word 3, bit 24:31 */
465dea3101eS 	uint8_t openSeqPerXchgLsb;	/* FC Word 3, bit 16:23 */
466dea3101eS 	uint8_t word3Reserved1;	/* Fc Word 3, bit  8:15 */
467dea3101eS 	uint8_t word3Reserved2;	/* Fc Word 3, bit  0: 7 */
468dea3101eS };
469dea3101eS 
470dea3101eS struct serv_parm {	/* Structure is in Big Endian format */
471dea3101eS 	struct csp cmn;
472dea3101eS 	struct lpfc_name portName;
473dea3101eS 	struct lpfc_name nodeName;
474dea3101eS 	struct class_parms cls1;
475dea3101eS 	struct class_parms cls2;
476dea3101eS 	struct class_parms cls3;
477dea3101eS 	struct class_parms cls4;
478dea3101eS 	uint8_t vendorVersion[16];
479dea3101eS };
480dea3101eS 
481dea3101eS /*
482da0436e9SJames Smart  * Virtual Fabric Tagging Header
483da0436e9SJames Smart  */
484da0436e9SJames Smart struct fc_vft_header {
485da0436e9SJames Smart 	 uint32_t word0;
486da0436e9SJames Smart #define fc_vft_hdr_r_ctl_SHIFT		24
487da0436e9SJames Smart #define fc_vft_hdr_r_ctl_MASK		0xFF
488da0436e9SJames Smart #define fc_vft_hdr_r_ctl_WORD		word0
489da0436e9SJames Smart #define fc_vft_hdr_ver_SHIFT		22
490da0436e9SJames Smart #define fc_vft_hdr_ver_MASK		0x3
491da0436e9SJames Smart #define fc_vft_hdr_ver_WORD		word0
492da0436e9SJames Smart #define fc_vft_hdr_type_SHIFT		18
493da0436e9SJames Smart #define fc_vft_hdr_type_MASK		0xF
494da0436e9SJames Smart #define fc_vft_hdr_type_WORD		word0
495da0436e9SJames Smart #define fc_vft_hdr_e_SHIFT		16
496da0436e9SJames Smart #define fc_vft_hdr_e_MASK		0x1
497da0436e9SJames Smart #define fc_vft_hdr_e_WORD		word0
498da0436e9SJames Smart #define fc_vft_hdr_priority_SHIFT	13
499da0436e9SJames Smart #define fc_vft_hdr_priority_MASK	0x7
500da0436e9SJames Smart #define fc_vft_hdr_priority_WORD	word0
501da0436e9SJames Smart #define fc_vft_hdr_vf_id_SHIFT		1
502da0436e9SJames Smart #define fc_vft_hdr_vf_id_MASK		0xFFF
503da0436e9SJames Smart #define fc_vft_hdr_vf_id_WORD		word0
504da0436e9SJames Smart 	uint32_t word1;
505da0436e9SJames Smart #define fc_vft_hdr_hopct_SHIFT		24
506da0436e9SJames Smart #define fc_vft_hdr_hopct_MASK		0xFF
507da0436e9SJames Smart #define fc_vft_hdr_hopct_WORD		word1
508da0436e9SJames Smart };
509da0436e9SJames Smart 
510da0436e9SJames Smart /*
511dea3101eS  *  Extended Link Service LS_COMMAND codes (Payload Word 0)
512dea3101eS  */
513dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
514dea3101eS #define ELS_CMD_MASK      0xffff0000
515dea3101eS #define ELS_RSP_MASK      0xff000000
516dea3101eS #define ELS_CMD_LS_RJT    0x01000000
517dea3101eS #define ELS_CMD_ACC       0x02000000
518dea3101eS #define ELS_CMD_PLOGI     0x03000000
519dea3101eS #define ELS_CMD_FLOGI     0x04000000
520dea3101eS #define ELS_CMD_LOGO      0x05000000
521dea3101eS #define ELS_CMD_ABTX      0x06000000
522dea3101eS #define ELS_CMD_RCS       0x07000000
523dea3101eS #define ELS_CMD_RES       0x08000000
524dea3101eS #define ELS_CMD_RSS       0x09000000
525dea3101eS #define ELS_CMD_RSI       0x0A000000
526dea3101eS #define ELS_CMD_ESTS      0x0B000000
527dea3101eS #define ELS_CMD_ESTC      0x0C000000
528dea3101eS #define ELS_CMD_ADVC      0x0D000000
529dea3101eS #define ELS_CMD_RTV       0x0E000000
530dea3101eS #define ELS_CMD_RLS       0x0F000000
531dea3101eS #define ELS_CMD_ECHO      0x10000000
532dea3101eS #define ELS_CMD_TEST      0x11000000
533dea3101eS #define ELS_CMD_RRQ       0x12000000
534dea3101eS #define ELS_CMD_PRLI      0x20100014
535dea3101eS #define ELS_CMD_PRLO      0x21100014
53682d9a2a2SJames Smart #define ELS_CMD_PRLO_ACC  0x02100014
537dea3101eS #define ELS_CMD_PDISC     0x50000000
538dea3101eS #define ELS_CMD_FDISC     0x51000000
539dea3101eS #define ELS_CMD_ADISC     0x52000000
540dea3101eS #define ELS_CMD_FARP      0x54000000
541dea3101eS #define ELS_CMD_FARPR     0x55000000
5427bb3b137SJamie Wellnitz #define ELS_CMD_RPS       0x56000000
5437bb3b137SJamie Wellnitz #define ELS_CMD_RPL       0x57000000
544dea3101eS #define ELS_CMD_FAN       0x60000000
545dea3101eS #define ELS_CMD_RSCN      0x61040000
546dea3101eS #define ELS_CMD_SCR       0x62000000
547dea3101eS #define ELS_CMD_RNID      0x78000000
5487bb3b137SJamie Wellnitz #define ELS_CMD_LIRR      0x7A000000
549dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
550dea3101eS #define ELS_CMD_MASK      0xffff
551dea3101eS #define ELS_RSP_MASK      0xff
552dea3101eS #define ELS_CMD_LS_RJT    0x01
553dea3101eS #define ELS_CMD_ACC       0x02
554dea3101eS #define ELS_CMD_PLOGI     0x03
555dea3101eS #define ELS_CMD_FLOGI     0x04
556dea3101eS #define ELS_CMD_LOGO      0x05
557dea3101eS #define ELS_CMD_ABTX      0x06
558dea3101eS #define ELS_CMD_RCS       0x07
559dea3101eS #define ELS_CMD_RES       0x08
560dea3101eS #define ELS_CMD_RSS       0x09
561dea3101eS #define ELS_CMD_RSI       0x0A
562dea3101eS #define ELS_CMD_ESTS      0x0B
563dea3101eS #define ELS_CMD_ESTC      0x0C
564dea3101eS #define ELS_CMD_ADVC      0x0D
565dea3101eS #define ELS_CMD_RTV       0x0E
566dea3101eS #define ELS_CMD_RLS       0x0F
567dea3101eS #define ELS_CMD_ECHO      0x10
568dea3101eS #define ELS_CMD_TEST      0x11
569dea3101eS #define ELS_CMD_RRQ       0x12
570dea3101eS #define ELS_CMD_PRLI      0x14001020
571dea3101eS #define ELS_CMD_PRLO      0x14001021
57282d9a2a2SJames Smart #define ELS_CMD_PRLO_ACC  0x14001002
573dea3101eS #define ELS_CMD_PDISC     0x50
574dea3101eS #define ELS_CMD_FDISC     0x51
575dea3101eS #define ELS_CMD_ADISC     0x52
576dea3101eS #define ELS_CMD_FARP      0x54
577dea3101eS #define ELS_CMD_FARPR     0x55
5787bb3b137SJamie Wellnitz #define ELS_CMD_RPS       0x56
5797bb3b137SJamie Wellnitz #define ELS_CMD_RPL       0x57
580dea3101eS #define ELS_CMD_FAN       0x60
581dea3101eS #define ELS_CMD_RSCN      0x0461
582dea3101eS #define ELS_CMD_SCR       0x62
583dea3101eS #define ELS_CMD_RNID      0x78
5847bb3b137SJamie Wellnitz #define ELS_CMD_LIRR      0x7A
585dea3101eS #endif
586dea3101eS 
587dea3101eS /*
588dea3101eS  *  LS_RJT Payload Definition
589dea3101eS  */
590dea3101eS 
591dea3101eS struct ls_rjt {	/* Structure is in Big Endian format */
592dea3101eS 	union {
593dea3101eS 		uint32_t lsRjtError;
594dea3101eS 		struct {
595dea3101eS 			uint8_t lsRjtRsvd0;	/* FC Word 0, bit 24:31 */
596dea3101eS 
597dea3101eS 			uint8_t lsRjtRsnCode;	/* FC Word 0, bit 16:23 */
598dea3101eS 			/* LS_RJT reason codes */
599dea3101eS #define LSRJT_INVALID_CMD     0x01
600dea3101eS #define LSRJT_LOGICAL_ERR     0x03
601dea3101eS #define LSRJT_LOGICAL_BSY     0x05
602dea3101eS #define LSRJT_PROTOCOL_ERR    0x07
603dea3101eS #define LSRJT_UNABLE_TPC      0x09	/* Unable to perform command */
604dea3101eS #define LSRJT_CMD_UNSUPPORTED 0x0B
605dea3101eS #define LSRJT_VENDOR_UNIQUE   0xFF	/* See Byte 3 */
606dea3101eS 
607dea3101eS 			uint8_t lsRjtRsnCodeExp; /* FC Word 0, bit 8:15 */
608dea3101eS 			/* LS_RJT reason explanation */
609dea3101eS #define LSEXP_NOTHING_MORE      0x00
610dea3101eS #define LSEXP_SPARM_OPTIONS     0x01
611dea3101eS #define LSEXP_SPARM_ICTL        0x03
612dea3101eS #define LSEXP_SPARM_RCTL        0x05
613dea3101eS #define LSEXP_SPARM_RCV_SIZE    0x07
614dea3101eS #define LSEXP_SPARM_CONCUR_SEQ  0x09
615dea3101eS #define LSEXP_SPARM_CREDIT      0x0B
616dea3101eS #define LSEXP_INVALID_PNAME     0x0D
617dea3101eS #define LSEXP_INVALID_NNAME     0x0E
618dea3101eS #define LSEXP_INVALID_CSP       0x0F
619dea3101eS #define LSEXP_INVALID_ASSOC_HDR 0x11
620dea3101eS #define LSEXP_ASSOC_HDR_REQ     0x13
621dea3101eS #define LSEXP_INVALID_O_SID     0x15
622dea3101eS #define LSEXP_INVALID_OX_RX     0x17
623dea3101eS #define LSEXP_CMD_IN_PROGRESS   0x19
6247f5f3d0dSJames Smart #define LSEXP_PORT_LOGIN_REQ    0x1E
625dea3101eS #define LSEXP_INVALID_NPORT_ID  0x1F
626dea3101eS #define LSEXP_INVALID_SEQ_ID    0x21
627dea3101eS #define LSEXP_INVALID_XCHG      0x23
628dea3101eS #define LSEXP_INACTIVE_XCHG     0x25
629dea3101eS #define LSEXP_RQ_REQUIRED       0x27
630dea3101eS #define LSEXP_OUT_OF_RESOURCE   0x29
631dea3101eS #define LSEXP_CANT_GIVE_DATA    0x2A
632dea3101eS #define LSEXP_REQ_UNSUPPORTED   0x2C
633dea3101eS 			uint8_t vendorUnique;	/* FC Word 0, bit  0: 7 */
634dea3101eS 		} b;
635dea3101eS 	} un;
636dea3101eS };
637dea3101eS 
638dea3101eS /*
639dea3101eS  *  N_Port Login (FLOGO/PLOGO Request) Payload Definition
640dea3101eS  */
641dea3101eS 
642dea3101eS typedef struct _LOGO {		/* Structure is in Big Endian format */
643dea3101eS 	union {
644dea3101eS 		uint32_t nPortId32;	/* Access nPortId as a word */
645dea3101eS 		struct {
646dea3101eS 			uint8_t word1Reserved1;	/* FC Word 1, bit 31:24 */
647dea3101eS 			uint8_t nPortIdByte0;	/* N_port  ID bit 16:23 */
648dea3101eS 			uint8_t nPortIdByte1;	/* N_port  ID bit  8:15 */
649dea3101eS 			uint8_t nPortIdByte2;	/* N_port  ID bit  0: 7 */
650dea3101eS 		} b;
651dea3101eS 	} un;
652dea3101eS 	struct lpfc_name portName;	/* N_port name field */
653dea3101eS } LOGO;
654dea3101eS 
655dea3101eS /*
656dea3101eS  *  FCP Login (PRLI Request / ACC) Payload Definition
657dea3101eS  */
658dea3101eS 
659dea3101eS #define PRLX_PAGE_LEN   0x10
660dea3101eS #define TPRLO_PAGE_LEN  0x14
661dea3101eS 
662dea3101eS typedef struct _PRLI {		/* Structure is in Big Endian format */
663dea3101eS 	uint8_t prliType;	/* FC Parm Word 0, bit 24:31 */
664dea3101eS 
665dea3101eS #define PRLI_FCP_TYPE 0x08
666dea3101eS 	uint8_t word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
667dea3101eS 
668dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
669dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
670dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
671dea3101eS 	uint8_t estabImagePair:1;	/* FC Parm Word 0, bit 13 */
672dea3101eS 
673dea3101eS 	/*    ACC = imagePairEstablished */
674dea3101eS 	uint8_t word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
675dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
676dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
677dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
678dea3101eS 	uint8_t word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
679dea3101eS 	uint8_t estabImagePair:1;	/* FC Parm Word 0, bit 13 */
680dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
681dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
682dea3101eS 	/*    ACC = imagePairEstablished */
683dea3101eS #endif
684dea3101eS 
685dea3101eS #define PRLI_REQ_EXECUTED     0x1	/* acceptRspCode */
686dea3101eS #define PRLI_NO_RESOURCES     0x2
687dea3101eS #define PRLI_INIT_INCOMPLETE  0x3
688dea3101eS #define PRLI_NO_SUCH_PA       0x4
689dea3101eS #define PRLI_PREDEF_CONFIG    0x5
690dea3101eS #define PRLI_PARTIAL_SUCCESS  0x6
691dea3101eS #define PRLI_INVALID_PAGE_CNT 0x7
692dea3101eS 	uint8_t word0Reserved3;	/* FC Parm Word 0, bit 0:7 */
693dea3101eS 
694dea3101eS 	uint32_t origProcAssoc;	/* FC Parm Word 1, bit 0:31 */
695dea3101eS 
696dea3101eS 	uint32_t respProcAssoc;	/* FC Parm Word 2, bit 0:31 */
697dea3101eS 
698dea3101eS 	uint8_t word3Reserved1;	/* FC Parm Word 3, bit 24:31 */
699dea3101eS 	uint8_t word3Reserved2;	/* FC Parm Word 3, bit 16:23 */
700dea3101eS 
701dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
702dea3101eS 	uint16_t Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
703dea3101eS 	uint16_t Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
704dea3101eS 	uint16_t Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
705dea3101eS 	uint16_t Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
706dea3101eS 	uint16_t Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
707dea3101eS 	uint16_t Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
708dea3101eS 	uint16_t TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
709dea3101eS 	uint16_t Retry:1;	/* FC Parm Word 3, bit  8 */
710dea3101eS 	uint16_t ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
711dea3101eS 	uint16_t dataOverLay:1;	/* FC Parm Word 3, bit  6 */
712dea3101eS 	uint16_t initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
713dea3101eS 	uint16_t targetFunc:1;	/* FC Parm Word 3, bit  4 */
714dea3101eS 	uint16_t cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
715dea3101eS 	uint16_t dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
716dea3101eS 	uint16_t readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
717dea3101eS 	uint16_t writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
718dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
719dea3101eS 	uint16_t Retry:1;	/* FC Parm Word 3, bit  8 */
720dea3101eS 	uint16_t TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
721dea3101eS 	uint16_t Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
722dea3101eS 	uint16_t Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
723dea3101eS 	uint16_t Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
724dea3101eS 	uint16_t Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
725dea3101eS 	uint16_t Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
726dea3101eS 	uint16_t Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
727dea3101eS 	uint16_t writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
728dea3101eS 	uint16_t readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
729dea3101eS 	uint16_t dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
730dea3101eS 	uint16_t cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
731dea3101eS 	uint16_t targetFunc:1;	/* FC Parm Word 3, bit  4 */
732dea3101eS 	uint16_t initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
733dea3101eS 	uint16_t dataOverLay:1;	/* FC Parm Word 3, bit  6 */
734dea3101eS 	uint16_t ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
735dea3101eS #endif
736dea3101eS } PRLI;
737dea3101eS 
738dea3101eS /*
739dea3101eS  *  FCP Logout (PRLO Request / ACC) Payload Definition
740dea3101eS  */
741dea3101eS 
742dea3101eS typedef struct _PRLO {		/* Structure is in Big Endian format */
743dea3101eS 	uint8_t prloType;	/* FC Parm Word 0, bit 24:31 */
744dea3101eS 
745dea3101eS #define PRLO_FCP_TYPE  0x08
746dea3101eS 	uint8_t word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
747dea3101eS 
748dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
749dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
750dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
751dea3101eS 	uint8_t word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
752dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
753dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
754dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
755dea3101eS 	uint8_t word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
756dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
757dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
758dea3101eS #endif
759dea3101eS 
760dea3101eS #define PRLO_REQ_EXECUTED     0x1	/* acceptRspCode */
761dea3101eS #define PRLO_NO_SUCH_IMAGE    0x4
762dea3101eS #define PRLO_INVALID_PAGE_CNT 0x7
763dea3101eS 
764dea3101eS 	uint8_t word0Reserved3;	/* FC Parm Word 0, bit 0:7 */
765dea3101eS 
766dea3101eS 	uint32_t origProcAssoc;	/* FC Parm Word 1, bit 0:31 */
767dea3101eS 
768dea3101eS 	uint32_t respProcAssoc;	/* FC Parm Word 2, bit 0:31 */
769dea3101eS 
770dea3101eS 	uint32_t word3Reserved1;	/* FC Parm Word 3, bit 0:31 */
771dea3101eS } PRLO;
772dea3101eS 
773dea3101eS typedef struct _ADISC {		/* Structure is in Big Endian format */
774dea3101eS 	uint32_t hardAL_PA;
775dea3101eS 	struct lpfc_name portName;
776dea3101eS 	struct lpfc_name nodeName;
777dea3101eS 	uint32_t DID;
778dea3101eS } ADISC;
779dea3101eS 
780dea3101eS typedef struct _FARP {		/* Structure is in Big Endian format */
781dea3101eS 	uint32_t Mflags:8;
782dea3101eS 	uint32_t Odid:24;
783dea3101eS #define FARP_NO_ACTION          0	/* FARP information enclosed, no
784dea3101eS 					   action */
785dea3101eS #define FARP_MATCH_PORT         0x1	/* Match on Responder Port Name */
786dea3101eS #define FARP_MATCH_NODE         0x2	/* Match on Responder Node Name */
787dea3101eS #define FARP_MATCH_IP           0x4	/* Match on IP address, not supported */
788dea3101eS #define FARP_MATCH_IPV4         0x5	/* Match on IPV4 address, not
789dea3101eS 					   supported */
790dea3101eS #define FARP_MATCH_IPV6         0x6	/* Match on IPV6 address, not
791dea3101eS 					   supported */
792dea3101eS 	uint32_t Rflags:8;
793dea3101eS 	uint32_t Rdid:24;
794dea3101eS #define FARP_REQUEST_PLOGI      0x1	/* Request for PLOGI */
795dea3101eS #define FARP_REQUEST_FARPR      0x2	/* Request for FARP Response */
796dea3101eS 	struct lpfc_name OportName;
797dea3101eS 	struct lpfc_name OnodeName;
798dea3101eS 	struct lpfc_name RportName;
799dea3101eS 	struct lpfc_name RnodeName;
800dea3101eS 	uint8_t Oipaddr[16];
801dea3101eS 	uint8_t Ripaddr[16];
802dea3101eS } FARP;
803dea3101eS 
804dea3101eS typedef struct _FAN {		/* Structure is in Big Endian format */
805dea3101eS 	uint32_t Fdid;
806dea3101eS 	struct lpfc_name FportName;
807dea3101eS 	struct lpfc_name FnodeName;
808dea3101eS } FAN;
809dea3101eS 
810dea3101eS typedef struct _SCR {		/* Structure is in Big Endian format */
811dea3101eS 	uint8_t resvd1;
812dea3101eS 	uint8_t resvd2;
813dea3101eS 	uint8_t resvd3;
814dea3101eS 	uint8_t Function;
815dea3101eS #define  SCR_FUNC_FABRIC     0x01
816dea3101eS #define  SCR_FUNC_NPORT      0x02
817dea3101eS #define  SCR_FUNC_FULL       0x03
818dea3101eS #define  SCR_CLEAR           0xff
819dea3101eS } SCR;
820dea3101eS 
821dea3101eS typedef struct _RNID_TOP_DISC {
822dea3101eS 	struct lpfc_name portName;
823dea3101eS 	uint8_t resvd[8];
824dea3101eS 	uint32_t unitType;
825dea3101eS #define RNID_HBA            0x7
826dea3101eS #define RNID_HOST           0xa
827dea3101eS #define RNID_DRIVER         0xd
828dea3101eS 	uint32_t physPort;
829dea3101eS 	uint32_t attachedNodes;
830dea3101eS 	uint16_t ipVersion;
831dea3101eS #define RNID_IPV4           0x1
832dea3101eS #define RNID_IPV6           0x2
833dea3101eS 	uint16_t UDPport;
834dea3101eS 	uint8_t ipAddr[16];
835dea3101eS 	uint16_t resvd1;
836dea3101eS 	uint16_t flags;
837dea3101eS #define RNID_TD_SUPPORT     0x1
838dea3101eS #define RNID_LP_VALID       0x2
839dea3101eS } RNID_TOP_DISC;
840dea3101eS 
841dea3101eS typedef struct _RNID {		/* Structure is in Big Endian format */
842dea3101eS 	uint8_t Format;
843dea3101eS #define RNID_TOPOLOGY_DISC  0xdf
844dea3101eS 	uint8_t CommonLen;
845dea3101eS 	uint8_t resvd1;
846dea3101eS 	uint8_t SpecificLen;
847dea3101eS 	struct lpfc_name portName;
848dea3101eS 	struct lpfc_name nodeName;
849dea3101eS 	union {
850dea3101eS 		RNID_TOP_DISC topologyDisc;	/* topology disc (0xdf) */
851dea3101eS 	} un;
852dea3101eS } RNID;
853dea3101eS 
8547bb3b137SJamie Wellnitz typedef struct  _RPS {		/* Structure is in Big Endian format */
8557bb3b137SJamie Wellnitz 	union {
8567bb3b137SJamie Wellnitz 		uint32_t portNum;
8577bb3b137SJamie Wellnitz 		struct lpfc_name portName;
8587bb3b137SJamie Wellnitz 	} un;
8597bb3b137SJamie Wellnitz } RPS;
8607bb3b137SJamie Wellnitz 
8617bb3b137SJamie Wellnitz typedef struct  _RPS_RSP {	/* Structure is in Big Endian format */
8627bb3b137SJamie Wellnitz 	uint16_t rsvd1;
8637bb3b137SJamie Wellnitz 	uint16_t portStatus;
8647bb3b137SJamie Wellnitz 	uint32_t linkFailureCnt;
8657bb3b137SJamie Wellnitz 	uint32_t lossSyncCnt;
8667bb3b137SJamie Wellnitz 	uint32_t lossSignalCnt;
8677bb3b137SJamie Wellnitz 	uint32_t primSeqErrCnt;
8687bb3b137SJamie Wellnitz 	uint32_t invalidXmitWord;
8697bb3b137SJamie Wellnitz 	uint32_t crcCnt;
8707bb3b137SJamie Wellnitz } RPS_RSP;
8717bb3b137SJamie Wellnitz 
87212265f68SJames Smart struct RLS {			/* Structure is in Big Endian format */
87312265f68SJames Smart 	uint32_t rls;
87412265f68SJames Smart #define rls_rsvd_SHIFT		24
87512265f68SJames Smart #define rls_rsvd_MASK		0x000000ff
87612265f68SJames Smart #define rls_rsvd_WORD		rls
87712265f68SJames Smart #define rls_did_SHIFT		0
87812265f68SJames Smart #define rls_did_MASK		0x00ffffff
87912265f68SJames Smart #define rls_did_WORD		rls
88012265f68SJames Smart };
88112265f68SJames Smart 
88212265f68SJames Smart struct  RLS_RSP {		/* Structure is in Big Endian format */
88312265f68SJames Smart 	uint32_t linkFailureCnt;
88412265f68SJames Smart 	uint32_t lossSyncCnt;
88512265f68SJames Smart 	uint32_t lossSignalCnt;
88612265f68SJames Smart 	uint32_t primSeqErrCnt;
88712265f68SJames Smart 	uint32_t invalidXmitWord;
88812265f68SJames Smart 	uint32_t crcCnt;
88912265f68SJames Smart };
89012265f68SJames Smart 
89119ca7609SJames Smart struct RRQ {			/* Structure is in Big Endian format */
89219ca7609SJames Smart 	uint32_t rrq;
89319ca7609SJames Smart #define rrq_rsvd_SHIFT		24
89419ca7609SJames Smart #define rrq_rsvd_MASK		0x000000ff
89519ca7609SJames Smart #define rrq_rsvd_WORD		rrq
89619ca7609SJames Smart #define rrq_did_SHIFT		0
89719ca7609SJames Smart #define rrq_did_MASK		0x00ffffff
89819ca7609SJames Smart #define rrq_did_WORD		rrq
89919ca7609SJames Smart 	uint32_t rrq_exchg;
90019ca7609SJames Smart #define rrq_oxid_SHIFT		16
90119ca7609SJames Smart #define rrq_oxid_MASK		0xffff
90219ca7609SJames Smart #define rrq_oxid_WORD		rrq_exchg
90319ca7609SJames Smart #define rrq_rxid_SHIFT		0
90419ca7609SJames Smart #define rrq_rxid_MASK		0xffff
90519ca7609SJames Smart #define rrq_rxid_WORD		rrq_exchg
90619ca7609SJames Smart };
90719ca7609SJames Smart 
908912e3acdSJames Smart #define LPFC_MAX_VFN_PER_PFN	255 /* Maximum VFs allowed per ARI */
909912e3acdSJames Smart #define LPFC_DEF_VFN_PER_PFN	0   /* Default VFs due to platform limitation*/
91019ca7609SJames Smart 
91112265f68SJames Smart struct RTV_RSP {		/* Structure is in Big Endian format */
91212265f68SJames Smart 	uint32_t ratov;
91312265f68SJames Smart 	uint32_t edtov;
91412265f68SJames Smart 	uint32_t qtov;
91512265f68SJames Smart #define qtov_rsvd0_SHIFT	28
91612265f68SJames Smart #define qtov_rsvd0_MASK		0x0000000f
91712265f68SJames Smart #define qtov_rsvd0_WORD		qtov		/* reserved */
91812265f68SJames Smart #define qtov_edtovres_SHIFT	27
91912265f68SJames Smart #define qtov_edtovres_MASK	0x00000001
92012265f68SJames Smart #define qtov_edtovres_WORD	qtov		/* E_D_TOV Resolution */
92112265f68SJames Smart #define qtov__rsvd1_SHIFT	19
92212265f68SJames Smart #define qtov_rsvd1_MASK		0x0000003f
92312265f68SJames Smart #define qtov_rsvd1_WORD		qtov		/* reserved */
92412265f68SJames Smart #define qtov_rttov_SHIFT	18
92512265f68SJames Smart #define qtov_rttov_MASK		0x00000001
92612265f68SJames Smart #define qtov_rttov_WORD		qtov		/* R_T_TOV value */
92712265f68SJames Smart #define qtov_rsvd2_SHIFT	0
92812265f68SJames Smart #define qtov_rsvd2_MASK		0x0003ffff
92912265f68SJames Smart #define qtov_rsvd2_WORD		qtov		/* reserved */
93012265f68SJames Smart };
93112265f68SJames Smart 
93212265f68SJames Smart 
9337bb3b137SJamie Wellnitz typedef struct  _RPL {		/* Structure is in Big Endian format */
9347bb3b137SJamie Wellnitz 	uint32_t maxsize;
9357bb3b137SJamie Wellnitz 	uint32_t index;
9367bb3b137SJamie Wellnitz } RPL;
9377bb3b137SJamie Wellnitz 
9387bb3b137SJamie Wellnitz typedef struct  _PORT_NUM_BLK {
9397bb3b137SJamie Wellnitz 	uint32_t portNum;
9407bb3b137SJamie Wellnitz 	uint32_t portID;
9417bb3b137SJamie Wellnitz 	struct lpfc_name portName;
9427bb3b137SJamie Wellnitz } PORT_NUM_BLK;
9437bb3b137SJamie Wellnitz 
9447bb3b137SJamie Wellnitz typedef struct  _RPL_RSP {	/* Structure is in Big Endian format */
9457bb3b137SJamie Wellnitz 	uint32_t listLen;
9467bb3b137SJamie Wellnitz 	uint32_t index;
9477bb3b137SJamie Wellnitz 	PORT_NUM_BLK port_num_blk;
9487bb3b137SJamie Wellnitz } RPL_RSP;
949dea3101eS 
950dea3101eS /* This is used for RSCN command */
951dea3101eS typedef struct _D_ID {		/* Structure is in Big Endian format */
952dea3101eS 	union {
953dea3101eS 		uint32_t word;
954dea3101eS 		struct {
955dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
956dea3101eS 			uint8_t resv;
957dea3101eS 			uint8_t domain;
958dea3101eS 			uint8_t area;
959dea3101eS 			uint8_t id;
960dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
961dea3101eS 			uint8_t id;
962dea3101eS 			uint8_t area;
963dea3101eS 			uint8_t domain;
964dea3101eS 			uint8_t resv;
965dea3101eS #endif
966dea3101eS 		} b;
967dea3101eS 	} un;
968dea3101eS } D_ID;
969dea3101eS 
970eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_PORT	0x0
971eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_AREA	0x1
972eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_DOMAIN	0x2
973eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_FABRIC	0x3
974eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_MASK	0x3
975eaf15d5bSJames Smart 
976dea3101eS /*
977dea3101eS  *  Structure to define all ELS Payload types
978dea3101eS  */
979dea3101eS 
980dea3101eS typedef struct _ELS_PKT {	/* Structure is in Big Endian format */
981dea3101eS 	uint8_t elsCode;	/* FC Word 0, bit 24:31 */
982dea3101eS 	uint8_t elsByte1;
983dea3101eS 	uint8_t elsByte2;
984dea3101eS 	uint8_t elsByte3;
985dea3101eS 	union {
986dea3101eS 		struct ls_rjt lsRjt;	/* Payload for LS_RJT ELS response */
987dea3101eS 		struct serv_parm logi;	/* Payload for PLOGI/FLOGI/PDISC/ACC */
988dea3101eS 		LOGO logo;	/* Payload for PLOGO/FLOGO/ACC */
989dea3101eS 		PRLI prli;	/* Payload for PRLI/ACC */
990dea3101eS 		PRLO prlo;	/* Payload for PRLO/ACC */
991dea3101eS 		ADISC adisc;	/* Payload for ADISC/ACC */
992dea3101eS 		FARP farp;	/* Payload for FARP/ACC */
993dea3101eS 		FAN fan;	/* Payload for FAN */
994dea3101eS 		SCR scr;	/* Payload for SCR/ACC */
995dea3101eS 		RNID rnid;	/* Payload for RNID */
996dea3101eS 		uint8_t pad[128 - 4];	/* Pad out to payload of 128 bytes */
997dea3101eS 	} un;
998dea3101eS } ELS_PKT;
999dea3101eS 
1000dea3101eS /*
1001dea3101eS  * FDMI
1002dea3101eS  * HBA MAnagement Operations Command Codes
1003dea3101eS  */
1004dea3101eS #define  SLI_MGMT_GRHL     0x100	/* Get registered HBA list */
1005dea3101eS #define  SLI_MGMT_GHAT     0x101	/* Get HBA attributes */
1006dea3101eS #define  SLI_MGMT_GRPL     0x102	/* Get registered Port list */
1007dea3101eS #define  SLI_MGMT_GPAT     0x110	/* Get Port attributes */
1008dea3101eS #define  SLI_MGMT_RHBA     0x200	/* Register HBA */
100970f23fd6SJustin P. Mattock #define  SLI_MGMT_RHAT     0x201	/* Register HBA attributes */
1010dea3101eS #define  SLI_MGMT_RPRT     0x210	/* Register Port */
1011dea3101eS #define  SLI_MGMT_RPA      0x211	/* Register Port attributes */
1012dea3101eS #define  SLI_MGMT_DHBA     0x300	/* De-register HBA */
1013dea3101eS #define  SLI_MGMT_DPRT     0x310	/* De-register Port */
1014dea3101eS 
1015dea3101eS /*
1016dea3101eS  * Management Service Subtypes
1017dea3101eS  */
1018dea3101eS #define  SLI_CT_FDMI_Subtypes     0x10
1019dea3101eS 
1020dea3101eS /*
1021dea3101eS  * HBA Management Service Reject Code
1022dea3101eS  */
1023dea3101eS #define  REJECT_CODE             0x9	/* Unable to perform command request */
1024dea3101eS 
1025dea3101eS /*
1026dea3101eS  * HBA Management Service Reject Reason Code
1027dea3101eS  * Please refer to the Reason Codes above
1028dea3101eS  */
1029dea3101eS 
1030dea3101eS /*
1031dea3101eS  * HBA Attribute Types
1032dea3101eS  */
1033dea3101eS #define  NODE_NAME               0x1
1034dea3101eS #define  MANUFACTURER            0x2
1035dea3101eS #define  SERIAL_NUMBER           0x3
1036dea3101eS #define  MODEL                   0x4
1037dea3101eS #define  MODEL_DESCRIPTION       0x5
1038dea3101eS #define  HARDWARE_VERSION        0x6
1039dea3101eS #define  DRIVER_VERSION          0x7
1040dea3101eS #define  OPTION_ROM_VERSION      0x8
1041dea3101eS #define  FIRMWARE_VERSION        0x9
1042dea3101eS #define  OS_NAME_VERSION	 0xa
1043dea3101eS #define  MAX_CT_PAYLOAD_LEN	 0xb
1044dea3101eS 
1045dea3101eS /*
1046dea3101eS  * Port Attrubute Types
1047dea3101eS  */
1048dea3101eS #define  SUPPORTED_FC4_TYPES     0x1
1049dea3101eS #define  SUPPORTED_SPEED         0x2
1050dea3101eS #define  PORT_SPEED              0x3
1051dea3101eS #define  MAX_FRAME_SIZE          0x4
1052dea3101eS #define  OS_DEVICE_NAME          0x5
1053dea3101eS #define  HOST_NAME               0x6
1054dea3101eS 
1055dea3101eS union AttributesDef {
1056dea3101eS 	/* Structure is in Big Endian format */
1057dea3101eS 	struct {
1058dea3101eS 		uint32_t AttrType:16;
1059dea3101eS 		uint32_t AttrLen:16;
1060dea3101eS 	} bits;
1061dea3101eS 	uint32_t word;
1062dea3101eS };
1063dea3101eS 
1064dea3101eS 
1065dea3101eS /*
1066dea3101eS  * HBA Attribute Entry (8 - 260 bytes)
1067dea3101eS  */
1068dea3101eS typedef struct {
1069dea3101eS 	union AttributesDef ad;
1070dea3101eS 	union {
1071dea3101eS 		uint32_t VendorSpecific;
1072dea3101eS 		uint8_t Manufacturer[64];
1073dea3101eS 		uint8_t SerialNumber[64];
1074dea3101eS 		uint8_t Model[256];
1075dea3101eS 		uint8_t ModelDescription[256];
1076dea3101eS 		uint8_t HardwareVersion[256];
1077dea3101eS 		uint8_t DriverVersion[256];
1078dea3101eS 		uint8_t OptionROMVersion[256];
1079dea3101eS 		uint8_t FirmwareVersion[256];
1080dea3101eS 		struct lpfc_name NodeName;
1081dea3101eS 		uint8_t SupportFC4Types[32];
1082dea3101eS 		uint32_t SupportSpeed;
1083dea3101eS 		uint32_t PortSpeed;
1084dea3101eS 		uint32_t MaxFrameSize;
1085dea3101eS 		uint8_t OsDeviceName[256];
1086dea3101eS 		uint8_t OsNameVersion[256];
1087dea3101eS 		uint32_t MaxCTPayloadLen;
1088dea3101eS 		uint8_t HostName[256];
1089dea3101eS 	} un;
1090dea3101eS } ATTRIBUTE_ENTRY;
1091dea3101eS 
1092dea3101eS /*
1093dea3101eS  * HBA Attribute Block
1094dea3101eS  */
1095dea3101eS typedef struct {
1096dea3101eS 	uint32_t EntryCnt;	/* Number of HBA attribute entries */
1097dea3101eS 	ATTRIBUTE_ENTRY Entry;	/* Variable-length array */
1098dea3101eS } ATTRIBUTE_BLOCK;
1099dea3101eS 
1100dea3101eS /*
1101dea3101eS  * Port Entry
1102dea3101eS  */
1103dea3101eS typedef struct {
1104dea3101eS 	struct lpfc_name PortName;
1105dea3101eS } PORT_ENTRY;
1106dea3101eS 
1107dea3101eS /*
1108dea3101eS  * HBA Identifier
1109dea3101eS  */
1110dea3101eS typedef struct {
1111dea3101eS 	struct lpfc_name PortName;
1112dea3101eS } HBA_IDENTIFIER;
1113dea3101eS 
1114dea3101eS /*
1115dea3101eS  * Registered Port List Format
1116dea3101eS  */
1117dea3101eS typedef struct {
1118dea3101eS 	uint32_t EntryCnt;
1119dea3101eS 	PORT_ENTRY pe;		/* Variable-length array */
1120dea3101eS } REG_PORT_LIST;
1121dea3101eS 
1122dea3101eS /*
1123dea3101eS  * Register HBA(RHBA)
1124dea3101eS  */
1125dea3101eS typedef struct {
1126dea3101eS 	HBA_IDENTIFIER hi;
1127dea3101eS 	REG_PORT_LIST rpl;	/* variable-length array */
1128dea3101eS /* ATTRIBUTE_BLOCK   ab; */
1129dea3101eS } REG_HBA;
1130dea3101eS 
1131dea3101eS /*
1132dea3101eS  * Register HBA Attributes (RHAT)
1133dea3101eS  */
1134dea3101eS typedef struct {
1135dea3101eS 	struct lpfc_name HBA_PortName;
1136dea3101eS 	ATTRIBUTE_BLOCK ab;
1137dea3101eS } REG_HBA_ATTRIBUTE;
1138dea3101eS 
1139dea3101eS /*
1140dea3101eS  * Register Port Attributes (RPA)
1141dea3101eS  */
1142dea3101eS typedef struct {
1143dea3101eS 	struct lpfc_name PortName;
1144dea3101eS 	ATTRIBUTE_BLOCK ab;
1145dea3101eS } REG_PORT_ATTRIBUTE;
1146dea3101eS 
1147dea3101eS /*
1148dea3101eS  * Get Registered HBA List (GRHL) Accept Payload Format
1149dea3101eS  */
1150dea3101eS typedef struct {
1151dea3101eS 	uint32_t HBA__Entry_Cnt; /* Number of Registered HBA Identifiers */
1152dea3101eS 	struct lpfc_name HBA_PortName;	/* Variable-length array */
1153dea3101eS } GRHL_ACC_PAYLOAD;
1154dea3101eS 
1155dea3101eS /*
1156dea3101eS  * Get Registered Port List (GRPL) Accept Payload Format
1157dea3101eS  */
1158dea3101eS typedef struct {
1159dea3101eS 	uint32_t RPL_Entry_Cnt;	/* Number of Registered Port Entries */
1160dea3101eS 	PORT_ENTRY Reg_Port_Entry[1];	/* Variable-length array */
1161dea3101eS } GRPL_ACC_PAYLOAD;
1162dea3101eS 
1163dea3101eS /*
1164dea3101eS  * Get Port Attributes (GPAT) Accept Payload Format
1165dea3101eS  */
1166dea3101eS 
1167dea3101eS typedef struct {
1168dea3101eS 	ATTRIBUTE_BLOCK pab;
1169dea3101eS } GPAT_ACC_PAYLOAD;
1170dea3101eS 
1171dea3101eS 
1172dea3101eS /*
1173dea3101eS  *  Begin HBA configuration parameters.
1174dea3101eS  *  The PCI configuration register BAR assignments are:
1175dea3101eS  *  BAR0, offset 0x10 - SLIM base memory address
1176dea3101eS  *  BAR1, offset 0x14 - SLIM base memory high address
1177dea3101eS  *  BAR2, offset 0x18 - REGISTER base memory address
1178dea3101eS  *  BAR3, offset 0x1c - REGISTER base memory high address
1179dea3101eS  *  BAR4, offset 0x20 - BIU I/O registers
1180dea3101eS  *  BAR5, offset 0x24 - REGISTER base io high address
1181dea3101eS  */
1182dea3101eS 
1183dea3101eS /* Number of rings currently used and available. */
1184dea3101eS #define MAX_CONFIGURED_RINGS     3
1185dea3101eS #define MAX_RINGS                4
1186dea3101eS 
1187dea3101eS /* IOCB / Mailbox is owned by FireFly */
1188dea3101eS #define OWN_CHIP        1
1189dea3101eS 
1190dea3101eS /* IOCB / Mailbox is owned by Host */
1191dea3101eS #define OWN_HOST        0
1192dea3101eS 
1193dea3101eS /* Number of 4-byte words in an IOCB. */
1194dea3101eS #define IOCB_WORD_SZ    8
1195dea3101eS 
1196dea3101eS /* network headers for Dfctl field */
1197dea3101eS #define FC_NET_HDR      0x20
1198dea3101eS 
1199dea3101eS /* Start FireFly Register definitions */
1200dea3101eS #define PCI_VENDOR_ID_EMULEX        0x10df
1201dea3101eS #define PCI_DEVICE_ID_FIREFLY       0x1ae5
120284774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_VF    0xe100
1203085c647cSJames Smart #define PCI_DEVICE_ID_BALIUS        0xe131
120484774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_PF    0xe180
1205085c647cSJames Smart #define PCI_DEVICE_ID_LANCER_FC     0xe200
1206c0c11512SJames Smart #define PCI_DEVICE_ID_LANCER_FC_VF  0xe208
1207085c647cSJames Smart #define PCI_DEVICE_ID_LANCER_FCOE   0xe260
1208c0c11512SJames Smart #define PCI_DEVICE_ID_LANCER_FCOE_VF 0xe268
1209b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_SMB       0xf011
1210b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_MID       0xf015
1211dea3101eS #define PCI_DEVICE_ID_RFLY          0xf095
1212dea3101eS #define PCI_DEVICE_ID_PFLY          0xf098
1213e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LP101         0xf0a1
1214dea3101eS #define PCI_DEVICE_ID_TFLY          0xf0a5
1215e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_BSMB          0xf0d1
1216e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_BMID          0xf0d5
1217e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZSMB          0xf0e1
1218e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZMID          0xf0e5
1219e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE       0xf0f5
1220e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE_SCSP  0xf0f6
1221e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE_DCSP  0xf0f7
1222b87eab38SJames Smart #define PCI_DEVICE_ID_SAT           0xf100
1223b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_SCSP      0xf111
1224b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_DCSP      0xf112
1225085c647cSJames Smart #define PCI_DEVICE_ID_FALCON        0xf180
1226e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_SUPERFLY      0xf700
1227e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_DRAGONFLY     0xf800
1228dea3101eS #define PCI_DEVICE_ID_CENTAUR       0xf900
1229dea3101eS #define PCI_DEVICE_ID_PEGASUS       0xf980
1230dea3101eS #define PCI_DEVICE_ID_THOR          0xfa00
1231dea3101eS #define PCI_DEVICE_ID_VIPER         0xfb00
1232dea3101eS #define PCI_DEVICE_ID_LP10000S      0xfc00
1233e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LP11000S      0xfc10
1234e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LPE11000S     0xfc20
1235b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_S         0xfc40
123684774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_S     0xfc50
1237e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS        0xfd00
1238e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS_SCSP   0xfd11
1239e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS_DCSP   0xfd12
1240e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR        0xfe00
124184774a4dSJames Smart #define PCI_DEVICE_ID_HORNET        0xfe05
1242e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR_SCSP   0xfe11
1243e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR_DCSP   0xfe12
1244da0436e9SJames Smart #define PCI_VENDOR_ID_SERVERENGINE  0x19a2
1245da0436e9SJames Smart #define PCI_DEVICE_ID_TIGERSHARK    0x0704
1246a747c9ceSJames Smart #define PCI_DEVICE_ID_TOMCAT        0x0714
1247dea3101eS 
1248dea3101eS #define JEDEC_ID_ADDRESS            0x0080001c
1249dea3101eS #define FIREFLY_JEDEC_ID            0x1ACC
1250dea3101eS #define SUPERFLY_JEDEC_ID           0x0020
1251dea3101eS #define DRAGONFLY_JEDEC_ID          0x0021
1252dea3101eS #define DRAGONFLY_V2_JEDEC_ID       0x0025
1253dea3101eS #define CENTAUR_2G_JEDEC_ID         0x0026
1254dea3101eS #define CENTAUR_1G_JEDEC_ID         0x0028
1255dea3101eS #define PEGASUS_ORION_JEDEC_ID      0x0036
1256dea3101eS #define PEGASUS_JEDEC_ID            0x0038
1257dea3101eS #define THOR_JEDEC_ID               0x0012
1258dea3101eS #define HELIOS_JEDEC_ID             0x0364
1259dea3101eS #define ZEPHYR_JEDEC_ID             0x0577
1260dea3101eS #define VIPER_JEDEC_ID              0x4838
1261b87eab38SJames Smart #define SATURN_JEDEC_ID             0x1004
126284774a4dSJames Smart #define HORNET_JDEC_ID              0x2057706D
1263dea3101eS 
1264dea3101eS #define JEDEC_ID_MASK               0x0FFFF000
1265dea3101eS #define JEDEC_ID_SHIFT              12
1266dea3101eS #define FC_JEDEC_ID(id)             ((id & JEDEC_ID_MASK) >> JEDEC_ID_SHIFT)
1267dea3101eS 
1268dea3101eS typedef struct {		/* FireFly BIU registers */
1269dea3101eS 	uint32_t hostAtt;	/* See definitions for Host Attention
1270dea3101eS 				   register */
1271dea3101eS 	uint32_t chipAtt;	/* See definitions for Chip Attention
1272dea3101eS 				   register */
1273dea3101eS 	uint32_t hostStatus;	/* See definitions for Host Status register */
1274dea3101eS 	uint32_t hostControl;	/* See definitions for Host Control register */
1275dea3101eS 	uint32_t buiConfig;	/* See definitions for BIU configuration
1276dea3101eS 				   register */
1277dea3101eS } FF_REGS;
1278dea3101eS 
1279dea3101eS /* IO Register size in bytes */
1280dea3101eS #define FF_REG_AREA_SIZE       256
1281dea3101eS 
1282dea3101eS /* Host Attention Register */
1283dea3101eS 
1284dea3101eS #define HA_REG_OFFSET  0	/* Byte offset from register base address */
1285dea3101eS 
1286dea3101eS #define HA_R0RE_REQ    0x00000001	/* Bit  0 */
1287dea3101eS #define HA_R0CE_RSP    0x00000002	/* Bit  1 */
1288dea3101eS #define HA_R0ATT       0x00000008	/* Bit  3 */
1289dea3101eS #define HA_R1RE_REQ    0x00000010	/* Bit  4 */
1290dea3101eS #define HA_R1CE_RSP    0x00000020	/* Bit  5 */
1291dea3101eS #define HA_R1ATT       0x00000080	/* Bit  7 */
1292dea3101eS #define HA_R2RE_REQ    0x00000100	/* Bit  8 */
1293dea3101eS #define HA_R2CE_RSP    0x00000200	/* Bit  9 */
1294dea3101eS #define HA_R2ATT       0x00000800	/* Bit 11 */
1295dea3101eS #define HA_R3RE_REQ    0x00001000	/* Bit 12 */
1296dea3101eS #define HA_R3CE_RSP    0x00002000	/* Bit 13 */
1297dea3101eS #define HA_R3ATT       0x00008000	/* Bit 15 */
1298dea3101eS #define HA_LATT        0x20000000	/* Bit 29 */
1299dea3101eS #define HA_MBATT       0x40000000	/* Bit 30 */
1300dea3101eS #define HA_ERATT       0x80000000	/* Bit 31 */
1301dea3101eS 
1302dea3101eS #define HA_RXRE_REQ    0x00000001	/* Bit  0 */
1303dea3101eS #define HA_RXCE_RSP    0x00000002	/* Bit  1 */
1304dea3101eS #define HA_RXATT       0x00000008	/* Bit  3 */
1305dea3101eS #define HA_RXMASK      0x0000000f
1306dea3101eS 
13079399627fSJames Smart #define HA_R0_CLR_MSK	(HA_R0RE_REQ | HA_R0CE_RSP | HA_R0ATT)
13089399627fSJames Smart #define HA_R1_CLR_MSK	(HA_R1RE_REQ | HA_R1CE_RSP | HA_R1ATT)
13099399627fSJames Smart #define HA_R2_CLR_MSK	(HA_R2RE_REQ | HA_R2CE_RSP | HA_R2ATT)
13109399627fSJames Smart #define HA_R3_CLR_MSK	(HA_R3RE_REQ | HA_R3CE_RSP | HA_R3ATT)
13119399627fSJames Smart 
13129399627fSJames Smart #define HA_R0_POS	3
13139399627fSJames Smart #define HA_R1_POS	7
13149399627fSJames Smart #define HA_R2_POS	11
13159399627fSJames Smart #define HA_R3_POS	15
13169399627fSJames Smart #define HA_LE_POS	29
13179399627fSJames Smart #define HA_MB_POS	30
13189399627fSJames Smart #define HA_ER_POS	31
1319dea3101eS /* Chip Attention Register */
1320dea3101eS 
1321dea3101eS #define CA_REG_OFFSET  4	/* Byte offset from register base address */
1322dea3101eS 
1323dea3101eS #define CA_R0CE_REQ    0x00000001	/* Bit  0 */
1324dea3101eS #define CA_R0RE_RSP    0x00000002	/* Bit  1 */
1325dea3101eS #define CA_R0ATT       0x00000008	/* Bit  3 */
1326dea3101eS #define CA_R1CE_REQ    0x00000010	/* Bit  4 */
1327dea3101eS #define CA_R1RE_RSP    0x00000020	/* Bit  5 */
1328dea3101eS #define CA_R1ATT       0x00000080	/* Bit  7 */
1329dea3101eS #define CA_R2CE_REQ    0x00000100	/* Bit  8 */
1330dea3101eS #define CA_R2RE_RSP    0x00000200	/* Bit  9 */
1331dea3101eS #define CA_R2ATT       0x00000800	/* Bit 11 */
1332dea3101eS #define CA_R3CE_REQ    0x00001000	/* Bit 12 */
1333dea3101eS #define CA_R3RE_RSP    0x00002000	/* Bit 13 */
1334dea3101eS #define CA_R3ATT       0x00008000	/* Bit 15 */
1335dea3101eS #define CA_MBATT       0x40000000	/* Bit 30 */
1336dea3101eS 
1337dea3101eS /* Host Status Register */
1338dea3101eS 
1339dea3101eS #define HS_REG_OFFSET  8	/* Byte offset from register base address */
1340dea3101eS 
1341dea3101eS #define HS_MBRDY       0x00400000	/* Bit 22 */
1342dea3101eS #define HS_FFRDY       0x00800000	/* Bit 23 */
1343dea3101eS #define HS_FFER8       0x01000000	/* Bit 24 */
1344dea3101eS #define HS_FFER7       0x02000000	/* Bit 25 */
1345dea3101eS #define HS_FFER6       0x04000000	/* Bit 26 */
1346dea3101eS #define HS_FFER5       0x08000000	/* Bit 27 */
1347dea3101eS #define HS_FFER4       0x10000000	/* Bit 28 */
1348dea3101eS #define HS_FFER3       0x20000000	/* Bit 29 */
1349dea3101eS #define HS_FFER2       0x40000000	/* Bit 30 */
1350dea3101eS #define HS_FFER1       0x80000000	/* Bit 31 */
135157127f15SJames Smart #define HS_CRIT_TEMP   0x00000100	/* Bit 8  */
135257127f15SJames Smart #define HS_FFERM       0xFF000100	/* Mask for error bits 31:24 and 8 */
13539940b97bSJames Smart #define UNPLUG_ERR     0x00000001	/* Indicate pci hot unplug */
1354dea3101eS /* Host Control Register */
1355dea3101eS 
13569399627fSJames Smart #define HC_REG_OFFSET  12	/* Byte offset from register base address */
1357dea3101eS 
1358dea3101eS #define HC_MBINT_ENA   0x00000001	/* Bit  0 */
1359dea3101eS #define HC_R0INT_ENA   0x00000002	/* Bit  1 */
1360dea3101eS #define HC_R1INT_ENA   0x00000004	/* Bit  2 */
1361dea3101eS #define HC_R2INT_ENA   0x00000008	/* Bit  3 */
1362dea3101eS #define HC_R3INT_ENA   0x00000010	/* Bit  4 */
1363dea3101eS #define HC_INITHBI     0x02000000	/* Bit 25 */
1364dea3101eS #define HC_INITMB      0x04000000	/* Bit 26 */
1365dea3101eS #define HC_INITFF      0x08000000	/* Bit 27 */
1366dea3101eS #define HC_LAINT_ENA   0x20000000	/* Bit 29 */
1367dea3101eS #define HC_ERINT_ENA   0x80000000	/* Bit 31 */
1368dea3101eS 
13699399627fSJames Smart /* Message Signaled Interrupt eXtension (MSI-X) message identifiers */
13709399627fSJames Smart #define MSIX_DFLT_ID	0
13719399627fSJames Smart #define MSIX_RNG0_ID	0
13729399627fSJames Smart #define MSIX_RNG1_ID	1
13739399627fSJames Smart #define MSIX_RNG2_ID	2
13749399627fSJames Smart #define MSIX_RNG3_ID	3
13759399627fSJames Smart 
13769399627fSJames Smart #define MSIX_LINK_ID	4
13779399627fSJames Smart #define MSIX_MBOX_ID	5
13789399627fSJames Smart 
13799399627fSJames Smart #define MSIX_SPARE0_ID	6
13809399627fSJames Smart #define MSIX_SPARE1_ID	7
13819399627fSJames Smart 
1382dea3101eS /* Mailbox Commands */
1383dea3101eS #define MBX_SHUTDOWN        0x00	/* terminate testing */
1384dea3101eS #define MBX_LOAD_SM         0x01
1385dea3101eS #define MBX_READ_NV         0x02
1386dea3101eS #define MBX_WRITE_NV        0x03
1387dea3101eS #define MBX_RUN_BIU_DIAG    0x04
1388dea3101eS #define MBX_INIT_LINK       0x05
1389dea3101eS #define MBX_DOWN_LINK       0x06
1390dea3101eS #define MBX_CONFIG_LINK     0x07
1391dea3101eS #define MBX_CONFIG_RING     0x09
1392dea3101eS #define MBX_RESET_RING      0x0A
1393dea3101eS #define MBX_READ_CONFIG     0x0B
1394dea3101eS #define MBX_READ_RCONFIG    0x0C
1395dea3101eS #define MBX_READ_SPARM      0x0D
1396dea3101eS #define MBX_READ_STATUS     0x0E
1397dea3101eS #define MBX_READ_RPI        0x0F
1398dea3101eS #define MBX_READ_XRI        0x10
1399dea3101eS #define MBX_READ_REV        0x11
1400dea3101eS #define MBX_READ_LNK_STAT   0x12
1401dea3101eS #define MBX_REG_LOGIN       0x13
1402dea3101eS #define MBX_UNREG_LOGIN     0x14
1403dea3101eS #define MBX_CLEAR_LA        0x16
1404dea3101eS #define MBX_DUMP_MEMORY     0x17
1405dea3101eS #define MBX_DUMP_CONTEXT    0x18
1406dea3101eS #define MBX_RUN_DIAGS       0x19
1407dea3101eS #define MBX_RESTART         0x1A
1408dea3101eS #define MBX_UPDATE_CFG      0x1B
1409dea3101eS #define MBX_DOWN_LOAD       0x1C
1410dea3101eS #define MBX_DEL_LD_ENTRY    0x1D
1411dea3101eS #define MBX_RUN_PROGRAM     0x1E
1412dea3101eS #define MBX_SET_MASK        0x20
141309372820SJames Smart #define MBX_SET_VARIABLE    0x21
1414dea3101eS #define MBX_UNREG_D_ID      0x23
141541415862SJamie Wellnitz #define MBX_KILL_BOARD      0x24
1416dea3101eS #define MBX_CONFIG_FARP     0x25
141741415862SJamie Wellnitz #define MBX_BEACON          0x2A
14189399627fSJames Smart #define MBX_CONFIG_MSI      0x30
1419858c9f6cSJames Smart #define MBX_HEARTBEAT       0x31
1420a8adb832SJames Smart #define MBX_WRITE_VPARMS    0x32
1421a8adb832SJames Smart #define MBX_ASYNCEVT_ENABLE 0x33
14224fede78fSJames Smart #define MBX_READ_EVENT_LOG_STATUS 0x37
14234fede78fSJames Smart #define MBX_READ_EVENT_LOG  0x38
14244fede78fSJames Smart #define MBX_WRITE_EVENT_LOG 0x39
1425dea3101eS 
142684774a4dSJames Smart #define MBX_PORT_CAPABILITIES 0x3B
142784774a4dSJames Smart #define MBX_PORT_IOV_CONTROL 0x3C
142884774a4dSJames Smart 
1429ed957684SJames Smart #define MBX_CONFIG_HBQ	    0x7C
1430dea3101eS #define MBX_LOAD_AREA       0x81
1431dea3101eS #define MBX_RUN_BIU_DIAG64  0x84
1432dea3101eS #define MBX_CONFIG_PORT     0x88
1433dea3101eS #define MBX_READ_SPARM64    0x8D
1434dea3101eS #define MBX_READ_RPI64      0x8F
1435dea3101eS #define MBX_REG_LOGIN64     0x93
143676a95d75SJames Smart #define MBX_READ_TOPOLOGY   0x95
143792d7f7b0SJames Smart #define MBX_REG_VPI	    0x96
143892d7f7b0SJames Smart #define MBX_UNREG_VPI	    0x97
1439dea3101eS 
144009372820SJames Smart #define MBX_WRITE_WWN       0x98
1441dea3101eS #define MBX_SET_DEBUG       0x99
1442dea3101eS #define MBX_LOAD_EXP_ROM    0x9C
1443da0436e9SJames Smart #define MBX_SLI4_CONFIG	    0x9B
1444da0436e9SJames Smart #define MBX_SLI4_REQ_FTRS   0x9D
1445da0436e9SJames Smart #define MBX_MAX_CMDS        0x9E
1446da0436e9SJames Smart #define MBX_RESUME_RPI      0x9E
1447dea3101eS #define MBX_SLI2_CMD_MASK   0x80
1448da0436e9SJames Smart #define MBX_REG_VFI         0x9F
1449da0436e9SJames Smart #define MBX_REG_FCFI        0xA0
1450da0436e9SJames Smart #define MBX_UNREG_VFI       0xA1
1451da0436e9SJames Smart #define MBX_UNREG_FCFI	    0xA2
1452da0436e9SJames Smart #define MBX_INIT_VFI        0xA3
1453da0436e9SJames Smart #define MBX_INIT_VPI        0xA4
1454dea3101eS 
1455dcf2a4e0SJames Smart #define MBX_AUTH_PORT       0xF8
1456dcf2a4e0SJames Smart #define MBX_SECURITY_MGMT   0xF9
1457dcf2a4e0SJames Smart 
1458dea3101eS /* IOCB Commands */
1459dea3101eS 
1460dea3101eS #define CMD_RCV_SEQUENCE_CX     0x01
1461dea3101eS #define CMD_XMIT_SEQUENCE_CR    0x02
1462dea3101eS #define CMD_XMIT_SEQUENCE_CX    0x03
1463dea3101eS #define CMD_XMIT_BCAST_CN       0x04
1464dea3101eS #define CMD_XMIT_BCAST_CX       0x05
1465dea3101eS #define CMD_QUE_RING_BUF_CN     0x06
1466dea3101eS #define CMD_QUE_XRI_BUF_CX      0x07
1467dea3101eS #define CMD_IOCB_CONTINUE_CN    0x08
1468dea3101eS #define CMD_RET_XRI_BUF_CX      0x09
1469dea3101eS #define CMD_ELS_REQUEST_CR      0x0A
1470dea3101eS #define CMD_ELS_REQUEST_CX      0x0B
1471dea3101eS #define CMD_RCV_ELS_REQ_CX      0x0D
1472dea3101eS #define CMD_ABORT_XRI_CN        0x0E
1473dea3101eS #define CMD_ABORT_XRI_CX        0x0F
1474dea3101eS #define CMD_CLOSE_XRI_CN        0x10
1475dea3101eS #define CMD_CLOSE_XRI_CX        0x11
1476dea3101eS #define CMD_CREATE_XRI_CR       0x12
1477dea3101eS #define CMD_CREATE_XRI_CX       0x13
1478dea3101eS #define CMD_GET_RPI_CN          0x14
1479dea3101eS #define CMD_XMIT_ELS_RSP_CX     0x15
1480dea3101eS #define CMD_GET_RPI_CR          0x16
1481dea3101eS #define CMD_XRI_ABORTED_CX      0x17
1482dea3101eS #define CMD_FCP_IWRITE_CR       0x18
1483dea3101eS #define CMD_FCP_IWRITE_CX       0x19
1484dea3101eS #define CMD_FCP_IREAD_CR        0x1A
1485dea3101eS #define CMD_FCP_IREAD_CX        0x1B
1486dea3101eS #define CMD_FCP_ICMND_CR        0x1C
1487dea3101eS #define CMD_FCP_ICMND_CX        0x1D
1488f5603511SJames Smart #define CMD_FCP_TSEND_CX        0x1F
1489f5603511SJames Smart #define CMD_FCP_TRECEIVE_CX     0x21
1490f5603511SJames Smart #define CMD_FCP_TRSP_CX	        0x23
1491f5603511SJames Smart #define CMD_FCP_AUTO_TRSP_CX    0x29
1492dea3101eS 
1493dea3101eS #define CMD_ADAPTER_MSG         0x20
1494dea3101eS #define CMD_ADAPTER_DUMP        0x22
1495dea3101eS 
1496dea3101eS /*  SLI_2 IOCB Command Set */
1497dea3101eS 
149857127f15SJames Smart #define CMD_ASYNC_STATUS        0x7C
1499dea3101eS #define CMD_RCV_SEQUENCE64_CX   0x81
1500dea3101eS #define CMD_XMIT_SEQUENCE64_CR  0x82
1501dea3101eS #define CMD_XMIT_SEQUENCE64_CX  0x83
1502dea3101eS #define CMD_XMIT_BCAST64_CN     0x84
1503dea3101eS #define CMD_XMIT_BCAST64_CX     0x85
1504dea3101eS #define CMD_QUE_RING_BUF64_CN   0x86
1505dea3101eS #define CMD_QUE_XRI_BUF64_CX    0x87
1506dea3101eS #define CMD_IOCB_CONTINUE64_CN  0x88
1507dea3101eS #define CMD_RET_XRI_BUF64_CX    0x89
1508dea3101eS #define CMD_ELS_REQUEST64_CR    0x8A
1509dea3101eS #define CMD_ELS_REQUEST64_CX    0x8B
1510dea3101eS #define CMD_ABORT_MXRI64_CN     0x8C
1511dea3101eS #define CMD_RCV_ELS_REQ64_CX    0x8D
1512dea3101eS #define CMD_XMIT_ELS_RSP64_CX   0x95
15136669f9bbSJames Smart #define CMD_XMIT_BLS_RSP64_CX   0x97
1514dea3101eS #define CMD_FCP_IWRITE64_CR     0x98
1515dea3101eS #define CMD_FCP_IWRITE64_CX     0x99
1516dea3101eS #define CMD_FCP_IREAD64_CR      0x9A
1517dea3101eS #define CMD_FCP_IREAD64_CX      0x9B
1518dea3101eS #define CMD_FCP_ICMND64_CR      0x9C
1519dea3101eS #define CMD_FCP_ICMND64_CX      0x9D
1520f5603511SJames Smart #define CMD_FCP_TSEND64_CX      0x9F
1521f5603511SJames Smart #define CMD_FCP_TRECEIVE64_CX   0xA1
1522f5603511SJames Smart #define CMD_FCP_TRSP64_CX       0xA3
1523dea3101eS 
152476bb24efSJames Smart #define CMD_QUE_XRI64_CX	0xB3
1525ed957684SJames Smart #define CMD_IOCB_RCV_SEQ64_CX	0xB5
1526ed957684SJames Smart #define CMD_IOCB_RCV_ELS64_CX	0xB7
15273163f725SJames Smart #define CMD_IOCB_RET_XRI64_CX	0xB9
1528ed957684SJames Smart #define CMD_IOCB_RCV_CONT64_CX	0xBB
1529ed957684SJames Smart 
1530dea3101eS #define CMD_GEN_REQUEST64_CR    0xC2
1531dea3101eS #define CMD_GEN_REQUEST64_CX    0xC3
1532dea3101eS 
15333163f725SJames Smart /* Unhandled SLI-3 Commands */
15343163f725SJames Smart #define CMD_IOCB_XMIT_MSEQ64_CR		0xB0
15353163f725SJames Smart #define CMD_IOCB_XMIT_MSEQ64_CX		0xB1
15363163f725SJames Smart #define CMD_IOCB_RCV_SEQ_LIST64_CX	0xC1
15373163f725SJames Smart #define CMD_IOCB_RCV_ELS_LIST64_CX	0xCD
15383163f725SJames Smart #define CMD_IOCB_CLOSE_EXTENDED_CN	0xB6
15393163f725SJames Smart #define CMD_IOCB_ABORT_EXTENDED_CN	0xBA
15403163f725SJames Smart #define CMD_IOCB_RET_HBQE64_CN		0xCA
15413163f725SJames Smart #define CMD_IOCB_FCP_IBIDIR64_CR	0xAC
15423163f725SJames Smart #define CMD_IOCB_FCP_IBIDIR64_CX	0xAD
15433163f725SJames Smart #define CMD_IOCB_FCP_ITASKMGT64_CX	0xAF
15443163f725SJames Smart #define CMD_IOCB_LOGENTRY_CN		0x94
15453163f725SJames Smart #define CMD_IOCB_LOGENTRY_ASYNC_CN	0x96
15463163f725SJames Smart 
1547341af102SJames Smart /* Data Security SLI Commands */
1548341af102SJames Smart #define DSSCMD_IWRITE64_CR		0xF8
1549341af102SJames Smart #define DSSCMD_IWRITE64_CX		0xF9
1550341af102SJames Smart #define DSSCMD_IREAD64_CR		0xFA
1551341af102SJames Smart #define DSSCMD_IREAD64_CX		0xFB
1552da0436e9SJames Smart 
1553341af102SJames Smart #define CMD_MAX_IOCB_CMD        0xFB
1554dea3101eS #define CMD_IOCB_MASK           0xff
1555dea3101eS 
1556dea3101eS #define MAX_MSG_DATA            28	/* max msg data in CMD_ADAPTER_MSG
1557dea3101eS 					   iocb */
1558dea3101eS #define LPFC_MAX_ADPTMSG         32	/* max msg data */
1559dea3101eS /*
1560dea3101eS  *  Define Status
1561dea3101eS  */
1562dea3101eS #define MBX_SUCCESS                 0
1563dea3101eS #define MBXERR_NUM_RINGS            1
1564dea3101eS #define MBXERR_NUM_IOCBS            2
1565dea3101eS #define MBXERR_IOCBS_EXCEEDED       3
1566dea3101eS #define MBXERR_BAD_RING_NUMBER      4
1567dea3101eS #define MBXERR_MASK_ENTRIES_RANGE   5
1568dea3101eS #define MBXERR_MASKS_EXCEEDED       6
1569dea3101eS #define MBXERR_BAD_PROFILE          7
1570dea3101eS #define MBXERR_BAD_DEF_CLASS        8
1571dea3101eS #define MBXERR_BAD_MAX_RESPONDER    9
1572dea3101eS #define MBXERR_BAD_MAX_ORIGINATOR   10
1573dea3101eS #define MBXERR_RPI_REGISTERED       11
1574dea3101eS #define MBXERR_RPI_FULL             12
1575dea3101eS #define MBXERR_NO_RESOURCES         13
1576dea3101eS #define MBXERR_BAD_RCV_LENGTH       14
1577dea3101eS #define MBXERR_DMA_ERROR            15
1578dea3101eS #define MBXERR_ERROR                16
1579da0436e9SJames Smart #define MBXERR_LINK_DOWN            0x33
1580dcf2a4e0SJames Smart #define MBXERR_SEC_NO_PERMISSION    0xF02
1581dea3101eS #define MBX_NOT_FINISHED            255
1582dea3101eS 
1583dea3101eS #define MBX_BUSY                   0xffffff /* Attempted cmd to busy Mailbox */
1584dea3101eS #define MBX_TIMEOUT                0xfffffe /* time-out expired waiting for */
1585dea3101eS 
158657127f15SJames Smart #define TEMPERATURE_OFFSET 0xB0	/* Slim offset for critical temperature event */
158757127f15SJames Smart 
1588dea3101eS /*
1589dea3101eS  *    Begin Structure Definitions for Mailbox Commands
1590dea3101eS  */
1591dea3101eS 
1592dea3101eS typedef struct {
1593dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1594dea3101eS 	uint8_t tval;
1595dea3101eS 	uint8_t tmask;
1596dea3101eS 	uint8_t rval;
1597dea3101eS 	uint8_t rmask;
1598dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1599dea3101eS 	uint8_t rmask;
1600dea3101eS 	uint8_t rval;
1601dea3101eS 	uint8_t tmask;
1602dea3101eS 	uint8_t tval;
1603dea3101eS #endif
1604dea3101eS } RR_REG;
1605dea3101eS 
1606dea3101eS struct ulp_bde {
1607dea3101eS 	uint32_t bdeAddress;
1608dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1609dea3101eS 	uint32_t bdeReserved:4;
1610dea3101eS 	uint32_t bdeAddrHigh:4;
1611dea3101eS 	uint32_t bdeSize:24;
1612dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1613dea3101eS 	uint32_t bdeSize:24;
1614dea3101eS 	uint32_t bdeAddrHigh:4;
1615dea3101eS 	uint32_t bdeReserved:4;
1616dea3101eS #endif
1617dea3101eS };
1618dea3101eS 
1619dea3101eS typedef struct ULP_BDL {	/* SLI-2 */
1620dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1621dea3101eS 	uint32_t bdeFlags:8;	/* BDL Flags */
1622dea3101eS 	uint32_t bdeSize:24;	/* Size of BDL array in host memory (bytes) */
1623dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1624dea3101eS 	uint32_t bdeSize:24;	/* Size of BDL array in host memory (bytes) */
1625dea3101eS 	uint32_t bdeFlags:8;	/* BDL Flags */
1626dea3101eS #endif
1627dea3101eS 
1628dea3101eS 	uint32_t addrLow;	/* Address 0:31 */
1629dea3101eS 	uint32_t addrHigh;	/* Address 32:63 */
1630dea3101eS 	uint32_t ulpIoTag32;	/* Can be used for 32 bit I/O Tag */
1631dea3101eS } ULP_BDL;
1632dea3101eS 
163381301a9bSJames Smart /*
163481301a9bSJames Smart  * BlockGuard Definitions
163581301a9bSJames Smart  */
163681301a9bSJames Smart 
163781301a9bSJames Smart enum lpfc_protgrp_type {
163881301a9bSJames Smart 	LPFC_PG_TYPE_INVALID = 0, /* used to indicate errors                  */
163981301a9bSJames Smart 	LPFC_PG_TYPE_NO_DIF,	  /* no DIF data pointed to by prot grp       */
164081301a9bSJames Smart 	LPFC_PG_TYPE_EMBD_DIF,	  /* DIF is embedded (inline) with data       */
164181301a9bSJames Smart 	LPFC_PG_TYPE_DIF_BUF	  /* DIF has its own scatter/gather list      */
164281301a9bSJames Smart };
164381301a9bSJames Smart 
164481301a9bSJames Smart /* PDE Descriptors */
16456c8eea54SJames Smart #define LPFC_PDE5_DESCRIPTOR		0x85
16466c8eea54SJames Smart #define LPFC_PDE6_DESCRIPTOR		0x86
16476c8eea54SJames Smart #define LPFC_PDE7_DESCRIPTOR		0x87
164881301a9bSJames Smart 
16496c8eea54SJames Smart /* BlockGuard Opcodes */
16506c8eea54SJames Smart #define BG_OP_IN_NODIF_OUT_CRC		0x0
16516c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_NODIF		0x1
16526c8eea54SJames Smart #define	BG_OP_IN_NODIF_OUT_CSUM		0x2
16536c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_NODIF		0x3
16546c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_CRC		0x4
16556c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_CSUM		0x5
16566c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_CSUM		0x6
16576c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_CRC		0x7
16586c8eea54SJames Smart 
16596c8eea54SJames Smart struct lpfc_pde5 {
16606c8eea54SJames Smart 	uint32_t word0;
16616c8eea54SJames Smart #define pde5_type_SHIFT		24
16626c8eea54SJames Smart #define pde5_type_MASK		0x000000ff
16636c8eea54SJames Smart #define pde5_type_WORD		word0
16646c8eea54SJames Smart #define pde5_rsvd0_SHIFT	0
16656c8eea54SJames Smart #define pde5_rsvd0_MASK		0x00ffffff
16666c8eea54SJames Smart #define pde5_rsvd0_WORD		word0
16676c8eea54SJames Smart 	uint32_t reftag;	/* Reference Tag Value			*/
16686c8eea54SJames Smart 	uint32_t reftagtr;	/* Reference Tag Translation Value 	*/
166981301a9bSJames Smart };
167081301a9bSJames Smart 
16716c8eea54SJames Smart struct lpfc_pde6 {
16726c8eea54SJames Smart 	uint32_t word0;
16736c8eea54SJames Smart #define pde6_type_SHIFT		24
16746c8eea54SJames Smart #define pde6_type_MASK		0x000000ff
16756c8eea54SJames Smart #define pde6_type_WORD		word0
16766c8eea54SJames Smart #define pde6_rsvd0_SHIFT	0
16776c8eea54SJames Smart #define pde6_rsvd0_MASK		0x00ffffff
16786c8eea54SJames Smart #define pde6_rsvd0_WORD		word0
16796c8eea54SJames Smart 	uint32_t word1;
16806c8eea54SJames Smart #define pde6_rsvd1_SHIFT	26
16816c8eea54SJames Smart #define pde6_rsvd1_MASK		0x0000003f
16826c8eea54SJames Smart #define pde6_rsvd1_WORD		word1
16836c8eea54SJames Smart #define pde6_na_SHIFT		25
16846c8eea54SJames Smart #define pde6_na_MASK		0x00000001
16856c8eea54SJames Smart #define pde6_na_WORD		word1
16866c8eea54SJames Smart #define pde6_rsvd2_SHIFT	16
16876c8eea54SJames Smart #define pde6_rsvd2_MASK		0x000001FF
16886c8eea54SJames Smart #define pde6_rsvd2_WORD		word1
16896c8eea54SJames Smart #define pde6_apptagtr_SHIFT	0
16906c8eea54SJames Smart #define pde6_apptagtr_MASK	0x0000ffff
16916c8eea54SJames Smart #define pde6_apptagtr_WORD	word1
16926c8eea54SJames Smart 	uint32_t word2;
16936c8eea54SJames Smart #define pde6_optx_SHIFT		28
16946c8eea54SJames Smart #define pde6_optx_MASK		0x0000000f
16956c8eea54SJames Smart #define pde6_optx_WORD		word2
16966c8eea54SJames Smart #define pde6_oprx_SHIFT		24
16976c8eea54SJames Smart #define pde6_oprx_MASK		0x0000000f
16986c8eea54SJames Smart #define pde6_oprx_WORD		word2
16996c8eea54SJames Smart #define pde6_nr_SHIFT		23
17006c8eea54SJames Smart #define pde6_nr_MASK		0x00000001
17016c8eea54SJames Smart #define pde6_nr_WORD		word2
17026c8eea54SJames Smart #define pde6_ce_SHIFT		22
17036c8eea54SJames Smart #define pde6_ce_MASK		0x00000001
17046c8eea54SJames Smart #define pde6_ce_WORD		word2
17056c8eea54SJames Smart #define pde6_re_SHIFT		21
17066c8eea54SJames Smart #define pde6_re_MASK		0x00000001
17076c8eea54SJames Smart #define pde6_re_WORD		word2
17086c8eea54SJames Smart #define pde6_ae_SHIFT		20
17096c8eea54SJames Smart #define pde6_ae_MASK		0x00000001
17106c8eea54SJames Smart #define pde6_ae_WORD		word2
17116c8eea54SJames Smart #define pde6_ai_SHIFT		19
17126c8eea54SJames Smart #define pde6_ai_MASK		0x00000001
17136c8eea54SJames Smart #define pde6_ai_WORD		word2
17146c8eea54SJames Smart #define pde6_bs_SHIFT		16
17156c8eea54SJames Smart #define pde6_bs_MASK		0x00000007
17166c8eea54SJames Smart #define pde6_bs_WORD		word2
17176c8eea54SJames Smart #define pde6_apptagval_SHIFT	0
17186c8eea54SJames Smart #define pde6_apptagval_MASK	0x0000ffff
17196c8eea54SJames Smart #define pde6_apptagval_WORD	word2
172081301a9bSJames Smart };
172181301a9bSJames Smart 
17227f86059aSJames Smart struct lpfc_pde7 {
17237f86059aSJames Smart 	uint32_t word0;
17247f86059aSJames Smart #define pde7_type_SHIFT		24
17257f86059aSJames Smart #define pde7_type_MASK		0x000000ff
17267f86059aSJames Smart #define pde7_type_WORD		word0
17277f86059aSJames Smart #define pde7_rsvd0_SHIFT	0
17287f86059aSJames Smart #define pde7_rsvd0_MASK		0x00ffffff
17297f86059aSJames Smart #define pde7_rsvd0_WORD		word0
17307f86059aSJames Smart 	uint32_t addrHigh;
17317f86059aSJames Smart 	uint32_t addrLow;
17327f86059aSJames Smart };
173381301a9bSJames Smart 
1734dea3101eS /* Structure for MB Command LOAD_SM and DOWN_LOAD */
1735dea3101eS 
1736dea3101eS typedef struct {
1737dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1738dea3101eS 	uint32_t rsvd2:25;
1739dea3101eS 	uint32_t acknowledgment:1;
1740dea3101eS 	uint32_t version:1;
1741dea3101eS 	uint32_t erase_or_prog:1;
1742dea3101eS 	uint32_t update_flash:1;
1743dea3101eS 	uint32_t update_ram:1;
1744dea3101eS 	uint32_t method:1;
1745dea3101eS 	uint32_t load_cmplt:1;
1746dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1747dea3101eS 	uint32_t load_cmplt:1;
1748dea3101eS 	uint32_t method:1;
1749dea3101eS 	uint32_t update_ram:1;
1750dea3101eS 	uint32_t update_flash:1;
1751dea3101eS 	uint32_t erase_or_prog:1;
1752dea3101eS 	uint32_t version:1;
1753dea3101eS 	uint32_t acknowledgment:1;
1754dea3101eS 	uint32_t rsvd2:25;
1755dea3101eS #endif
1756dea3101eS 
1757dea3101eS 	uint32_t dl_to_adr_low;
1758dea3101eS 	uint32_t dl_to_adr_high;
1759dea3101eS 	uint32_t dl_len;
1760dea3101eS 	union {
1761dea3101eS 		uint32_t dl_from_mbx_offset;
1762dea3101eS 		struct ulp_bde dl_from_bde;
1763dea3101eS 		struct ulp_bde64 dl_from_bde64;
1764dea3101eS 	} un;
1765dea3101eS 
1766dea3101eS } LOAD_SM_VAR;
1767dea3101eS 
1768dea3101eS /* Structure for MB Command READ_NVPARM (02) */
1769dea3101eS 
1770dea3101eS typedef struct {
1771dea3101eS 	uint32_t rsvd1[3];	/* Read as all one's */
1772dea3101eS 	uint32_t rsvd2;		/* Read as all zero's */
1773dea3101eS 	uint32_t portname[2];	/* N_PORT name */
1774dea3101eS 	uint32_t nodename[2];	/* NODE name */
1775dea3101eS 
1776dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1777dea3101eS 	uint32_t pref_DID:24;
1778dea3101eS 	uint32_t hardAL_PA:8;
1779dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1780dea3101eS 	uint32_t hardAL_PA:8;
1781dea3101eS 	uint32_t pref_DID:24;
1782dea3101eS #endif
1783dea3101eS 
1784dea3101eS 	uint32_t rsvd3[21];	/* Read as all one's */
1785dea3101eS } READ_NV_VAR;
1786dea3101eS 
1787dea3101eS /* Structure for MB Command WRITE_NVPARMS (03) */
1788dea3101eS 
1789dea3101eS typedef struct {
1790dea3101eS 	uint32_t rsvd1[3];	/* Must be all one's */
1791dea3101eS 	uint32_t rsvd2;		/* Must be all zero's */
1792dea3101eS 	uint32_t portname[2];	/* N_PORT name */
1793dea3101eS 	uint32_t nodename[2];	/* NODE name */
1794dea3101eS 
1795dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1796dea3101eS 	uint32_t pref_DID:24;
1797dea3101eS 	uint32_t hardAL_PA:8;
1798dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1799dea3101eS 	uint32_t hardAL_PA:8;
1800dea3101eS 	uint32_t pref_DID:24;
1801dea3101eS #endif
1802dea3101eS 
1803dea3101eS 	uint32_t rsvd3[21];	/* Must be all one's */
1804dea3101eS } WRITE_NV_VAR;
1805dea3101eS 
1806dea3101eS /* Structure for MB Command RUN_BIU_DIAG (04) */
1807dea3101eS /* Structure for MB Command RUN_BIU_DIAG64 (0x84) */
1808dea3101eS 
1809dea3101eS typedef struct {
1810dea3101eS 	uint32_t rsvd1;
1811dea3101eS 	union {
1812dea3101eS 		struct {
1813dea3101eS 			struct ulp_bde xmit_bde;
1814dea3101eS 			struct ulp_bde rcv_bde;
1815dea3101eS 		} s1;
1816dea3101eS 		struct {
1817dea3101eS 			struct ulp_bde64 xmit_bde64;
1818dea3101eS 			struct ulp_bde64 rcv_bde64;
1819dea3101eS 		} s2;
1820dea3101eS 	} un;
1821dea3101eS } BIU_DIAG_VAR;
1822dea3101eS 
1823c7495937SJames Smart /* Structure for MB command READ_EVENT_LOG (0x38) */
1824c7495937SJames Smart struct READ_EVENT_LOG_VAR {
1825c7495937SJames Smart 	uint32_t word1;
1826c7495937SJames Smart #define lpfc_event_log_SHIFT	29
1827c7495937SJames Smart #define lpfc_event_log_MASK	0x00000001
1828c7495937SJames Smart #define lpfc_event_log_WORD	word1
1829c7495937SJames Smart #define USE_MAILBOX_RESPONSE	1
1830c7495937SJames Smart 	uint32_t offset;
1831c7495937SJames Smart 	struct ulp_bde64 rcv_bde64;
1832c7495937SJames Smart };
1833c7495937SJames Smart 
1834dea3101eS /* Structure for MB Command INIT_LINK (05) */
1835dea3101eS 
1836dea3101eS typedef struct {
1837dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1838dea3101eS 	uint32_t rsvd1:24;
1839dea3101eS 	uint32_t lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective Reset to */
1840dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1841dea3101eS 	uint32_t lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective Reset to */
1842dea3101eS 	uint32_t rsvd1:24;
1843dea3101eS #endif
1844dea3101eS 
1845dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1846dea3101eS 	uint8_t fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
1847dea3101eS 	uint8_t rsvd2;
1848dea3101eS 	uint16_t link_flags;
1849dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1850dea3101eS 	uint16_t link_flags;
1851dea3101eS 	uint8_t rsvd2;
1852dea3101eS 	uint8_t fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
1853dea3101eS #endif
1854dea3101eS 
1855dea3101eS #define FLAGS_LOCAL_LB               0x01 /* link_flags (=1) ENDEC loopback */
1856dea3101eS #define FLAGS_TOPOLOGY_MODE_LOOP_PT  0x00 /* Attempt loop then pt-pt */
1857dea3101eS #define FLAGS_TOPOLOGY_MODE_PT_PT    0x02 /* Attempt pt-pt only */
1858dea3101eS #define FLAGS_TOPOLOGY_MODE_LOOP     0x04 /* Attempt loop only */
1859dea3101eS #define FLAGS_TOPOLOGY_MODE_PT_LOOP  0x06 /* Attempt pt-pt then loop */
1860ed957684SJames Smart #define	FLAGS_UNREG_LOGIN_ALL	     0x08 /* UNREG_LOGIN all on link down */
1861dea3101eS #define FLAGS_LIRP_LILP              0x80 /* LIRP / LILP is disabled */
1862dea3101eS 
1863dea3101eS #define FLAGS_TOPOLOGY_FAILOVER      0x0400	/* Bit 10 */
1864dea3101eS #define FLAGS_LINK_SPEED             0x0800	/* Bit 11 */
18654b0b91d4SJames Smart #define FLAGS_IMED_ABORT             0x04000	/* Bit 14 */
1866dea3101eS 
1867dea3101eS 	uint32_t link_speed;
186876a95d75SJames Smart #define LINK_SPEED_AUTO 0x0     /* Auto selection */
186976a95d75SJames Smart #define LINK_SPEED_1G   0x1     /* 1 Gigabaud */
187076a95d75SJames Smart #define LINK_SPEED_2G   0x2     /* 2 Gigabaud */
187176a95d75SJames Smart #define LINK_SPEED_4G   0x4     /* 4 Gigabaud */
187276a95d75SJames Smart #define LINK_SPEED_8G   0x8     /* 8 Gigabaud */
187376a95d75SJames Smart #define LINK_SPEED_10G  0x10    /* 10 Gigabaud */
187476a95d75SJames Smart #define LINK_SPEED_16G  0x11    /* 16 Gigabaud */
1875dea3101eS 
1876dea3101eS } INIT_LINK_VAR;
1877dea3101eS 
1878dea3101eS /* Structure for MB Command DOWN_LINK (06) */
1879dea3101eS 
1880dea3101eS typedef struct {
1881dea3101eS 	uint32_t rsvd1;
1882dea3101eS } DOWN_LINK_VAR;
1883dea3101eS 
1884dea3101eS /* Structure for MB Command CONFIG_LINK (07) */
1885dea3101eS 
1886dea3101eS typedef struct {
1887dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1888dea3101eS 	uint32_t cr:1;
1889dea3101eS 	uint32_t ci:1;
1890dea3101eS 	uint32_t cr_delay:6;
1891dea3101eS 	uint32_t cr_count:8;
1892dea3101eS 	uint32_t rsvd1:8;
1893dea3101eS 	uint32_t MaxBBC:8;
1894dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1895dea3101eS 	uint32_t MaxBBC:8;
1896dea3101eS 	uint32_t rsvd1:8;
1897dea3101eS 	uint32_t cr_count:8;
1898dea3101eS 	uint32_t cr_delay:6;
1899dea3101eS 	uint32_t ci:1;
1900dea3101eS 	uint32_t cr:1;
1901dea3101eS #endif
1902dea3101eS 
1903dea3101eS 	uint32_t myId;
1904dea3101eS 	uint32_t rsvd2;
1905dea3101eS 	uint32_t edtov;
1906dea3101eS 	uint32_t arbtov;
1907dea3101eS 	uint32_t ratov;
1908dea3101eS 	uint32_t rttov;
1909dea3101eS 	uint32_t altov;
1910dea3101eS 	uint32_t crtov;
1911dea3101eS 	uint32_t citov;
1912dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1913dea3101eS 	uint32_t rrq_enable:1;
1914dea3101eS 	uint32_t rrq_immed:1;
1915dea3101eS 	uint32_t rsvd4:29;
1916dea3101eS 	uint32_t ack0_enable:1;
1917dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1918dea3101eS 	uint32_t ack0_enable:1;
1919dea3101eS 	uint32_t rsvd4:29;
1920dea3101eS 	uint32_t rrq_immed:1;
1921dea3101eS 	uint32_t rrq_enable:1;
1922dea3101eS #endif
1923dea3101eS } CONFIG_LINK;
1924dea3101eS 
1925dea3101eS /* Structure for MB Command PART_SLIM (08)
1926dea3101eS  * will be removed since SLI1 is no longer supported!
1927dea3101eS  */
1928dea3101eS typedef struct {
1929dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1930dea3101eS 	uint16_t offCiocb;
1931dea3101eS 	uint16_t numCiocb;
1932dea3101eS 	uint16_t offRiocb;
1933dea3101eS 	uint16_t numRiocb;
1934dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1935dea3101eS 	uint16_t numCiocb;
1936dea3101eS 	uint16_t offCiocb;
1937dea3101eS 	uint16_t numRiocb;
1938dea3101eS 	uint16_t offRiocb;
1939dea3101eS #endif
1940dea3101eS } RING_DEF;
1941dea3101eS 
1942dea3101eS typedef struct {
1943dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1944dea3101eS 	uint32_t unused1:24;
1945dea3101eS 	uint32_t numRing:8;
1946dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1947dea3101eS 	uint32_t numRing:8;
1948dea3101eS 	uint32_t unused1:24;
1949dea3101eS #endif
1950dea3101eS 
1951dea3101eS 	RING_DEF ringdef[4];
1952dea3101eS 	uint32_t hbainit;
1953dea3101eS } PART_SLIM_VAR;
1954dea3101eS 
1955dea3101eS /* Structure for MB Command CONFIG_RING (09) */
1956dea3101eS 
1957dea3101eS typedef struct {
1958dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1959dea3101eS 	uint32_t unused2:6;
1960dea3101eS 	uint32_t recvSeq:1;
1961dea3101eS 	uint32_t recvNotify:1;
1962dea3101eS 	uint32_t numMask:8;
1963dea3101eS 	uint32_t profile:8;
1964dea3101eS 	uint32_t unused1:4;
1965dea3101eS 	uint32_t ring:4;
1966dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1967dea3101eS 	uint32_t ring:4;
1968dea3101eS 	uint32_t unused1:4;
1969dea3101eS 	uint32_t profile:8;
1970dea3101eS 	uint32_t numMask:8;
1971dea3101eS 	uint32_t recvNotify:1;
1972dea3101eS 	uint32_t recvSeq:1;
1973dea3101eS 	uint32_t unused2:6;
1974dea3101eS #endif
1975dea3101eS 
1976dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1977dea3101eS 	uint16_t maxRespXchg;
1978dea3101eS 	uint16_t maxOrigXchg;
1979dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1980dea3101eS 	uint16_t maxOrigXchg;
1981dea3101eS 	uint16_t maxRespXchg;
1982dea3101eS #endif
1983dea3101eS 
1984dea3101eS 	RR_REG rrRegs[6];
1985dea3101eS } CONFIG_RING_VAR;
1986dea3101eS 
1987dea3101eS /* Structure for MB Command RESET_RING (10) */
1988dea3101eS 
1989dea3101eS typedef struct {
1990dea3101eS 	uint32_t ring_no;
1991dea3101eS } RESET_RING_VAR;
1992dea3101eS 
1993dea3101eS /* Structure for MB Command READ_CONFIG (11) */
1994dea3101eS 
1995dea3101eS typedef struct {
1996dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1997dea3101eS 	uint32_t cr:1;
1998dea3101eS 	uint32_t ci:1;
1999dea3101eS 	uint32_t cr_delay:6;
2000dea3101eS 	uint32_t cr_count:8;
2001dea3101eS 	uint32_t InitBBC:8;
2002dea3101eS 	uint32_t MaxBBC:8;
2003dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2004dea3101eS 	uint32_t MaxBBC:8;
2005dea3101eS 	uint32_t InitBBC:8;
2006dea3101eS 	uint32_t cr_count:8;
2007dea3101eS 	uint32_t cr_delay:6;
2008dea3101eS 	uint32_t ci:1;
2009dea3101eS 	uint32_t cr:1;
2010dea3101eS #endif
2011dea3101eS 
2012dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2013dea3101eS 	uint32_t topology:8;
2014dea3101eS 	uint32_t myDid:24;
2015dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2016dea3101eS 	uint32_t myDid:24;
2017dea3101eS 	uint32_t topology:8;
2018dea3101eS #endif
2019dea3101eS 
2020dea3101eS 	/* Defines for topology (defined previously) */
2021dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2022dea3101eS 	uint32_t AR:1;
2023dea3101eS 	uint32_t IR:1;
2024dea3101eS 	uint32_t rsvd1:29;
2025dea3101eS 	uint32_t ack0:1;
2026dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2027dea3101eS 	uint32_t ack0:1;
2028dea3101eS 	uint32_t rsvd1:29;
2029dea3101eS 	uint32_t IR:1;
2030dea3101eS 	uint32_t AR:1;
2031dea3101eS #endif
2032dea3101eS 
2033dea3101eS 	uint32_t edtov;
2034dea3101eS 	uint32_t arbtov;
2035dea3101eS 	uint32_t ratov;
2036dea3101eS 	uint32_t rttov;
2037dea3101eS 	uint32_t altov;
2038dea3101eS 	uint32_t lmt;
203974b72a59SJamie Wellnitz #define LMT_RESERVED  0x000    /* Not used */
204074b72a59SJamie Wellnitz #define LMT_1Gb       0x004
204174b72a59SJamie Wellnitz #define LMT_2Gb       0x008
204274b72a59SJamie Wellnitz #define LMT_4Gb       0x040
204374b72a59SJamie Wellnitz #define LMT_8Gb       0x080
204474b72a59SJamie Wellnitz #define LMT_10Gb      0x100
204576a95d75SJames Smart #define LMT_16Gb      0x200
2046dea3101eS 	uint32_t rsvd2;
2047dea3101eS 	uint32_t rsvd3;
2048dea3101eS 	uint32_t max_xri;
2049dea3101eS 	uint32_t max_iocb;
2050dea3101eS 	uint32_t max_rpi;
2051dea3101eS 	uint32_t avail_xri;
2052dea3101eS 	uint32_t avail_iocb;
2053dea3101eS 	uint32_t avail_rpi;
2054858c9f6cSJames Smart 	uint32_t max_vpi;
2055858c9f6cSJames Smart 	uint32_t rsvd4;
2056858c9f6cSJames Smart 	uint32_t rsvd5;
2057858c9f6cSJames Smart 	uint32_t avail_vpi;
2058dea3101eS } READ_CONFIG_VAR;
2059dea3101eS 
2060dea3101eS /* Structure for MB Command READ_RCONFIG (12) */
2061dea3101eS 
2062dea3101eS typedef struct {
2063dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2064dea3101eS 	uint32_t rsvd2:7;
2065dea3101eS 	uint32_t recvNotify:1;
2066dea3101eS 	uint32_t numMask:8;
2067dea3101eS 	uint32_t profile:8;
2068dea3101eS 	uint32_t rsvd1:4;
2069dea3101eS 	uint32_t ring:4;
2070dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2071dea3101eS 	uint32_t ring:4;
2072dea3101eS 	uint32_t rsvd1:4;
2073dea3101eS 	uint32_t profile:8;
2074dea3101eS 	uint32_t numMask:8;
2075dea3101eS 	uint32_t recvNotify:1;
2076dea3101eS 	uint32_t rsvd2:7;
2077dea3101eS #endif
2078dea3101eS 
2079dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2080dea3101eS 	uint16_t maxResp;
2081dea3101eS 	uint16_t maxOrig;
2082dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2083dea3101eS 	uint16_t maxOrig;
2084dea3101eS 	uint16_t maxResp;
2085dea3101eS #endif
2086dea3101eS 
2087dea3101eS 	RR_REG rrRegs[6];
2088dea3101eS 
2089dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2090dea3101eS 	uint16_t cmdRingOffset;
2091dea3101eS 	uint16_t cmdEntryCnt;
2092dea3101eS 	uint16_t rspRingOffset;
2093dea3101eS 	uint16_t rspEntryCnt;
2094dea3101eS 	uint16_t nextCmdOffset;
2095dea3101eS 	uint16_t rsvd3;
2096dea3101eS 	uint16_t nextRspOffset;
2097dea3101eS 	uint16_t rsvd4;
2098dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2099dea3101eS 	uint16_t cmdEntryCnt;
2100dea3101eS 	uint16_t cmdRingOffset;
2101dea3101eS 	uint16_t rspEntryCnt;
2102dea3101eS 	uint16_t rspRingOffset;
2103dea3101eS 	uint16_t rsvd3;
2104dea3101eS 	uint16_t nextCmdOffset;
2105dea3101eS 	uint16_t rsvd4;
2106dea3101eS 	uint16_t nextRspOffset;
2107dea3101eS #endif
2108dea3101eS } READ_RCONF_VAR;
2109dea3101eS 
2110dea3101eS /* Structure for MB Command READ_SPARM (13) */
2111dea3101eS /* Structure for MB Command READ_SPARM64 (0x8D) */
2112dea3101eS 
2113dea3101eS typedef struct {
2114dea3101eS 	uint32_t rsvd1;
2115dea3101eS 	uint32_t rsvd2;
2116dea3101eS 	union {
2117dea3101eS 		struct ulp_bde sp; /* This BDE points to struct serv_parm
2118dea3101eS 				      structure */
2119dea3101eS 		struct ulp_bde64 sp64;
2120dea3101eS 	} un;
2121ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2122ed957684SJames Smart 	uint16_t rsvd3;
2123ed957684SJames Smart 	uint16_t vpi;
2124ed957684SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
2125ed957684SJames Smart 	uint16_t vpi;
2126ed957684SJames Smart 	uint16_t rsvd3;
2127ed957684SJames Smart #endif
2128dea3101eS } READ_SPARM_VAR;
2129dea3101eS 
2130dea3101eS /* Structure for MB Command READ_STATUS (14) */
2131dea3101eS 
2132dea3101eS typedef struct {
2133dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2134dea3101eS 	uint32_t rsvd1:31;
2135dea3101eS 	uint32_t clrCounters:1;
2136dea3101eS 	uint16_t activeXriCnt;
2137dea3101eS 	uint16_t activeRpiCnt;
2138dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2139dea3101eS 	uint32_t clrCounters:1;
2140dea3101eS 	uint32_t rsvd1:31;
2141dea3101eS 	uint16_t activeRpiCnt;
2142dea3101eS 	uint16_t activeXriCnt;
2143dea3101eS #endif
2144dea3101eS 
2145dea3101eS 	uint32_t xmitByteCnt;
2146dea3101eS 	uint32_t rcvByteCnt;
2147dea3101eS 	uint32_t xmitFrameCnt;
2148dea3101eS 	uint32_t rcvFrameCnt;
2149dea3101eS 	uint32_t xmitSeqCnt;
2150dea3101eS 	uint32_t rcvSeqCnt;
2151dea3101eS 	uint32_t totalOrigExchanges;
2152dea3101eS 	uint32_t totalRespExchanges;
2153dea3101eS 	uint32_t rcvPbsyCnt;
2154dea3101eS 	uint32_t rcvFbsyCnt;
2155dea3101eS } READ_STATUS_VAR;
2156dea3101eS 
2157dea3101eS /* Structure for MB Command READ_RPI (15) */
2158dea3101eS /* Structure for MB Command READ_RPI64 (0x8F) */
2159dea3101eS 
2160dea3101eS typedef struct {
2161dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2162dea3101eS 	uint16_t nextRpi;
2163dea3101eS 	uint16_t reqRpi;
2164dea3101eS 	uint32_t rsvd2:8;
2165dea3101eS 	uint32_t DID:24;
2166dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2167dea3101eS 	uint16_t reqRpi;
2168dea3101eS 	uint16_t nextRpi;
2169dea3101eS 	uint32_t DID:24;
2170dea3101eS 	uint32_t rsvd2:8;
2171dea3101eS #endif
2172dea3101eS 
2173dea3101eS 	union {
2174dea3101eS 		struct ulp_bde sp;
2175dea3101eS 		struct ulp_bde64 sp64;
2176dea3101eS 	} un;
2177dea3101eS 
2178dea3101eS } READ_RPI_VAR;
2179dea3101eS 
2180dea3101eS /* Structure for MB Command READ_XRI (16) */
2181dea3101eS 
2182dea3101eS typedef struct {
2183dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2184dea3101eS 	uint16_t nextXri;
2185dea3101eS 	uint16_t reqXri;
2186dea3101eS 	uint16_t rsvd1;
2187dea3101eS 	uint16_t rpi;
2188dea3101eS 	uint32_t rsvd2:8;
2189dea3101eS 	uint32_t DID:24;
2190dea3101eS 	uint32_t rsvd3:8;
2191dea3101eS 	uint32_t SID:24;
2192dea3101eS 	uint32_t rsvd4;
2193dea3101eS 	uint8_t seqId;
2194dea3101eS 	uint8_t rsvd5;
2195dea3101eS 	uint16_t seqCount;
2196dea3101eS 	uint16_t oxId;
2197dea3101eS 	uint16_t rxId;
2198dea3101eS 	uint32_t rsvd6:30;
2199dea3101eS 	uint32_t si:1;
2200dea3101eS 	uint32_t exchOrig:1;
2201dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2202dea3101eS 	uint16_t reqXri;
2203dea3101eS 	uint16_t nextXri;
2204dea3101eS 	uint16_t rpi;
2205dea3101eS 	uint16_t rsvd1;
2206dea3101eS 	uint32_t DID:24;
2207dea3101eS 	uint32_t rsvd2:8;
2208dea3101eS 	uint32_t SID:24;
2209dea3101eS 	uint32_t rsvd3:8;
2210dea3101eS 	uint32_t rsvd4;
2211dea3101eS 	uint16_t seqCount;
2212dea3101eS 	uint8_t rsvd5;
2213dea3101eS 	uint8_t seqId;
2214dea3101eS 	uint16_t rxId;
2215dea3101eS 	uint16_t oxId;
2216dea3101eS 	uint32_t exchOrig:1;
2217dea3101eS 	uint32_t si:1;
2218dea3101eS 	uint32_t rsvd6:30;
2219dea3101eS #endif
2220dea3101eS } READ_XRI_VAR;
2221dea3101eS 
2222dea3101eS /* Structure for MB Command READ_REV (17) */
2223dea3101eS 
2224dea3101eS typedef struct {
2225dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2226dea3101eS 	uint32_t cv:1;
2227dea3101eS 	uint32_t rr:1;
2228ed957684SJames Smart 	uint32_t rsvd2:2;
2229ed957684SJames Smart 	uint32_t v3req:1;
2230ed957684SJames Smart 	uint32_t v3rsp:1;
2231ed957684SJames Smart 	uint32_t rsvd1:25;
2232dea3101eS 	uint32_t rv:1;
2233dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2234dea3101eS 	uint32_t rv:1;
2235ed957684SJames Smart 	uint32_t rsvd1:25;
2236ed957684SJames Smart 	uint32_t v3rsp:1;
2237ed957684SJames Smart 	uint32_t v3req:1;
2238ed957684SJames Smart 	uint32_t rsvd2:2;
2239dea3101eS 	uint32_t rr:1;
2240dea3101eS 	uint32_t cv:1;
2241dea3101eS #endif
2242dea3101eS 
2243dea3101eS 	uint32_t biuRev;
2244dea3101eS 	uint32_t smRev;
2245dea3101eS 	union {
2246dea3101eS 		uint32_t smFwRev;
2247dea3101eS 		struct {
2248dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2249dea3101eS 			uint8_t ProgType;
2250dea3101eS 			uint8_t ProgId;
2251dea3101eS 			uint16_t ProgVer:4;
2252dea3101eS 			uint16_t ProgRev:4;
2253dea3101eS 			uint16_t ProgFixLvl:2;
2254dea3101eS 			uint16_t ProgDistType:2;
2255dea3101eS 			uint16_t DistCnt:4;
2256dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2257dea3101eS 			uint16_t DistCnt:4;
2258dea3101eS 			uint16_t ProgDistType:2;
2259dea3101eS 			uint16_t ProgFixLvl:2;
2260dea3101eS 			uint16_t ProgRev:4;
2261dea3101eS 			uint16_t ProgVer:4;
2262dea3101eS 			uint8_t ProgId;
2263dea3101eS 			uint8_t ProgType;
2264dea3101eS #endif
2265dea3101eS 
2266dea3101eS 		} b;
2267dea3101eS 	} un;
2268dea3101eS 	uint32_t endecRev;
2269dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2270dea3101eS 	uint8_t feaLevelHigh;
2271dea3101eS 	uint8_t feaLevelLow;
2272dea3101eS 	uint8_t fcphHigh;
2273dea3101eS 	uint8_t fcphLow;
2274dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2275dea3101eS 	uint8_t fcphLow;
2276dea3101eS 	uint8_t fcphHigh;
2277dea3101eS 	uint8_t feaLevelLow;
2278dea3101eS 	uint8_t feaLevelHigh;
2279dea3101eS #endif
2280dea3101eS 
2281dea3101eS 	uint32_t postKernRev;
2282dea3101eS 	uint32_t opFwRev;
2283dea3101eS 	uint8_t opFwName[16];
2284dea3101eS 	uint32_t sli1FwRev;
2285dea3101eS 	uint8_t sli1FwName[16];
2286dea3101eS 	uint32_t sli2FwRev;
2287dea3101eS 	uint8_t sli2FwName[16];
2288ed957684SJames Smart 	uint32_t sli3Feat;
2289ed957684SJames Smart 	uint32_t RandomData[6];
2290dea3101eS } READ_REV_VAR;
2291dea3101eS 
2292dea3101eS /* Structure for MB Command READ_LINK_STAT (18) */
2293dea3101eS 
2294dea3101eS typedef struct {
2295dea3101eS 	uint32_t rsvd1;
2296dea3101eS 	uint32_t linkFailureCnt;
2297dea3101eS 	uint32_t lossSyncCnt;
2298dea3101eS 
2299dea3101eS 	uint32_t lossSignalCnt;
2300dea3101eS 	uint32_t primSeqErrCnt;
2301dea3101eS 	uint32_t invalidXmitWord;
2302dea3101eS 	uint32_t crcCnt;
2303dea3101eS 	uint32_t primSeqTimeout;
2304dea3101eS 	uint32_t elasticOverrun;
2305dea3101eS 	uint32_t arbTimeout;
2306dea3101eS } READ_LNK_VAR;
2307dea3101eS 
2308dea3101eS /* Structure for MB Command REG_LOGIN (19) */
2309dea3101eS /* Structure for MB Command REG_LOGIN64 (0x93) */
2310dea3101eS 
2311dea3101eS typedef struct {
2312dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2313dea3101eS 	uint16_t rsvd1;
2314dea3101eS 	uint16_t rpi;
2315dea3101eS 	uint32_t rsvd2:8;
2316dea3101eS 	uint32_t did:24;
2317dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2318dea3101eS 	uint16_t rpi;
2319dea3101eS 	uint16_t rsvd1;
2320dea3101eS 	uint32_t did:24;
2321dea3101eS 	uint32_t rsvd2:8;
2322dea3101eS #endif
2323dea3101eS 
2324dea3101eS 	union {
2325dea3101eS 		struct ulp_bde sp;
2326dea3101eS 		struct ulp_bde64 sp64;
2327dea3101eS 	} un;
2328dea3101eS 
2329ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2330ed957684SJames Smart 	uint16_t rsvd6;
2331ed957684SJames Smart 	uint16_t vpi;
2332ed957684SJames Smart #else /* __LITTLE_ENDIAN_BITFIELD */
2333ed957684SJames Smart 	uint16_t vpi;
2334ed957684SJames Smart 	uint16_t rsvd6;
2335ed957684SJames Smart #endif
2336ed957684SJames Smart 
2337dea3101eS } REG_LOGIN_VAR;
2338dea3101eS 
2339dea3101eS /* Word 30 contents for REG_LOGIN */
2340dea3101eS typedef union {
2341dea3101eS 	struct {
2342dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2343dea3101eS 		uint16_t rsvd1:12;
2344dea3101eS 		uint16_t wd30_class:4;
2345dea3101eS 		uint16_t xri;
2346dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2347dea3101eS 		uint16_t xri;
2348dea3101eS 		uint16_t wd30_class:4;
2349dea3101eS 		uint16_t rsvd1:12;
2350dea3101eS #endif
2351dea3101eS 	} f;
2352dea3101eS 	uint32_t word;
2353dea3101eS } REG_WD30;
2354dea3101eS 
2355dea3101eS /* Structure for MB Command UNREG_LOGIN (20) */
2356dea3101eS 
2357dea3101eS typedef struct {
2358dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2359dea3101eS 	uint16_t rsvd1;
2360dea3101eS 	uint16_t rpi;
2361ed957684SJames Smart 	uint32_t rsvd2;
2362ed957684SJames Smart 	uint32_t rsvd3;
2363ed957684SJames Smart 	uint32_t rsvd4;
2364ed957684SJames Smart 	uint32_t rsvd5;
2365ed957684SJames Smart 	uint16_t rsvd6;
2366ed957684SJames Smart 	uint16_t vpi;
2367dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2368dea3101eS 	uint16_t rpi;
2369dea3101eS 	uint16_t rsvd1;
2370ed957684SJames Smart 	uint32_t rsvd2;
2371ed957684SJames Smart 	uint32_t rsvd3;
2372ed957684SJames Smart 	uint32_t rsvd4;
2373ed957684SJames Smart 	uint32_t rsvd5;
2374ed957684SJames Smart 	uint16_t vpi;
2375ed957684SJames Smart 	uint16_t rsvd6;
2376dea3101eS #endif
2377dea3101eS } UNREG_LOGIN_VAR;
2378dea3101eS 
237992d7f7b0SJames Smart /* Structure for MB Command REG_VPI (0x96) */
238092d7f7b0SJames Smart typedef struct {
238192d7f7b0SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
238292d7f7b0SJames Smart 	uint32_t rsvd1;
238338b92ef8SJames Smart 	uint32_t rsvd2:7;
238438b92ef8SJames Smart 	uint32_t upd:1;
238592d7f7b0SJames Smart 	uint32_t sid:24;
2386c868595dSJames Smart 	uint32_t wwn[2];
238792d7f7b0SJames Smart 	uint32_t rsvd5;
2388da0436e9SJames Smart 	uint16_t vfi;
238992d7f7b0SJames Smart 	uint16_t vpi;
239092d7f7b0SJames Smart #else	/*  __LITTLE_ENDIAN */
239192d7f7b0SJames Smart 	uint32_t rsvd1;
239292d7f7b0SJames Smart 	uint32_t sid:24;
239338b92ef8SJames Smart 	uint32_t upd:1;
239438b92ef8SJames Smart 	uint32_t rsvd2:7;
2395c868595dSJames Smart 	uint32_t wwn[2];
239692d7f7b0SJames Smart 	uint32_t rsvd5;
239792d7f7b0SJames Smart 	uint16_t vpi;
2398da0436e9SJames Smart 	uint16_t vfi;
239992d7f7b0SJames Smart #endif
240092d7f7b0SJames Smart } REG_VPI_VAR;
240192d7f7b0SJames Smart 
240292d7f7b0SJames Smart /* Structure for MB Command UNREG_VPI (0x97) */
240392d7f7b0SJames Smart typedef struct {
240492d7f7b0SJames Smart 	uint32_t rsvd1;
24056669f9bbSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
24066669f9bbSJames Smart 	uint16_t rsvd2;
24076669f9bbSJames Smart 	uint16_t sli4_vpi;
24086669f9bbSJames Smart #else	/*  __LITTLE_ENDIAN */
24096669f9bbSJames Smart 	uint16_t sli4_vpi;
24106669f9bbSJames Smart 	uint16_t rsvd2;
24116669f9bbSJames Smart #endif
241292d7f7b0SJames Smart 	uint32_t rsvd3;
241392d7f7b0SJames Smart 	uint32_t rsvd4;
241492d7f7b0SJames Smart 	uint32_t rsvd5;
241592d7f7b0SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
241692d7f7b0SJames Smart 	uint16_t rsvd6;
241792d7f7b0SJames Smart 	uint16_t vpi;
241892d7f7b0SJames Smart #else	/*  __LITTLE_ENDIAN */
241992d7f7b0SJames Smart 	uint16_t vpi;
242092d7f7b0SJames Smart 	uint16_t rsvd6;
242192d7f7b0SJames Smart #endif
242292d7f7b0SJames Smart } UNREG_VPI_VAR;
242392d7f7b0SJames Smart 
2424dea3101eS /* Structure for MB Command UNREG_D_ID (0x23) */
2425dea3101eS 
2426dea3101eS typedef struct {
2427dea3101eS 	uint32_t did;
2428ed957684SJames Smart 	uint32_t rsvd2;
2429ed957684SJames Smart 	uint32_t rsvd3;
2430ed957684SJames Smart 	uint32_t rsvd4;
2431ed957684SJames Smart 	uint32_t rsvd5;
2432ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2433ed957684SJames Smart 	uint16_t rsvd6;
2434ed957684SJames Smart 	uint16_t vpi;
2435ed957684SJames Smart #else
2436ed957684SJames Smart 	uint16_t vpi;
2437ed957684SJames Smart 	uint16_t rsvd6;
2438ed957684SJames Smart #endif
2439dea3101eS } UNREG_D_ID_VAR;
2440dea3101eS 
244176a95d75SJames Smart /* Structure for MB Command READ_TOPOLOGY (0x95) */
244276a95d75SJames Smart struct lpfc_mbx_read_top {
2443dea3101eS 	uint32_t eventTag;	/* Event tag */
244476a95d75SJames Smart 	uint32_t word2;
244576a95d75SJames Smart #define lpfc_mbx_read_top_fa_SHIFT		12
244676a95d75SJames Smart #define lpfc_mbx_read_top_fa_MASK		0x00000001
244776a95d75SJames Smart #define lpfc_mbx_read_top_fa_WORD		word2
244876a95d75SJames Smart #define lpfc_mbx_read_top_mm_SHIFT		11
244976a95d75SJames Smart #define lpfc_mbx_read_top_mm_MASK		0x00000001
245076a95d75SJames Smart #define lpfc_mbx_read_top_mm_WORD		word2
245176a95d75SJames Smart #define lpfc_mbx_read_top_pb_SHIFT		9
245276a95d75SJames Smart #define lpfc_mbx_read_top_pb_MASK		0X00000001
245376a95d75SJames Smart #define lpfc_mbx_read_top_pb_WORD		word2
245476a95d75SJames Smart #define lpfc_mbx_read_top_il_SHIFT		8
245576a95d75SJames Smart #define lpfc_mbx_read_top_il_MASK		0x00000001
245676a95d75SJames Smart #define lpfc_mbx_read_top_il_WORD		word2
245776a95d75SJames Smart #define lpfc_mbx_read_top_att_type_SHIFT	0
245876a95d75SJames Smart #define lpfc_mbx_read_top_att_type_MASK		0x000000FF
245976a95d75SJames Smart #define lpfc_mbx_read_top_att_type_WORD		word2
246076a95d75SJames Smart #define LPFC_ATT_RESERVED    0x00	/* Reserved - attType */
246176a95d75SJames Smart #define LPFC_ATT_LINK_UP     0x01	/* Link is up */
246276a95d75SJames Smart #define LPFC_ATT_LINK_DOWN   0x02	/* Link is down */
246376a95d75SJames Smart 	uint32_t word3;
246476a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_SHIFT	24
246576a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_MASK	0x000000FF
246676a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_WORD	word3
246776a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_SHIFT	16
246876a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_MASK		0x000000FF
246976a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_WORD		word3
247076a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_SHIFT	8
247176a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_MASK		0x000000FF
247276a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_WORD		word3
247376a95d75SJames Smart #define lpfc_mbx_read_top_topology_SHIFT	0
247476a95d75SJames Smart #define lpfc_mbx_read_top_topology_MASK		0x000000FF
247576a95d75SJames Smart #define lpfc_mbx_read_top_topology_WORD		word3
247676a95d75SJames Smart #define LPFC_TOPOLOGY_PT_PT 0x01	/* Topology is pt-pt / pt-fabric */
247776a95d75SJames Smart #define LPFC_TOPOLOGY_LOOP  0x02	/* Topology is FC-AL */
247876a95d75SJames Smart #define LPFC_TOPOLOGY_MM    0x05	/* maint mode zephtr to menlo */
2479dea3101eS 	/* store the LILP AL_PA position map into */
2480dea3101eS 	struct ulp_bde64 lilpBde64;
248176a95d75SJames Smart #define LPFC_ALPA_MAP_SIZE	128
248276a95d75SJames Smart 	uint32_t word7;
248376a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_SHIFT		31
248476a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_MASK		0x00000001
248576a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_WORD		word7
248676a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_SHIFT		30
248776a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_MASK		0x00000001
248876a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_WORD		word7
248976a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_SHIFT	8
249076a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_MASK	0x000000FF
249176a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_WORD	word7
249276a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_SHIFT	4
249376a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_MASK	0x0000000F
249476a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_WORD	word7
249576a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_SHIFT		2
249676a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_MASK		0x00000003
249776a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_WORD		word7
249876a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_SHIFT		0
249976a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_MASK		0x00000003
250076a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_WORD		word7
250176a95d75SJames Smart 	uint32_t word8;
250276a95d75SJames Smart #define lpfc_mbx_read_top_lu_SHIFT		31
250376a95d75SJames Smart #define lpfc_mbx_read_top_lu_MASK		0x00000001
250476a95d75SJames Smart #define lpfc_mbx_read_top_lu_WORD		word8
250576a95d75SJames Smart #define lpfc_mbx_read_top_tf_SHIFT		30
250676a95d75SJames Smart #define lpfc_mbx_read_top_tf_MASK		0x00000001
250776a95d75SJames Smart #define lpfc_mbx_read_top_tf_WORD		word8
250876a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_SHIFT	8
250976a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_MASK		0x000000FF
251076a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_WORD		word8
251176a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_SHIFT		4
251276a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_MASK		0x0000000F
251376a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_WORD		word8
251476a95d75SJames Smart #define lpfc_mbx_read_top_tx_SHIFT		2
251576a95d75SJames Smart #define lpfc_mbx_read_top_tx_MASK		0x00000003
251676a95d75SJames Smart #define lpfc_mbx_read_top_tx_WORD		word8
251776a95d75SJames Smart #define lpfc_mbx_read_top_rx_SHIFT		0
251876a95d75SJames Smart #define lpfc_mbx_read_top_rx_MASK		0x00000003
251976a95d75SJames Smart #define lpfc_mbx_read_top_rx_WORD		word8
252076a95d75SJames Smart #define LPFC_LINK_SPEED_UNKNOWN	0x0
252176a95d75SJames Smart #define LPFC_LINK_SPEED_1GHZ	0x04
252276a95d75SJames Smart #define LPFC_LINK_SPEED_2GHZ	0x08
252376a95d75SJames Smart #define LPFC_LINK_SPEED_4GHZ	0x10
252476a95d75SJames Smart #define LPFC_LINK_SPEED_8GHZ	0x20
252576a95d75SJames Smart #define LPFC_LINK_SPEED_10GHZ	0x40
252676a95d75SJames Smart #define LPFC_LINK_SPEED_16GHZ	0x80
252776a95d75SJames Smart };
2528dea3101eS 
2529dea3101eS /* Structure for MB Command CLEAR_LA (22) */
2530dea3101eS 
2531dea3101eS typedef struct {
2532dea3101eS 	uint32_t eventTag;	/* Event tag */
2533dea3101eS 	uint32_t rsvd1;
2534dea3101eS } CLEAR_LA_VAR;
2535dea3101eS 
2536dea3101eS /* Structure for MB Command DUMP */
2537dea3101eS 
2538dea3101eS typedef struct {
2539dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2540dea3101eS 	uint32_t rsvd:25;
2541dea3101eS 	uint32_t ra:1;
2542dea3101eS 	uint32_t co:1;
2543dea3101eS 	uint32_t cv:1;
2544dea3101eS 	uint32_t type:4;
2545dea3101eS 	uint32_t entry_index:16;
2546dea3101eS 	uint32_t region_id:16;
2547dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2548dea3101eS 	uint32_t type:4;
2549dea3101eS 	uint32_t cv:1;
2550dea3101eS 	uint32_t co:1;
2551dea3101eS 	uint32_t ra:1;
2552dea3101eS 	uint32_t rsvd:25;
2553dea3101eS 	uint32_t region_id:16;
2554dea3101eS 	uint32_t entry_index:16;
2555dea3101eS #endif
2556dea3101eS 
2557da0436e9SJames Smart 	uint32_t sli4_length;
2558dea3101eS 	uint32_t word_cnt;
2559dea3101eS 	uint32_t resp_offset;
2560dea3101eS } DUMP_VAR;
2561dea3101eS 
2562dea3101eS #define  DMP_MEM_REG             0x1
2563dea3101eS #define  DMP_NV_PARAMS           0x2
2564dea3101eS 
2565dea3101eS #define  DMP_REGION_VPD          0xe
2566dea3101eS #define  DMP_VPD_SIZE            0x400  /* maximum amount of VPD */
2567dea3101eS #define  DMP_RSP_OFFSET          0x14   /* word 5 contains first word of rsp */
2568dea3101eS #define  DMP_RSP_SIZE            0x6C   /* maximum of 27 words of rsp data */
2569dea3101eS 
2570da0436e9SJames Smart #define  DMP_REGION_VPORT	 0x16   /* VPort info region */
2571da0436e9SJames Smart #define  DMP_VPORT_REGION_SIZE	 0x200
2572da0436e9SJames Smart #define  DMP_MBOX_OFFSET_WORD	 0x5
2573da0436e9SJames Smart 
2574a0c87cbdSJames Smart #define  DMP_REGION_23		 0x17   /* fcoe param  and port state region */
2575a0c87cbdSJames Smart #define  DMP_RGN23_SIZE		 0x400
2576da0436e9SJames Smart 
257797207482SJames Smart #define  WAKE_UP_PARMS_REGION_ID    4
257897207482SJames Smart #define  WAKE_UP_PARMS_WORD_SIZE   15
257997207482SJames Smart 
2580da0436e9SJames Smart struct vport_rec {
2581da0436e9SJames Smart 	uint8_t wwpn[8];
2582da0436e9SJames Smart 	uint8_t wwnn[8];
2583da0436e9SJames Smart };
2584da0436e9SJames Smart 
2585da0436e9SJames Smart #define VPORT_INFO_SIG 0x32324752
2586da0436e9SJames Smart #define VPORT_INFO_REV_MASK 0xff
2587da0436e9SJames Smart #define VPORT_INFO_REV 0x1
2588da0436e9SJames Smart #define MAX_STATIC_VPORT_COUNT 16
2589da0436e9SJames Smart struct static_vport_info {
2590da0436e9SJames Smart 	uint32_t		signature;
2591da0436e9SJames Smart 	uint32_t		rev;
2592da0436e9SJames Smart 	struct vport_rec	vport_list[MAX_STATIC_VPORT_COUNT];
2593da0436e9SJames Smart 	uint32_t		resvd[66];
2594da0436e9SJames Smart };
2595da0436e9SJames Smart 
259697207482SJames Smart /* Option rom version structure */
259797207482SJames Smart struct prog_id {
259897207482SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
259997207482SJames Smart 	uint8_t  type;
260097207482SJames Smart 	uint8_t  id;
260197207482SJames Smart 	uint32_t ver:4;  /* Major Version */
260297207482SJames Smart 	uint32_t rev:4;  /* Revision */
260397207482SJames Smart 	uint32_t lev:2;  /* Level */
260497207482SJames Smart 	uint32_t dist:2; /* Dist Type */
260597207482SJames Smart 	uint32_t num:4;  /* number after dist type */
260697207482SJames Smart #else /*  __LITTLE_ENDIAN_BITFIELD */
260797207482SJames Smart 	uint32_t num:4;  /* number after dist type */
260897207482SJames Smart 	uint32_t dist:2; /* Dist Type */
260997207482SJames Smart 	uint32_t lev:2;  /* Level */
261097207482SJames Smart 	uint32_t rev:4;  /* Revision */
261197207482SJames Smart 	uint32_t ver:4;  /* Major Version */
261297207482SJames Smart 	uint8_t  id;
261397207482SJames Smart 	uint8_t  type;
261497207482SJames Smart #endif
261597207482SJames Smart };
261697207482SJames Smart 
2617d7c255b2SJames Smart /* Structure for MB Command UPDATE_CFG (0x1B) */
2618d7c255b2SJames Smart 
2619d7c255b2SJames Smart struct update_cfg_var {
2620d7c255b2SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2621d7c255b2SJames Smart 	uint32_t rsvd2:16;
2622d7c255b2SJames Smart 	uint32_t type:8;
2623d7c255b2SJames Smart 	uint32_t rsvd:1;
2624d7c255b2SJames Smart 	uint32_t ra:1;
2625d7c255b2SJames Smart 	uint32_t co:1;
2626d7c255b2SJames Smart 	uint32_t cv:1;
2627d7c255b2SJames Smart 	uint32_t req:4;
2628d7c255b2SJames Smart 	uint32_t entry_length:16;
2629d7c255b2SJames Smart 	uint32_t region_id:16;
2630d7c255b2SJames Smart #else  /*  __LITTLE_ENDIAN_BITFIELD */
2631d7c255b2SJames Smart 	uint32_t req:4;
2632d7c255b2SJames Smart 	uint32_t cv:1;
2633d7c255b2SJames Smart 	uint32_t co:1;
2634d7c255b2SJames Smart 	uint32_t ra:1;
2635d7c255b2SJames Smart 	uint32_t rsvd:1;
2636d7c255b2SJames Smart 	uint32_t type:8;
2637d7c255b2SJames Smart 	uint32_t rsvd2:16;
2638d7c255b2SJames Smart 	uint32_t region_id:16;
2639d7c255b2SJames Smart 	uint32_t entry_length:16;
2640d7c255b2SJames Smart #endif
2641d7c255b2SJames Smart 
2642d7c255b2SJames Smart 	uint32_t resp_info;
2643d7c255b2SJames Smart 	uint32_t byte_cnt;
2644d7c255b2SJames Smart 	uint32_t data_offset;
2645d7c255b2SJames Smart };
2646d7c255b2SJames Smart 
2647ed957684SJames Smart struct hbq_mask {
2648ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2649ed957684SJames Smart 	uint8_t tmatch;
2650ed957684SJames Smart 	uint8_t tmask;
2651ed957684SJames Smart 	uint8_t rctlmatch;
2652ed957684SJames Smart 	uint8_t rctlmask;
2653ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2654ed957684SJames Smart 	uint8_t rctlmask;
2655ed957684SJames Smart 	uint8_t rctlmatch;
2656ed957684SJames Smart 	uint8_t tmask;
2657ed957684SJames Smart 	uint8_t tmatch;
2658ed957684SJames Smart #endif
2659ed957684SJames Smart };
2660ed957684SJames Smart 
2661ed957684SJames Smart 
2662ed957684SJames Smart /* Structure for MB Command CONFIG_HBQ (7c) */
2663ed957684SJames Smart 
2664ed957684SJames Smart struct config_hbq_var {
2665ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2666ed957684SJames Smart 	uint32_t rsvd1      :7;
2667ed957684SJames Smart 	uint32_t recvNotify :1;     /* Receive Notification */
2668ed957684SJames Smart 	uint32_t numMask    :8;     /* # Mask Entries       */
2669ed957684SJames Smart 	uint32_t profile    :8;     /* Selection Profile    */
2670ed957684SJames Smart 	uint32_t rsvd2      :8;
2671ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2672ed957684SJames Smart 	uint32_t rsvd2      :8;
2673ed957684SJames Smart 	uint32_t profile    :8;     /* Selection Profile    */
2674ed957684SJames Smart 	uint32_t numMask    :8;     /* # Mask Entries       */
2675ed957684SJames Smart 	uint32_t recvNotify :1;     /* Receive Notification */
2676ed957684SJames Smart 	uint32_t rsvd1      :7;
2677ed957684SJames Smart #endif
2678ed957684SJames Smart 
2679ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2680ed957684SJames Smart 	uint32_t hbqId      :16;
2681ed957684SJames Smart 	uint32_t rsvd3      :12;
2682ed957684SJames Smart 	uint32_t ringMask   :4;
2683ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2684ed957684SJames Smart 	uint32_t ringMask   :4;
2685ed957684SJames Smart 	uint32_t rsvd3      :12;
2686ed957684SJames Smart 	uint32_t hbqId      :16;
2687ed957684SJames Smart #endif
2688ed957684SJames Smart 
2689ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2690ed957684SJames Smart 	uint32_t entry_count :16;
2691ed957684SJames Smart 	uint32_t rsvd4        :8;
2692ed957684SJames Smart 	uint32_t headerLen    :8;
2693ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2694ed957684SJames Smart 	uint32_t headerLen    :8;
2695ed957684SJames Smart 	uint32_t rsvd4        :8;
2696ed957684SJames Smart 	uint32_t entry_count :16;
2697ed957684SJames Smart #endif
2698ed957684SJames Smart 
2699ed957684SJames Smart 	uint32_t hbqaddrLow;
2700ed957684SJames Smart 	uint32_t hbqaddrHigh;
2701ed957684SJames Smart 
2702ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2703ed957684SJames Smart 	uint32_t rsvd5      :31;
2704ed957684SJames Smart 	uint32_t logEntry   :1;
2705ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2706ed957684SJames Smart 	uint32_t logEntry   :1;
2707ed957684SJames Smart 	uint32_t rsvd5      :31;
2708ed957684SJames Smart #endif
2709ed957684SJames Smart 
2710ed957684SJames Smart 	uint32_t rsvd6;    /* w7 */
2711ed957684SJames Smart 	uint32_t rsvd7;    /* w8 */
2712ed957684SJames Smart 	uint32_t rsvd8;    /* w9 */
2713ed957684SJames Smart 
2714ed957684SJames Smart 	struct hbq_mask hbqMasks[6];
2715ed957684SJames Smart 
2716ed957684SJames Smart 
2717ed957684SJames Smart 	union {
2718ed957684SJames Smart 		uint32_t allprofiles[12];
2719ed957684SJames Smart 
2720ed957684SJames Smart 		struct {
2721ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2722ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2723ed957684SJames Smart 				uint32_t	maxlen		:16;
2724ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2725ed957684SJames Smart 				uint32_t	maxlen		:16;
2726ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2727ed957684SJames Smart 			#endif
2728ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2729ed957684SJames Smart 				uint32_t	rsvd1		:28;
2730ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2731ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2732ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2733ed957684SJames Smart 				uint32_t	rsvd1		:28;
2734ed957684SJames Smart 			#endif
2735ed957684SJames Smart 			uint32_t rsvd[10];
2736ed957684SJames Smart 		} profile2;
2737ed957684SJames Smart 
2738ed957684SJames Smart 		struct {
2739ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2740ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2741ed957684SJames Smart 				uint32_t	maxlen		:16;
2742ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2743ed957684SJames Smart 				uint32_t	maxlen		:16;
2744ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2745ed957684SJames Smart 			#endif
2746ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2747ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
2748ed957684SJames Smart 				uint32_t	rsvd1		:12;
2749ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2750ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2751ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2752ed957684SJames Smart 				uint32_t	rsvd1		:12;
2753ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
2754ed957684SJames Smart 			#endif
2755ed957684SJames Smart 			uint32_t cmdmatch[8];
2756ed957684SJames Smart 
2757ed957684SJames Smart 			uint32_t rsvd[2];
2758ed957684SJames Smart 		} profile3;
2759ed957684SJames Smart 
2760ed957684SJames Smart 		struct {
2761ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2762ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2763ed957684SJames Smart 				uint32_t	maxlen		:16;
2764ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2765ed957684SJames Smart 				uint32_t	maxlen		:16;
2766ed957684SJames Smart 				uint32_t	seqlenoff	:16;
2767ed957684SJames Smart 			#endif
2768ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
2769ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
2770ed957684SJames Smart 				uint32_t	rsvd1		:12;
2771ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2772ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
2773ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
2774ed957684SJames Smart 				uint32_t	rsvd1		:12;
2775ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
2776ed957684SJames Smart 			#endif
2777ed957684SJames Smart 			uint32_t cmdmatch[8];
2778ed957684SJames Smart 
2779ed957684SJames Smart 			uint32_t rsvd[2];
2780ed957684SJames Smart 		} profile5;
2781ed957684SJames Smart 
2782ed957684SJames Smart 	} profiles;
2783ed957684SJames Smart 
2784ed957684SJames Smart };
2785ed957684SJames Smart 
2786ed957684SJames Smart 
2787dea3101eS 
27882e0fef85SJames Smart /* Structure for MB Command CONFIG_PORT (0x88) */
2789dea3101eS typedef struct {
2790ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2791ed957684SJames Smart 	uint32_t cBE       :  1;
2792ed957684SJames Smart 	uint32_t cET       :  1;
2793ed957684SJames Smart 	uint32_t cHpcb     :  1;
2794ed957684SJames Smart 	uint32_t cMA       :  1;
2795ed957684SJames Smart 	uint32_t sli_mode  :  4;
2796ed957684SJames Smart 	uint32_t pcbLen    : 24;       /* bit 23:0  of memory based port
2797ed957684SJames Smart 					* config block */
2798ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2799ed957684SJames Smart 	uint32_t pcbLen    : 24;       /* bit 23:0  of memory based port
2800ed957684SJames Smart 					* config block */
2801ed957684SJames Smart 	uint32_t sli_mode  :  4;
2802ed957684SJames Smart 	uint32_t cMA       :  1;
2803ed957684SJames Smart 	uint32_t cHpcb     :  1;
2804ed957684SJames Smart 	uint32_t cET       :  1;
2805ed957684SJames Smart 	uint32_t cBE       :  1;
2806ed957684SJames Smart #endif
2807ed957684SJames Smart 
2808dea3101eS 	uint32_t pcbLow;       /* bit 31:0  of memory based port config block */
2809dea3101eS 	uint32_t pcbHigh;      /* bit 63:32 of memory based port config block */
281097207482SJames Smart 	uint32_t hbainit[5];
281197207482SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
281297207482SJames Smart 	uint32_t hps	   :  1; /* bit 31 word9 Host Pointer in slim */
281397207482SJames Smart 	uint32_t rsvd	   : 31; /* least significant 31 bits of word 9 */
281497207482SJames Smart #else   /*  __LITTLE_ENDIAN */
281597207482SJames Smart 	uint32_t rsvd      : 31; /* least significant 31 bits of word 9 */
281697207482SJames Smart 	uint32_t hps	   :  1; /* bit 31 word9 Host Pointer in slim */
281797207482SJames Smart #endif
2818ed957684SJames Smart 
2819ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2820da0436e9SJames Smart 	uint32_t rsvd1     : 19;  /* Reserved                             */
2821da0436e9SJames Smart 	uint32_t cdss      :  1;  /* Configure Data Security SLI          */
2822*cb69f7deSJames Smart 	uint32_t casabt    :  1;  /* Configure async abts status notice   */
2823*cb69f7deSJames Smart 	uint32_t rsvd2     :  2;  /* Reserved                             */
282481301a9bSJames Smart 	uint32_t cbg       :  1;  /* Configure BlockGuard                 */
2825ed957684SJames Smart 	uint32_t cmv       :  1;  /* Configure Max VPIs                   */
2826ed957684SJames Smart 	uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
2827ed957684SJames Smart 	uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
2828ed957684SJames Smart 	uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
2829ed957684SJames Smart 	uint32_t cinb      :  1;  /* Enable Interrupt Notification Block  */
2830ed957684SJames Smart 	uint32_t cerbm	   :  1;  /* Configure Enhanced Receive Buf Mgmt  */
2831ed957684SJames Smart 	uint32_t cmx	   :  1;  /* Configure Max XRIs                   */
2832ed957684SJames Smart 	uint32_t cmr	   :  1;  /* Configure Max RPIs                   */
2833ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2834ed957684SJames Smart 	uint32_t cmr	   :  1;  /* Configure Max RPIs                   */
2835ed957684SJames Smart 	uint32_t cmx	   :  1;  /* Configure Max XRIs                   */
2836ed957684SJames Smart 	uint32_t cerbm	   :  1;  /* Configure Enhanced Receive Buf Mgmt  */
2837ed957684SJames Smart 	uint32_t cinb      :  1;  /* Enable Interrupt Notification Block  */
2838ed957684SJames Smart 	uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
2839ed957684SJames Smart 	uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
2840ed957684SJames Smart 	uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
2841ed957684SJames Smart 	uint32_t cmv	   :  1;  /* Configure Max VPIs                   */
284281301a9bSJames Smart 	uint32_t cbg       :  1;  /* Configure BlockGuard                 */
2843*cb69f7deSJames Smart 	uint32_t rsvd2     :  2;  /* Reserved                             */
2844*cb69f7deSJames Smart 	uint32_t casabt    :  1;  /* Configure async abts status notice   */
2845da0436e9SJames Smart 	uint32_t cdss      :  1;  /* Configure Data Security SLI          */
2846da0436e9SJames Smart 	uint32_t rsvd1     : 19;  /* Reserved                             */
2847ed957684SJames Smart #endif
2848ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2849da0436e9SJames Smart 	uint32_t rsvd3     : 19;  /* Reserved                             */
2850da0436e9SJames Smart 	uint32_t gdss      :  1;  /* Configure Data Security SLI          */
2851*cb69f7deSJames Smart 	uint32_t gasabt    :  1;  /* Grant async abts status notice       */
2852*cb69f7deSJames Smart 	uint32_t rsvd4     :  2;  /* Reserved                             */
285381301a9bSJames Smart 	uint32_t gbg       :  1;  /* Grant BlockGuard                     */
2854ed957684SJames Smart 	uint32_t gmv	   :  1;  /* Grant Max VPIs                       */
2855ed957684SJames Smart 	uint32_t gcrp	   :  1;  /* Grant Command Ring Polling           */
2856ed957684SJames Smart 	uint32_t gsah	   :  1;  /* Grant Synchronous Abort Handling     */
2857ed957684SJames Smart 	uint32_t ghbs	   :  1;  /* Grant Host Backing Store             */
2858ed957684SJames Smart 	uint32_t ginb	   :  1;  /* Grant Interrupt Notification Block   */
2859ed957684SJames Smart 	uint32_t gerbm	   :  1;  /* Grant ERBM Request                   */
2860ed957684SJames Smart 	uint32_t gmx	   :  1;  /* Grant Max XRIs                       */
2861ed957684SJames Smart 	uint32_t gmr	   :  1;  /* Grant Max RPIs                       */
2862ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2863ed957684SJames Smart 	uint32_t gmr	   :  1;  /* Grant Max RPIs                       */
2864ed957684SJames Smart 	uint32_t gmx	   :  1;  /* Grant Max XRIs                       */
2865ed957684SJames Smart 	uint32_t gerbm	   :  1;  /* Grant ERBM Request                   */
2866ed957684SJames Smart 	uint32_t ginb	   :  1;  /* Grant Interrupt Notification Block   */
2867ed957684SJames Smart 	uint32_t ghbs	   :  1;  /* Grant Host Backing Store             */
2868ed957684SJames Smart 	uint32_t gsah	   :  1;  /* Grant Synchronous Abort Handling     */
2869ed957684SJames Smart 	uint32_t gcrp	   :  1;  /* Grant Command Ring Polling           */
2870ed957684SJames Smart 	uint32_t gmv	   :  1;  /* Grant Max VPIs                       */
287181301a9bSJames Smart 	uint32_t gbg       :  1;  /* Grant BlockGuard                     */
2872*cb69f7deSJames Smart 	uint32_t rsvd4     :  2;  /* Reserved                             */
2873*cb69f7deSJames Smart 	uint32_t gasabt    :  1;  /* Grant async abts status notice       */
2874da0436e9SJames Smart 	uint32_t gdss      :  1;  /* Configure Data Security SLI          */
2875da0436e9SJames Smart 	uint32_t rsvd3     : 19;  /* Reserved                             */
2876ed957684SJames Smart #endif
2877ed957684SJames Smart 
2878ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2879ed957684SJames Smart 	uint32_t max_rpi   : 16;  /* Max RPIs Port should configure       */
2880ed957684SJames Smart 	uint32_t max_xri   : 16;  /* Max XRIs Port should configure       */
2881ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2882ed957684SJames Smart 	uint32_t max_xri   : 16;  /* Max XRIs Port should configure       */
2883ed957684SJames Smart 	uint32_t max_rpi   : 16;  /* Max RPIs Port should configure       */
2884ed957684SJames Smart #endif
2885ed957684SJames Smart 
2886ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2887ed957684SJames Smart 	uint32_t max_hbq   : 16;  /* Max HBQs Host expect to configure    */
2888da0436e9SJames Smart 	uint32_t rsvd5     : 16;  /* Max HBQs Host expect to configure    */
2889ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2890da0436e9SJames Smart 	uint32_t rsvd5     : 16;  /* Max HBQs Host expect to configure    */
2891ed957684SJames Smart 	uint32_t max_hbq   : 16;  /* Max HBQs Host expect to configure    */
2892ed957684SJames Smart #endif
2893ed957684SJames Smart 
2894da0436e9SJames Smart 	uint32_t rsvd6;           /* Reserved                             */
2895ed957684SJames Smart 
2896ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2897bc73905aSJames Smart 	uint32_t fips_rev   : 3;   /* FIPS Spec Revision                   */
2898bc73905aSJames Smart 	uint32_t fips_level : 4;   /* FIPS Level                           */
2899bc73905aSJames Smart 	uint32_t sec_err    : 9;   /* security crypto error                */
2900ed957684SJames Smart 	uint32_t max_vpi    : 16;  /* Max number of virt N-Ports           */
2901ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
2902ed957684SJames Smart 	uint32_t max_vpi    : 16;  /* Max number of virt N-Ports           */
2903bc73905aSJames Smart 	uint32_t sec_err    : 9;   /* security crypto error                */
2904bc73905aSJames Smart 	uint32_t fips_level : 4;   /* FIPS Level                           */
2905bc73905aSJames Smart 	uint32_t fips_rev   : 3;   /* FIPS Spec Revision                   */
2906ed957684SJames Smart #endif
2907ed957684SJames Smart 
2908dea3101eS } CONFIG_PORT_VAR;
2909dea3101eS 
29109399627fSJames Smart /* Structure for MB Command CONFIG_MSI (0x30) */
29119399627fSJames Smart struct config_msi_var {
29129399627fSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
29139399627fSJames Smart 	uint32_t dfltMsgNum:8;	/* Default message number            */
29149399627fSJames Smart 	uint32_t rsvd1:11;	/* Reserved                          */
29159399627fSJames Smart 	uint32_t NID:5;		/* Number of secondary attention IDs */
29169399627fSJames Smart 	uint32_t rsvd2:5;	/* Reserved                          */
29179399627fSJames Smart 	uint32_t dfltPresent:1;	/* Default message number present    */
29189399627fSJames Smart 	uint32_t addFlag:1;	/* Add association flag              */
29199399627fSJames Smart 	uint32_t reportFlag:1;	/* Report association flag           */
29209399627fSJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
29219399627fSJames Smart 	uint32_t reportFlag:1;	/* Report association flag           */
29229399627fSJames Smart 	uint32_t addFlag:1;	/* Add association flag              */
29239399627fSJames Smart 	uint32_t dfltPresent:1;	/* Default message number present    */
29249399627fSJames Smart 	uint32_t rsvd2:5;	/* Reserved                          */
29259399627fSJames Smart 	uint32_t NID:5;		/* Number of secondary attention IDs */
29269399627fSJames Smart 	uint32_t rsvd1:11;	/* Reserved                          */
29279399627fSJames Smart 	uint32_t dfltMsgNum:8;	/* Default message number            */
29289399627fSJames Smart #endif
29299399627fSJames Smart 	uint32_t attentionConditions[2];
29309399627fSJames Smart 	uint8_t  attentionId[16];
29319399627fSJames Smart 	uint8_t  messageNumberByHA[64];
29329399627fSJames Smart 	uint8_t  messageNumberByID[16];
29339399627fSJames Smart 	uint32_t autoClearHA[2];
29349399627fSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
29359399627fSJames Smart 	uint32_t rsvd3:16;
29369399627fSJames Smart 	uint32_t autoClearID:16;
29379399627fSJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
29389399627fSJames Smart 	uint32_t autoClearID:16;
29399399627fSJames Smart 	uint32_t rsvd3:16;
29409399627fSJames Smart #endif
29419399627fSJames Smart 	uint32_t rsvd4;
29429399627fSJames Smart };
29439399627fSJames Smart 
2944dea3101eS /* SLI-2 Port Control Block */
2945dea3101eS 
2946dea3101eS /* SLIM POINTER */
2947dea3101eS #define SLIMOFF 0x30		/* WORD */
2948dea3101eS 
2949dea3101eS typedef struct _SLI2_RDSC {
2950dea3101eS 	uint32_t cmdEntries;
2951dea3101eS 	uint32_t cmdAddrLow;
2952dea3101eS 	uint32_t cmdAddrHigh;
2953dea3101eS 
2954dea3101eS 	uint32_t rspEntries;
2955dea3101eS 	uint32_t rspAddrLow;
2956dea3101eS 	uint32_t rspAddrHigh;
2957dea3101eS } SLI2_RDSC;
2958dea3101eS 
2959dea3101eS typedef struct _PCB {
2960dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2961dea3101eS 	uint32_t type:8;
2962497888cfSPhil Carmody #define TYPE_NATIVE_SLI2       0x01
2963dea3101eS 	uint32_t feature:8;
2964497888cfSPhil Carmody #define FEATURE_INITIAL_SLI2   0x01
2965dea3101eS 	uint32_t rsvd:12;
2966dea3101eS 	uint32_t maxRing:4;
2967dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2968dea3101eS 	uint32_t maxRing:4;
2969dea3101eS 	uint32_t rsvd:12;
2970dea3101eS 	uint32_t feature:8;
2971497888cfSPhil Carmody #define FEATURE_INITIAL_SLI2   0x01
2972dea3101eS 	uint32_t type:8;
2973497888cfSPhil Carmody #define TYPE_NATIVE_SLI2       0x01
2974dea3101eS #endif
2975dea3101eS 
2976dea3101eS 	uint32_t mailBoxSize;
2977dea3101eS 	uint32_t mbAddrLow;
2978dea3101eS 	uint32_t mbAddrHigh;
2979dea3101eS 
2980dea3101eS 	uint32_t hgpAddrLow;
2981dea3101eS 	uint32_t hgpAddrHigh;
2982dea3101eS 
2983dea3101eS 	uint32_t pgpAddrLow;
2984dea3101eS 	uint32_t pgpAddrHigh;
2985dea3101eS 	SLI2_RDSC rdsc[MAX_RINGS];
2986dea3101eS } PCB_t;
2987dea3101eS 
2988dea3101eS /* NEW_FEATURE */
2989dea3101eS typedef struct {
2990dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2991dea3101eS 	uint32_t rsvd0:27;
2992dea3101eS 	uint32_t discardFarp:1;
2993dea3101eS 	uint32_t IPEnable:1;
2994dea3101eS 	uint32_t nodeName:1;
2995dea3101eS 	uint32_t portName:1;
2996dea3101eS 	uint32_t filterEnable:1;
2997dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2998dea3101eS 	uint32_t filterEnable:1;
2999dea3101eS 	uint32_t portName:1;
3000dea3101eS 	uint32_t nodeName:1;
3001dea3101eS 	uint32_t IPEnable:1;
3002dea3101eS 	uint32_t discardFarp:1;
3003dea3101eS 	uint32_t rsvd:27;
3004dea3101eS #endif
3005dea3101eS 
3006dea3101eS 	uint8_t portname[8];	/* Used to be struct lpfc_name */
3007dea3101eS 	uint8_t nodename[8];
3008dea3101eS 	uint32_t rsvd1;
3009dea3101eS 	uint32_t rsvd2;
3010dea3101eS 	uint32_t rsvd3;
3011dea3101eS 	uint32_t IPAddress;
3012dea3101eS } CONFIG_FARP_VAR;
3013dea3101eS 
301457127f15SJames Smart /* Structure for MB Command MBX_ASYNCEVT_ENABLE (0x33) */
301557127f15SJames Smart 
301657127f15SJames Smart typedef struct {
301757127f15SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
301857127f15SJames Smart 	uint32_t rsvd:30;
301957127f15SJames Smart 	uint32_t ring:2;	/* Ring for ASYNC_EVENT iocb Bits 0-1*/
302057127f15SJames Smart #else /*  __LITTLE_ENDIAN */
302157127f15SJames Smart 	uint32_t ring:2;	/* Ring for ASYNC_EVENT iocb Bits 0-1*/
302257127f15SJames Smart 	uint32_t rsvd:30;
302357127f15SJames Smart #endif
302457127f15SJames Smart } ASYNCEVT_ENABLE_VAR;
302557127f15SJames Smart 
3026dea3101eS /* Union of all Mailbox Command types */
3027dea3101eS #define MAILBOX_CMD_WSIZE	32
3028dea3101eS #define MAILBOX_CMD_SIZE	(MAILBOX_CMD_WSIZE * sizeof(uint32_t))
30297a470277SJames Smart /* ext_wsize times 4 bytes should not be greater than max xmit size */
30307a470277SJames Smart #define MAILBOX_EXT_WSIZE	512
30317a470277SJames Smart #define MAILBOX_EXT_SIZE	(MAILBOX_EXT_WSIZE * sizeof(uint32_t))
30327a470277SJames Smart #define MAILBOX_HBA_EXT_OFFSET  0x100
30337a470277SJames Smart /* max mbox xmit size is a page size for sysfs IO operations */
3034c0c11512SJames Smart #define MAILBOX_SYSFS_MAX	4096
3035dea3101eS 
3036dea3101eS typedef union {
3037ed957684SJames Smart 	uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/
3038ed957684SJames Smart 						    * feature/max ring number
3039ed957684SJames Smart 						    */
3040dea3101eS 	LOAD_SM_VAR varLdSM;		/* cmd =  1 (LOAD_SM)        */
3041dea3101eS 	READ_NV_VAR varRDnvp;		/* cmd =  2 (READ_NVPARMS)   */
3042dea3101eS 	WRITE_NV_VAR varWTnvp;		/* cmd =  3 (WRITE_NVPARMS)  */
3043dea3101eS 	BIU_DIAG_VAR varBIUdiag;	/* cmd =  4 (RUN_BIU_DIAG)   */
3044dea3101eS 	INIT_LINK_VAR varInitLnk;	/* cmd =  5 (INIT_LINK)      */
3045dea3101eS 	DOWN_LINK_VAR varDwnLnk;	/* cmd =  6 (DOWN_LINK)      */
3046dea3101eS 	CONFIG_LINK varCfgLnk;		/* cmd =  7 (CONFIG_LINK)    */
3047dea3101eS 	PART_SLIM_VAR varSlim;		/* cmd =  8 (PART_SLIM)      */
3048dea3101eS 	CONFIG_RING_VAR varCfgRing;	/* cmd =  9 (CONFIG_RING)    */
3049dea3101eS 	RESET_RING_VAR varRstRing;	/* cmd = 10 (RESET_RING)     */
3050dea3101eS 	READ_CONFIG_VAR varRdConfig;	/* cmd = 11 (READ_CONFIG)    */
3051dea3101eS 	READ_RCONF_VAR varRdRConfig;	/* cmd = 12 (READ_RCONFIG)   */
3052dea3101eS 	READ_SPARM_VAR varRdSparm;	/* cmd = 13 (READ_SPARM(64)) */
3053dea3101eS 	READ_STATUS_VAR varRdStatus;	/* cmd = 14 (READ_STATUS)    */
3054dea3101eS 	READ_RPI_VAR varRdRPI;		/* cmd = 15 (READ_RPI(64))   */
3055dea3101eS 	READ_XRI_VAR varRdXRI;		/* cmd = 16 (READ_XRI)       */
3056dea3101eS 	READ_REV_VAR varRdRev;		/* cmd = 17 (READ_REV)       */
3057dea3101eS 	READ_LNK_VAR varRdLnk;		/* cmd = 18 (READ_LNK_STAT)  */
3058dea3101eS 	REG_LOGIN_VAR varRegLogin;	/* cmd = 19 (REG_LOGIN(64))  */
3059dea3101eS 	UNREG_LOGIN_VAR varUnregLogin;	/* cmd = 20 (UNREG_LOGIN)    */
3060dea3101eS 	CLEAR_LA_VAR varClearLA;	/* cmd = 22 (CLEAR_LA)       */
3061dea3101eS 	DUMP_VAR varDmp;		/* Warm Start DUMP mbx cmd   */
3062dea3101eS 	UNREG_D_ID_VAR varUnregDID;	/* cmd = 0x23 (UNREG_D_ID)   */
3063ed957684SJames Smart 	CONFIG_FARP_VAR varCfgFarp;	/* cmd = 0x25 (CONFIG_FARP)
3064ed957684SJames Smart 					 * NEW_FEATURE
3065ed957684SJames Smart 					 */
3066ed957684SJames Smart 	struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ)  */
3067d7c255b2SJames Smart 	struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/
3068dea3101eS 	CONFIG_PORT_VAR varCfgPort;	/* cmd = 0x88 (CONFIG_PORT)  */
306976a95d75SJames Smart 	struct lpfc_mbx_read_top varReadTop; /* cmd = 0x95 (READ_TOPOLOGY) */
307092d7f7b0SJames Smart 	REG_VPI_VAR varRegVpi;		/* cmd = 0x96 (REG_VPI) */
307192d7f7b0SJames Smart 	UNREG_VPI_VAR varUnregVpi;	/* cmd = 0x97 (UNREG_VPI) */
307257127f15SJames Smart 	ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */
3073c7495937SJames Smart 	struct READ_EVENT_LOG_VAR varRdEventLog;	/* cmd = 0x38
3074c7495937SJames Smart 							 * (READ_EVENT_LOG)
3075c7495937SJames Smart 							 */
30769399627fSJames Smart 	struct config_msi_var varCfgMSI;/* cmd = x30 (CONFIG_MSI)     */
3077dea3101eS } MAILVARIANTS;
3078dea3101eS 
3079dea3101eS /*
3080dea3101eS  * SLI-2 specific structures
3081dea3101eS  */
3082dea3101eS 
30834cc2da1dSJames.Smart@Emulex.Com struct lpfc_hgp {
30844cc2da1dSJames.Smart@Emulex.Com 	__le32 cmdPutInx;
30854cc2da1dSJames.Smart@Emulex.Com 	__le32 rspGetInx;
30864cc2da1dSJames.Smart@Emulex.Com };
3087dea3101eS 
30884cc2da1dSJames.Smart@Emulex.Com struct lpfc_pgp {
30894cc2da1dSJames.Smart@Emulex.Com 	__le32 cmdGetInx;
30904cc2da1dSJames.Smart@Emulex.Com 	__le32 rspPutInx;
30914cc2da1dSJames.Smart@Emulex.Com };
3092dea3101eS 
3093ed957684SJames Smart struct sli2_desc {
3094dea3101eS 	uint32_t unused1[16];
3095ed957684SJames Smart 	struct lpfc_hgp host[MAX_RINGS];
30964cc2da1dSJames.Smart@Emulex.Com 	struct lpfc_pgp port[MAX_RINGS];
3097ed957684SJames Smart };
3098ed957684SJames Smart 
3099ed957684SJames Smart struct sli3_desc {
3100ed957684SJames Smart 	struct lpfc_hgp host[MAX_RINGS];
3101ed957684SJames Smart 	uint32_t reserved[8];
3102ed957684SJames Smart 	uint32_t hbq_put[16];
3103ed957684SJames Smart };
3104ed957684SJames Smart 
3105ed957684SJames Smart struct sli3_pgp {
3106ed957684SJames Smart 	struct lpfc_pgp port[MAX_RINGS];
3107ed957684SJames Smart 	uint32_t hbq_get[16];
3108ed957684SJames Smart };
3109dea3101eS 
311034b02dcdSJames Smart union sli_var {
3111ed957684SJames Smart 	struct sli2_desc	s2;
3112ed957684SJames Smart 	struct sli3_desc	s3;
3113ed957684SJames Smart 	struct sli3_pgp		s3_pgp;
311434b02dcdSJames Smart };
3115dea3101eS 
3116dea3101eS typedef struct {
3117dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3118dea3101eS 	uint16_t mbxStatus;
3119dea3101eS 	uint8_t mbxCommand;
3120dea3101eS 	uint8_t mbxReserved:6;
3121dea3101eS 	uint8_t mbxHc:1;
3122dea3101eS 	uint8_t mbxOwner:1;	/* Low order bit first word */
3123dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3124dea3101eS 	uint8_t mbxOwner:1;	/* Low order bit first word */
3125dea3101eS 	uint8_t mbxHc:1;
3126dea3101eS 	uint8_t mbxReserved:6;
3127dea3101eS 	uint8_t mbxCommand;
3128dea3101eS 	uint16_t mbxStatus;
3129dea3101eS #endif
3130dea3101eS 
3131dea3101eS 	MAILVARIANTS un;
313234b02dcdSJames Smart 	union sli_var us;
3133dea3101eS } MAILBOX_t;
3134dea3101eS 
3135dea3101eS /*
3136dea3101eS  *    Begin Structure Definitions for IOCB Commands
3137dea3101eS  */
3138dea3101eS 
3139dea3101eS typedef struct {
3140dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3141dea3101eS 	uint8_t statAction;
3142dea3101eS 	uint8_t statRsn;
3143dea3101eS 	uint8_t statBaExp;
3144dea3101eS 	uint8_t statLocalError;
3145dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3146dea3101eS 	uint8_t statLocalError;
3147dea3101eS 	uint8_t statBaExp;
3148dea3101eS 	uint8_t statRsn;
3149dea3101eS 	uint8_t statAction;
3150dea3101eS #endif
3151dea3101eS 	/* statRsn  P/F_RJT reason codes */
3152dea3101eS #define RJT_BAD_D_ID       0x01	/* Invalid D_ID field */
3153dea3101eS #define RJT_BAD_S_ID       0x02	/* Invalid S_ID field */
3154dea3101eS #define RJT_UNAVAIL_TEMP   0x03	/* N_Port unavailable temp. */
3155dea3101eS #define RJT_UNAVAIL_PERM   0x04	/* N_Port unavailable perm. */
3156dea3101eS #define RJT_UNSUP_CLASS    0x05	/* Class not supported */
3157dea3101eS #define RJT_DELIM_ERR      0x06	/* Delimiter usage error */
3158dea3101eS #define RJT_UNSUP_TYPE     0x07	/* Type not supported */
3159dea3101eS #define RJT_BAD_CONTROL    0x08	/* Invalid link conrtol */
3160dea3101eS #define RJT_BAD_RCTL       0x09	/* R_CTL invalid */
3161dea3101eS #define RJT_BAD_FCTL       0x0A	/* F_CTL invalid */
3162dea3101eS #define RJT_BAD_OXID       0x0B	/* OX_ID invalid */
3163dea3101eS #define RJT_BAD_RXID       0x0C	/* RX_ID invalid */
3164dea3101eS #define RJT_BAD_SEQID      0x0D	/* SEQ_ID invalid */
3165dea3101eS #define RJT_BAD_DFCTL      0x0E	/* DF_CTL invalid */
3166dea3101eS #define RJT_BAD_SEQCNT     0x0F	/* SEQ_CNT invalid */
3167dea3101eS #define RJT_BAD_PARM       0x10	/* Param. field invalid */
3168dea3101eS #define RJT_XCHG_ERR       0x11	/* Exchange error */
3169dea3101eS #define RJT_PROT_ERR       0x12	/* Protocol error */
3170dea3101eS #define RJT_BAD_LENGTH     0x13	/* Invalid Length */
3171dea3101eS #define RJT_UNEXPECTED_ACK 0x14	/* Unexpected ACK */
3172dea3101eS #define RJT_LOGIN_REQUIRED 0x16	/* Login required */
3173dea3101eS #define RJT_TOO_MANY_SEQ   0x17	/* Excessive sequences */
3174dea3101eS #define RJT_XCHG_NOT_STRT  0x18	/* Exchange not started */
3175dea3101eS #define RJT_UNSUP_SEC_HDR  0x19	/* Security hdr not supported */
3176dea3101eS #define RJT_UNAVAIL_PATH   0x1A	/* Fabric Path not available */
3177dea3101eS #define RJT_VENDOR_UNIQUE  0xFF	/* Vendor unique error */
3178dea3101eS 
3179dea3101eS #define IOERR_SUCCESS                 0x00	/* statLocalError */
3180dea3101eS #define IOERR_MISSING_CONTINUE        0x01
3181dea3101eS #define IOERR_SEQUENCE_TIMEOUT        0x02
3182dea3101eS #define IOERR_INTERNAL_ERROR          0x03
3183dea3101eS #define IOERR_INVALID_RPI             0x04
3184dea3101eS #define IOERR_NO_XRI                  0x05
3185dea3101eS #define IOERR_ILLEGAL_COMMAND         0x06
3186dea3101eS #define IOERR_XCHG_DROPPED            0x07
3187dea3101eS #define IOERR_ILLEGAL_FIELD           0x08
3188dea3101eS #define IOERR_BAD_CONTINUE            0x09
3189dea3101eS #define IOERR_TOO_MANY_BUFFERS        0x0A
3190dea3101eS #define IOERR_RCV_BUFFER_WAITING      0x0B
3191dea3101eS #define IOERR_NO_CONNECTION           0x0C
3192dea3101eS #define IOERR_TX_DMA_FAILED           0x0D
3193dea3101eS #define IOERR_RX_DMA_FAILED           0x0E
3194dea3101eS #define IOERR_ILLEGAL_FRAME           0x0F
3195dea3101eS #define IOERR_EXTRA_DATA              0x10
3196dea3101eS #define IOERR_NO_RESOURCES            0x11
3197dea3101eS #define IOERR_RESERVED                0x12
3198dea3101eS #define IOERR_ILLEGAL_LENGTH          0x13
3199dea3101eS #define IOERR_UNSUPPORTED_FEATURE     0x14
3200dea3101eS #define IOERR_ABORT_IN_PROGRESS       0x15
3201dea3101eS #define IOERR_ABORT_REQUESTED         0x16
3202dea3101eS #define IOERR_RECEIVE_BUFFER_TIMEOUT  0x17
3203dea3101eS #define IOERR_LOOP_OPEN_FAILURE       0x18
3204dea3101eS #define IOERR_RING_RESET              0x19
3205dea3101eS #define IOERR_LINK_DOWN               0x1A
3206dea3101eS #define IOERR_CORRUPTED_DATA          0x1B
3207dea3101eS #define IOERR_CORRUPTED_RPI           0x1C
3208dea3101eS #define IOERR_OUT_OF_ORDER_DATA       0x1D
3209dea3101eS #define IOERR_OUT_OF_ORDER_ACK        0x1E
3210dea3101eS #define IOERR_DUP_FRAME               0x1F
3211dea3101eS #define IOERR_LINK_CONTROL_FRAME      0x20	/* ACK_N received */
3212dea3101eS #define IOERR_BAD_HOST_ADDRESS        0x21
3213dea3101eS #define IOERR_RCV_HDRBUF_WAITING      0x22
3214dea3101eS #define IOERR_MISSING_HDR_BUFFER      0x23
3215dea3101eS #define IOERR_MSEQ_CHAIN_CORRUPTED    0x24
3216dea3101eS #define IOERR_ABORTMULT_REQUESTED     0x25
3217dea3101eS #define IOERR_BUFFER_SHORTAGE         0x28
3218dea3101eS #define IOERR_DEFAULT                 0x29
3219dea3101eS #define IOERR_CNT                     0x2A
3220b92938b4SJames Smart #define IOERR_SLER_FAILURE            0x46
3221b92938b4SJames Smart #define IOERR_SLER_CMD_RCV_FAILURE    0x47
3222b92938b4SJames Smart #define IOERR_SLER_REC_RJT_ERR        0x48
3223b92938b4SJames Smart #define IOERR_SLER_REC_SRR_RETRY_ERR  0x49
3224b92938b4SJames Smart #define IOERR_SLER_SRR_RJT_ERR        0x4A
3225b92938b4SJames Smart #define IOERR_SLER_RRQ_RJT_ERR        0x4C
3226b92938b4SJames Smart #define IOERR_SLER_RRQ_RETRY_ERR      0x4D
3227b92938b4SJames Smart #define IOERR_SLER_ABTS_ERR           0x4E
3228ab56dc2eSJames Smart #define IOERR_ELXSEC_KEY_UNWRAP_ERROR		0xF0
3229ab56dc2eSJames Smart #define IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR	0xF1
3230ab56dc2eSJames Smart #define IOERR_ELXSEC_CRYPTO_ERROR		0xF2
3231ab56dc2eSJames Smart #define IOERR_ELXSEC_CRYPTO_COMPARE_ERROR	0xF3
3232dea3101eS #define IOERR_DRVR_MASK               0x100
3233dea3101eS #define IOERR_SLI_DOWN                0x101  /* ulpStatus  - Driver defined */
3234dea3101eS #define IOERR_SLI_BRESET              0x102
3235dea3101eS #define IOERR_SLI_ABORTED             0x103
3236dea3101eS } PARM_ERR;
3237dea3101eS 
3238dea3101eS typedef union {
3239dea3101eS 	struct {
3240dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3241dea3101eS 		uint8_t Rctl;	/* R_CTL field */
3242dea3101eS 		uint8_t Type;	/* TYPE field */
3243dea3101eS 		uint8_t Dfctl;	/* DF_CTL field */
3244dea3101eS 		uint8_t Fctl;	/* Bits 0-7 of IOCB word 5 */
3245dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3246dea3101eS 		uint8_t Fctl;	/* Bits 0-7 of IOCB word 5 */
3247dea3101eS 		uint8_t Dfctl;	/* DF_CTL field */
3248dea3101eS 		uint8_t Type;	/* TYPE field */
3249dea3101eS 		uint8_t Rctl;	/* R_CTL field */
3250dea3101eS #endif
3251dea3101eS 
3252dea3101eS #define BC      0x02		/* Broadcast Received  - Fctl */
3253dea3101eS #define SI      0x04		/* Sequence Initiative */
3254dea3101eS #define LA      0x08		/* Ignore Link Attention state */
3255dea3101eS #define LS      0x80		/* Last Sequence */
3256dea3101eS 	} hcsw;
3257dea3101eS 	uint32_t reserved;
3258dea3101eS } WORD5;
3259dea3101eS 
3260dea3101eS /* IOCB Command template for a generic response */
3261dea3101eS typedef struct {
3262dea3101eS 	uint32_t reserved[4];
3263dea3101eS 	PARM_ERR perr;
3264dea3101eS } GENERIC_RSP;
3265dea3101eS 
3266dea3101eS /* IOCB Command template for XMIT / XMIT_BCAST / RCV_SEQUENCE / XMIT_ELS */
3267dea3101eS typedef struct {
3268dea3101eS 	struct ulp_bde xrsqbde[2];
3269dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3270dea3101eS 	WORD5 w5;		/* Header control/status word */
3271dea3101eS } XR_SEQ_FIELDS;
3272dea3101eS 
3273dea3101eS /* IOCB Command template for ELS_REQUEST */
3274dea3101eS typedef struct {
3275dea3101eS 	struct ulp_bde elsReq;
3276dea3101eS 	struct ulp_bde elsRsp;
3277dea3101eS 
3278dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3279dea3101eS 	uint32_t word4Rsvd:7;
3280dea3101eS 	uint32_t fl:1;
3281dea3101eS 	uint32_t myID:24;
3282dea3101eS 	uint32_t word5Rsvd:8;
3283dea3101eS 	uint32_t remoteID:24;
3284dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3285dea3101eS 	uint32_t myID:24;
3286dea3101eS 	uint32_t fl:1;
3287dea3101eS 	uint32_t word4Rsvd:7;
3288dea3101eS 	uint32_t remoteID:24;
3289dea3101eS 	uint32_t word5Rsvd:8;
3290dea3101eS #endif
3291dea3101eS } ELS_REQUEST;
3292dea3101eS 
3293dea3101eS /* IOCB Command template for RCV_ELS_REQ */
3294dea3101eS typedef struct {
3295dea3101eS 	struct ulp_bde elsReq[2];
3296dea3101eS 	uint32_t parmRo;
3297dea3101eS 
3298dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3299dea3101eS 	uint32_t word5Rsvd:8;
3300dea3101eS 	uint32_t remoteID:24;
3301dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3302dea3101eS 	uint32_t remoteID:24;
3303dea3101eS 	uint32_t word5Rsvd:8;
3304dea3101eS #endif
3305dea3101eS } RCV_ELS_REQ;
3306dea3101eS 
3307dea3101eS /* IOCB Command template for ABORT / CLOSE_XRI */
3308dea3101eS typedef struct {
3309dea3101eS 	uint32_t rsvd[3];
3310dea3101eS 	uint32_t abortType;
3311dea3101eS #define ABORT_TYPE_ABTX  0x00000000
3312dea3101eS #define ABORT_TYPE_ABTS  0x00000001
3313dea3101eS 	uint32_t parm;
3314dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3315dea3101eS 	uint16_t abortContextTag; /* ulpContext from command to abort/close */
3316dea3101eS 	uint16_t abortIoTag;	/* ulpIoTag from command to abort/close */
3317dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3318dea3101eS 	uint16_t abortIoTag;	/* ulpIoTag from command to abort/close */
3319dea3101eS 	uint16_t abortContextTag; /* ulpContext from command to abort/close */
3320dea3101eS #endif
3321dea3101eS } AC_XRI;
3322dea3101eS 
3323dea3101eS /* IOCB Command template for ABORT_MXRI64 */
3324dea3101eS typedef struct {
3325dea3101eS 	uint32_t rsvd[3];
3326dea3101eS 	uint32_t abortType;
3327dea3101eS 	uint32_t parm;
3328dea3101eS 	uint32_t iotag32;
3329dea3101eS } A_MXRI64;
3330dea3101eS 
3331dea3101eS /* IOCB Command template for GET_RPI */
3332dea3101eS typedef struct {
3333dea3101eS 	uint32_t rsvd[4];
3334dea3101eS 	uint32_t parmRo;
3335dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3336dea3101eS 	uint32_t word5Rsvd:8;
3337dea3101eS 	uint32_t remoteID:24;
3338dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3339dea3101eS 	uint32_t remoteID:24;
3340dea3101eS 	uint32_t word5Rsvd:8;
3341dea3101eS #endif
3342dea3101eS } GET_RPI;
3343dea3101eS 
3344dea3101eS /* IOCB Command template for all FCP Initiator commands */
3345dea3101eS typedef struct {
3346dea3101eS 	struct ulp_bde fcpi_cmnd;	/* FCP_CMND payload descriptor */
3347dea3101eS 	struct ulp_bde fcpi_rsp;	/* Rcv buffer */
3348dea3101eS 	uint32_t fcpi_parm;
3349dea3101eS 	uint32_t fcpi_XRdy;	/* transfer ready for IWRITE */
3350dea3101eS } FCPI_FIELDS;
3351dea3101eS 
3352dea3101eS /* IOCB Command template for all FCP Target commands */
3353dea3101eS typedef struct {
3354dea3101eS 	struct ulp_bde fcpt_Buffer[2];	/* FCP_CMND payload descriptor */
3355dea3101eS 	uint32_t fcpt_Offset;
3356dea3101eS 	uint32_t fcpt_Length;	/* transfer ready for IWRITE */
3357dea3101eS } FCPT_FIELDS;
3358dea3101eS 
3359dea3101eS /* SLI-2 IOCB structure definitions */
3360dea3101eS 
3361dea3101eS /* IOCB Command template for 64 bit XMIT / XMIT_BCAST / XMIT_ELS */
3362dea3101eS typedef struct {
3363dea3101eS 	ULP_BDL bdl;
3364dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3365dea3101eS 	WORD5 w5;		/* Header control/status word */
3366dea3101eS } XMT_SEQ_FIELDS64;
3367dea3101eS 
3368dea3101eS /* IOCB Command template for 64 bit RCV_SEQUENCE64 */
3369dea3101eS typedef struct {
3370dea3101eS 	struct ulp_bde64 rcvBde;
3371dea3101eS 	uint32_t rsvd1;
3372dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3373dea3101eS 	WORD5 w5;		/* Header control/status word */
3374dea3101eS } RCV_SEQ_FIELDS64;
3375dea3101eS 
3376dea3101eS /* IOCB Command template for ELS_REQUEST64 */
3377dea3101eS typedef struct {
3378dea3101eS 	ULP_BDL bdl;
3379dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3380dea3101eS 	uint32_t word4Rsvd:7;
3381dea3101eS 	uint32_t fl:1;
3382dea3101eS 	uint32_t myID:24;
3383dea3101eS 	uint32_t word5Rsvd:8;
3384dea3101eS 	uint32_t remoteID:24;
3385dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3386dea3101eS 	uint32_t myID:24;
3387dea3101eS 	uint32_t fl:1;
3388dea3101eS 	uint32_t word4Rsvd:7;
3389dea3101eS 	uint32_t remoteID:24;
3390dea3101eS 	uint32_t word5Rsvd:8;
3391dea3101eS #endif
3392dea3101eS } ELS_REQUEST64;
3393dea3101eS 
3394dea3101eS /* IOCB Command template for GEN_REQUEST64 */
3395dea3101eS typedef struct {
3396dea3101eS 	ULP_BDL bdl;
3397dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3398dea3101eS 	WORD5 w5;		/* Header control/status word */
3399dea3101eS } GEN_REQUEST64;
3400dea3101eS 
3401dea3101eS /* IOCB Command template for RCV_ELS_REQ64 */
3402dea3101eS typedef struct {
3403dea3101eS 	struct ulp_bde64 elsReq;
3404dea3101eS 	uint32_t rcvd1;
3405dea3101eS 	uint32_t parmRo;
3406dea3101eS 
3407dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3408dea3101eS 	uint32_t word5Rsvd:8;
3409dea3101eS 	uint32_t remoteID:24;
3410dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3411dea3101eS 	uint32_t remoteID:24;
3412dea3101eS 	uint32_t word5Rsvd:8;
3413dea3101eS #endif
3414dea3101eS } RCV_ELS_REQ64;
3415dea3101eS 
34169c2face6SJames Smart /* IOCB Command template for RCV_SEQ64 */
34179c2face6SJames Smart struct rcv_seq64 {
34189c2face6SJames Smart 	struct ulp_bde64 elsReq;
34199c2face6SJames Smart 	uint32_t hbq_1;
34209c2face6SJames Smart 	uint32_t parmRo;
34219c2face6SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
34229c2face6SJames Smart 	uint32_t rctl:8;
34239c2face6SJames Smart 	uint32_t type:8;
34249c2face6SJames Smart 	uint32_t dfctl:8;
34259c2face6SJames Smart 	uint32_t ls:1;
34269c2face6SJames Smart 	uint32_t fs:1;
34279c2face6SJames Smart 	uint32_t rsvd2:3;
34289c2face6SJames Smart 	uint32_t si:1;
34299c2face6SJames Smart 	uint32_t bc:1;
34309c2face6SJames Smart 	uint32_t rsvd3:1;
34319c2face6SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
34329c2face6SJames Smart 	uint32_t rsvd3:1;
34339c2face6SJames Smart 	uint32_t bc:1;
34349c2face6SJames Smart 	uint32_t si:1;
34359c2face6SJames Smart 	uint32_t rsvd2:3;
34369c2face6SJames Smart 	uint32_t fs:1;
34379c2face6SJames Smart 	uint32_t ls:1;
34389c2face6SJames Smart 	uint32_t dfctl:8;
34399c2face6SJames Smart 	uint32_t type:8;
34409c2face6SJames Smart 	uint32_t rctl:8;
34419c2face6SJames Smart #endif
34429c2face6SJames Smart };
34439c2face6SJames Smart 
3444dea3101eS /* IOCB Command template for all 64 bit FCP Initiator commands */
3445dea3101eS typedef struct {
3446dea3101eS 	ULP_BDL bdl;
3447dea3101eS 	uint32_t fcpi_parm;
3448dea3101eS 	uint32_t fcpi_XRdy;	/* transfer ready for IWRITE */
3449dea3101eS } FCPI_FIELDS64;
3450dea3101eS 
3451dea3101eS /* IOCB Command template for all 64 bit FCP Target commands */
3452dea3101eS typedef struct {
3453dea3101eS 	ULP_BDL bdl;
3454dea3101eS 	uint32_t fcpt_Offset;
3455dea3101eS 	uint32_t fcpt_Length;	/* transfer ready for IWRITE */
3456dea3101eS } FCPT_FIELDS64;
3457dea3101eS 
345857127f15SJames Smart /* IOCB Command template for Async Status iocb commands */
345957127f15SJames Smart typedef struct {
346057127f15SJames Smart 	uint32_t rsvd[4];
346157127f15SJames Smart 	uint32_t param;
346257127f15SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
346357127f15SJames Smart 	uint16_t evt_code;		/* High order bits word 5 */
346457127f15SJames Smart 	uint16_t sub_ctxt_tag;		/* Low  order bits word 5 */
346557127f15SJames Smart #else   /*  __LITTLE_ENDIAN_BITFIELD */
346657127f15SJames Smart 	uint16_t sub_ctxt_tag;		/* High order bits word 5 */
346757127f15SJames Smart 	uint16_t evt_code;		/* Low  order bits word 5 */
346857127f15SJames Smart #endif
346957127f15SJames Smart } ASYNCSTAT_FIELDS;
347057127f15SJames Smart #define ASYNC_TEMP_WARN		0x100
347157127f15SJames Smart #define ASYNC_TEMP_SAFE		0x101
3472*cb69f7deSJames Smart #define ASYNC_STATUS_CN		0x102
347357127f15SJames Smart 
3474ed957684SJames Smart /* IOCB Command template for CMD_IOCB_RCV_ELS64_CX (0xB7)
3475ed957684SJames Smart    or CMD_IOCB_RCV_SEQ64_CX (0xB5) */
3476ed957684SJames Smart 
3477ed957684SJames Smart struct rcv_sli3 {
3478ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
34797851fe2cSJames Smart 	uint16_t ox_id;
34807851fe2cSJames Smart 	uint16_t seq_cnt;
34817851fe2cSJames Smart 
3482ed957684SJames Smart 	uint16_t vpi;
3483ed957684SJames Smart 	uint16_t word9Rsvd;
3484ed957684SJames Smart #else  /*  __LITTLE_ENDIAN */
34857851fe2cSJames Smart 	uint16_t seq_cnt;
34867851fe2cSJames Smart 	uint16_t ox_id;
34877851fe2cSJames Smart 
3488ed957684SJames Smart 	uint16_t word9Rsvd;
3489ed957684SJames Smart 	uint16_t vpi;
3490ed957684SJames Smart #endif
3491ed957684SJames Smart 	uint32_t word10Rsvd;
3492ed957684SJames Smart 	uint32_t acc_len;      /* accumulated length */
3493ed957684SJames Smart 	struct ulp_bde64 bde2;
3494ed957684SJames Smart };
3495ed957684SJames Smart 
349676bb24efSJames Smart /* Structure used for a single HBQ entry */
349776bb24efSJames Smart struct lpfc_hbq_entry {
349876bb24efSJames Smart 	struct ulp_bde64 bde;
349976bb24efSJames Smart 	uint32_t buffer_tag;
350076bb24efSJames Smart };
350192d7f7b0SJames Smart 
350276bb24efSJames Smart /* IOCB Command template for QUE_XRI64_CX (0xB3) command */
350376bb24efSJames Smart typedef struct {
350476bb24efSJames Smart 	struct lpfc_hbq_entry   buff;
350576bb24efSJames Smart 	uint32_t                rsvd;
350676bb24efSJames Smart 	uint32_t		rsvd1;
350776bb24efSJames Smart } QUE_XRI64_CX_FIELDS;
350876bb24efSJames Smart 
350976bb24efSJames Smart struct que_xri64cx_ext_fields {
351076bb24efSJames Smart 	uint32_t	iotag64_low;
351176bb24efSJames Smart 	uint32_t	iotag64_high;
351276bb24efSJames Smart 	uint32_t	ebde_count;
351376bb24efSJames Smart 	uint32_t	rsvd;
351476bb24efSJames Smart 	struct lpfc_hbq_entry	buff[5];
351576bb24efSJames Smart };
351692d7f7b0SJames Smart 
351781301a9bSJames Smart struct sli3_bg_fields {
351881301a9bSJames Smart 	uint32_t filler[6];	/* word 8-13 in IOCB */
351981301a9bSJames Smart 	uint32_t bghm;		/* word 14 - BlockGuard High Water Mark */
352081301a9bSJames Smart /* Bitfields for bgstat (BlockGuard Status - word 15 of IOCB) */
352181301a9bSJames Smart #define BGS_BIDIR_BG_PROF_MASK		0xff000000
352281301a9bSJames Smart #define BGS_BIDIR_BG_PROF_SHIFT		24
352381301a9bSJames Smart #define BGS_BIDIR_ERR_COND_FLAGS_MASK	0x003f0000
352481301a9bSJames Smart #define BGS_BIDIR_ERR_COND_SHIFT	16
352581301a9bSJames Smart #define BGS_BG_PROFILE_MASK		0x0000ff00
352681301a9bSJames Smart #define BGS_BG_PROFILE_SHIFT		8
352781301a9bSJames Smart #define BGS_INVALID_PROF_MASK		0x00000020
352881301a9bSJames Smart #define BGS_INVALID_PROF_SHIFT		5
352981301a9bSJames Smart #define BGS_UNINIT_DIF_BLOCK_MASK	0x00000010
353081301a9bSJames Smart #define BGS_UNINIT_DIF_BLOCK_SHIFT	4
353181301a9bSJames Smart #define BGS_HI_WATER_MARK_PRESENT_MASK	0x00000008
353281301a9bSJames Smart #define BGS_HI_WATER_MARK_PRESENT_SHIFT	3
353381301a9bSJames Smart #define BGS_REFTAG_ERR_MASK		0x00000004
353481301a9bSJames Smart #define BGS_REFTAG_ERR_SHIFT		2
353581301a9bSJames Smart #define BGS_APPTAG_ERR_MASK		0x00000002
353681301a9bSJames Smart #define BGS_APPTAG_ERR_SHIFT		1
353781301a9bSJames Smart #define BGS_GUARD_ERR_MASK		0x00000001
353881301a9bSJames Smart #define BGS_GUARD_ERR_SHIFT		0
353981301a9bSJames Smart 	uint32_t bgstat;	/* word 15 - BlockGuard Status */
354081301a9bSJames Smart };
354181301a9bSJames Smart 
354281301a9bSJames Smart static inline uint32_t
354381301a9bSJames Smart lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat)
354481301a9bSJames Smart {
3545bc73905aSJames Smart 	return (bgstat & BGS_BIDIR_BG_PROF_MASK) >>
354681301a9bSJames Smart 				BGS_BIDIR_BG_PROF_SHIFT;
354781301a9bSJames Smart }
354881301a9bSJames Smart 
354981301a9bSJames Smart static inline uint32_t
355081301a9bSJames Smart lpfc_bgs_get_bidir_err_cond(uint32_t bgstat)
355181301a9bSJames Smart {
3552bc73905aSJames Smart 	return (bgstat & BGS_BIDIR_ERR_COND_FLAGS_MASK) >>
355381301a9bSJames Smart 				BGS_BIDIR_ERR_COND_SHIFT;
355481301a9bSJames Smart }
355581301a9bSJames Smart 
355681301a9bSJames Smart static inline uint32_t
355781301a9bSJames Smart lpfc_bgs_get_bg_prof(uint32_t bgstat)
355881301a9bSJames Smart {
3559bc73905aSJames Smart 	return (bgstat & BGS_BG_PROFILE_MASK) >>
356081301a9bSJames Smart 				BGS_BG_PROFILE_SHIFT;
356181301a9bSJames Smart }
356281301a9bSJames Smart 
356381301a9bSJames Smart static inline uint32_t
356481301a9bSJames Smart lpfc_bgs_get_invalid_prof(uint32_t bgstat)
356581301a9bSJames Smart {
3566bc73905aSJames Smart 	return (bgstat & BGS_INVALID_PROF_MASK) >>
356781301a9bSJames Smart 				BGS_INVALID_PROF_SHIFT;
356881301a9bSJames Smart }
356981301a9bSJames Smart 
357081301a9bSJames Smart static inline uint32_t
357181301a9bSJames Smart lpfc_bgs_get_uninit_dif_block(uint32_t bgstat)
357281301a9bSJames Smart {
3573bc73905aSJames Smart 	return (bgstat & BGS_UNINIT_DIF_BLOCK_MASK) >>
357481301a9bSJames Smart 				BGS_UNINIT_DIF_BLOCK_SHIFT;
357581301a9bSJames Smart }
357681301a9bSJames Smart 
357781301a9bSJames Smart static inline uint32_t
357881301a9bSJames Smart lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat)
357981301a9bSJames Smart {
3580bc73905aSJames Smart 	return (bgstat & BGS_HI_WATER_MARK_PRESENT_MASK) >>
358181301a9bSJames Smart 				BGS_HI_WATER_MARK_PRESENT_SHIFT;
358281301a9bSJames Smart }
358381301a9bSJames Smart 
358481301a9bSJames Smart static inline uint32_t
358581301a9bSJames Smart lpfc_bgs_get_reftag_err(uint32_t bgstat)
358681301a9bSJames Smart {
3587bc73905aSJames Smart 	return (bgstat & BGS_REFTAG_ERR_MASK) >>
358881301a9bSJames Smart 				BGS_REFTAG_ERR_SHIFT;
358981301a9bSJames Smart }
359081301a9bSJames Smart 
359181301a9bSJames Smart static inline uint32_t
359281301a9bSJames Smart lpfc_bgs_get_apptag_err(uint32_t bgstat)
359381301a9bSJames Smart {
3594bc73905aSJames Smart 	return (bgstat & BGS_APPTAG_ERR_MASK) >>
359581301a9bSJames Smart 				BGS_APPTAG_ERR_SHIFT;
359681301a9bSJames Smart }
359781301a9bSJames Smart 
359881301a9bSJames Smart static inline uint32_t
359981301a9bSJames Smart lpfc_bgs_get_guard_err(uint32_t bgstat)
360081301a9bSJames Smart {
3601bc73905aSJames Smart 	return (bgstat & BGS_GUARD_ERR_MASK) >>
360281301a9bSJames Smart 				BGS_GUARD_ERR_SHIFT;
360381301a9bSJames Smart }
360481301a9bSJames Smart 
360534b02dcdSJames Smart #define LPFC_EXT_DATA_BDE_COUNT 3
360634b02dcdSJames Smart struct fcp_irw_ext {
360734b02dcdSJames Smart 	uint32_t	io_tag64_low;
360834b02dcdSJames Smart 	uint32_t	io_tag64_high;
360934b02dcdSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
361034b02dcdSJames Smart 	uint8_t		reserved1;
361134b02dcdSJames Smart 	uint8_t		reserved2;
361234b02dcdSJames Smart 	uint8_t		reserved3;
361334b02dcdSJames Smart 	uint8_t		ebde_count;
361434b02dcdSJames Smart #else  /* __LITTLE_ENDIAN */
361534b02dcdSJames Smart 	uint8_t		ebde_count;
361634b02dcdSJames Smart 	uint8_t		reserved3;
361734b02dcdSJames Smart 	uint8_t		reserved2;
361834b02dcdSJames Smart 	uint8_t		reserved1;
361934b02dcdSJames Smart #endif
362034b02dcdSJames Smart 	uint32_t	reserved4;
362134b02dcdSJames Smart 	struct ulp_bde64 rbde;		/* response bde */
362234b02dcdSJames Smart 	struct ulp_bde64 dbde[LPFC_EXT_DATA_BDE_COUNT];	/* data BDE or BPL */
362334b02dcdSJames Smart 	uint8_t icd[32];		/* immediate command data (32 bytes) */
362434b02dcdSJames Smart };
362534b02dcdSJames Smart 
3626dea3101eS typedef struct _IOCB {	/* IOCB structure */
3627dea3101eS 	union {
3628dea3101eS 		GENERIC_RSP grsp;	/* Generic response */
3629dea3101eS 		XR_SEQ_FIELDS xrseq;	/* XMIT / BCAST / RCV_SEQUENCE cmd */
3630dea3101eS 		struct ulp_bde cont[3];	/* up to 3 continuation bdes */
3631dea3101eS 		RCV_ELS_REQ rcvels;	/* RCV_ELS_REQ template */
3632dea3101eS 		AC_XRI acxri;	/* ABORT / CLOSE_XRI template */
3633dea3101eS 		A_MXRI64 amxri;	/* abort multiple xri command overlay */
3634dea3101eS 		GET_RPI getrpi;	/* GET_RPI template */
3635dea3101eS 		FCPI_FIELDS fcpi;	/* FCP Initiator template */
3636dea3101eS 		FCPT_FIELDS fcpt;	/* FCP target template */
3637dea3101eS 
3638dea3101eS 		/* SLI-2 structures */
3639dea3101eS 
3640dea3101eS 		struct ulp_bde64 cont64[2];  /* up to 2 64 bit continuation
3641ed957684SJames Smart 					      * bde_64s */
3642dea3101eS 		ELS_REQUEST64 elsreq64;	/* ELS_REQUEST template */
3643dea3101eS 		GEN_REQUEST64 genreq64;	/* GEN_REQUEST template */
3644dea3101eS 		RCV_ELS_REQ64 rcvels64;	/* RCV_ELS_REQ template */
3645dea3101eS 		XMT_SEQ_FIELDS64 xseq64;	/* XMIT / BCAST cmd */
3646dea3101eS 		FCPI_FIELDS64 fcpi64;	/* FCP 64 bit Initiator template */
3647dea3101eS 		FCPT_FIELDS64 fcpt64;	/* FCP 64 bit target template */
364857127f15SJames Smart 		ASYNCSTAT_FIELDS asyncstat; /* async_status iocb */
364976bb24efSJames Smart 		QUE_XRI64_CX_FIELDS quexri64cx; /* que_xri64_cx fields */
36509c2face6SJames Smart 		struct rcv_seq64 rcvseq64;	/* RCV_SEQ64 and RCV_CONT64 */
3651546fc854SJames Smart 		struct sli4_bls_rsp bls_rsp; /* UNSOL ABTS BLS_RSP params */
3652dea3101eS 		uint32_t ulpWord[IOCB_WORD_SZ - 2];	/* generic 6 'words' */
3653dea3101eS 	} un;
3654dea3101eS 	union {
3655dea3101eS 		struct {
3656dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3657dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
3658dea3101eS 			uint16_t ulpIoTag;	/* Low  order bits word 6 */
3659dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3660dea3101eS 			uint16_t ulpIoTag;	/* Low  order bits word 6 */
3661dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
3662dea3101eS #endif
3663dea3101eS 		} t1;
3664dea3101eS 		struct {
3665dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3666dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
3667dea3101eS 			uint16_t ulpIoTag1:2;	/* Low  order bits word 6 */
3668dea3101eS 			uint16_t ulpIoTag0:14;	/* Low  order bits word 6 */
3669dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3670dea3101eS 			uint16_t ulpIoTag0:14;	/* Low  order bits word 6 */
3671dea3101eS 			uint16_t ulpIoTag1:2;	/* Low  order bits word 6 */
3672dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
3673dea3101eS #endif
3674dea3101eS 		} t2;
3675dea3101eS 	} un1;
3676dea3101eS #define ulpContext un1.t1.ulpContext
3677dea3101eS #define ulpIoTag   un1.t1.ulpIoTag
3678dea3101eS #define ulpIoTag0  un1.t2.ulpIoTag0
3679dea3101eS 
3680dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3681dea3101eS 	uint32_t ulpTimeout:8;
3682dea3101eS 	uint32_t ulpXS:1;
3683dea3101eS 	uint32_t ulpFCP2Rcvy:1;
3684dea3101eS 	uint32_t ulpPU:2;
3685dea3101eS 	uint32_t ulpIr:1;
3686dea3101eS 	uint32_t ulpClass:3;
3687dea3101eS 	uint32_t ulpCommand:8;
3688dea3101eS 	uint32_t ulpStatus:4;
3689dea3101eS 	uint32_t ulpBdeCount:2;
3690dea3101eS 	uint32_t ulpLe:1;
3691dea3101eS 	uint32_t ulpOwner:1;	/* Low order bit word 7 */
3692dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3693dea3101eS 	uint32_t ulpOwner:1;	/* Low order bit word 7 */
3694dea3101eS 	uint32_t ulpLe:1;
3695dea3101eS 	uint32_t ulpBdeCount:2;
3696dea3101eS 	uint32_t ulpStatus:4;
3697dea3101eS 	uint32_t ulpCommand:8;
3698dea3101eS 	uint32_t ulpClass:3;
3699dea3101eS 	uint32_t ulpIr:1;
3700dea3101eS 	uint32_t ulpPU:2;
3701dea3101eS 	uint32_t ulpFCP2Rcvy:1;
3702dea3101eS 	uint32_t ulpXS:1;
3703dea3101eS 	uint32_t ulpTimeout:8;
3704dea3101eS #endif
370592d7f7b0SJames Smart 
3706ed957684SJames Smart 	union {
3707ed957684SJames Smart 		struct rcv_sli3 rcvsli3; /* words 8 - 15 */
370876bb24efSJames Smart 
370976bb24efSJames Smart 		/* words 8-31 used for que_xri_cx iocb */
371076bb24efSJames Smart 		struct que_xri64cx_ext_fields que_xri64cx_ext_words;
371134b02dcdSJames Smart 		struct fcp_irw_ext fcp_ext;
3712ed957684SJames Smart 		uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */
371381301a9bSJames Smart 
371481301a9bSJames Smart 		/* words 8-15 for BlockGuard */
371581301a9bSJames Smart 		struct sli3_bg_fields sli3_bg;
3716ed957684SJames Smart 	} unsli3;
3717dea3101eS 
3718ed957684SJames Smart #define ulpCt_h ulpXS
3719ed957684SJames Smart #define ulpCt_l ulpFCP2Rcvy
3720ed957684SJames Smart 
3721ed957684SJames Smart #define IOCB_FCP	   1	/* IOCB is used for FCP ELS cmds-ulpRsvByte */
3722ed957684SJames Smart #define IOCB_IP		   2	/* IOCB is used for IP ELS cmds */
3723dea3101eS #define PARM_UNUSED        0	/* PU field (Word 4) not used */
3724dea3101eS #define PARM_REL_OFF       1	/* PU field (Word 4) = R. O. */
3725dea3101eS #define PARM_READ_CHECK    2	/* PU field (Word 4) = Data Transfer Length */
372692d7f7b0SJames Smart #define PARM_NPIV_DID	   3
3727dea3101eS #define CLASS1             0	/* Class 1 */
3728dea3101eS #define CLASS2             1	/* Class 2 */
3729dea3101eS #define CLASS3             2	/* Class 3 */
3730dea3101eS #define CLASS_FCP_INTERMIX 7	/* FCP Data->Cls 1, all else->Cls 2 */
3731dea3101eS 
3732dea3101eS #define IOSTAT_SUCCESS         0x0	/* ulpStatus  - HBA defined */
3733dea3101eS #define IOSTAT_FCP_RSP_ERROR   0x1
3734dea3101eS #define IOSTAT_REMOTE_STOP     0x2
3735dea3101eS #define IOSTAT_LOCAL_REJECT    0x3
3736dea3101eS #define IOSTAT_NPORT_RJT       0x4
3737dea3101eS #define IOSTAT_FABRIC_RJT      0x5
3738dea3101eS #define IOSTAT_NPORT_BSY       0x6
3739dea3101eS #define IOSTAT_FABRIC_BSY      0x7
3740dea3101eS #define IOSTAT_INTERMED_RSP    0x8
3741dea3101eS #define IOSTAT_LS_RJT          0x9
3742dea3101eS #define IOSTAT_BA_RJT          0xA
3743dea3101eS #define IOSTAT_RSVD1           0xB
3744dea3101eS #define IOSTAT_RSVD2           0xC
3745dea3101eS #define IOSTAT_RSVD3           0xD
3746dea3101eS #define IOSTAT_RSVD4           0xE
374792d7f7b0SJames Smart #define IOSTAT_NEED_BUFFER     0xF
3748dea3101eS #define IOSTAT_DRIVER_REJECT   0x10   /* ulpStatus  - Driver defined */
3749dea3101eS #define IOSTAT_DEFAULT         0xF    /* Same as rsvd5 for now */
3750dea3101eS #define IOSTAT_CNT             0x11
3751dea3101eS 
3752dea3101eS } IOCB_t;
3753dea3101eS 
3754dea3101eS 
3755dea3101eS #define SLI1_SLIM_SIZE   (4 * 1024)
3756dea3101eS 
3757dea3101eS /* Up to 498 IOCBs will fit into 16k
3758dea3101eS  * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384
3759dea3101eS  */
3760ed957684SJames Smart #define SLI2_SLIM_SIZE   (64 * 1024)
3761dea3101eS 
3762dea3101eS /* Maximum IOCBs that will fit in SLI2 slim */
3763dea3101eS #define MAX_SLI2_IOCB    498
3764ed957684SJames Smart #define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \
37657a470277SJames Smart 			    (sizeof(MAILBOX_t) + sizeof(PCB_t) + \
37667a470277SJames Smart 			    sizeof(uint32_t) * MAILBOX_EXT_WSIZE))
3767ed957684SJames Smart 
3768ed957684SJames Smart /* HBQ entries are 4 words each = 4k */
3769ed957684SJames Smart #define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) *  \
3770ed957684SJames Smart 			     lpfc_sli_hbq_count())
3771dea3101eS 
3772dea3101eS struct lpfc_sli2_slim {
3773dea3101eS 	MAILBOX_t mbx;
37747a470277SJames Smart 	uint32_t  mbx_ext_words[MAILBOX_EXT_WSIZE];
3775dea3101eS 	PCB_t pcb;
3776ed957684SJames Smart 	IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE];
3777dea3101eS };
3778dea3101eS 
37792e0fef85SJames Smart /*
37802e0fef85SJames Smart  * This function checks PCI device to allow special handling for LC HBAs.
37812e0fef85SJames Smart  *
37822e0fef85SJames Smart  * Parameters:
37832e0fef85SJames Smart  * device : struct pci_dev 's device field
37842e0fef85SJames Smart  *
37852e0fef85SJames Smart  * return 1 => TRUE
37862e0fef85SJames Smart  *        0 => FALSE
37872e0fef85SJames Smart  */
3788dea3101eS static inline int
3789dea3101eS lpfc_is_LC_HBA(unsigned short device)
3790dea3101eS {
3791dea3101eS 	if ((device == PCI_DEVICE_ID_TFLY) ||
3792dea3101eS 	    (device == PCI_DEVICE_ID_PFLY) ||
3793dea3101eS 	    (device == PCI_DEVICE_ID_LP101) ||
3794dea3101eS 	    (device == PCI_DEVICE_ID_BMID) ||
3795dea3101eS 	    (device == PCI_DEVICE_ID_BSMB) ||
3796dea3101eS 	    (device == PCI_DEVICE_ID_ZMID) ||
3797dea3101eS 	    (device == PCI_DEVICE_ID_ZSMB) ||
379809372820SJames Smart 	    (device == PCI_DEVICE_ID_SAT_MID) ||
379909372820SJames Smart 	    (device == PCI_DEVICE_ID_SAT_SMB) ||
3800dea3101eS 	    (device == PCI_DEVICE_ID_RFLY))
3801dea3101eS 		return 1;
3802dea3101eS 	else
3803dea3101eS 		return 0;
3804dea3101eS }
3805858c9f6cSJames Smart 
3806858c9f6cSJames Smart /*
3807858c9f6cSJames Smart  * Determine if an IOCB failed because of a link event or firmware reset.
3808858c9f6cSJames Smart  */
3809858c9f6cSJames Smart 
3810858c9f6cSJames Smart static inline int
3811858c9f6cSJames Smart lpfc_error_lost_link(IOCB_t *iocbp)
3812858c9f6cSJames Smart {
3813858c9f6cSJames Smart 	return (iocbp->ulpStatus == IOSTAT_LOCAL_REJECT &&
3814858c9f6cSJames Smart 		(iocbp->un.ulpWord[4] == IOERR_SLI_ABORTED ||
3815858c9f6cSJames Smart 		 iocbp->un.ulpWord[4] == IOERR_LINK_DOWN ||
3816858c9f6cSJames Smart 		 iocbp->un.ulpWord[4] == IOERR_SLI_DOWN));
3817858c9f6cSJames Smart }
381884774a4dSJames Smart 
381984774a4dSJames Smart #define MENLO_TRANSPORT_TYPE 0xfe
382084774a4dSJames Smart #define MENLO_CONTEXT 0
382184774a4dSJames Smart #define MENLO_PU 3
382284774a4dSJames Smart #define MENLO_TIMEOUT 30
382384774a4dSJames Smart #define SETVAR_MLOMNT 0x103107
382484774a4dSJames Smart #define SETVAR_MLORST 0x103007
3825da0436e9SJames Smart 
3826da0436e9SJames Smart #define BPL_ALIGN_SZ 8 /* 8 byte alignment for bpl and mbufs */
3827