xref: /linux/drivers/scsi/lpfc/lpfc_hw.h (revision e0165f20447c8ca1d367725ee94d8ec9f38ca275)
1dea3101eS /*******************************************************************
2dea3101eS  * This file is part of the Emulex Linux Device Driver for         *
3c44ce173SJames.Smart@Emulex.Com  * Fibre Channel Host Bus Adapters.                                *
450611577SJames Smart  * Copyright (C) 2004-2016 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) */
3621bf0b97SJames Smart #define FF_DEF_RATOV            10	/* Default RA_TOV (10s) */
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
481ba981fdSJames Smart #define LPFC_FCP_OAS_RING        3
49dea3101eS 
50dea3101eS #define SLI2_IOCB_CMD_R0_ENTRIES    172	/* SLI-2 FCP command ring entries */
51dea3101eS #define SLI2_IOCB_RSP_R0_ENTRIES    134	/* SLI-2 FCP response ring entries */
52a4bc3379SJames Smart #define SLI2_IOCB_CMD_R1_ENTRIES      4	/* SLI-2 extra command ring entries */
53a4bc3379SJames Smart #define SLI2_IOCB_RSP_R1_ENTRIES      4	/* SLI-2 extra response ring entries */
54dea3101eS #define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36	/* SLI-2 extra FCP cmd ring entries */
55dea3101eS #define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52	/* SLI-2 extra FCP rsp ring entries */
56dea3101eS #define SLI2_IOCB_CMD_R2_ENTRIES     20	/* SLI-2 ELS command ring entries */
57dea3101eS #define SLI2_IOCB_RSP_R2_ENTRIES     20	/* SLI-2 ELS response ring entries */
58dea3101eS #define SLI2_IOCB_CMD_R3_ENTRIES      0
59dea3101eS #define SLI2_IOCB_RSP_R3_ENTRIES      0
60dea3101eS #define SLI2_IOCB_CMD_R3XTRA_ENTRIES 24
61dea3101eS #define SLI2_IOCB_RSP_R3XTRA_ENTRIES 32
62dea3101eS 
63ed957684SJames Smart #define SLI2_IOCB_CMD_SIZE	32
64ed957684SJames Smart #define SLI2_IOCB_RSP_SIZE	32
65ed957684SJames Smart #define SLI3_IOCB_CMD_SIZE	128
66ed957684SJames Smart #define SLI3_IOCB_RSP_SIZE	64
67ed957684SJames Smart 
686d368e53SJames Smart #define LPFC_UNREG_ALL_RPIS_VPORT	0xffff
696d368e53SJames Smart #define LPFC_UNREG_ALL_DFLT_RPIS	0xffffffff
7092d7f7b0SJames Smart 
71ddcc50f0SJames Smart /* vendor ID used in SCSI netlink calls */
72ddcc50f0SJames Smart #define LPFC_NL_VENDOR_ID (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX)
73ddcc50f0SJames Smart 
746b5151fdSJames Smart #define FW_REV_STR_SIZE	32
75dea3101eS /* Common Transport structures and definitions */
76dea3101eS 
77dea3101eS union CtRevisionId {
78dea3101eS 	/* Structure is in Big Endian format */
79dea3101eS 	struct {
80dea3101eS 		uint32_t Revision:8;
81dea3101eS 		uint32_t InId:24;
82dea3101eS 	} bits;
83dea3101eS 	uint32_t word;
84dea3101eS };
85dea3101eS 
86dea3101eS union CtCommandResponse {
87dea3101eS 	/* Structure is in Big Endian format */
88dea3101eS 	struct {
89dea3101eS 		uint32_t CmdRsp:16;
90dea3101eS 		uint32_t Size:16;
91dea3101eS 	} bits;
92dea3101eS 	uint32_t word;
93dea3101eS };
94dea3101eS 
9592d7f7b0SJames Smart #define FC4_FEATURE_INIT 0x2
9692d7f7b0SJames Smart #define FC4_FEATURE_TARGET 0x1
9792d7f7b0SJames Smart 
98dea3101eS struct lpfc_sli_ct_request {
99dea3101eS 	/* Structure is in Big Endian format */
100dea3101eS 	union CtRevisionId RevisionId;
101dea3101eS 	uint8_t FsType;
102dea3101eS 	uint8_t FsSubType;
103dea3101eS 	uint8_t Options;
104dea3101eS 	uint8_t Rsrvd1;
105dea3101eS 	union CtCommandResponse CommandResponse;
106dea3101eS 	uint8_t Rsrvd2;
107dea3101eS 	uint8_t ReasonCode;
108dea3101eS 	uint8_t Explanation;
109dea3101eS 	uint8_t VendorUnique;
11076b2c34aSJames Smart #define LPFC_CT_PREAMBLE	20	/* Size of CTReq + 4 up to here */
111dea3101eS 
112dea3101eS 	union {
113dea3101eS 		uint32_t PortID;
114dea3101eS 		struct gid {
115dea3101eS 			uint8_t PortType;	/* for GID_PT requests */
116dea3101eS 			uint8_t DomainScope;
117dea3101eS 			uint8_t AreaScope;
118dea3101eS 			uint8_t Fc4Type;	/* for GID_FT requests */
119dea3101eS 		} gid;
120dea3101eS 		struct rft {
121dea3101eS 			uint32_t PortId;	/* For RFT_ID requests */
122dea3101eS 
123dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
124dea3101eS 			uint32_t rsvd0:16;
125dea3101eS 			uint32_t rsvd1:7;
126dea3101eS 			uint32_t fcpReg:1;	/* Type 8 */
127dea3101eS 			uint32_t rsvd2:2;
128dea3101eS 			uint32_t ipReg:1;	/* Type 5 */
129dea3101eS 			uint32_t rsvd3:5;
130dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
131dea3101eS 			uint32_t rsvd0:16;
132dea3101eS 			uint32_t fcpReg:1;	/* Type 8 */
133dea3101eS 			uint32_t rsvd1:7;
134dea3101eS 			uint32_t rsvd3:5;
135dea3101eS 			uint32_t ipReg:1;	/* Type 5 */
136dea3101eS 			uint32_t rsvd2:2;
137dea3101eS #endif
138dea3101eS 
139dea3101eS 			uint32_t rsvd[7];
140dea3101eS 		} rft;
141dea3101eS 		struct rnn {
142dea3101eS 			uint32_t PortId;	/* For RNN_ID requests */
143dea3101eS 			uint8_t wwnn[8];
144dea3101eS 		} rnn;
145dea3101eS 		struct rsnn {	/* For RSNN_ID requests */
146dea3101eS 			uint8_t wwnn[8];
147dea3101eS 			uint8_t len;
148dea3101eS 			uint8_t symbname[255];
149dea3101eS 		} rsnn;
1507ee5d43eSJames Smart 		struct da_id { /* For DA_ID requests */
1517ee5d43eSJames Smart 			uint32_t port_id;
1527ee5d43eSJames Smart 		} da_id;
15392d7f7b0SJames Smart 		struct rspn {	/* For RSPN_ID requests */
15492d7f7b0SJames Smart 			uint32_t PortId;
15592d7f7b0SJames Smart 			uint8_t len;
15692d7f7b0SJames Smart 			uint8_t symbname[255];
15792d7f7b0SJames Smart 		} rspn;
15892d7f7b0SJames Smart 		struct gff {
15992d7f7b0SJames Smart 			uint32_t PortId;
16092d7f7b0SJames Smart 		} gff;
16192d7f7b0SJames Smart 		struct gff_acc {
16292d7f7b0SJames Smart 			uint8_t fbits[128];
16392d7f7b0SJames Smart 		} gff_acc;
16451ef4c26SJames Smart #define FCP_TYPE_FEATURE_OFFSET 7
16592d7f7b0SJames Smart 		struct rff {
16692d7f7b0SJames Smart 			uint32_t PortId;
16792d7f7b0SJames Smart 			uint8_t reserved[2];
16892d7f7b0SJames Smart 			uint8_t fbits;
16992d7f7b0SJames Smart 			uint8_t type_code;     /* type=8 for FCP */
17092d7f7b0SJames Smart 		} rff;
171dea3101eS 	} un;
172dea3101eS };
173dea3101eS 
17476b2c34aSJames Smart #define LPFC_MAX_CT_SIZE	(60 * 4096)
17576b2c34aSJames Smart 
176dea3101eS #define  SLI_CT_REVISION        1
17792d7f7b0SJames Smart #define  GID_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
17892d7f7b0SJames Smart 			   sizeof(struct gid))
17992d7f7b0SJames Smart #define  GFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
18092d7f7b0SJames Smart 			   sizeof(struct gff))
18192d7f7b0SJames Smart #define  RFT_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
18292d7f7b0SJames Smart 			   sizeof(struct rft))
18392d7f7b0SJames Smart #define  RFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
18492d7f7b0SJames Smart 			   sizeof(struct rff))
18592d7f7b0SJames Smart #define  RNN_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
18692d7f7b0SJames Smart 			   sizeof(struct rnn))
18792d7f7b0SJames Smart #define  RSNN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
18892d7f7b0SJames Smart 			   sizeof(struct rsnn))
1897ee5d43eSJames Smart #define DA_ID_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
1907ee5d43eSJames Smart 			  sizeof(struct da_id))
19192d7f7b0SJames Smart #define  RSPN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
19292d7f7b0SJames Smart 			   sizeof(struct rspn))
193dea3101eS 
194dea3101eS /*
195dea3101eS  * FsType Definitions
196dea3101eS  */
197dea3101eS 
198dea3101eS #define  SLI_CT_MANAGEMENT_SERVICE        0xFA
199dea3101eS #define  SLI_CT_TIME_SERVICE              0xFB
200dea3101eS #define  SLI_CT_DIRECTORY_SERVICE         0xFC
201dea3101eS #define  SLI_CT_FABRIC_CONTROLLER_SERVICE 0xFD
202dea3101eS 
203dea3101eS /*
204dea3101eS  * Directory Service Subtypes
205dea3101eS  */
206dea3101eS 
207dea3101eS #define  SLI_CT_DIRECTORY_NAME_SERVER     0x02
208dea3101eS 
209dea3101eS /*
210dea3101eS  * Response Codes
211dea3101eS  */
212dea3101eS 
213dea3101eS #define  SLI_CT_RESPONSE_FS_RJT           0x8001
214dea3101eS #define  SLI_CT_RESPONSE_FS_ACC           0x8002
215dea3101eS 
216dea3101eS /*
217dea3101eS  * Reason Codes
218dea3101eS  */
219dea3101eS 
220dea3101eS #define  SLI_CT_NO_ADDITIONAL_EXPL	  0x0
221dea3101eS #define  SLI_CT_INVALID_COMMAND           0x01
222dea3101eS #define  SLI_CT_INVALID_VERSION           0x02
223dea3101eS #define  SLI_CT_LOGICAL_ERROR             0x03
224dea3101eS #define  SLI_CT_INVALID_IU_SIZE           0x04
225dea3101eS #define  SLI_CT_LOGICAL_BUSY              0x05
226dea3101eS #define  SLI_CT_PROTOCOL_ERROR            0x07
227dea3101eS #define  SLI_CT_UNABLE_TO_PERFORM_REQ     0x09
228dea3101eS #define  SLI_CT_REQ_NOT_SUPPORTED         0x0b
229dea3101eS #define  SLI_CT_HBA_INFO_NOT_REGISTERED	  0x10
230dea3101eS #define  SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE  0x11
231dea3101eS #define  SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN      0x12
232dea3101eS #define  SLI_CT_HBA_ATTR_NOT_PRESENT	  0x13
233dea3101eS #define  SLI_CT_PORT_INFO_NOT_REGISTERED  0x20
234dea3101eS #define  SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE 0x21
235dea3101eS #define  SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN     0x22
236dea3101eS #define  SLI_CT_VENDOR_UNIQUE             0xff
237dea3101eS 
238dea3101eS /*
239dea3101eS  * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
240dea3101eS  */
241dea3101eS 
242dea3101eS #define  SLI_CT_NO_PORT_ID                0x01
243dea3101eS #define  SLI_CT_NO_PORT_NAME              0x02
244dea3101eS #define  SLI_CT_NO_NODE_NAME              0x03
245dea3101eS #define  SLI_CT_NO_CLASS_OF_SERVICE       0x04
246dea3101eS #define  SLI_CT_NO_IP_ADDRESS             0x05
247dea3101eS #define  SLI_CT_NO_IPA                    0x06
248dea3101eS #define  SLI_CT_NO_FC4_TYPES              0x07
249dea3101eS #define  SLI_CT_NO_SYMBOLIC_PORT_NAME     0x08
250dea3101eS #define  SLI_CT_NO_SYMBOLIC_NODE_NAME     0x09
251dea3101eS #define  SLI_CT_NO_PORT_TYPE              0x0A
252dea3101eS #define  SLI_CT_ACCESS_DENIED             0x10
253dea3101eS #define  SLI_CT_INVALID_PORT_ID           0x11
254dea3101eS #define  SLI_CT_DATABASE_EMPTY            0x12
255dea3101eS 
256dea3101eS /*
257dea3101eS  * Name Server Command Codes
258dea3101eS  */
259dea3101eS 
260dea3101eS #define  SLI_CTNS_GA_NXT      0x0100
261dea3101eS #define  SLI_CTNS_GPN_ID      0x0112
262dea3101eS #define  SLI_CTNS_GNN_ID      0x0113
263dea3101eS #define  SLI_CTNS_GCS_ID      0x0114
264dea3101eS #define  SLI_CTNS_GFT_ID      0x0117
265dea3101eS #define  SLI_CTNS_GSPN_ID     0x0118
266dea3101eS #define  SLI_CTNS_GPT_ID      0x011A
26792d7f7b0SJames Smart #define  SLI_CTNS_GFF_ID      0x011F
268dea3101eS #define  SLI_CTNS_GID_PN      0x0121
269dea3101eS #define  SLI_CTNS_GID_NN      0x0131
270dea3101eS #define  SLI_CTNS_GIP_NN      0x0135
271dea3101eS #define  SLI_CTNS_GIPA_NN     0x0136
272dea3101eS #define  SLI_CTNS_GSNN_NN     0x0139
273dea3101eS #define  SLI_CTNS_GNN_IP      0x0153
274dea3101eS #define  SLI_CTNS_GIPA_IP     0x0156
275dea3101eS #define  SLI_CTNS_GID_FT      0x0171
276dea3101eS #define  SLI_CTNS_GID_PT      0x01A1
277dea3101eS #define  SLI_CTNS_RPN_ID      0x0212
278dea3101eS #define  SLI_CTNS_RNN_ID      0x0213
279dea3101eS #define  SLI_CTNS_RCS_ID      0x0214
280dea3101eS #define  SLI_CTNS_RFT_ID      0x0217
281dea3101eS #define  SLI_CTNS_RSPN_ID     0x0218
282dea3101eS #define  SLI_CTNS_RPT_ID      0x021A
28392d7f7b0SJames Smart #define  SLI_CTNS_RFF_ID      0x021F
284dea3101eS #define  SLI_CTNS_RIP_NN      0x0235
285dea3101eS #define  SLI_CTNS_RIPA_NN     0x0236
286dea3101eS #define  SLI_CTNS_RSNN_NN     0x0239
287dea3101eS #define  SLI_CTNS_DA_ID       0x0300
288dea3101eS 
289dea3101eS /*
290dea3101eS  * Port Types
291dea3101eS  */
292dea3101eS 
293dea3101eS #define  SLI_CTPT_N_PORT      0x01
294dea3101eS #define  SLI_CTPT_NL_PORT     0x02
295dea3101eS #define  SLI_CTPT_FNL_PORT    0x03
296dea3101eS #define  SLI_CTPT_IP          0x04
297dea3101eS #define  SLI_CTPT_FCP         0x08
298dea3101eS #define  SLI_CTPT_NX_PORT     0x7F
299dea3101eS #define  SLI_CTPT_F_PORT      0x81
300dea3101eS #define  SLI_CTPT_FL_PORT     0x82
301dea3101eS #define  SLI_CTPT_E_PORT      0x84
302dea3101eS 
303dea3101eS #define SLI_CT_LAST_ENTRY     0x80000000
304dea3101eS 
305dea3101eS /* Fibre Channel Service Parameter definitions */
306dea3101eS 
307dea3101eS #define FC_PH_4_0   6		/* FC-PH version 4.0 */
308dea3101eS #define FC_PH_4_1   7		/* FC-PH version 4.1 */
309dea3101eS #define FC_PH_4_2   8		/* FC-PH version 4.2 */
310dea3101eS #define FC_PH_4_3   9		/* FC-PH version 4.3 */
311dea3101eS 
312dea3101eS #define FC_PH_LOW   8		/* Lowest supported FC-PH version */
313dea3101eS #define FC_PH_HIGH  9		/* Highest supported FC-PH version */
314dea3101eS #define FC_PH3   0x20		/* FC-PH-3 version */
315dea3101eS 
316dea3101eS #define FF_FRAME_SIZE     2048
317dea3101eS 
318dea3101eS struct lpfc_name {
319f631b4beSAndrew Vasquez 	union {
320f631b4beSAndrew Vasquez 		struct {
321dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
322dea3101eS 			uint8_t nameType:4;	/* FC Word 0, bit 28:31 */
3231de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit
3241de933f3SJames.Smart@Emulex.Com 						   8:11 of IEEE ext */
325dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3261de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit
3271de933f3SJames.Smart@Emulex.Com 						   8:11 of IEEE ext */
328dea3101eS 			uint8_t nameType:4;	/* FC Word 0, bit 28:31 */
329dea3101eS #endif
330dea3101eS 
331dea3101eS #define NAME_IEEE           0x1	/* IEEE name - nameType */
332dea3101eS #define NAME_IEEE_EXT       0x2	/* IEEE extended name */
333dea3101eS #define NAME_FC_TYPE        0x3	/* FC native name type */
334dea3101eS #define NAME_IP_TYPE        0x4	/* IP address */
335dea3101eS #define NAME_CCITT_TYPE     0xC
336dea3101eS #define NAME_CCITT_GR_TYPE  0xE
3371de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextLsb;	/* FC Word 0, bit 16:23, IEEE
3381de933f3SJames.Smart@Emulex.Com 						   extended Lsb */
339dea3101eS 			uint8_t IEEE[6];	/* FC IEEE address */
34068ce1eb5SAndrew Morton 		} s;
341f631b4beSAndrew Vasquez 		uint8_t wwn[8];
34268ce1eb5SAndrew Morton 	} u;
343f631b4beSAndrew Vasquez };
344dea3101eS 
345dea3101eS struct csp {
346dea3101eS 	uint8_t fcphHigh;	/* FC Word 0, byte 0 */
347dea3101eS 	uint8_t fcphLow;
348dea3101eS 	uint8_t bbCreditMsb;
3493aaaa314SJames Smart 	uint8_t bbCreditLsb;	/* FC Word 0, byte 3 */
350dea3101eS 
35192494144SJames Smart /*
35292494144SJames Smart  * Word 1 Bit 31 in common service parameter is overloaded.
35392494144SJames Smart  * Word 1 Bit 31 in FLOGI request is multiple NPort request
35492494144SJames Smart  * Word 1 Bit 31 in FLOGI response is clean address bit
35592494144SJames Smart  */
35692494144SJames Smart #define clean_address_bit request_multiple_Nport /* Word 1, bit 31 */
357df9e1b59SJames Smart /*
358df9e1b59SJames Smart  * Word 1 Bit 30 in common service parameter is overloaded.
359df9e1b59SJames Smart  * Word 1 Bit 30 in FLOGI request is Virtual Fabrics
360df9e1b59SJames Smart  * Word 1 Bit 30 in PLOGI request is random offset
361df9e1b59SJames Smart  */
362df9e1b59SJames Smart #define virtual_fabric_support randomOffset /* Word 1, bit 30 */
363*e0165f20SJames Smart /*
364*e0165f20SJames Smart  * Word 1 Bit 29 in common service parameter is overloaded.
365*e0165f20SJames Smart  * Word 1 Bit 29 in FLOGI response is multiple NPort assignment
366*e0165f20SJames Smart  * Word 1 Bit 29 in FLOGI/PLOGI request is Valid Vendor Version Level
367*e0165f20SJames Smart  */
368*e0165f20SJames Smart #define valid_vendor_ver_level response_multiple_NPort /* Word 1, bit 29 */
369dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
37092d7f7b0SJames Smart 	uint16_t request_multiple_Nport:1;	/* FC Word 1, bit 31 */
37192d7f7b0SJames Smart 	uint16_t randomOffset:1;	/* FC Word 1, bit 30 */
37292d7f7b0SJames Smart 	uint16_t response_multiple_NPort:1;	/* FC Word 1, bit 29 */
373dea3101eS 	uint16_t fPort:1;	/* FC Word 1, bit 28 */
374dea3101eS 	uint16_t altBbCredit:1;	/* FC Word 1, bit 27 */
375dea3101eS 	uint16_t edtovResolution:1;	/* FC Word 1, bit 26 */
376dea3101eS 	uint16_t multicast:1;	/* FC Word 1, bit 25 */
377dea3101eS 	uint16_t broadcast:1;	/* FC Word 1, bit 24 */
378dea3101eS 
379dea3101eS 	uint16_t huntgroup:1;	/* FC Word 1, bit 23 */
380dea3101eS 	uint16_t simplex:1;	/* FC Word 1, bit 22 */
381dea3101eS 	uint16_t word1Reserved1:3;	/* FC Word 1, bit 21:19 */
382dea3101eS 	uint16_t dhd:1;		/* FC Word 1, bit 18 */
383dea3101eS 	uint16_t contIncSeqCnt:1;	/* FC Word 1, bit 17 */
384dea3101eS 	uint16_t payloadlength:1;	/* FC Word 1, bit 16 */
385dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
386dea3101eS 	uint16_t broadcast:1;	/* FC Word 1, bit 24 */
387dea3101eS 	uint16_t multicast:1;	/* FC Word 1, bit 25 */
388dea3101eS 	uint16_t edtovResolution:1;	/* FC Word 1, bit 26 */
389dea3101eS 	uint16_t altBbCredit:1;	/* FC Word 1, bit 27 */
390dea3101eS 	uint16_t fPort:1;	/* FC Word 1, bit 28 */
39192d7f7b0SJames Smart 	uint16_t response_multiple_NPort:1;	/* FC Word 1, bit 29 */
392dea3101eS 	uint16_t randomOffset:1;	/* FC Word 1, bit 30 */
39392d7f7b0SJames Smart 	uint16_t request_multiple_Nport:1;	/* FC Word 1, bit 31 */
394dea3101eS 
395dea3101eS 	uint16_t payloadlength:1;	/* FC Word 1, bit 16 */
396dea3101eS 	uint16_t contIncSeqCnt:1;	/* FC Word 1, bit 17 */
397dea3101eS 	uint16_t dhd:1;		/* FC Word 1, bit 18 */
398dea3101eS 	uint16_t word1Reserved1:3;	/* FC Word 1, bit 21:19 */
399dea3101eS 	uint16_t simplex:1;	/* FC Word 1, bit 22 */
400dea3101eS 	uint16_t huntgroup:1;	/* FC Word 1, bit 23 */
401dea3101eS #endif
402dea3101eS 
403dea3101eS 	uint8_t bbRcvSizeMsb;	/* Upper nibble is reserved */
404dea3101eS 	uint8_t bbRcvSizeLsb;	/* FC Word 1, byte 3 */
405dea3101eS 	union {
406dea3101eS 		struct {
407dea3101eS 			uint8_t word2Reserved1;	/* FC Word 2 byte 0 */
408dea3101eS 
409dea3101eS 			uint8_t totalConcurrSeq;	/* FC Word 2 byte 1 */
410dea3101eS 			uint8_t roByCategoryMsb;	/* FC Word 2 byte 2 */
411dea3101eS 
412dea3101eS 			uint8_t roByCategoryLsb;	/* FC Word 2 byte 3 */
413dea3101eS 		} nPort;
414dea3101eS 		uint32_t r_a_tov;	/* R_A_TOV must be in B.E. format */
415dea3101eS 	} w2;
416dea3101eS 
417dea3101eS 	uint32_t e_d_tov;	/* E_D_TOV must be in B.E. format */
418dea3101eS };
419dea3101eS 
420dea3101eS struct class_parms {
421dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
422dea3101eS 	uint8_t classValid:1;	/* FC Word 0, bit 31 */
423dea3101eS 	uint8_t intermix:1;	/* FC Word 0, bit 30 */
424dea3101eS 	uint8_t stackedXparent:1;	/* FC Word 0, bit 29 */
425dea3101eS 	uint8_t stackedLockDown:1;	/* FC Word 0, bit 28 */
426dea3101eS 	uint8_t seqDelivery:1;	/* FC Word 0, bit 27 */
427dea3101eS 	uint8_t word0Reserved1:3;	/* FC Word 0, bit 24:26 */
428dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
429dea3101eS 	uint8_t word0Reserved1:3;	/* FC Word 0, bit 24:26 */
430dea3101eS 	uint8_t seqDelivery:1;	/* FC Word 0, bit 27 */
431dea3101eS 	uint8_t stackedLockDown:1;	/* FC Word 0, bit 28 */
432dea3101eS 	uint8_t stackedXparent:1;	/* FC Word 0, bit 29 */
433dea3101eS 	uint8_t intermix:1;	/* FC Word 0, bit 30 */
434dea3101eS 	uint8_t classValid:1;	/* FC Word 0, bit 31 */
435dea3101eS 
436dea3101eS #endif
437dea3101eS 
438dea3101eS 	uint8_t word0Reserved2;	/* FC Word 0, bit 16:23 */
439dea3101eS 
440dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
441dea3101eS 	uint8_t iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
442dea3101eS 	uint8_t iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
443dea3101eS 	uint8_t iCtlAck0capable:1;	/* FC Word 0, bit 11 */
444dea3101eS 	uint8_t iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
445dea3101eS 	uint8_t word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
446dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
447dea3101eS 	uint8_t word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
448dea3101eS 	uint8_t iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
449dea3101eS 	uint8_t iCtlAck0capable:1;	/* FC Word 0, bit 11 */
450dea3101eS 	uint8_t iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
451dea3101eS 	uint8_t iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
452dea3101eS #endif
453dea3101eS 
454dea3101eS 	uint8_t word0Reserved4;	/* FC Word 0, bit  0: 7 */
455dea3101eS 
456dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
457dea3101eS 	uint8_t rCtlAck0capable:1;	/* FC Word 1, bit 31 */
458dea3101eS 	uint8_t rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
459dea3101eS 	uint8_t rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
460dea3101eS 	uint8_t rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
461dea3101eS 	uint8_t word1Reserved1:1;	/* FC Word 1, bit 26 */
462dea3101eS 	uint8_t rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
463dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
464dea3101eS 	uint8_t rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
465dea3101eS 	uint8_t word1Reserved1:1;	/* FC Word 1, bit 26 */
466dea3101eS 	uint8_t rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
467dea3101eS 	uint8_t rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
468dea3101eS 	uint8_t rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
469dea3101eS 	uint8_t rCtlAck0capable:1;	/* FC Word 1, bit 31 */
470dea3101eS #endif
471dea3101eS 
472dea3101eS 	uint8_t word1Reserved2;	/* FC Word 1, bit 16:23 */
473dea3101eS 	uint8_t rcvDataSizeMsb;	/* FC Word 1, bit  8:15 */
474dea3101eS 	uint8_t rcvDataSizeLsb;	/* FC Word 1, bit  0: 7 */
475dea3101eS 
476dea3101eS 	uint8_t concurrentSeqMsb;	/* FC Word 2, bit 24:31 */
477dea3101eS 	uint8_t concurrentSeqLsb;	/* FC Word 2, bit 16:23 */
478dea3101eS 	uint8_t EeCreditSeqMsb;	/* FC Word 2, bit  8:15 */
479dea3101eS 	uint8_t EeCreditSeqLsb;	/* FC Word 2, bit  0: 7 */
480dea3101eS 
481dea3101eS 	uint8_t openSeqPerXchgMsb;	/* FC Word 3, bit 24:31 */
482dea3101eS 	uint8_t openSeqPerXchgLsb;	/* FC Word 3, bit 16:23 */
483dea3101eS 	uint8_t word3Reserved1;	/* Fc Word 3, bit  8:15 */
484dea3101eS 	uint8_t word3Reserved2;	/* Fc Word 3, bit  0: 7 */
485dea3101eS };
486dea3101eS 
487dea3101eS struct serv_parm {	/* Structure is in Big Endian format */
488dea3101eS 	struct csp cmn;
489dea3101eS 	struct lpfc_name portName;
490dea3101eS 	struct lpfc_name nodeName;
491dea3101eS 	struct class_parms cls1;
492dea3101eS 	struct class_parms cls2;
493dea3101eS 	struct class_parms cls3;
494dea3101eS 	struct class_parms cls4;
495dea3101eS 	uint8_t vendorVersion[16];
496dea3101eS };
497dea3101eS 
498dea3101eS /*
499da0436e9SJames Smart  * Virtual Fabric Tagging Header
500da0436e9SJames Smart  */
501da0436e9SJames Smart struct fc_vft_header {
502da0436e9SJames Smart 	 uint32_t word0;
503da0436e9SJames Smart #define fc_vft_hdr_r_ctl_SHIFT		24
504da0436e9SJames Smart #define fc_vft_hdr_r_ctl_MASK		0xFF
505da0436e9SJames Smart #define fc_vft_hdr_r_ctl_WORD		word0
506da0436e9SJames Smart #define fc_vft_hdr_ver_SHIFT		22
507da0436e9SJames Smart #define fc_vft_hdr_ver_MASK		0x3
508da0436e9SJames Smart #define fc_vft_hdr_ver_WORD		word0
509da0436e9SJames Smart #define fc_vft_hdr_type_SHIFT		18
510da0436e9SJames Smart #define fc_vft_hdr_type_MASK		0xF
511da0436e9SJames Smart #define fc_vft_hdr_type_WORD		word0
512da0436e9SJames Smart #define fc_vft_hdr_e_SHIFT		16
513da0436e9SJames Smart #define fc_vft_hdr_e_MASK		0x1
514da0436e9SJames Smart #define fc_vft_hdr_e_WORD		word0
515da0436e9SJames Smart #define fc_vft_hdr_priority_SHIFT	13
516da0436e9SJames Smart #define fc_vft_hdr_priority_MASK	0x7
517da0436e9SJames Smart #define fc_vft_hdr_priority_WORD	word0
518da0436e9SJames Smart #define fc_vft_hdr_vf_id_SHIFT		1
519da0436e9SJames Smart #define fc_vft_hdr_vf_id_MASK		0xFFF
520da0436e9SJames Smart #define fc_vft_hdr_vf_id_WORD		word0
521da0436e9SJames Smart 	uint32_t word1;
522da0436e9SJames Smart #define fc_vft_hdr_hopct_SHIFT		24
523da0436e9SJames Smart #define fc_vft_hdr_hopct_MASK		0xFF
524da0436e9SJames Smart #define fc_vft_hdr_hopct_WORD		word1
525da0436e9SJames Smart };
526da0436e9SJames Smart 
527da0436e9SJames Smart /*
528dea3101eS  *  Extended Link Service LS_COMMAND codes (Payload Word 0)
529dea3101eS  */
530dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
531dea3101eS #define ELS_CMD_MASK      0xffff0000
532dea3101eS #define ELS_RSP_MASK      0xff000000
533dea3101eS #define ELS_CMD_LS_RJT    0x01000000
534dea3101eS #define ELS_CMD_ACC       0x02000000
535dea3101eS #define ELS_CMD_PLOGI     0x03000000
536dea3101eS #define ELS_CMD_FLOGI     0x04000000
537dea3101eS #define ELS_CMD_LOGO      0x05000000
538dea3101eS #define ELS_CMD_ABTX      0x06000000
539dea3101eS #define ELS_CMD_RCS       0x07000000
540dea3101eS #define ELS_CMD_RES       0x08000000
541dea3101eS #define ELS_CMD_RSS       0x09000000
542dea3101eS #define ELS_CMD_RSI       0x0A000000
543dea3101eS #define ELS_CMD_ESTS      0x0B000000
544dea3101eS #define ELS_CMD_ESTC      0x0C000000
545dea3101eS #define ELS_CMD_ADVC      0x0D000000
546dea3101eS #define ELS_CMD_RTV       0x0E000000
547dea3101eS #define ELS_CMD_RLS       0x0F000000
548dea3101eS #define ELS_CMD_ECHO      0x10000000
549dea3101eS #define ELS_CMD_TEST      0x11000000
550dea3101eS #define ELS_CMD_RRQ       0x12000000
551303f2f9cSJames Smart #define ELS_CMD_REC       0x13000000
55286478875SJames Smart #define ELS_CMD_RDP       0x18000000
553dea3101eS #define ELS_CMD_PRLI      0x20100014
554dea3101eS #define ELS_CMD_PRLO      0x21100014
55582d9a2a2SJames Smart #define ELS_CMD_PRLO_ACC  0x02100014
556dea3101eS #define ELS_CMD_PDISC     0x50000000
557dea3101eS #define ELS_CMD_FDISC     0x51000000
558dea3101eS #define ELS_CMD_ADISC     0x52000000
559dea3101eS #define ELS_CMD_FARP      0x54000000
560dea3101eS #define ELS_CMD_FARPR     0x55000000
5617bb3b137SJamie Wellnitz #define ELS_CMD_RPS       0x56000000
5627bb3b137SJamie Wellnitz #define ELS_CMD_RPL       0x57000000
563dea3101eS #define ELS_CMD_FAN       0x60000000
564dea3101eS #define ELS_CMD_RSCN      0x61040000
565dea3101eS #define ELS_CMD_SCR       0x62000000
566dea3101eS #define ELS_CMD_RNID      0x78000000
5677bb3b137SJamie Wellnitz #define ELS_CMD_LIRR      0x7A000000
5688b017a30SJames Smart #define ELS_CMD_LCB	  0x81000000
569dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
570dea3101eS #define ELS_CMD_MASK      0xffff
571dea3101eS #define ELS_RSP_MASK      0xff
572dea3101eS #define ELS_CMD_LS_RJT    0x01
573dea3101eS #define ELS_CMD_ACC       0x02
574dea3101eS #define ELS_CMD_PLOGI     0x03
575dea3101eS #define ELS_CMD_FLOGI     0x04
576dea3101eS #define ELS_CMD_LOGO      0x05
577dea3101eS #define ELS_CMD_ABTX      0x06
578dea3101eS #define ELS_CMD_RCS       0x07
579dea3101eS #define ELS_CMD_RES       0x08
580dea3101eS #define ELS_CMD_RSS       0x09
581dea3101eS #define ELS_CMD_RSI       0x0A
582dea3101eS #define ELS_CMD_ESTS      0x0B
583dea3101eS #define ELS_CMD_ESTC      0x0C
584dea3101eS #define ELS_CMD_ADVC      0x0D
585dea3101eS #define ELS_CMD_RTV       0x0E
586dea3101eS #define ELS_CMD_RLS       0x0F
587dea3101eS #define ELS_CMD_ECHO      0x10
588dea3101eS #define ELS_CMD_TEST      0x11
589dea3101eS #define ELS_CMD_RRQ       0x12
590303f2f9cSJames Smart #define ELS_CMD_REC       0x13
59186478875SJames Smart #define ELS_CMD_RDP	  0x18
592dea3101eS #define ELS_CMD_PRLI      0x14001020
593dea3101eS #define ELS_CMD_PRLO      0x14001021
59482d9a2a2SJames Smart #define ELS_CMD_PRLO_ACC  0x14001002
595dea3101eS #define ELS_CMD_PDISC     0x50
596dea3101eS #define ELS_CMD_FDISC     0x51
597dea3101eS #define ELS_CMD_ADISC     0x52
598dea3101eS #define ELS_CMD_FARP      0x54
599dea3101eS #define ELS_CMD_FARPR     0x55
6007bb3b137SJamie Wellnitz #define ELS_CMD_RPS       0x56
6017bb3b137SJamie Wellnitz #define ELS_CMD_RPL       0x57
602dea3101eS #define ELS_CMD_FAN       0x60
603dea3101eS #define ELS_CMD_RSCN      0x0461
604dea3101eS #define ELS_CMD_SCR       0x62
605dea3101eS #define ELS_CMD_RNID      0x78
6067bb3b137SJamie Wellnitz #define ELS_CMD_LIRR      0x7A
6078b017a30SJames Smart #define ELS_CMD_LCB	  0x81
608dea3101eS #endif
609dea3101eS 
610dea3101eS /*
611dea3101eS  *  LS_RJT Payload Definition
612dea3101eS  */
613dea3101eS 
614dea3101eS struct ls_rjt {	/* Structure is in Big Endian format */
615dea3101eS 	union {
616dea3101eS 		uint32_t lsRjtError;
617dea3101eS 		struct {
618dea3101eS 			uint8_t lsRjtRsvd0;	/* FC Word 0, bit 24:31 */
619dea3101eS 
620dea3101eS 			uint8_t lsRjtRsnCode;	/* FC Word 0, bit 16:23 */
621dea3101eS 			/* LS_RJT reason codes */
622dea3101eS #define LSRJT_INVALID_CMD     0x01
623dea3101eS #define LSRJT_LOGICAL_ERR     0x03
624dea3101eS #define LSRJT_LOGICAL_BSY     0x05
625dea3101eS #define LSRJT_PROTOCOL_ERR    0x07
626dea3101eS #define LSRJT_UNABLE_TPC      0x09	/* Unable to perform command */
627dea3101eS #define LSRJT_CMD_UNSUPPORTED 0x0B
628dea3101eS #define LSRJT_VENDOR_UNIQUE   0xFF	/* See Byte 3 */
629dea3101eS 
630dea3101eS 			uint8_t lsRjtRsnCodeExp; /* FC Word 0, bit 8:15 */
631dea3101eS 			/* LS_RJT reason explanation */
632dea3101eS #define LSEXP_NOTHING_MORE      0x00
633dea3101eS #define LSEXP_SPARM_OPTIONS     0x01
634dea3101eS #define LSEXP_SPARM_ICTL        0x03
635dea3101eS #define LSEXP_SPARM_RCTL        0x05
636dea3101eS #define LSEXP_SPARM_RCV_SIZE    0x07
637dea3101eS #define LSEXP_SPARM_CONCUR_SEQ  0x09
638dea3101eS #define LSEXP_SPARM_CREDIT      0x0B
639dea3101eS #define LSEXP_INVALID_PNAME     0x0D
640dea3101eS #define LSEXP_INVALID_NNAME     0x0E
641dea3101eS #define LSEXP_INVALID_CSP       0x0F
642dea3101eS #define LSEXP_INVALID_ASSOC_HDR 0x11
643dea3101eS #define LSEXP_ASSOC_HDR_REQ     0x13
644dea3101eS #define LSEXP_INVALID_O_SID     0x15
645dea3101eS #define LSEXP_INVALID_OX_RX     0x17
646dea3101eS #define LSEXP_CMD_IN_PROGRESS   0x19
6477f5f3d0dSJames Smart #define LSEXP_PORT_LOGIN_REQ    0x1E
648dea3101eS #define LSEXP_INVALID_NPORT_ID  0x1F
649dea3101eS #define LSEXP_INVALID_SEQ_ID    0x21
650dea3101eS #define LSEXP_INVALID_XCHG      0x23
651dea3101eS #define LSEXP_INACTIVE_XCHG     0x25
652dea3101eS #define LSEXP_RQ_REQUIRED       0x27
653dea3101eS #define LSEXP_OUT_OF_RESOURCE   0x29
654dea3101eS #define LSEXP_CANT_GIVE_DATA    0x2A
655dea3101eS #define LSEXP_REQ_UNSUPPORTED   0x2C
656dea3101eS 			uint8_t vendorUnique;	/* FC Word 0, bit  0: 7 */
657dea3101eS 		} b;
658dea3101eS 	} un;
659dea3101eS };
660dea3101eS 
661dea3101eS /*
662dea3101eS  *  N_Port Login (FLOGO/PLOGO Request) Payload Definition
663dea3101eS  */
664dea3101eS 
665dea3101eS typedef struct _LOGO {		/* Structure is in Big Endian format */
666dea3101eS 	union {
667dea3101eS 		uint32_t nPortId32;	/* Access nPortId as a word */
668dea3101eS 		struct {
669dea3101eS 			uint8_t word1Reserved1;	/* FC Word 1, bit 31:24 */
670dea3101eS 			uint8_t nPortIdByte0;	/* N_port  ID bit 16:23 */
671dea3101eS 			uint8_t nPortIdByte1;	/* N_port  ID bit  8:15 */
672dea3101eS 			uint8_t nPortIdByte2;	/* N_port  ID bit  0: 7 */
673dea3101eS 		} b;
674dea3101eS 	} un;
675dea3101eS 	struct lpfc_name portName;	/* N_port name field */
676dea3101eS } LOGO;
677dea3101eS 
678dea3101eS /*
679dea3101eS  *  FCP Login (PRLI Request / ACC) Payload Definition
680dea3101eS  */
681dea3101eS 
682dea3101eS #define PRLX_PAGE_LEN   0x10
683dea3101eS #define TPRLO_PAGE_LEN  0x14
684dea3101eS 
685dea3101eS typedef struct _PRLI {		/* Structure is in Big Endian format */
686dea3101eS 	uint8_t prliType;	/* FC Parm Word 0, bit 24:31 */
687dea3101eS 
688dea3101eS #define PRLI_FCP_TYPE 0x08
689dea3101eS 	uint8_t word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
690dea3101eS 
691dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
692dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
693dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
694dea3101eS 	uint8_t estabImagePair:1;	/* FC Parm Word 0, bit 13 */
695dea3101eS 
696dea3101eS 	/*    ACC = imagePairEstablished */
697dea3101eS 	uint8_t word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
698dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
699dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
700dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
701dea3101eS 	uint8_t word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
702dea3101eS 	uint8_t estabImagePair:1;	/* FC Parm Word 0, bit 13 */
703dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
704dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
705dea3101eS 	/*    ACC = imagePairEstablished */
706dea3101eS #endif
707dea3101eS 
708dea3101eS #define PRLI_REQ_EXECUTED     0x1	/* acceptRspCode */
709dea3101eS #define PRLI_NO_RESOURCES     0x2
710dea3101eS #define PRLI_INIT_INCOMPLETE  0x3
711dea3101eS #define PRLI_NO_SUCH_PA       0x4
712dea3101eS #define PRLI_PREDEF_CONFIG    0x5
713dea3101eS #define PRLI_PARTIAL_SUCCESS  0x6
714dea3101eS #define PRLI_INVALID_PAGE_CNT 0x7
715dea3101eS 	uint8_t word0Reserved3;	/* FC Parm Word 0, bit 0:7 */
716dea3101eS 
717dea3101eS 	uint32_t origProcAssoc;	/* FC Parm Word 1, bit 0:31 */
718dea3101eS 
719dea3101eS 	uint32_t respProcAssoc;	/* FC Parm Word 2, bit 0:31 */
720dea3101eS 
721dea3101eS 	uint8_t word3Reserved1;	/* FC Parm Word 3, bit 24:31 */
722dea3101eS 	uint8_t word3Reserved2;	/* FC Parm Word 3, bit 16:23 */
723dea3101eS 
724dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
725dea3101eS 	uint16_t Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
726dea3101eS 	uint16_t Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
727dea3101eS 	uint16_t Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
728dea3101eS 	uint16_t Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
729dea3101eS 	uint16_t Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
730dea3101eS 	uint16_t Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
731dea3101eS 	uint16_t TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
732dea3101eS 	uint16_t Retry:1;	/* FC Parm Word 3, bit  8 */
733dea3101eS 	uint16_t ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
734dea3101eS 	uint16_t dataOverLay:1;	/* FC Parm Word 3, bit  6 */
735dea3101eS 	uint16_t initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
736dea3101eS 	uint16_t targetFunc:1;	/* FC Parm Word 3, bit  4 */
737dea3101eS 	uint16_t cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
738dea3101eS 	uint16_t dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
739dea3101eS 	uint16_t readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
740dea3101eS 	uint16_t writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
741dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
742dea3101eS 	uint16_t Retry:1;	/* FC Parm Word 3, bit  8 */
743dea3101eS 	uint16_t TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
744dea3101eS 	uint16_t Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
745dea3101eS 	uint16_t Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
746dea3101eS 	uint16_t Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
747dea3101eS 	uint16_t Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
748dea3101eS 	uint16_t Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
749dea3101eS 	uint16_t Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
750dea3101eS 	uint16_t writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
751dea3101eS 	uint16_t readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
752dea3101eS 	uint16_t dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
753dea3101eS 	uint16_t cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
754dea3101eS 	uint16_t targetFunc:1;	/* FC Parm Word 3, bit  4 */
755dea3101eS 	uint16_t initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
756dea3101eS 	uint16_t dataOverLay:1;	/* FC Parm Word 3, bit  6 */
757dea3101eS 	uint16_t ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
758dea3101eS #endif
759dea3101eS } PRLI;
760dea3101eS 
761dea3101eS /*
762dea3101eS  *  FCP Logout (PRLO Request / ACC) Payload Definition
763dea3101eS  */
764dea3101eS 
765dea3101eS typedef struct _PRLO {		/* Structure is in Big Endian format */
766dea3101eS 	uint8_t prloType;	/* FC Parm Word 0, bit 24:31 */
767dea3101eS 
768dea3101eS #define PRLO_FCP_TYPE  0x08
769dea3101eS 	uint8_t word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
770dea3101eS 
771dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
772dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
773dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
774dea3101eS 	uint8_t word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
775dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
776dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
777dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
778dea3101eS 	uint8_t word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
779dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
780dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
781dea3101eS #endif
782dea3101eS 
783dea3101eS #define PRLO_REQ_EXECUTED     0x1	/* acceptRspCode */
784dea3101eS #define PRLO_NO_SUCH_IMAGE    0x4
785dea3101eS #define PRLO_INVALID_PAGE_CNT 0x7
786dea3101eS 
787dea3101eS 	uint8_t word0Reserved3;	/* FC Parm Word 0, bit 0:7 */
788dea3101eS 
789dea3101eS 	uint32_t origProcAssoc;	/* FC Parm Word 1, bit 0:31 */
790dea3101eS 
791dea3101eS 	uint32_t respProcAssoc;	/* FC Parm Word 2, bit 0:31 */
792dea3101eS 
793dea3101eS 	uint32_t word3Reserved1;	/* FC Parm Word 3, bit 0:31 */
794dea3101eS } PRLO;
795dea3101eS 
796dea3101eS typedef struct _ADISC {		/* Structure is in Big Endian format */
797dea3101eS 	uint32_t hardAL_PA;
798dea3101eS 	struct lpfc_name portName;
799dea3101eS 	struct lpfc_name nodeName;
800dea3101eS 	uint32_t DID;
801dea3101eS } ADISC;
802dea3101eS 
803dea3101eS typedef struct _FARP {		/* Structure is in Big Endian format */
804dea3101eS 	uint32_t Mflags:8;
805dea3101eS 	uint32_t Odid:24;
806dea3101eS #define FARP_NO_ACTION          0	/* FARP information enclosed, no
807dea3101eS 					   action */
808dea3101eS #define FARP_MATCH_PORT         0x1	/* Match on Responder Port Name */
809dea3101eS #define FARP_MATCH_NODE         0x2	/* Match on Responder Node Name */
810dea3101eS #define FARP_MATCH_IP           0x4	/* Match on IP address, not supported */
811dea3101eS #define FARP_MATCH_IPV4         0x5	/* Match on IPV4 address, not
812dea3101eS 					   supported */
813dea3101eS #define FARP_MATCH_IPV6         0x6	/* Match on IPV6 address, not
814dea3101eS 					   supported */
815dea3101eS 	uint32_t Rflags:8;
816dea3101eS 	uint32_t Rdid:24;
817dea3101eS #define FARP_REQUEST_PLOGI      0x1	/* Request for PLOGI */
818dea3101eS #define FARP_REQUEST_FARPR      0x2	/* Request for FARP Response */
819dea3101eS 	struct lpfc_name OportName;
820dea3101eS 	struct lpfc_name OnodeName;
821dea3101eS 	struct lpfc_name RportName;
822dea3101eS 	struct lpfc_name RnodeName;
823dea3101eS 	uint8_t Oipaddr[16];
824dea3101eS 	uint8_t Ripaddr[16];
825dea3101eS } FARP;
826dea3101eS 
827dea3101eS typedef struct _FAN {		/* Structure is in Big Endian format */
828dea3101eS 	uint32_t Fdid;
829dea3101eS 	struct lpfc_name FportName;
830dea3101eS 	struct lpfc_name FnodeName;
831dea3101eS } FAN;
832dea3101eS 
833dea3101eS typedef struct _SCR {		/* Structure is in Big Endian format */
834dea3101eS 	uint8_t resvd1;
835dea3101eS 	uint8_t resvd2;
836dea3101eS 	uint8_t resvd3;
837dea3101eS 	uint8_t Function;
838dea3101eS #define  SCR_FUNC_FABRIC     0x01
839dea3101eS #define  SCR_FUNC_NPORT      0x02
840dea3101eS #define  SCR_FUNC_FULL       0x03
841dea3101eS #define  SCR_CLEAR           0xff
842dea3101eS } SCR;
843dea3101eS 
844dea3101eS typedef struct _RNID_TOP_DISC {
845dea3101eS 	struct lpfc_name portName;
846dea3101eS 	uint8_t resvd[8];
847dea3101eS 	uint32_t unitType;
848dea3101eS #define RNID_HBA            0x7
849dea3101eS #define RNID_HOST           0xa
850dea3101eS #define RNID_DRIVER         0xd
851dea3101eS 	uint32_t physPort;
852dea3101eS 	uint32_t attachedNodes;
853dea3101eS 	uint16_t ipVersion;
854dea3101eS #define RNID_IPV4           0x1
855dea3101eS #define RNID_IPV6           0x2
856dea3101eS 	uint16_t UDPport;
857dea3101eS 	uint8_t ipAddr[16];
858dea3101eS 	uint16_t resvd1;
859dea3101eS 	uint16_t flags;
860dea3101eS #define RNID_TD_SUPPORT     0x1
861dea3101eS #define RNID_LP_VALID       0x2
862dea3101eS } RNID_TOP_DISC;
863dea3101eS 
864dea3101eS typedef struct _RNID {		/* Structure is in Big Endian format */
865dea3101eS 	uint8_t Format;
866dea3101eS #define RNID_TOPOLOGY_DISC  0xdf
867dea3101eS 	uint8_t CommonLen;
868dea3101eS 	uint8_t resvd1;
869dea3101eS 	uint8_t SpecificLen;
870dea3101eS 	struct lpfc_name portName;
871dea3101eS 	struct lpfc_name nodeName;
872dea3101eS 	union {
873dea3101eS 		RNID_TOP_DISC topologyDisc;	/* topology disc (0xdf) */
874dea3101eS 	} un;
875dea3101eS } RNID;
876dea3101eS 
8777bb3b137SJamie Wellnitz typedef struct  _RPS {		/* Structure is in Big Endian format */
8787bb3b137SJamie Wellnitz 	union {
8797bb3b137SJamie Wellnitz 		uint32_t portNum;
8807bb3b137SJamie Wellnitz 		struct lpfc_name portName;
8817bb3b137SJamie Wellnitz 	} un;
8827bb3b137SJamie Wellnitz } RPS;
8837bb3b137SJamie Wellnitz 
8847bb3b137SJamie Wellnitz typedef struct  _RPS_RSP {	/* Structure is in Big Endian format */
8857bb3b137SJamie Wellnitz 	uint16_t rsvd1;
8867bb3b137SJamie Wellnitz 	uint16_t portStatus;
8877bb3b137SJamie Wellnitz 	uint32_t linkFailureCnt;
8887bb3b137SJamie Wellnitz 	uint32_t lossSyncCnt;
8897bb3b137SJamie Wellnitz 	uint32_t lossSignalCnt;
8907bb3b137SJamie Wellnitz 	uint32_t primSeqErrCnt;
8917bb3b137SJamie Wellnitz 	uint32_t invalidXmitWord;
8927bb3b137SJamie Wellnitz 	uint32_t crcCnt;
8937bb3b137SJamie Wellnitz } RPS_RSP;
8947bb3b137SJamie Wellnitz 
89512265f68SJames Smart struct RLS {			/* Structure is in Big Endian format */
89612265f68SJames Smart 	uint32_t rls;
89712265f68SJames Smart #define rls_rsvd_SHIFT		24
89812265f68SJames Smart #define rls_rsvd_MASK		0x000000ff
89912265f68SJames Smart #define rls_rsvd_WORD		rls
90012265f68SJames Smart #define rls_did_SHIFT		0
90112265f68SJames Smart #define rls_did_MASK		0x00ffffff
90212265f68SJames Smart #define rls_did_WORD		rls
90312265f68SJames Smart };
90412265f68SJames Smart 
90512265f68SJames Smart struct  RLS_RSP {		/* Structure is in Big Endian format */
90612265f68SJames Smart 	uint32_t linkFailureCnt;
90712265f68SJames Smart 	uint32_t lossSyncCnt;
90812265f68SJames Smart 	uint32_t lossSignalCnt;
90912265f68SJames Smart 	uint32_t primSeqErrCnt;
91012265f68SJames Smart 	uint32_t invalidXmitWord;
91112265f68SJames Smart 	uint32_t crcCnt;
91212265f68SJames Smart };
91312265f68SJames Smart 
91419ca7609SJames Smart struct RRQ {			/* Structure is in Big Endian format */
91519ca7609SJames Smart 	uint32_t rrq;
91619ca7609SJames Smart #define rrq_rsvd_SHIFT		24
91719ca7609SJames Smart #define rrq_rsvd_MASK		0x000000ff
91819ca7609SJames Smart #define rrq_rsvd_WORD		rrq
91919ca7609SJames Smart #define rrq_did_SHIFT		0
92019ca7609SJames Smart #define rrq_did_MASK		0x00ffffff
92119ca7609SJames Smart #define rrq_did_WORD		rrq
92219ca7609SJames Smart 	uint32_t rrq_exchg;
92319ca7609SJames Smart #define rrq_oxid_SHIFT		16
92419ca7609SJames Smart #define rrq_oxid_MASK		0xffff
92519ca7609SJames Smart #define rrq_oxid_WORD		rrq_exchg
92619ca7609SJames Smart #define rrq_rxid_SHIFT		0
92719ca7609SJames Smart #define rrq_rxid_MASK		0xffff
92819ca7609SJames Smart #define rrq_rxid_WORD		rrq_exchg
92919ca7609SJames Smart };
93019ca7609SJames Smart 
931912e3acdSJames Smart #define LPFC_MAX_VFN_PER_PFN	255 /* Maximum VFs allowed per ARI */
932912e3acdSJames Smart #define LPFC_DEF_VFN_PER_PFN	0   /* Default VFs due to platform limitation*/
93319ca7609SJames Smart 
93412265f68SJames Smart struct RTV_RSP {		/* Structure is in Big Endian format */
93512265f68SJames Smart 	uint32_t ratov;
93612265f68SJames Smart 	uint32_t edtov;
93712265f68SJames Smart 	uint32_t qtov;
93812265f68SJames Smart #define qtov_rsvd0_SHIFT	28
93912265f68SJames Smart #define qtov_rsvd0_MASK		0x0000000f
94012265f68SJames Smart #define qtov_rsvd0_WORD		qtov		/* reserved */
94112265f68SJames Smart #define qtov_edtovres_SHIFT	27
94212265f68SJames Smart #define qtov_edtovres_MASK	0x00000001
94312265f68SJames Smart #define qtov_edtovres_WORD	qtov		/* E_D_TOV Resolution */
94412265f68SJames Smart #define qtov__rsvd1_SHIFT	19
94512265f68SJames Smart #define qtov_rsvd1_MASK		0x0000003f
94612265f68SJames Smart #define qtov_rsvd1_WORD		qtov		/* reserved */
94712265f68SJames Smart #define qtov_rttov_SHIFT	18
94812265f68SJames Smart #define qtov_rttov_MASK		0x00000001
94912265f68SJames Smart #define qtov_rttov_WORD		qtov		/* R_T_TOV value */
95012265f68SJames Smart #define qtov_rsvd2_SHIFT	0
95112265f68SJames Smart #define qtov_rsvd2_MASK		0x0003ffff
95212265f68SJames Smart #define qtov_rsvd2_WORD		qtov		/* reserved */
95312265f68SJames Smart };
95412265f68SJames Smart 
95512265f68SJames Smart 
9567bb3b137SJamie Wellnitz typedef struct  _RPL {		/* Structure is in Big Endian format */
9577bb3b137SJamie Wellnitz 	uint32_t maxsize;
9587bb3b137SJamie Wellnitz 	uint32_t index;
9597bb3b137SJamie Wellnitz } RPL;
9607bb3b137SJamie Wellnitz 
9617bb3b137SJamie Wellnitz typedef struct  _PORT_NUM_BLK {
9627bb3b137SJamie Wellnitz 	uint32_t portNum;
9637bb3b137SJamie Wellnitz 	uint32_t portID;
9647bb3b137SJamie Wellnitz 	struct lpfc_name portName;
9657bb3b137SJamie Wellnitz } PORT_NUM_BLK;
9667bb3b137SJamie Wellnitz 
9677bb3b137SJamie Wellnitz typedef struct  _RPL_RSP {	/* Structure is in Big Endian format */
9687bb3b137SJamie Wellnitz 	uint32_t listLen;
9697bb3b137SJamie Wellnitz 	uint32_t index;
9707bb3b137SJamie Wellnitz 	PORT_NUM_BLK port_num_blk;
9717bb3b137SJamie Wellnitz } RPL_RSP;
972dea3101eS 
973dea3101eS /* This is used for RSCN command */
974dea3101eS typedef struct _D_ID {		/* Structure is in Big Endian format */
975dea3101eS 	union {
976dea3101eS 		uint32_t word;
977dea3101eS 		struct {
978dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
979dea3101eS 			uint8_t resv;
980dea3101eS 			uint8_t domain;
981dea3101eS 			uint8_t area;
982dea3101eS 			uint8_t id;
983dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
984dea3101eS 			uint8_t id;
985dea3101eS 			uint8_t area;
986dea3101eS 			uint8_t domain;
987dea3101eS 			uint8_t resv;
988dea3101eS #endif
989dea3101eS 		} b;
990dea3101eS 	} un;
991dea3101eS } D_ID;
992dea3101eS 
993eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_PORT	0x0
994eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_AREA	0x1
995eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_DOMAIN	0x2
996eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_FABRIC	0x3
997eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_MASK	0x3
998eaf15d5bSJames Smart 
999dea3101eS /*
1000dea3101eS  *  Structure to define all ELS Payload types
1001dea3101eS  */
1002dea3101eS 
1003dea3101eS typedef struct _ELS_PKT {	/* Structure is in Big Endian format */
1004dea3101eS 	uint8_t elsCode;	/* FC Word 0, bit 24:31 */
1005dea3101eS 	uint8_t elsByte1;
1006dea3101eS 	uint8_t elsByte2;
1007dea3101eS 	uint8_t elsByte3;
1008dea3101eS 	union {
1009dea3101eS 		struct ls_rjt lsRjt;	/* Payload for LS_RJT ELS response */
1010dea3101eS 		struct serv_parm logi;	/* Payload for PLOGI/FLOGI/PDISC/ACC */
1011dea3101eS 		LOGO logo;	/* Payload for PLOGO/FLOGO/ACC */
1012dea3101eS 		PRLI prli;	/* Payload for PRLI/ACC */
1013dea3101eS 		PRLO prlo;	/* Payload for PRLO/ACC */
1014dea3101eS 		ADISC adisc;	/* Payload for ADISC/ACC */
1015dea3101eS 		FARP farp;	/* Payload for FARP/ACC */
1016dea3101eS 		FAN fan;	/* Payload for FAN */
1017dea3101eS 		SCR scr;	/* Payload for SCR/ACC */
1018dea3101eS 		RNID rnid;	/* Payload for RNID */
1019dea3101eS 		uint8_t pad[128 - 4];	/* Pad out to payload of 128 bytes */
1020dea3101eS 	} un;
1021dea3101eS } ELS_PKT;
1022dea3101eS 
10238b017a30SJames Smart /*
10248b017a30SJames Smart  * Link Cable Beacon (LCB) ELS Frame
10258b017a30SJames Smart  */
10268b017a30SJames Smart 
10278b017a30SJames Smart struct fc_lcb_request_frame {
10288b017a30SJames Smart 	uint32_t      lcb_command;      /* ELS command opcode (0x81)     */
10298b017a30SJames Smart 	uint8_t       lcb_sub_command;/* LCB Payload Word 1, bit 24:31 */
10308b017a30SJames Smart #define LPFC_LCB_ON    0x1
10318b017a30SJames Smart #define LPFC_LCB_OFF   0x2
10328b017a30SJames Smart 	uint8_t       reserved[3];
10338b017a30SJames Smart 
10348b017a30SJames Smart 	uint8_t       lcb_type; /* LCB Payload Word 2, bit 24:31 */
10358b017a30SJames Smart #define LPFC_LCB_GREEN 0x1
10368b017a30SJames Smart #define LPFC_LCB_AMBER 0x2
10378b017a30SJames Smart 	uint8_t       lcb_frequency;    /* LCB Payload Word 2, bit 16:23 */
10388b017a30SJames Smart 	uint16_t      lcb_duration;     /* LCB Payload Word 2, bit 15:0  */
10398b017a30SJames Smart };
10408b017a30SJames Smart 
10418b017a30SJames Smart /*
10428b017a30SJames Smart  * Link Cable Beacon (LCB) ELS Response Frame
10438b017a30SJames Smart  */
10448b017a30SJames Smart struct fc_lcb_res_frame {
10458b017a30SJames Smart 	uint32_t      lcb_ls_acc;       /* Acceptance of LCB request (0x02) */
10468b017a30SJames Smart 	uint8_t       lcb_sub_command;/* LCB Payload Word 1, bit 24:31 */
10478b017a30SJames Smart 	uint8_t       reserved[3];
10488b017a30SJames Smart 	uint8_t       lcb_type; /* LCB Payload Word 2, bit 24:31 */
10498b017a30SJames Smart 	uint8_t       lcb_frequency;    /* LCB Payload Word 2, bit 16:23 */
10508b017a30SJames Smart 	uint16_t      lcb_duration;     /* LCB Payload Word 2, bit 15:0  */
10518b017a30SJames Smart };
10528b017a30SJames Smart 
105386478875SJames Smart /*
105486478875SJames Smart  * Read Diagnostic Parameters (RDP) ELS frame.
105586478875SJames Smart  */
105686478875SJames Smart #define SFF_PG0_IDENT_SFP              0x3
105786478875SJames Smart 
105886478875SJames Smart #define SFP_FLAG_PT_OPTICAL            0x0
105986478875SJames Smart #define SFP_FLAG_PT_SWLASER            0x01
106086478875SJames Smart #define SFP_FLAG_PT_LWLASER_LC1310     0x02
106186478875SJames Smart #define SFP_FLAG_PT_LWLASER_LL1550     0x03
106286478875SJames Smart #define SFP_FLAG_PT_MASK               0x0F
106386478875SJames Smart #define SFP_FLAG_PT_SHIFT              0
106486478875SJames Smart 
106586478875SJames Smart #define SFP_FLAG_IS_OPTICAL_PORT       0x01
106686478875SJames Smart #define SFP_FLAG_IS_OPTICAL_MASK       0x010
106786478875SJames Smart #define SFP_FLAG_IS_OPTICAL_SHIFT      4
106886478875SJames Smart 
106986478875SJames Smart #define SFP_FLAG_IS_DESC_VALID         0x01
107086478875SJames Smart #define SFP_FLAG_IS_DESC_VALID_MASK    0x020
107186478875SJames Smart #define SFP_FLAG_IS_DESC_VALID_SHIFT   5
107286478875SJames Smart 
107386478875SJames Smart #define SFP_FLAG_CT_UNKNOWN            0x0
107486478875SJames Smart #define SFP_FLAG_CT_SFP_PLUS           0x01
107586478875SJames Smart #define SFP_FLAG_CT_MASK               0x3C
107686478875SJames Smart #define SFP_FLAG_CT_SHIFT              6
107786478875SJames Smart 
107886478875SJames Smart struct fc_rdp_port_name_info {
107986478875SJames Smart 	uint8_t wwnn[8];
108086478875SJames Smart 	uint8_t wwpn[8];
108186478875SJames Smart };
108286478875SJames Smart 
108386478875SJames Smart 
108486478875SJames Smart /*
108586478875SJames Smart  * Link Error Status Block Structure (FC-FS-3) for RDP
108686478875SJames Smart  * This similar to RPS ELS
108786478875SJames Smart  */
108886478875SJames Smart struct fc_link_status {
108986478875SJames Smart 	uint32_t      link_failure_cnt;
109086478875SJames Smart 	uint32_t      loss_of_synch_cnt;
109186478875SJames Smart 	uint32_t      loss_of_signal_cnt;
109286478875SJames Smart 	uint32_t      primitive_seq_proto_err;
109386478875SJames Smart 	uint32_t      invalid_trans_word;
109486478875SJames Smart 	uint32_t      invalid_crc_cnt;
109586478875SJames Smart 
109686478875SJames Smart };
109786478875SJames Smart 
109886478875SJames Smart #define RDP_PORT_NAMES_DESC_TAG  0x00010003
109986478875SJames Smart struct fc_rdp_port_name_desc {
110086478875SJames Smart 	uint32_t	tag;     /* 0001 0003h */
110186478875SJames Smart 	uint32_t	length;  /* set to size of payload struct */
110286478875SJames Smart 	struct fc_rdp_port_name_info  port_names;
110386478875SJames Smart };
110486478875SJames Smart 
110586478875SJames Smart 
11064258e98eSJames Smart struct fc_rdp_fec_info {
11074258e98eSJames Smart 	uint32_t CorrectedBlocks;
11084258e98eSJames Smart 	uint32_t UncorrectableBlocks;
11094258e98eSJames Smart };
11104258e98eSJames Smart 
11114258e98eSJames Smart #define RDP_FEC_DESC_TAG  0x00010005
11124258e98eSJames Smart struct fc_fec_rdp_desc {
11134258e98eSJames Smart 	uint32_t tag;
11144258e98eSJames Smart 	uint32_t length;
11154258e98eSJames Smart 	struct fc_rdp_fec_info info;
11164258e98eSJames Smart };
11174258e98eSJames Smart 
111886478875SJames Smart struct fc_rdp_link_error_status_payload_info {
111986478875SJames Smart 	struct fc_link_status link_status; /* 24 bytes */
112086478875SJames Smart 	uint32_t  port_type;             /* bits 31-30 only */
112186478875SJames Smart };
112286478875SJames Smart 
112386478875SJames Smart #define RDP_LINK_ERROR_STATUS_DESC_TAG  0x00010002
112486478875SJames Smart struct fc_rdp_link_error_status_desc {
112586478875SJames Smart 	uint32_t         tag;     /* 0001 0002h */
112686478875SJames Smart 	uint32_t         length;  /* set to size of payload struct */
112786478875SJames Smart 	struct fc_rdp_link_error_status_payload_info info;
112886478875SJames Smart };
112986478875SJames Smart 
113086478875SJames Smart #define VN_PT_PHY_UNKNOWN      0x00
113186478875SJames Smart #define VN_PT_PHY_PF_PORT      0x01
113286478875SJames Smart #define VN_PT_PHY_ETH_MAC      0x10
113386478875SJames Smart #define VN_PT_PHY_SHIFT                30
113486478875SJames Smart 
113586478875SJames Smart #define RDP_PS_1GB             0x8000
113686478875SJames Smart #define RDP_PS_2GB             0x4000
113786478875SJames Smart #define RDP_PS_4GB             0x2000
113886478875SJames Smart #define RDP_PS_10GB            0x1000
113986478875SJames Smart #define RDP_PS_8GB             0x0800
114086478875SJames Smart #define RDP_PS_16GB            0x0400
114186478875SJames Smart #define RDP_PS_32GB            0x0200
114286478875SJames Smart 
114356204984SJames Smart #define RDP_CAP_USER_CONFIGURED 0x0002
114486478875SJames Smart #define RDP_CAP_UNKNOWN         0x0001
114586478875SJames Smart #define RDP_PS_UNKNOWN          0x0002
114686478875SJames Smart #define RDP_PS_NOT_ESTABLISHED  0x0001
114786478875SJames Smart 
114886478875SJames Smart struct fc_rdp_port_speed {
114986478875SJames Smart 	uint16_t   capabilities;
115086478875SJames Smart 	uint16_t   speed;
115186478875SJames Smart };
115286478875SJames Smart 
115386478875SJames Smart struct fc_rdp_port_speed_info {
115486478875SJames Smart 	struct fc_rdp_port_speed   port_speed;
115586478875SJames Smart };
115686478875SJames Smart 
115786478875SJames Smart #define RDP_PORT_SPEED_DESC_TAG  0x00010001
115886478875SJames Smart struct fc_rdp_port_speed_desc {
115986478875SJames Smart 	uint32_t         tag;            /* 00010001h */
116086478875SJames Smart 	uint32_t         length;         /* set to size of payload struct */
116186478875SJames Smart 	struct fc_rdp_port_speed_info info;
116286478875SJames Smart };
116386478875SJames Smart 
116486478875SJames Smart #define RDP_NPORT_ID_SIZE      4
116586478875SJames Smart #define RDP_N_PORT_DESC_TAG    0x00000003
116686478875SJames Smart struct fc_rdp_nport_desc {
116786478875SJames Smart 	uint32_t         tag;          /* 0000 0003h, big endian */
116886478875SJames Smart 	uint32_t         length;       /* size of RDP_N_PORT_ID struct */
116986478875SJames Smart 	uint32_t         nport_id : 12;
117086478875SJames Smart 	uint32_t         reserved : 8;
117186478875SJames Smart };
117286478875SJames Smart 
117386478875SJames Smart 
117486478875SJames Smart struct fc_rdp_link_service_info {
117586478875SJames Smart 	uint32_t         els_req;    /* Request payload word 0 value.*/
117686478875SJames Smart };
117786478875SJames Smart 
117886478875SJames Smart #define RDP_LINK_SERVICE_DESC_TAG  0x00000001
117986478875SJames Smart struct fc_rdp_link_service_desc {
118086478875SJames Smart 	uint32_t         tag;     /* Descriptor tag  1 */
118186478875SJames Smart 	uint32_t         length;  /* set to size of payload struct. */
118286478875SJames Smart 	struct fc_rdp_link_service_info  payload;
118386478875SJames Smart 				  /* must be ELS req Word 0(0x18) */
118486478875SJames Smart };
118586478875SJames Smart 
118686478875SJames Smart struct fc_rdp_sfp_info {
118786478875SJames Smart 	uint16_t	temperature;
118886478875SJames Smart 	uint16_t	vcc;
118986478875SJames Smart 	uint16_t	tx_bias;
119086478875SJames Smart 	uint16_t	tx_power;
119186478875SJames Smart 	uint16_t	rx_power;
119286478875SJames Smart 	uint16_t	flags;
119386478875SJames Smart };
119486478875SJames Smart 
119586478875SJames Smart #define RDP_SFP_DESC_TAG  0x00010000
119686478875SJames Smart struct fc_rdp_sfp_desc {
119786478875SJames Smart 	uint32_t         tag;
119886478875SJames Smart 	uint32_t         length;  /* set to size of sfp_info struct */
119986478875SJames Smart 	struct fc_rdp_sfp_info sfp_info;
120086478875SJames Smart };
120186478875SJames Smart 
120256204984SJames Smart /* Buffer Credit Descriptor */
120356204984SJames Smart struct fc_rdp_bbc_info {
120456204984SJames Smart 	uint32_t              port_bbc; /* FC_Port buffer-to-buffer credit */
120556204984SJames Smart 	uint32_t              attached_port_bbc;
120656204984SJames Smart 	uint32_t              rtt;      /* Round trip time */
120756204984SJames Smart };
120856204984SJames Smart #define RDP_BBC_DESC_TAG  0x00010006
120956204984SJames Smart struct fc_rdp_bbc_desc {
121056204984SJames Smart 	uint32_t              tag;
121156204984SJames Smart 	uint32_t              length;
121256204984SJames Smart 	struct fc_rdp_bbc_info  bbc_info;
121356204984SJames Smart };
121456204984SJames Smart 
1215310429efSJames Smart /* Optical Element Type Transgression Flags */
1216310429efSJames Smart #define RDP_OET_LOW_WARNING  0x1
1217310429efSJames Smart #define RDP_OET_HIGH_WARNING 0x2
1218310429efSJames Smart #define RDP_OET_LOW_ALARM    0x4
1219310429efSJames Smart #define RDP_OET_HIGH_ALARM   0x8
1220310429efSJames Smart 
122156204984SJames Smart #define RDP_OED_TEMPERATURE  0x1
122256204984SJames Smart #define RDP_OED_VOLTAGE      0x2
122356204984SJames Smart #define RDP_OED_TXBIAS       0x3
122456204984SJames Smart #define RDP_OED_TXPOWER      0x4
122556204984SJames Smart #define RDP_OED_RXPOWER      0x5
122656204984SJames Smart 
122756204984SJames Smart #define RDP_OED_TYPE_SHIFT   28
122856204984SJames Smart /* Optical Element Data descriptor */
122956204984SJames Smart struct fc_rdp_oed_info {
123056204984SJames Smart 	uint16_t            hi_alarm;
123156204984SJames Smart 	uint16_t            lo_alarm;
123256204984SJames Smart 	uint16_t            hi_warning;
123356204984SJames Smart 	uint16_t            lo_warning;
123456204984SJames Smart 	uint32_t            function_flags;
123556204984SJames Smart };
123656204984SJames Smart #define RDP_OED_DESC_TAG  0x00010007
123756204984SJames Smart struct fc_rdp_oed_sfp_desc {
123856204984SJames Smart 	uint32_t             tag;
123956204984SJames Smart 	uint32_t             length;
124056204984SJames Smart 	struct fc_rdp_oed_info oed_info;
124156204984SJames Smart };
124256204984SJames Smart 
124356204984SJames Smart /* Optical Product Data descriptor */
124456204984SJames Smart struct fc_rdp_opd_sfp_info {
124556204984SJames Smart 	uint8_t            vendor_name[16];
124656204984SJames Smart 	uint8_t            model_number[16];
124756204984SJames Smart 	uint8_t            serial_number[16];
124856204984SJames Smart 	uint8_t            revision[2];
12495b1993deSJames Smart 	uint8_t            reserved[2];
125056204984SJames Smart 	uint8_t            date[8];
125156204984SJames Smart };
125256204984SJames Smart 
125356204984SJames Smart #define RDP_OPD_DESC_TAG  0x00010008
125456204984SJames Smart struct fc_rdp_opd_sfp_desc {
125556204984SJames Smart 	uint32_t             tag;
125656204984SJames Smart 	uint32_t             length;
125756204984SJames Smart 	struct fc_rdp_opd_sfp_info opd_info;
125856204984SJames Smart };
125956204984SJames Smart 
126086478875SJames Smart struct fc_rdp_req_frame {
126186478875SJames Smart 	uint32_t         rdp_command;           /* ELS command opcode (0x18)*/
126286478875SJames Smart 	uint32_t         rdp_des_length;        /* RDP Payload Word 1 */
126386478875SJames Smart 	struct fc_rdp_nport_desc nport_id_desc; /* RDP Payload Word 2 - 4 */
126486478875SJames Smart };
126586478875SJames Smart 
126686478875SJames Smart 
126786478875SJames Smart struct fc_rdp_res_frame {
126886478875SJames Smart 	uint32_t	reply_sequence;		/* FC word0 LS_ACC or LS_RJT */
126986478875SJames Smart 	uint32_t	length;			/* FC Word 1      */
127086478875SJames Smart 	struct fc_rdp_link_service_desc link_service_desc;    /* Word 2 -4  */
127186478875SJames Smart 	struct fc_rdp_sfp_desc sfp_desc;                      /* Word 5 -9  */
127286478875SJames Smart 	struct fc_rdp_port_speed_desc portspeed_desc;         /* Word 10-12 */
127386478875SJames Smart 	struct fc_rdp_link_error_status_desc link_error_desc; /* Word 13-21 */
127486478875SJames Smart 	struct fc_rdp_port_name_desc diag_port_names_desc;    /* Word 22-27 */
127586478875SJames Smart 	struct fc_rdp_port_name_desc attached_port_names_desc;/* Word 28-33 */
12766c92d1d0SJames Smart 	struct fc_fec_rdp_desc fec_desc;                      /* FC word 34-37*/
12776c92d1d0SJames Smart 	struct fc_rdp_bbc_desc bbc_desc;                      /* FC Word 38-42*/
12786c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_temp_desc;             /* FC Word 43-47*/
12796c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_voltage_desc;          /* FC word 48-52*/
12806c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_txbias_desc;           /* FC word 53-57*/
12816c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_txpower_desc;          /* FC word 58-62*/
12826c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_rxpower_desc;          /* FC word 63-67*/
12836c92d1d0SJames Smart 	struct fc_rdp_opd_sfp_desc opd_desc;                  /* FC word 68-84*/
128486478875SJames Smart };
128586478875SJames Smart 
128686478875SJames Smart 
128776b2c34aSJames Smart /******** FDMI ********/
128876b2c34aSJames Smart 
128976b2c34aSJames Smart /* lpfc_sli_ct_request defines the CT_IU preamble for FDMI commands */
129076b2c34aSJames Smart #define  SLI_CT_FDMI_Subtypes     0x10	/* Management Service Subtype */
1291dea3101eS 
1292dea3101eS /*
129376b2c34aSJames Smart  * Registered Port List Format
1294dea3101eS  */
129576b2c34aSJames Smart struct lpfc_fdmi_reg_port_list {
129676b2c34aSJames Smart 	uint32_t EntryCnt;
129776b2c34aSJames Smart 	uint32_t pe;		/* Variable-length array */
1298dea3101eS };
1299dea3101eS 
1300dea3101eS 
130176b2c34aSJames Smart /* Definitions for HBA / Port attribute entries */
130276b2c34aSJames Smart 
130376b2c34aSJames Smart struct lpfc_fdmi_attr_def { /* Defined in TLV format */
130476b2c34aSJames Smart 	/* Structure is in Big Endian format */
130576b2c34aSJames Smart 	uint32_t AttrType:16;
130676b2c34aSJames Smart 	uint32_t AttrLen:16;
130776b2c34aSJames Smart 	uint32_t AttrValue;  /* Marks start of Value (ATTRIBUTE_ENTRY) */
130876b2c34aSJames Smart };
130976b2c34aSJames Smart 
131076b2c34aSJames Smart 
131176b2c34aSJames Smart /* Attribute Entry */
131276b2c34aSJames Smart struct lpfc_fdmi_attr_entry {
1313dea3101eS 	union {
13144258e98eSJames Smart 		uint32_t AttrInt;
13154258e98eSJames Smart 		uint8_t  AttrTypes[32];
13164258e98eSJames Smart 		uint8_t  AttrString[256];
13174258e98eSJames Smart 		struct lpfc_name AttrWWN;
1318dea3101eS 	} un;
131976b2c34aSJames Smart };
132076b2c34aSJames Smart 
132176b2c34aSJames Smart #define LPFC_FDMI_MAX_AE_SIZE	sizeof(struct lpfc_fdmi_attr_entry)
1322dea3101eS 
1323dea3101eS /*
1324dea3101eS  * HBA Attribute Block
1325dea3101eS  */
132676b2c34aSJames Smart struct lpfc_fdmi_attr_block {
1327dea3101eS 	uint32_t EntryCnt;		/* Number of HBA attribute entries */
132876b2c34aSJames Smart 	struct lpfc_fdmi_attr_entry Entry;	/* Variable-length array */
132976b2c34aSJames Smart };
1330dea3101eS 
1331dea3101eS /*
1332dea3101eS  * Port Entry
1333dea3101eS  */
133476b2c34aSJames Smart struct lpfc_fdmi_port_entry {
1335dea3101eS 	struct lpfc_name PortName;
133676b2c34aSJames Smart };
1337dea3101eS 
1338dea3101eS /*
1339dea3101eS  * HBA Identifier
1340dea3101eS  */
134176b2c34aSJames Smart struct lpfc_fdmi_hba_ident {
1342dea3101eS 	struct lpfc_name PortName;
134376b2c34aSJames Smart };
1344dea3101eS 
1345dea3101eS /*
1346dea3101eS  * Register HBA(RHBA)
1347dea3101eS  */
134876b2c34aSJames Smart struct lpfc_fdmi_reg_hba {
134976b2c34aSJames Smart 	struct lpfc_fdmi_hba_ident hi;
135076b2c34aSJames Smart 	struct lpfc_fdmi_reg_port_list rpl;	/* variable-length array */
135176b2c34aSJames Smart /* struct lpfc_fdmi_attr_block   ab; */
135276b2c34aSJames Smart };
1353dea3101eS 
1354dea3101eS /*
1355dea3101eS  * Register HBA Attributes (RHAT)
1356dea3101eS  */
135776b2c34aSJames Smart struct lpfc_fdmi_reg_hbaattr {
1358dea3101eS 	struct lpfc_name HBA_PortName;
135976b2c34aSJames Smart 	struct lpfc_fdmi_attr_block ab;
136076b2c34aSJames Smart };
1361dea3101eS 
1362dea3101eS /*
1363dea3101eS  * Register Port Attributes (RPA)
1364dea3101eS  */
136576b2c34aSJames Smart struct lpfc_fdmi_reg_portattr {
1366dea3101eS 	struct lpfc_name PortName;
136776b2c34aSJames Smart 	struct lpfc_fdmi_attr_block ab;
136876b2c34aSJames Smart };
1369dea3101eS 
1370dea3101eS /*
137176b2c34aSJames Smart  * HBA MAnagement Operations Command Codes
1372dea3101eS  */
137376b2c34aSJames Smart #define  SLI_MGMT_GRHL     0x100	/* Get registered HBA list */
137476b2c34aSJames Smart #define  SLI_MGMT_GHAT     0x101	/* Get HBA attributes */
137576b2c34aSJames Smart #define  SLI_MGMT_GRPL     0x102	/* Get registered Port list */
137676b2c34aSJames Smart #define  SLI_MGMT_GPAT     0x110	/* Get Port attributes */
137776b2c34aSJames Smart #define  SLI_MGMT_GPAS     0x120	/* Get Port Statistics */
137876b2c34aSJames Smart #define  SLI_MGMT_RHBA     0x200	/* Register HBA */
137976b2c34aSJames Smart #define  SLI_MGMT_RHAT     0x201	/* Register HBA attributes */
138076b2c34aSJames Smart #define  SLI_MGMT_RPRT     0x210	/* Register Port */
138176b2c34aSJames Smart #define  SLI_MGMT_RPA      0x211	/* Register Port attributes */
138276b2c34aSJames Smart #define  SLI_MGMT_DHBA     0x300	/* De-register HBA */
138376b2c34aSJames Smart #define  SLI_MGMT_DHAT     0x301	/* De-register HBA attributes */
138476b2c34aSJames Smart #define  SLI_MGMT_DPRT     0x310	/* De-register Port */
138576b2c34aSJames Smart #define  SLI_MGMT_DPA      0x311	/* De-register Port attributes */
1386dea3101eS 
13874258e98eSJames Smart #define LPFC_FDMI_MAX_RETRY     3  /* Max retries for a FDMI command */
13884258e98eSJames Smart 
1389dea3101eS /*
139076b2c34aSJames Smart  * HBA Attribute Types
1391dea3101eS  */
139276b2c34aSJames Smart #define  RHBA_NODENAME           0x1 /* 8 byte WWNN */
139376b2c34aSJames Smart #define  RHBA_MANUFACTURER       0x2 /* 4 to 64 byte ASCII string */
139476b2c34aSJames Smart #define  RHBA_SERIAL_NUMBER      0x3 /* 4 to 64 byte ASCII string */
139576b2c34aSJames Smart #define  RHBA_MODEL              0x4 /* 4 to 256 byte ASCII string */
139676b2c34aSJames Smart #define  RHBA_MODEL_DESCRIPTION  0x5 /* 4 to 256 byte ASCII string */
139776b2c34aSJames Smart #define  RHBA_HARDWARE_VERSION   0x6 /* 4 to 256 byte ASCII string */
139876b2c34aSJames Smart #define  RHBA_DRIVER_VERSION     0x7 /* 4 to 256 byte ASCII string */
139976b2c34aSJames Smart #define  RHBA_OPTION_ROM_VERSION 0x8 /* 4 to 256 byte ASCII string */
140076b2c34aSJames Smart #define  RHBA_FIRMWARE_VERSION   0x9 /* 4 to 256 byte ASCII string */
140176b2c34aSJames Smart #define  RHBA_OS_NAME_VERSION	 0xa /* 4 to 256 byte ASCII string */
140276b2c34aSJames Smart #define  RHBA_MAX_CT_PAYLOAD_LEN 0xb /* 32-bit unsigned int */
140376b2c34aSJames Smart #define  RHBA_SYM_NODENAME       0xc /* 4 to 256 byte ASCII string */
14044258e98eSJames Smart #define  RHBA_VENDOR_INFO        0xd  /* 32-bit unsigned int */
14054258e98eSJames Smart #define  RHBA_NUM_PORTS          0xe  /* 32-bit unsigned int */
14064258e98eSJames Smart #define  RHBA_FABRIC_WWNN        0xf  /* 8 byte WWNN */
14074258e98eSJames Smart #define  RHBA_BIOS_VERSION       0x10 /* 4 to 256 byte ASCII string */
14084258e98eSJames Smart #define  RHBA_BIOS_STATE         0x11 /* 32-bit unsigned int */
14094258e98eSJames Smart #define  RHBA_VENDOR_ID          0xe0 /* 8 byte ASCII string */
14104258e98eSJames Smart 
14114258e98eSJames Smart /* Bit mask for all individual HBA attributes */
14124258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_wwnn			0x00000001
14134258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_manufacturer		0x00000002
14144258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_sn			0x00000004
14154258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_model		0x00000008
14164258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_description		0x00000010
14174258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_hdw_ver		0x00000020
14184258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_drvr_ver		0x00000040
14194258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_rom_ver		0x00000080
14204258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_fmw_ver		0x00000100
14214258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_os_ver		0x00000200
14224258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_ct_len		0x00000400
14234258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_symbolic_name	0x00000800
14244258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_vendor_info		0x00001000 /* Not used */
14254258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_num_ports		0x00002000
14264258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_fabric_wwnn		0x00004000
14274258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_bios_ver		0x00008000
14284258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_bios_state		0x00010000 /* Not used */
14294258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_vendor_id		0x00020000
14304258e98eSJames Smart 
14314258e98eSJames Smart /* Bit mask for FDMI-1 defined HBA attributes */
14324258e98eSJames Smart #define LPFC_FDMI1_HBA_ATTR			0x000007ff
14334258e98eSJames Smart 
14344258e98eSJames Smart /* Bit mask for FDMI-2 defined HBA attributes */
14354258e98eSJames Smart /* Skip vendor_info and bios_state */
14364258e98eSJames Smart #define LPFC_FDMI2_HBA_ATTR			0x0002efff
1437dea3101eS 
1438dea3101eS /*
143976b2c34aSJames Smart  * Port Attrubute Types
1440dea3101eS  */
144176b2c34aSJames Smart #define  RPRT_SUPPORTED_FC4_TYPES     0x1 /* 32 byte binary array */
144276b2c34aSJames Smart #define  RPRT_SUPPORTED_SPEED         0x2 /* 32-bit unsigned int */
144376b2c34aSJames Smart #define  RPRT_PORT_SPEED              0x3 /* 32-bit unsigned int */
144476b2c34aSJames Smart #define  RPRT_MAX_FRAME_SIZE          0x4 /* 32-bit unsigned int */
144576b2c34aSJames Smart #define  RPRT_OS_DEVICE_NAME          0x5 /* 4 to 256 byte ASCII string */
144676b2c34aSJames Smart #define  RPRT_HOST_NAME               0x6 /* 4 to 256 byte ASCII string */
144776b2c34aSJames Smart #define  RPRT_NODENAME                0x7 /* 8 byte WWNN */
14484258e98eSJames Smart #define  RPRT_PORTNAME                0x8 /* 8 byte WWPN */
144976b2c34aSJames Smart #define  RPRT_SYM_PORTNAME            0x9 /* 4 to 256 byte ASCII string */
145076b2c34aSJames Smart #define  RPRT_PORT_TYPE               0xa /* 32-bit unsigned int */
145176b2c34aSJames Smart #define  RPRT_SUPPORTED_CLASS         0xb /* 32-bit unsigned int */
14524258e98eSJames Smart #define  RPRT_FABRICNAME              0xc /* 8 byte Fabric WWPN */
145376b2c34aSJames Smart #define  RPRT_ACTIVE_FC4_TYPES        0xd /* 32 byte binary array */
145476b2c34aSJames Smart #define  RPRT_PORT_STATE              0x101 /* 32-bit unsigned int */
145576b2c34aSJames Smart #define  RPRT_DISC_PORT               0x102 /* 32-bit unsigned int */
145676b2c34aSJames Smart #define  RPRT_PORT_ID                 0x103 /* 32-bit unsigned int */
14574258e98eSJames Smart #define  RPRT_SMART_SERVICE           0xf100 /* 4 to 256 byte ASCII string */
14584258e98eSJames Smart #define  RPRT_SMART_GUID              0xf101 /* 8 byte WWNN + 8 byte WWPN */
14594258e98eSJames Smart #define  RPRT_SMART_VERSION           0xf102 /* 4 to 256 byte ASCII string */
14604258e98eSJames Smart #define  RPRT_SMART_MODEL             0xf103 /* 4 to 256 byte ASCII string */
14614258e98eSJames Smart #define  RPRT_SMART_PORT_INFO         0xf104 /* 32-bit unsigned int */
14624258e98eSJames Smart #define  RPRT_SMART_QOS               0xf105 /* 32-bit unsigned int */
14634258e98eSJames Smart #define  RPRT_SMART_SECURITY          0xf106 /* 32-bit unsigned int */
14644258e98eSJames Smart 
14654258e98eSJames Smart /* Bit mask for all individual PORT attributes */
14664258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_fc4type		0x00000001
14674258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_support_speed	0x00000002
14684258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_speed		0x00000004
14694258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_max_frame		0x00000008
14704258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_os_devname		0x00000010
14714258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_host_name		0x00000020
14724258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_wwnn		0x00000040
14734258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_wwpn		0x00000080
14744258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_symbolic_name	0x00000100
14754258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_port_type		0x00000200
14764258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_class		0x00000400
14774258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_fabric_wwpn		0x00000800
14784258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_port_state		0x00001000
14794258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_active_fc4type	0x00002000
14804258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_num_disc		0x00004000
14814258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_nportid		0x00008000
14824258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_service		0x00010000 /* Vendor specific */
14834258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_guid		0x00020000 /* Vendor specific */
14844258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_version		0x00040000 /* Vendor specific */
14854258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_model		0x00080000 /* Vendor specific */
14864258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_port_info		0x00100000 /* Vendor specific */
14874258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_qos		0x00200000 /* Vendor specific */
14884258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_security		0x00400000 /* Vendor specific */
14894258e98eSJames Smart 
14904258e98eSJames Smart /* Bit mask for FDMI-1 defined PORT attributes */
14914258e98eSJames Smart #define LPFC_FDMI1_PORT_ATTR			0x0000003f
14924258e98eSJames Smart 
14934258e98eSJames Smart /* Bit mask for FDMI-2 defined PORT attributes */
14944258e98eSJames Smart #define LPFC_FDMI2_PORT_ATTR			0x0000ffff
14954258e98eSJames Smart 
14964258e98eSJames Smart /* Bit mask for Smart SAN defined PORT attributes */
14974258e98eSJames Smart #define LPFC_FDMI2_SMART_ATTR			0x007fffff
14984258e98eSJames Smart 
14994258e98eSJames Smart /* Defines for PORT port state attribute */
15004258e98eSJames Smart #define LPFC_FDMI_PORTSTATE_UNKNOWN	1
15014258e98eSJames Smart #define LPFC_FDMI_PORTSTATE_ONLINE	2
15024258e98eSJames Smart 
15034258e98eSJames Smart /* Defines for PORT port type attribute */
15044258e98eSJames Smart #define LPFC_FDMI_PORTTYPE_UNKNOWN	0
15054258e98eSJames Smart #define LPFC_FDMI_PORTTYPE_NPORT	1
15064258e98eSJames Smart #define LPFC_FDMI_PORTTYPE_NLPORT	2
1507dea3101eS 
1508dea3101eS /*
1509dea3101eS  *  Begin HBA configuration parameters.
1510dea3101eS  *  The PCI configuration register BAR assignments are:
1511dea3101eS  *  BAR0, offset 0x10 - SLIM base memory address
1512dea3101eS  *  BAR1, offset 0x14 - SLIM base memory high address
1513dea3101eS  *  BAR2, offset 0x18 - REGISTER base memory address
1514dea3101eS  *  BAR3, offset 0x1c - REGISTER base memory high address
1515dea3101eS  *  BAR4, offset 0x20 - BIU I/O registers
1516dea3101eS  *  BAR5, offset 0x24 - REGISTER base io high address
1517dea3101eS  */
1518dea3101eS 
1519dea3101eS /* Number of rings currently used and available. */
15202a76a283SJames Smart #define MAX_SLI3_CONFIGURED_RINGS     3
15212a76a283SJames Smart #define MAX_SLI3_RINGS                4
1522dea3101eS 
1523dea3101eS /* IOCB / Mailbox is owned by FireFly */
1524dea3101eS #define OWN_CHIP        1
1525dea3101eS 
1526dea3101eS /* IOCB / Mailbox is owned by Host */
1527dea3101eS #define OWN_HOST        0
1528dea3101eS 
1529dea3101eS /* Number of 4-byte words in an IOCB. */
1530dea3101eS #define IOCB_WORD_SZ    8
1531dea3101eS 
1532dea3101eS /* network headers for Dfctl field */
1533dea3101eS #define FC_NET_HDR      0x20
1534dea3101eS 
1535dea3101eS /* Start FireFly Register definitions */
1536dea3101eS #define PCI_VENDOR_ID_EMULEX        0x10df
1537dea3101eS #define PCI_DEVICE_ID_FIREFLY       0x1ae5
153884774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_VF    0xe100
1539085c647cSJames Smart #define PCI_DEVICE_ID_BALIUS        0xe131
154084774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_PF    0xe180
1541085c647cSJames Smart #define PCI_DEVICE_ID_LANCER_FC     0xe200
1542c0c11512SJames Smart #define PCI_DEVICE_ID_LANCER_FC_VF  0xe208
1543085c647cSJames Smart #define PCI_DEVICE_ID_LANCER_FCOE   0xe260
1544c0c11512SJames Smart #define PCI_DEVICE_ID_LANCER_FCOE_VF 0xe268
1545d38dd52cSJames Smart #define PCI_DEVICE_ID_LANCER_G6_FC  0xe300
1546b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_SMB       0xf011
1547b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_MID       0xf015
1548dea3101eS #define PCI_DEVICE_ID_RFLY          0xf095
1549dea3101eS #define PCI_DEVICE_ID_PFLY          0xf098
1550e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LP101         0xf0a1
1551dea3101eS #define PCI_DEVICE_ID_TFLY          0xf0a5
1552e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_BSMB          0xf0d1
1553e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_BMID          0xf0d5
1554e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZSMB          0xf0e1
1555e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZMID          0xf0e5
1556e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE       0xf0f5
1557e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE_SCSP  0xf0f6
1558e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE_DCSP  0xf0f7
1559b87eab38SJames Smart #define PCI_DEVICE_ID_SAT           0xf100
1560b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_SCSP      0xf111
1561b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_DCSP      0xf112
1562085c647cSJames Smart #define PCI_DEVICE_ID_FALCON        0xf180
1563e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_SUPERFLY      0xf700
1564e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_DRAGONFLY     0xf800
1565dea3101eS #define PCI_DEVICE_ID_CENTAUR       0xf900
1566dea3101eS #define PCI_DEVICE_ID_PEGASUS       0xf980
1567dea3101eS #define PCI_DEVICE_ID_THOR          0xfa00
1568dea3101eS #define PCI_DEVICE_ID_VIPER         0xfb00
1569dea3101eS #define PCI_DEVICE_ID_LP10000S      0xfc00
1570e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LP11000S      0xfc10
1571e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LPE11000S     0xfc20
1572b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_S         0xfc40
157384774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_S     0xfc50
1574e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS        0xfd00
1575e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS_SCSP   0xfd11
1576e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS_DCSP   0xfd12
1577e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR        0xfe00
157884774a4dSJames Smart #define PCI_DEVICE_ID_HORNET        0xfe05
1579e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR_SCSP   0xfe11
1580e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR_DCSP   0xfe12
1581da0436e9SJames Smart #define PCI_VENDOR_ID_SERVERENGINE  0x19a2
1582da0436e9SJames Smart #define PCI_DEVICE_ID_TIGERSHARK    0x0704
1583a747c9ceSJames Smart #define PCI_DEVICE_ID_TOMCAT        0x0714
1584f8cafd38SJames Smart #define PCI_DEVICE_ID_SKYHAWK       0x0724
1585f8cafd38SJames Smart #define PCI_DEVICE_ID_SKYHAWK_VF    0x072c
1586dea3101eS 
1587dea3101eS #define JEDEC_ID_ADDRESS            0x0080001c
1588dea3101eS #define FIREFLY_JEDEC_ID            0x1ACC
1589dea3101eS #define SUPERFLY_JEDEC_ID           0x0020
1590dea3101eS #define DRAGONFLY_JEDEC_ID          0x0021
1591dea3101eS #define DRAGONFLY_V2_JEDEC_ID       0x0025
1592dea3101eS #define CENTAUR_2G_JEDEC_ID         0x0026
1593dea3101eS #define CENTAUR_1G_JEDEC_ID         0x0028
1594dea3101eS #define PEGASUS_ORION_JEDEC_ID      0x0036
1595dea3101eS #define PEGASUS_JEDEC_ID            0x0038
1596dea3101eS #define THOR_JEDEC_ID               0x0012
1597dea3101eS #define HELIOS_JEDEC_ID             0x0364
1598dea3101eS #define ZEPHYR_JEDEC_ID             0x0577
1599dea3101eS #define VIPER_JEDEC_ID              0x4838
1600b87eab38SJames Smart #define SATURN_JEDEC_ID             0x1004
160184774a4dSJames Smart #define HORNET_JDEC_ID              0x2057706D
1602dea3101eS 
1603dea3101eS #define JEDEC_ID_MASK               0x0FFFF000
1604dea3101eS #define JEDEC_ID_SHIFT              12
1605dea3101eS #define FC_JEDEC_ID(id)             ((id & JEDEC_ID_MASK) >> JEDEC_ID_SHIFT)
1606dea3101eS 
1607dea3101eS typedef struct {		/* FireFly BIU registers */
1608dea3101eS 	uint32_t hostAtt;	/* See definitions for Host Attention
1609dea3101eS 				   register */
1610dea3101eS 	uint32_t chipAtt;	/* See definitions for Chip Attention
1611dea3101eS 				   register */
1612dea3101eS 	uint32_t hostStatus;	/* See definitions for Host Status register */
1613dea3101eS 	uint32_t hostControl;	/* See definitions for Host Control register */
1614dea3101eS 	uint32_t buiConfig;	/* See definitions for BIU configuration
1615dea3101eS 				   register */
1616dea3101eS } FF_REGS;
1617dea3101eS 
1618dea3101eS /* IO Register size in bytes */
1619dea3101eS #define FF_REG_AREA_SIZE       256
1620dea3101eS 
1621dea3101eS /* Host Attention Register */
1622dea3101eS 
1623dea3101eS #define HA_REG_OFFSET  0	/* Byte offset from register base address */
1624dea3101eS 
1625dea3101eS #define HA_R0RE_REQ    0x00000001	/* Bit  0 */
1626dea3101eS #define HA_R0CE_RSP    0x00000002	/* Bit  1 */
1627dea3101eS #define HA_R0ATT       0x00000008	/* Bit  3 */
1628dea3101eS #define HA_R1RE_REQ    0x00000010	/* Bit  4 */
1629dea3101eS #define HA_R1CE_RSP    0x00000020	/* Bit  5 */
1630dea3101eS #define HA_R1ATT       0x00000080	/* Bit  7 */
1631dea3101eS #define HA_R2RE_REQ    0x00000100	/* Bit  8 */
1632dea3101eS #define HA_R2CE_RSP    0x00000200	/* Bit  9 */
1633dea3101eS #define HA_R2ATT       0x00000800	/* Bit 11 */
1634dea3101eS #define HA_R3RE_REQ    0x00001000	/* Bit 12 */
1635dea3101eS #define HA_R3CE_RSP    0x00002000	/* Bit 13 */
1636dea3101eS #define HA_R3ATT       0x00008000	/* Bit 15 */
1637dea3101eS #define HA_LATT        0x20000000	/* Bit 29 */
1638dea3101eS #define HA_MBATT       0x40000000	/* Bit 30 */
1639dea3101eS #define HA_ERATT       0x80000000	/* Bit 31 */
1640dea3101eS 
1641dea3101eS #define HA_RXRE_REQ    0x00000001	/* Bit  0 */
1642dea3101eS #define HA_RXCE_RSP    0x00000002	/* Bit  1 */
1643dea3101eS #define HA_RXATT       0x00000008	/* Bit  3 */
1644dea3101eS #define HA_RXMASK      0x0000000f
1645dea3101eS 
16469399627fSJames Smart #define HA_R0_CLR_MSK	(HA_R0RE_REQ | HA_R0CE_RSP | HA_R0ATT)
16479399627fSJames Smart #define HA_R1_CLR_MSK	(HA_R1RE_REQ | HA_R1CE_RSP | HA_R1ATT)
16489399627fSJames Smart #define HA_R2_CLR_MSK	(HA_R2RE_REQ | HA_R2CE_RSP | HA_R2ATT)
16499399627fSJames Smart #define HA_R3_CLR_MSK	(HA_R3RE_REQ | HA_R3CE_RSP | HA_R3ATT)
16509399627fSJames Smart 
16519399627fSJames Smart #define HA_R0_POS	3
16529399627fSJames Smart #define HA_R1_POS	7
16539399627fSJames Smart #define HA_R2_POS	11
16549399627fSJames Smart #define HA_R3_POS	15
16559399627fSJames Smart #define HA_LE_POS	29
16569399627fSJames Smart #define HA_MB_POS	30
16579399627fSJames Smart #define HA_ER_POS	31
1658dea3101eS /* Chip Attention Register */
1659dea3101eS 
1660dea3101eS #define CA_REG_OFFSET  4	/* Byte offset from register base address */
1661dea3101eS 
1662dea3101eS #define CA_R0CE_REQ    0x00000001	/* Bit  0 */
1663dea3101eS #define CA_R0RE_RSP    0x00000002	/* Bit  1 */
1664dea3101eS #define CA_R0ATT       0x00000008	/* Bit  3 */
1665dea3101eS #define CA_R1CE_REQ    0x00000010	/* Bit  4 */
1666dea3101eS #define CA_R1RE_RSP    0x00000020	/* Bit  5 */
1667dea3101eS #define CA_R1ATT       0x00000080	/* Bit  7 */
1668dea3101eS #define CA_R2CE_REQ    0x00000100	/* Bit  8 */
1669dea3101eS #define CA_R2RE_RSP    0x00000200	/* Bit  9 */
1670dea3101eS #define CA_R2ATT       0x00000800	/* Bit 11 */
1671dea3101eS #define CA_R3CE_REQ    0x00001000	/* Bit 12 */
1672dea3101eS #define CA_R3RE_RSP    0x00002000	/* Bit 13 */
1673dea3101eS #define CA_R3ATT       0x00008000	/* Bit 15 */
1674dea3101eS #define CA_MBATT       0x40000000	/* Bit 30 */
1675dea3101eS 
1676dea3101eS /* Host Status Register */
1677dea3101eS 
1678dea3101eS #define HS_REG_OFFSET  8	/* Byte offset from register base address */
1679dea3101eS 
1680dea3101eS #define HS_MBRDY       0x00400000	/* Bit 22 */
1681dea3101eS #define HS_FFRDY       0x00800000	/* Bit 23 */
1682dea3101eS #define HS_FFER8       0x01000000	/* Bit 24 */
1683dea3101eS #define HS_FFER7       0x02000000	/* Bit 25 */
1684dea3101eS #define HS_FFER6       0x04000000	/* Bit 26 */
1685dea3101eS #define HS_FFER5       0x08000000	/* Bit 27 */
1686dea3101eS #define HS_FFER4       0x10000000	/* Bit 28 */
1687dea3101eS #define HS_FFER3       0x20000000	/* Bit 29 */
1688dea3101eS #define HS_FFER2       0x40000000	/* Bit 30 */
1689dea3101eS #define HS_FFER1       0x80000000	/* Bit 31 */
169057127f15SJames Smart #define HS_CRIT_TEMP   0x00000100	/* Bit 8  */
169157127f15SJames Smart #define HS_FFERM       0xFF000100	/* Mask for error bits 31:24 and 8 */
16929940b97bSJames Smart #define UNPLUG_ERR     0x00000001	/* Indicate pci hot unplug */
1693dea3101eS /* Host Control Register */
1694dea3101eS 
16959399627fSJames Smart #define HC_REG_OFFSET  12	/* Byte offset from register base address */
1696dea3101eS 
1697dea3101eS #define HC_MBINT_ENA   0x00000001	/* Bit  0 */
1698dea3101eS #define HC_R0INT_ENA   0x00000002	/* Bit  1 */
1699dea3101eS #define HC_R1INT_ENA   0x00000004	/* Bit  2 */
1700dea3101eS #define HC_R2INT_ENA   0x00000008	/* Bit  3 */
1701dea3101eS #define HC_R3INT_ENA   0x00000010	/* Bit  4 */
1702dea3101eS #define HC_INITHBI     0x02000000	/* Bit 25 */
1703dea3101eS #define HC_INITMB      0x04000000	/* Bit 26 */
1704dea3101eS #define HC_INITFF      0x08000000	/* Bit 27 */
1705dea3101eS #define HC_LAINT_ENA   0x20000000	/* Bit 29 */
1706dea3101eS #define HC_ERINT_ENA   0x80000000	/* Bit 31 */
1707dea3101eS 
17089399627fSJames Smart /* Message Signaled Interrupt eXtension (MSI-X) message identifiers */
17099399627fSJames Smart #define MSIX_DFLT_ID	0
17109399627fSJames Smart #define MSIX_RNG0_ID	0
17119399627fSJames Smart #define MSIX_RNG1_ID	1
17129399627fSJames Smart #define MSIX_RNG2_ID	2
17139399627fSJames Smart #define MSIX_RNG3_ID	3
17149399627fSJames Smart 
17159399627fSJames Smart #define MSIX_LINK_ID	4
17169399627fSJames Smart #define MSIX_MBOX_ID	5
17179399627fSJames Smart 
17189399627fSJames Smart #define MSIX_SPARE0_ID	6
17199399627fSJames Smart #define MSIX_SPARE1_ID	7
17209399627fSJames Smart 
1721dea3101eS /* Mailbox Commands */
1722dea3101eS #define MBX_SHUTDOWN        0x00	/* terminate testing */
1723dea3101eS #define MBX_LOAD_SM         0x01
1724dea3101eS #define MBX_READ_NV         0x02
1725dea3101eS #define MBX_WRITE_NV        0x03
1726dea3101eS #define MBX_RUN_BIU_DIAG    0x04
1727dea3101eS #define MBX_INIT_LINK       0x05
1728dea3101eS #define MBX_DOWN_LINK       0x06
1729dea3101eS #define MBX_CONFIG_LINK     0x07
1730dea3101eS #define MBX_CONFIG_RING     0x09
1731dea3101eS #define MBX_RESET_RING      0x0A
1732dea3101eS #define MBX_READ_CONFIG     0x0B
1733dea3101eS #define MBX_READ_RCONFIG    0x0C
1734dea3101eS #define MBX_READ_SPARM      0x0D
1735dea3101eS #define MBX_READ_STATUS     0x0E
1736dea3101eS #define MBX_READ_RPI        0x0F
1737dea3101eS #define MBX_READ_XRI        0x10
1738dea3101eS #define MBX_READ_REV        0x11
1739dea3101eS #define MBX_READ_LNK_STAT   0x12
1740dea3101eS #define MBX_REG_LOGIN       0x13
1741dea3101eS #define MBX_UNREG_LOGIN     0x14
1742dea3101eS #define MBX_CLEAR_LA        0x16
1743dea3101eS #define MBX_DUMP_MEMORY     0x17
1744dea3101eS #define MBX_DUMP_CONTEXT    0x18
1745dea3101eS #define MBX_RUN_DIAGS       0x19
1746dea3101eS #define MBX_RESTART         0x1A
1747dea3101eS #define MBX_UPDATE_CFG      0x1B
1748dea3101eS #define MBX_DOWN_LOAD       0x1C
1749dea3101eS #define MBX_DEL_LD_ENTRY    0x1D
1750dea3101eS #define MBX_RUN_PROGRAM     0x1E
1751dea3101eS #define MBX_SET_MASK        0x20
175209372820SJames Smart #define MBX_SET_VARIABLE    0x21
1753dea3101eS #define MBX_UNREG_D_ID      0x23
175441415862SJamie Wellnitz #define MBX_KILL_BOARD      0x24
1755dea3101eS #define MBX_CONFIG_FARP     0x25
175641415862SJamie Wellnitz #define MBX_BEACON          0x2A
17579399627fSJames Smart #define MBX_CONFIG_MSI      0x30
1758858c9f6cSJames Smart #define MBX_HEARTBEAT       0x31
1759a8adb832SJames Smart #define MBX_WRITE_VPARMS    0x32
1760a8adb832SJames Smart #define MBX_ASYNCEVT_ENABLE 0x33
17614fede78fSJames Smart #define MBX_READ_EVENT_LOG_STATUS 0x37
17624fede78fSJames Smart #define MBX_READ_EVENT_LOG  0x38
17634fede78fSJames Smart #define MBX_WRITE_EVENT_LOG 0x39
1764dea3101eS 
176584774a4dSJames Smart #define MBX_PORT_CAPABILITIES 0x3B
176684774a4dSJames Smart #define MBX_PORT_IOV_CONTROL 0x3C
176784774a4dSJames Smart 
1768ed957684SJames Smart #define MBX_CONFIG_HBQ	    0x7C
1769dea3101eS #define MBX_LOAD_AREA       0x81
1770dea3101eS #define MBX_RUN_BIU_DIAG64  0x84
1771dea3101eS #define MBX_CONFIG_PORT     0x88
1772dea3101eS #define MBX_READ_SPARM64    0x8D
1773dea3101eS #define MBX_READ_RPI64      0x8F
1774dea3101eS #define MBX_REG_LOGIN64     0x93
177576a95d75SJames Smart #define MBX_READ_TOPOLOGY   0x95
177692d7f7b0SJames Smart #define MBX_REG_VPI	    0x96
177792d7f7b0SJames Smart #define MBX_UNREG_VPI	    0x97
1778dea3101eS 
177909372820SJames Smart #define MBX_WRITE_WWN       0x98
1780dea3101eS #define MBX_SET_DEBUG       0x99
1781dea3101eS #define MBX_LOAD_EXP_ROM    0x9C
1782da0436e9SJames Smart #define MBX_SLI4_CONFIG	    0x9B
1783da0436e9SJames Smart #define MBX_SLI4_REQ_FTRS   0x9D
1784da0436e9SJames Smart #define MBX_MAX_CMDS        0x9E
1785da0436e9SJames Smart #define MBX_RESUME_RPI      0x9E
1786dea3101eS #define MBX_SLI2_CMD_MASK   0x80
1787da0436e9SJames Smart #define MBX_REG_VFI         0x9F
1788da0436e9SJames Smart #define MBX_REG_FCFI        0xA0
1789da0436e9SJames Smart #define MBX_UNREG_VFI       0xA1
1790da0436e9SJames Smart #define MBX_UNREG_FCFI	    0xA2
1791da0436e9SJames Smart #define MBX_INIT_VFI        0xA3
1792da0436e9SJames Smart #define MBX_INIT_VPI        0xA4
1793940eb687SJames Smart #define MBX_ACCESS_VDATA    0xA5
1794dea3101eS 
1795dcf2a4e0SJames Smart #define MBX_AUTH_PORT       0xF8
1796dcf2a4e0SJames Smart #define MBX_SECURITY_MGMT   0xF9
1797dcf2a4e0SJames Smart 
1798dea3101eS /* IOCB Commands */
1799dea3101eS 
1800dea3101eS #define CMD_RCV_SEQUENCE_CX     0x01
1801dea3101eS #define CMD_XMIT_SEQUENCE_CR    0x02
1802dea3101eS #define CMD_XMIT_SEQUENCE_CX    0x03
1803dea3101eS #define CMD_XMIT_BCAST_CN       0x04
1804dea3101eS #define CMD_XMIT_BCAST_CX       0x05
1805dea3101eS #define CMD_QUE_RING_BUF_CN     0x06
1806dea3101eS #define CMD_QUE_XRI_BUF_CX      0x07
1807dea3101eS #define CMD_IOCB_CONTINUE_CN    0x08
1808dea3101eS #define CMD_RET_XRI_BUF_CX      0x09
1809dea3101eS #define CMD_ELS_REQUEST_CR      0x0A
1810dea3101eS #define CMD_ELS_REQUEST_CX      0x0B
1811dea3101eS #define CMD_RCV_ELS_REQ_CX      0x0D
1812dea3101eS #define CMD_ABORT_XRI_CN        0x0E
1813dea3101eS #define CMD_ABORT_XRI_CX        0x0F
1814dea3101eS #define CMD_CLOSE_XRI_CN        0x10
1815dea3101eS #define CMD_CLOSE_XRI_CX        0x11
1816dea3101eS #define CMD_CREATE_XRI_CR       0x12
1817dea3101eS #define CMD_CREATE_XRI_CX       0x13
1818dea3101eS #define CMD_GET_RPI_CN          0x14
1819dea3101eS #define CMD_XMIT_ELS_RSP_CX     0x15
1820dea3101eS #define CMD_GET_RPI_CR          0x16
1821dea3101eS #define CMD_XRI_ABORTED_CX      0x17
1822dea3101eS #define CMD_FCP_IWRITE_CR       0x18
1823dea3101eS #define CMD_FCP_IWRITE_CX       0x19
1824dea3101eS #define CMD_FCP_IREAD_CR        0x1A
1825dea3101eS #define CMD_FCP_IREAD_CX        0x1B
1826dea3101eS #define CMD_FCP_ICMND_CR        0x1C
1827dea3101eS #define CMD_FCP_ICMND_CX        0x1D
1828f5603511SJames Smart #define CMD_FCP_TSEND_CX        0x1F
1829f5603511SJames Smart #define CMD_FCP_TRECEIVE_CX     0x21
1830f5603511SJames Smart #define CMD_FCP_TRSP_CX	        0x23
1831f5603511SJames Smart #define CMD_FCP_AUTO_TRSP_CX    0x29
1832dea3101eS 
1833dea3101eS #define CMD_ADAPTER_MSG         0x20
1834dea3101eS #define CMD_ADAPTER_DUMP        0x22
1835dea3101eS 
1836dea3101eS /*  SLI_2 IOCB Command Set */
1837dea3101eS 
183857127f15SJames Smart #define CMD_ASYNC_STATUS        0x7C
1839dea3101eS #define CMD_RCV_SEQUENCE64_CX   0x81
1840dea3101eS #define CMD_XMIT_SEQUENCE64_CR  0x82
1841dea3101eS #define CMD_XMIT_SEQUENCE64_CX  0x83
1842dea3101eS #define CMD_XMIT_BCAST64_CN     0x84
1843dea3101eS #define CMD_XMIT_BCAST64_CX     0x85
1844dea3101eS #define CMD_QUE_RING_BUF64_CN   0x86
1845dea3101eS #define CMD_QUE_XRI_BUF64_CX    0x87
1846dea3101eS #define CMD_IOCB_CONTINUE64_CN  0x88
1847dea3101eS #define CMD_RET_XRI_BUF64_CX    0x89
1848dea3101eS #define CMD_ELS_REQUEST64_CR    0x8A
1849dea3101eS #define CMD_ELS_REQUEST64_CX    0x8B
1850dea3101eS #define CMD_ABORT_MXRI64_CN     0x8C
1851dea3101eS #define CMD_RCV_ELS_REQ64_CX    0x8D
1852dea3101eS #define CMD_XMIT_ELS_RSP64_CX   0x95
18536669f9bbSJames Smart #define CMD_XMIT_BLS_RSP64_CX   0x97
1854dea3101eS #define CMD_FCP_IWRITE64_CR     0x98
1855dea3101eS #define CMD_FCP_IWRITE64_CX     0x99
1856dea3101eS #define CMD_FCP_IREAD64_CR      0x9A
1857dea3101eS #define CMD_FCP_IREAD64_CX      0x9B
1858dea3101eS #define CMD_FCP_ICMND64_CR      0x9C
1859dea3101eS #define CMD_FCP_ICMND64_CX      0x9D
1860f5603511SJames Smart #define CMD_FCP_TSEND64_CX      0x9F
1861f5603511SJames Smart #define CMD_FCP_TRECEIVE64_CX   0xA1
1862f5603511SJames Smart #define CMD_FCP_TRSP64_CX       0xA3
1863dea3101eS 
186476bb24efSJames Smart #define CMD_QUE_XRI64_CX	0xB3
1865ed957684SJames Smart #define CMD_IOCB_RCV_SEQ64_CX	0xB5
1866ed957684SJames Smart #define CMD_IOCB_RCV_ELS64_CX	0xB7
18673163f725SJames Smart #define CMD_IOCB_RET_XRI64_CX	0xB9
1868ed957684SJames Smart #define CMD_IOCB_RCV_CONT64_CX	0xBB
1869ed957684SJames Smart 
1870dea3101eS #define CMD_GEN_REQUEST64_CR    0xC2
1871dea3101eS #define CMD_GEN_REQUEST64_CX    0xC3
1872dea3101eS 
18733163f725SJames Smart /* Unhandled SLI-3 Commands */
18743163f725SJames Smart #define CMD_IOCB_XMIT_MSEQ64_CR		0xB0
18753163f725SJames Smart #define CMD_IOCB_XMIT_MSEQ64_CX		0xB1
18763163f725SJames Smart #define CMD_IOCB_RCV_SEQ_LIST64_CX	0xC1
18773163f725SJames Smart #define CMD_IOCB_RCV_ELS_LIST64_CX	0xCD
18783163f725SJames Smart #define CMD_IOCB_CLOSE_EXTENDED_CN	0xB6
18793163f725SJames Smart #define CMD_IOCB_ABORT_EXTENDED_CN	0xBA
18803163f725SJames Smart #define CMD_IOCB_RET_HBQE64_CN		0xCA
18813163f725SJames Smart #define CMD_IOCB_FCP_IBIDIR64_CR	0xAC
18823163f725SJames Smart #define CMD_IOCB_FCP_IBIDIR64_CX	0xAD
18833163f725SJames Smart #define CMD_IOCB_FCP_ITASKMGT64_CX	0xAF
18843163f725SJames Smart #define CMD_IOCB_LOGENTRY_CN		0x94
18853163f725SJames Smart #define CMD_IOCB_LOGENTRY_ASYNC_CN	0x96
18863163f725SJames Smart 
1887341af102SJames Smart /* Data Security SLI Commands */
1888341af102SJames Smart #define DSSCMD_IWRITE64_CR		0xF8
1889341af102SJames Smart #define DSSCMD_IWRITE64_CX		0xF9
1890341af102SJames Smart #define DSSCMD_IREAD64_CR		0xFA
1891341af102SJames Smart #define DSSCMD_IREAD64_CX		0xFB
1892da0436e9SJames Smart 
1893341af102SJames Smart #define CMD_MAX_IOCB_CMD        0xFB
1894dea3101eS #define CMD_IOCB_MASK           0xff
1895dea3101eS 
1896dea3101eS #define MAX_MSG_DATA            28	/* max msg data in CMD_ADAPTER_MSG
1897dea3101eS 					   iocb */
1898dea3101eS #define LPFC_MAX_ADPTMSG         32	/* max msg data */
1899dea3101eS /*
1900dea3101eS  *  Define Status
1901dea3101eS  */
1902dea3101eS #define MBX_SUCCESS                 0
1903dea3101eS #define MBXERR_NUM_RINGS            1
1904dea3101eS #define MBXERR_NUM_IOCBS            2
1905dea3101eS #define MBXERR_IOCBS_EXCEEDED       3
1906dea3101eS #define MBXERR_BAD_RING_NUMBER      4
1907dea3101eS #define MBXERR_MASK_ENTRIES_RANGE   5
1908dea3101eS #define MBXERR_MASKS_EXCEEDED       6
1909dea3101eS #define MBXERR_BAD_PROFILE          7
1910dea3101eS #define MBXERR_BAD_DEF_CLASS        8
1911dea3101eS #define MBXERR_BAD_MAX_RESPONDER    9
1912dea3101eS #define MBXERR_BAD_MAX_ORIGINATOR   10
1913dea3101eS #define MBXERR_RPI_REGISTERED       11
1914dea3101eS #define MBXERR_RPI_FULL             12
1915dea3101eS #define MBXERR_NO_RESOURCES         13
1916dea3101eS #define MBXERR_BAD_RCV_LENGTH       14
1917dea3101eS #define MBXERR_DMA_ERROR            15
1918dea3101eS #define MBXERR_ERROR                16
1919da0436e9SJames Smart #define MBXERR_LINK_DOWN            0x33
1920dcf2a4e0SJames Smart #define MBXERR_SEC_NO_PERMISSION    0xF02
1921dea3101eS #define MBX_NOT_FINISHED            255
1922dea3101eS 
1923dea3101eS #define MBX_BUSY                   0xffffff /* Attempted cmd to busy Mailbox */
1924dea3101eS #define MBX_TIMEOUT                0xfffffe /* time-out expired waiting for */
1925dea3101eS 
192657127f15SJames Smart #define TEMPERATURE_OFFSET 0xB0	/* Slim offset for critical temperature event */
192757127f15SJames Smart 
1928dea3101eS /*
192986478875SJames Smart  * return code Fail
193086478875SJames Smart  */
193186478875SJames Smart #define FAILURE 1
193286478875SJames Smart 
193386478875SJames Smart /*
1934dea3101eS  *    Begin Structure Definitions for Mailbox Commands
1935dea3101eS  */
1936dea3101eS 
1937dea3101eS typedef struct {
1938dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1939dea3101eS 	uint8_t tval;
1940dea3101eS 	uint8_t tmask;
1941dea3101eS 	uint8_t rval;
1942dea3101eS 	uint8_t rmask;
1943dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1944dea3101eS 	uint8_t rmask;
1945dea3101eS 	uint8_t rval;
1946dea3101eS 	uint8_t tmask;
1947dea3101eS 	uint8_t tval;
1948dea3101eS #endif
1949dea3101eS } RR_REG;
1950dea3101eS 
1951dea3101eS struct ulp_bde {
1952dea3101eS 	uint32_t bdeAddress;
1953dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1954dea3101eS 	uint32_t bdeReserved:4;
1955dea3101eS 	uint32_t bdeAddrHigh:4;
1956dea3101eS 	uint32_t bdeSize:24;
1957dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1958dea3101eS 	uint32_t bdeSize:24;
1959dea3101eS 	uint32_t bdeAddrHigh:4;
1960dea3101eS 	uint32_t bdeReserved:4;
1961dea3101eS #endif
1962dea3101eS };
1963dea3101eS 
1964dea3101eS typedef struct ULP_BDL {	/* SLI-2 */
1965dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1966dea3101eS 	uint32_t bdeFlags:8;	/* BDL Flags */
1967dea3101eS 	uint32_t bdeSize:24;	/* Size of BDL array in host memory (bytes) */
1968dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1969dea3101eS 	uint32_t bdeSize:24;	/* Size of BDL array in host memory (bytes) */
1970dea3101eS 	uint32_t bdeFlags:8;	/* BDL Flags */
1971dea3101eS #endif
1972dea3101eS 
1973dea3101eS 	uint32_t addrLow;	/* Address 0:31 */
1974dea3101eS 	uint32_t addrHigh;	/* Address 32:63 */
1975dea3101eS 	uint32_t ulpIoTag32;	/* Can be used for 32 bit I/O Tag */
1976dea3101eS } ULP_BDL;
1977dea3101eS 
197881301a9bSJames Smart /*
197981301a9bSJames Smart  * BlockGuard Definitions
198081301a9bSJames Smart  */
198181301a9bSJames Smart 
198281301a9bSJames Smart enum lpfc_protgrp_type {
198381301a9bSJames Smart 	LPFC_PG_TYPE_INVALID = 0, /* used to indicate errors                  */
198481301a9bSJames Smart 	LPFC_PG_TYPE_NO_DIF,	  /* no DIF data pointed to by prot grp       */
198581301a9bSJames Smart 	LPFC_PG_TYPE_EMBD_DIF,	  /* DIF is embedded (inline) with data       */
198681301a9bSJames Smart 	LPFC_PG_TYPE_DIF_BUF	  /* DIF has its own scatter/gather list      */
198781301a9bSJames Smart };
198881301a9bSJames Smart 
198981301a9bSJames Smart /* PDE Descriptors */
19906c8eea54SJames Smart #define LPFC_PDE5_DESCRIPTOR		0x85
19916c8eea54SJames Smart #define LPFC_PDE6_DESCRIPTOR		0x86
19926c8eea54SJames Smart #define LPFC_PDE7_DESCRIPTOR		0x87
199381301a9bSJames Smart 
19946c8eea54SJames Smart /* BlockGuard Opcodes */
19956c8eea54SJames Smart #define BG_OP_IN_NODIF_OUT_CRC		0x0
19966c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_NODIF		0x1
19976c8eea54SJames Smart #define	BG_OP_IN_NODIF_OUT_CSUM		0x2
19986c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_NODIF		0x3
19996c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_CRC		0x4
20006c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_CSUM		0x5
20016c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_CSUM		0x6
20026c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_CRC		0x7
2003a6887e28SJames Smart #define	BG_OP_RAW_MODE			0x8
20046c8eea54SJames Smart 
20056c8eea54SJames Smart struct lpfc_pde5 {
20066c8eea54SJames Smart 	uint32_t word0;
20076c8eea54SJames Smart #define pde5_type_SHIFT		24
20086c8eea54SJames Smart #define pde5_type_MASK		0x000000ff
20096c8eea54SJames Smart #define pde5_type_WORD		word0
20106c8eea54SJames Smart #define pde5_rsvd0_SHIFT	0
20116c8eea54SJames Smart #define pde5_rsvd0_MASK		0x00ffffff
20126c8eea54SJames Smart #define pde5_rsvd0_WORD		word0
20136c8eea54SJames Smart 	uint32_t reftag;	/* Reference Tag Value			*/
20146c8eea54SJames Smart 	uint32_t reftagtr;	/* Reference Tag Translation Value 	*/
201581301a9bSJames Smart };
201681301a9bSJames Smart 
20176c8eea54SJames Smart struct lpfc_pde6 {
20186c8eea54SJames Smart 	uint32_t word0;
20196c8eea54SJames Smart #define pde6_type_SHIFT		24
20206c8eea54SJames Smart #define pde6_type_MASK		0x000000ff
20216c8eea54SJames Smart #define pde6_type_WORD		word0
20226c8eea54SJames Smart #define pde6_rsvd0_SHIFT	0
20236c8eea54SJames Smart #define pde6_rsvd0_MASK		0x00ffffff
20246c8eea54SJames Smart #define pde6_rsvd0_WORD		word0
20256c8eea54SJames Smart 	uint32_t word1;
20266c8eea54SJames Smart #define pde6_rsvd1_SHIFT	26
20276c8eea54SJames Smart #define pde6_rsvd1_MASK		0x0000003f
20286c8eea54SJames Smart #define pde6_rsvd1_WORD		word1
20296c8eea54SJames Smart #define pde6_na_SHIFT		25
20306c8eea54SJames Smart #define pde6_na_MASK		0x00000001
20316c8eea54SJames Smart #define pde6_na_WORD		word1
20326c8eea54SJames Smart #define pde6_rsvd2_SHIFT	16
20336c8eea54SJames Smart #define pde6_rsvd2_MASK		0x000001FF
20346c8eea54SJames Smart #define pde6_rsvd2_WORD		word1
20356c8eea54SJames Smart #define pde6_apptagtr_SHIFT	0
20366c8eea54SJames Smart #define pde6_apptagtr_MASK	0x0000ffff
20376c8eea54SJames Smart #define pde6_apptagtr_WORD	word1
20386c8eea54SJames Smart 	uint32_t word2;
20396c8eea54SJames Smart #define pde6_optx_SHIFT		28
20406c8eea54SJames Smart #define pde6_optx_MASK		0x0000000f
20416c8eea54SJames Smart #define pde6_optx_WORD		word2
20426c8eea54SJames Smart #define pde6_oprx_SHIFT		24
20436c8eea54SJames Smart #define pde6_oprx_MASK		0x0000000f
20446c8eea54SJames Smart #define pde6_oprx_WORD		word2
20456c8eea54SJames Smart #define pde6_nr_SHIFT		23
20466c8eea54SJames Smart #define pde6_nr_MASK		0x00000001
20476c8eea54SJames Smart #define pde6_nr_WORD		word2
20486c8eea54SJames Smart #define pde6_ce_SHIFT		22
20496c8eea54SJames Smart #define pde6_ce_MASK		0x00000001
20506c8eea54SJames Smart #define pde6_ce_WORD		word2
20516c8eea54SJames Smart #define pde6_re_SHIFT		21
20526c8eea54SJames Smart #define pde6_re_MASK		0x00000001
20536c8eea54SJames Smart #define pde6_re_WORD		word2
20546c8eea54SJames Smart #define pde6_ae_SHIFT		20
20556c8eea54SJames Smart #define pde6_ae_MASK		0x00000001
20566c8eea54SJames Smart #define pde6_ae_WORD		word2
20576c8eea54SJames Smart #define pde6_ai_SHIFT		19
20586c8eea54SJames Smart #define pde6_ai_MASK		0x00000001
20596c8eea54SJames Smart #define pde6_ai_WORD		word2
20606c8eea54SJames Smart #define pde6_bs_SHIFT		16
20616c8eea54SJames Smart #define pde6_bs_MASK		0x00000007
20626c8eea54SJames Smart #define pde6_bs_WORD		word2
20636c8eea54SJames Smart #define pde6_apptagval_SHIFT	0
20646c8eea54SJames Smart #define pde6_apptagval_MASK	0x0000ffff
20656c8eea54SJames Smart #define pde6_apptagval_WORD	word2
206681301a9bSJames Smart };
206781301a9bSJames Smart 
20687f86059aSJames Smart struct lpfc_pde7 {
20697f86059aSJames Smart 	uint32_t word0;
20707f86059aSJames Smart #define pde7_type_SHIFT		24
20717f86059aSJames Smart #define pde7_type_MASK		0x000000ff
20727f86059aSJames Smart #define pde7_type_WORD		word0
20737f86059aSJames Smart #define pde7_rsvd0_SHIFT	0
20747f86059aSJames Smart #define pde7_rsvd0_MASK		0x00ffffff
20757f86059aSJames Smart #define pde7_rsvd0_WORD		word0
20767f86059aSJames Smart 	uint32_t addrHigh;
20777f86059aSJames Smart 	uint32_t addrLow;
20787f86059aSJames Smart };
207981301a9bSJames Smart 
2080dea3101eS /* Structure for MB Command LOAD_SM and DOWN_LOAD */
2081dea3101eS 
2082dea3101eS typedef struct {
2083dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2084dea3101eS 	uint32_t rsvd2:25;
2085dea3101eS 	uint32_t acknowledgment:1;
2086dea3101eS 	uint32_t version:1;
2087dea3101eS 	uint32_t erase_or_prog:1;
2088dea3101eS 	uint32_t update_flash:1;
2089dea3101eS 	uint32_t update_ram:1;
2090dea3101eS 	uint32_t method:1;
2091dea3101eS 	uint32_t load_cmplt:1;
2092dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2093dea3101eS 	uint32_t load_cmplt:1;
2094dea3101eS 	uint32_t method:1;
2095dea3101eS 	uint32_t update_ram:1;
2096dea3101eS 	uint32_t update_flash:1;
2097dea3101eS 	uint32_t erase_or_prog:1;
2098dea3101eS 	uint32_t version:1;
2099dea3101eS 	uint32_t acknowledgment:1;
2100dea3101eS 	uint32_t rsvd2:25;
2101dea3101eS #endif
2102dea3101eS 
2103dea3101eS 	uint32_t dl_to_adr_low;
2104dea3101eS 	uint32_t dl_to_adr_high;
2105dea3101eS 	uint32_t dl_len;
2106dea3101eS 	union {
2107dea3101eS 		uint32_t dl_from_mbx_offset;
2108dea3101eS 		struct ulp_bde dl_from_bde;
2109dea3101eS 		struct ulp_bde64 dl_from_bde64;
2110dea3101eS 	} un;
2111dea3101eS 
2112dea3101eS } LOAD_SM_VAR;
2113dea3101eS 
2114dea3101eS /* Structure for MB Command READ_NVPARM (02) */
2115dea3101eS 
2116dea3101eS typedef struct {
2117dea3101eS 	uint32_t rsvd1[3];	/* Read as all one's */
2118dea3101eS 	uint32_t rsvd2;		/* Read as all zero's */
2119dea3101eS 	uint32_t portname[2];	/* N_PORT name */
2120dea3101eS 	uint32_t nodename[2];	/* NODE name */
2121dea3101eS 
2122dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2123dea3101eS 	uint32_t pref_DID:24;
2124dea3101eS 	uint32_t hardAL_PA:8;
2125dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2126dea3101eS 	uint32_t hardAL_PA:8;
2127dea3101eS 	uint32_t pref_DID:24;
2128dea3101eS #endif
2129dea3101eS 
2130dea3101eS 	uint32_t rsvd3[21];	/* Read as all one's */
2131dea3101eS } READ_NV_VAR;
2132dea3101eS 
2133dea3101eS /* Structure for MB Command WRITE_NVPARMS (03) */
2134dea3101eS 
2135dea3101eS typedef struct {
2136dea3101eS 	uint32_t rsvd1[3];	/* Must be all one's */
2137dea3101eS 	uint32_t rsvd2;		/* Must be all zero's */
2138dea3101eS 	uint32_t portname[2];	/* N_PORT name */
2139dea3101eS 	uint32_t nodename[2];	/* NODE name */
2140dea3101eS 
2141dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2142dea3101eS 	uint32_t pref_DID:24;
2143dea3101eS 	uint32_t hardAL_PA:8;
2144dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2145dea3101eS 	uint32_t hardAL_PA:8;
2146dea3101eS 	uint32_t pref_DID:24;
2147dea3101eS #endif
2148dea3101eS 
2149dea3101eS 	uint32_t rsvd3[21];	/* Must be all one's */
2150dea3101eS } WRITE_NV_VAR;
2151dea3101eS 
2152dea3101eS /* Structure for MB Command RUN_BIU_DIAG (04) */
2153dea3101eS /* Structure for MB Command RUN_BIU_DIAG64 (0x84) */
2154dea3101eS 
2155dea3101eS typedef struct {
2156dea3101eS 	uint32_t rsvd1;
2157dea3101eS 	union {
2158dea3101eS 		struct {
2159dea3101eS 			struct ulp_bde xmit_bde;
2160dea3101eS 			struct ulp_bde rcv_bde;
2161dea3101eS 		} s1;
2162dea3101eS 		struct {
2163dea3101eS 			struct ulp_bde64 xmit_bde64;
2164dea3101eS 			struct ulp_bde64 rcv_bde64;
2165dea3101eS 		} s2;
2166dea3101eS 	} un;
2167dea3101eS } BIU_DIAG_VAR;
2168dea3101eS 
2169c7495937SJames Smart /* Structure for MB command READ_EVENT_LOG (0x38) */
2170c7495937SJames Smart struct READ_EVENT_LOG_VAR {
2171c7495937SJames Smart 	uint32_t word1;
2172c7495937SJames Smart #define lpfc_event_log_SHIFT	29
2173c7495937SJames Smart #define lpfc_event_log_MASK	0x00000001
2174c7495937SJames Smart #define lpfc_event_log_WORD	word1
2175c7495937SJames Smart #define USE_MAILBOX_RESPONSE	1
2176c7495937SJames Smart 	uint32_t offset;
2177c7495937SJames Smart 	struct ulp_bde64 rcv_bde64;
2178c7495937SJames Smart };
2179c7495937SJames Smart 
2180dea3101eS /* Structure for MB Command INIT_LINK (05) */
2181dea3101eS 
2182dea3101eS typedef struct {
2183dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2184dea3101eS 	uint32_t rsvd1:24;
2185dea3101eS 	uint32_t lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective Reset to */
2186dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2187dea3101eS 	uint32_t lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective Reset to */
2188dea3101eS 	uint32_t rsvd1:24;
2189dea3101eS #endif
2190dea3101eS 
2191dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2192dea3101eS 	uint8_t fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
2193dea3101eS 	uint8_t rsvd2;
2194dea3101eS 	uint16_t link_flags;
2195dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2196dea3101eS 	uint16_t link_flags;
2197dea3101eS 	uint8_t rsvd2;
2198dea3101eS 	uint8_t fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
2199dea3101eS #endif
2200dea3101eS 
2201dea3101eS #define FLAGS_TOPOLOGY_MODE_LOOP_PT  0x00 /* Attempt loop then pt-pt */
22021b51197dSJames Smart #define FLAGS_LOCAL_LB               0x01 /* link_flags (=1) ENDEC loopback */
2203dea3101eS #define FLAGS_TOPOLOGY_MODE_PT_PT    0x02 /* Attempt pt-pt only */
2204dea3101eS #define FLAGS_TOPOLOGY_MODE_LOOP     0x04 /* Attempt loop only */
2205dea3101eS #define FLAGS_TOPOLOGY_MODE_PT_LOOP  0x06 /* Attempt pt-pt then loop */
2206ed957684SJames Smart #define	FLAGS_UNREG_LOGIN_ALL	     0x08 /* UNREG_LOGIN all on link down */
2207dea3101eS #define FLAGS_LIRP_LILP              0x80 /* LIRP / LILP is disabled */
2208dea3101eS 
2209dea3101eS #define FLAGS_TOPOLOGY_FAILOVER      0x0400	/* Bit 10 */
2210dea3101eS #define FLAGS_LINK_SPEED             0x0800	/* Bit 11 */
22114b0b91d4SJames Smart #define FLAGS_IMED_ABORT             0x04000	/* Bit 14 */
2212dea3101eS 
2213dea3101eS 	uint32_t link_speed;
221476a95d75SJames Smart #define LINK_SPEED_AUTO 0x0     /* Auto selection */
221576a95d75SJames Smart #define LINK_SPEED_1G   0x1     /* 1 Gigabaud */
221676a95d75SJames Smart #define LINK_SPEED_2G   0x2     /* 2 Gigabaud */
221776a95d75SJames Smart #define LINK_SPEED_4G   0x4     /* 4 Gigabaud */
221876a95d75SJames Smart #define LINK_SPEED_8G   0x8     /* 8 Gigabaud */
221976a95d75SJames Smart #define LINK_SPEED_10G  0x10    /* 10 Gigabaud */
222076a95d75SJames Smart #define LINK_SPEED_16G  0x11    /* 16 Gigabaud */
2221d38dd52cSJames Smart #define LINK_SPEED_32G  0x14    /* 32 Gigabaud */
2222dea3101eS 
2223dea3101eS } INIT_LINK_VAR;
2224dea3101eS 
2225dea3101eS /* Structure for MB Command DOWN_LINK (06) */
2226dea3101eS 
2227dea3101eS typedef struct {
2228dea3101eS 	uint32_t rsvd1;
2229dea3101eS } DOWN_LINK_VAR;
2230dea3101eS 
2231dea3101eS /* Structure for MB Command CONFIG_LINK (07) */
2232dea3101eS 
2233dea3101eS typedef struct {
2234dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2235dea3101eS 	uint32_t cr:1;
2236dea3101eS 	uint32_t ci:1;
2237dea3101eS 	uint32_t cr_delay:6;
2238dea3101eS 	uint32_t cr_count:8;
2239dea3101eS 	uint32_t rsvd1:8;
2240dea3101eS 	uint32_t MaxBBC:8;
2241dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2242dea3101eS 	uint32_t MaxBBC:8;
2243dea3101eS 	uint32_t rsvd1:8;
2244dea3101eS 	uint32_t cr_count:8;
2245dea3101eS 	uint32_t cr_delay:6;
2246dea3101eS 	uint32_t ci:1;
2247dea3101eS 	uint32_t cr:1;
2248dea3101eS #endif
2249dea3101eS 
2250dea3101eS 	uint32_t myId;
2251dea3101eS 	uint32_t rsvd2;
2252dea3101eS 	uint32_t edtov;
2253dea3101eS 	uint32_t arbtov;
2254dea3101eS 	uint32_t ratov;
2255dea3101eS 	uint32_t rttov;
2256dea3101eS 	uint32_t altov;
2257dea3101eS 	uint32_t crtov;
2258dea3101eS 	uint32_t citov;
2259dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2260dea3101eS 	uint32_t rrq_enable:1;
2261dea3101eS 	uint32_t rrq_immed:1;
2262dea3101eS 	uint32_t rsvd4:29;
2263dea3101eS 	uint32_t ack0_enable:1;
2264dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2265dea3101eS 	uint32_t ack0_enable:1;
2266dea3101eS 	uint32_t rsvd4:29;
2267dea3101eS 	uint32_t rrq_immed:1;
2268dea3101eS 	uint32_t rrq_enable:1;
2269dea3101eS #endif
2270dea3101eS } CONFIG_LINK;
2271dea3101eS 
2272dea3101eS /* Structure for MB Command PART_SLIM (08)
2273dea3101eS  * will be removed since SLI1 is no longer supported!
2274dea3101eS  */
2275dea3101eS typedef struct {
2276dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2277dea3101eS 	uint16_t offCiocb;
2278dea3101eS 	uint16_t numCiocb;
2279dea3101eS 	uint16_t offRiocb;
2280dea3101eS 	uint16_t numRiocb;
2281dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2282dea3101eS 	uint16_t numCiocb;
2283dea3101eS 	uint16_t offCiocb;
2284dea3101eS 	uint16_t numRiocb;
2285dea3101eS 	uint16_t offRiocb;
2286dea3101eS #endif
2287dea3101eS } RING_DEF;
2288dea3101eS 
2289dea3101eS typedef struct {
2290dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2291dea3101eS 	uint32_t unused1:24;
2292dea3101eS 	uint32_t numRing:8;
2293dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2294dea3101eS 	uint32_t numRing:8;
2295dea3101eS 	uint32_t unused1:24;
2296dea3101eS #endif
2297dea3101eS 
2298dea3101eS 	RING_DEF ringdef[4];
2299dea3101eS 	uint32_t hbainit;
2300dea3101eS } PART_SLIM_VAR;
2301dea3101eS 
2302dea3101eS /* Structure for MB Command CONFIG_RING (09) */
2303dea3101eS 
2304dea3101eS typedef struct {
2305dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2306dea3101eS 	uint32_t unused2:6;
2307dea3101eS 	uint32_t recvSeq:1;
2308dea3101eS 	uint32_t recvNotify:1;
2309dea3101eS 	uint32_t numMask:8;
2310dea3101eS 	uint32_t profile:8;
2311dea3101eS 	uint32_t unused1:4;
2312dea3101eS 	uint32_t ring:4;
2313dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2314dea3101eS 	uint32_t ring:4;
2315dea3101eS 	uint32_t unused1:4;
2316dea3101eS 	uint32_t profile:8;
2317dea3101eS 	uint32_t numMask:8;
2318dea3101eS 	uint32_t recvNotify:1;
2319dea3101eS 	uint32_t recvSeq:1;
2320dea3101eS 	uint32_t unused2:6;
2321dea3101eS #endif
2322dea3101eS 
2323dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2324dea3101eS 	uint16_t maxRespXchg;
2325dea3101eS 	uint16_t maxOrigXchg;
2326dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2327dea3101eS 	uint16_t maxOrigXchg;
2328dea3101eS 	uint16_t maxRespXchg;
2329dea3101eS #endif
2330dea3101eS 
2331dea3101eS 	RR_REG rrRegs[6];
2332dea3101eS } CONFIG_RING_VAR;
2333dea3101eS 
2334dea3101eS /* Structure for MB Command RESET_RING (10) */
2335dea3101eS 
2336dea3101eS typedef struct {
2337dea3101eS 	uint32_t ring_no;
2338dea3101eS } RESET_RING_VAR;
2339dea3101eS 
2340dea3101eS /* Structure for MB Command READ_CONFIG (11) */
2341dea3101eS 
2342dea3101eS typedef struct {
2343dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2344dea3101eS 	uint32_t cr:1;
2345dea3101eS 	uint32_t ci:1;
2346dea3101eS 	uint32_t cr_delay:6;
2347dea3101eS 	uint32_t cr_count:8;
2348dea3101eS 	uint32_t InitBBC:8;
2349dea3101eS 	uint32_t MaxBBC:8;
2350dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2351dea3101eS 	uint32_t MaxBBC:8;
2352dea3101eS 	uint32_t InitBBC:8;
2353dea3101eS 	uint32_t cr_count:8;
2354dea3101eS 	uint32_t cr_delay:6;
2355dea3101eS 	uint32_t ci:1;
2356dea3101eS 	uint32_t cr:1;
2357dea3101eS #endif
2358dea3101eS 
2359dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2360dea3101eS 	uint32_t topology:8;
2361dea3101eS 	uint32_t myDid:24;
2362dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2363dea3101eS 	uint32_t myDid:24;
2364dea3101eS 	uint32_t topology:8;
2365dea3101eS #endif
2366dea3101eS 
2367dea3101eS 	/* Defines for topology (defined previously) */
2368dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2369dea3101eS 	uint32_t AR:1;
2370dea3101eS 	uint32_t IR:1;
2371dea3101eS 	uint32_t rsvd1:29;
2372dea3101eS 	uint32_t ack0:1;
2373dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2374dea3101eS 	uint32_t ack0:1;
2375dea3101eS 	uint32_t rsvd1:29;
2376dea3101eS 	uint32_t IR:1;
2377dea3101eS 	uint32_t AR:1;
2378dea3101eS #endif
2379dea3101eS 
2380dea3101eS 	uint32_t edtov;
2381dea3101eS 	uint32_t arbtov;
2382dea3101eS 	uint32_t ratov;
2383dea3101eS 	uint32_t rttov;
2384dea3101eS 	uint32_t altov;
2385dea3101eS 	uint32_t lmt;
238674b72a59SJamie Wellnitz #define LMT_RESERVED  0x000    /* Not used */
238774b72a59SJamie Wellnitz #define LMT_1Gb       0x004
238874b72a59SJamie Wellnitz #define LMT_2Gb       0x008
238974b72a59SJamie Wellnitz #define LMT_4Gb       0x040
239074b72a59SJamie Wellnitz #define LMT_8Gb       0x080
239174b72a59SJamie Wellnitz #define LMT_10Gb      0x100
239276a95d75SJames Smart #define LMT_16Gb      0x200
2393d38dd52cSJames Smart #define LMT_32Gb      0x400
2394dea3101eS 	uint32_t rsvd2;
2395dea3101eS 	uint32_t rsvd3;
2396dea3101eS 	uint32_t max_xri;
2397dea3101eS 	uint32_t max_iocb;
2398dea3101eS 	uint32_t max_rpi;
2399dea3101eS 	uint32_t avail_xri;
2400dea3101eS 	uint32_t avail_iocb;
2401dea3101eS 	uint32_t avail_rpi;
2402858c9f6cSJames Smart 	uint32_t max_vpi;
2403858c9f6cSJames Smart 	uint32_t rsvd4;
2404858c9f6cSJames Smart 	uint32_t rsvd5;
2405858c9f6cSJames Smart 	uint32_t avail_vpi;
2406dea3101eS } READ_CONFIG_VAR;
2407dea3101eS 
2408dea3101eS /* Structure for MB Command READ_RCONFIG (12) */
2409dea3101eS 
2410dea3101eS typedef struct {
2411dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2412dea3101eS 	uint32_t rsvd2:7;
2413dea3101eS 	uint32_t recvNotify:1;
2414dea3101eS 	uint32_t numMask:8;
2415dea3101eS 	uint32_t profile:8;
2416dea3101eS 	uint32_t rsvd1:4;
2417dea3101eS 	uint32_t ring:4;
2418dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2419dea3101eS 	uint32_t ring:4;
2420dea3101eS 	uint32_t rsvd1:4;
2421dea3101eS 	uint32_t profile:8;
2422dea3101eS 	uint32_t numMask:8;
2423dea3101eS 	uint32_t recvNotify:1;
2424dea3101eS 	uint32_t rsvd2:7;
2425dea3101eS #endif
2426dea3101eS 
2427dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2428dea3101eS 	uint16_t maxResp;
2429dea3101eS 	uint16_t maxOrig;
2430dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2431dea3101eS 	uint16_t maxOrig;
2432dea3101eS 	uint16_t maxResp;
2433dea3101eS #endif
2434dea3101eS 
2435dea3101eS 	RR_REG rrRegs[6];
2436dea3101eS 
2437dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2438dea3101eS 	uint16_t cmdRingOffset;
2439dea3101eS 	uint16_t cmdEntryCnt;
2440dea3101eS 	uint16_t rspRingOffset;
2441dea3101eS 	uint16_t rspEntryCnt;
2442dea3101eS 	uint16_t nextCmdOffset;
2443dea3101eS 	uint16_t rsvd3;
2444dea3101eS 	uint16_t nextRspOffset;
2445dea3101eS 	uint16_t rsvd4;
2446dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2447dea3101eS 	uint16_t cmdEntryCnt;
2448dea3101eS 	uint16_t cmdRingOffset;
2449dea3101eS 	uint16_t rspEntryCnt;
2450dea3101eS 	uint16_t rspRingOffset;
2451dea3101eS 	uint16_t rsvd3;
2452dea3101eS 	uint16_t nextCmdOffset;
2453dea3101eS 	uint16_t rsvd4;
2454dea3101eS 	uint16_t nextRspOffset;
2455dea3101eS #endif
2456dea3101eS } READ_RCONF_VAR;
2457dea3101eS 
2458dea3101eS /* Structure for MB Command READ_SPARM (13) */
2459dea3101eS /* Structure for MB Command READ_SPARM64 (0x8D) */
2460dea3101eS 
2461dea3101eS typedef struct {
2462dea3101eS 	uint32_t rsvd1;
2463dea3101eS 	uint32_t rsvd2;
2464dea3101eS 	union {
2465dea3101eS 		struct ulp_bde sp; /* This BDE points to struct serv_parm
2466dea3101eS 				      structure */
2467dea3101eS 		struct ulp_bde64 sp64;
2468dea3101eS 	} un;
2469ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2470ed957684SJames Smart 	uint16_t rsvd3;
2471ed957684SJames Smart 	uint16_t vpi;
2472ed957684SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
2473ed957684SJames Smart 	uint16_t vpi;
2474ed957684SJames Smart 	uint16_t rsvd3;
2475ed957684SJames Smart #endif
2476dea3101eS } READ_SPARM_VAR;
2477dea3101eS 
2478dea3101eS /* Structure for MB Command READ_STATUS (14) */
2479dea3101eS 
2480dea3101eS typedef struct {
2481dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2482dea3101eS 	uint32_t rsvd1:31;
2483dea3101eS 	uint32_t clrCounters:1;
2484dea3101eS 	uint16_t activeXriCnt;
2485dea3101eS 	uint16_t activeRpiCnt;
2486dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2487dea3101eS 	uint32_t clrCounters:1;
2488dea3101eS 	uint32_t rsvd1:31;
2489dea3101eS 	uint16_t activeRpiCnt;
2490dea3101eS 	uint16_t activeXriCnt;
2491dea3101eS #endif
2492dea3101eS 
2493dea3101eS 	uint32_t xmitByteCnt;
2494dea3101eS 	uint32_t rcvByteCnt;
2495dea3101eS 	uint32_t xmitFrameCnt;
2496dea3101eS 	uint32_t rcvFrameCnt;
2497dea3101eS 	uint32_t xmitSeqCnt;
2498dea3101eS 	uint32_t rcvSeqCnt;
2499dea3101eS 	uint32_t totalOrigExchanges;
2500dea3101eS 	uint32_t totalRespExchanges;
2501dea3101eS 	uint32_t rcvPbsyCnt;
2502dea3101eS 	uint32_t rcvFbsyCnt;
2503dea3101eS } READ_STATUS_VAR;
2504dea3101eS 
2505dea3101eS /* Structure for MB Command READ_RPI (15) */
2506dea3101eS /* Structure for MB Command READ_RPI64 (0x8F) */
2507dea3101eS 
2508dea3101eS typedef struct {
2509dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2510dea3101eS 	uint16_t nextRpi;
2511dea3101eS 	uint16_t reqRpi;
2512dea3101eS 	uint32_t rsvd2:8;
2513dea3101eS 	uint32_t DID:24;
2514dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2515dea3101eS 	uint16_t reqRpi;
2516dea3101eS 	uint16_t nextRpi;
2517dea3101eS 	uint32_t DID:24;
2518dea3101eS 	uint32_t rsvd2:8;
2519dea3101eS #endif
2520dea3101eS 
2521dea3101eS 	union {
2522dea3101eS 		struct ulp_bde sp;
2523dea3101eS 		struct ulp_bde64 sp64;
2524dea3101eS 	} un;
2525dea3101eS 
2526dea3101eS } READ_RPI_VAR;
2527dea3101eS 
2528dea3101eS /* Structure for MB Command READ_XRI (16) */
2529dea3101eS 
2530dea3101eS typedef struct {
2531dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2532dea3101eS 	uint16_t nextXri;
2533dea3101eS 	uint16_t reqXri;
2534dea3101eS 	uint16_t rsvd1;
2535dea3101eS 	uint16_t rpi;
2536dea3101eS 	uint32_t rsvd2:8;
2537dea3101eS 	uint32_t DID:24;
2538dea3101eS 	uint32_t rsvd3:8;
2539dea3101eS 	uint32_t SID:24;
2540dea3101eS 	uint32_t rsvd4;
2541dea3101eS 	uint8_t seqId;
2542dea3101eS 	uint8_t rsvd5;
2543dea3101eS 	uint16_t seqCount;
2544dea3101eS 	uint16_t oxId;
2545dea3101eS 	uint16_t rxId;
2546dea3101eS 	uint32_t rsvd6:30;
2547dea3101eS 	uint32_t si:1;
2548dea3101eS 	uint32_t exchOrig:1;
2549dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2550dea3101eS 	uint16_t reqXri;
2551dea3101eS 	uint16_t nextXri;
2552dea3101eS 	uint16_t rpi;
2553dea3101eS 	uint16_t rsvd1;
2554dea3101eS 	uint32_t DID:24;
2555dea3101eS 	uint32_t rsvd2:8;
2556dea3101eS 	uint32_t SID:24;
2557dea3101eS 	uint32_t rsvd3:8;
2558dea3101eS 	uint32_t rsvd4;
2559dea3101eS 	uint16_t seqCount;
2560dea3101eS 	uint8_t rsvd5;
2561dea3101eS 	uint8_t seqId;
2562dea3101eS 	uint16_t rxId;
2563dea3101eS 	uint16_t oxId;
2564dea3101eS 	uint32_t exchOrig:1;
2565dea3101eS 	uint32_t si:1;
2566dea3101eS 	uint32_t rsvd6:30;
2567dea3101eS #endif
2568dea3101eS } READ_XRI_VAR;
2569dea3101eS 
2570dea3101eS /* Structure for MB Command READ_REV (17) */
2571dea3101eS 
2572dea3101eS typedef struct {
2573dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2574dea3101eS 	uint32_t cv:1;
2575dea3101eS 	uint32_t rr:1;
2576ed957684SJames Smart 	uint32_t rsvd2:2;
2577ed957684SJames Smart 	uint32_t v3req:1;
2578ed957684SJames Smart 	uint32_t v3rsp:1;
2579ed957684SJames Smart 	uint32_t rsvd1:25;
2580dea3101eS 	uint32_t rv:1;
2581dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2582dea3101eS 	uint32_t rv:1;
2583ed957684SJames Smart 	uint32_t rsvd1:25;
2584ed957684SJames Smart 	uint32_t v3rsp:1;
2585ed957684SJames Smart 	uint32_t v3req:1;
2586ed957684SJames Smart 	uint32_t rsvd2:2;
2587dea3101eS 	uint32_t rr:1;
2588dea3101eS 	uint32_t cv:1;
2589dea3101eS #endif
2590dea3101eS 
2591dea3101eS 	uint32_t biuRev;
2592dea3101eS 	uint32_t smRev;
2593dea3101eS 	union {
2594dea3101eS 		uint32_t smFwRev;
2595dea3101eS 		struct {
2596dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2597dea3101eS 			uint8_t ProgType;
2598dea3101eS 			uint8_t ProgId;
2599dea3101eS 			uint16_t ProgVer:4;
2600dea3101eS 			uint16_t ProgRev:4;
2601dea3101eS 			uint16_t ProgFixLvl:2;
2602dea3101eS 			uint16_t ProgDistType:2;
2603dea3101eS 			uint16_t DistCnt:4;
2604dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2605dea3101eS 			uint16_t DistCnt:4;
2606dea3101eS 			uint16_t ProgDistType:2;
2607dea3101eS 			uint16_t ProgFixLvl:2;
2608dea3101eS 			uint16_t ProgRev:4;
2609dea3101eS 			uint16_t ProgVer:4;
2610dea3101eS 			uint8_t ProgId;
2611dea3101eS 			uint8_t ProgType;
2612dea3101eS #endif
2613dea3101eS 
2614dea3101eS 		} b;
2615dea3101eS 	} un;
2616dea3101eS 	uint32_t endecRev;
2617dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2618dea3101eS 	uint8_t feaLevelHigh;
2619dea3101eS 	uint8_t feaLevelLow;
2620dea3101eS 	uint8_t fcphHigh;
2621dea3101eS 	uint8_t fcphLow;
2622dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2623dea3101eS 	uint8_t fcphLow;
2624dea3101eS 	uint8_t fcphHigh;
2625dea3101eS 	uint8_t feaLevelLow;
2626dea3101eS 	uint8_t feaLevelHigh;
2627dea3101eS #endif
2628dea3101eS 
2629dea3101eS 	uint32_t postKernRev;
2630dea3101eS 	uint32_t opFwRev;
2631dea3101eS 	uint8_t opFwName[16];
2632dea3101eS 	uint32_t sli1FwRev;
2633dea3101eS 	uint8_t sli1FwName[16];
2634dea3101eS 	uint32_t sli2FwRev;
2635dea3101eS 	uint8_t sli2FwName[16];
2636ed957684SJames Smart 	uint32_t sli3Feat;
2637ed957684SJames Smart 	uint32_t RandomData[6];
2638dea3101eS } READ_REV_VAR;
2639dea3101eS 
2640dea3101eS /* Structure for MB Command READ_LINK_STAT (18) */
2641dea3101eS 
2642dea3101eS typedef struct {
26434258e98eSJames Smart 	uint32_t word0;
26444258e98eSJames Smart 
26454258e98eSJames Smart #define lpfc_read_link_stat_rec_SHIFT   0
26464258e98eSJames Smart #define lpfc_read_link_stat_rec_MASK   0x1
26474258e98eSJames Smart #define lpfc_read_link_stat_rec_WORD   word0
26484258e98eSJames Smart 
26494258e98eSJames Smart #define lpfc_read_link_stat_gec_SHIFT	1
26504258e98eSJames Smart #define lpfc_read_link_stat_gec_MASK   0x1
26514258e98eSJames Smart #define lpfc_read_link_stat_gec_WORD   word0
26524258e98eSJames Smart 
26534258e98eSJames Smart #define lpfc_read_link_stat_w02oftow23of_SHIFT	2
26544258e98eSJames Smart #define lpfc_read_link_stat_w02oftow23of_MASK   0x3FFFFF
26554258e98eSJames Smart #define lpfc_read_link_stat_w02oftow23of_WORD   word0
26564258e98eSJames Smart 
26574258e98eSJames Smart #define lpfc_read_link_stat_rsvd_SHIFT	24
26584258e98eSJames Smart #define lpfc_read_link_stat_rsvd_MASK   0x1F
26594258e98eSJames Smart #define lpfc_read_link_stat_rsvd_WORD   word0
26604258e98eSJames Smart 
26614258e98eSJames Smart #define lpfc_read_link_stat_gec2_SHIFT  29
26624258e98eSJames Smart #define lpfc_read_link_stat_gec2_MASK   0x1
26634258e98eSJames Smart #define lpfc_read_link_stat_gec2_WORD   word0
26644258e98eSJames Smart 
26654258e98eSJames Smart #define lpfc_read_link_stat_clrc_SHIFT  30
26664258e98eSJames Smart #define lpfc_read_link_stat_clrc_MASK   0x1
26674258e98eSJames Smart #define lpfc_read_link_stat_clrc_WORD   word0
26684258e98eSJames Smart 
26694258e98eSJames Smart #define lpfc_read_link_stat_clof_SHIFT  31
26704258e98eSJames Smart #define lpfc_read_link_stat_clof_MASK   0x1
26714258e98eSJames Smart #define lpfc_read_link_stat_clof_WORD   word0
26724258e98eSJames Smart 
2673dea3101eS 	uint32_t linkFailureCnt;
2674dea3101eS 	uint32_t lossSyncCnt;
2675dea3101eS 	uint32_t lossSignalCnt;
2676dea3101eS 	uint32_t primSeqErrCnt;
2677dea3101eS 	uint32_t invalidXmitWord;
2678dea3101eS 	uint32_t crcCnt;
2679dea3101eS 	uint32_t primSeqTimeout;
2680dea3101eS 	uint32_t elasticOverrun;
2681dea3101eS 	uint32_t arbTimeout;
26824258e98eSJames Smart 	uint32_t advRecBufCredit;
26834258e98eSJames Smart 	uint32_t curRecBufCredit;
26844258e98eSJames Smart 	uint32_t advTransBufCredit;
26854258e98eSJames Smart 	uint32_t curTransBufCredit;
26864258e98eSJames Smart 	uint32_t recEofCount;
26874258e98eSJames Smart 	uint32_t recEofdtiCount;
26884258e98eSJames Smart 	uint32_t recEofniCount;
26894258e98eSJames Smart 	uint32_t recSofcount;
26904258e98eSJames Smart 	uint32_t rsvd1;
26914258e98eSJames Smart 	uint32_t rsvd2;
26924258e98eSJames Smart 	uint32_t recDrpXriCount;
26934258e98eSJames Smart 	uint32_t fecCorrBlkCount;
26944258e98eSJames Smart 	uint32_t fecUncorrBlkCount;
2695dea3101eS } READ_LNK_VAR;
2696dea3101eS 
2697dea3101eS /* Structure for MB Command REG_LOGIN (19) */
2698dea3101eS /* Structure for MB Command REG_LOGIN64 (0x93) */
2699dea3101eS 
2700dea3101eS typedef struct {
2701dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2702dea3101eS 	uint16_t rsvd1;
2703dea3101eS 	uint16_t rpi;
2704dea3101eS 	uint32_t rsvd2:8;
2705dea3101eS 	uint32_t did:24;
2706dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2707dea3101eS 	uint16_t rpi;
2708dea3101eS 	uint16_t rsvd1;
2709dea3101eS 	uint32_t did:24;
2710dea3101eS 	uint32_t rsvd2:8;
2711dea3101eS #endif
2712dea3101eS 
2713dea3101eS 	union {
2714dea3101eS 		struct ulp_bde sp;
2715dea3101eS 		struct ulp_bde64 sp64;
2716dea3101eS 	} un;
2717dea3101eS 
2718ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2719ed957684SJames Smart 	uint16_t rsvd6;
2720ed957684SJames Smart 	uint16_t vpi;
2721ed957684SJames Smart #else /* __LITTLE_ENDIAN_BITFIELD */
2722ed957684SJames Smart 	uint16_t vpi;
2723ed957684SJames Smart 	uint16_t rsvd6;
2724ed957684SJames Smart #endif
2725ed957684SJames Smart 
2726dea3101eS } REG_LOGIN_VAR;
2727dea3101eS 
2728dea3101eS /* Word 30 contents for REG_LOGIN */
2729dea3101eS typedef union {
2730dea3101eS 	struct {
2731dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2732dea3101eS 		uint16_t rsvd1:12;
2733dea3101eS 		uint16_t wd30_class:4;
2734dea3101eS 		uint16_t xri;
2735dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2736dea3101eS 		uint16_t xri;
2737dea3101eS 		uint16_t wd30_class:4;
2738dea3101eS 		uint16_t rsvd1:12;
2739dea3101eS #endif
2740dea3101eS 	} f;
2741dea3101eS 	uint32_t word;
2742dea3101eS } REG_WD30;
2743dea3101eS 
2744dea3101eS /* Structure for MB Command UNREG_LOGIN (20) */
2745dea3101eS 
2746dea3101eS typedef struct {
2747dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2748dea3101eS 	uint16_t rsvd1;
2749dea3101eS 	uint16_t rpi;
2750ed957684SJames Smart 	uint32_t rsvd2;
2751ed957684SJames Smart 	uint32_t rsvd3;
2752ed957684SJames Smart 	uint32_t rsvd4;
2753ed957684SJames Smart 	uint32_t rsvd5;
2754ed957684SJames Smart 	uint16_t rsvd6;
2755ed957684SJames Smart 	uint16_t vpi;
2756dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2757dea3101eS 	uint16_t rpi;
2758dea3101eS 	uint16_t rsvd1;
2759ed957684SJames Smart 	uint32_t rsvd2;
2760ed957684SJames Smart 	uint32_t rsvd3;
2761ed957684SJames Smart 	uint32_t rsvd4;
2762ed957684SJames Smart 	uint32_t rsvd5;
2763ed957684SJames Smart 	uint16_t vpi;
2764ed957684SJames Smart 	uint16_t rsvd6;
2765dea3101eS #endif
2766dea3101eS } UNREG_LOGIN_VAR;
2767dea3101eS 
276892d7f7b0SJames Smart /* Structure for MB Command REG_VPI (0x96) */
276992d7f7b0SJames Smart typedef struct {
277092d7f7b0SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
277192d7f7b0SJames Smart 	uint32_t rsvd1;
277238b92ef8SJames Smart 	uint32_t rsvd2:7;
277338b92ef8SJames Smart 	uint32_t upd:1;
277492d7f7b0SJames Smart 	uint32_t sid:24;
2775c868595dSJames Smart 	uint32_t wwn[2];
277692d7f7b0SJames Smart 	uint32_t rsvd5;
2777da0436e9SJames Smart 	uint16_t vfi;
277892d7f7b0SJames Smart 	uint16_t vpi;
277992d7f7b0SJames Smart #else	/*  __LITTLE_ENDIAN */
278092d7f7b0SJames Smart 	uint32_t rsvd1;
278192d7f7b0SJames Smart 	uint32_t sid:24;
278238b92ef8SJames Smart 	uint32_t upd:1;
278338b92ef8SJames Smart 	uint32_t rsvd2:7;
2784c868595dSJames Smart 	uint32_t wwn[2];
278592d7f7b0SJames Smart 	uint32_t rsvd5;
278692d7f7b0SJames Smart 	uint16_t vpi;
2787da0436e9SJames Smart 	uint16_t vfi;
278892d7f7b0SJames Smart #endif
278992d7f7b0SJames Smart } REG_VPI_VAR;
279092d7f7b0SJames Smart 
279192d7f7b0SJames Smart /* Structure for MB Command UNREG_VPI (0x97) */
279292d7f7b0SJames Smart typedef struct {
279392d7f7b0SJames Smart 	uint32_t rsvd1;
27946669f9bbSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
27956669f9bbSJames Smart 	uint16_t rsvd2;
27966669f9bbSJames Smart 	uint16_t sli4_vpi;
27976669f9bbSJames Smart #else	/*  __LITTLE_ENDIAN */
27986669f9bbSJames Smart 	uint16_t sli4_vpi;
27996669f9bbSJames Smart 	uint16_t rsvd2;
28006669f9bbSJames Smart #endif
280192d7f7b0SJames Smart 	uint32_t rsvd3;
280292d7f7b0SJames Smart 	uint32_t rsvd4;
280392d7f7b0SJames Smart 	uint32_t rsvd5;
280492d7f7b0SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
280592d7f7b0SJames Smart 	uint16_t rsvd6;
280692d7f7b0SJames Smart 	uint16_t vpi;
280792d7f7b0SJames Smart #else	/*  __LITTLE_ENDIAN */
280892d7f7b0SJames Smart 	uint16_t vpi;
280992d7f7b0SJames Smart 	uint16_t rsvd6;
281092d7f7b0SJames Smart #endif
281192d7f7b0SJames Smart } UNREG_VPI_VAR;
281292d7f7b0SJames Smart 
2813dea3101eS /* Structure for MB Command UNREG_D_ID (0x23) */
2814dea3101eS 
2815dea3101eS typedef struct {
2816dea3101eS 	uint32_t did;
2817ed957684SJames Smart 	uint32_t rsvd2;
2818ed957684SJames Smart 	uint32_t rsvd3;
2819ed957684SJames Smart 	uint32_t rsvd4;
2820ed957684SJames Smart 	uint32_t rsvd5;
2821ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2822ed957684SJames Smart 	uint16_t rsvd6;
2823ed957684SJames Smart 	uint16_t vpi;
2824ed957684SJames Smart #else
2825ed957684SJames Smart 	uint16_t vpi;
2826ed957684SJames Smart 	uint16_t rsvd6;
2827ed957684SJames Smart #endif
2828dea3101eS } UNREG_D_ID_VAR;
2829dea3101eS 
283076a95d75SJames Smart /* Structure for MB Command READ_TOPOLOGY (0x95) */
283176a95d75SJames Smart struct lpfc_mbx_read_top {
2832dea3101eS 	uint32_t eventTag;	/* Event tag */
283376a95d75SJames Smart 	uint32_t word2;
283476a95d75SJames Smart #define lpfc_mbx_read_top_fa_SHIFT		12
283576a95d75SJames Smart #define lpfc_mbx_read_top_fa_MASK		0x00000001
283676a95d75SJames Smart #define lpfc_mbx_read_top_fa_WORD		word2
283776a95d75SJames Smart #define lpfc_mbx_read_top_mm_SHIFT		11
283876a95d75SJames Smart #define lpfc_mbx_read_top_mm_MASK		0x00000001
283976a95d75SJames Smart #define lpfc_mbx_read_top_mm_WORD		word2
284076a95d75SJames Smart #define lpfc_mbx_read_top_pb_SHIFT		9
284176a95d75SJames Smart #define lpfc_mbx_read_top_pb_MASK		0X00000001
284276a95d75SJames Smart #define lpfc_mbx_read_top_pb_WORD		word2
284376a95d75SJames Smart #define lpfc_mbx_read_top_il_SHIFT		8
284476a95d75SJames Smart #define lpfc_mbx_read_top_il_MASK		0x00000001
284576a95d75SJames Smart #define lpfc_mbx_read_top_il_WORD		word2
284676a95d75SJames Smart #define lpfc_mbx_read_top_att_type_SHIFT	0
284776a95d75SJames Smart #define lpfc_mbx_read_top_att_type_MASK		0x000000FF
284876a95d75SJames Smart #define lpfc_mbx_read_top_att_type_WORD		word2
284976a95d75SJames Smart #define LPFC_ATT_RESERVED    0x00	/* Reserved - attType */
285076a95d75SJames Smart #define LPFC_ATT_LINK_UP     0x01	/* Link is up */
285176a95d75SJames Smart #define LPFC_ATT_LINK_DOWN   0x02	/* Link is down */
285276a95d75SJames Smart 	uint32_t word3;
285376a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_SHIFT	24
285476a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_MASK	0x000000FF
285576a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_WORD	word3
285676a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_SHIFT	16
285776a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_MASK		0x000000FF
285876a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_WORD		word3
285976a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_SHIFT	8
286076a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_MASK		0x000000FF
286176a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_WORD		word3
286276a95d75SJames Smart #define lpfc_mbx_read_top_topology_SHIFT	0
286376a95d75SJames Smart #define lpfc_mbx_read_top_topology_MASK		0x000000FF
286476a95d75SJames Smart #define lpfc_mbx_read_top_topology_WORD		word3
286576a95d75SJames Smart #define LPFC_TOPOLOGY_PT_PT 0x01	/* Topology is pt-pt / pt-fabric */
286676a95d75SJames Smart #define LPFC_TOPOLOGY_LOOP  0x02	/* Topology is FC-AL */
286776a95d75SJames Smart #define LPFC_TOPOLOGY_MM    0x05	/* maint mode zephtr to menlo */
2868dea3101eS 	/* store the LILP AL_PA position map into */
2869dea3101eS 	struct ulp_bde64 lilpBde64;
287076a95d75SJames Smart #define LPFC_ALPA_MAP_SIZE	128
287176a95d75SJames Smart 	uint32_t word7;
287276a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_SHIFT		31
287376a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_MASK		0x00000001
287476a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_WORD		word7
287576a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_SHIFT		30
287676a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_MASK		0x00000001
287776a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_WORD		word7
287876a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_SHIFT	8
287976a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_MASK	0x000000FF
288076a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_WORD	word7
288176a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_SHIFT	4
288276a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_MASK	0x0000000F
288376a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_WORD	word7
288476a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_SHIFT		2
288576a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_MASK		0x00000003
288676a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_WORD		word7
288776a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_SHIFT		0
288876a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_MASK		0x00000003
288976a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_WORD		word7
289076a95d75SJames Smart 	uint32_t word8;
289176a95d75SJames Smart #define lpfc_mbx_read_top_lu_SHIFT		31
289276a95d75SJames Smart #define lpfc_mbx_read_top_lu_MASK		0x00000001
289376a95d75SJames Smart #define lpfc_mbx_read_top_lu_WORD		word8
289476a95d75SJames Smart #define lpfc_mbx_read_top_tf_SHIFT		30
289576a95d75SJames Smart #define lpfc_mbx_read_top_tf_MASK		0x00000001
289676a95d75SJames Smart #define lpfc_mbx_read_top_tf_WORD		word8
289776a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_SHIFT	8
289876a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_MASK		0x000000FF
289976a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_WORD		word8
290076a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_SHIFT		4
290176a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_MASK		0x0000000F
290276a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_WORD		word8
290376a95d75SJames Smart #define lpfc_mbx_read_top_tx_SHIFT		2
290476a95d75SJames Smart #define lpfc_mbx_read_top_tx_MASK		0x00000003
290576a95d75SJames Smart #define lpfc_mbx_read_top_tx_WORD		word8
290676a95d75SJames Smart #define lpfc_mbx_read_top_rx_SHIFT		0
290776a95d75SJames Smart #define lpfc_mbx_read_top_rx_MASK		0x00000003
290876a95d75SJames Smart #define lpfc_mbx_read_top_rx_WORD		word8
290976a95d75SJames Smart #define LPFC_LINK_SPEED_UNKNOWN	0x0
291076a95d75SJames Smart #define LPFC_LINK_SPEED_1GHZ	0x04
291176a95d75SJames Smart #define LPFC_LINK_SPEED_2GHZ	0x08
291276a95d75SJames Smart #define LPFC_LINK_SPEED_4GHZ	0x10
291376a95d75SJames Smart #define LPFC_LINK_SPEED_8GHZ	0x20
291476a95d75SJames Smart #define LPFC_LINK_SPEED_10GHZ	0x40
291576a95d75SJames Smart #define LPFC_LINK_SPEED_16GHZ	0x80
2916d38dd52cSJames Smart #define LPFC_LINK_SPEED_32GHZ	0x90
291776a95d75SJames Smart };
2918dea3101eS 
2919dea3101eS /* Structure for MB Command CLEAR_LA (22) */
2920dea3101eS 
2921dea3101eS typedef struct {
2922dea3101eS 	uint32_t eventTag;	/* Event tag */
2923dea3101eS 	uint32_t rsvd1;
2924dea3101eS } CLEAR_LA_VAR;
2925dea3101eS 
2926dea3101eS /* Structure for MB Command DUMP */
2927dea3101eS 
2928dea3101eS typedef struct {
2929dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2930dea3101eS 	uint32_t rsvd:25;
2931dea3101eS 	uint32_t ra:1;
2932dea3101eS 	uint32_t co:1;
2933dea3101eS 	uint32_t cv:1;
2934dea3101eS 	uint32_t type:4;
2935dea3101eS 	uint32_t entry_index:16;
2936dea3101eS 	uint32_t region_id:16;
2937dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2938dea3101eS 	uint32_t type:4;
2939dea3101eS 	uint32_t cv:1;
2940dea3101eS 	uint32_t co:1;
2941dea3101eS 	uint32_t ra:1;
2942dea3101eS 	uint32_t rsvd:25;
2943dea3101eS 	uint32_t region_id:16;
2944dea3101eS 	uint32_t entry_index:16;
2945dea3101eS #endif
2946dea3101eS 
2947da0436e9SJames Smart 	uint32_t sli4_length;
2948dea3101eS 	uint32_t word_cnt;
2949dea3101eS 	uint32_t resp_offset;
2950dea3101eS } DUMP_VAR;
2951dea3101eS 
2952dea3101eS #define  DMP_MEM_REG             0x1
2953dea3101eS #define  DMP_NV_PARAMS           0x2
29543ef6d24cSJames Smart #define  DMP_LMSD                0x3 /* Link Module Serial Data */
29553ef6d24cSJames Smart #define  DMP_WELL_KNOWN          0x4
2956dea3101eS 
2957dea3101eS #define  DMP_REGION_VPD          0xe
2958dea3101eS #define  DMP_VPD_SIZE            0x400  /* maximum amount of VPD */
2959dea3101eS #define  DMP_RSP_OFFSET          0x14   /* word 5 contains first word of rsp */
2960dea3101eS #define  DMP_RSP_SIZE            0x6C   /* maximum of 27 words of rsp data */
2961dea3101eS 
2962da0436e9SJames Smart #define  DMP_REGION_VPORT	 0x16   /* VPort info region */
2963da0436e9SJames Smart #define  DMP_VPORT_REGION_SIZE	 0x200
2964da0436e9SJames Smart #define  DMP_MBOX_OFFSET_WORD	 0x5
2965da0436e9SJames Smart 
2966a0c87cbdSJames Smart #define  DMP_REGION_23		 0x17   /* fcoe param  and port state region */
2967a0c87cbdSJames Smart #define  DMP_RGN23_SIZE		 0x400
2968da0436e9SJames Smart 
296997207482SJames Smart #define  WAKE_UP_PARMS_REGION_ID    4
297097207482SJames Smart #define  WAKE_UP_PARMS_WORD_SIZE   15
297197207482SJames Smart 
2972da0436e9SJames Smart struct vport_rec {
2973da0436e9SJames Smart 	uint8_t wwpn[8];
2974da0436e9SJames Smart 	uint8_t wwnn[8];
2975da0436e9SJames Smart };
2976da0436e9SJames Smart 
2977da0436e9SJames Smart #define VPORT_INFO_SIG 0x32324752
2978da0436e9SJames Smart #define VPORT_INFO_REV_MASK 0xff
2979da0436e9SJames Smart #define VPORT_INFO_REV 0x1
2980da0436e9SJames Smart #define MAX_STATIC_VPORT_COUNT 16
2981da0436e9SJames Smart struct static_vport_info {
2982da0436e9SJames Smart 	uint32_t		signature;
2983da0436e9SJames Smart 	uint32_t		rev;
2984da0436e9SJames Smart 	struct vport_rec	vport_list[MAX_STATIC_VPORT_COUNT];
2985da0436e9SJames Smart 	uint32_t		resvd[66];
2986da0436e9SJames Smart };
2987da0436e9SJames Smart 
298897207482SJames Smart /* Option rom version structure */
298997207482SJames Smart struct prog_id {
299097207482SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
299197207482SJames Smart 	uint8_t  type;
299297207482SJames Smart 	uint8_t  id;
299397207482SJames Smart 	uint32_t ver:4;  /* Major Version */
299497207482SJames Smart 	uint32_t rev:4;  /* Revision */
299597207482SJames Smart 	uint32_t lev:2;  /* Level */
299697207482SJames Smart 	uint32_t dist:2; /* Dist Type */
299797207482SJames Smart 	uint32_t num:4;  /* number after dist type */
299897207482SJames Smart #else /*  __LITTLE_ENDIAN_BITFIELD */
299997207482SJames Smart 	uint32_t num:4;  /* number after dist type */
300097207482SJames Smart 	uint32_t dist:2; /* Dist Type */
300197207482SJames Smart 	uint32_t lev:2;  /* Level */
300297207482SJames Smart 	uint32_t rev:4;  /* Revision */
300397207482SJames Smart 	uint32_t ver:4;  /* Major Version */
300497207482SJames Smart 	uint8_t  id;
300597207482SJames Smart 	uint8_t  type;
300697207482SJames Smart #endif
300797207482SJames Smart };
300897207482SJames Smart 
3009d7c255b2SJames Smart /* Structure for MB Command UPDATE_CFG (0x1B) */
3010d7c255b2SJames Smart 
3011d7c255b2SJames Smart struct update_cfg_var {
3012d7c255b2SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3013d7c255b2SJames Smart 	uint32_t rsvd2:16;
3014d7c255b2SJames Smart 	uint32_t type:8;
3015d7c255b2SJames Smart 	uint32_t rsvd:1;
3016d7c255b2SJames Smart 	uint32_t ra:1;
3017d7c255b2SJames Smart 	uint32_t co:1;
3018d7c255b2SJames Smart 	uint32_t cv:1;
3019d7c255b2SJames Smart 	uint32_t req:4;
3020d7c255b2SJames Smart 	uint32_t entry_length:16;
3021d7c255b2SJames Smart 	uint32_t region_id:16;
3022d7c255b2SJames Smart #else  /*  __LITTLE_ENDIAN_BITFIELD */
3023d7c255b2SJames Smart 	uint32_t req:4;
3024d7c255b2SJames Smart 	uint32_t cv:1;
3025d7c255b2SJames Smart 	uint32_t co:1;
3026d7c255b2SJames Smart 	uint32_t ra:1;
3027d7c255b2SJames Smart 	uint32_t rsvd:1;
3028d7c255b2SJames Smart 	uint32_t type:8;
3029d7c255b2SJames Smart 	uint32_t rsvd2:16;
3030d7c255b2SJames Smart 	uint32_t region_id:16;
3031d7c255b2SJames Smart 	uint32_t entry_length:16;
3032d7c255b2SJames Smart #endif
3033d7c255b2SJames Smart 
3034d7c255b2SJames Smart 	uint32_t resp_info;
3035d7c255b2SJames Smart 	uint32_t byte_cnt;
3036d7c255b2SJames Smart 	uint32_t data_offset;
3037d7c255b2SJames Smart };
3038d7c255b2SJames Smart 
3039ed957684SJames Smart struct hbq_mask {
3040ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3041ed957684SJames Smart 	uint8_t tmatch;
3042ed957684SJames Smart 	uint8_t tmask;
3043ed957684SJames Smart 	uint8_t rctlmatch;
3044ed957684SJames Smart 	uint8_t rctlmask;
3045ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3046ed957684SJames Smart 	uint8_t rctlmask;
3047ed957684SJames Smart 	uint8_t rctlmatch;
3048ed957684SJames Smart 	uint8_t tmask;
3049ed957684SJames Smart 	uint8_t tmatch;
3050ed957684SJames Smart #endif
3051ed957684SJames Smart };
3052ed957684SJames Smart 
3053ed957684SJames Smart 
3054ed957684SJames Smart /* Structure for MB Command CONFIG_HBQ (7c) */
3055ed957684SJames Smart 
3056ed957684SJames Smart struct config_hbq_var {
3057ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3058ed957684SJames Smart 	uint32_t rsvd1      :7;
3059ed957684SJames Smart 	uint32_t recvNotify :1;     /* Receive Notification */
3060ed957684SJames Smart 	uint32_t numMask    :8;     /* # Mask Entries       */
3061ed957684SJames Smart 	uint32_t profile    :8;     /* Selection Profile    */
3062ed957684SJames Smart 	uint32_t rsvd2      :8;
3063ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3064ed957684SJames Smart 	uint32_t rsvd2      :8;
3065ed957684SJames Smart 	uint32_t profile    :8;     /* Selection Profile    */
3066ed957684SJames Smart 	uint32_t numMask    :8;     /* # Mask Entries       */
3067ed957684SJames Smart 	uint32_t recvNotify :1;     /* Receive Notification */
3068ed957684SJames Smart 	uint32_t rsvd1      :7;
3069ed957684SJames Smart #endif
3070ed957684SJames Smart 
3071ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3072ed957684SJames Smart 	uint32_t hbqId      :16;
3073ed957684SJames Smart 	uint32_t rsvd3      :12;
3074ed957684SJames Smart 	uint32_t ringMask   :4;
3075ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3076ed957684SJames Smart 	uint32_t ringMask   :4;
3077ed957684SJames Smart 	uint32_t rsvd3      :12;
3078ed957684SJames Smart 	uint32_t hbqId      :16;
3079ed957684SJames Smart #endif
3080ed957684SJames Smart 
3081ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3082ed957684SJames Smart 	uint32_t entry_count :16;
3083ed957684SJames Smart 	uint32_t rsvd4        :8;
3084ed957684SJames Smart 	uint32_t headerLen    :8;
3085ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3086ed957684SJames Smart 	uint32_t headerLen    :8;
3087ed957684SJames Smart 	uint32_t rsvd4        :8;
3088ed957684SJames Smart 	uint32_t entry_count :16;
3089ed957684SJames Smart #endif
3090ed957684SJames Smart 
3091ed957684SJames Smart 	uint32_t hbqaddrLow;
3092ed957684SJames Smart 	uint32_t hbqaddrHigh;
3093ed957684SJames Smart 
3094ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3095ed957684SJames Smart 	uint32_t rsvd5      :31;
3096ed957684SJames Smart 	uint32_t logEntry   :1;
3097ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3098ed957684SJames Smart 	uint32_t logEntry   :1;
3099ed957684SJames Smart 	uint32_t rsvd5      :31;
3100ed957684SJames Smart #endif
3101ed957684SJames Smart 
3102ed957684SJames Smart 	uint32_t rsvd6;    /* w7 */
3103ed957684SJames Smart 	uint32_t rsvd7;    /* w8 */
3104ed957684SJames Smart 	uint32_t rsvd8;    /* w9 */
3105ed957684SJames Smart 
3106ed957684SJames Smart 	struct hbq_mask hbqMasks[6];
3107ed957684SJames Smart 
3108ed957684SJames Smart 
3109ed957684SJames Smart 	union {
3110ed957684SJames Smart 		uint32_t allprofiles[12];
3111ed957684SJames Smart 
3112ed957684SJames Smart 		struct {
3113ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3114ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3115ed957684SJames Smart 				uint32_t	maxlen		:16;
3116ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3117ed957684SJames Smart 				uint32_t	maxlen		:16;
3118ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3119ed957684SJames Smart 			#endif
3120ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3121ed957684SJames Smart 				uint32_t	rsvd1		:28;
3122ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3123ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3124ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3125ed957684SJames Smart 				uint32_t	rsvd1		:28;
3126ed957684SJames Smart 			#endif
3127ed957684SJames Smart 			uint32_t rsvd[10];
3128ed957684SJames Smart 		} profile2;
3129ed957684SJames Smart 
3130ed957684SJames Smart 		struct {
3131ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3132ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3133ed957684SJames Smart 				uint32_t	maxlen		:16;
3134ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3135ed957684SJames Smart 				uint32_t	maxlen		:16;
3136ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3137ed957684SJames Smart 			#endif
3138ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3139ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
3140ed957684SJames Smart 				uint32_t	rsvd1		:12;
3141ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3142ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3143ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3144ed957684SJames Smart 				uint32_t	rsvd1		:12;
3145ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
3146ed957684SJames Smart 			#endif
3147ed957684SJames Smart 			uint32_t cmdmatch[8];
3148ed957684SJames Smart 
3149ed957684SJames Smart 			uint32_t rsvd[2];
3150ed957684SJames Smart 		} profile3;
3151ed957684SJames Smart 
3152ed957684SJames Smart 		struct {
3153ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3154ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3155ed957684SJames Smart 				uint32_t	maxlen		:16;
3156ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3157ed957684SJames Smart 				uint32_t	maxlen		:16;
3158ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3159ed957684SJames Smart 			#endif
3160ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3161ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
3162ed957684SJames Smart 				uint32_t	rsvd1		:12;
3163ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3164ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3165ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3166ed957684SJames Smart 				uint32_t	rsvd1		:12;
3167ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
3168ed957684SJames Smart 			#endif
3169ed957684SJames Smart 			uint32_t cmdmatch[8];
3170ed957684SJames Smart 
3171ed957684SJames Smart 			uint32_t rsvd[2];
3172ed957684SJames Smart 		} profile5;
3173ed957684SJames Smart 
3174ed957684SJames Smart 	} profiles;
3175ed957684SJames Smart 
3176ed957684SJames Smart };
3177ed957684SJames Smart 
3178ed957684SJames Smart 
3179dea3101eS 
31802e0fef85SJames Smart /* Structure for MB Command CONFIG_PORT (0x88) */
3181dea3101eS typedef struct {
3182ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3183ed957684SJames Smart 	uint32_t cBE       :  1;
3184ed957684SJames Smart 	uint32_t cET       :  1;
3185ed957684SJames Smart 	uint32_t cHpcb     :  1;
3186ed957684SJames Smart 	uint32_t cMA       :  1;
3187ed957684SJames Smart 	uint32_t sli_mode  :  4;
3188ed957684SJames Smart 	uint32_t pcbLen    : 24;       /* bit 23:0  of memory based port
3189ed957684SJames Smart 					* config block */
3190ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3191ed957684SJames Smart 	uint32_t pcbLen    : 24;       /* bit 23:0  of memory based port
3192ed957684SJames Smart 					* config block */
3193ed957684SJames Smart 	uint32_t sli_mode  :  4;
3194ed957684SJames Smart 	uint32_t cMA       :  1;
3195ed957684SJames Smart 	uint32_t cHpcb     :  1;
3196ed957684SJames Smart 	uint32_t cET       :  1;
3197ed957684SJames Smart 	uint32_t cBE       :  1;
3198ed957684SJames Smart #endif
3199ed957684SJames Smart 
3200dea3101eS 	uint32_t pcbLow;       /* bit 31:0  of memory based port config block */
3201dea3101eS 	uint32_t pcbHigh;      /* bit 63:32 of memory based port config block */
320297207482SJames Smart 	uint32_t hbainit[5];
320397207482SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
320497207482SJames Smart 	uint32_t hps	   :  1; /* bit 31 word9 Host Pointer in slim */
320597207482SJames Smart 	uint32_t rsvd	   : 31; /* least significant 31 bits of word 9 */
320697207482SJames Smart #else   /*  __LITTLE_ENDIAN */
320797207482SJames Smart 	uint32_t rsvd      : 31; /* least significant 31 bits of word 9 */
320897207482SJames Smart 	uint32_t hps	   :  1; /* bit 31 word9 Host Pointer in slim */
320997207482SJames Smart #endif
3210ed957684SJames Smart 
3211ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3212da0436e9SJames Smart 	uint32_t rsvd1     : 19;  /* Reserved                             */
3213da0436e9SJames Smart 	uint32_t cdss      :  1;  /* Configure Data Security SLI          */
3214cb69f7deSJames Smart 	uint32_t casabt    :  1;  /* Configure async abts status notice   */
3215cb69f7deSJames Smart 	uint32_t rsvd2     :  2;  /* Reserved                             */
321681301a9bSJames Smart 	uint32_t cbg       :  1;  /* Configure BlockGuard                 */
3217ed957684SJames Smart 	uint32_t cmv       :  1;  /* Configure Max VPIs                   */
3218ed957684SJames Smart 	uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
3219ed957684SJames Smart 	uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
3220ed957684SJames Smart 	uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
3221ed957684SJames Smart 	uint32_t cinb      :  1;  /* Enable Interrupt Notification Block  */
3222ed957684SJames Smart 	uint32_t cerbm	   :  1;  /* Configure Enhanced Receive Buf Mgmt  */
3223ed957684SJames Smart 	uint32_t cmx	   :  1;  /* Configure Max XRIs                   */
3224ed957684SJames Smart 	uint32_t cmr	   :  1;  /* Configure Max RPIs                   */
3225ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3226ed957684SJames Smart 	uint32_t cmr	   :  1;  /* Configure Max RPIs                   */
3227ed957684SJames Smart 	uint32_t cmx	   :  1;  /* Configure Max XRIs                   */
3228ed957684SJames Smart 	uint32_t cerbm	   :  1;  /* Configure Enhanced Receive Buf Mgmt  */
3229ed957684SJames Smart 	uint32_t cinb      :  1;  /* Enable Interrupt Notification Block  */
3230ed957684SJames Smart 	uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
3231ed957684SJames Smart 	uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
3232ed957684SJames Smart 	uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
3233ed957684SJames Smart 	uint32_t cmv	   :  1;  /* Configure Max VPIs                   */
323481301a9bSJames Smart 	uint32_t cbg       :  1;  /* Configure BlockGuard                 */
3235cb69f7deSJames Smart 	uint32_t rsvd2     :  2;  /* Reserved                             */
3236cb69f7deSJames Smart 	uint32_t casabt    :  1;  /* Configure async abts status notice   */
3237da0436e9SJames Smart 	uint32_t cdss      :  1;  /* Configure Data Security SLI          */
3238da0436e9SJames Smart 	uint32_t rsvd1     : 19;  /* Reserved                             */
3239ed957684SJames Smart #endif
3240ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3241da0436e9SJames Smart 	uint32_t rsvd3     : 19;  /* Reserved                             */
3242da0436e9SJames Smart 	uint32_t gdss      :  1;  /* Configure Data Security SLI          */
3243cb69f7deSJames Smart 	uint32_t gasabt    :  1;  /* Grant async abts status notice       */
3244cb69f7deSJames Smart 	uint32_t rsvd4     :  2;  /* Reserved                             */
324581301a9bSJames Smart 	uint32_t gbg       :  1;  /* Grant BlockGuard                     */
3246ed957684SJames Smart 	uint32_t gmv	   :  1;  /* Grant Max VPIs                       */
3247ed957684SJames Smart 	uint32_t gcrp	   :  1;  /* Grant Command Ring Polling           */
3248ed957684SJames Smart 	uint32_t gsah	   :  1;  /* Grant Synchronous Abort Handling     */
3249ed957684SJames Smart 	uint32_t ghbs	   :  1;  /* Grant Host Backing Store             */
3250ed957684SJames Smart 	uint32_t ginb	   :  1;  /* Grant Interrupt Notification Block   */
3251ed957684SJames Smart 	uint32_t gerbm	   :  1;  /* Grant ERBM Request                   */
3252ed957684SJames Smart 	uint32_t gmx	   :  1;  /* Grant Max XRIs                       */
3253ed957684SJames Smart 	uint32_t gmr	   :  1;  /* Grant Max RPIs                       */
3254ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3255ed957684SJames Smart 	uint32_t gmr	   :  1;  /* Grant Max RPIs                       */
3256ed957684SJames Smart 	uint32_t gmx	   :  1;  /* Grant Max XRIs                       */
3257ed957684SJames Smart 	uint32_t gerbm	   :  1;  /* Grant ERBM Request                   */
3258ed957684SJames Smart 	uint32_t ginb	   :  1;  /* Grant Interrupt Notification Block   */
3259ed957684SJames Smart 	uint32_t ghbs	   :  1;  /* Grant Host Backing Store             */
3260ed957684SJames Smart 	uint32_t gsah	   :  1;  /* Grant Synchronous Abort Handling     */
3261ed957684SJames Smart 	uint32_t gcrp	   :  1;  /* Grant Command Ring Polling           */
3262ed957684SJames Smart 	uint32_t gmv	   :  1;  /* Grant Max VPIs                       */
326381301a9bSJames Smart 	uint32_t gbg       :  1;  /* Grant BlockGuard                     */
3264cb69f7deSJames Smart 	uint32_t rsvd4     :  2;  /* Reserved                             */
3265cb69f7deSJames Smart 	uint32_t gasabt    :  1;  /* Grant async abts status notice       */
3266da0436e9SJames Smart 	uint32_t gdss      :  1;  /* Configure Data Security SLI          */
3267da0436e9SJames Smart 	uint32_t rsvd3     : 19;  /* Reserved                             */
3268ed957684SJames Smart #endif
3269ed957684SJames Smart 
3270ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3271ed957684SJames Smart 	uint32_t max_rpi   : 16;  /* Max RPIs Port should configure       */
3272ed957684SJames Smart 	uint32_t max_xri   : 16;  /* Max XRIs Port should configure       */
3273ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3274ed957684SJames Smart 	uint32_t max_xri   : 16;  /* Max XRIs Port should configure       */
3275ed957684SJames Smart 	uint32_t max_rpi   : 16;  /* Max RPIs Port should configure       */
3276ed957684SJames Smart #endif
3277ed957684SJames Smart 
3278ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3279ed957684SJames Smart 	uint32_t max_hbq   : 16;  /* Max HBQs Host expect to configure    */
3280da0436e9SJames Smart 	uint32_t rsvd5     : 16;  /* Max HBQs Host expect to configure    */
3281ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3282da0436e9SJames Smart 	uint32_t rsvd5     : 16;  /* Max HBQs Host expect to configure    */
3283ed957684SJames Smart 	uint32_t max_hbq   : 16;  /* Max HBQs Host expect to configure    */
3284ed957684SJames Smart #endif
3285ed957684SJames Smart 
3286da0436e9SJames Smart 	uint32_t rsvd6;           /* Reserved                             */
3287ed957684SJames Smart 
3288ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3289bc73905aSJames Smart 	uint32_t fips_rev   : 3;   /* FIPS Spec Revision                   */
3290bc73905aSJames Smart 	uint32_t fips_level : 4;   /* FIPS Level                           */
3291bc73905aSJames Smart 	uint32_t sec_err    : 9;   /* security crypto error                */
3292ed957684SJames Smart 	uint32_t max_vpi    : 16;  /* Max number of virt N-Ports           */
3293ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3294ed957684SJames Smart 	uint32_t max_vpi    : 16;  /* Max number of virt N-Ports           */
3295bc73905aSJames Smart 	uint32_t sec_err    : 9;   /* security crypto error                */
3296bc73905aSJames Smart 	uint32_t fips_level : 4;   /* FIPS Level                           */
3297bc73905aSJames Smart 	uint32_t fips_rev   : 3;   /* FIPS Spec Revision                   */
3298ed957684SJames Smart #endif
3299ed957684SJames Smart 
3300dea3101eS } CONFIG_PORT_VAR;
3301dea3101eS 
33029399627fSJames Smart /* Structure for MB Command CONFIG_MSI (0x30) */
33039399627fSJames Smart struct config_msi_var {
33049399627fSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
33059399627fSJames Smart 	uint32_t dfltMsgNum:8;	/* Default message number            */
33069399627fSJames Smart 	uint32_t rsvd1:11;	/* Reserved                          */
33079399627fSJames Smart 	uint32_t NID:5;		/* Number of secondary attention IDs */
33089399627fSJames Smart 	uint32_t rsvd2:5;	/* Reserved                          */
33099399627fSJames Smart 	uint32_t dfltPresent:1;	/* Default message number present    */
33109399627fSJames Smart 	uint32_t addFlag:1;	/* Add association flag              */
33119399627fSJames Smart 	uint32_t reportFlag:1;	/* Report association flag           */
33129399627fSJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
33139399627fSJames Smart 	uint32_t reportFlag:1;	/* Report association flag           */
33149399627fSJames Smart 	uint32_t addFlag:1;	/* Add association flag              */
33159399627fSJames Smart 	uint32_t dfltPresent:1;	/* Default message number present    */
33169399627fSJames Smart 	uint32_t rsvd2:5;	/* Reserved                          */
33179399627fSJames Smart 	uint32_t NID:5;		/* Number of secondary attention IDs */
33189399627fSJames Smart 	uint32_t rsvd1:11;	/* Reserved                          */
33199399627fSJames Smart 	uint32_t dfltMsgNum:8;	/* Default message number            */
33209399627fSJames Smart #endif
33219399627fSJames Smart 	uint32_t attentionConditions[2];
33229399627fSJames Smart 	uint8_t  attentionId[16];
33239399627fSJames Smart 	uint8_t  messageNumberByHA[64];
33249399627fSJames Smart 	uint8_t  messageNumberByID[16];
33259399627fSJames Smart 	uint32_t autoClearHA[2];
33269399627fSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
33279399627fSJames Smart 	uint32_t rsvd3:16;
33289399627fSJames Smart 	uint32_t autoClearID:16;
33299399627fSJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
33309399627fSJames Smart 	uint32_t autoClearID:16;
33319399627fSJames Smart 	uint32_t rsvd3:16;
33329399627fSJames Smart #endif
33339399627fSJames Smart 	uint32_t rsvd4;
33349399627fSJames Smart };
33359399627fSJames Smart 
3336dea3101eS /* SLI-2 Port Control Block */
3337dea3101eS 
3338dea3101eS /* SLIM POINTER */
3339dea3101eS #define SLIMOFF 0x30		/* WORD */
3340dea3101eS 
3341dea3101eS typedef struct _SLI2_RDSC {
3342dea3101eS 	uint32_t cmdEntries;
3343dea3101eS 	uint32_t cmdAddrLow;
3344dea3101eS 	uint32_t cmdAddrHigh;
3345dea3101eS 
3346dea3101eS 	uint32_t rspEntries;
3347dea3101eS 	uint32_t rspAddrLow;
3348dea3101eS 	uint32_t rspAddrHigh;
3349dea3101eS } SLI2_RDSC;
3350dea3101eS 
3351dea3101eS typedef struct _PCB {
3352dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3353dea3101eS 	uint32_t type:8;
3354497888cfSPhil Carmody #define TYPE_NATIVE_SLI2       0x01
3355dea3101eS 	uint32_t feature:8;
3356497888cfSPhil Carmody #define FEATURE_INITIAL_SLI2   0x01
3357dea3101eS 	uint32_t rsvd:12;
3358dea3101eS 	uint32_t maxRing:4;
3359dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3360dea3101eS 	uint32_t maxRing:4;
3361dea3101eS 	uint32_t rsvd:12;
3362dea3101eS 	uint32_t feature:8;
3363497888cfSPhil Carmody #define FEATURE_INITIAL_SLI2   0x01
3364dea3101eS 	uint32_t type:8;
3365497888cfSPhil Carmody #define TYPE_NATIVE_SLI2       0x01
3366dea3101eS #endif
3367dea3101eS 
3368dea3101eS 	uint32_t mailBoxSize;
3369dea3101eS 	uint32_t mbAddrLow;
3370dea3101eS 	uint32_t mbAddrHigh;
3371dea3101eS 
3372dea3101eS 	uint32_t hgpAddrLow;
3373dea3101eS 	uint32_t hgpAddrHigh;
3374dea3101eS 
3375dea3101eS 	uint32_t pgpAddrLow;
3376dea3101eS 	uint32_t pgpAddrHigh;
33772a76a283SJames Smart 	SLI2_RDSC rdsc[MAX_SLI3_RINGS];
3378dea3101eS } PCB_t;
3379dea3101eS 
3380dea3101eS /* NEW_FEATURE */
3381dea3101eS typedef struct {
3382dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3383dea3101eS 	uint32_t rsvd0:27;
3384dea3101eS 	uint32_t discardFarp:1;
3385dea3101eS 	uint32_t IPEnable:1;
3386dea3101eS 	uint32_t nodeName:1;
3387dea3101eS 	uint32_t portName:1;
3388dea3101eS 	uint32_t filterEnable:1;
3389dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3390dea3101eS 	uint32_t filterEnable:1;
3391dea3101eS 	uint32_t portName:1;
3392dea3101eS 	uint32_t nodeName:1;
3393dea3101eS 	uint32_t IPEnable:1;
3394dea3101eS 	uint32_t discardFarp:1;
3395dea3101eS 	uint32_t rsvd:27;
3396dea3101eS #endif
3397dea3101eS 
3398dea3101eS 	uint8_t portname[8];	/* Used to be struct lpfc_name */
3399dea3101eS 	uint8_t nodename[8];
3400dea3101eS 	uint32_t rsvd1;
3401dea3101eS 	uint32_t rsvd2;
3402dea3101eS 	uint32_t rsvd3;
3403dea3101eS 	uint32_t IPAddress;
3404dea3101eS } CONFIG_FARP_VAR;
3405dea3101eS 
340657127f15SJames Smart /* Structure for MB Command MBX_ASYNCEVT_ENABLE (0x33) */
340757127f15SJames Smart 
340857127f15SJames Smart typedef struct {
340957127f15SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
341057127f15SJames Smart 	uint32_t rsvd:30;
341157127f15SJames Smart 	uint32_t ring:2;	/* Ring for ASYNC_EVENT iocb Bits 0-1*/
341257127f15SJames Smart #else /*  __LITTLE_ENDIAN */
341357127f15SJames Smart 	uint32_t ring:2;	/* Ring for ASYNC_EVENT iocb Bits 0-1*/
341457127f15SJames Smart 	uint32_t rsvd:30;
341557127f15SJames Smart #endif
341657127f15SJames Smart } ASYNCEVT_ENABLE_VAR;
341757127f15SJames Smart 
3418dea3101eS /* Union of all Mailbox Command types */
3419dea3101eS #define MAILBOX_CMD_WSIZE	32
3420dea3101eS #define MAILBOX_CMD_SIZE	(MAILBOX_CMD_WSIZE * sizeof(uint32_t))
34217a470277SJames Smart /* ext_wsize times 4 bytes should not be greater than max xmit size */
34227a470277SJames Smart #define MAILBOX_EXT_WSIZE	512
34237a470277SJames Smart #define MAILBOX_EXT_SIZE	(MAILBOX_EXT_WSIZE * sizeof(uint32_t))
34247a470277SJames Smart #define MAILBOX_HBA_EXT_OFFSET  0x100
34257a470277SJames Smart /* max mbox xmit size is a page size for sysfs IO operations */
3426c0c11512SJames Smart #define MAILBOX_SYSFS_MAX	4096
3427dea3101eS 
3428dea3101eS typedef union {
3429ed957684SJames Smart 	uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/
3430ed957684SJames Smart 						    * feature/max ring number
3431ed957684SJames Smart 						    */
3432dea3101eS 	LOAD_SM_VAR varLdSM;		/* cmd =  1 (LOAD_SM)        */
3433dea3101eS 	READ_NV_VAR varRDnvp;		/* cmd =  2 (READ_NVPARMS)   */
3434dea3101eS 	WRITE_NV_VAR varWTnvp;		/* cmd =  3 (WRITE_NVPARMS)  */
3435dea3101eS 	BIU_DIAG_VAR varBIUdiag;	/* cmd =  4 (RUN_BIU_DIAG)   */
3436dea3101eS 	INIT_LINK_VAR varInitLnk;	/* cmd =  5 (INIT_LINK)      */
3437dea3101eS 	DOWN_LINK_VAR varDwnLnk;	/* cmd =  6 (DOWN_LINK)      */
3438dea3101eS 	CONFIG_LINK varCfgLnk;		/* cmd =  7 (CONFIG_LINK)    */
3439dea3101eS 	PART_SLIM_VAR varSlim;		/* cmd =  8 (PART_SLIM)      */
3440dea3101eS 	CONFIG_RING_VAR varCfgRing;	/* cmd =  9 (CONFIG_RING)    */
3441dea3101eS 	RESET_RING_VAR varRstRing;	/* cmd = 10 (RESET_RING)     */
3442dea3101eS 	READ_CONFIG_VAR varRdConfig;	/* cmd = 11 (READ_CONFIG)    */
3443dea3101eS 	READ_RCONF_VAR varRdRConfig;	/* cmd = 12 (READ_RCONFIG)   */
3444dea3101eS 	READ_SPARM_VAR varRdSparm;	/* cmd = 13 (READ_SPARM(64)) */
3445dea3101eS 	READ_STATUS_VAR varRdStatus;	/* cmd = 14 (READ_STATUS)    */
3446dea3101eS 	READ_RPI_VAR varRdRPI;		/* cmd = 15 (READ_RPI(64))   */
3447dea3101eS 	READ_XRI_VAR varRdXRI;		/* cmd = 16 (READ_XRI)       */
3448dea3101eS 	READ_REV_VAR varRdRev;		/* cmd = 17 (READ_REV)       */
3449dea3101eS 	READ_LNK_VAR varRdLnk;		/* cmd = 18 (READ_LNK_STAT)  */
3450dea3101eS 	REG_LOGIN_VAR varRegLogin;	/* cmd = 19 (REG_LOGIN(64))  */
3451dea3101eS 	UNREG_LOGIN_VAR varUnregLogin;	/* cmd = 20 (UNREG_LOGIN)    */
3452dea3101eS 	CLEAR_LA_VAR varClearLA;	/* cmd = 22 (CLEAR_LA)       */
3453dea3101eS 	DUMP_VAR varDmp;		/* Warm Start DUMP mbx cmd   */
3454dea3101eS 	UNREG_D_ID_VAR varUnregDID;	/* cmd = 0x23 (UNREG_D_ID)   */
3455ed957684SJames Smart 	CONFIG_FARP_VAR varCfgFarp;	/* cmd = 0x25 (CONFIG_FARP)
3456ed957684SJames Smart 					 * NEW_FEATURE
3457ed957684SJames Smart 					 */
3458ed957684SJames Smart 	struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ)  */
3459d7c255b2SJames Smart 	struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/
3460dea3101eS 	CONFIG_PORT_VAR varCfgPort;	/* cmd = 0x88 (CONFIG_PORT)  */
346176a95d75SJames Smart 	struct lpfc_mbx_read_top varReadTop; /* cmd = 0x95 (READ_TOPOLOGY) */
346292d7f7b0SJames Smart 	REG_VPI_VAR varRegVpi;		/* cmd = 0x96 (REG_VPI) */
346392d7f7b0SJames Smart 	UNREG_VPI_VAR varUnregVpi;	/* cmd = 0x97 (UNREG_VPI) */
346457127f15SJames Smart 	ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */
3465c7495937SJames Smart 	struct READ_EVENT_LOG_VAR varRdEventLog;	/* cmd = 0x38
3466c7495937SJames Smart 							 * (READ_EVENT_LOG)
3467c7495937SJames Smart 							 */
34689399627fSJames Smart 	struct config_msi_var varCfgMSI;/* cmd = x30 (CONFIG_MSI)     */
3469dea3101eS } MAILVARIANTS;
3470dea3101eS 
3471dea3101eS /*
3472dea3101eS  * SLI-2 specific structures
3473dea3101eS  */
3474dea3101eS 
34754cc2da1dSJames.Smart@Emulex.Com struct lpfc_hgp {
34764cc2da1dSJames.Smart@Emulex.Com 	__le32 cmdPutInx;
34774cc2da1dSJames.Smart@Emulex.Com 	__le32 rspGetInx;
34784cc2da1dSJames.Smart@Emulex.Com };
3479dea3101eS 
34804cc2da1dSJames.Smart@Emulex.Com struct lpfc_pgp {
34814cc2da1dSJames.Smart@Emulex.Com 	__le32 cmdGetInx;
34824cc2da1dSJames.Smart@Emulex.Com 	__le32 rspPutInx;
34834cc2da1dSJames.Smart@Emulex.Com };
3484dea3101eS 
3485ed957684SJames Smart struct sli2_desc {
3486dea3101eS 	uint32_t unused1[16];
34872a76a283SJames Smart 	struct lpfc_hgp host[MAX_SLI3_RINGS];
34882a76a283SJames Smart 	struct lpfc_pgp port[MAX_SLI3_RINGS];
3489ed957684SJames Smart };
3490ed957684SJames Smart 
3491ed957684SJames Smart struct sli3_desc {
34922a76a283SJames Smart 	struct lpfc_hgp host[MAX_SLI3_RINGS];
3493ed957684SJames Smart 	uint32_t reserved[8];
3494ed957684SJames Smart 	uint32_t hbq_put[16];
3495ed957684SJames Smart };
3496ed957684SJames Smart 
3497ed957684SJames Smart struct sli3_pgp {
34982a76a283SJames Smart 	struct lpfc_pgp port[MAX_SLI3_RINGS];
3499ed957684SJames Smart 	uint32_t hbq_get[16];
3500ed957684SJames Smart };
3501dea3101eS 
350234b02dcdSJames Smart union sli_var {
3503ed957684SJames Smart 	struct sli2_desc	s2;
3504ed957684SJames Smart 	struct sli3_desc	s3;
3505ed957684SJames Smart 	struct sli3_pgp		s3_pgp;
350634b02dcdSJames Smart };
3507dea3101eS 
3508dea3101eS typedef struct {
3509dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3510dea3101eS 	uint16_t mbxStatus;
3511dea3101eS 	uint8_t mbxCommand;
3512dea3101eS 	uint8_t mbxReserved:6;
3513dea3101eS 	uint8_t mbxHc:1;
3514dea3101eS 	uint8_t mbxOwner:1;	/* Low order bit first word */
3515dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3516dea3101eS 	uint8_t mbxOwner:1;	/* Low order bit first word */
3517dea3101eS 	uint8_t mbxHc:1;
3518dea3101eS 	uint8_t mbxReserved:6;
3519dea3101eS 	uint8_t mbxCommand;
3520dea3101eS 	uint16_t mbxStatus;
3521dea3101eS #endif
3522dea3101eS 
3523dea3101eS 	MAILVARIANTS un;
352434b02dcdSJames Smart 	union sli_var us;
3525dea3101eS } MAILBOX_t;
3526dea3101eS 
3527dea3101eS /*
3528dea3101eS  *    Begin Structure Definitions for IOCB Commands
3529dea3101eS  */
3530dea3101eS 
3531dea3101eS typedef struct {
3532dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3533dea3101eS 	uint8_t statAction;
3534dea3101eS 	uint8_t statRsn;
3535dea3101eS 	uint8_t statBaExp;
3536dea3101eS 	uint8_t statLocalError;
3537dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3538dea3101eS 	uint8_t statLocalError;
3539dea3101eS 	uint8_t statBaExp;
3540dea3101eS 	uint8_t statRsn;
3541dea3101eS 	uint8_t statAction;
3542dea3101eS #endif
3543dea3101eS 	/* statRsn  P/F_RJT reason codes */
3544dea3101eS #define RJT_BAD_D_ID       0x01	/* Invalid D_ID field */
3545dea3101eS #define RJT_BAD_S_ID       0x02	/* Invalid S_ID field */
3546dea3101eS #define RJT_UNAVAIL_TEMP   0x03	/* N_Port unavailable temp. */
3547dea3101eS #define RJT_UNAVAIL_PERM   0x04	/* N_Port unavailable perm. */
3548dea3101eS #define RJT_UNSUP_CLASS    0x05	/* Class not supported */
3549dea3101eS #define RJT_DELIM_ERR      0x06	/* Delimiter usage error */
3550dea3101eS #define RJT_UNSUP_TYPE     0x07	/* Type not supported */
3551dea3101eS #define RJT_BAD_CONTROL    0x08	/* Invalid link conrtol */
3552dea3101eS #define RJT_BAD_RCTL       0x09	/* R_CTL invalid */
3553dea3101eS #define RJT_BAD_FCTL       0x0A	/* F_CTL invalid */
3554dea3101eS #define RJT_BAD_OXID       0x0B	/* OX_ID invalid */
3555dea3101eS #define RJT_BAD_RXID       0x0C	/* RX_ID invalid */
3556dea3101eS #define RJT_BAD_SEQID      0x0D	/* SEQ_ID invalid */
3557dea3101eS #define RJT_BAD_DFCTL      0x0E	/* DF_CTL invalid */
3558dea3101eS #define RJT_BAD_SEQCNT     0x0F	/* SEQ_CNT invalid */
3559dea3101eS #define RJT_BAD_PARM       0x10	/* Param. field invalid */
3560dea3101eS #define RJT_XCHG_ERR       0x11	/* Exchange error */
3561dea3101eS #define RJT_PROT_ERR       0x12	/* Protocol error */
3562dea3101eS #define RJT_BAD_LENGTH     0x13	/* Invalid Length */
3563dea3101eS #define RJT_UNEXPECTED_ACK 0x14	/* Unexpected ACK */
3564dea3101eS #define RJT_LOGIN_REQUIRED 0x16	/* Login required */
3565dea3101eS #define RJT_TOO_MANY_SEQ   0x17	/* Excessive sequences */
3566dea3101eS #define RJT_XCHG_NOT_STRT  0x18	/* Exchange not started */
3567dea3101eS #define RJT_UNSUP_SEC_HDR  0x19	/* Security hdr not supported */
3568dea3101eS #define RJT_UNAVAIL_PATH   0x1A	/* Fabric Path not available */
3569dea3101eS #define RJT_VENDOR_UNIQUE  0xFF	/* Vendor unique error */
3570dea3101eS 
3571dea3101eS #define IOERR_SUCCESS                 0x00	/* statLocalError */
3572dea3101eS #define IOERR_MISSING_CONTINUE        0x01
3573dea3101eS #define IOERR_SEQUENCE_TIMEOUT        0x02
3574dea3101eS #define IOERR_INTERNAL_ERROR          0x03
3575dea3101eS #define IOERR_INVALID_RPI             0x04
3576dea3101eS #define IOERR_NO_XRI                  0x05
3577dea3101eS #define IOERR_ILLEGAL_COMMAND         0x06
3578dea3101eS #define IOERR_XCHG_DROPPED            0x07
3579dea3101eS #define IOERR_ILLEGAL_FIELD           0x08
3580dea3101eS #define IOERR_BAD_CONTINUE            0x09
3581dea3101eS #define IOERR_TOO_MANY_BUFFERS        0x0A
3582dea3101eS #define IOERR_RCV_BUFFER_WAITING      0x0B
3583dea3101eS #define IOERR_NO_CONNECTION           0x0C
3584dea3101eS #define IOERR_TX_DMA_FAILED           0x0D
3585dea3101eS #define IOERR_RX_DMA_FAILED           0x0E
3586dea3101eS #define IOERR_ILLEGAL_FRAME           0x0F
3587dea3101eS #define IOERR_EXTRA_DATA              0x10
3588dea3101eS #define IOERR_NO_RESOURCES            0x11
3589dea3101eS #define IOERR_RESERVED                0x12
3590dea3101eS #define IOERR_ILLEGAL_LENGTH          0x13
3591dea3101eS #define IOERR_UNSUPPORTED_FEATURE     0x14
3592dea3101eS #define IOERR_ABORT_IN_PROGRESS       0x15
3593dea3101eS #define IOERR_ABORT_REQUESTED         0x16
3594dea3101eS #define IOERR_RECEIVE_BUFFER_TIMEOUT  0x17
3595dea3101eS #define IOERR_LOOP_OPEN_FAILURE       0x18
3596dea3101eS #define IOERR_RING_RESET              0x19
3597dea3101eS #define IOERR_LINK_DOWN               0x1A
3598dea3101eS #define IOERR_CORRUPTED_DATA          0x1B
3599dea3101eS #define IOERR_CORRUPTED_RPI           0x1C
3600dea3101eS #define IOERR_OUT_OF_ORDER_DATA       0x1D
3601dea3101eS #define IOERR_OUT_OF_ORDER_ACK        0x1E
3602dea3101eS #define IOERR_DUP_FRAME               0x1F
3603dea3101eS #define IOERR_LINK_CONTROL_FRAME      0x20	/* ACK_N received */
3604dea3101eS #define IOERR_BAD_HOST_ADDRESS        0x21
3605dea3101eS #define IOERR_RCV_HDRBUF_WAITING      0x22
3606dea3101eS #define IOERR_MISSING_HDR_BUFFER      0x23
3607dea3101eS #define IOERR_MSEQ_CHAIN_CORRUPTED    0x24
3608dea3101eS #define IOERR_ABORTMULT_REQUESTED     0x25
3609dea3101eS #define IOERR_BUFFER_SHORTAGE         0x28
3610dea3101eS #define IOERR_DEFAULT                 0x29
3611dea3101eS #define IOERR_CNT                     0x2A
3612b92938b4SJames Smart #define IOERR_SLER_FAILURE            0x46
3613b92938b4SJames Smart #define IOERR_SLER_CMD_RCV_FAILURE    0x47
3614b92938b4SJames Smart #define IOERR_SLER_REC_RJT_ERR        0x48
3615b92938b4SJames Smart #define IOERR_SLER_REC_SRR_RETRY_ERR  0x49
3616b92938b4SJames Smart #define IOERR_SLER_SRR_RJT_ERR        0x4A
3617b92938b4SJames Smart #define IOERR_SLER_RRQ_RJT_ERR        0x4C
3618b92938b4SJames Smart #define IOERR_SLER_RRQ_RETRY_ERR      0x4D
3619b92938b4SJames Smart #define IOERR_SLER_ABTS_ERR           0x4E
3620ab56dc2eSJames Smart #define IOERR_ELXSEC_KEY_UNWRAP_ERROR		0xF0
3621ab56dc2eSJames Smart #define IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR	0xF1
3622ab56dc2eSJames Smart #define IOERR_ELXSEC_CRYPTO_ERROR		0xF2
3623ab56dc2eSJames Smart #define IOERR_ELXSEC_CRYPTO_COMPARE_ERROR	0xF3
3624dea3101eS #define IOERR_DRVR_MASK               0x100
3625dea3101eS #define IOERR_SLI_DOWN                0x101  /* ulpStatus  - Driver defined */
3626dea3101eS #define IOERR_SLI_BRESET              0x102
3627dea3101eS #define IOERR_SLI_ABORTED             0x103
3628e3d2b802SJames Smart #define IOERR_PARAM_MASK              0x1ff
3629dea3101eS } PARM_ERR;
3630dea3101eS 
3631dea3101eS typedef union {
3632dea3101eS 	struct {
3633dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3634dea3101eS 		uint8_t Rctl;	/* R_CTL field */
3635dea3101eS 		uint8_t Type;	/* TYPE field */
3636dea3101eS 		uint8_t Dfctl;	/* DF_CTL field */
3637dea3101eS 		uint8_t Fctl;	/* Bits 0-7 of IOCB word 5 */
3638dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3639dea3101eS 		uint8_t Fctl;	/* Bits 0-7 of IOCB word 5 */
3640dea3101eS 		uint8_t Dfctl;	/* DF_CTL field */
3641dea3101eS 		uint8_t Type;	/* TYPE field */
3642dea3101eS 		uint8_t Rctl;	/* R_CTL field */
3643dea3101eS #endif
3644dea3101eS 
3645dea3101eS #define BC      0x02		/* Broadcast Received  - Fctl */
3646dea3101eS #define SI      0x04		/* Sequence Initiative */
3647dea3101eS #define LA      0x08		/* Ignore Link Attention state */
3648dea3101eS #define LS      0x80		/* Last Sequence */
3649dea3101eS 	} hcsw;
3650dea3101eS 	uint32_t reserved;
3651dea3101eS } WORD5;
3652dea3101eS 
3653dea3101eS /* IOCB Command template for a generic response */
3654dea3101eS typedef struct {
3655dea3101eS 	uint32_t reserved[4];
3656dea3101eS 	PARM_ERR perr;
3657dea3101eS } GENERIC_RSP;
3658dea3101eS 
3659dea3101eS /* IOCB Command template for XMIT / XMIT_BCAST / RCV_SEQUENCE / XMIT_ELS */
3660dea3101eS typedef struct {
3661dea3101eS 	struct ulp_bde xrsqbde[2];
3662dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3663dea3101eS 	WORD5 w5;		/* Header control/status word */
3664dea3101eS } XR_SEQ_FIELDS;
3665dea3101eS 
3666dea3101eS /* IOCB Command template for ELS_REQUEST */
3667dea3101eS typedef struct {
3668dea3101eS 	struct ulp_bde elsReq;
3669dea3101eS 	struct ulp_bde elsRsp;
3670dea3101eS 
3671dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3672dea3101eS 	uint32_t word4Rsvd:7;
3673dea3101eS 	uint32_t fl:1;
3674dea3101eS 	uint32_t myID:24;
3675dea3101eS 	uint32_t word5Rsvd:8;
3676dea3101eS 	uint32_t remoteID:24;
3677dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3678dea3101eS 	uint32_t myID:24;
3679dea3101eS 	uint32_t fl:1;
3680dea3101eS 	uint32_t word4Rsvd:7;
3681dea3101eS 	uint32_t remoteID:24;
3682dea3101eS 	uint32_t word5Rsvd:8;
3683dea3101eS #endif
3684dea3101eS } ELS_REQUEST;
3685dea3101eS 
3686dea3101eS /* IOCB Command template for RCV_ELS_REQ */
3687dea3101eS typedef struct {
3688dea3101eS 	struct ulp_bde elsReq[2];
3689dea3101eS 	uint32_t parmRo;
3690dea3101eS 
3691dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3692dea3101eS 	uint32_t word5Rsvd:8;
3693dea3101eS 	uint32_t remoteID:24;
3694dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3695dea3101eS 	uint32_t remoteID:24;
3696dea3101eS 	uint32_t word5Rsvd:8;
3697dea3101eS #endif
3698dea3101eS } RCV_ELS_REQ;
3699dea3101eS 
3700dea3101eS /* IOCB Command template for ABORT / CLOSE_XRI */
3701dea3101eS typedef struct {
3702dea3101eS 	uint32_t rsvd[3];
3703dea3101eS 	uint32_t abortType;
3704dea3101eS #define ABORT_TYPE_ABTX  0x00000000
3705dea3101eS #define ABORT_TYPE_ABTS  0x00000001
3706dea3101eS 	uint32_t parm;
3707dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3708dea3101eS 	uint16_t abortContextTag; /* ulpContext from command to abort/close */
3709dea3101eS 	uint16_t abortIoTag;	/* ulpIoTag from command to abort/close */
3710dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3711dea3101eS 	uint16_t abortIoTag;	/* ulpIoTag from command to abort/close */
3712dea3101eS 	uint16_t abortContextTag; /* ulpContext from command to abort/close */
3713dea3101eS #endif
3714dea3101eS } AC_XRI;
3715dea3101eS 
3716dea3101eS /* IOCB Command template for ABORT_MXRI64 */
3717dea3101eS typedef struct {
3718dea3101eS 	uint32_t rsvd[3];
3719dea3101eS 	uint32_t abortType;
3720dea3101eS 	uint32_t parm;
3721dea3101eS 	uint32_t iotag32;
3722dea3101eS } A_MXRI64;
3723dea3101eS 
3724dea3101eS /* IOCB Command template for GET_RPI */
3725dea3101eS typedef struct {
3726dea3101eS 	uint32_t rsvd[4];
3727dea3101eS 	uint32_t parmRo;
3728dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3729dea3101eS 	uint32_t word5Rsvd:8;
3730dea3101eS 	uint32_t remoteID:24;
3731dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3732dea3101eS 	uint32_t remoteID:24;
3733dea3101eS 	uint32_t word5Rsvd:8;
3734dea3101eS #endif
3735dea3101eS } GET_RPI;
3736dea3101eS 
3737dea3101eS /* IOCB Command template for all FCP Initiator commands */
3738dea3101eS typedef struct {
3739dea3101eS 	struct ulp_bde fcpi_cmnd;	/* FCP_CMND payload descriptor */
3740dea3101eS 	struct ulp_bde fcpi_rsp;	/* Rcv buffer */
3741dea3101eS 	uint32_t fcpi_parm;
3742dea3101eS 	uint32_t fcpi_XRdy;	/* transfer ready for IWRITE */
3743dea3101eS } FCPI_FIELDS;
3744dea3101eS 
3745dea3101eS /* IOCB Command template for all FCP Target commands */
3746dea3101eS typedef struct {
3747dea3101eS 	struct ulp_bde fcpt_Buffer[2];	/* FCP_CMND payload descriptor */
3748dea3101eS 	uint32_t fcpt_Offset;
3749dea3101eS 	uint32_t fcpt_Length;	/* transfer ready for IWRITE */
3750dea3101eS } FCPT_FIELDS;
3751dea3101eS 
3752dea3101eS /* SLI-2 IOCB structure definitions */
3753dea3101eS 
3754dea3101eS /* IOCB Command template for 64 bit XMIT / XMIT_BCAST / XMIT_ELS */
3755dea3101eS typedef struct {
3756dea3101eS 	ULP_BDL bdl;
3757dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3758dea3101eS 	WORD5 w5;		/* Header control/status word */
3759dea3101eS } XMT_SEQ_FIELDS64;
3760dea3101eS 
3761939723a4SJames Smart /* This word is remote ports D_ID for XMIT_ELS_RSP64 */
3762939723a4SJames Smart #define xmit_els_remoteID xrsqRo
3763939723a4SJames Smart 
3764dea3101eS /* IOCB Command template for 64 bit RCV_SEQUENCE64 */
3765dea3101eS typedef struct {
3766dea3101eS 	struct ulp_bde64 rcvBde;
3767dea3101eS 	uint32_t rsvd1;
3768dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3769dea3101eS 	WORD5 w5;		/* Header control/status word */
3770dea3101eS } RCV_SEQ_FIELDS64;
3771dea3101eS 
3772dea3101eS /* IOCB Command template for ELS_REQUEST64 */
3773dea3101eS typedef struct {
3774dea3101eS 	ULP_BDL bdl;
3775dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3776dea3101eS 	uint32_t word4Rsvd:7;
3777dea3101eS 	uint32_t fl:1;
3778dea3101eS 	uint32_t myID:24;
3779dea3101eS 	uint32_t word5Rsvd:8;
3780dea3101eS 	uint32_t remoteID:24;
3781dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3782dea3101eS 	uint32_t myID:24;
3783dea3101eS 	uint32_t fl:1;
3784dea3101eS 	uint32_t word4Rsvd:7;
3785dea3101eS 	uint32_t remoteID:24;
3786dea3101eS 	uint32_t word5Rsvd:8;
3787dea3101eS #endif
3788dea3101eS } ELS_REQUEST64;
3789dea3101eS 
3790dea3101eS /* IOCB Command template for GEN_REQUEST64 */
3791dea3101eS typedef struct {
3792dea3101eS 	ULP_BDL bdl;
3793dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3794dea3101eS 	WORD5 w5;		/* Header control/status word */
3795dea3101eS } GEN_REQUEST64;
3796dea3101eS 
3797dea3101eS /* IOCB Command template for RCV_ELS_REQ64 */
3798dea3101eS typedef struct {
3799dea3101eS 	struct ulp_bde64 elsReq;
3800dea3101eS 	uint32_t rcvd1;
3801dea3101eS 	uint32_t parmRo;
3802dea3101eS 
3803dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3804dea3101eS 	uint32_t word5Rsvd:8;
3805dea3101eS 	uint32_t remoteID:24;
3806dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3807dea3101eS 	uint32_t remoteID:24;
3808dea3101eS 	uint32_t word5Rsvd:8;
3809dea3101eS #endif
3810dea3101eS } RCV_ELS_REQ64;
3811dea3101eS 
38129c2face6SJames Smart /* IOCB Command template for RCV_SEQ64 */
38139c2face6SJames Smart struct rcv_seq64 {
38149c2face6SJames Smart 	struct ulp_bde64 elsReq;
38159c2face6SJames Smart 	uint32_t hbq_1;
38169c2face6SJames Smart 	uint32_t parmRo;
38179c2face6SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
38189c2face6SJames Smart 	uint32_t rctl:8;
38199c2face6SJames Smart 	uint32_t type:8;
38209c2face6SJames Smart 	uint32_t dfctl:8;
38219c2face6SJames Smart 	uint32_t ls:1;
38229c2face6SJames Smart 	uint32_t fs:1;
38239c2face6SJames Smart 	uint32_t rsvd2:3;
38249c2face6SJames Smart 	uint32_t si:1;
38259c2face6SJames Smart 	uint32_t bc:1;
38269c2face6SJames Smart 	uint32_t rsvd3:1;
38279c2face6SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
38289c2face6SJames Smart 	uint32_t rsvd3:1;
38299c2face6SJames Smart 	uint32_t bc:1;
38309c2face6SJames Smart 	uint32_t si:1;
38319c2face6SJames Smart 	uint32_t rsvd2:3;
38329c2face6SJames Smart 	uint32_t fs:1;
38339c2face6SJames Smart 	uint32_t ls:1;
38349c2face6SJames Smart 	uint32_t dfctl:8;
38359c2face6SJames Smart 	uint32_t type:8;
38369c2face6SJames Smart 	uint32_t rctl:8;
38379c2face6SJames Smart #endif
38389c2face6SJames Smart };
38399c2face6SJames Smart 
3840dea3101eS /* IOCB Command template for all 64 bit FCP Initiator commands */
3841dea3101eS typedef struct {
3842dea3101eS 	ULP_BDL bdl;
3843dea3101eS 	uint32_t fcpi_parm;
3844dea3101eS 	uint32_t fcpi_XRdy;	/* transfer ready for IWRITE */
3845dea3101eS } FCPI_FIELDS64;
3846dea3101eS 
3847dea3101eS /* IOCB Command template for all 64 bit FCP Target commands */
3848dea3101eS typedef struct {
3849dea3101eS 	ULP_BDL bdl;
3850dea3101eS 	uint32_t fcpt_Offset;
3851dea3101eS 	uint32_t fcpt_Length;	/* transfer ready for IWRITE */
3852dea3101eS } FCPT_FIELDS64;
3853dea3101eS 
385457127f15SJames Smart /* IOCB Command template for Async Status iocb commands */
385557127f15SJames Smart typedef struct {
385657127f15SJames Smart 	uint32_t rsvd[4];
385757127f15SJames Smart 	uint32_t param;
385857127f15SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
385957127f15SJames Smart 	uint16_t evt_code;		/* High order bits word 5 */
386057127f15SJames Smart 	uint16_t sub_ctxt_tag;		/* Low  order bits word 5 */
386157127f15SJames Smart #else   /*  __LITTLE_ENDIAN_BITFIELD */
386257127f15SJames Smart 	uint16_t sub_ctxt_tag;		/* High order bits word 5 */
386357127f15SJames Smart 	uint16_t evt_code;		/* Low  order bits word 5 */
386457127f15SJames Smart #endif
386557127f15SJames Smart } ASYNCSTAT_FIELDS;
386657127f15SJames Smart #define ASYNC_TEMP_WARN		0x100
386757127f15SJames Smart #define ASYNC_TEMP_SAFE		0x101
3868cb69f7deSJames Smart #define ASYNC_STATUS_CN		0x102
386957127f15SJames Smart 
3870ed957684SJames Smart /* IOCB Command template for CMD_IOCB_RCV_ELS64_CX (0xB7)
3871ed957684SJames Smart    or CMD_IOCB_RCV_SEQ64_CX (0xB5) */
3872ed957684SJames Smart 
3873ed957684SJames Smart struct rcv_sli3 {
3874ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
38757851fe2cSJames Smart 	uint16_t ox_id;
38767851fe2cSJames Smart 	uint16_t seq_cnt;
38777851fe2cSJames Smart 
3878ed957684SJames Smart 	uint16_t vpi;
3879ed957684SJames Smart 	uint16_t word9Rsvd;
3880ed957684SJames Smart #else  /*  __LITTLE_ENDIAN */
38817851fe2cSJames Smart 	uint16_t seq_cnt;
38827851fe2cSJames Smart 	uint16_t ox_id;
38837851fe2cSJames Smart 
3884ed957684SJames Smart 	uint16_t word9Rsvd;
3885ed957684SJames Smart 	uint16_t vpi;
3886ed957684SJames Smart #endif
3887ed957684SJames Smart 	uint32_t word10Rsvd;
3888ed957684SJames Smart 	uint32_t acc_len;      /* accumulated length */
3889ed957684SJames Smart 	struct ulp_bde64 bde2;
3890ed957684SJames Smart };
3891ed957684SJames Smart 
389276bb24efSJames Smart /* Structure used for a single HBQ entry */
389376bb24efSJames Smart struct lpfc_hbq_entry {
389476bb24efSJames Smart 	struct ulp_bde64 bde;
389576bb24efSJames Smart 	uint32_t buffer_tag;
389676bb24efSJames Smart };
389792d7f7b0SJames Smart 
389876bb24efSJames Smart /* IOCB Command template for QUE_XRI64_CX (0xB3) command */
389976bb24efSJames Smart typedef struct {
390076bb24efSJames Smart 	struct lpfc_hbq_entry   buff;
390176bb24efSJames Smart 	uint32_t                rsvd;
390276bb24efSJames Smart 	uint32_t		rsvd1;
390376bb24efSJames Smart } QUE_XRI64_CX_FIELDS;
390476bb24efSJames Smart 
390576bb24efSJames Smart struct que_xri64cx_ext_fields {
390676bb24efSJames Smart 	uint32_t	iotag64_low;
390776bb24efSJames Smart 	uint32_t	iotag64_high;
390876bb24efSJames Smart 	uint32_t	ebde_count;
390976bb24efSJames Smart 	uint32_t	rsvd;
391076bb24efSJames Smart 	struct lpfc_hbq_entry	buff[5];
391176bb24efSJames Smart };
391292d7f7b0SJames Smart 
391381301a9bSJames Smart struct sli3_bg_fields {
391481301a9bSJames Smart 	uint32_t filler[6];	/* word 8-13 in IOCB */
391581301a9bSJames Smart 	uint32_t bghm;		/* word 14 - BlockGuard High Water Mark */
391681301a9bSJames Smart /* Bitfields for bgstat (BlockGuard Status - word 15 of IOCB) */
391781301a9bSJames Smart #define BGS_BIDIR_BG_PROF_MASK		0xff000000
391881301a9bSJames Smart #define BGS_BIDIR_BG_PROF_SHIFT		24
391981301a9bSJames Smart #define BGS_BIDIR_ERR_COND_FLAGS_MASK	0x003f0000
392081301a9bSJames Smart #define BGS_BIDIR_ERR_COND_SHIFT	16
392181301a9bSJames Smart #define BGS_BG_PROFILE_MASK		0x0000ff00
392281301a9bSJames Smart #define BGS_BG_PROFILE_SHIFT		8
392381301a9bSJames Smart #define BGS_INVALID_PROF_MASK		0x00000020
392481301a9bSJames Smart #define BGS_INVALID_PROF_SHIFT		5
392581301a9bSJames Smart #define BGS_UNINIT_DIF_BLOCK_MASK	0x00000010
392681301a9bSJames Smart #define BGS_UNINIT_DIF_BLOCK_SHIFT	4
392781301a9bSJames Smart #define BGS_HI_WATER_MARK_PRESENT_MASK	0x00000008
392881301a9bSJames Smart #define BGS_HI_WATER_MARK_PRESENT_SHIFT	3
392981301a9bSJames Smart #define BGS_REFTAG_ERR_MASK		0x00000004
393081301a9bSJames Smart #define BGS_REFTAG_ERR_SHIFT		2
393181301a9bSJames Smart #define BGS_APPTAG_ERR_MASK		0x00000002
393281301a9bSJames Smart #define BGS_APPTAG_ERR_SHIFT		1
393381301a9bSJames Smart #define BGS_GUARD_ERR_MASK		0x00000001
393481301a9bSJames Smart #define BGS_GUARD_ERR_SHIFT		0
393581301a9bSJames Smart 	uint32_t bgstat;	/* word 15 - BlockGuard Status */
393681301a9bSJames Smart };
393781301a9bSJames Smart 
393881301a9bSJames Smart static inline uint32_t
393981301a9bSJames Smart lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat)
394081301a9bSJames Smart {
3941bc73905aSJames Smart 	return (bgstat & BGS_BIDIR_BG_PROF_MASK) >>
394281301a9bSJames Smart 				BGS_BIDIR_BG_PROF_SHIFT;
394381301a9bSJames Smart }
394481301a9bSJames Smart 
394581301a9bSJames Smart static inline uint32_t
394681301a9bSJames Smart lpfc_bgs_get_bidir_err_cond(uint32_t bgstat)
394781301a9bSJames Smart {
3948bc73905aSJames Smart 	return (bgstat & BGS_BIDIR_ERR_COND_FLAGS_MASK) >>
394981301a9bSJames Smart 				BGS_BIDIR_ERR_COND_SHIFT;
395081301a9bSJames Smart }
395181301a9bSJames Smart 
395281301a9bSJames Smart static inline uint32_t
395381301a9bSJames Smart lpfc_bgs_get_bg_prof(uint32_t bgstat)
395481301a9bSJames Smart {
3955bc73905aSJames Smart 	return (bgstat & BGS_BG_PROFILE_MASK) >>
395681301a9bSJames Smart 				BGS_BG_PROFILE_SHIFT;
395781301a9bSJames Smart }
395881301a9bSJames Smart 
395981301a9bSJames Smart static inline uint32_t
396081301a9bSJames Smart lpfc_bgs_get_invalid_prof(uint32_t bgstat)
396181301a9bSJames Smart {
3962bc73905aSJames Smart 	return (bgstat & BGS_INVALID_PROF_MASK) >>
396381301a9bSJames Smart 				BGS_INVALID_PROF_SHIFT;
396481301a9bSJames Smart }
396581301a9bSJames Smart 
396681301a9bSJames Smart static inline uint32_t
396781301a9bSJames Smart lpfc_bgs_get_uninit_dif_block(uint32_t bgstat)
396881301a9bSJames Smart {
3969bc73905aSJames Smart 	return (bgstat & BGS_UNINIT_DIF_BLOCK_MASK) >>
397081301a9bSJames Smart 				BGS_UNINIT_DIF_BLOCK_SHIFT;
397181301a9bSJames Smart }
397281301a9bSJames Smart 
397381301a9bSJames Smart static inline uint32_t
397481301a9bSJames Smart lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat)
397581301a9bSJames Smart {
3976bc73905aSJames Smart 	return (bgstat & BGS_HI_WATER_MARK_PRESENT_MASK) >>
397781301a9bSJames Smart 				BGS_HI_WATER_MARK_PRESENT_SHIFT;
397881301a9bSJames Smart }
397981301a9bSJames Smart 
398081301a9bSJames Smart static inline uint32_t
398181301a9bSJames Smart lpfc_bgs_get_reftag_err(uint32_t bgstat)
398281301a9bSJames Smart {
3983bc73905aSJames Smart 	return (bgstat & BGS_REFTAG_ERR_MASK) >>
398481301a9bSJames Smart 				BGS_REFTAG_ERR_SHIFT;
398581301a9bSJames Smart }
398681301a9bSJames Smart 
398781301a9bSJames Smart static inline uint32_t
398881301a9bSJames Smart lpfc_bgs_get_apptag_err(uint32_t bgstat)
398981301a9bSJames Smart {
3990bc73905aSJames Smart 	return (bgstat & BGS_APPTAG_ERR_MASK) >>
399181301a9bSJames Smart 				BGS_APPTAG_ERR_SHIFT;
399281301a9bSJames Smart }
399381301a9bSJames Smart 
399481301a9bSJames Smart static inline uint32_t
399581301a9bSJames Smart lpfc_bgs_get_guard_err(uint32_t bgstat)
399681301a9bSJames Smart {
3997bc73905aSJames Smart 	return (bgstat & BGS_GUARD_ERR_MASK) >>
399881301a9bSJames Smart 				BGS_GUARD_ERR_SHIFT;
399981301a9bSJames Smart }
400081301a9bSJames Smart 
400134b02dcdSJames Smart #define LPFC_EXT_DATA_BDE_COUNT 3
400234b02dcdSJames Smart struct fcp_irw_ext {
400334b02dcdSJames Smart 	uint32_t	io_tag64_low;
400434b02dcdSJames Smart 	uint32_t	io_tag64_high;
400534b02dcdSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
400634b02dcdSJames Smart 	uint8_t		reserved1;
400734b02dcdSJames Smart 	uint8_t		reserved2;
400834b02dcdSJames Smart 	uint8_t		reserved3;
400934b02dcdSJames Smart 	uint8_t		ebde_count;
401034b02dcdSJames Smart #else  /* __LITTLE_ENDIAN */
401134b02dcdSJames Smart 	uint8_t		ebde_count;
401234b02dcdSJames Smart 	uint8_t		reserved3;
401334b02dcdSJames Smart 	uint8_t		reserved2;
401434b02dcdSJames Smart 	uint8_t		reserved1;
401534b02dcdSJames Smart #endif
401634b02dcdSJames Smart 	uint32_t	reserved4;
401734b02dcdSJames Smart 	struct ulp_bde64 rbde;		/* response bde */
401834b02dcdSJames Smart 	struct ulp_bde64 dbde[LPFC_EXT_DATA_BDE_COUNT];	/* data BDE or BPL */
401934b02dcdSJames Smart 	uint8_t icd[32];		/* immediate command data (32 bytes) */
402034b02dcdSJames Smart };
402134b02dcdSJames Smart 
4022dea3101eS typedef struct _IOCB {	/* IOCB structure */
4023dea3101eS 	union {
4024dea3101eS 		GENERIC_RSP grsp;	/* Generic response */
4025dea3101eS 		XR_SEQ_FIELDS xrseq;	/* XMIT / BCAST / RCV_SEQUENCE cmd */
4026dea3101eS 		struct ulp_bde cont[3];	/* up to 3 continuation bdes */
4027dea3101eS 		RCV_ELS_REQ rcvels;	/* RCV_ELS_REQ template */
4028dea3101eS 		AC_XRI acxri;	/* ABORT / CLOSE_XRI template */
4029dea3101eS 		A_MXRI64 amxri;	/* abort multiple xri command overlay */
4030dea3101eS 		GET_RPI getrpi;	/* GET_RPI template */
4031dea3101eS 		FCPI_FIELDS fcpi;	/* FCP Initiator template */
4032dea3101eS 		FCPT_FIELDS fcpt;	/* FCP target template */
4033dea3101eS 
4034dea3101eS 		/* SLI-2 structures */
4035dea3101eS 
4036dea3101eS 		struct ulp_bde64 cont64[2];  /* up to 2 64 bit continuation
4037ed957684SJames Smart 					      * bde_64s */
4038dea3101eS 		ELS_REQUEST64 elsreq64;	/* ELS_REQUEST template */
4039dea3101eS 		GEN_REQUEST64 genreq64;	/* GEN_REQUEST template */
4040dea3101eS 		RCV_ELS_REQ64 rcvels64;	/* RCV_ELS_REQ template */
4041dea3101eS 		XMT_SEQ_FIELDS64 xseq64;	/* XMIT / BCAST cmd */
4042dea3101eS 		FCPI_FIELDS64 fcpi64;	/* FCP 64 bit Initiator template */
4043dea3101eS 		FCPT_FIELDS64 fcpt64;	/* FCP 64 bit target template */
404457127f15SJames Smart 		ASYNCSTAT_FIELDS asyncstat; /* async_status iocb */
404576bb24efSJames Smart 		QUE_XRI64_CX_FIELDS quexri64cx; /* que_xri64_cx fields */
40469c2face6SJames Smart 		struct rcv_seq64 rcvseq64;	/* RCV_SEQ64 and RCV_CONT64 */
4047546fc854SJames Smart 		struct sli4_bls_rsp bls_rsp; /* UNSOL ABTS BLS_RSP params */
4048dea3101eS 		uint32_t ulpWord[IOCB_WORD_SZ - 2];	/* generic 6 'words' */
4049dea3101eS 	} un;
4050dea3101eS 	union {
4051dea3101eS 		struct {
4052dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
4053dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
4054dea3101eS 			uint16_t ulpIoTag;	/* Low  order bits word 6 */
4055dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
4056dea3101eS 			uint16_t ulpIoTag;	/* Low  order bits word 6 */
4057dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
4058dea3101eS #endif
4059dea3101eS 		} t1;
4060dea3101eS 		struct {
4061dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
4062dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
4063dea3101eS 			uint16_t ulpIoTag1:2;	/* Low  order bits word 6 */
4064dea3101eS 			uint16_t ulpIoTag0:14;	/* Low  order bits word 6 */
4065dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
4066dea3101eS 			uint16_t ulpIoTag0:14;	/* Low  order bits word 6 */
4067dea3101eS 			uint16_t ulpIoTag1:2;	/* Low  order bits word 6 */
4068dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
4069dea3101eS #endif
4070dea3101eS 		} t2;
4071dea3101eS 	} un1;
4072dea3101eS #define ulpContext un1.t1.ulpContext
4073dea3101eS #define ulpIoTag   un1.t1.ulpIoTag
4074dea3101eS #define ulpIoTag0  un1.t2.ulpIoTag0
4075dea3101eS 
4076dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
4077dea3101eS 	uint32_t ulpTimeout:8;
4078dea3101eS 	uint32_t ulpXS:1;
4079dea3101eS 	uint32_t ulpFCP2Rcvy:1;
4080dea3101eS 	uint32_t ulpPU:2;
4081dea3101eS 	uint32_t ulpIr:1;
4082dea3101eS 	uint32_t ulpClass:3;
4083dea3101eS 	uint32_t ulpCommand:8;
4084dea3101eS 	uint32_t ulpStatus:4;
4085dea3101eS 	uint32_t ulpBdeCount:2;
4086dea3101eS 	uint32_t ulpLe:1;
4087dea3101eS 	uint32_t ulpOwner:1;	/* Low order bit word 7 */
4088dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
4089dea3101eS 	uint32_t ulpOwner:1;	/* Low order bit word 7 */
4090dea3101eS 	uint32_t ulpLe:1;
4091dea3101eS 	uint32_t ulpBdeCount:2;
4092dea3101eS 	uint32_t ulpStatus:4;
4093dea3101eS 	uint32_t ulpCommand:8;
4094dea3101eS 	uint32_t ulpClass:3;
4095dea3101eS 	uint32_t ulpIr:1;
4096dea3101eS 	uint32_t ulpPU:2;
4097dea3101eS 	uint32_t ulpFCP2Rcvy:1;
4098dea3101eS 	uint32_t ulpXS:1;
4099dea3101eS 	uint32_t ulpTimeout:8;
4100dea3101eS #endif
410192d7f7b0SJames Smart 
4102ed957684SJames Smart 	union {
4103ed957684SJames Smart 		struct rcv_sli3 rcvsli3; /* words 8 - 15 */
410476bb24efSJames Smart 
410576bb24efSJames Smart 		/* words 8-31 used for que_xri_cx iocb */
410676bb24efSJames Smart 		struct que_xri64cx_ext_fields que_xri64cx_ext_words;
410734b02dcdSJames Smart 		struct fcp_irw_ext fcp_ext;
4108ed957684SJames Smart 		uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */
410981301a9bSJames Smart 
411081301a9bSJames Smart 		/* words 8-15 for BlockGuard */
411181301a9bSJames Smart 		struct sli3_bg_fields sli3_bg;
4112ed957684SJames Smart 	} unsli3;
4113dea3101eS 
4114ed957684SJames Smart #define ulpCt_h ulpXS
4115ed957684SJames Smart #define ulpCt_l ulpFCP2Rcvy
4116ed957684SJames Smart 
4117ed957684SJames Smart #define IOCB_FCP	   1	/* IOCB is used for FCP ELS cmds-ulpRsvByte */
4118ed957684SJames Smart #define IOCB_IP		   2	/* IOCB is used for IP ELS cmds */
4119dea3101eS #define PARM_UNUSED        0	/* PU field (Word 4) not used */
4120dea3101eS #define PARM_REL_OFF       1	/* PU field (Word 4) = R. O. */
4121dea3101eS #define PARM_READ_CHECK    2	/* PU field (Word 4) = Data Transfer Length */
412292d7f7b0SJames Smart #define PARM_NPIV_DID	   3
4123dea3101eS #define CLASS1             0	/* Class 1 */
4124dea3101eS #define CLASS2             1	/* Class 2 */
4125dea3101eS #define CLASS3             2	/* Class 3 */
4126dea3101eS #define CLASS_FCP_INTERMIX 7	/* FCP Data->Cls 1, all else->Cls 2 */
4127dea3101eS 
4128dea3101eS #define IOSTAT_SUCCESS         0x0	/* ulpStatus  - HBA defined */
4129dea3101eS #define IOSTAT_FCP_RSP_ERROR   0x1
4130dea3101eS #define IOSTAT_REMOTE_STOP     0x2
4131dea3101eS #define IOSTAT_LOCAL_REJECT    0x3
4132dea3101eS #define IOSTAT_NPORT_RJT       0x4
4133dea3101eS #define IOSTAT_FABRIC_RJT      0x5
4134dea3101eS #define IOSTAT_NPORT_BSY       0x6
4135dea3101eS #define IOSTAT_FABRIC_BSY      0x7
4136dea3101eS #define IOSTAT_INTERMED_RSP    0x8
4137dea3101eS #define IOSTAT_LS_RJT          0x9
4138dea3101eS #define IOSTAT_BA_RJT          0xA
4139dea3101eS #define IOSTAT_RSVD1           0xB
4140dea3101eS #define IOSTAT_RSVD2           0xC
4141dea3101eS #define IOSTAT_RSVD3           0xD
4142dea3101eS #define IOSTAT_RSVD4           0xE
414392d7f7b0SJames Smart #define IOSTAT_NEED_BUFFER     0xF
4144dea3101eS #define IOSTAT_DRIVER_REJECT   0x10   /* ulpStatus  - Driver defined */
4145dea3101eS #define IOSTAT_DEFAULT         0xF    /* Same as rsvd5 for now */
4146dea3101eS #define IOSTAT_CNT             0x11
4147dea3101eS 
4148dea3101eS } IOCB_t;
4149dea3101eS 
4150dea3101eS 
4151dea3101eS #define SLI1_SLIM_SIZE   (4 * 1024)
4152dea3101eS 
4153dea3101eS /* Up to 498 IOCBs will fit into 16k
4154dea3101eS  * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384
4155dea3101eS  */
4156ed957684SJames Smart #define SLI2_SLIM_SIZE   (64 * 1024)
4157dea3101eS 
4158dea3101eS /* Maximum IOCBs that will fit in SLI2 slim */
4159dea3101eS #define MAX_SLI2_IOCB    498
4160ed957684SJames Smart #define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \
41617a470277SJames Smart 			    (sizeof(MAILBOX_t) + sizeof(PCB_t) + \
41627a470277SJames Smart 			    sizeof(uint32_t) * MAILBOX_EXT_WSIZE))
4163ed957684SJames Smart 
4164ed957684SJames Smart /* HBQ entries are 4 words each = 4k */
4165ed957684SJames Smart #define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) *  \
4166ed957684SJames Smart 			     lpfc_sli_hbq_count())
4167dea3101eS 
4168dea3101eS struct lpfc_sli2_slim {
4169dea3101eS 	MAILBOX_t mbx;
41707a470277SJames Smart 	uint32_t  mbx_ext_words[MAILBOX_EXT_WSIZE];
4171dea3101eS 	PCB_t pcb;
4172ed957684SJames Smart 	IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE];
4173dea3101eS };
4174dea3101eS 
41752e0fef85SJames Smart /*
41762e0fef85SJames Smart  * This function checks PCI device to allow special handling for LC HBAs.
41772e0fef85SJames Smart  *
41782e0fef85SJames Smart  * Parameters:
41792e0fef85SJames Smart  * device : struct pci_dev 's device field
41802e0fef85SJames Smart  *
41812e0fef85SJames Smart  * return 1 => TRUE
41822e0fef85SJames Smart  *        0 => FALSE
41832e0fef85SJames Smart  */
4184dea3101eS static inline int
4185dea3101eS lpfc_is_LC_HBA(unsigned short device)
4186dea3101eS {
4187dea3101eS 	if ((device == PCI_DEVICE_ID_TFLY) ||
4188dea3101eS 	    (device == PCI_DEVICE_ID_PFLY) ||
4189dea3101eS 	    (device == PCI_DEVICE_ID_LP101) ||
4190dea3101eS 	    (device == PCI_DEVICE_ID_BMID) ||
4191dea3101eS 	    (device == PCI_DEVICE_ID_BSMB) ||
4192dea3101eS 	    (device == PCI_DEVICE_ID_ZMID) ||
4193dea3101eS 	    (device == PCI_DEVICE_ID_ZSMB) ||
419409372820SJames Smart 	    (device == PCI_DEVICE_ID_SAT_MID) ||
419509372820SJames Smart 	    (device == PCI_DEVICE_ID_SAT_SMB) ||
4196dea3101eS 	    (device == PCI_DEVICE_ID_RFLY))
4197dea3101eS 		return 1;
4198dea3101eS 	else
4199dea3101eS 		return 0;
4200dea3101eS }
4201858c9f6cSJames Smart 
4202858c9f6cSJames Smart /*
4203858c9f6cSJames Smart  * Determine if an IOCB failed because of a link event or firmware reset.
4204858c9f6cSJames Smart  */
4205858c9f6cSJames Smart 
4206858c9f6cSJames Smart static inline int
4207858c9f6cSJames Smart lpfc_error_lost_link(IOCB_t *iocbp)
4208858c9f6cSJames Smart {
4209858c9f6cSJames Smart 	return (iocbp->ulpStatus == IOSTAT_LOCAL_REJECT &&
4210858c9f6cSJames Smart 		(iocbp->un.ulpWord[4] == IOERR_SLI_ABORTED ||
4211858c9f6cSJames Smart 		 iocbp->un.ulpWord[4] == IOERR_LINK_DOWN ||
4212858c9f6cSJames Smart 		 iocbp->un.ulpWord[4] == IOERR_SLI_DOWN));
4213858c9f6cSJames Smart }
421484774a4dSJames Smart 
421584774a4dSJames Smart #define MENLO_TRANSPORT_TYPE 0xfe
421684774a4dSJames Smart #define MENLO_CONTEXT 0
421784774a4dSJames Smart #define MENLO_PU 3
421884774a4dSJames Smart #define MENLO_TIMEOUT 30
421984774a4dSJames Smart #define SETVAR_MLOMNT 0x103107
422084774a4dSJames Smart #define SETVAR_MLORST 0x103007
4221da0436e9SJames Smart 
4222da0436e9SJames Smart #define BPL_ALIGN_SZ 8 /* 8 byte alignment for bpl and mbufs */
4223