xref: /linux/drivers/scsi/lpfc/lpfc_hw.h (revision 6c983d327b9e628923916f9780bb0d107740d76b)
1dea3101eS /*******************************************************************
2dea3101eS  * This file is part of the Emulex Linux Device Driver for         *
3c44ce173SJames.Smart@Emulex.Com  * Fibre Channel Host Bus Adapters.                                *
4f45775bfSJames Smart  * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term *
54ae2ebdeSJames Smart  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
650611577SJames Smart  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
7c44ce173SJames.Smart@Emulex.Com  * EMULEX and SLI are trademarks of Emulex.                        *
8d080abe0SJames Smart  * www.broadcom.com                                                *
9dea3101eS  *                                                                 *
10dea3101eS  * This program is free software; you can redistribute it and/or   *
11c44ce173SJames.Smart@Emulex.Com  * modify it under the terms of version 2 of the GNU General       *
12c44ce173SJames.Smart@Emulex.Com  * Public License as published by the Free Software Foundation.    *
13c44ce173SJames.Smart@Emulex.Com  * This program is distributed in the hope that it will be useful. *
14c44ce173SJames.Smart@Emulex.Com  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
15c44ce173SJames.Smart@Emulex.Com  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
16c44ce173SJames.Smart@Emulex.Com  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
17c44ce173SJames.Smart@Emulex.Com  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
18c44ce173SJames.Smart@Emulex.Com  * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
19c44ce173SJames.Smart@Emulex.Com  * more details, a copy of which can be found in the file COPYING  *
20c44ce173SJames.Smart@Emulex.Com  * included with this package.                                     *
21dea3101eS  *******************************************************************/
22dea3101eS 
23dea3101eS #define FDMI_DID        0xfffffaU
24dea3101eS #define NameServer_DID  0xfffffcU
25df3fe766SJames Smart #define Fabric_Cntl_DID 0xfffffdU
26dea3101eS #define Fabric_DID      0xfffffeU
27dea3101eS #define Bcast_DID       0xffffffU
28dea3101eS #define Mask_DID        0xffffffU
29dea3101eS #define CT_DID_MASK     0xffff00U
30dea3101eS #define Fabric_DID_MASK 0xfff000U
31dea3101eS #define WELL_KNOWN_DID_MASK 0xfffff0U
32dea3101eS 
33dea3101eS #define PT2PT_LocalID	1
34dea3101eS #define PT2PT_RemoteID	2
35dea3101eS 
36dea3101eS #define FF_DEF_EDTOV          2000	/* Default E_D_TOV (2000ms) */
37dea3101eS #define FF_DEF_ALTOV            15	/* Default AL_TIME (15ms) */
3821bf0b97SJames Smart #define FF_DEF_RATOV            10	/* Default RA_TOV (10s) */
39dea3101eS #define FF_DEF_ARBTOV         1900	/* Default ARB_TOV (1900ms) */
40dea3101eS 
41dea3101eS #define LPFC_BUF_RING0        64	/* Number of buffers to post to RING
42dea3101eS 					   0 */
43dea3101eS 
44dea3101eS #define FCELSSIZE             1024	/* maximum ELS transfer size */
45dea3101eS 
46dea3101eS #define LPFC_FCP_RING            0	/* ring 0 for FCP initiator commands */
47a4bc3379SJames Smart #define LPFC_EXTRA_RING          1	/* ring 1 for other protocols */
48dea3101eS #define LPFC_ELS_RING            2	/* ring 2 for ELS commands */
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 
95a0f2d3efSJames Smart /* FC4 Feature bits for RFF_ID */
9692d7f7b0SJames Smart #define FC4_FEATURE_TARGET	0x1
97a0f2d3efSJames Smart #define FC4_FEATURE_INIT	0x2
98a0f2d3efSJames Smart #define FC4_FEATURE_NVME_DISC	0x4
9992d7f7b0SJames Smart 
100*6c983d32SJames Smart enum rft_word0 {
101*6c983d32SJames Smart 	RFT_FCP_REG	= (0x1 << 8),
102*6c983d32SJames Smart };
103*6c983d32SJames Smart 
104*6c983d32SJames Smart enum rft_word1 {
105*6c983d32SJames Smart 	RFT_NVME_REG	= (0x1 << 8),
106*6c983d32SJames Smart };
107*6c983d32SJames Smart 
108*6c983d32SJames Smart enum rft_word3 {
109*6c983d32SJames Smart 	RFT_APP_SERV_REG	= (0x1 << 0),
110*6c983d32SJames Smart };
111*6c983d32SJames Smart 
112dea3101eS struct lpfc_sli_ct_request {
113dea3101eS 	/* Structure is in Big Endian format */
114dea3101eS 	union CtRevisionId RevisionId;
115dea3101eS 	uint8_t FsType;
116dea3101eS 	uint8_t FsSubType;
117dea3101eS 	uint8_t Options;
118dea3101eS 	uint8_t Rsrvd1;
119dea3101eS 	union CtCommandResponse CommandResponse;
120dea3101eS 	uint8_t Rsrvd2;
121dea3101eS 	uint8_t ReasonCode;
122dea3101eS 	uint8_t Explanation;
123dea3101eS 	uint8_t VendorUnique;
12476b2c34aSJames Smart #define LPFC_CT_PREAMBLE	20	/* Size of CTReq + 4 up to here */
125dea3101eS 
126dea3101eS 	union {
127dea3101eS 		uint32_t PortID;
128dea3101eS 		struct gid {
129dea3101eS 			uint8_t PortType;	/* for GID_PT requests */
1307ea92eb4SJames Smart #define GID_PT_N_PORT	1
131dea3101eS 			uint8_t DomainScope;
132dea3101eS 			uint8_t AreaScope;
133dea3101eS 			uint8_t Fc4Type;	/* for GID_FT requests */
134dea3101eS 		} gid;
135a0f2d3efSJames Smart 		struct gid_ff {
136a0f2d3efSJames Smart 			uint8_t Flags;
137a0f2d3efSJames Smart 			uint8_t DomainScope;
138a0f2d3efSJames Smart 			uint8_t AreaScope;
139a0f2d3efSJames Smart 			uint8_t rsvd1;
140a0f2d3efSJames Smart 			uint8_t rsvd2;
141a0f2d3efSJames Smart 			uint8_t rsvd3;
142a0f2d3efSJames Smart 			uint8_t Fc4FBits;
143a0f2d3efSJames Smart 			uint8_t Fc4Type;
144a0f2d3efSJames Smart 		} gid_ff;
145dea3101eS 		struct rft {
146*6c983d32SJames Smart 			__be32 port_id; /* For RFT_ID requests */
147dea3101eS 
148*6c983d32SJames Smart 			__be32 fcp_reg;	/* rsvd 31:9, fcp_reg 8, rsvd 7:0 */
149*6c983d32SJames Smart 			__be32 nvme_reg; /* rsvd 31:9, nvme_reg 8, rsvd 7:0 */
150*6c983d32SJames Smart 			__be32 word2;
151*6c983d32SJames Smart 			__be32 app_serv_reg; /* rsvd 31:1, app_serv_reg 0 */
152*6c983d32SJames Smart 			__be32 word[4];
153dea3101eS 		} rft;
154dea3101eS 		struct rnn {
155dea3101eS 			uint32_t PortId;	/* For RNN_ID requests */
156dea3101eS 			uint8_t wwnn[8];
157dea3101eS 		} rnn;
158dea3101eS 		struct rsnn {	/* For RSNN_ID requests */
159dea3101eS 			uint8_t wwnn[8];
160dea3101eS 			uint8_t len;
161dea3101eS 			uint8_t symbname[255];
162dea3101eS 		} rsnn;
1637ee5d43eSJames Smart 		struct da_id { /* For DA_ID requests */
1647ee5d43eSJames Smart 			uint32_t port_id;
1657ee5d43eSJames Smart 		} da_id;
16692d7f7b0SJames Smart 		struct rspn {	/* For RSPN_ID requests */
16792d7f7b0SJames Smart 			uint32_t PortId;
16892d7f7b0SJames Smart 			uint8_t len;
16992d7f7b0SJames Smart 			uint8_t symbname[255];
17092d7f7b0SJames Smart 		} rspn;
17192d7f7b0SJames Smart 		struct gff {
17292d7f7b0SJames Smart 			uint32_t PortId;
17392d7f7b0SJames Smart 		} gff;
17492d7f7b0SJames Smart 		struct gff_acc {
17592d7f7b0SJames Smart 			uint8_t fbits[128];
17692d7f7b0SJames Smart 		} gff_acc;
177a0f2d3efSJames Smart 		struct gft {
178a0f2d3efSJames Smart 			uint32_t PortId;
179a0f2d3efSJames Smart 		} gft;
180a0f2d3efSJames Smart 		struct gft_acc {
181a0f2d3efSJames Smart 			uint32_t fc4_types[8];
182a0f2d3efSJames Smart 		} gft_acc;
18351ef4c26SJames Smart #define FCP_TYPE_FEATURE_OFFSET 7
18492d7f7b0SJames Smart 		struct rff {
18592d7f7b0SJames Smart 			uint32_t PortId;
18692d7f7b0SJames Smart 			uint8_t reserved[2];
18792d7f7b0SJames Smart 			uint8_t fbits;
18892d7f7b0SJames Smart 			uint8_t type_code;     /* type=8 for FCP */
18992d7f7b0SJames Smart 		} rff;
190dea3101eS 	} un;
191dea3101eS };
192dea3101eS 
19376b2c34aSJames Smart #define LPFC_MAX_CT_SIZE	(60 * 4096)
19476b2c34aSJames Smart 
195dea3101eS #define  SLI_CT_REVISION        1
19692d7f7b0SJames Smart #define  GID_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
19792d7f7b0SJames Smart 			   sizeof(struct gid))
198a0f2d3efSJames Smart #define  GIDFF_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
199a0f2d3efSJames Smart 			   sizeof(struct gid_ff))
20092d7f7b0SJames Smart #define  GFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
20192d7f7b0SJames Smart 			   sizeof(struct gff))
202a0f2d3efSJames Smart #define  GFT_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
203a0f2d3efSJames Smart 			   sizeof(struct gft))
20492d7f7b0SJames Smart #define  RFT_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
20592d7f7b0SJames Smart 			   sizeof(struct rft))
20692d7f7b0SJames Smart #define  RFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
20792d7f7b0SJames Smart 			   sizeof(struct rff))
20892d7f7b0SJames Smart #define  RNN_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
20992d7f7b0SJames Smart 			   sizeof(struct rnn))
21092d7f7b0SJames Smart #define  RSNN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
21192d7f7b0SJames Smart 			   sizeof(struct rsnn))
2127ee5d43eSJames Smart #define DA_ID_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
2137ee5d43eSJames Smart 			  sizeof(struct da_id))
21492d7f7b0SJames Smart #define  RSPN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
21592d7f7b0SJames Smart 			   sizeof(struct rspn))
216dea3101eS 
217dea3101eS /*
218dea3101eS  * FsType Definitions
219dea3101eS  */
220dea3101eS 
221dea3101eS #define  SLI_CT_MANAGEMENT_SERVICE        0xFA
222dea3101eS #define  SLI_CT_TIME_SERVICE              0xFB
223dea3101eS #define  SLI_CT_DIRECTORY_SERVICE         0xFC
224dea3101eS #define  SLI_CT_FABRIC_CONTROLLER_SERVICE 0xFD
225dea3101eS 
226dea3101eS /*
227dea3101eS  * Directory Service Subtypes
228dea3101eS  */
229dea3101eS 
230dea3101eS #define  SLI_CT_DIRECTORY_NAME_SERVER     0x02
231dea3101eS 
232dea3101eS /*
233dea3101eS  * Response Codes
234dea3101eS  */
235dea3101eS 
236dea3101eS #define  SLI_CT_RESPONSE_FS_RJT           0x8001
237dea3101eS #define  SLI_CT_RESPONSE_FS_ACC           0x8002
238dea3101eS 
239dea3101eS /*
240dea3101eS  * Reason Codes
241dea3101eS  */
242dea3101eS 
243dea3101eS #define  SLI_CT_NO_ADDITIONAL_EXPL	  0x0
244dea3101eS #define  SLI_CT_INVALID_COMMAND           0x01
245dea3101eS #define  SLI_CT_INVALID_VERSION           0x02
246dea3101eS #define  SLI_CT_LOGICAL_ERROR             0x03
247dea3101eS #define  SLI_CT_INVALID_IU_SIZE           0x04
248dea3101eS #define  SLI_CT_LOGICAL_BUSY              0x05
249dea3101eS #define  SLI_CT_PROTOCOL_ERROR            0x07
250dea3101eS #define  SLI_CT_UNABLE_TO_PERFORM_REQ     0x09
251dea3101eS #define  SLI_CT_REQ_NOT_SUPPORTED         0x0b
252dea3101eS #define  SLI_CT_HBA_INFO_NOT_REGISTERED	  0x10
253dea3101eS #define  SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE  0x11
254dea3101eS #define  SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN      0x12
255dea3101eS #define  SLI_CT_HBA_ATTR_NOT_PRESENT	  0x13
256dea3101eS #define  SLI_CT_PORT_INFO_NOT_REGISTERED  0x20
257dea3101eS #define  SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE 0x21
258dea3101eS #define  SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN     0x22
259dea3101eS #define  SLI_CT_VENDOR_UNIQUE             0xff
260dea3101eS 
261dea3101eS /*
262dea3101eS  * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
263dea3101eS  */
264dea3101eS 
265dea3101eS #define  SLI_CT_NO_PORT_ID                0x01
266dea3101eS #define  SLI_CT_NO_PORT_NAME              0x02
267dea3101eS #define  SLI_CT_NO_NODE_NAME              0x03
268dea3101eS #define  SLI_CT_NO_CLASS_OF_SERVICE       0x04
269dea3101eS #define  SLI_CT_NO_IP_ADDRESS             0x05
270dea3101eS #define  SLI_CT_NO_IPA                    0x06
271dea3101eS #define  SLI_CT_NO_FC4_TYPES              0x07
272dea3101eS #define  SLI_CT_NO_SYMBOLIC_PORT_NAME     0x08
273dea3101eS #define  SLI_CT_NO_SYMBOLIC_NODE_NAME     0x09
274dea3101eS #define  SLI_CT_NO_PORT_TYPE              0x0A
275dea3101eS #define  SLI_CT_ACCESS_DENIED             0x10
276dea3101eS #define  SLI_CT_INVALID_PORT_ID           0x11
277dea3101eS #define  SLI_CT_DATABASE_EMPTY            0x12
27802169e84SGaurav Srivastava #define  SLI_CT_APP_ID_NOT_AVAILABLE      0x40
279dea3101eS 
280dea3101eS /*
281dea3101eS  * Name Server Command Codes
282dea3101eS  */
283dea3101eS 
284dea3101eS #define  SLI_CTNS_GA_NXT      0x0100
285dea3101eS #define  SLI_CTNS_GPN_ID      0x0112
286dea3101eS #define  SLI_CTNS_GNN_ID      0x0113
287dea3101eS #define  SLI_CTNS_GCS_ID      0x0114
288dea3101eS #define  SLI_CTNS_GFT_ID      0x0117
289dea3101eS #define  SLI_CTNS_GSPN_ID     0x0118
290dea3101eS #define  SLI_CTNS_GPT_ID      0x011A
29192d7f7b0SJames Smart #define  SLI_CTNS_GFF_ID      0x011F
292dea3101eS #define  SLI_CTNS_GID_PN      0x0121
293dea3101eS #define  SLI_CTNS_GID_NN      0x0131
294dea3101eS #define  SLI_CTNS_GIP_NN      0x0135
295dea3101eS #define  SLI_CTNS_GIPA_NN     0x0136
296dea3101eS #define  SLI_CTNS_GSNN_NN     0x0139
297dea3101eS #define  SLI_CTNS_GNN_IP      0x0153
298dea3101eS #define  SLI_CTNS_GIPA_IP     0x0156
299dea3101eS #define  SLI_CTNS_GID_FT      0x0171
300a0f2d3efSJames Smart #define  SLI_CTNS_GID_FF      0x01F1
301dea3101eS #define  SLI_CTNS_GID_PT      0x01A1
302dea3101eS #define  SLI_CTNS_RPN_ID      0x0212
303dea3101eS #define  SLI_CTNS_RNN_ID      0x0213
304dea3101eS #define  SLI_CTNS_RCS_ID      0x0214
305dea3101eS #define  SLI_CTNS_RFT_ID      0x0217
306dea3101eS #define  SLI_CTNS_RSPN_ID     0x0218
307dea3101eS #define  SLI_CTNS_RPT_ID      0x021A
30892d7f7b0SJames Smart #define  SLI_CTNS_RFF_ID      0x021F
309dea3101eS #define  SLI_CTNS_RIP_NN      0x0235
310dea3101eS #define  SLI_CTNS_RIPA_NN     0x0236
311dea3101eS #define  SLI_CTNS_RSNN_NN     0x0239
312dea3101eS #define  SLI_CTNS_DA_ID       0x0300
313dea3101eS 
314dea3101eS /*
315dea3101eS  * Port Types
316dea3101eS  */
317dea3101eS 
318dea3101eS #define SLI_CTPT_N_PORT		0x01
319dea3101eS #define SLI_CTPT_NL_PORT	0x02
320dea3101eS #define SLI_CTPT_FNL_PORT	0x03
321dea3101eS #define SLI_CTPT_IP		0x04
322dea3101eS #define SLI_CTPT_FCP		0x08
323a0f2d3efSJames Smart #define SLI_CTPT_NVME		0x28
324dea3101eS #define SLI_CTPT_NX_PORT	0x7F
325dea3101eS #define SLI_CTPT_F_PORT		0x81
326dea3101eS #define SLI_CTPT_FL_PORT	0x82
327dea3101eS #define SLI_CTPT_E_PORT		0x84
328dea3101eS 
329dea3101eS #define SLI_CT_LAST_ENTRY     0x80000000
330dea3101eS 
331dea3101eS /* Fibre Channel Service Parameter definitions */
332dea3101eS 
333dea3101eS #define FC_PH_4_0   6		/* FC-PH version 4.0 */
334dea3101eS #define FC_PH_4_1   7		/* FC-PH version 4.1 */
335dea3101eS #define FC_PH_4_2   8		/* FC-PH version 4.2 */
336dea3101eS #define FC_PH_4_3   9		/* FC-PH version 4.3 */
337dea3101eS 
338dea3101eS #define FC_PH_LOW   8		/* Lowest supported FC-PH version */
339dea3101eS #define FC_PH_HIGH  9		/* Highest supported FC-PH version */
340dea3101eS #define FC_PH3   0x20		/* FC-PH-3 version */
341dea3101eS 
342dea3101eS #define FF_FRAME_SIZE     2048
343dea3101eS 
344dea3101eS struct lpfc_name {
345f631b4beSAndrew Vasquez 	union {
346f631b4beSAndrew Vasquez 		struct {
347dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
348dea3101eS 			uint8_t nameType:4;	/* FC Word 0, bit 28:31 */
3491de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit
3501de933f3SJames.Smart@Emulex.Com 						   8:11 of IEEE ext */
351dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3521de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit
3531de933f3SJames.Smart@Emulex.Com 						   8:11 of IEEE ext */
354dea3101eS 			uint8_t nameType:4;	/* FC Word 0, bit 28:31 */
355dea3101eS #endif
356dea3101eS 
357dea3101eS #define NAME_IEEE           0x1	/* IEEE name - nameType */
358dea3101eS #define NAME_IEEE_EXT       0x2	/* IEEE extended name */
359dea3101eS #define NAME_FC_TYPE        0x3	/* FC native name type */
360dea3101eS #define NAME_IP_TYPE        0x4	/* IP address */
361dea3101eS #define NAME_CCITT_TYPE     0xC
362dea3101eS #define NAME_CCITT_GR_TYPE  0xE
3631de933f3SJames.Smart@Emulex.Com 			uint8_t IEEEextLsb;	/* FC Word 0, bit 16:23, IEEE
3641de933f3SJames.Smart@Emulex.Com 						   extended Lsb */
365dea3101eS 			uint8_t IEEE[6];	/* FC IEEE address */
36668ce1eb5SAndrew Morton 		} s;
367f631b4beSAndrew Vasquez 		uint8_t wwn[8];
368a0f2d3efSJames Smart 		uint64_t name;
36968ce1eb5SAndrew Morton 	} u;
370f631b4beSAndrew Vasquez };
371dea3101eS 
372dea3101eS struct csp {
373dea3101eS 	uint8_t fcphHigh;	/* FC Word 0, byte 0 */
374dea3101eS 	uint8_t fcphLow;
375dea3101eS 	uint8_t bbCreditMsb;
3763aaaa314SJames Smart 	uint8_t bbCreditLsb;	/* FC Word 0, byte 3 */
377dea3101eS 
37892494144SJames Smart /*
37992494144SJames Smart  * Word 1 Bit 31 in common service parameter is overloaded.
38092494144SJames Smart  * Word 1 Bit 31 in FLOGI request is multiple NPort request
38192494144SJames Smart  * Word 1 Bit 31 in FLOGI response is clean address bit
38292494144SJames Smart  */
38392494144SJames Smart #define clean_address_bit request_multiple_Nport /* Word 1, bit 31 */
384df9e1b59SJames Smart /*
385df9e1b59SJames Smart  * Word 1 Bit 30 in common service parameter is overloaded.
386df9e1b59SJames Smart  * Word 1 Bit 30 in FLOGI request is Virtual Fabrics
387df9e1b59SJames Smart  * Word 1 Bit 30 in PLOGI request is random offset
388df9e1b59SJames Smart  */
389df9e1b59SJames Smart #define virtual_fabric_support randomOffset /* Word 1, bit 30 */
390e0165f20SJames Smart /*
391e0165f20SJames Smart  * Word 1 Bit 29 in common service parameter is overloaded.
392e0165f20SJames Smart  * Word 1 Bit 29 in FLOGI response is multiple NPort assignment
393e0165f20SJames Smart  * Word 1 Bit 29 in FLOGI/PLOGI request is Valid Vendor Version Level
394e0165f20SJames Smart  */
395e0165f20SJames Smart #define valid_vendor_ver_level response_multiple_NPort /* Word 1, bit 29 */
396dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
39792d7f7b0SJames Smart 	uint16_t request_multiple_Nport:1;	/* FC Word 1, bit 31 */
39892d7f7b0SJames Smart 	uint16_t randomOffset:1;	/* FC Word 1, bit 30 */
39992d7f7b0SJames Smart 	uint16_t response_multiple_NPort:1;	/* FC Word 1, bit 29 */
400dea3101eS 	uint16_t fPort:1;	/* FC Word 1, bit 28 */
401dea3101eS 	uint16_t altBbCredit:1;	/* FC Word 1, bit 27 */
402dea3101eS 	uint16_t edtovResolution:1;	/* FC Word 1, bit 26 */
403dea3101eS 	uint16_t multicast:1;	/* FC Word 1, bit 25 */
40402169e84SGaurav Srivastava 	uint16_t app_hdr_support:1;	/* FC Word 1, bit 24 */
405dea3101eS 
40602169e84SGaurav Srivastava 	uint16_t priority_tagging:1;	/* FC Word 1, bit 23 */
407dea3101eS 	uint16_t simplex:1;	/* FC Word 1, bit 22 */
408dea3101eS 	uint16_t word1Reserved1:3;	/* FC Word 1, bit 21:19 */
409dea3101eS 	uint16_t dhd:1;		/* FC Word 1, bit 18 */
410dea3101eS 	uint16_t contIncSeqCnt:1;	/* FC Word 1, bit 17 */
411dea3101eS 	uint16_t payloadlength:1;	/* FC Word 1, bit 16 */
412dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
41302169e84SGaurav Srivastava 	uint16_t app_hdr_support:1;	/* FC Word 1, bit 24 */
414dea3101eS 	uint16_t multicast:1;	/* FC Word 1, bit 25 */
415dea3101eS 	uint16_t edtovResolution:1;	/* FC Word 1, bit 26 */
416dea3101eS 	uint16_t altBbCredit:1;	/* FC Word 1, bit 27 */
417dea3101eS 	uint16_t fPort:1;	/* FC Word 1, bit 28 */
41892d7f7b0SJames Smart 	uint16_t response_multiple_NPort:1;	/* FC Word 1, bit 29 */
419dea3101eS 	uint16_t randomOffset:1;	/* FC Word 1, bit 30 */
42092d7f7b0SJames Smart 	uint16_t request_multiple_Nport:1;	/* FC Word 1, bit 31 */
421dea3101eS 
422dea3101eS 	uint16_t payloadlength:1;	/* FC Word 1, bit 16 */
423dea3101eS 	uint16_t contIncSeqCnt:1;	/* FC Word 1, bit 17 */
424dea3101eS 	uint16_t dhd:1;		/* FC Word 1, bit 18 */
425dea3101eS 	uint16_t word1Reserved1:3;	/* FC Word 1, bit 21:19 */
426dea3101eS 	uint16_t simplex:1;	/* FC Word 1, bit 22 */
42702169e84SGaurav Srivastava 	uint16_t priority_tagging:1;	/* FC Word 1, bit 23 */
428dea3101eS #endif
429dea3101eS 
430dea3101eS 	uint8_t bbRcvSizeMsb;	/* Upper nibble is reserved */
431dea3101eS 	uint8_t bbRcvSizeLsb;	/* FC Word 1, byte 3 */
432dea3101eS 	union {
433dea3101eS 		struct {
434dea3101eS 			uint8_t word2Reserved1;	/* FC Word 2 byte 0 */
435dea3101eS 
436dea3101eS 			uint8_t totalConcurrSeq;	/* FC Word 2 byte 1 */
437dea3101eS 			uint8_t roByCategoryMsb;	/* FC Word 2 byte 2 */
438dea3101eS 
439dea3101eS 			uint8_t roByCategoryLsb;	/* FC Word 2 byte 3 */
440dea3101eS 		} nPort;
441dea3101eS 		uint32_t r_a_tov;	/* R_A_TOV must be in B.E. format */
442dea3101eS 	} w2;
443dea3101eS 
444dea3101eS 	uint32_t e_d_tov;	/* E_D_TOV must be in B.E. format */
445dea3101eS };
446dea3101eS 
447dea3101eS struct class_parms {
448dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
449dea3101eS 	uint8_t classValid:1;	/* FC Word 0, bit 31 */
450dea3101eS 	uint8_t intermix:1;	/* FC Word 0, bit 30 */
451dea3101eS 	uint8_t stackedXparent:1;	/* FC Word 0, bit 29 */
452dea3101eS 	uint8_t stackedLockDown:1;	/* FC Word 0, bit 28 */
453dea3101eS 	uint8_t seqDelivery:1;	/* FC Word 0, bit 27 */
454dea3101eS 	uint8_t word0Reserved1:3;	/* FC Word 0, bit 24:26 */
455dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
456dea3101eS 	uint8_t word0Reserved1:3;	/* FC Word 0, bit 24:26 */
457dea3101eS 	uint8_t seqDelivery:1;	/* FC Word 0, bit 27 */
458dea3101eS 	uint8_t stackedLockDown:1;	/* FC Word 0, bit 28 */
459dea3101eS 	uint8_t stackedXparent:1;	/* FC Word 0, bit 29 */
460dea3101eS 	uint8_t intermix:1;	/* FC Word 0, bit 30 */
461dea3101eS 	uint8_t classValid:1;	/* FC Word 0, bit 31 */
462dea3101eS 
463dea3101eS #endif
464dea3101eS 
465dea3101eS 	uint8_t word0Reserved2;	/* FC Word 0, bit 16:23 */
466dea3101eS 
467dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
468dea3101eS 	uint8_t iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
469dea3101eS 	uint8_t iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
470dea3101eS 	uint8_t iCtlAck0capable:1;	/* FC Word 0, bit 11 */
471dea3101eS 	uint8_t iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
472dea3101eS 	uint8_t word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
473dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
474dea3101eS 	uint8_t word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
475dea3101eS 	uint8_t iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
476dea3101eS 	uint8_t iCtlAck0capable:1;	/* FC Word 0, bit 11 */
477dea3101eS 	uint8_t iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
478dea3101eS 	uint8_t iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
479dea3101eS #endif
480dea3101eS 
481dea3101eS 	uint8_t word0Reserved4;	/* FC Word 0, bit  0: 7 */
482dea3101eS 
483dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
484dea3101eS 	uint8_t rCtlAck0capable:1;	/* FC Word 1, bit 31 */
485dea3101eS 	uint8_t rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
486dea3101eS 	uint8_t rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
487dea3101eS 	uint8_t rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
488dea3101eS 	uint8_t word1Reserved1:1;	/* FC Word 1, bit 26 */
489dea3101eS 	uint8_t rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
490dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
491dea3101eS 	uint8_t rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
492dea3101eS 	uint8_t word1Reserved1:1;	/* FC Word 1, bit 26 */
493dea3101eS 	uint8_t rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
494dea3101eS 	uint8_t rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
495dea3101eS 	uint8_t rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
496dea3101eS 	uint8_t rCtlAck0capable:1;	/* FC Word 1, bit 31 */
497dea3101eS #endif
498dea3101eS 
499dea3101eS 	uint8_t word1Reserved2;	/* FC Word 1, bit 16:23 */
500dea3101eS 	uint8_t rcvDataSizeMsb;	/* FC Word 1, bit  8:15 */
501dea3101eS 	uint8_t rcvDataSizeLsb;	/* FC Word 1, bit  0: 7 */
502dea3101eS 
503dea3101eS 	uint8_t concurrentSeqMsb;	/* FC Word 2, bit 24:31 */
504dea3101eS 	uint8_t concurrentSeqLsb;	/* FC Word 2, bit 16:23 */
505dea3101eS 	uint8_t EeCreditSeqMsb;	/* FC Word 2, bit  8:15 */
506dea3101eS 	uint8_t EeCreditSeqLsb;	/* FC Word 2, bit  0: 7 */
507dea3101eS 
508dea3101eS 	uint8_t openSeqPerXchgMsb;	/* FC Word 3, bit 24:31 */
509dea3101eS 	uint8_t openSeqPerXchgLsb;	/* FC Word 3, bit 16:23 */
510dea3101eS 	uint8_t word3Reserved1;	/* Fc Word 3, bit  8:15 */
511dea3101eS 	uint8_t word3Reserved2;	/* Fc Word 3, bit  0: 7 */
512dea3101eS };
513dea3101eS 
514aeb3c817SJames Smart #define FAPWWN_KEY_VENDOR	0x42524344 /*valid vendor version fawwpn key*/
515aeb3c817SJames Smart 
516dea3101eS struct serv_parm {	/* Structure is in Big Endian format */
517dea3101eS 	struct csp cmn;
518dea3101eS 	struct lpfc_name portName;
519dea3101eS 	struct lpfc_name nodeName;
520dea3101eS 	struct class_parms cls1;
521dea3101eS 	struct class_parms cls2;
522dea3101eS 	struct class_parms cls3;
523dea3101eS 	struct class_parms cls4;
5248c258641SJames Smart 	union {
525dea3101eS 		uint8_t vendorVersion[16];
5268c258641SJames Smart 		struct {
5278c258641SJames Smart 			uint32_t vid;
5288c258641SJames Smart #define LPFC_VV_EMLX_ID	0x454d4c58	/* EMLX */
5298c258641SJames Smart 			uint32_t flags;
5308c258641SJames Smart #define LPFC_VV_SUPPRESS_RSP	1
5318c258641SJames Smart 		} vv;
5328c258641SJames Smart 	} un;
533dea3101eS };
534dea3101eS 
535dea3101eS /*
536da0436e9SJames Smart  * Virtual Fabric Tagging Header
537da0436e9SJames Smart  */
538da0436e9SJames Smart struct fc_vft_header {
539da0436e9SJames Smart 	 uint32_t word0;
540da0436e9SJames Smart #define fc_vft_hdr_r_ctl_SHIFT		24
541da0436e9SJames Smart #define fc_vft_hdr_r_ctl_MASK		0xFF
542da0436e9SJames Smart #define fc_vft_hdr_r_ctl_WORD		word0
543da0436e9SJames Smart #define fc_vft_hdr_ver_SHIFT		22
544da0436e9SJames Smart #define fc_vft_hdr_ver_MASK		0x3
545da0436e9SJames Smart #define fc_vft_hdr_ver_WORD		word0
546da0436e9SJames Smart #define fc_vft_hdr_type_SHIFT		18
547da0436e9SJames Smart #define fc_vft_hdr_type_MASK		0xF
548da0436e9SJames Smart #define fc_vft_hdr_type_WORD		word0
549da0436e9SJames Smart #define fc_vft_hdr_e_SHIFT		16
550da0436e9SJames Smart #define fc_vft_hdr_e_MASK		0x1
551da0436e9SJames Smart #define fc_vft_hdr_e_WORD		word0
552da0436e9SJames Smart #define fc_vft_hdr_priority_SHIFT	13
553da0436e9SJames Smart #define fc_vft_hdr_priority_MASK	0x7
554da0436e9SJames Smart #define fc_vft_hdr_priority_WORD	word0
555da0436e9SJames Smart #define fc_vft_hdr_vf_id_SHIFT		1
556da0436e9SJames Smart #define fc_vft_hdr_vf_id_MASK		0xFFF
557da0436e9SJames Smart #define fc_vft_hdr_vf_id_WORD		word0
558da0436e9SJames Smart 	uint32_t word1;
559da0436e9SJames Smart #define fc_vft_hdr_hopct_SHIFT		24
560da0436e9SJames Smart #define fc_vft_hdr_hopct_MASK		0xFF
561da0436e9SJames Smart #define fc_vft_hdr_hopct_WORD		word1
562da0436e9SJames Smart };
563da0436e9SJames Smart 
5641a61e548SJames Smart #include <uapi/scsi/fc/fc_els.h>
5651a61e548SJames Smart 
566da0436e9SJames Smart /*
567dea3101eS  *  Extended Link Service LS_COMMAND codes (Payload Word 0)
568dea3101eS  */
569dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
570dea3101eS #define ELS_CMD_MASK      0xffff0000
571dea3101eS #define ELS_RSP_MASK      0xff000000
572dea3101eS #define ELS_CMD_LS_RJT    0x01000000
573dea3101eS #define ELS_CMD_ACC       0x02000000
574dea3101eS #define ELS_CMD_PLOGI     0x03000000
575dea3101eS #define ELS_CMD_FLOGI     0x04000000
576dea3101eS #define ELS_CMD_LOGO      0x05000000
577dea3101eS #define ELS_CMD_ABTX      0x06000000
578dea3101eS #define ELS_CMD_RCS       0x07000000
579dea3101eS #define ELS_CMD_RES       0x08000000
580dea3101eS #define ELS_CMD_RSS       0x09000000
581dea3101eS #define ELS_CMD_RSI       0x0A000000
582dea3101eS #define ELS_CMD_ESTS      0x0B000000
583dea3101eS #define ELS_CMD_ESTC      0x0C000000
584dea3101eS #define ELS_CMD_ADVC      0x0D000000
585dea3101eS #define ELS_CMD_RTV       0x0E000000
586dea3101eS #define ELS_CMD_RLS       0x0F000000
587dea3101eS #define ELS_CMD_ECHO      0x10000000
588dea3101eS #define ELS_CMD_TEST      0x11000000
589dea3101eS #define ELS_CMD_RRQ       0x12000000
590303f2f9cSJames Smart #define ELS_CMD_REC       0x13000000
59186478875SJames Smart #define ELS_CMD_RDP       0x18000000
592df3fe766SJames Smart #define ELS_CMD_RDF       0x19000000
593dea3101eS #define ELS_CMD_PRLI      0x20100014
594a0f2d3efSJames Smart #define ELS_CMD_NVMEPRLI  0x20140018
595dea3101eS #define ELS_CMD_PRLO      0x21100014
59682d9a2a2SJames Smart #define ELS_CMD_PRLO_ACC  0x02100014
597dea3101eS #define ELS_CMD_PDISC     0x50000000
598dea3101eS #define ELS_CMD_FDISC     0x51000000
599dea3101eS #define ELS_CMD_ADISC     0x52000000
600dea3101eS #define ELS_CMD_FARP      0x54000000
601dea3101eS #define ELS_CMD_FARPR     0x55000000
6027bb3b137SJamie Wellnitz #define ELS_CMD_RPL       0x57000000
603dea3101eS #define ELS_CMD_FAN       0x60000000
604dea3101eS #define ELS_CMD_RSCN      0x61040000
605f60cb93bSJames Smart #define ELS_CMD_RSCN_XMT  0x61040008
606dea3101eS #define ELS_CMD_SCR       0x62000000
607dea3101eS #define ELS_CMD_RNID      0x78000000
6087bb3b137SJamie Wellnitz #define ELS_CMD_LIRR      0x7A000000
6098b017a30SJames Smart #define ELS_CMD_LCB	  0x81000000
6101a61e548SJames Smart #define ELS_CMD_FPIN	  0x16000000
6119064aeb2SJames Smart #define ELS_CMD_EDC	  0x17000000
61202169e84SGaurav Srivastava #define ELS_CMD_QFPA      0xB0000000
61302169e84SGaurav Srivastava #define ELS_CMD_UVEM      0xB1000000
614dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
615dea3101eS #define ELS_CMD_MASK      0xffff
616dea3101eS #define ELS_RSP_MASK      0xff
617dea3101eS #define ELS_CMD_LS_RJT    0x01
618dea3101eS #define ELS_CMD_ACC       0x02
619dea3101eS #define ELS_CMD_PLOGI     0x03
620dea3101eS #define ELS_CMD_FLOGI     0x04
621dea3101eS #define ELS_CMD_LOGO      0x05
622dea3101eS #define ELS_CMD_ABTX      0x06
623dea3101eS #define ELS_CMD_RCS       0x07
624dea3101eS #define ELS_CMD_RES       0x08
625dea3101eS #define ELS_CMD_RSS       0x09
626dea3101eS #define ELS_CMD_RSI       0x0A
627dea3101eS #define ELS_CMD_ESTS      0x0B
628dea3101eS #define ELS_CMD_ESTC      0x0C
629dea3101eS #define ELS_CMD_ADVC      0x0D
630dea3101eS #define ELS_CMD_RTV       0x0E
631dea3101eS #define ELS_CMD_RLS       0x0F
632dea3101eS #define ELS_CMD_ECHO      0x10
633dea3101eS #define ELS_CMD_TEST      0x11
634dea3101eS #define ELS_CMD_RRQ       0x12
635303f2f9cSJames Smart #define ELS_CMD_REC       0x13
63686478875SJames Smart #define ELS_CMD_RDP	  0x18
637df3fe766SJames Smart #define ELS_CMD_RDF	  0x19
638dea3101eS #define ELS_CMD_PRLI      0x14001020
639a0f2d3efSJames Smart #define ELS_CMD_NVMEPRLI  0x18001420
640dea3101eS #define ELS_CMD_PRLO      0x14001021
64182d9a2a2SJames Smart #define ELS_CMD_PRLO_ACC  0x14001002
642dea3101eS #define ELS_CMD_PDISC     0x50
643dea3101eS #define ELS_CMD_FDISC     0x51
644dea3101eS #define ELS_CMD_ADISC     0x52
645dea3101eS #define ELS_CMD_FARP      0x54
646dea3101eS #define ELS_CMD_FARPR     0x55
6477bb3b137SJamie Wellnitz #define ELS_CMD_RPL       0x57
648dea3101eS #define ELS_CMD_FAN       0x60
649dea3101eS #define ELS_CMD_RSCN      0x0461
650f60cb93bSJames Smart #define ELS_CMD_RSCN_XMT  0x08000461
651dea3101eS #define ELS_CMD_SCR       0x62
652dea3101eS #define ELS_CMD_RNID      0x78
6537bb3b137SJamie Wellnitz #define ELS_CMD_LIRR      0x7A
6548b017a30SJames Smart #define ELS_CMD_LCB	  0x81
6551a61e548SJames Smart #define ELS_CMD_FPIN	  ELS_FPIN
6569064aeb2SJames Smart #define ELS_CMD_EDC	  ELS_EDC
65702169e84SGaurav Srivastava #define ELS_CMD_QFPA      0xB0
65802169e84SGaurav Srivastava #define ELS_CMD_UVEM      0xB1
659dea3101eS #endif
660dea3101eS 
661dea3101eS /*
662dea3101eS  *  LS_RJT Payload Definition
663dea3101eS  */
664dea3101eS 
665dea3101eS struct ls_rjt {	/* Structure is in Big Endian format */
666dea3101eS 	union {
6676831ce12SJames Smart 		__be32 ls_rjt_error_be;
668dea3101eS 		uint32_t lsRjtError;
669dea3101eS 		struct {
670dea3101eS 			uint8_t lsRjtRsvd0;	/* FC Word 0, bit 24:31 */
671dea3101eS 
672dea3101eS 			uint8_t lsRjtRsnCode;	/* FC Word 0, bit 16:23 */
673dea3101eS 			/* LS_RJT reason codes */
674dea3101eS #define LSRJT_INVALID_CMD     0x01
675dea3101eS #define LSRJT_LOGICAL_ERR     0x03
676dea3101eS #define LSRJT_LOGICAL_BSY     0x05
677dea3101eS #define LSRJT_PROTOCOL_ERR    0x07
678dea3101eS #define LSRJT_UNABLE_TPC      0x09	/* Unable to perform command */
679dea3101eS #define LSRJT_CMD_UNSUPPORTED 0x0B
680dea3101eS #define LSRJT_VENDOR_UNIQUE   0xFF	/* See Byte 3 */
681dea3101eS 
682dea3101eS 			uint8_t lsRjtRsnCodeExp; /* FC Word 0, bit 8:15 */
683dea3101eS 			/* LS_RJT reason explanation */
684dea3101eS #define LSEXP_NOTHING_MORE      0x00
685dea3101eS #define LSEXP_SPARM_OPTIONS     0x01
686dea3101eS #define LSEXP_SPARM_ICTL        0x03
687dea3101eS #define LSEXP_SPARM_RCTL        0x05
688dea3101eS #define LSEXP_SPARM_RCV_SIZE    0x07
689dea3101eS #define LSEXP_SPARM_CONCUR_SEQ  0x09
690dea3101eS #define LSEXP_SPARM_CREDIT      0x0B
691dea3101eS #define LSEXP_INVALID_PNAME     0x0D
692dea3101eS #define LSEXP_INVALID_NNAME     0x0E
693dea3101eS #define LSEXP_INVALID_CSP       0x0F
694dea3101eS #define LSEXP_INVALID_ASSOC_HDR 0x11
695dea3101eS #define LSEXP_ASSOC_HDR_REQ     0x13
696dea3101eS #define LSEXP_INVALID_O_SID     0x15
697dea3101eS #define LSEXP_INVALID_OX_RX     0x17
698dea3101eS #define LSEXP_CMD_IN_PROGRESS   0x19
6997f5f3d0dSJames Smart #define LSEXP_PORT_LOGIN_REQ    0x1E
700dea3101eS #define LSEXP_INVALID_NPORT_ID  0x1F
701dea3101eS #define LSEXP_INVALID_SEQ_ID    0x21
702dea3101eS #define LSEXP_INVALID_XCHG      0x23
703dea3101eS #define LSEXP_INACTIVE_XCHG     0x25
704dea3101eS #define LSEXP_RQ_REQUIRED       0x27
705dea3101eS #define LSEXP_OUT_OF_RESOURCE   0x29
706dea3101eS #define LSEXP_CANT_GIVE_DATA    0x2A
707dea3101eS #define LSEXP_REQ_UNSUPPORTED   0x2C
708dea3101eS 			uint8_t vendorUnique;	/* FC Word 0, bit  0: 7 */
709dea3101eS 		} b;
710dea3101eS 	} un;
711dea3101eS };
712dea3101eS 
713dea3101eS /*
714dea3101eS  *  N_Port Login (FLOGO/PLOGO Request) Payload Definition
715dea3101eS  */
716dea3101eS 
717dea3101eS typedef struct _LOGO {		/* Structure is in Big Endian format */
718dea3101eS 	union {
719dea3101eS 		uint32_t nPortId32;	/* Access nPortId as a word */
720dea3101eS 		struct {
721dea3101eS 			uint8_t word1Reserved1;	/* FC Word 1, bit 31:24 */
722dea3101eS 			uint8_t nPortIdByte0;	/* N_port  ID bit 16:23 */
723dea3101eS 			uint8_t nPortIdByte1;	/* N_port  ID bit  8:15 */
724dea3101eS 			uint8_t nPortIdByte2;	/* N_port  ID bit  0: 7 */
725dea3101eS 		} b;
726dea3101eS 	} un;
727dea3101eS 	struct lpfc_name portName;	/* N_port name field */
728dea3101eS } LOGO;
729dea3101eS 
730dea3101eS /*
731dea3101eS  *  FCP Login (PRLI Request / ACC) Payload Definition
732dea3101eS  */
733dea3101eS 
734dea3101eS #define PRLX_PAGE_LEN   0x10
735dea3101eS #define TPRLO_PAGE_LEN  0x14
736dea3101eS 
737dea3101eS typedef struct _PRLI {		/* Structure is in Big Endian format */
738dea3101eS 	uint8_t prliType;	/* FC Parm Word 0, bit 24:31 */
739dea3101eS 
740dea3101eS #define PRLI_FCP_TYPE 0x08
741a0f2d3efSJames Smart #define PRLI_NVME_TYPE 0x28
742dea3101eS 	uint8_t word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
743dea3101eS 
744dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
745dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
746dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
747dea3101eS 	uint8_t estabImagePair:1;	/* FC Parm Word 0, bit 13 */
748dea3101eS 
749dea3101eS 	/*    ACC = imagePairEstablished */
750dea3101eS 	uint8_t word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
751dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
752dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
753dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
754dea3101eS 	uint8_t word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
755dea3101eS 	uint8_t estabImagePair:1;	/* FC Parm Word 0, bit 13 */
756dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
757dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
758dea3101eS 	/*    ACC = imagePairEstablished */
759dea3101eS #endif
760dea3101eS 
761dea3101eS #define PRLI_REQ_EXECUTED     0x1	/* acceptRspCode */
762dea3101eS #define PRLI_NO_RESOURCES     0x2
763dea3101eS #define PRLI_INIT_INCOMPLETE  0x3
764dea3101eS #define PRLI_NO_SUCH_PA       0x4
765dea3101eS #define PRLI_PREDEF_CONFIG    0x5
766dea3101eS #define PRLI_PARTIAL_SUCCESS  0x6
767dea3101eS #define PRLI_INVALID_PAGE_CNT 0x7
768dea3101eS 	uint8_t word0Reserved3;	/* FC Parm Word 0, bit 0:7 */
769dea3101eS 
770dea3101eS 	uint32_t origProcAssoc;	/* FC Parm Word 1, bit 0:31 */
771dea3101eS 
772dea3101eS 	uint32_t respProcAssoc;	/* FC Parm Word 2, bit 0:31 */
773dea3101eS 
774dea3101eS 	uint8_t word3Reserved1;	/* FC Parm Word 3, bit 24:31 */
775dea3101eS 	uint8_t word3Reserved2;	/* FC Parm Word 3, bit 16:23 */
776dea3101eS 
777dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
778dea3101eS 	uint16_t Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
779dea3101eS 	uint16_t Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
780dea3101eS 	uint16_t Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
781dea3101eS 	uint16_t Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
782dea3101eS 	uint16_t Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
783dea3101eS 	uint16_t Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
784dea3101eS 	uint16_t TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
785dea3101eS 	uint16_t Retry:1;	/* FC Parm Word 3, bit  8 */
786dea3101eS 	uint16_t ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
787dea3101eS 	uint16_t dataOverLay:1;	/* FC Parm Word 3, bit  6 */
788dea3101eS 	uint16_t initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
789dea3101eS 	uint16_t targetFunc:1;	/* FC Parm Word 3, bit  4 */
790dea3101eS 	uint16_t cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
791dea3101eS 	uint16_t dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
792dea3101eS 	uint16_t readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
793dea3101eS 	uint16_t writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
794dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
795dea3101eS 	uint16_t Retry:1;	/* FC Parm Word 3, bit  8 */
796dea3101eS 	uint16_t TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
797dea3101eS 	uint16_t Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
798dea3101eS 	uint16_t Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
799dea3101eS 	uint16_t Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
800dea3101eS 	uint16_t Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
801dea3101eS 	uint16_t Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
802dea3101eS 	uint16_t Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
803dea3101eS 	uint16_t writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
804dea3101eS 	uint16_t readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
805dea3101eS 	uint16_t dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
806dea3101eS 	uint16_t cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
807dea3101eS 	uint16_t targetFunc:1;	/* FC Parm Word 3, bit  4 */
808dea3101eS 	uint16_t initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
809dea3101eS 	uint16_t dataOverLay:1;	/* FC Parm Word 3, bit  6 */
810dea3101eS 	uint16_t ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
811dea3101eS #endif
812dea3101eS } PRLI;
813dea3101eS 
814dea3101eS /*
815dea3101eS  *  FCP Logout (PRLO Request / ACC) Payload Definition
816dea3101eS  */
817dea3101eS 
818dea3101eS typedef struct _PRLO {		/* Structure is in Big Endian format */
819dea3101eS 	uint8_t prloType;	/* FC Parm Word 0, bit 24:31 */
820dea3101eS 
821dea3101eS #define PRLO_FCP_TYPE  0x08
822dea3101eS 	uint8_t word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
823dea3101eS 
824dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
825dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
826dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
827dea3101eS 	uint8_t word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
828dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
829dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
830dea3101eS 	uint8_t acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, ACC ONLY */
831dea3101eS 	uint8_t word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
832dea3101eS 	uint8_t respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
833dea3101eS 	uint8_t origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
834dea3101eS #endif
835dea3101eS 
836dea3101eS #define PRLO_REQ_EXECUTED     0x1	/* acceptRspCode */
837dea3101eS #define PRLO_NO_SUCH_IMAGE    0x4
838dea3101eS #define PRLO_INVALID_PAGE_CNT 0x7
839dea3101eS 
840dea3101eS 	uint8_t word0Reserved3;	/* FC Parm Word 0, bit 0:7 */
841dea3101eS 
842dea3101eS 	uint32_t origProcAssoc;	/* FC Parm Word 1, bit 0:31 */
843dea3101eS 
844dea3101eS 	uint32_t respProcAssoc;	/* FC Parm Word 2, bit 0:31 */
845dea3101eS 
846dea3101eS 	uint32_t word3Reserved1;	/* FC Parm Word 3, bit 0:31 */
847dea3101eS } PRLO;
848dea3101eS 
849dea3101eS typedef struct _ADISC {		/* Structure is in Big Endian format */
850dea3101eS 	uint32_t hardAL_PA;
851dea3101eS 	struct lpfc_name portName;
852dea3101eS 	struct lpfc_name nodeName;
853dea3101eS 	uint32_t DID;
8541d755d64SJames Smart } __packed ADISC;
855dea3101eS 
856dea3101eS typedef struct _FARP {		/* Structure is in Big Endian format */
857dea3101eS 	uint32_t Mflags:8;
858dea3101eS 	uint32_t Odid:24;
859dea3101eS #define FARP_NO_ACTION          0	/* FARP information enclosed, no
860dea3101eS 					   action */
861dea3101eS #define FARP_MATCH_PORT         0x1	/* Match on Responder Port Name */
862dea3101eS #define FARP_MATCH_NODE         0x2	/* Match on Responder Node Name */
863dea3101eS #define FARP_MATCH_IP           0x4	/* Match on IP address, not supported */
864dea3101eS #define FARP_MATCH_IPV4         0x5	/* Match on IPV4 address, not
865dea3101eS 					   supported */
866dea3101eS #define FARP_MATCH_IPV6         0x6	/* Match on IPV6 address, not
867dea3101eS 					   supported */
868dea3101eS 	uint32_t Rflags:8;
869dea3101eS 	uint32_t Rdid:24;
870dea3101eS #define FARP_REQUEST_PLOGI      0x1	/* Request for PLOGI */
871dea3101eS #define FARP_REQUEST_FARPR      0x2	/* Request for FARP Response */
872dea3101eS 	struct lpfc_name OportName;
873dea3101eS 	struct lpfc_name OnodeName;
874dea3101eS 	struct lpfc_name RportName;
875dea3101eS 	struct lpfc_name RnodeName;
876dea3101eS 	uint8_t Oipaddr[16];
877dea3101eS 	uint8_t Ripaddr[16];
878dea3101eS } FARP;
879dea3101eS 
880dea3101eS typedef struct _FAN {		/* Structure is in Big Endian format */
881dea3101eS 	uint32_t Fdid;
882dea3101eS 	struct lpfc_name FportName;
883dea3101eS 	struct lpfc_name FnodeName;
8841d755d64SJames Smart } __packed FAN;
885dea3101eS 
886dea3101eS typedef struct _SCR {		/* Structure is in Big Endian format */
887dea3101eS 	uint8_t resvd1;
888dea3101eS 	uint8_t resvd2;
889dea3101eS 	uint8_t resvd3;
890dea3101eS 	uint8_t Function;
891dea3101eS #define  SCR_FUNC_FABRIC     0x01
892dea3101eS #define  SCR_FUNC_NPORT      0x02
893dea3101eS #define  SCR_FUNC_FULL       0x03
894dea3101eS #define  SCR_CLEAR           0xff
895dea3101eS } SCR;
896dea3101eS 
897dea3101eS typedef struct _RNID_TOP_DISC {
898dea3101eS 	struct lpfc_name portName;
899dea3101eS 	uint8_t resvd[8];
900dea3101eS 	uint32_t unitType;
901dea3101eS #define RNID_HBA            0x7
902dea3101eS #define RNID_HOST           0xa
903dea3101eS #define RNID_DRIVER         0xd
904dea3101eS 	uint32_t physPort;
905dea3101eS 	uint32_t attachedNodes;
906dea3101eS 	uint16_t ipVersion;
907dea3101eS #define RNID_IPV4           0x1
908dea3101eS #define RNID_IPV6           0x2
909dea3101eS 	uint16_t UDPport;
910dea3101eS 	uint8_t ipAddr[16];
911dea3101eS 	uint16_t resvd1;
912dea3101eS 	uint16_t flags;
913dea3101eS #define RNID_TD_SUPPORT     0x1
914dea3101eS #define RNID_LP_VALID       0x2
915dea3101eS } RNID_TOP_DISC;
916dea3101eS 
917dea3101eS typedef struct _RNID {		/* Structure is in Big Endian format */
918dea3101eS 	uint8_t Format;
919dea3101eS #define RNID_TOPOLOGY_DISC  0xdf
920dea3101eS 	uint8_t CommonLen;
921dea3101eS 	uint8_t resvd1;
922dea3101eS 	uint8_t SpecificLen;
923dea3101eS 	struct lpfc_name portName;
924dea3101eS 	struct lpfc_name nodeName;
925dea3101eS 	union {
926dea3101eS 		RNID_TOP_DISC topologyDisc;	/* topology disc (0xdf) */
927dea3101eS 	} un;
9281d755d64SJames Smart } __packed RNID;
929dea3101eS 
93012265f68SJames Smart struct RLS {			/* Structure is in Big Endian format */
93112265f68SJames Smart 	uint32_t rls;
93212265f68SJames Smart #define rls_rsvd_SHIFT		24
93312265f68SJames Smart #define rls_rsvd_MASK		0x000000ff
93412265f68SJames Smart #define rls_rsvd_WORD		rls
93512265f68SJames Smart #define rls_did_SHIFT		0
93612265f68SJames Smart #define rls_did_MASK		0x00ffffff
93712265f68SJames Smart #define rls_did_WORD		rls
93812265f68SJames Smart };
93912265f68SJames Smart 
94012265f68SJames Smart struct  RLS_RSP {		/* Structure is in Big Endian format */
94112265f68SJames Smart 	uint32_t linkFailureCnt;
94212265f68SJames Smart 	uint32_t lossSyncCnt;
94312265f68SJames Smart 	uint32_t lossSignalCnt;
94412265f68SJames Smart 	uint32_t primSeqErrCnt;
94512265f68SJames Smart 	uint32_t invalidXmitWord;
94612265f68SJames Smart 	uint32_t crcCnt;
94712265f68SJames Smart };
94812265f68SJames Smart 
94919ca7609SJames Smart struct RRQ {			/* Structure is in Big Endian format */
95019ca7609SJames Smart 	uint32_t rrq;
95119ca7609SJames Smart #define rrq_rsvd_SHIFT		24
95219ca7609SJames Smart #define rrq_rsvd_MASK		0x000000ff
95319ca7609SJames Smart #define rrq_rsvd_WORD		rrq
95419ca7609SJames Smart #define rrq_did_SHIFT		0
95519ca7609SJames Smart #define rrq_did_MASK		0x00ffffff
95619ca7609SJames Smart #define rrq_did_WORD		rrq
95719ca7609SJames Smart 	uint32_t rrq_exchg;
95819ca7609SJames Smart #define rrq_oxid_SHIFT		16
95919ca7609SJames Smart #define rrq_oxid_MASK		0xffff
96019ca7609SJames Smart #define rrq_oxid_WORD		rrq_exchg
96119ca7609SJames Smart #define rrq_rxid_SHIFT		0
96219ca7609SJames Smart #define rrq_rxid_MASK		0xffff
96319ca7609SJames Smart #define rrq_rxid_WORD		rrq_exchg
96419ca7609SJames Smart };
96519ca7609SJames Smart 
966912e3acdSJames Smart #define LPFC_MAX_VFN_PER_PFN	255 /* Maximum VFs allowed per ARI */
967912e3acdSJames Smart #define LPFC_DEF_VFN_PER_PFN	0   /* Default VFs due to platform limitation*/
96819ca7609SJames Smart 
96912265f68SJames Smart struct RTV_RSP {		/* Structure is in Big Endian format */
97012265f68SJames Smart 	uint32_t ratov;
97112265f68SJames Smart 	uint32_t edtov;
97212265f68SJames Smart 	uint32_t qtov;
97312265f68SJames Smart #define qtov_rsvd0_SHIFT	28
97412265f68SJames Smart #define qtov_rsvd0_MASK		0x0000000f
97512265f68SJames Smart #define qtov_rsvd0_WORD		qtov		/* reserved */
97612265f68SJames Smart #define qtov_edtovres_SHIFT	27
97712265f68SJames Smart #define qtov_edtovres_MASK	0x00000001
97812265f68SJames Smart #define qtov_edtovres_WORD	qtov		/* E_D_TOV Resolution */
97912265f68SJames Smart #define qtov__rsvd1_SHIFT	19
98012265f68SJames Smart #define qtov_rsvd1_MASK		0x0000003f
98112265f68SJames Smart #define qtov_rsvd1_WORD		qtov		/* reserved */
98212265f68SJames Smart #define qtov_rttov_SHIFT	18
98312265f68SJames Smart #define qtov_rttov_MASK		0x00000001
98412265f68SJames Smart #define qtov_rttov_WORD		qtov		/* R_T_TOV value */
98512265f68SJames Smart #define qtov_rsvd2_SHIFT	0
98612265f68SJames Smart #define qtov_rsvd2_MASK		0x0003ffff
98712265f68SJames Smart #define qtov_rsvd2_WORD		qtov		/* reserved */
98812265f68SJames Smart };
98912265f68SJames Smart 
99012265f68SJames Smart 
9917bb3b137SJamie Wellnitz typedef struct  _RPL {		/* Structure is in Big Endian format */
9927bb3b137SJamie Wellnitz 	uint32_t maxsize;
9937bb3b137SJamie Wellnitz 	uint32_t index;
9947bb3b137SJamie Wellnitz } RPL;
9957bb3b137SJamie Wellnitz 
9967bb3b137SJamie Wellnitz typedef struct  _PORT_NUM_BLK {
9977bb3b137SJamie Wellnitz 	uint32_t portNum;
9987bb3b137SJamie Wellnitz 	uint32_t portID;
9997bb3b137SJamie Wellnitz 	struct lpfc_name portName;
10007bb3b137SJamie Wellnitz } PORT_NUM_BLK;
10017bb3b137SJamie Wellnitz 
10027bb3b137SJamie Wellnitz typedef struct  _RPL_RSP {	/* Structure is in Big Endian format */
10037bb3b137SJamie Wellnitz 	uint32_t listLen;
10047bb3b137SJamie Wellnitz 	uint32_t index;
10057bb3b137SJamie Wellnitz 	PORT_NUM_BLK port_num_blk;
10067bb3b137SJamie Wellnitz } RPL_RSP;
1007dea3101eS 
1008dea3101eS /* This is used for RSCN command */
1009dea3101eS typedef struct _D_ID {		/* Structure is in Big Endian format */
1010dea3101eS 	union {
1011dea3101eS 		uint32_t word;
1012dea3101eS 		struct {
1013dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
1014dea3101eS 			uint8_t resv;
1015dea3101eS 			uint8_t domain;
1016dea3101eS 			uint8_t area;
1017dea3101eS 			uint8_t id;
1018dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
1019dea3101eS 			uint8_t id;
1020dea3101eS 			uint8_t area;
1021dea3101eS 			uint8_t domain;
1022dea3101eS 			uint8_t resv;
1023dea3101eS #endif
1024dea3101eS 		} b;
1025dea3101eS 	} un;
1026dea3101eS } D_ID;
1027dea3101eS 
1028eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_PORT	0x0
1029eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_AREA	0x1
1030eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_DOMAIN	0x2
1031eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_FABRIC	0x3
1032eaf15d5bSJames Smart #define RSCN_ADDRESS_FORMAT_MASK	0x3
1033eaf15d5bSJames Smart 
1034dea3101eS /*
1035dea3101eS  *  Structure to define all ELS Payload types
1036dea3101eS  */
1037dea3101eS 
1038dea3101eS typedef struct _ELS_PKT {	/* Structure is in Big Endian format */
1039dea3101eS 	uint8_t elsCode;	/* FC Word 0, bit 24:31 */
1040dea3101eS 	uint8_t elsByte1;
1041dea3101eS 	uint8_t elsByte2;
1042dea3101eS 	uint8_t elsByte3;
1043dea3101eS 	union {
1044dea3101eS 		struct ls_rjt lsRjt;	/* Payload for LS_RJT ELS response */
1045dea3101eS 		struct serv_parm logi;	/* Payload for PLOGI/FLOGI/PDISC/ACC */
1046dea3101eS 		LOGO logo;	/* Payload for PLOGO/FLOGO/ACC */
1047dea3101eS 		PRLI prli;	/* Payload for PRLI/ACC */
1048dea3101eS 		PRLO prlo;	/* Payload for PRLO/ACC */
1049dea3101eS 		ADISC adisc;	/* Payload for ADISC/ACC */
1050dea3101eS 		FARP farp;	/* Payload for FARP/ACC */
1051dea3101eS 		FAN fan;	/* Payload for FAN */
1052dea3101eS 		SCR scr;	/* Payload for SCR/ACC */
1053dea3101eS 		RNID rnid;	/* Payload for RNID */
1054dea3101eS 		uint8_t pad[128 - 4];	/* Pad out to payload of 128 bytes */
1055dea3101eS 	} un;
1056dea3101eS } ELS_PKT;
1057dea3101eS 
10588b017a30SJames Smart /*
10598b017a30SJames Smart  * Link Cable Beacon (LCB) ELS Frame
10608b017a30SJames Smart  */
10618b017a30SJames Smart 
10628b017a30SJames Smart struct fc_lcb_request_frame {
10638b017a30SJames Smart 	uint32_t      lcb_command;      /* ELS command opcode (0x81)     */
10648b017a30SJames Smart 	uint8_t       lcb_sub_command;/* LCB Payload Word 1, bit 24:31 */
10658b017a30SJames Smart #define LPFC_LCB_ON		0x1
10668b017a30SJames Smart #define LPFC_LCB_OFF		0x2
106766e9e6bfSJames Smart 	uint8_t       reserved[2];
106866e9e6bfSJames Smart 	uint8_t	      capability;	/* LCB Payload Word 1, bit 0:7 */
10698b017a30SJames Smart 	uint8_t       lcb_type; /* LCB Payload Word 2, bit 24:31 */
10708b017a30SJames Smart #define LPFC_LCB_GREEN		0x1
10718b017a30SJames Smart #define LPFC_LCB_AMBER		0x2
10728b017a30SJames Smart 	uint8_t       lcb_frequency;    /* LCB Payload Word 2, bit 16:23 */
107366e9e6bfSJames Smart #define LCB_CAPABILITY_DURATION	1
107466e9e6bfSJames Smart #define BEACON_VERSION_V1	1
107566e9e6bfSJames Smart #define BEACON_VERSION_V0	0
10768b017a30SJames Smart 	uint16_t      lcb_duration;     /* LCB Payload Word 2, bit 15:0  */
10778b017a30SJames Smart };
10788b017a30SJames Smart 
10798b017a30SJames Smart /*
10808b017a30SJames Smart  * Link Cable Beacon (LCB) ELS Response Frame
10818b017a30SJames Smart  */
10828b017a30SJames Smart struct fc_lcb_res_frame {
10838b017a30SJames Smart 	uint32_t      lcb_ls_acc;       /* Acceptance of LCB request (0x02) */
10848b017a30SJames Smart 	uint8_t       lcb_sub_command;/* LCB Payload Word 1, bit 24:31 */
108566e9e6bfSJames Smart 	uint8_t       reserved[2];
108666e9e6bfSJames Smart 	uint8_t	      capability;	/* LCB Payload Word 1, bit 0:7 */
10878b017a30SJames Smart 	uint8_t       lcb_type; /* LCB Payload Word 2, bit 24:31 */
10888b017a30SJames Smart 	uint8_t       lcb_frequency;    /* LCB Payload Word 2, bit 16:23 */
10898b017a30SJames Smart 	uint16_t      lcb_duration;     /* LCB Payload Word 2, bit 15:0  */
10908b017a30SJames Smart };
10918b017a30SJames Smart 
109286478875SJames Smart /*
109386478875SJames Smart  * Read Diagnostic Parameters (RDP) ELS frame.
109486478875SJames Smart  */
109586478875SJames Smart #define SFF_PG0_IDENT_SFP              0x3
109686478875SJames Smart 
109786478875SJames Smart #define SFP_FLAG_PT_OPTICAL            0x0
109886478875SJames Smart #define SFP_FLAG_PT_SWLASER            0x01
109986478875SJames Smart #define SFP_FLAG_PT_LWLASER_LC1310     0x02
110086478875SJames Smart #define SFP_FLAG_PT_LWLASER_LL1550     0x03
110186478875SJames Smart #define SFP_FLAG_PT_MASK               0x0F
110286478875SJames Smart #define SFP_FLAG_PT_SHIFT              0
110386478875SJames Smart 
110486478875SJames Smart #define SFP_FLAG_IS_OPTICAL_PORT       0x01
110586478875SJames Smart #define SFP_FLAG_IS_OPTICAL_MASK       0x010
110686478875SJames Smart #define SFP_FLAG_IS_OPTICAL_SHIFT      4
110786478875SJames Smart 
110886478875SJames Smart #define SFP_FLAG_IS_DESC_VALID         0x01
110986478875SJames Smart #define SFP_FLAG_IS_DESC_VALID_MASK    0x020
111086478875SJames Smart #define SFP_FLAG_IS_DESC_VALID_SHIFT   5
111186478875SJames Smart 
111286478875SJames Smart #define SFP_FLAG_CT_UNKNOWN            0x0
111386478875SJames Smart #define SFP_FLAG_CT_SFP_PLUS           0x01
111486478875SJames Smart #define SFP_FLAG_CT_MASK               0x3C
111586478875SJames Smart #define SFP_FLAG_CT_SHIFT              6
111686478875SJames Smart 
111786478875SJames Smart struct fc_rdp_port_name_info {
111886478875SJames Smart 	uint8_t wwnn[8];
111986478875SJames Smart 	uint8_t wwpn[8];
112086478875SJames Smart };
112186478875SJames Smart 
112286478875SJames Smart 
112386478875SJames Smart /*
112486478875SJames Smart  * Link Error Status Block Structure (FC-FS-3) for RDP
112586478875SJames Smart  * This similar to RPS ELS
112686478875SJames Smart  */
112786478875SJames Smart struct fc_link_status {
112886478875SJames Smart 	uint32_t      link_failure_cnt;
112986478875SJames Smart 	uint32_t      loss_of_synch_cnt;
113086478875SJames Smart 	uint32_t      loss_of_signal_cnt;
113186478875SJames Smart 	uint32_t      primitive_seq_proto_err;
113286478875SJames Smart 	uint32_t      invalid_trans_word;
113386478875SJames Smart 	uint32_t      invalid_crc_cnt;
113486478875SJames Smart 
113586478875SJames Smart };
113686478875SJames Smart 
113786478875SJames Smart #define RDP_PORT_NAMES_DESC_TAG  0x00010003
113886478875SJames Smart struct fc_rdp_port_name_desc {
113986478875SJames Smart 	uint32_t	tag;     /* 0001 0003h */
114086478875SJames Smart 	uint32_t	length;  /* set to size of payload struct */
114186478875SJames Smart 	struct fc_rdp_port_name_info  port_names;
114286478875SJames Smart };
114386478875SJames Smart 
114486478875SJames Smart 
11454258e98eSJames Smart struct fc_rdp_fec_info {
11464258e98eSJames Smart 	uint32_t CorrectedBlocks;
11474258e98eSJames Smart 	uint32_t UncorrectableBlocks;
11484258e98eSJames Smart };
11494258e98eSJames Smart 
11504258e98eSJames Smart #define RDP_FEC_DESC_TAG  0x00010005
11514258e98eSJames Smart struct fc_fec_rdp_desc {
11524258e98eSJames Smart 	uint32_t tag;
11534258e98eSJames Smart 	uint32_t length;
11544258e98eSJames Smart 	struct fc_rdp_fec_info info;
11554258e98eSJames Smart };
11564258e98eSJames Smart 
115786478875SJames Smart struct fc_rdp_link_error_status_payload_info {
115886478875SJames Smart 	struct fc_link_status link_status; /* 24 bytes */
115986478875SJames Smart 	uint32_t  port_type;             /* bits 31-30 only */
116086478875SJames Smart };
116186478875SJames Smart 
116286478875SJames Smart #define RDP_LINK_ERROR_STATUS_DESC_TAG  0x00010002
116386478875SJames Smart struct fc_rdp_link_error_status_desc {
116486478875SJames Smart 	uint32_t         tag;     /* 0001 0002h */
116586478875SJames Smart 	uint32_t         length;  /* set to size of payload struct */
116686478875SJames Smart 	struct fc_rdp_link_error_status_payload_info info;
116786478875SJames Smart };
116886478875SJames Smart 
116986478875SJames Smart #define VN_PT_PHY_UNKNOWN      0x00
117086478875SJames Smart #define VN_PT_PHY_PF_PORT      0x01
117186478875SJames Smart #define VN_PT_PHY_ETH_MAC      0x10
117286478875SJames Smart #define VN_PT_PHY_SHIFT                30
117386478875SJames Smart 
117486478875SJames Smart #define RDP_PS_1GB             0x8000
117586478875SJames Smart #define RDP_PS_2GB             0x4000
117686478875SJames Smart #define RDP_PS_4GB             0x2000
117786478875SJames Smart #define RDP_PS_10GB            0x1000
117886478875SJames Smart #define RDP_PS_8GB             0x0800
117986478875SJames Smart #define RDP_PS_16GB            0x0400
118086478875SJames Smart #define RDP_PS_32GB            0x0200
1181fbd8a6baSJames Smart #define RDP_PS_64GB            0x0100
1182fbd8a6baSJames Smart #define RDP_PS_128GB           0x0080
1183fbd8a6baSJames Smart #define RDP_PS_256GB           0x0040
118486478875SJames Smart 
118556204984SJames Smart #define RDP_CAP_USER_CONFIGURED 0x0002
118686478875SJames Smart #define RDP_CAP_UNKNOWN         0x0001
118786478875SJames Smart #define RDP_PS_UNKNOWN          0x0002
118886478875SJames Smart #define RDP_PS_NOT_ESTABLISHED  0x0001
118986478875SJames Smart 
119086478875SJames Smart struct fc_rdp_port_speed {
119186478875SJames Smart 	uint16_t   capabilities;
119286478875SJames Smart 	uint16_t   speed;
119386478875SJames Smart };
119486478875SJames Smart 
119586478875SJames Smart struct fc_rdp_port_speed_info {
119686478875SJames Smart 	struct fc_rdp_port_speed   port_speed;
119786478875SJames Smart };
119886478875SJames Smart 
119986478875SJames Smart #define RDP_PORT_SPEED_DESC_TAG  0x00010001
120086478875SJames Smart struct fc_rdp_port_speed_desc {
120186478875SJames Smart 	uint32_t         tag;            /* 00010001h */
120286478875SJames Smart 	uint32_t         length;         /* set to size of payload struct */
120386478875SJames Smart 	struct fc_rdp_port_speed_info info;
120486478875SJames Smart };
120586478875SJames Smart 
120686478875SJames Smart #define RDP_NPORT_ID_SIZE      4
120786478875SJames Smart #define RDP_N_PORT_DESC_TAG    0x00000003
120886478875SJames Smart struct fc_rdp_nport_desc {
120986478875SJames Smart 	uint32_t         tag;          /* 0000 0003h, big endian */
121086478875SJames Smart 	uint32_t         length;       /* size of RDP_N_PORT_ID struct */
121186478875SJames Smart 	uint32_t         nport_id : 12;
121286478875SJames Smart 	uint32_t         reserved : 8;
121386478875SJames Smart };
121486478875SJames Smart 
121586478875SJames Smart 
121686478875SJames Smart struct fc_rdp_link_service_info {
121786478875SJames Smart 	uint32_t         els_req;    /* Request payload word 0 value.*/
121886478875SJames Smart };
121986478875SJames Smart 
122086478875SJames Smart #define RDP_LINK_SERVICE_DESC_TAG  0x00000001
122186478875SJames Smart struct fc_rdp_link_service_desc {
122286478875SJames Smart 	uint32_t         tag;     /* Descriptor tag  1 */
122386478875SJames Smart 	uint32_t         length;  /* set to size of payload struct. */
122486478875SJames Smart 	struct fc_rdp_link_service_info  payload;
122586478875SJames Smart 				  /* must be ELS req Word 0(0x18) */
122686478875SJames Smart };
122786478875SJames Smart 
122886478875SJames Smart struct fc_rdp_sfp_info {
122986478875SJames Smart 	uint16_t	temperature;
123086478875SJames Smart 	uint16_t	vcc;
123186478875SJames Smart 	uint16_t	tx_bias;
123286478875SJames Smart 	uint16_t	tx_power;
123386478875SJames Smart 	uint16_t	rx_power;
123486478875SJames Smart 	uint16_t	flags;
123586478875SJames Smart };
123686478875SJames Smart 
123786478875SJames Smart #define RDP_SFP_DESC_TAG  0x00010000
123886478875SJames Smart struct fc_rdp_sfp_desc {
123986478875SJames Smart 	uint32_t         tag;
124086478875SJames Smart 	uint32_t         length;  /* set to size of sfp_info struct */
124186478875SJames Smart 	struct fc_rdp_sfp_info sfp_info;
124286478875SJames Smart };
124386478875SJames Smart 
124456204984SJames Smart /* Buffer Credit Descriptor */
124556204984SJames Smart struct fc_rdp_bbc_info {
124656204984SJames Smart 	uint32_t              port_bbc; /* FC_Port buffer-to-buffer credit */
124756204984SJames Smart 	uint32_t              attached_port_bbc;
124856204984SJames Smart 	uint32_t              rtt;      /* Round trip time */
124956204984SJames Smart };
125056204984SJames Smart #define RDP_BBC_DESC_TAG  0x00010006
125156204984SJames Smart struct fc_rdp_bbc_desc {
125256204984SJames Smart 	uint32_t              tag;
125356204984SJames Smart 	uint32_t              length;
125456204984SJames Smart 	struct fc_rdp_bbc_info  bbc_info;
125556204984SJames Smart };
125656204984SJames Smart 
1257310429efSJames Smart /* Optical Element Type Transgression Flags */
1258310429efSJames Smart #define RDP_OET_LOW_WARNING  0x1
1259310429efSJames Smart #define RDP_OET_HIGH_WARNING 0x2
1260310429efSJames Smart #define RDP_OET_LOW_ALARM    0x4
1261310429efSJames Smart #define RDP_OET_HIGH_ALARM   0x8
1262310429efSJames Smart 
126356204984SJames Smart #define RDP_OED_TEMPERATURE  0x1
126456204984SJames Smart #define RDP_OED_VOLTAGE      0x2
126556204984SJames Smart #define RDP_OED_TXBIAS       0x3
126656204984SJames Smart #define RDP_OED_TXPOWER      0x4
126756204984SJames Smart #define RDP_OED_RXPOWER      0x5
126856204984SJames Smart 
126956204984SJames Smart #define RDP_OED_TYPE_SHIFT   28
127056204984SJames Smart /* Optical Element Data descriptor */
127156204984SJames Smart struct fc_rdp_oed_info {
127256204984SJames Smart 	uint16_t            hi_alarm;
127356204984SJames Smart 	uint16_t            lo_alarm;
127456204984SJames Smart 	uint16_t            hi_warning;
127556204984SJames Smart 	uint16_t            lo_warning;
127656204984SJames Smart 	uint32_t            function_flags;
127756204984SJames Smart };
127856204984SJames Smart #define RDP_OED_DESC_TAG  0x00010007
127956204984SJames Smart struct fc_rdp_oed_sfp_desc {
128056204984SJames Smart 	uint32_t             tag;
128156204984SJames Smart 	uint32_t             length;
128256204984SJames Smart 	struct fc_rdp_oed_info oed_info;
128356204984SJames Smart };
128456204984SJames Smart 
128556204984SJames Smart /* Optical Product Data descriptor */
128656204984SJames Smart struct fc_rdp_opd_sfp_info {
128756204984SJames Smart 	uint8_t            vendor_name[16];
128856204984SJames Smart 	uint8_t            model_number[16];
128956204984SJames Smart 	uint8_t            serial_number[16];
1290a0f2d3efSJames Smart 	uint8_t            revision[4];
129156204984SJames Smart 	uint8_t            date[8];
129256204984SJames Smart };
129356204984SJames Smart 
129456204984SJames Smart #define RDP_OPD_DESC_TAG  0x00010008
129556204984SJames Smart struct fc_rdp_opd_sfp_desc {
129656204984SJames Smart 	uint32_t             tag;
129756204984SJames Smart 	uint32_t             length;
129856204984SJames Smart 	struct fc_rdp_opd_sfp_info opd_info;
129956204984SJames Smart };
130056204984SJames Smart 
130186478875SJames Smart struct fc_rdp_req_frame {
130286478875SJames Smart 	uint32_t         rdp_command;           /* ELS command opcode (0x18)*/
130386478875SJames Smart 	uint32_t         rdp_des_length;        /* RDP Payload Word 1 */
130486478875SJames Smart 	struct fc_rdp_nport_desc nport_id_desc; /* RDP Payload Word 2 - 4 */
130586478875SJames Smart };
130686478875SJames Smart 
130786478875SJames Smart 
130886478875SJames Smart struct fc_rdp_res_frame {
130986478875SJames Smart 	uint32_t    reply_sequence;		/* FC word0 LS_ACC or LS_RJT */
131086478875SJames Smart 	uint32_t   length;			/* FC Word 1      */
131186478875SJames Smart 	struct fc_rdp_link_service_desc link_service_desc;    /* Word 2 -4   */
131286478875SJames Smart 	struct fc_rdp_sfp_desc sfp_desc;                      /* Word 5 -9   */
131386478875SJames Smart 	struct fc_rdp_port_speed_desc portspeed_desc;         /* Word 10 -12 */
131486478875SJames Smart 	struct fc_rdp_link_error_status_desc link_error_desc; /* Word 13 -21 */
131586478875SJames Smart 	struct fc_rdp_port_name_desc diag_port_names_desc;    /* Word 22 -27 */
131686478875SJames Smart 	struct fc_rdp_port_name_desc attached_port_names_desc;/* Word 28 -33 */
13176c92d1d0SJames Smart 	struct fc_fec_rdp_desc fec_desc;                      /* FC word 34-37*/
13186c92d1d0SJames Smart 	struct fc_rdp_bbc_desc bbc_desc;                      /* FC Word 38-42*/
13196c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_temp_desc;             /* FC Word 43-47*/
13206c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_voltage_desc;          /* FC word 48-52*/
13216c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_txbias_desc;           /* FC word 53-57*/
13226c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_txpower_desc;          /* FC word 58-62*/
13236c92d1d0SJames Smart 	struct fc_rdp_oed_sfp_desc oed_rxpower_desc;          /* FC word 63-67*/
13246c92d1d0SJames Smart 	struct fc_rdp_opd_sfp_desc opd_desc;                  /* FC word 68-84*/
132586478875SJames Smart };
132686478875SJames Smart 
132786478875SJames Smart 
132802169e84SGaurav Srivastava /* UVEM */
132902169e84SGaurav Srivastava 
133002169e84SGaurav Srivastava #define LPFC_UVEM_SIZE 60
133102169e84SGaurav Srivastava #define LPFC_UVEM_VEM_ID_DESC_SIZE 16
133202169e84SGaurav Srivastava #define LPFC_UVEM_VE_MAP_DESC_SIZE 20
133302169e84SGaurav Srivastava 
133402169e84SGaurav Srivastava #define VEM_ID_DESC_TAG  0x0001000A
133502169e84SGaurav Srivastava struct lpfc_vem_id_desc {
133602169e84SGaurav Srivastava 	uint32_t tag;
133702169e84SGaurav Srivastava 	uint32_t length;
133802169e84SGaurav Srivastava 	uint8_t vem_id[16];
133902169e84SGaurav Srivastava };
134002169e84SGaurav Srivastava 
134102169e84SGaurav Srivastava #define LPFC_QFPA_SIZE	4
134202169e84SGaurav Srivastava 
134302169e84SGaurav Srivastava #define INSTANTIATED_VE_DESC_TAG  0x0001000B
134402169e84SGaurav Srivastava struct instantiated_ve_desc {
134502169e84SGaurav Srivastava 	uint32_t tag;
134602169e84SGaurav Srivastava 	uint32_t length;
134702169e84SGaurav Srivastava 	uint8_t global_vem_id[16];
134802169e84SGaurav Srivastava 	uint32_t word6;
134902169e84SGaurav Srivastava #define lpfc_instantiated_local_id_SHIFT   0
135002169e84SGaurav Srivastava #define lpfc_instantiated_local_id_MASK    0x000000ff
135102169e84SGaurav Srivastava #define lpfc_instantiated_local_id_WORD    word6
135202169e84SGaurav Srivastava #define lpfc_instantiated_nport_id_SHIFT   8
135302169e84SGaurav Srivastava #define lpfc_instantiated_nport_id_MASK    0x00ffffff
135402169e84SGaurav Srivastava #define lpfc_instantiated_nport_id_WORD    word6
135502169e84SGaurav Srivastava };
135602169e84SGaurav Srivastava 
135702169e84SGaurav Srivastava #define DEINSTANTIATED_VE_DESC_TAG  0x0001000C
135802169e84SGaurav Srivastava struct deinstantiated_ve_desc {
135902169e84SGaurav Srivastava 	uint32_t tag;
136002169e84SGaurav Srivastava 	uint32_t length;
136102169e84SGaurav Srivastava 	uint8_t global_vem_id[16];
136202169e84SGaurav Srivastava 	uint32_t word6;
136302169e84SGaurav Srivastava #define lpfc_deinstantiated_nport_id_SHIFT   0
136402169e84SGaurav Srivastava #define lpfc_deinstantiated_nport_id_MASK    0x000000ff
136502169e84SGaurav Srivastava #define lpfc_deinstantiated_nport_id_WORD    word6
136602169e84SGaurav Srivastava #define lpfc_deinstantiated_local_id_SHIFT   24
136702169e84SGaurav Srivastava #define lpfc_deinstantiated_local_id_MASK    0x00ffffff
136802169e84SGaurav Srivastava #define lpfc_deinstantiated_local_id_WORD    word6
136902169e84SGaurav Srivastava };
137002169e84SGaurav Srivastava 
137102169e84SGaurav Srivastava /* Query Fabric Priority Allocation Response */
137202169e84SGaurav Srivastava #define LPFC_PRIORITY_RANGE_DESC_SIZE 12
137302169e84SGaurav Srivastava 
137402169e84SGaurav Srivastava struct priority_range_desc {
137502169e84SGaurav Srivastava 	uint32_t tag;
137602169e84SGaurav Srivastava 	uint32_t length;
137702169e84SGaurav Srivastava 	uint8_t lo_range;
137802169e84SGaurav Srivastava 	uint8_t hi_range;
137902169e84SGaurav Srivastava 	uint8_t qos_priority;
138002169e84SGaurav Srivastava 	uint8_t local_ve_id;
138102169e84SGaurav Srivastava };
138202169e84SGaurav Srivastava 
138302169e84SGaurav Srivastava struct fc_qfpa_res {
138402169e84SGaurav Srivastava 	uint32_t reply_sequence;	/* LS_ACC or LS_RJT */
138502169e84SGaurav Srivastava 	uint32_t length;	/* FC Word 1    */
138602169e84SGaurav Srivastava 	struct priority_range_desc desc[1];
138702169e84SGaurav Srivastava };
138802169e84SGaurav Srivastava 
138902169e84SGaurav Srivastava /* Application Server command code */
139002169e84SGaurav Srivastava /* VMID               */
139102169e84SGaurav Srivastava 
139202169e84SGaurav Srivastava #define SLI_CT_APP_SEV_Subtypes     0x20	/* Application Server subtype */
139302169e84SGaurav Srivastava 
139402169e84SGaurav Srivastava #define SLI_CTAS_GAPPIA_ENT    0x0100	/* Get Application Identifier */
139502169e84SGaurav Srivastava #define SLI_CTAS_GALLAPPIA     0x0101	/* Get All Application Identifier */
139602169e84SGaurav Srivastava #define SLI_CTAS_GALLAPPIA_ID  0x0102	/* Get All Application Identifier */
139702169e84SGaurav Srivastava 					/* for Nport */
139802169e84SGaurav Srivastava #define SLI_CTAS_GAPPIA_IDAPP  0x0103	/* Get Application Identifier */
139902169e84SGaurav Srivastava 					/* for Nport */
140002169e84SGaurav Srivastava #define SLI_CTAS_RAPP_IDENT    0x0200	/* Register Application Identifier */
140102169e84SGaurav Srivastava #define SLI_CTAS_DAPP_IDENT    0x0300	/* Deregister Application */
140202169e84SGaurav Srivastava 					/* Identifier */
140302169e84SGaurav Srivastava #define SLI_CTAS_DALLAPP_ID    0x0301	/* Deregister All Application */
140402169e84SGaurav Srivastava 					/* Identifier */
140502169e84SGaurav Srivastava 
140602169e84SGaurav Srivastava struct entity_id_object {
140702169e84SGaurav Srivastava 	uint8_t entity_id_len;
140802169e84SGaurav Srivastava 	uint8_t entity_id[255];	/* VM UUID */
140902169e84SGaurav Srivastava };
141002169e84SGaurav Srivastava 
141102169e84SGaurav Srivastava struct app_id_object {
141202169e84SGaurav Srivastava 	uint32_t port_id;
141302169e84SGaurav Srivastava 	uint32_t app_id;
141402169e84SGaurav Srivastava 	struct entity_id_object obj;
141502169e84SGaurav Srivastava };
141602169e84SGaurav Srivastava 
141702169e84SGaurav Srivastava struct lpfc_vmid_rapp_ident_list {
141802169e84SGaurav Srivastava 	uint32_t no_of_objects;
141902169e84SGaurav Srivastava 	struct entity_id_object obj[1];
142002169e84SGaurav Srivastava };
142102169e84SGaurav Srivastava 
142202169e84SGaurav Srivastava struct lpfc_vmid_dapp_ident_list {
142302169e84SGaurav Srivastava 	uint32_t no_of_objects;
142402169e84SGaurav Srivastava 	struct entity_id_object obj[1];
142502169e84SGaurav Srivastava };
142602169e84SGaurav Srivastava 
142702169e84SGaurav Srivastava #define GALLAPPIA_ID_LAST  0x80
142802169e84SGaurav Srivastava struct lpfc_vmid_gallapp_ident_list {
142902169e84SGaurav Srivastava 	uint8_t control;
143002169e84SGaurav Srivastava 	uint8_t reserved[3];
143102169e84SGaurav Srivastava 	struct app_id_object app_id;
143202169e84SGaurav Srivastava };
143302169e84SGaurav Srivastava 
143402169e84SGaurav Srivastava #define RAPP_IDENT_OFFSET  (offsetof(struct lpfc_sli_ct_request, un) + 4)
143502169e84SGaurav Srivastava #define DAPP_IDENT_OFFSET  (offsetof(struct lpfc_sli_ct_request, un) + 4)
143602169e84SGaurav Srivastava #define GALLAPPIA_ID_SIZE  (offsetof(struct lpfc_sli_ct_request, un) + 4)
143702169e84SGaurav Srivastava #define DALLAPP_ID_SIZE    (offsetof(struct lpfc_sli_ct_request, un) + 4)
143802169e84SGaurav Srivastava 
143976b2c34aSJames Smart /******** FDMI ********/
144076b2c34aSJames Smart 
144176b2c34aSJames Smart /* lpfc_sli_ct_request defines the CT_IU preamble for FDMI commands */
144276b2c34aSJames Smart #define  SLI_CT_FDMI_Subtypes     0x10	/* Management Service Subtype */
1443dea3101eS 
144476b2c34aSJames Smart /* Definitions for HBA / Port attribute entries */
144576b2c34aSJames Smart 
144676b2c34aSJames Smart /* Attribute Entry */
144776b2c34aSJames Smart struct lpfc_fdmi_attr_entry {
1448dea3101eS 	union {
14494258e98eSJames Smart 		uint32_t AttrInt;
14504258e98eSJames Smart 		uint8_t  AttrTypes[32];
14514258e98eSJames Smart 		uint8_t  AttrString[256];
14524258e98eSJames Smart 		struct lpfc_name AttrWWN;
1453dea3101eS 	} un;
145476b2c34aSJames Smart };
145576b2c34aSJames Smart 
14564cb9e1ddSJames Smart struct lpfc_fdmi_attr_def { /* Defined in TLV format */
14574cb9e1ddSJames Smart 	/* Structure is in Big Endian format */
14584cb9e1ddSJames Smart 	uint32_t AttrType:16;
14594cb9e1ddSJames Smart 	uint32_t AttrLen:16;
14604cb9e1ddSJames Smart 	/* Marks start of Value (ATTRIBUTE_ENTRY) */
14614cb9e1ddSJames Smart 	struct lpfc_fdmi_attr_entry AttrValue;
14624cb9e1ddSJames Smart } __packed;
1463dea3101eS 
1464dea3101eS /*
1465dea3101eS  * HBA Attribute Block
1466dea3101eS  */
146776b2c34aSJames Smart struct lpfc_fdmi_attr_block {
1468dea3101eS 	uint32_t EntryCnt;		/* Number of HBA attribute entries */
146976b2c34aSJames Smart 	struct lpfc_fdmi_attr_entry Entry;	/* Variable-length array */
147076b2c34aSJames Smart };
1471dea3101eS 
1472dea3101eS /*
1473dea3101eS  * Port Entry
1474dea3101eS  */
147576b2c34aSJames Smart struct lpfc_fdmi_port_entry {
1476dea3101eS 	struct lpfc_name PortName;
147776b2c34aSJames Smart };
1478dea3101eS 
1479dea3101eS /*
1480dea3101eS  * HBA Identifier
1481dea3101eS  */
148276b2c34aSJames Smart struct lpfc_fdmi_hba_ident {
1483dea3101eS 	struct lpfc_name PortName;
148476b2c34aSJames Smart };
1485dea3101eS 
1486dea3101eS /*
14874cb9e1ddSJames Smart  * Registered Port List Format
14884cb9e1ddSJames Smart  */
14894cb9e1ddSJames Smart struct lpfc_fdmi_reg_port_list {
14904cb9e1ddSJames Smart 	uint32_t EntryCnt;
14914cb9e1ddSJames Smart 	struct lpfc_fdmi_port_entry pe;
14924cb9e1ddSJames Smart } __packed;
14934cb9e1ddSJames Smart 
14944cb9e1ddSJames Smart /*
1495dea3101eS  * Register HBA(RHBA)
1496dea3101eS  */
149776b2c34aSJames Smart struct lpfc_fdmi_reg_hba {
149876b2c34aSJames Smart 	struct lpfc_fdmi_hba_ident hi;
14994cb9e1ddSJames Smart 	struct lpfc_fdmi_reg_port_list rpl;
150076b2c34aSJames Smart };
1501dea3101eS 
1502b67b5944SJames Smart /******** MI MIB ********/
1503b67b5944SJames Smart #define SLI_CT_MIB_Subtypes	0x11
1504b67b5944SJames Smart 
1505dea3101eS /*
1506dea3101eS  * Register HBA Attributes (RHAT)
1507dea3101eS  */
150876b2c34aSJames Smart struct lpfc_fdmi_reg_hbaattr {
1509dea3101eS 	struct lpfc_name HBA_PortName;
151076b2c34aSJames Smart 	struct lpfc_fdmi_attr_block ab;
151176b2c34aSJames Smart };
1512dea3101eS 
1513dea3101eS /*
1514dea3101eS  * Register Port Attributes (RPA)
1515dea3101eS  */
151676b2c34aSJames Smart struct lpfc_fdmi_reg_portattr {
1517dea3101eS 	struct lpfc_name PortName;
151876b2c34aSJames Smart 	struct lpfc_fdmi_attr_block ab;
151976b2c34aSJames Smart };
1520dea3101eS 
1521dea3101eS /*
152276b2c34aSJames Smart  * HBA MAnagement Operations Command Codes
1523dea3101eS  */
152476b2c34aSJames Smart #define  SLI_MGMT_GRHL     0x100	/* Get registered HBA list */
152576b2c34aSJames Smart #define  SLI_MGMT_GHAT     0x101	/* Get HBA attributes */
152676b2c34aSJames Smart #define  SLI_MGMT_GRPL     0x102	/* Get registered Port list */
152776b2c34aSJames Smart #define  SLI_MGMT_GPAT     0x110	/* Get Port attributes */
152876b2c34aSJames Smart #define  SLI_MGMT_GPAS     0x120	/* Get Port Statistics */
152976b2c34aSJames Smart #define  SLI_MGMT_RHBA     0x200	/* Register HBA */
153076b2c34aSJames Smart #define  SLI_MGMT_RHAT     0x201	/* Register HBA attributes */
153176b2c34aSJames Smart #define  SLI_MGMT_RPRT     0x210	/* Register Port */
153276b2c34aSJames Smart #define  SLI_MGMT_RPA      0x211	/* Register Port attributes */
153376b2c34aSJames Smart #define  SLI_MGMT_DHBA     0x300	/* De-register HBA */
153476b2c34aSJames Smart #define  SLI_MGMT_DHAT     0x301	/* De-register HBA attributes */
153576b2c34aSJames Smart #define  SLI_MGMT_DPRT     0x310	/* De-register Port */
153676b2c34aSJames Smart #define  SLI_MGMT_DPA      0x311	/* De-register Port attributes */
1537dea3101eS 
15384258e98eSJames Smart #define LPFC_FDMI_MAX_RETRY     3  /* Max retries for a FDMI command */
15394258e98eSJames Smart 
1540dea3101eS /*
154176b2c34aSJames Smart  * HBA Attribute Types
1542dea3101eS  */
154376b2c34aSJames Smart #define  RHBA_NODENAME           0x1 /* 8 byte WWNN */
154476b2c34aSJames Smart #define  RHBA_MANUFACTURER       0x2 /* 4 to 64 byte ASCII string */
154576b2c34aSJames Smart #define  RHBA_SERIAL_NUMBER      0x3 /* 4 to 64 byte ASCII string */
154676b2c34aSJames Smart #define  RHBA_MODEL              0x4 /* 4 to 256 byte ASCII string */
154776b2c34aSJames Smart #define  RHBA_MODEL_DESCRIPTION  0x5 /* 4 to 256 byte ASCII string */
154876b2c34aSJames Smart #define  RHBA_HARDWARE_VERSION   0x6 /* 4 to 256 byte ASCII string */
154976b2c34aSJames Smart #define  RHBA_DRIVER_VERSION     0x7 /* 4 to 256 byte ASCII string */
155076b2c34aSJames Smart #define  RHBA_OPTION_ROM_VERSION 0x8 /* 4 to 256 byte ASCII string */
155176b2c34aSJames Smart #define  RHBA_FIRMWARE_VERSION   0x9 /* 4 to 256 byte ASCII string */
155276b2c34aSJames Smart #define  RHBA_OS_NAME_VERSION	 0xa /* 4 to 256 byte ASCII string */
155376b2c34aSJames Smart #define  RHBA_MAX_CT_PAYLOAD_LEN 0xb /* 32-bit unsigned int */
155476b2c34aSJames Smart #define  RHBA_SYM_NODENAME       0xc /* 4 to 256 byte ASCII string */
15554258e98eSJames Smart #define  RHBA_VENDOR_INFO        0xd  /* 32-bit unsigned int */
15564258e98eSJames Smart #define  RHBA_NUM_PORTS          0xe  /* 32-bit unsigned int */
15574258e98eSJames Smart #define  RHBA_FABRIC_WWNN        0xf  /* 8 byte WWNN */
15584258e98eSJames Smart #define  RHBA_BIOS_VERSION       0x10 /* 4 to 256 byte ASCII string */
15594258e98eSJames Smart #define  RHBA_BIOS_STATE         0x11 /* 32-bit unsigned int */
15604258e98eSJames Smart #define  RHBA_VENDOR_ID          0xe0 /* 8 byte ASCII string */
15614258e98eSJames Smart 
15624258e98eSJames Smart /* Bit mask for all individual HBA attributes */
15634258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_wwnn			0x00000001
15644258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_manufacturer		0x00000002
15654258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_sn			0x00000004
15664258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_model		0x00000008
15674258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_description		0x00000010
15684258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_hdw_ver		0x00000020
15694258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_drvr_ver		0x00000040
15704258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_rom_ver		0x00000080
15714258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_fmw_ver		0x00000100
15724258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_os_ver		0x00000200
15734258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_ct_len		0x00000400
15744258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_symbolic_name	0x00000800
15754258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_vendor_info		0x00001000 /* Not used */
15764258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_num_ports		0x00002000
15774258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_fabric_wwnn		0x00004000
15784258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_bios_ver		0x00008000
15794258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_bios_state		0x00010000 /* Not used */
15804258e98eSJames Smart #define LPFC_FDMI_HBA_ATTR_vendor_id		0x00020000
15814258e98eSJames Smart 
15824258e98eSJames Smart /* Bit mask for FDMI-1 defined HBA attributes */
15834258e98eSJames Smart #define LPFC_FDMI1_HBA_ATTR			0x000007ff
15844258e98eSJames Smart 
15854258e98eSJames Smart /* Bit mask for FDMI-2 defined HBA attributes */
15864258e98eSJames Smart /* Skip vendor_info and bios_state */
15874258e98eSJames Smart #define LPFC_FDMI2_HBA_ATTR			0x0002efff
1588dea3101eS 
1589dea3101eS /*
15908aaa7bcfSJames Smart  * Port Attribute Types
1591dea3101eS  */
159276b2c34aSJames Smart #define  RPRT_SUPPORTED_FC4_TYPES     0x1 /* 32 byte binary array */
159376b2c34aSJames Smart #define  RPRT_SUPPORTED_SPEED         0x2 /* 32-bit unsigned int */
159476b2c34aSJames Smart #define  RPRT_PORT_SPEED              0x3 /* 32-bit unsigned int */
159576b2c34aSJames Smart #define  RPRT_MAX_FRAME_SIZE          0x4 /* 32-bit unsigned int */
159676b2c34aSJames Smart #define  RPRT_OS_DEVICE_NAME          0x5 /* 4 to 256 byte ASCII string */
159776b2c34aSJames Smart #define  RPRT_HOST_NAME               0x6 /* 4 to 256 byte ASCII string */
159876b2c34aSJames Smart #define  RPRT_NODENAME                0x7 /* 8 byte WWNN */
15994258e98eSJames Smart #define  RPRT_PORTNAME                0x8 /* 8 byte WWPN */
160076b2c34aSJames Smart #define  RPRT_SYM_PORTNAME            0x9 /* 4 to 256 byte ASCII string */
160176b2c34aSJames Smart #define  RPRT_PORT_TYPE               0xa /* 32-bit unsigned int */
160276b2c34aSJames Smart #define  RPRT_SUPPORTED_CLASS         0xb /* 32-bit unsigned int */
16034258e98eSJames Smart #define  RPRT_FABRICNAME              0xc /* 8 byte Fabric WWPN */
160476b2c34aSJames Smart #define  RPRT_ACTIVE_FC4_TYPES        0xd /* 32 byte binary array */
160576b2c34aSJames Smart #define  RPRT_PORT_STATE              0x101 /* 32-bit unsigned int */
160676b2c34aSJames Smart #define  RPRT_DISC_PORT               0x102 /* 32-bit unsigned int */
160776b2c34aSJames Smart #define  RPRT_PORT_ID                 0x103 /* 32-bit unsigned int */
16088aaa7bcfSJames Smart #define  RPRT_VENDOR_MI               0xf047 /* vendor ascii string */
16094258e98eSJames Smart #define  RPRT_SMART_SERVICE           0xf100 /* 4 to 256 byte ASCII string */
16104258e98eSJames Smart #define  RPRT_SMART_GUID              0xf101 /* 8 byte WWNN + 8 byte WWPN */
16114258e98eSJames Smart #define  RPRT_SMART_VERSION           0xf102 /* 4 to 256 byte ASCII string */
16124258e98eSJames Smart #define  RPRT_SMART_MODEL             0xf103 /* 4 to 256 byte ASCII string */
16134258e98eSJames Smart #define  RPRT_SMART_PORT_INFO         0xf104 /* 32-bit unsigned int */
16144258e98eSJames Smart #define  RPRT_SMART_QOS               0xf105 /* 32-bit unsigned int */
16154258e98eSJames Smart #define  RPRT_SMART_SECURITY          0xf106 /* 32-bit unsigned int */
16164258e98eSJames Smart 
16174258e98eSJames Smart /* Bit mask for all individual PORT attributes */
16184258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_fc4type		0x00000001
16194258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_support_speed	0x00000002
16204258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_speed		0x00000004
16214258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_max_frame		0x00000008
16224258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_os_devname		0x00000010
16234258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_host_name		0x00000020
16244258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_wwnn		0x00000040
16254258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_wwpn		0x00000080
16264258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_symbolic_name	0x00000100
16274258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_port_type		0x00000200
16284258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_class		0x00000400
16294258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_fabric_wwpn		0x00000800
16304258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_port_state		0x00001000
16314258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_active_fc4type	0x00002000
16324258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_num_disc		0x00004000
16334258e98eSJames Smart #define LPFC_FDMI_PORT_ATTR_nportid		0x00008000
16344258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_service		0x00010000 /* Vendor specific */
16354258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_guid		0x00020000 /* Vendor specific */
16364258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_version		0x00040000 /* Vendor specific */
16374258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_model		0x00080000 /* Vendor specific */
16384258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_port_info		0x00100000 /* Vendor specific */
16394258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_qos		0x00200000 /* Vendor specific */
16404258e98eSJames Smart #define LPFC_FDMI_SMART_ATTR_security		0x00400000 /* Vendor specific */
16418aaa7bcfSJames Smart #define LPFC_FDMI_VENDOR_ATTR_mi		0x00800000 /* Vendor specific */
16424258e98eSJames Smart 
16434258e98eSJames Smart /* Bit mask for FDMI-1 defined PORT attributes */
16444258e98eSJames Smart #define LPFC_FDMI1_PORT_ATTR			0x0000003f
16454258e98eSJames Smart 
16464258e98eSJames Smart /* Bit mask for FDMI-2 defined PORT attributes */
16474258e98eSJames Smart #define LPFC_FDMI2_PORT_ATTR			0x0000ffff
16484258e98eSJames Smart 
16494258e98eSJames Smart /* Bit mask for Smart SAN defined PORT attributes */
16504258e98eSJames Smart #define LPFC_FDMI2_SMART_ATTR			0x007fffff
16514258e98eSJames Smart 
16524258e98eSJames Smart /* Defines for PORT port state attribute */
16534258e98eSJames Smart #define LPFC_FDMI_PORTSTATE_UNKNOWN	1
16544258e98eSJames Smart #define LPFC_FDMI_PORTSTATE_ONLINE	2
16554258e98eSJames Smart 
16564258e98eSJames Smart /* Defines for PORT port type attribute */
16574258e98eSJames Smart #define LPFC_FDMI_PORTTYPE_UNKNOWN	0
16584258e98eSJames Smart #define LPFC_FDMI_PORTTYPE_NPORT	1
16594258e98eSJames Smart #define LPFC_FDMI_PORTTYPE_NLPORT	2
1660dea3101eS 
1661dea3101eS /*
1662dea3101eS  *  Begin HBA configuration parameters.
1663dea3101eS  *  The PCI configuration register BAR assignments are:
1664dea3101eS  *  BAR0, offset 0x10 - SLIM base memory address
1665dea3101eS  *  BAR1, offset 0x14 - SLIM base memory high address
1666dea3101eS  *  BAR2, offset 0x18 - REGISTER base memory address
1667dea3101eS  *  BAR3, offset 0x1c - REGISTER base memory high address
1668dea3101eS  *  BAR4, offset 0x20 - BIU I/O registers
1669dea3101eS  *  BAR5, offset 0x24 - REGISTER base io high address
1670dea3101eS  */
1671dea3101eS 
1672dea3101eS /* Number of rings currently used and available. */
16732a76a283SJames Smart #define MAX_SLI3_CONFIGURED_RINGS     3
16742a76a283SJames Smart #define MAX_SLI3_RINGS                4
1675dea3101eS 
1676dea3101eS /* IOCB / Mailbox is owned by FireFly */
1677dea3101eS #define OWN_CHIP        1
1678dea3101eS 
1679dea3101eS /* IOCB / Mailbox is owned by Host */
1680dea3101eS #define OWN_HOST        0
1681dea3101eS 
1682dea3101eS /* Number of 4-byte words in an IOCB. */
1683dea3101eS #define IOCB_WORD_SZ    8
1684dea3101eS 
1685dea3101eS /* network headers for Dfctl field */
1686dea3101eS #define FC_NET_HDR      0x20
1687dea3101eS 
1688dea3101eS /* Start FireFly Register definitions */
1689dea3101eS #define PCI_VENDOR_ID_EMULEX        0x10df
1690dea3101eS #define PCI_DEVICE_ID_FIREFLY       0x1ae5
169184774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_VF    0xe100
1692085c647cSJames Smart #define PCI_DEVICE_ID_BALIUS        0xe131
169384774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_PF    0xe180
1694085c647cSJames Smart #define PCI_DEVICE_ID_LANCER_FC     0xe200
1695c0c11512SJames Smart #define PCI_DEVICE_ID_LANCER_FC_VF  0xe208
1696085c647cSJames Smart #define PCI_DEVICE_ID_LANCER_FCOE   0xe260
1697c0c11512SJames Smart #define PCI_DEVICE_ID_LANCER_FCOE_VF 0xe268
1698d38dd52cSJames Smart #define PCI_DEVICE_ID_LANCER_G6_FC  0xe300
1699c238b9b6SJames Smart #define PCI_DEVICE_ID_LANCER_G7_FC  0xf400
1700f449a3d7SJames Smart #define PCI_DEVICE_ID_LANCER_G7P_FC 0xf500
1701b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_SMB       0xf011
1702b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_MID       0xf015
1703dea3101eS #define PCI_DEVICE_ID_RFLY          0xf095
1704dea3101eS #define PCI_DEVICE_ID_PFLY          0xf098
1705e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LP101         0xf0a1
1706dea3101eS #define PCI_DEVICE_ID_TFLY          0xf0a5
1707e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_BSMB          0xf0d1
1708e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_BMID          0xf0d5
1709e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZSMB          0xf0e1
1710e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZMID          0xf0e5
1711e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE       0xf0f5
1712e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE_SCSP  0xf0f6
1713e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_NEPTUNE_DCSP  0xf0f7
1714b87eab38SJames Smart #define PCI_DEVICE_ID_SAT           0xf100
1715b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_SCSP      0xf111
1716b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_DCSP      0xf112
1717085c647cSJames Smart #define PCI_DEVICE_ID_FALCON        0xf180
1718e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_SUPERFLY      0xf700
1719e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_DRAGONFLY     0xf800
1720dea3101eS #define PCI_DEVICE_ID_CENTAUR       0xf900
1721dea3101eS #define PCI_DEVICE_ID_PEGASUS       0xf980
1722dea3101eS #define PCI_DEVICE_ID_THOR          0xfa00
1723dea3101eS #define PCI_DEVICE_ID_VIPER         0xfb00
1724dea3101eS #define PCI_DEVICE_ID_LP10000S      0xfc00
1725e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LP11000S      0xfc10
1726e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_LPE11000S     0xfc20
1727b87eab38SJames Smart #define PCI_DEVICE_ID_SAT_S         0xfc40
172884774a4dSJames Smart #define PCI_DEVICE_ID_PROTEUS_S     0xfc50
1729e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS        0xfd00
1730e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS_SCSP   0xfd11
1731e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_HELIOS_DCSP   0xfd12
1732e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR        0xfe00
173384774a4dSJames Smart #define PCI_DEVICE_ID_HORNET        0xfe05
1734e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR_SCSP   0xfe11
1735e4adb204SJames.Smart@Emulex.Com #define PCI_DEVICE_ID_ZEPHYR_DCSP   0xfe12
1736da0436e9SJames Smart #define PCI_VENDOR_ID_SERVERENGINE  0x19a2
1737da0436e9SJames Smart #define PCI_DEVICE_ID_TIGERSHARK    0x0704
1738a747c9ceSJames Smart #define PCI_DEVICE_ID_TOMCAT        0x0714
1739f8cafd38SJames Smart #define PCI_DEVICE_ID_SKYHAWK       0x0724
1740f8cafd38SJames Smart #define PCI_DEVICE_ID_SKYHAWK_VF    0x072c
1741dea3101eS 
1742dea3101eS #define JEDEC_ID_ADDRESS            0x0080001c
1743dea3101eS #define FIREFLY_JEDEC_ID            0x1ACC
1744dea3101eS #define SUPERFLY_JEDEC_ID           0x0020
1745dea3101eS #define DRAGONFLY_JEDEC_ID          0x0021
1746dea3101eS #define DRAGONFLY_V2_JEDEC_ID       0x0025
1747dea3101eS #define CENTAUR_2G_JEDEC_ID         0x0026
1748dea3101eS #define CENTAUR_1G_JEDEC_ID         0x0028
1749dea3101eS #define PEGASUS_ORION_JEDEC_ID      0x0036
1750dea3101eS #define PEGASUS_JEDEC_ID            0x0038
1751dea3101eS #define THOR_JEDEC_ID               0x0012
1752dea3101eS #define HELIOS_JEDEC_ID             0x0364
1753dea3101eS #define ZEPHYR_JEDEC_ID             0x0577
1754dea3101eS #define VIPER_JEDEC_ID              0x4838
1755b87eab38SJames Smart #define SATURN_JEDEC_ID             0x1004
175684774a4dSJames Smart #define HORNET_JDEC_ID              0x2057706D
1757dea3101eS 
1758dea3101eS #define JEDEC_ID_MASK               0x0FFFF000
1759dea3101eS #define JEDEC_ID_SHIFT              12
1760dea3101eS #define FC_JEDEC_ID(id)             ((id & JEDEC_ID_MASK) >> JEDEC_ID_SHIFT)
1761dea3101eS 
1762dea3101eS typedef struct {		/* FireFly BIU registers */
1763dea3101eS 	uint32_t hostAtt;	/* See definitions for Host Attention
1764dea3101eS 				   register */
1765dea3101eS 	uint32_t chipAtt;	/* See definitions for Chip Attention
1766dea3101eS 				   register */
1767dea3101eS 	uint32_t hostStatus;	/* See definitions for Host Status register */
1768dea3101eS 	uint32_t hostControl;	/* See definitions for Host Control register */
1769dea3101eS 	uint32_t buiConfig;	/* See definitions for BIU configuration
1770dea3101eS 				   register */
1771dea3101eS } FF_REGS;
1772dea3101eS 
1773dea3101eS /* IO Register size in bytes */
1774dea3101eS #define FF_REG_AREA_SIZE       256
1775dea3101eS 
1776dea3101eS /* Host Attention Register */
1777dea3101eS 
1778dea3101eS #define HA_REG_OFFSET  0	/* Byte offset from register base address */
1779dea3101eS 
1780dea3101eS #define HA_R0RE_REQ    0x00000001	/* Bit  0 */
1781dea3101eS #define HA_R0CE_RSP    0x00000002	/* Bit  1 */
1782dea3101eS #define HA_R0ATT       0x00000008	/* Bit  3 */
1783dea3101eS #define HA_R1RE_REQ    0x00000010	/* Bit  4 */
1784dea3101eS #define HA_R1CE_RSP    0x00000020	/* Bit  5 */
1785dea3101eS #define HA_R1ATT       0x00000080	/* Bit  7 */
1786dea3101eS #define HA_R2RE_REQ    0x00000100	/* Bit  8 */
1787dea3101eS #define HA_R2CE_RSP    0x00000200	/* Bit  9 */
1788dea3101eS #define HA_R2ATT       0x00000800	/* Bit 11 */
1789dea3101eS #define HA_R3RE_REQ    0x00001000	/* Bit 12 */
1790dea3101eS #define HA_R3CE_RSP    0x00002000	/* Bit 13 */
1791dea3101eS #define HA_R3ATT       0x00008000	/* Bit 15 */
1792dea3101eS #define HA_LATT        0x20000000	/* Bit 29 */
1793dea3101eS #define HA_MBATT       0x40000000	/* Bit 30 */
1794dea3101eS #define HA_ERATT       0x80000000	/* Bit 31 */
1795dea3101eS 
1796dea3101eS #define HA_RXRE_REQ    0x00000001	/* Bit  0 */
1797dea3101eS #define HA_RXCE_RSP    0x00000002	/* Bit  1 */
1798dea3101eS #define HA_RXATT       0x00000008	/* Bit  3 */
1799dea3101eS #define HA_RXMASK      0x0000000f
1800dea3101eS 
18019399627fSJames Smart #define HA_R0_CLR_MSK	(HA_R0RE_REQ | HA_R0CE_RSP | HA_R0ATT)
18029399627fSJames Smart #define HA_R1_CLR_MSK	(HA_R1RE_REQ | HA_R1CE_RSP | HA_R1ATT)
18039399627fSJames Smart #define HA_R2_CLR_MSK	(HA_R2RE_REQ | HA_R2CE_RSP | HA_R2ATT)
18049399627fSJames Smart #define HA_R3_CLR_MSK	(HA_R3RE_REQ | HA_R3CE_RSP | HA_R3ATT)
18059399627fSJames Smart 
18069399627fSJames Smart #define HA_R0_POS	3
18079399627fSJames Smart #define HA_R1_POS	7
18089399627fSJames Smart #define HA_R2_POS	11
18099399627fSJames Smart #define HA_R3_POS	15
18109399627fSJames Smart #define HA_LE_POS	29
18119399627fSJames Smart #define HA_MB_POS	30
18129399627fSJames Smart #define HA_ER_POS	31
1813dea3101eS /* Chip Attention Register */
1814dea3101eS 
1815dea3101eS #define CA_REG_OFFSET  4	/* Byte offset from register base address */
1816dea3101eS 
1817dea3101eS #define CA_R0CE_REQ    0x00000001	/* Bit  0 */
1818dea3101eS #define CA_R0RE_RSP    0x00000002	/* Bit  1 */
1819dea3101eS #define CA_R0ATT       0x00000008	/* Bit  3 */
1820dea3101eS #define CA_R1CE_REQ    0x00000010	/* Bit  4 */
1821dea3101eS #define CA_R1RE_RSP    0x00000020	/* Bit  5 */
1822dea3101eS #define CA_R1ATT       0x00000080	/* Bit  7 */
1823dea3101eS #define CA_R2CE_REQ    0x00000100	/* Bit  8 */
1824dea3101eS #define CA_R2RE_RSP    0x00000200	/* Bit  9 */
1825dea3101eS #define CA_R2ATT       0x00000800	/* Bit 11 */
1826dea3101eS #define CA_R3CE_REQ    0x00001000	/* Bit 12 */
1827dea3101eS #define CA_R3RE_RSP    0x00002000	/* Bit 13 */
1828dea3101eS #define CA_R3ATT       0x00008000	/* Bit 15 */
1829dea3101eS #define CA_MBATT       0x40000000	/* Bit 30 */
1830dea3101eS 
1831dea3101eS /* Host Status Register */
1832dea3101eS 
1833dea3101eS #define HS_REG_OFFSET  8	/* Byte offset from register base address */
1834dea3101eS 
1835dea3101eS #define HS_MBRDY       0x00400000	/* Bit 22 */
1836dea3101eS #define HS_FFRDY       0x00800000	/* Bit 23 */
1837dea3101eS #define HS_FFER8       0x01000000	/* Bit 24 */
1838dea3101eS #define HS_FFER7       0x02000000	/* Bit 25 */
1839dea3101eS #define HS_FFER6       0x04000000	/* Bit 26 */
1840dea3101eS #define HS_FFER5       0x08000000	/* Bit 27 */
1841dea3101eS #define HS_FFER4       0x10000000	/* Bit 28 */
1842dea3101eS #define HS_FFER3       0x20000000	/* Bit 29 */
1843dea3101eS #define HS_FFER2       0x40000000	/* Bit 30 */
1844dea3101eS #define HS_FFER1       0x80000000	/* Bit 31 */
184557127f15SJames Smart #define HS_CRIT_TEMP   0x00000100	/* Bit 8  */
184657127f15SJames Smart #define HS_FFERM       0xFF000100	/* Mask for error bits 31:24 and 8 */
18479940b97bSJames Smart #define UNPLUG_ERR     0x00000001	/* Indicate pci hot unplug */
1848dea3101eS /* Host Control Register */
1849dea3101eS 
18509399627fSJames Smart #define HC_REG_OFFSET  12	/* Byte offset from register base address */
1851dea3101eS 
1852dea3101eS #define HC_MBINT_ENA   0x00000001	/* Bit  0 */
1853dea3101eS #define HC_R0INT_ENA   0x00000002	/* Bit  1 */
1854dea3101eS #define HC_R1INT_ENA   0x00000004	/* Bit  2 */
1855dea3101eS #define HC_R2INT_ENA   0x00000008	/* Bit  3 */
1856dea3101eS #define HC_R3INT_ENA   0x00000010	/* Bit  4 */
1857dea3101eS #define HC_INITHBI     0x02000000	/* Bit 25 */
1858dea3101eS #define HC_INITMB      0x04000000	/* Bit 26 */
1859dea3101eS #define HC_INITFF      0x08000000	/* Bit 27 */
1860dea3101eS #define HC_LAINT_ENA   0x20000000	/* Bit 29 */
1861dea3101eS #define HC_ERINT_ENA   0x80000000	/* Bit 31 */
1862dea3101eS 
18639399627fSJames Smart /* Message Signaled Interrupt eXtension (MSI-X) message identifiers */
18649399627fSJames Smart #define MSIX_DFLT_ID	0
18659399627fSJames Smart #define MSIX_RNG0_ID	0
18669399627fSJames Smart #define MSIX_RNG1_ID	1
18679399627fSJames Smart #define MSIX_RNG2_ID	2
18689399627fSJames Smart #define MSIX_RNG3_ID	3
18699399627fSJames Smart 
18709399627fSJames Smart #define MSIX_LINK_ID	4
18719399627fSJames Smart #define MSIX_MBOX_ID	5
18729399627fSJames Smart 
18739399627fSJames Smart #define MSIX_SPARE0_ID	6
18749399627fSJames Smart #define MSIX_SPARE1_ID	7
18759399627fSJames Smart 
1876dea3101eS /* Mailbox Commands */
1877dea3101eS #define MBX_SHUTDOWN        0x00	/* terminate testing */
1878dea3101eS #define MBX_LOAD_SM         0x01
1879dea3101eS #define MBX_READ_NV         0x02
1880dea3101eS #define MBX_WRITE_NV        0x03
1881dea3101eS #define MBX_RUN_BIU_DIAG    0x04
1882dea3101eS #define MBX_INIT_LINK       0x05
1883dea3101eS #define MBX_DOWN_LINK       0x06
1884dea3101eS #define MBX_CONFIG_LINK     0x07
1885dea3101eS #define MBX_CONFIG_RING     0x09
1886dea3101eS #define MBX_RESET_RING      0x0A
1887dea3101eS #define MBX_READ_CONFIG     0x0B
1888dea3101eS #define MBX_READ_RCONFIG    0x0C
1889dea3101eS #define MBX_READ_SPARM      0x0D
1890dea3101eS #define MBX_READ_STATUS     0x0E
1891dea3101eS #define MBX_READ_RPI        0x0F
1892dea3101eS #define MBX_READ_XRI        0x10
1893dea3101eS #define MBX_READ_REV        0x11
1894dea3101eS #define MBX_READ_LNK_STAT   0x12
1895dea3101eS #define MBX_REG_LOGIN       0x13
1896dea3101eS #define MBX_UNREG_LOGIN     0x14
1897dea3101eS #define MBX_CLEAR_LA        0x16
1898dea3101eS #define MBX_DUMP_MEMORY     0x17
1899dea3101eS #define MBX_DUMP_CONTEXT    0x18
1900dea3101eS #define MBX_RUN_DIAGS       0x19
1901dea3101eS #define MBX_RESTART         0x1A
1902dea3101eS #define MBX_UPDATE_CFG      0x1B
1903dea3101eS #define MBX_DOWN_LOAD       0x1C
1904dea3101eS #define MBX_DEL_LD_ENTRY    0x1D
1905dea3101eS #define MBX_RUN_PROGRAM     0x1E
1906dea3101eS #define MBX_SET_MASK        0x20
190709372820SJames Smart #define MBX_SET_VARIABLE    0x21
1908dea3101eS #define MBX_UNREG_D_ID      0x23
190941415862SJamie Wellnitz #define MBX_KILL_BOARD      0x24
1910dea3101eS #define MBX_CONFIG_FARP     0x25
191141415862SJamie Wellnitz #define MBX_BEACON          0x2A
19129399627fSJames Smart #define MBX_CONFIG_MSI      0x30
1913858c9f6cSJames Smart #define MBX_HEARTBEAT       0x31
1914a8adb832SJames Smart #define MBX_WRITE_VPARMS    0x32
1915a8adb832SJames Smart #define MBX_ASYNCEVT_ENABLE 0x33
19164fede78fSJames Smart #define MBX_READ_EVENT_LOG_STATUS 0x37
19174fede78fSJames Smart #define MBX_READ_EVENT_LOG  0x38
19184fede78fSJames Smart #define MBX_WRITE_EVENT_LOG 0x39
1919dea3101eS 
192084774a4dSJames Smart #define MBX_PORT_CAPABILITIES 0x3B
192184774a4dSJames Smart #define MBX_PORT_IOV_CONTROL 0x3C
192284774a4dSJames Smart 
1923ed957684SJames Smart #define MBX_CONFIG_HBQ	    0x7C
1924dea3101eS #define MBX_LOAD_AREA       0x81
1925dea3101eS #define MBX_RUN_BIU_DIAG64  0x84
1926dea3101eS #define MBX_CONFIG_PORT     0x88
1927dea3101eS #define MBX_READ_SPARM64    0x8D
1928dea3101eS #define MBX_READ_RPI64      0x8F
1929dea3101eS #define MBX_REG_LOGIN64     0x93
193076a95d75SJames Smart #define MBX_READ_TOPOLOGY   0x95
193192d7f7b0SJames Smart #define MBX_REG_VPI	    0x96
193292d7f7b0SJames Smart #define MBX_UNREG_VPI	    0x97
1933dea3101eS 
193409372820SJames Smart #define MBX_WRITE_WWN       0x98
1935dea3101eS #define MBX_SET_DEBUG       0x99
1936dea3101eS #define MBX_LOAD_EXP_ROM    0x9C
1937da0436e9SJames Smart #define MBX_SLI4_CONFIG	    0x9B
1938da0436e9SJames Smart #define MBX_SLI4_REQ_FTRS   0x9D
1939da0436e9SJames Smart #define MBX_MAX_CMDS        0x9E
1940da0436e9SJames Smart #define MBX_RESUME_RPI      0x9E
1941dea3101eS #define MBX_SLI2_CMD_MASK   0x80
1942da0436e9SJames Smart #define MBX_REG_VFI         0x9F
1943da0436e9SJames Smart #define MBX_REG_FCFI        0xA0
1944da0436e9SJames Smart #define MBX_UNREG_VFI       0xA1
1945da0436e9SJames Smart #define MBX_UNREG_FCFI	    0xA2
1946da0436e9SJames Smart #define MBX_INIT_VFI        0xA3
1947da0436e9SJames Smart #define MBX_INIT_VPI        0xA4
1948940eb687SJames Smart #define MBX_ACCESS_VDATA    0xA5
1949895427bdSJames Smart #define MBX_REG_FCFI_MRQ    0xAF
1950dea3101eS 
1951dcf2a4e0SJames Smart #define MBX_AUTH_PORT       0xF8
1952dcf2a4e0SJames Smart #define MBX_SECURITY_MGMT   0xF9
1953dcf2a4e0SJames Smart 
1954dea3101eS /* IOCB Commands */
1955dea3101eS 
1956dea3101eS #define CMD_RCV_SEQUENCE_CX     0x01
1957dea3101eS #define CMD_XMIT_SEQUENCE_CR    0x02
1958dea3101eS #define CMD_XMIT_SEQUENCE_CX    0x03
1959dea3101eS #define CMD_XMIT_BCAST_CN       0x04
1960dea3101eS #define CMD_XMIT_BCAST_CX       0x05
1961dea3101eS #define CMD_QUE_RING_BUF_CN     0x06
1962dea3101eS #define CMD_QUE_XRI_BUF_CX      0x07
1963dea3101eS #define CMD_IOCB_CONTINUE_CN    0x08
1964dea3101eS #define CMD_RET_XRI_BUF_CX      0x09
1965dea3101eS #define CMD_ELS_REQUEST_CR      0x0A
1966dea3101eS #define CMD_ELS_REQUEST_CX      0x0B
1967dea3101eS #define CMD_RCV_ELS_REQ_CX      0x0D
1968dea3101eS #define CMD_ABORT_XRI_CN        0x0E
1969dea3101eS #define CMD_ABORT_XRI_CX        0x0F
1970dea3101eS #define CMD_CLOSE_XRI_CN        0x10
1971dea3101eS #define CMD_CLOSE_XRI_CX        0x11
1972dea3101eS #define CMD_CREATE_XRI_CR       0x12
1973dea3101eS #define CMD_CREATE_XRI_CX       0x13
1974dea3101eS #define CMD_GET_RPI_CN          0x14
1975dea3101eS #define CMD_XMIT_ELS_RSP_CX     0x15
1976dea3101eS #define CMD_GET_RPI_CR          0x16
1977dea3101eS #define CMD_XRI_ABORTED_CX      0x17
1978dea3101eS #define CMD_FCP_IWRITE_CR       0x18
1979dea3101eS #define CMD_FCP_IWRITE_CX       0x19
1980dea3101eS #define CMD_FCP_IREAD_CR        0x1A
1981dea3101eS #define CMD_FCP_IREAD_CX        0x1B
1982dea3101eS #define CMD_FCP_ICMND_CR        0x1C
1983dea3101eS #define CMD_FCP_ICMND_CX        0x1D
1984f5603511SJames Smart #define CMD_FCP_TSEND_CX        0x1F
1985f5603511SJames Smart #define CMD_FCP_TRECEIVE_CX     0x21
1986f5603511SJames Smart #define CMD_FCP_TRSP_CX	        0x23
1987f5603511SJames Smart #define CMD_FCP_AUTO_TRSP_CX    0x29
1988dea3101eS 
1989dea3101eS #define CMD_ADAPTER_MSG         0x20
1990dea3101eS #define CMD_ADAPTER_DUMP        0x22
1991dea3101eS 
1992dea3101eS /*  SLI_2 IOCB Command Set */
1993dea3101eS 
199457127f15SJames Smart #define CMD_ASYNC_STATUS        0x7C
1995dea3101eS #define CMD_RCV_SEQUENCE64_CX   0x81
1996dea3101eS #define CMD_XMIT_SEQUENCE64_CR  0x82
1997dea3101eS #define CMD_XMIT_SEQUENCE64_CX  0x83
1998dea3101eS #define CMD_XMIT_BCAST64_CN     0x84
1999dea3101eS #define CMD_XMIT_BCAST64_CX     0x85
2000dea3101eS #define CMD_QUE_RING_BUF64_CN   0x86
2001dea3101eS #define CMD_QUE_XRI_BUF64_CX    0x87
2002dea3101eS #define CMD_IOCB_CONTINUE64_CN  0x88
2003dea3101eS #define CMD_RET_XRI_BUF64_CX    0x89
2004dea3101eS #define CMD_ELS_REQUEST64_CR    0x8A
2005dea3101eS #define CMD_ELS_REQUEST64_CX    0x8B
2006dea3101eS #define CMD_ABORT_MXRI64_CN     0x8C
2007dea3101eS #define CMD_RCV_ELS_REQ64_CX    0x8D
2008dea3101eS #define CMD_XMIT_ELS_RSP64_CX   0x95
20096669f9bbSJames Smart #define CMD_XMIT_BLS_RSP64_CX   0x97
2010dea3101eS #define CMD_FCP_IWRITE64_CR     0x98
2011dea3101eS #define CMD_FCP_IWRITE64_CX     0x99
2012dea3101eS #define CMD_FCP_IREAD64_CR      0x9A
2013dea3101eS #define CMD_FCP_IREAD64_CX      0x9B
2014dea3101eS #define CMD_FCP_ICMND64_CR      0x9C
2015dea3101eS #define CMD_FCP_ICMND64_CX      0x9D
2016f5603511SJames Smart #define CMD_FCP_TSEND64_CX      0x9F
2017f5603511SJames Smart #define CMD_FCP_TRECEIVE64_CX   0xA1
2018f5603511SJames Smart #define CMD_FCP_TRSP64_CX       0xA3
2019dea3101eS 
202076bb24efSJames Smart #define CMD_QUE_XRI64_CX	0xB3
2021ed957684SJames Smart #define CMD_IOCB_RCV_SEQ64_CX	0xB5
2022ed957684SJames Smart #define CMD_IOCB_RCV_ELS64_CX	0xB7
20233163f725SJames Smart #define CMD_IOCB_RET_XRI64_CX	0xB9
2024ed957684SJames Smart #define CMD_IOCB_RCV_CONT64_CX	0xBB
2025ed957684SJames Smart 
2026dea3101eS #define CMD_GEN_REQUEST64_CR    0xC2
2027dea3101eS #define CMD_GEN_REQUEST64_CX    0xC3
2028dea3101eS 
20293163f725SJames Smart /* Unhandled SLI-3 Commands */
20303163f725SJames Smart #define CMD_IOCB_XMIT_MSEQ64_CR		0xB0
20313163f725SJames Smart #define CMD_IOCB_XMIT_MSEQ64_CX		0xB1
20323163f725SJames Smart #define CMD_IOCB_RCV_SEQ_LIST64_CX	0xC1
20333163f725SJames Smart #define CMD_IOCB_RCV_ELS_LIST64_CX	0xCD
20343163f725SJames Smart #define CMD_IOCB_CLOSE_EXTENDED_CN	0xB6
20353163f725SJames Smart #define CMD_IOCB_ABORT_EXTENDED_CN	0xBA
20363163f725SJames Smart #define CMD_IOCB_RET_HBQE64_CN		0xCA
20373163f725SJames Smart #define CMD_IOCB_FCP_IBIDIR64_CR	0xAC
20383163f725SJames Smart #define CMD_IOCB_FCP_IBIDIR64_CX	0xAD
20393163f725SJames Smart #define CMD_IOCB_FCP_ITASKMGT64_CX	0xAF
20403163f725SJames Smart #define CMD_IOCB_LOGENTRY_CN		0x94
20413163f725SJames Smart #define CMD_IOCB_LOGENTRY_ASYNC_CN	0x96
20423163f725SJames Smart 
2043341af102SJames Smart /* Data Security SLI Commands */
2044341af102SJames Smart #define DSSCMD_IWRITE64_CR		0xF8
2045341af102SJames Smart #define DSSCMD_IWRITE64_CX		0xF9
2046341af102SJames Smart #define DSSCMD_IREAD64_CR		0xFA
2047341af102SJames Smart #define DSSCMD_IREAD64_CX		0xFB
2048da0436e9SJames Smart 
2049341af102SJames Smart #define CMD_MAX_IOCB_CMD        0xFB
2050dea3101eS #define CMD_IOCB_MASK           0xff
2051dea3101eS 
2052dea3101eS #define MAX_MSG_DATA            28	/* max msg data in CMD_ADAPTER_MSG
2053dea3101eS 					   iocb */
2054dea3101eS #define LPFC_MAX_ADPTMSG         32	/* max msg data */
2055dea3101eS /*
2056dea3101eS  *  Define Status
2057dea3101eS  */
2058dea3101eS #define MBX_SUCCESS                 0
2059dea3101eS #define MBXERR_NUM_RINGS            1
2060dea3101eS #define MBXERR_NUM_IOCBS            2
2061dea3101eS #define MBXERR_IOCBS_EXCEEDED       3
2062dea3101eS #define MBXERR_BAD_RING_NUMBER      4
2063dea3101eS #define MBXERR_MASK_ENTRIES_RANGE   5
2064dea3101eS #define MBXERR_MASKS_EXCEEDED       6
2065dea3101eS #define MBXERR_BAD_PROFILE          7
2066dea3101eS #define MBXERR_BAD_DEF_CLASS        8
2067dea3101eS #define MBXERR_BAD_MAX_RESPONDER    9
2068dea3101eS #define MBXERR_BAD_MAX_ORIGINATOR   10
2069dea3101eS #define MBXERR_RPI_REGISTERED       11
2070dea3101eS #define MBXERR_RPI_FULL             12
2071dea3101eS #define MBXERR_NO_RESOURCES         13
2072dea3101eS #define MBXERR_BAD_RCV_LENGTH       14
2073dea3101eS #define MBXERR_DMA_ERROR            15
2074dea3101eS #define MBXERR_ERROR                16
2075da0436e9SJames Smart #define MBXERR_LINK_DOWN            0x33
2076dcf2a4e0SJames Smart #define MBXERR_SEC_NO_PERMISSION    0xF02
2077dea3101eS #define MBX_NOT_FINISHED            255
2078dea3101eS 
2079dea3101eS #define MBX_BUSY                   0xffffff /* Attempted cmd to busy Mailbox */
2080dea3101eS #define MBX_TIMEOUT                0xfffffe /* time-out expired waiting for */
2081dea3101eS 
208257127f15SJames Smart #define TEMPERATURE_OFFSET 0xB0	/* Slim offset for critical temperature event */
208357127f15SJames Smart 
2084dea3101eS /*
208586478875SJames Smart  * return code Fail
208686478875SJames Smart  */
208786478875SJames Smart #define FAILURE 1
208886478875SJames Smart 
208986478875SJames Smart /*
2090dea3101eS  *    Begin Structure Definitions for Mailbox Commands
2091dea3101eS  */
2092dea3101eS 
2093dea3101eS typedef struct {
2094dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2095dea3101eS 	uint8_t tval;
2096dea3101eS 	uint8_t tmask;
2097dea3101eS 	uint8_t rval;
2098dea3101eS 	uint8_t rmask;
2099dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2100dea3101eS 	uint8_t rmask;
2101dea3101eS 	uint8_t rval;
2102dea3101eS 	uint8_t tmask;
2103dea3101eS 	uint8_t tval;
2104dea3101eS #endif
2105dea3101eS } RR_REG;
2106dea3101eS 
2107dea3101eS struct ulp_bde {
2108dea3101eS 	uint32_t bdeAddress;
2109dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2110dea3101eS 	uint32_t bdeReserved:4;
2111dea3101eS 	uint32_t bdeAddrHigh:4;
2112dea3101eS 	uint32_t bdeSize:24;
2113dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2114dea3101eS 	uint32_t bdeSize:24;
2115dea3101eS 	uint32_t bdeAddrHigh:4;
2116dea3101eS 	uint32_t bdeReserved:4;
2117dea3101eS #endif
2118dea3101eS };
2119dea3101eS 
2120dea3101eS typedef struct ULP_BDL {	/* SLI-2 */
2121dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2122dea3101eS 	uint32_t bdeFlags:8;	/* BDL Flags */
2123dea3101eS 	uint32_t bdeSize:24;	/* Size of BDL array in host memory (bytes) */
2124dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2125dea3101eS 	uint32_t bdeSize:24;	/* Size of BDL array in host memory (bytes) */
2126dea3101eS 	uint32_t bdeFlags:8;	/* BDL Flags */
2127dea3101eS #endif
2128dea3101eS 
2129dea3101eS 	uint32_t addrLow;	/* Address 0:31 */
2130dea3101eS 	uint32_t addrHigh;	/* Address 32:63 */
2131dea3101eS 	uint32_t ulpIoTag32;	/* Can be used for 32 bit I/O Tag */
2132dea3101eS } ULP_BDL;
2133dea3101eS 
213481301a9bSJames Smart /*
213581301a9bSJames Smart  * BlockGuard Definitions
213681301a9bSJames Smart  */
213781301a9bSJames Smart 
213881301a9bSJames Smart enum lpfc_protgrp_type {
213981301a9bSJames Smart 	LPFC_PG_TYPE_INVALID = 0, /* used to indicate errors                  */
214081301a9bSJames Smart 	LPFC_PG_TYPE_NO_DIF,	  /* no DIF data pointed to by prot grp       */
214181301a9bSJames Smart 	LPFC_PG_TYPE_EMBD_DIF,	  /* DIF is embedded (inline) with data       */
214281301a9bSJames Smart 	LPFC_PG_TYPE_DIF_BUF	  /* DIF has its own scatter/gather list      */
214381301a9bSJames Smart };
214481301a9bSJames Smart 
214581301a9bSJames Smart /* PDE Descriptors */
21466c8eea54SJames Smart #define LPFC_PDE5_DESCRIPTOR		0x85
21476c8eea54SJames Smart #define LPFC_PDE6_DESCRIPTOR		0x86
21486c8eea54SJames Smart #define LPFC_PDE7_DESCRIPTOR		0x87
214981301a9bSJames Smart 
21506c8eea54SJames Smart /* BlockGuard Opcodes */
21516c8eea54SJames Smart #define BG_OP_IN_NODIF_OUT_CRC		0x0
21526c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_NODIF		0x1
21536c8eea54SJames Smart #define	BG_OP_IN_NODIF_OUT_CSUM		0x2
21546c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_NODIF		0x3
21556c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_CRC		0x4
21566c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_CSUM		0x5
21576c8eea54SJames Smart #define	BG_OP_IN_CRC_OUT_CSUM		0x6
21586c8eea54SJames Smart #define	BG_OP_IN_CSUM_OUT_CRC		0x7
2159a6887e28SJames Smart #define	BG_OP_RAW_MODE			0x8
21606c8eea54SJames Smart 
21616c8eea54SJames Smart struct lpfc_pde5 {
21626c8eea54SJames Smart 	uint32_t word0;
21636c8eea54SJames Smart #define pde5_type_SHIFT		24
21646c8eea54SJames Smart #define pde5_type_MASK		0x000000ff
21656c8eea54SJames Smart #define pde5_type_WORD		word0
21666c8eea54SJames Smart #define pde5_rsvd0_SHIFT	0
21676c8eea54SJames Smart #define pde5_rsvd0_MASK		0x00ffffff
21686c8eea54SJames Smart #define pde5_rsvd0_WORD		word0
21696c8eea54SJames Smart 	uint32_t reftag;	/* Reference Tag Value			*/
21706c8eea54SJames Smart 	uint32_t reftagtr;	/* Reference Tag Translation Value 	*/
217181301a9bSJames Smart };
217281301a9bSJames Smart 
21736c8eea54SJames Smart struct lpfc_pde6 {
21746c8eea54SJames Smart 	uint32_t word0;
21756c8eea54SJames Smart #define pde6_type_SHIFT		24
21766c8eea54SJames Smart #define pde6_type_MASK		0x000000ff
21776c8eea54SJames Smart #define pde6_type_WORD		word0
21786c8eea54SJames Smart #define pde6_rsvd0_SHIFT	0
21796c8eea54SJames Smart #define pde6_rsvd0_MASK		0x00ffffff
21806c8eea54SJames Smart #define pde6_rsvd0_WORD		word0
21816c8eea54SJames Smart 	uint32_t word1;
21826c8eea54SJames Smart #define pde6_rsvd1_SHIFT	26
21836c8eea54SJames Smart #define pde6_rsvd1_MASK		0x0000003f
21846c8eea54SJames Smart #define pde6_rsvd1_WORD		word1
21856c8eea54SJames Smart #define pde6_na_SHIFT		25
21866c8eea54SJames Smart #define pde6_na_MASK		0x00000001
21876c8eea54SJames Smart #define pde6_na_WORD		word1
21886c8eea54SJames Smart #define pde6_rsvd2_SHIFT	16
21896c8eea54SJames Smart #define pde6_rsvd2_MASK		0x000001FF
21906c8eea54SJames Smart #define pde6_rsvd2_WORD		word1
21916c8eea54SJames Smart #define pde6_apptagtr_SHIFT	0
21926c8eea54SJames Smart #define pde6_apptagtr_MASK	0x0000ffff
21936c8eea54SJames Smart #define pde6_apptagtr_WORD	word1
21946c8eea54SJames Smart 	uint32_t word2;
21956c8eea54SJames Smart #define pde6_optx_SHIFT		28
21966c8eea54SJames Smart #define pde6_optx_MASK		0x0000000f
21976c8eea54SJames Smart #define pde6_optx_WORD		word2
21986c8eea54SJames Smart #define pde6_oprx_SHIFT		24
21996c8eea54SJames Smart #define pde6_oprx_MASK		0x0000000f
22006c8eea54SJames Smart #define pde6_oprx_WORD		word2
22016c8eea54SJames Smart #define pde6_nr_SHIFT		23
22026c8eea54SJames Smart #define pde6_nr_MASK		0x00000001
22036c8eea54SJames Smart #define pde6_nr_WORD		word2
22046c8eea54SJames Smart #define pde6_ce_SHIFT		22
22056c8eea54SJames Smart #define pde6_ce_MASK		0x00000001
22066c8eea54SJames Smart #define pde6_ce_WORD		word2
22076c8eea54SJames Smart #define pde6_re_SHIFT		21
22086c8eea54SJames Smart #define pde6_re_MASK		0x00000001
22096c8eea54SJames Smart #define pde6_re_WORD		word2
22106c8eea54SJames Smart #define pde6_ae_SHIFT		20
22116c8eea54SJames Smart #define pde6_ae_MASK		0x00000001
22126c8eea54SJames Smart #define pde6_ae_WORD		word2
22136c8eea54SJames Smart #define pde6_ai_SHIFT		19
22146c8eea54SJames Smart #define pde6_ai_MASK		0x00000001
22156c8eea54SJames Smart #define pde6_ai_WORD		word2
22166c8eea54SJames Smart #define pde6_bs_SHIFT		16
22176c8eea54SJames Smart #define pde6_bs_MASK		0x00000007
22186c8eea54SJames Smart #define pde6_bs_WORD		word2
22196c8eea54SJames Smart #define pde6_apptagval_SHIFT	0
22206c8eea54SJames Smart #define pde6_apptagval_MASK	0x0000ffff
22216c8eea54SJames Smart #define pde6_apptagval_WORD	word2
222281301a9bSJames Smart };
222381301a9bSJames Smart 
22247f86059aSJames Smart struct lpfc_pde7 {
22257f86059aSJames Smart 	uint32_t word0;
22267f86059aSJames Smart #define pde7_type_SHIFT		24
22277f86059aSJames Smart #define pde7_type_MASK		0x000000ff
22287f86059aSJames Smart #define pde7_type_WORD		word0
22297f86059aSJames Smart #define pde7_rsvd0_SHIFT	0
22307f86059aSJames Smart #define pde7_rsvd0_MASK		0x00ffffff
22317f86059aSJames Smart #define pde7_rsvd0_WORD		word0
22327f86059aSJames Smart 	uint32_t addrHigh;
22337f86059aSJames Smart 	uint32_t addrLow;
22347f86059aSJames Smart };
223581301a9bSJames Smart 
2236dea3101eS /* Structure for MB Command LOAD_SM and DOWN_LOAD */
2237dea3101eS 
2238dea3101eS typedef struct {
2239dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2240dea3101eS 	uint32_t rsvd2:25;
2241dea3101eS 	uint32_t acknowledgment:1;
2242dea3101eS 	uint32_t version:1;
2243dea3101eS 	uint32_t erase_or_prog:1;
2244dea3101eS 	uint32_t update_flash:1;
2245dea3101eS 	uint32_t update_ram:1;
2246dea3101eS 	uint32_t method:1;
2247dea3101eS 	uint32_t load_cmplt:1;
2248dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2249dea3101eS 	uint32_t load_cmplt:1;
2250dea3101eS 	uint32_t method:1;
2251dea3101eS 	uint32_t update_ram:1;
2252dea3101eS 	uint32_t update_flash:1;
2253dea3101eS 	uint32_t erase_or_prog:1;
2254dea3101eS 	uint32_t version:1;
2255dea3101eS 	uint32_t acknowledgment:1;
2256dea3101eS 	uint32_t rsvd2:25;
2257dea3101eS #endif
2258dea3101eS 
2259dea3101eS 	uint32_t dl_to_adr_low;
2260dea3101eS 	uint32_t dl_to_adr_high;
2261dea3101eS 	uint32_t dl_len;
2262dea3101eS 	union {
2263dea3101eS 		uint32_t dl_from_mbx_offset;
2264dea3101eS 		struct ulp_bde dl_from_bde;
2265dea3101eS 		struct ulp_bde64 dl_from_bde64;
2266dea3101eS 	} un;
2267dea3101eS 
2268dea3101eS } LOAD_SM_VAR;
2269dea3101eS 
2270dea3101eS /* Structure for MB Command READ_NVPARM (02) */
2271dea3101eS 
2272dea3101eS typedef struct {
2273dea3101eS 	uint32_t rsvd1[3];	/* Read as all one's */
2274dea3101eS 	uint32_t rsvd2;		/* Read as all zero's */
2275dea3101eS 	uint32_t portname[2];	/* N_PORT name */
2276dea3101eS 	uint32_t nodename[2];	/* NODE name */
2277dea3101eS 
2278dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2279dea3101eS 	uint32_t pref_DID:24;
2280dea3101eS 	uint32_t hardAL_PA:8;
2281dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2282dea3101eS 	uint32_t hardAL_PA:8;
2283dea3101eS 	uint32_t pref_DID:24;
2284dea3101eS #endif
2285dea3101eS 
2286dea3101eS 	uint32_t rsvd3[21];	/* Read as all one's */
2287dea3101eS } READ_NV_VAR;
2288dea3101eS 
2289dea3101eS /* Structure for MB Command WRITE_NVPARMS (03) */
2290dea3101eS 
2291dea3101eS typedef struct {
2292dea3101eS 	uint32_t rsvd1[3];	/* Must be all one's */
2293dea3101eS 	uint32_t rsvd2;		/* Must be all zero's */
2294dea3101eS 	uint32_t portname[2];	/* N_PORT name */
2295dea3101eS 	uint32_t nodename[2];	/* NODE name */
2296dea3101eS 
2297dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2298dea3101eS 	uint32_t pref_DID:24;
2299dea3101eS 	uint32_t hardAL_PA:8;
2300dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2301dea3101eS 	uint32_t hardAL_PA:8;
2302dea3101eS 	uint32_t pref_DID:24;
2303dea3101eS #endif
2304dea3101eS 
2305dea3101eS 	uint32_t rsvd3[21];	/* Must be all one's */
2306dea3101eS } WRITE_NV_VAR;
2307dea3101eS 
2308dea3101eS /* Structure for MB Command RUN_BIU_DIAG (04) */
2309dea3101eS /* Structure for MB Command RUN_BIU_DIAG64 (0x84) */
2310dea3101eS 
2311dea3101eS typedef struct {
2312dea3101eS 	uint32_t rsvd1;
2313dea3101eS 	union {
2314dea3101eS 		struct {
2315dea3101eS 			struct ulp_bde xmit_bde;
2316dea3101eS 			struct ulp_bde rcv_bde;
2317dea3101eS 		} s1;
2318dea3101eS 		struct {
2319dea3101eS 			struct ulp_bde64 xmit_bde64;
2320dea3101eS 			struct ulp_bde64 rcv_bde64;
2321dea3101eS 		} s2;
2322dea3101eS 	} un;
2323dea3101eS } BIU_DIAG_VAR;
2324dea3101eS 
2325c7495937SJames Smart /* Structure for MB command READ_EVENT_LOG (0x38) */
2326c7495937SJames Smart struct READ_EVENT_LOG_VAR {
2327c7495937SJames Smart 	uint32_t word1;
2328c7495937SJames Smart #define lpfc_event_log_SHIFT	29
2329c7495937SJames Smart #define lpfc_event_log_MASK	0x00000001
2330c7495937SJames Smart #define lpfc_event_log_WORD	word1
2331c7495937SJames Smart #define USE_MAILBOX_RESPONSE	1
2332c7495937SJames Smart 	uint32_t offset;
2333c7495937SJames Smart 	struct ulp_bde64 rcv_bde64;
2334c7495937SJames Smart };
2335c7495937SJames Smart 
2336dea3101eS /* Structure for MB Command INIT_LINK (05) */
2337dea3101eS 
2338dea3101eS typedef struct {
2339dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2340dea3101eS 	uint32_t rsvd1:24;
2341dea3101eS 	uint32_t lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective Reset to */
2342dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2343dea3101eS 	uint32_t lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective Reset to */
2344dea3101eS 	uint32_t rsvd1:24;
2345dea3101eS #endif
2346dea3101eS 
2347dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2348dea3101eS 	uint8_t fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
2349dea3101eS 	uint8_t rsvd2;
2350dea3101eS 	uint16_t link_flags;
2351dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2352dea3101eS 	uint16_t link_flags;
2353dea3101eS 	uint8_t rsvd2;
2354dea3101eS 	uint8_t fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
2355dea3101eS #endif
2356dea3101eS 
2357dea3101eS #define FLAGS_TOPOLOGY_MODE_LOOP_PT  0x00 /* Attempt loop then pt-pt */
23581b51197dSJames Smart #define FLAGS_LOCAL_LB               0x01 /* link_flags (=1) ENDEC loopback */
2359dea3101eS #define FLAGS_TOPOLOGY_MODE_PT_PT    0x02 /* Attempt pt-pt only */
2360dea3101eS #define FLAGS_TOPOLOGY_MODE_LOOP     0x04 /* Attempt loop only */
2361dea3101eS #define FLAGS_TOPOLOGY_MODE_PT_LOOP  0x06 /* Attempt pt-pt then loop */
2362ed957684SJames Smart #define	FLAGS_UNREG_LOGIN_ALL	     0x08 /* UNREG_LOGIN all on link down */
2363dea3101eS #define FLAGS_LIRP_LILP              0x80 /* LIRP / LILP is disabled */
2364dea3101eS 
2365dea3101eS #define FLAGS_TOPOLOGY_FAILOVER      0x0400	/* Bit 10 */
2366dea3101eS #define FLAGS_LINK_SPEED             0x0800	/* Bit 11 */
23674b0b91d4SJames Smart #define FLAGS_IMED_ABORT             0x04000	/* Bit 14 */
2368dea3101eS 
2369dea3101eS 	uint32_t link_speed;
237076a95d75SJames Smart #define LINK_SPEED_AUTO 0x0     /* Auto selection */
237176a95d75SJames Smart #define LINK_SPEED_1G   0x1     /* 1 Gigabaud */
237276a95d75SJames Smart #define LINK_SPEED_2G   0x2     /* 2 Gigabaud */
237376a95d75SJames Smart #define LINK_SPEED_4G   0x4     /* 4 Gigabaud */
237476a95d75SJames Smart #define LINK_SPEED_8G   0x8     /* 8 Gigabaud */
237576a95d75SJames Smart #define LINK_SPEED_10G  0x10    /* 10 Gigabaud */
237676a95d75SJames Smart #define LINK_SPEED_16G  0x11    /* 16 Gigabaud */
2377d38dd52cSJames Smart #define LINK_SPEED_32G  0x14    /* 32 Gigabaud */
2378fbd8a6baSJames Smart #define LINK_SPEED_64G  0x17    /* 64 Gigabaud */
2379fbd8a6baSJames Smart #define LINK_SPEED_128G 0x1A    /* 128 Gigabaud */
2380fbd8a6baSJames Smart #define LINK_SPEED_256G 0x1D    /* 256 Gigabaud */
2381dea3101eS 
2382dea3101eS } INIT_LINK_VAR;
2383dea3101eS 
2384dea3101eS /* Structure for MB Command DOWN_LINK (06) */
2385dea3101eS 
2386dea3101eS typedef struct {
2387dea3101eS 	uint32_t rsvd1;
2388dea3101eS } DOWN_LINK_VAR;
2389dea3101eS 
2390dea3101eS /* Structure for MB Command CONFIG_LINK (07) */
2391dea3101eS 
2392dea3101eS typedef struct {
2393dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2394dea3101eS 	uint32_t cr:1;
2395dea3101eS 	uint32_t ci:1;
2396dea3101eS 	uint32_t cr_delay:6;
2397dea3101eS 	uint32_t cr_count:8;
2398dea3101eS 	uint32_t rsvd1:8;
2399dea3101eS 	uint32_t MaxBBC:8;
2400dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2401dea3101eS 	uint32_t MaxBBC:8;
2402dea3101eS 	uint32_t rsvd1:8;
2403dea3101eS 	uint32_t cr_count:8;
2404dea3101eS 	uint32_t cr_delay:6;
2405dea3101eS 	uint32_t ci:1;
2406dea3101eS 	uint32_t cr:1;
2407dea3101eS #endif
2408dea3101eS 
2409dea3101eS 	uint32_t myId;
2410dea3101eS 	uint32_t rsvd2;
2411dea3101eS 	uint32_t edtov;
2412dea3101eS 	uint32_t arbtov;
2413dea3101eS 	uint32_t ratov;
2414dea3101eS 	uint32_t rttov;
2415dea3101eS 	uint32_t altov;
2416dea3101eS 	uint32_t crtov;
241744fd7fe3SJames Smart 
241844fd7fe3SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
241944fd7fe3SJames Smart 	uint32_t rsvd4:19;
242044fd7fe3SJames Smart 	uint32_t cscn:1;
242144fd7fe3SJames Smart 	uint32_t bbscn:4;
242244fd7fe3SJames Smart 	uint32_t rsvd3:8;
242344fd7fe3SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
242444fd7fe3SJames Smart 	uint32_t rsvd3:8;
242544fd7fe3SJames Smart 	uint32_t bbscn:4;
242644fd7fe3SJames Smart 	uint32_t cscn:1;
242744fd7fe3SJames Smart 	uint32_t rsvd4:19;
242844fd7fe3SJames Smart #endif
242944fd7fe3SJames Smart 
2430dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2431dea3101eS 	uint32_t rrq_enable:1;
2432dea3101eS 	uint32_t rrq_immed:1;
243344fd7fe3SJames Smart 	uint32_t rsvd5:29;
2434dea3101eS 	uint32_t ack0_enable:1;
2435dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2436dea3101eS 	uint32_t ack0_enable:1;
243744fd7fe3SJames Smart 	uint32_t rsvd5:29;
2438dea3101eS 	uint32_t rrq_immed:1;
2439dea3101eS 	uint32_t rrq_enable:1;
2440dea3101eS #endif
2441dea3101eS } CONFIG_LINK;
2442dea3101eS 
2443dea3101eS /* Structure for MB Command PART_SLIM (08)
2444dea3101eS  * will be removed since SLI1 is no longer supported!
2445dea3101eS  */
2446dea3101eS typedef struct {
2447dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2448dea3101eS 	uint16_t offCiocb;
2449dea3101eS 	uint16_t numCiocb;
2450dea3101eS 	uint16_t offRiocb;
2451dea3101eS 	uint16_t numRiocb;
2452dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2453dea3101eS 	uint16_t numCiocb;
2454dea3101eS 	uint16_t offCiocb;
2455dea3101eS 	uint16_t numRiocb;
2456dea3101eS 	uint16_t offRiocb;
2457dea3101eS #endif
2458dea3101eS } RING_DEF;
2459dea3101eS 
2460dea3101eS typedef struct {
2461dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2462dea3101eS 	uint32_t unused1:24;
2463dea3101eS 	uint32_t numRing:8;
2464dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2465dea3101eS 	uint32_t numRing:8;
2466dea3101eS 	uint32_t unused1:24;
2467dea3101eS #endif
2468dea3101eS 
2469dea3101eS 	RING_DEF ringdef[4];
2470dea3101eS 	uint32_t hbainit;
2471dea3101eS } PART_SLIM_VAR;
2472dea3101eS 
2473dea3101eS /* Structure for MB Command CONFIG_RING (09) */
2474dea3101eS 
2475dea3101eS typedef struct {
2476dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2477dea3101eS 	uint32_t unused2:6;
2478dea3101eS 	uint32_t recvSeq:1;
2479dea3101eS 	uint32_t recvNotify:1;
2480dea3101eS 	uint32_t numMask:8;
2481dea3101eS 	uint32_t profile:8;
2482dea3101eS 	uint32_t unused1:4;
2483dea3101eS 	uint32_t ring:4;
2484dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2485dea3101eS 	uint32_t ring:4;
2486dea3101eS 	uint32_t unused1:4;
2487dea3101eS 	uint32_t profile:8;
2488dea3101eS 	uint32_t numMask:8;
2489dea3101eS 	uint32_t recvNotify:1;
2490dea3101eS 	uint32_t recvSeq:1;
2491dea3101eS 	uint32_t unused2:6;
2492dea3101eS #endif
2493dea3101eS 
2494dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2495dea3101eS 	uint16_t maxRespXchg;
2496dea3101eS 	uint16_t maxOrigXchg;
2497dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2498dea3101eS 	uint16_t maxOrigXchg;
2499dea3101eS 	uint16_t maxRespXchg;
2500dea3101eS #endif
2501dea3101eS 
2502dea3101eS 	RR_REG rrRegs[6];
2503dea3101eS } CONFIG_RING_VAR;
2504dea3101eS 
2505dea3101eS /* Structure for MB Command RESET_RING (10) */
2506dea3101eS 
2507dea3101eS typedef struct {
2508dea3101eS 	uint32_t ring_no;
2509dea3101eS } RESET_RING_VAR;
2510dea3101eS 
2511dea3101eS /* Structure for MB Command READ_CONFIG (11) */
2512dea3101eS 
2513dea3101eS typedef struct {
2514dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2515dea3101eS 	uint32_t cr:1;
2516dea3101eS 	uint32_t ci:1;
2517dea3101eS 	uint32_t cr_delay:6;
2518dea3101eS 	uint32_t cr_count:8;
2519dea3101eS 	uint32_t InitBBC:8;
2520dea3101eS 	uint32_t MaxBBC:8;
2521dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2522dea3101eS 	uint32_t MaxBBC:8;
2523dea3101eS 	uint32_t InitBBC:8;
2524dea3101eS 	uint32_t cr_count:8;
2525dea3101eS 	uint32_t cr_delay:6;
2526dea3101eS 	uint32_t ci:1;
2527dea3101eS 	uint32_t cr:1;
2528dea3101eS #endif
2529dea3101eS 
2530dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2531dea3101eS 	uint32_t topology:8;
2532dea3101eS 	uint32_t myDid:24;
2533dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2534dea3101eS 	uint32_t myDid:24;
2535dea3101eS 	uint32_t topology:8;
2536dea3101eS #endif
2537dea3101eS 
2538dea3101eS 	/* Defines for topology (defined previously) */
2539dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2540dea3101eS 	uint32_t AR:1;
2541dea3101eS 	uint32_t IR:1;
2542dea3101eS 	uint32_t rsvd1:29;
2543dea3101eS 	uint32_t ack0:1;
2544dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2545dea3101eS 	uint32_t ack0:1;
2546dea3101eS 	uint32_t rsvd1:29;
2547dea3101eS 	uint32_t IR:1;
2548dea3101eS 	uint32_t AR:1;
2549dea3101eS #endif
2550dea3101eS 
2551dea3101eS 	uint32_t edtov;
2552dea3101eS 	uint32_t arbtov;
2553dea3101eS 	uint32_t ratov;
2554dea3101eS 	uint32_t rttov;
2555dea3101eS 	uint32_t altov;
2556dea3101eS 	uint32_t lmt;
255774b72a59SJamie Wellnitz #define LMT_RESERVED  0x000    /* Not used */
255874b72a59SJamie Wellnitz #define LMT_1Gb       0x004
255974b72a59SJamie Wellnitz #define LMT_2Gb       0x008
256074b72a59SJamie Wellnitz #define LMT_4Gb       0x040
256174b72a59SJamie Wellnitz #define LMT_8Gb       0x080
256274b72a59SJamie Wellnitz #define LMT_10Gb      0x100
256376a95d75SJames Smart #define LMT_16Gb      0x200
2564d38dd52cSJames Smart #define LMT_32Gb      0x400
2565fbd8a6baSJames Smart #define LMT_64Gb      0x800
2566fbd8a6baSJames Smart #define LMT_128Gb     0x1000
2567fbd8a6baSJames Smart #define LMT_256Gb     0x2000
2568dea3101eS 	uint32_t rsvd2;
2569dea3101eS 	uint32_t rsvd3;
2570dea3101eS 	uint32_t max_xri;
2571dea3101eS 	uint32_t max_iocb;
2572dea3101eS 	uint32_t max_rpi;
2573dea3101eS 	uint32_t avail_xri;
2574dea3101eS 	uint32_t avail_iocb;
2575dea3101eS 	uint32_t avail_rpi;
2576858c9f6cSJames Smart 	uint32_t max_vpi;
2577858c9f6cSJames Smart 	uint32_t rsvd4;
2578858c9f6cSJames Smart 	uint32_t rsvd5;
2579858c9f6cSJames Smart 	uint32_t avail_vpi;
2580dea3101eS } READ_CONFIG_VAR;
2581dea3101eS 
2582dea3101eS /* Structure for MB Command READ_RCONFIG (12) */
2583dea3101eS 
2584dea3101eS typedef struct {
2585dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2586dea3101eS 	uint32_t rsvd2:7;
2587dea3101eS 	uint32_t recvNotify:1;
2588dea3101eS 	uint32_t numMask:8;
2589dea3101eS 	uint32_t profile:8;
2590dea3101eS 	uint32_t rsvd1:4;
2591dea3101eS 	uint32_t ring:4;
2592dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2593dea3101eS 	uint32_t ring:4;
2594dea3101eS 	uint32_t rsvd1:4;
2595dea3101eS 	uint32_t profile:8;
2596dea3101eS 	uint32_t numMask:8;
2597dea3101eS 	uint32_t recvNotify:1;
2598dea3101eS 	uint32_t rsvd2:7;
2599dea3101eS #endif
2600dea3101eS 
2601dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2602dea3101eS 	uint16_t maxResp;
2603dea3101eS 	uint16_t maxOrig;
2604dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2605dea3101eS 	uint16_t maxOrig;
2606dea3101eS 	uint16_t maxResp;
2607dea3101eS #endif
2608dea3101eS 
2609dea3101eS 	RR_REG rrRegs[6];
2610dea3101eS 
2611dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2612dea3101eS 	uint16_t cmdRingOffset;
2613dea3101eS 	uint16_t cmdEntryCnt;
2614dea3101eS 	uint16_t rspRingOffset;
2615dea3101eS 	uint16_t rspEntryCnt;
2616dea3101eS 	uint16_t nextCmdOffset;
2617dea3101eS 	uint16_t rsvd3;
2618dea3101eS 	uint16_t nextRspOffset;
2619dea3101eS 	uint16_t rsvd4;
2620dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2621dea3101eS 	uint16_t cmdEntryCnt;
2622dea3101eS 	uint16_t cmdRingOffset;
2623dea3101eS 	uint16_t rspEntryCnt;
2624dea3101eS 	uint16_t rspRingOffset;
2625dea3101eS 	uint16_t rsvd3;
2626dea3101eS 	uint16_t nextCmdOffset;
2627dea3101eS 	uint16_t rsvd4;
2628dea3101eS 	uint16_t nextRspOffset;
2629dea3101eS #endif
2630dea3101eS } READ_RCONF_VAR;
2631dea3101eS 
2632dea3101eS /* Structure for MB Command READ_SPARM (13) */
2633dea3101eS /* Structure for MB Command READ_SPARM64 (0x8D) */
2634dea3101eS 
2635dea3101eS typedef struct {
2636dea3101eS 	uint32_t rsvd1;
2637dea3101eS 	uint32_t rsvd2;
2638dea3101eS 	union {
2639dea3101eS 		struct ulp_bde sp; /* This BDE points to struct serv_parm
2640dea3101eS 				      structure */
2641dea3101eS 		struct ulp_bde64 sp64;
2642dea3101eS 	} un;
2643ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2644ed957684SJames Smart 	uint16_t rsvd3;
2645ed957684SJames Smart 	uint16_t vpi;
2646ed957684SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
2647ed957684SJames Smart 	uint16_t vpi;
2648ed957684SJames Smart 	uint16_t rsvd3;
2649ed957684SJames Smart #endif
2650dea3101eS } READ_SPARM_VAR;
2651dea3101eS 
2652dea3101eS /* Structure for MB Command READ_STATUS (14) */
2653dea3101eS 
2654dea3101eS typedef struct {
2655dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2656dea3101eS 	uint32_t rsvd1:31;
2657dea3101eS 	uint32_t clrCounters:1;
2658dea3101eS 	uint16_t activeXriCnt;
2659dea3101eS 	uint16_t activeRpiCnt;
2660dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2661dea3101eS 	uint32_t clrCounters:1;
2662dea3101eS 	uint32_t rsvd1:31;
2663dea3101eS 	uint16_t activeRpiCnt;
2664dea3101eS 	uint16_t activeXriCnt;
2665dea3101eS #endif
2666dea3101eS 
2667dea3101eS 	uint32_t xmitByteCnt;
2668dea3101eS 	uint32_t rcvByteCnt;
2669dea3101eS 	uint32_t xmitFrameCnt;
2670dea3101eS 	uint32_t rcvFrameCnt;
2671dea3101eS 	uint32_t xmitSeqCnt;
2672dea3101eS 	uint32_t rcvSeqCnt;
2673dea3101eS 	uint32_t totalOrigExchanges;
2674dea3101eS 	uint32_t totalRespExchanges;
2675dea3101eS 	uint32_t rcvPbsyCnt;
2676dea3101eS 	uint32_t rcvFbsyCnt;
2677dea3101eS } READ_STATUS_VAR;
2678dea3101eS 
2679dea3101eS /* Structure for MB Command READ_RPI (15) */
2680dea3101eS /* Structure for MB Command READ_RPI64 (0x8F) */
2681dea3101eS 
2682dea3101eS typedef struct {
2683dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2684dea3101eS 	uint16_t nextRpi;
2685dea3101eS 	uint16_t reqRpi;
2686dea3101eS 	uint32_t rsvd2:8;
2687dea3101eS 	uint32_t DID:24;
2688dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2689dea3101eS 	uint16_t reqRpi;
2690dea3101eS 	uint16_t nextRpi;
2691dea3101eS 	uint32_t DID:24;
2692dea3101eS 	uint32_t rsvd2:8;
2693dea3101eS #endif
2694dea3101eS 
2695dea3101eS 	union {
2696dea3101eS 		struct ulp_bde sp;
2697dea3101eS 		struct ulp_bde64 sp64;
2698dea3101eS 	} un;
2699dea3101eS 
2700dea3101eS } READ_RPI_VAR;
2701dea3101eS 
2702dea3101eS /* Structure for MB Command READ_XRI (16) */
2703dea3101eS 
2704dea3101eS typedef struct {
2705dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2706dea3101eS 	uint16_t nextXri;
2707dea3101eS 	uint16_t reqXri;
2708dea3101eS 	uint16_t rsvd1;
2709dea3101eS 	uint16_t rpi;
2710dea3101eS 	uint32_t rsvd2:8;
2711dea3101eS 	uint32_t DID:24;
2712dea3101eS 	uint32_t rsvd3:8;
2713dea3101eS 	uint32_t SID:24;
2714dea3101eS 	uint32_t rsvd4;
2715dea3101eS 	uint8_t seqId;
2716dea3101eS 	uint8_t rsvd5;
2717dea3101eS 	uint16_t seqCount;
2718dea3101eS 	uint16_t oxId;
2719dea3101eS 	uint16_t rxId;
2720dea3101eS 	uint32_t rsvd6:30;
2721dea3101eS 	uint32_t si:1;
2722dea3101eS 	uint32_t exchOrig:1;
2723dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2724dea3101eS 	uint16_t reqXri;
2725dea3101eS 	uint16_t nextXri;
2726dea3101eS 	uint16_t rpi;
2727dea3101eS 	uint16_t rsvd1;
2728dea3101eS 	uint32_t DID:24;
2729dea3101eS 	uint32_t rsvd2:8;
2730dea3101eS 	uint32_t SID:24;
2731dea3101eS 	uint32_t rsvd3:8;
2732dea3101eS 	uint32_t rsvd4;
2733dea3101eS 	uint16_t seqCount;
2734dea3101eS 	uint8_t rsvd5;
2735dea3101eS 	uint8_t seqId;
2736dea3101eS 	uint16_t rxId;
2737dea3101eS 	uint16_t oxId;
2738dea3101eS 	uint32_t exchOrig:1;
2739dea3101eS 	uint32_t si:1;
2740dea3101eS 	uint32_t rsvd6:30;
2741dea3101eS #endif
2742dea3101eS } READ_XRI_VAR;
2743dea3101eS 
2744dea3101eS /* Structure for MB Command READ_REV (17) */
2745dea3101eS 
2746dea3101eS typedef struct {
2747dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2748dea3101eS 	uint32_t cv:1;
2749dea3101eS 	uint32_t rr:1;
2750ed957684SJames Smart 	uint32_t rsvd2:2;
2751ed957684SJames Smart 	uint32_t v3req:1;
2752ed957684SJames Smart 	uint32_t v3rsp:1;
2753ed957684SJames Smart 	uint32_t rsvd1:25;
2754dea3101eS 	uint32_t rv:1;
2755dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2756dea3101eS 	uint32_t rv:1;
2757ed957684SJames Smart 	uint32_t rsvd1:25;
2758ed957684SJames Smart 	uint32_t v3rsp:1;
2759ed957684SJames Smart 	uint32_t v3req:1;
2760ed957684SJames Smart 	uint32_t rsvd2:2;
2761dea3101eS 	uint32_t rr:1;
2762dea3101eS 	uint32_t cv:1;
2763dea3101eS #endif
2764dea3101eS 
2765dea3101eS 	uint32_t biuRev;
2766dea3101eS 	uint32_t smRev;
2767dea3101eS 	union {
2768dea3101eS 		uint32_t smFwRev;
2769dea3101eS 		struct {
2770dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2771dea3101eS 			uint8_t ProgType;
2772dea3101eS 			uint8_t ProgId;
2773dea3101eS 			uint16_t ProgVer:4;
2774dea3101eS 			uint16_t ProgRev:4;
2775dea3101eS 			uint16_t ProgFixLvl:2;
2776dea3101eS 			uint16_t ProgDistType:2;
2777dea3101eS 			uint16_t DistCnt:4;
2778dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2779dea3101eS 			uint16_t DistCnt:4;
2780dea3101eS 			uint16_t ProgDistType:2;
2781dea3101eS 			uint16_t ProgFixLvl:2;
2782dea3101eS 			uint16_t ProgRev:4;
2783dea3101eS 			uint16_t ProgVer:4;
2784dea3101eS 			uint8_t ProgId;
2785dea3101eS 			uint8_t ProgType;
2786dea3101eS #endif
2787dea3101eS 
2788dea3101eS 		} b;
2789dea3101eS 	} un;
2790dea3101eS 	uint32_t endecRev;
2791dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2792dea3101eS 	uint8_t feaLevelHigh;
2793dea3101eS 	uint8_t feaLevelLow;
2794dea3101eS 	uint8_t fcphHigh;
2795dea3101eS 	uint8_t fcphLow;
2796dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2797dea3101eS 	uint8_t fcphLow;
2798dea3101eS 	uint8_t fcphHigh;
2799dea3101eS 	uint8_t feaLevelLow;
2800dea3101eS 	uint8_t feaLevelHigh;
2801dea3101eS #endif
2802dea3101eS 
2803dea3101eS 	uint32_t postKernRev;
2804dea3101eS 	uint32_t opFwRev;
2805dea3101eS 	uint8_t opFwName[16];
2806dea3101eS 	uint32_t sli1FwRev;
2807dea3101eS 	uint8_t sli1FwName[16];
2808dea3101eS 	uint32_t sli2FwRev;
2809dea3101eS 	uint8_t sli2FwName[16];
2810ed957684SJames Smart 	uint32_t sli3Feat;
2811ed957684SJames Smart 	uint32_t RandomData[6];
2812dea3101eS } READ_REV_VAR;
2813dea3101eS 
2814dea3101eS /* Structure for MB Command READ_LINK_STAT (18) */
2815dea3101eS 
2816dea3101eS typedef struct {
28174258e98eSJames Smart 	uint32_t word0;
28184258e98eSJames Smart 
28194258e98eSJames Smart #define lpfc_read_link_stat_rec_SHIFT   0
28204258e98eSJames Smart #define lpfc_read_link_stat_rec_MASK   0x1
28214258e98eSJames Smart #define lpfc_read_link_stat_rec_WORD   word0
28224258e98eSJames Smart 
28234258e98eSJames Smart #define lpfc_read_link_stat_gec_SHIFT	1
28244258e98eSJames Smart #define lpfc_read_link_stat_gec_MASK   0x1
28254258e98eSJames Smart #define lpfc_read_link_stat_gec_WORD   word0
28264258e98eSJames Smart 
28274258e98eSJames Smart #define lpfc_read_link_stat_w02oftow23of_SHIFT	2
28284258e98eSJames Smart #define lpfc_read_link_stat_w02oftow23of_MASK   0x3FFFFF
28294258e98eSJames Smart #define lpfc_read_link_stat_w02oftow23of_WORD   word0
28304258e98eSJames Smart 
28314258e98eSJames Smart #define lpfc_read_link_stat_rsvd_SHIFT	24
28324258e98eSJames Smart #define lpfc_read_link_stat_rsvd_MASK   0x1F
28334258e98eSJames Smart #define lpfc_read_link_stat_rsvd_WORD   word0
28344258e98eSJames Smart 
28354258e98eSJames Smart #define lpfc_read_link_stat_gec2_SHIFT  29
28364258e98eSJames Smart #define lpfc_read_link_stat_gec2_MASK   0x1
28374258e98eSJames Smart #define lpfc_read_link_stat_gec2_WORD   word0
28384258e98eSJames Smart 
28394258e98eSJames Smart #define lpfc_read_link_stat_clrc_SHIFT  30
28404258e98eSJames Smart #define lpfc_read_link_stat_clrc_MASK   0x1
28414258e98eSJames Smart #define lpfc_read_link_stat_clrc_WORD   word0
28424258e98eSJames Smart 
28434258e98eSJames Smart #define lpfc_read_link_stat_clof_SHIFT  31
28444258e98eSJames Smart #define lpfc_read_link_stat_clof_MASK   0x1
28454258e98eSJames Smart #define lpfc_read_link_stat_clof_WORD   word0
28464258e98eSJames Smart 
2847dea3101eS 	uint32_t linkFailureCnt;
2848dea3101eS 	uint32_t lossSyncCnt;
2849dea3101eS 	uint32_t lossSignalCnt;
2850dea3101eS 	uint32_t primSeqErrCnt;
2851dea3101eS 	uint32_t invalidXmitWord;
2852dea3101eS 	uint32_t crcCnt;
2853dea3101eS 	uint32_t primSeqTimeout;
2854dea3101eS 	uint32_t elasticOverrun;
2855dea3101eS 	uint32_t arbTimeout;
28564258e98eSJames Smart 	uint32_t advRecBufCredit;
28574258e98eSJames Smart 	uint32_t curRecBufCredit;
28584258e98eSJames Smart 	uint32_t advTransBufCredit;
28594258e98eSJames Smart 	uint32_t curTransBufCredit;
28604258e98eSJames Smart 	uint32_t recEofCount;
28614258e98eSJames Smart 	uint32_t recEofdtiCount;
28624258e98eSJames Smart 	uint32_t recEofniCount;
28634258e98eSJames Smart 	uint32_t recSofcount;
28644258e98eSJames Smart 	uint32_t rsvd1;
28654258e98eSJames Smart 	uint32_t rsvd2;
28664258e98eSJames Smart 	uint32_t recDrpXriCount;
28674258e98eSJames Smart 	uint32_t fecCorrBlkCount;
28684258e98eSJames Smart 	uint32_t fecUncorrBlkCount;
2869dea3101eS } READ_LNK_VAR;
2870dea3101eS 
2871dea3101eS /* Structure for MB Command REG_LOGIN (19) */
2872dea3101eS /* Structure for MB Command REG_LOGIN64 (0x93) */
2873dea3101eS 
2874dea3101eS typedef struct {
2875dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2876dea3101eS 	uint16_t rsvd1;
2877dea3101eS 	uint16_t rpi;
2878dea3101eS 	uint32_t rsvd2:8;
2879dea3101eS 	uint32_t did:24;
2880dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2881dea3101eS 	uint16_t rpi;
2882dea3101eS 	uint16_t rsvd1;
2883dea3101eS 	uint32_t did:24;
2884dea3101eS 	uint32_t rsvd2:8;
2885dea3101eS #endif
2886dea3101eS 
2887dea3101eS 	union {
2888dea3101eS 		struct ulp_bde sp;
2889dea3101eS 		struct ulp_bde64 sp64;
2890dea3101eS 	} un;
2891dea3101eS 
2892ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2893ed957684SJames Smart 	uint16_t rsvd6;
2894ed957684SJames Smart 	uint16_t vpi;
2895ed957684SJames Smart #else /* __LITTLE_ENDIAN_BITFIELD */
2896ed957684SJames Smart 	uint16_t vpi;
2897ed957684SJames Smart 	uint16_t rsvd6;
2898ed957684SJames Smart #endif
2899ed957684SJames Smart 
2900dea3101eS } REG_LOGIN_VAR;
2901dea3101eS 
2902dea3101eS /* Word 30 contents for REG_LOGIN */
2903dea3101eS typedef union {
2904dea3101eS 	struct {
2905dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2906dea3101eS 		uint16_t rsvd1:12;
2907dea3101eS 		uint16_t wd30_class:4;
2908dea3101eS 		uint16_t xri;
2909dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2910dea3101eS 		uint16_t xri;
2911dea3101eS 		uint16_t wd30_class:4;
2912dea3101eS 		uint16_t rsvd1:12;
2913dea3101eS #endif
2914dea3101eS 	} f;
2915dea3101eS 	uint32_t word;
2916dea3101eS } REG_WD30;
2917dea3101eS 
2918dea3101eS /* Structure for MB Command UNREG_LOGIN (20) */
2919dea3101eS 
2920dea3101eS typedef struct {
2921dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
2922dea3101eS 	uint16_t rsvd1;
2923dea3101eS 	uint16_t rpi;
2924ed957684SJames Smart 	uint32_t rsvd2;
2925ed957684SJames Smart 	uint32_t rsvd3;
2926ed957684SJames Smart 	uint32_t rsvd4;
2927ed957684SJames Smart 	uint32_t rsvd5;
2928ed957684SJames Smart 	uint16_t rsvd6;
2929ed957684SJames Smart 	uint16_t vpi;
2930dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
2931dea3101eS 	uint16_t rpi;
2932dea3101eS 	uint16_t rsvd1;
2933ed957684SJames Smart 	uint32_t rsvd2;
2934ed957684SJames Smart 	uint32_t rsvd3;
2935ed957684SJames Smart 	uint32_t rsvd4;
2936ed957684SJames Smart 	uint32_t rsvd5;
2937ed957684SJames Smart 	uint16_t vpi;
2938ed957684SJames Smart 	uint16_t rsvd6;
2939dea3101eS #endif
2940dea3101eS } UNREG_LOGIN_VAR;
2941dea3101eS 
294292d7f7b0SJames Smart /* Structure for MB Command REG_VPI (0x96) */
294392d7f7b0SJames Smart typedef struct {
294492d7f7b0SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
294592d7f7b0SJames Smart 	uint32_t rsvd1;
294638b92ef8SJames Smart 	uint32_t rsvd2:7;
294738b92ef8SJames Smart 	uint32_t upd:1;
294892d7f7b0SJames Smart 	uint32_t sid:24;
2949c868595dSJames Smart 	uint32_t wwn[2];
295092d7f7b0SJames Smart 	uint32_t rsvd5;
2951da0436e9SJames Smart 	uint16_t vfi;
295292d7f7b0SJames Smart 	uint16_t vpi;
295392d7f7b0SJames Smart #else	/*  __LITTLE_ENDIAN */
295492d7f7b0SJames Smart 	uint32_t rsvd1;
295592d7f7b0SJames Smart 	uint32_t sid:24;
295638b92ef8SJames Smart 	uint32_t upd:1;
295738b92ef8SJames Smart 	uint32_t rsvd2:7;
2958c868595dSJames Smart 	uint32_t wwn[2];
295992d7f7b0SJames Smart 	uint32_t rsvd5;
296092d7f7b0SJames Smart 	uint16_t vpi;
2961da0436e9SJames Smart 	uint16_t vfi;
296292d7f7b0SJames Smart #endif
296392d7f7b0SJames Smart } REG_VPI_VAR;
296492d7f7b0SJames Smart 
296592d7f7b0SJames Smart /* Structure for MB Command UNREG_VPI (0x97) */
296692d7f7b0SJames Smart typedef struct {
296792d7f7b0SJames Smart 	uint32_t rsvd1;
29686669f9bbSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
29696669f9bbSJames Smart 	uint16_t rsvd2;
29706669f9bbSJames Smart 	uint16_t sli4_vpi;
29716669f9bbSJames Smart #else	/*  __LITTLE_ENDIAN */
29726669f9bbSJames Smart 	uint16_t sli4_vpi;
29736669f9bbSJames Smart 	uint16_t rsvd2;
29746669f9bbSJames Smart #endif
297592d7f7b0SJames Smart 	uint32_t rsvd3;
297692d7f7b0SJames Smart 	uint32_t rsvd4;
297792d7f7b0SJames Smart 	uint32_t rsvd5;
297892d7f7b0SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
297992d7f7b0SJames Smart 	uint16_t rsvd6;
298092d7f7b0SJames Smart 	uint16_t vpi;
298192d7f7b0SJames Smart #else	/*  __LITTLE_ENDIAN */
298292d7f7b0SJames Smart 	uint16_t vpi;
298392d7f7b0SJames Smart 	uint16_t rsvd6;
298492d7f7b0SJames Smart #endif
298592d7f7b0SJames Smart } UNREG_VPI_VAR;
298692d7f7b0SJames Smart 
2987dea3101eS /* Structure for MB Command UNREG_D_ID (0x23) */
2988dea3101eS 
2989dea3101eS typedef struct {
2990dea3101eS 	uint32_t did;
2991ed957684SJames Smart 	uint32_t rsvd2;
2992ed957684SJames Smart 	uint32_t rsvd3;
2993ed957684SJames Smart 	uint32_t rsvd4;
2994ed957684SJames Smart 	uint32_t rsvd5;
2995ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
2996ed957684SJames Smart 	uint16_t rsvd6;
2997ed957684SJames Smart 	uint16_t vpi;
2998ed957684SJames Smart #else
2999ed957684SJames Smart 	uint16_t vpi;
3000ed957684SJames Smart 	uint16_t rsvd6;
3001ed957684SJames Smart #endif
3002dea3101eS } UNREG_D_ID_VAR;
3003dea3101eS 
300476a95d75SJames Smart /* Structure for MB Command READ_TOPOLOGY (0x95) */
300576a95d75SJames Smart struct lpfc_mbx_read_top {
3006dea3101eS 	uint32_t eventTag;	/* Event tag */
300776a95d75SJames Smart 	uint32_t word2;
300876a95d75SJames Smart #define lpfc_mbx_read_top_fa_SHIFT		12
300976a95d75SJames Smart #define lpfc_mbx_read_top_fa_MASK		0x00000001
301076a95d75SJames Smart #define lpfc_mbx_read_top_fa_WORD		word2
301176a95d75SJames Smart #define lpfc_mbx_read_top_mm_SHIFT		11
301276a95d75SJames Smart #define lpfc_mbx_read_top_mm_MASK		0x00000001
301376a95d75SJames Smart #define lpfc_mbx_read_top_mm_WORD		word2
301476a95d75SJames Smart #define lpfc_mbx_read_top_pb_SHIFT		9
301576a95d75SJames Smart #define lpfc_mbx_read_top_pb_MASK		0X00000001
301676a95d75SJames Smart #define lpfc_mbx_read_top_pb_WORD		word2
301776a95d75SJames Smart #define lpfc_mbx_read_top_il_SHIFT		8
301876a95d75SJames Smart #define lpfc_mbx_read_top_il_MASK		0x00000001
301976a95d75SJames Smart #define lpfc_mbx_read_top_il_WORD		word2
302076a95d75SJames Smart #define lpfc_mbx_read_top_att_type_SHIFT	0
302176a95d75SJames Smart #define lpfc_mbx_read_top_att_type_MASK		0x000000FF
302276a95d75SJames Smart #define lpfc_mbx_read_top_att_type_WORD		word2
302376a95d75SJames Smart #define LPFC_ATT_RESERVED    0x00	/* Reserved - attType */
302476a95d75SJames Smart #define LPFC_ATT_LINK_UP     0x01	/* Link is up */
302576a95d75SJames Smart #define LPFC_ATT_LINK_DOWN   0x02	/* Link is down */
3026aeb3c817SJames Smart #define LPFC_ATT_UNEXP_WWPN  0x06	/* Link is down Unexpected WWWPN */
302776a95d75SJames Smart 	uint32_t word3;
302876a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_SHIFT	24
302976a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_MASK	0x000000FF
303076a95d75SJames Smart #define lpfc_mbx_read_top_alpa_granted_WORD	word3
303176a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_SHIFT	16
303276a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_MASK		0x000000FF
303376a95d75SJames Smart #define lpfc_mbx_read_top_lip_alps_WORD		word3
303476a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_SHIFT	8
303576a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_MASK		0x000000FF
303676a95d75SJames Smart #define lpfc_mbx_read_top_lip_type_WORD		word3
303776a95d75SJames Smart #define lpfc_mbx_read_top_topology_SHIFT	0
303876a95d75SJames Smart #define lpfc_mbx_read_top_topology_MASK		0x000000FF
303976a95d75SJames Smart #define lpfc_mbx_read_top_topology_WORD		word3
304076a95d75SJames Smart #define LPFC_TOPOLOGY_PT_PT 0x01	/* Topology is pt-pt / pt-fabric */
304176a95d75SJames Smart #define LPFC_TOPOLOGY_LOOP  0x02	/* Topology is FC-AL */
304276a95d75SJames Smart #define LPFC_TOPOLOGY_MM    0x05	/* maint mode zephtr to menlo */
3043dea3101eS 	/* store the LILP AL_PA position map into */
3044dea3101eS 	struct ulp_bde64 lilpBde64;
304576a95d75SJames Smart #define LPFC_ALPA_MAP_SIZE	128
304676a95d75SJames Smart 	uint32_t word7;
304776a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_SHIFT		31
304876a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_MASK		0x00000001
304976a95d75SJames Smart #define lpfc_mbx_read_top_ld_lu_WORD		word7
305076a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_SHIFT		30
305176a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_MASK		0x00000001
305276a95d75SJames Smart #define lpfc_mbx_read_top_ld_tf_WORD		word7
305376a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_SHIFT	8
305476a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_MASK	0x000000FF
305576a95d75SJames Smart #define lpfc_mbx_read_top_ld_link_spd_WORD	word7
305676a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_SHIFT	4
305776a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_MASK	0x0000000F
305876a95d75SJames Smart #define lpfc_mbx_read_top_ld_nl_port_WORD	word7
305976a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_SHIFT		2
306076a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_MASK		0x00000003
306176a95d75SJames Smart #define lpfc_mbx_read_top_ld_tx_WORD		word7
306276a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_SHIFT		0
306376a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_MASK		0x00000003
306476a95d75SJames Smart #define lpfc_mbx_read_top_ld_rx_WORD		word7
306576a95d75SJames Smart 	uint32_t word8;
306676a95d75SJames Smart #define lpfc_mbx_read_top_lu_SHIFT		31
306776a95d75SJames Smart #define lpfc_mbx_read_top_lu_MASK		0x00000001
306876a95d75SJames Smart #define lpfc_mbx_read_top_lu_WORD		word8
306976a95d75SJames Smart #define lpfc_mbx_read_top_tf_SHIFT		30
307076a95d75SJames Smart #define lpfc_mbx_read_top_tf_MASK		0x00000001
307176a95d75SJames Smart #define lpfc_mbx_read_top_tf_WORD		word8
307276a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_SHIFT	8
307376a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_MASK		0x000000FF
307476a95d75SJames Smart #define lpfc_mbx_read_top_link_spd_WORD		word8
307576a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_SHIFT		4
307676a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_MASK		0x0000000F
307776a95d75SJames Smart #define lpfc_mbx_read_top_nl_port_WORD		word8
307876a95d75SJames Smart #define lpfc_mbx_read_top_tx_SHIFT		2
307976a95d75SJames Smart #define lpfc_mbx_read_top_tx_MASK		0x00000003
308076a95d75SJames Smart #define lpfc_mbx_read_top_tx_WORD		word8
308176a95d75SJames Smart #define lpfc_mbx_read_top_rx_SHIFT		0
308276a95d75SJames Smart #define lpfc_mbx_read_top_rx_MASK		0x00000003
308376a95d75SJames Smart #define lpfc_mbx_read_top_rx_WORD		word8
308476a95d75SJames Smart #define LPFC_LINK_SPEED_UNKNOWN	0x0
308576a95d75SJames Smart #define LPFC_LINK_SPEED_1GHZ	0x04
308676a95d75SJames Smart #define LPFC_LINK_SPEED_2GHZ	0x08
308776a95d75SJames Smart #define LPFC_LINK_SPEED_4GHZ	0x10
308876a95d75SJames Smart #define LPFC_LINK_SPEED_8GHZ	0x20
308976a95d75SJames Smart #define LPFC_LINK_SPEED_10GHZ	0x40
309076a95d75SJames Smart #define LPFC_LINK_SPEED_16GHZ	0x80
3091d38dd52cSJames Smart #define LPFC_LINK_SPEED_32GHZ	0x90
3092fbd8a6baSJames Smart #define LPFC_LINK_SPEED_64GHZ	0xA0
3093fbd8a6baSJames Smart #define LPFC_LINK_SPEED_128GHZ	0xB0
3094fbd8a6baSJames Smart #define LPFC_LINK_SPEED_256GHZ	0xC0
309576a95d75SJames Smart };
3096dea3101eS 
3097dea3101eS /* Structure for MB Command CLEAR_LA (22) */
3098dea3101eS 
3099dea3101eS typedef struct {
3100dea3101eS 	uint32_t eventTag;	/* Event tag */
3101dea3101eS 	uint32_t rsvd1;
3102dea3101eS } CLEAR_LA_VAR;
3103dea3101eS 
3104dea3101eS /* Structure for MB Command DUMP */
3105dea3101eS 
3106dea3101eS typedef struct {
3107dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3108dea3101eS 	uint32_t rsvd:25;
3109dea3101eS 	uint32_t ra:1;
3110dea3101eS 	uint32_t co:1;
3111dea3101eS 	uint32_t cv:1;
3112dea3101eS 	uint32_t type:4;
3113dea3101eS 	uint32_t entry_index:16;
3114dea3101eS 	uint32_t region_id:16;
3115dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3116dea3101eS 	uint32_t type:4;
3117dea3101eS 	uint32_t cv:1;
3118dea3101eS 	uint32_t co:1;
3119dea3101eS 	uint32_t ra:1;
3120dea3101eS 	uint32_t rsvd:25;
3121dea3101eS 	uint32_t region_id:16;
3122dea3101eS 	uint32_t entry_index:16;
3123dea3101eS #endif
3124dea3101eS 
3125da0436e9SJames Smart 	uint32_t sli4_length;
3126dea3101eS 	uint32_t word_cnt;
3127dea3101eS 	uint32_t resp_offset;
3128dea3101eS } DUMP_VAR;
3129dea3101eS 
3130dea3101eS #define  DMP_MEM_REG             0x1
3131dea3101eS #define  DMP_NV_PARAMS           0x2
31323ef6d24cSJames Smart #define  DMP_LMSD                0x3 /* Link Module Serial Data */
31333ef6d24cSJames Smart #define  DMP_WELL_KNOWN          0x4
3134dea3101eS 
3135dea3101eS #define  DMP_REGION_VPD          0xe
3136dea3101eS #define  DMP_VPD_SIZE            0x400  /* maximum amount of VPD */
3137dea3101eS #define  DMP_RSP_OFFSET          0x14   /* word 5 contains first word of rsp */
3138dea3101eS #define  DMP_RSP_SIZE            0x6C   /* maximum of 27 words of rsp data */
3139dea3101eS 
3140da0436e9SJames Smart #define  DMP_REGION_VPORT	 0x16   /* VPort info region */
3141da0436e9SJames Smart #define  DMP_VPORT_REGION_SIZE	 0x200
3142da0436e9SJames Smart #define  DMP_MBOX_OFFSET_WORD	 0x5
3143da0436e9SJames Smart 
3144a0c87cbdSJames Smart #define  DMP_REGION_23		 0x17   /* fcoe param  and port state region */
3145a0c87cbdSJames Smart #define  DMP_RGN23_SIZE		 0x400
3146da0436e9SJames Smart 
314797207482SJames Smart #define  WAKE_UP_PARMS_REGION_ID    4
314897207482SJames Smart #define  WAKE_UP_PARMS_WORD_SIZE   15
314997207482SJames Smart 
3150da0436e9SJames Smart struct vport_rec {
3151da0436e9SJames Smart 	uint8_t wwpn[8];
3152da0436e9SJames Smart 	uint8_t wwnn[8];
3153da0436e9SJames Smart };
3154da0436e9SJames Smart 
3155da0436e9SJames Smart #define VPORT_INFO_SIG 0x32324752
3156da0436e9SJames Smart #define VPORT_INFO_REV_MASK 0xff
3157da0436e9SJames Smart #define VPORT_INFO_REV 0x1
3158da0436e9SJames Smart #define MAX_STATIC_VPORT_COUNT 16
3159da0436e9SJames Smart struct static_vport_info {
3160da0436e9SJames Smart 	uint32_t		signature;
3161da0436e9SJames Smart 	uint32_t		rev;
3162da0436e9SJames Smart 	struct vport_rec	vport_list[MAX_STATIC_VPORT_COUNT];
3163da0436e9SJames Smart 	uint32_t		resvd[66];
3164da0436e9SJames Smart };
3165da0436e9SJames Smart 
316697207482SJames Smart /* Option rom version structure */
316797207482SJames Smart struct prog_id {
316897207482SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
316997207482SJames Smart 	uint8_t  type;
317097207482SJames Smart 	uint8_t  id;
317197207482SJames Smart 	uint32_t ver:4;  /* Major Version */
317297207482SJames Smart 	uint32_t rev:4;  /* Revision */
317397207482SJames Smart 	uint32_t lev:2;  /* Level */
317497207482SJames Smart 	uint32_t dist:2; /* Dist Type */
317597207482SJames Smart 	uint32_t num:4;  /* number after dist type */
317697207482SJames Smart #else /*  __LITTLE_ENDIAN_BITFIELD */
317797207482SJames Smart 	uint32_t num:4;  /* number after dist type */
317897207482SJames Smart 	uint32_t dist:2; /* Dist Type */
317997207482SJames Smart 	uint32_t lev:2;  /* Level */
318097207482SJames Smart 	uint32_t rev:4;  /* Revision */
318197207482SJames Smart 	uint32_t ver:4;  /* Major Version */
318297207482SJames Smart 	uint8_t  id;
318397207482SJames Smart 	uint8_t  type;
318497207482SJames Smart #endif
318597207482SJames Smart };
318697207482SJames Smart 
3187d7c255b2SJames Smart /* Structure for MB Command UPDATE_CFG (0x1B) */
3188d7c255b2SJames Smart 
3189d7c255b2SJames Smart struct update_cfg_var {
3190d7c255b2SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3191d7c255b2SJames Smart 	uint32_t rsvd2:16;
3192d7c255b2SJames Smart 	uint32_t type:8;
3193d7c255b2SJames Smart 	uint32_t rsvd:1;
3194d7c255b2SJames Smart 	uint32_t ra:1;
3195d7c255b2SJames Smart 	uint32_t co:1;
3196d7c255b2SJames Smart 	uint32_t cv:1;
3197d7c255b2SJames Smart 	uint32_t req:4;
3198d7c255b2SJames Smart 	uint32_t entry_length:16;
3199d7c255b2SJames Smart 	uint32_t region_id:16;
3200d7c255b2SJames Smart #else  /*  __LITTLE_ENDIAN_BITFIELD */
3201d7c255b2SJames Smart 	uint32_t req:4;
3202d7c255b2SJames Smart 	uint32_t cv:1;
3203d7c255b2SJames Smart 	uint32_t co:1;
3204d7c255b2SJames Smart 	uint32_t ra:1;
3205d7c255b2SJames Smart 	uint32_t rsvd:1;
3206d7c255b2SJames Smart 	uint32_t type:8;
3207d7c255b2SJames Smart 	uint32_t rsvd2:16;
3208d7c255b2SJames Smart 	uint32_t region_id:16;
3209d7c255b2SJames Smart 	uint32_t entry_length:16;
3210d7c255b2SJames Smart #endif
3211d7c255b2SJames Smart 
3212d7c255b2SJames Smart 	uint32_t resp_info;
3213d7c255b2SJames Smart 	uint32_t byte_cnt;
3214d7c255b2SJames Smart 	uint32_t data_offset;
3215d7c255b2SJames Smart };
3216d7c255b2SJames Smart 
3217ed957684SJames Smart struct hbq_mask {
3218ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3219ed957684SJames Smart 	uint8_t tmatch;
3220ed957684SJames Smart 	uint8_t tmask;
3221ed957684SJames Smart 	uint8_t rctlmatch;
3222ed957684SJames Smart 	uint8_t rctlmask;
3223ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3224ed957684SJames Smart 	uint8_t rctlmask;
3225ed957684SJames Smart 	uint8_t rctlmatch;
3226ed957684SJames Smart 	uint8_t tmask;
3227ed957684SJames Smart 	uint8_t tmatch;
3228ed957684SJames Smart #endif
3229ed957684SJames Smart };
3230ed957684SJames Smart 
3231ed957684SJames Smart 
3232ed957684SJames Smart /* Structure for MB Command CONFIG_HBQ (7c) */
3233ed957684SJames Smart 
3234ed957684SJames Smart struct config_hbq_var {
3235ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3236ed957684SJames Smart 	uint32_t rsvd1      :7;
3237ed957684SJames Smart 	uint32_t recvNotify :1;     /* Receive Notification */
3238ed957684SJames Smart 	uint32_t numMask    :8;     /* # Mask Entries       */
3239ed957684SJames Smart 	uint32_t profile    :8;     /* Selection Profile    */
3240ed957684SJames Smart 	uint32_t rsvd2      :8;
3241ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3242ed957684SJames Smart 	uint32_t rsvd2      :8;
3243ed957684SJames Smart 	uint32_t profile    :8;     /* Selection Profile    */
3244ed957684SJames Smart 	uint32_t numMask    :8;     /* # Mask Entries       */
3245ed957684SJames Smart 	uint32_t recvNotify :1;     /* Receive Notification */
3246ed957684SJames Smart 	uint32_t rsvd1      :7;
3247ed957684SJames Smart #endif
3248ed957684SJames Smart 
3249ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3250ed957684SJames Smart 	uint32_t hbqId      :16;
3251ed957684SJames Smart 	uint32_t rsvd3      :12;
3252ed957684SJames Smart 	uint32_t ringMask   :4;
3253ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3254ed957684SJames Smart 	uint32_t ringMask   :4;
3255ed957684SJames Smart 	uint32_t rsvd3      :12;
3256ed957684SJames Smart 	uint32_t hbqId      :16;
3257ed957684SJames Smart #endif
3258ed957684SJames Smart 
3259ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3260ed957684SJames Smart 	uint32_t entry_count :16;
3261ed957684SJames Smart 	uint32_t rsvd4        :8;
3262ed957684SJames Smart 	uint32_t headerLen    :8;
3263ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3264ed957684SJames Smart 	uint32_t headerLen    :8;
3265ed957684SJames Smart 	uint32_t rsvd4        :8;
3266ed957684SJames Smart 	uint32_t entry_count :16;
3267ed957684SJames Smart #endif
3268ed957684SJames Smart 
3269ed957684SJames Smart 	uint32_t hbqaddrLow;
3270ed957684SJames Smart 	uint32_t hbqaddrHigh;
3271ed957684SJames Smart 
3272ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3273ed957684SJames Smart 	uint32_t rsvd5      :31;
3274ed957684SJames Smart 	uint32_t logEntry   :1;
3275ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3276ed957684SJames Smart 	uint32_t logEntry   :1;
3277ed957684SJames Smart 	uint32_t rsvd5      :31;
3278ed957684SJames Smart #endif
3279ed957684SJames Smart 
3280ed957684SJames Smart 	uint32_t rsvd6;    /* w7 */
3281ed957684SJames Smart 	uint32_t rsvd7;    /* w8 */
3282ed957684SJames Smart 	uint32_t rsvd8;    /* w9 */
3283ed957684SJames Smart 
3284ed957684SJames Smart 	struct hbq_mask hbqMasks[6];
3285ed957684SJames Smart 
3286ed957684SJames Smart 
3287ed957684SJames Smart 	union {
3288ed957684SJames Smart 		uint32_t allprofiles[12];
3289ed957684SJames Smart 
3290ed957684SJames Smart 		struct {
3291ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3292ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3293ed957684SJames Smart 				uint32_t	maxlen		:16;
3294ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3295ed957684SJames Smart 				uint32_t	maxlen		:16;
3296ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3297ed957684SJames Smart 			#endif
3298ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3299ed957684SJames Smart 				uint32_t	rsvd1		:28;
3300ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3301ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3302ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3303ed957684SJames Smart 				uint32_t	rsvd1		:28;
3304ed957684SJames Smart 			#endif
3305ed957684SJames Smart 			uint32_t rsvd[10];
3306ed957684SJames Smart 		} profile2;
3307ed957684SJames Smart 
3308ed957684SJames Smart 		struct {
3309ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3310ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3311ed957684SJames Smart 				uint32_t	maxlen		:16;
3312ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3313ed957684SJames Smart 				uint32_t	maxlen		:16;
3314ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3315ed957684SJames Smart 			#endif
3316ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3317ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
3318ed957684SJames Smart 				uint32_t	rsvd1		:12;
3319ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3320ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3321ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3322ed957684SJames Smart 				uint32_t	rsvd1		:12;
3323ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
3324ed957684SJames Smart 			#endif
3325ed957684SJames Smart 			uint32_t cmdmatch[8];
3326ed957684SJames Smart 
3327ed957684SJames Smart 			uint32_t rsvd[2];
3328ed957684SJames Smart 		} profile3;
3329ed957684SJames Smart 
3330ed957684SJames Smart 		struct {
3331ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3332ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3333ed957684SJames Smart 				uint32_t	maxlen		:16;
3334ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3335ed957684SJames Smart 				uint32_t	maxlen		:16;
3336ed957684SJames Smart 				uint32_t	seqlenoff	:16;
3337ed957684SJames Smart 			#endif
3338ed957684SJames Smart 			#ifdef __BIG_ENDIAN_BITFIELD
3339ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
3340ed957684SJames Smart 				uint32_t	rsvd1		:12;
3341ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3342ed957684SJames Smart 			#else	/*  __LITTLE_ENDIAN */
3343ed957684SJames Smart 				uint32_t	seqlenbcnt	:4;
3344ed957684SJames Smart 				uint32_t	rsvd1		:12;
3345ed957684SJames Smart 				uint32_t	cmdcodeoff	:28;
3346ed957684SJames Smart 			#endif
3347ed957684SJames Smart 			uint32_t cmdmatch[8];
3348ed957684SJames Smart 
3349ed957684SJames Smart 			uint32_t rsvd[2];
3350ed957684SJames Smart 		} profile5;
3351ed957684SJames Smart 
3352ed957684SJames Smart 	} profiles;
3353ed957684SJames Smart 
3354ed957684SJames Smart };
3355ed957684SJames Smart 
3356ed957684SJames Smart 
3357dea3101eS 
33582e0fef85SJames Smart /* Structure for MB Command CONFIG_PORT (0x88) */
3359dea3101eS typedef struct {
3360ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3361ed957684SJames Smart 	uint32_t cBE       :  1;
3362ed957684SJames Smart 	uint32_t cET       :  1;
3363ed957684SJames Smart 	uint32_t cHpcb     :  1;
3364ed957684SJames Smart 	uint32_t cMA       :  1;
3365ed957684SJames Smart 	uint32_t sli_mode  :  4;
3366ed957684SJames Smart 	uint32_t pcbLen    : 24;       /* bit 23:0  of memory based port
3367ed957684SJames Smart 					* config block */
3368ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3369ed957684SJames Smart 	uint32_t pcbLen    : 24;       /* bit 23:0  of memory based port
3370ed957684SJames Smart 					* config block */
3371ed957684SJames Smart 	uint32_t sli_mode  :  4;
3372ed957684SJames Smart 	uint32_t cMA       :  1;
3373ed957684SJames Smart 	uint32_t cHpcb     :  1;
3374ed957684SJames Smart 	uint32_t cET       :  1;
3375ed957684SJames Smart 	uint32_t cBE       :  1;
3376ed957684SJames Smart #endif
3377ed957684SJames Smart 
3378dea3101eS 	uint32_t pcbLow;       /* bit 31:0  of memory based port config block */
3379dea3101eS 	uint32_t pcbHigh;      /* bit 63:32 of memory based port config block */
338097207482SJames Smart 	uint32_t hbainit[5];
338197207482SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
338297207482SJames Smart 	uint32_t hps	   :  1; /* bit 31 word9 Host Pointer in slim */
338397207482SJames Smart 	uint32_t rsvd	   : 31; /* least significant 31 bits of word 9 */
338497207482SJames Smart #else   /*  __LITTLE_ENDIAN */
338597207482SJames Smart 	uint32_t rsvd      : 31; /* least significant 31 bits of word 9 */
338697207482SJames Smart 	uint32_t hps	   :  1; /* bit 31 word9 Host Pointer in slim */
338797207482SJames Smart #endif
3388ed957684SJames Smart 
3389ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
33900e75461aSJames Smart 	uint32_t rsvd1     : 20;  /* Reserved                             */
3391cb69f7deSJames Smart 	uint32_t casabt    :  1;  /* Configure async abts status notice   */
3392cb69f7deSJames Smart 	uint32_t rsvd2     :  2;  /* Reserved                             */
339381301a9bSJames Smart 	uint32_t cbg       :  1;  /* Configure BlockGuard                 */
3394ed957684SJames Smart 	uint32_t cmv       :  1;  /* Configure Max VPIs                   */
3395ed957684SJames Smart 	uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
3396ed957684SJames Smart 	uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
3397ed957684SJames Smart 	uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
3398ed957684SJames Smart 	uint32_t cinb      :  1;  /* Enable Interrupt Notification Block  */
3399ed957684SJames Smart 	uint32_t cerbm	   :  1;  /* Configure Enhanced Receive Buf Mgmt  */
3400ed957684SJames Smart 	uint32_t cmx	   :  1;  /* Configure Max XRIs                   */
3401ed957684SJames Smart 	uint32_t cmr	   :  1;  /* Configure Max RPIs                   */
3402ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3403ed957684SJames Smart 	uint32_t cmr	   :  1;  /* Configure Max RPIs                   */
3404ed957684SJames Smart 	uint32_t cmx	   :  1;  /* Configure Max XRIs                   */
3405ed957684SJames Smart 	uint32_t cerbm	   :  1;  /* Configure Enhanced Receive Buf Mgmt  */
3406ed957684SJames Smart 	uint32_t cinb      :  1;  /* Enable Interrupt Notification Block  */
3407ed957684SJames Smart 	uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
3408ed957684SJames Smart 	uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
3409ed957684SJames Smart 	uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
3410ed957684SJames Smart 	uint32_t cmv	   :  1;  /* Configure Max VPIs                   */
341181301a9bSJames Smart 	uint32_t cbg       :  1;  /* Configure BlockGuard                 */
3412cb69f7deSJames Smart 	uint32_t rsvd2     :  2;  /* Reserved                             */
3413cb69f7deSJames Smart 	uint32_t casabt    :  1;  /* Configure async abts status notice   */
34140e75461aSJames Smart 	uint32_t rsvd1     : 20;  /* Reserved                             */
3415ed957684SJames Smart #endif
3416ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
34170e75461aSJames Smart 	uint32_t rsvd3     : 20;  /* Reserved                             */
3418cb69f7deSJames Smart 	uint32_t gasabt    :  1;  /* Grant async abts status notice       */
3419cb69f7deSJames Smart 	uint32_t rsvd4     :  2;  /* Reserved                             */
342081301a9bSJames Smart 	uint32_t gbg       :  1;  /* Grant BlockGuard                     */
3421ed957684SJames Smart 	uint32_t gmv	   :  1;  /* Grant Max VPIs                       */
3422ed957684SJames Smart 	uint32_t gcrp	   :  1;  /* Grant Command Ring Polling           */
3423ed957684SJames Smart 	uint32_t gsah	   :  1;  /* Grant Synchronous Abort Handling     */
3424ed957684SJames Smart 	uint32_t ghbs	   :  1;  /* Grant Host Backing Store             */
3425ed957684SJames Smart 	uint32_t ginb	   :  1;  /* Grant Interrupt Notification Block   */
3426ed957684SJames Smart 	uint32_t gerbm	   :  1;  /* Grant ERBM Request                   */
3427ed957684SJames Smart 	uint32_t gmx	   :  1;  /* Grant Max XRIs                       */
3428ed957684SJames Smart 	uint32_t gmr	   :  1;  /* Grant Max RPIs                       */
3429ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3430ed957684SJames Smart 	uint32_t gmr	   :  1;  /* Grant Max RPIs                       */
3431ed957684SJames Smart 	uint32_t gmx	   :  1;  /* Grant Max XRIs                       */
3432ed957684SJames Smart 	uint32_t gerbm	   :  1;  /* Grant ERBM Request                   */
3433ed957684SJames Smart 	uint32_t ginb	   :  1;  /* Grant Interrupt Notification Block   */
3434ed957684SJames Smart 	uint32_t ghbs	   :  1;  /* Grant Host Backing Store             */
3435ed957684SJames Smart 	uint32_t gsah	   :  1;  /* Grant Synchronous Abort Handling     */
3436ed957684SJames Smart 	uint32_t gcrp	   :  1;  /* Grant Command Ring Polling           */
3437ed957684SJames Smart 	uint32_t gmv	   :  1;  /* Grant Max VPIs                       */
343881301a9bSJames Smart 	uint32_t gbg       :  1;  /* Grant BlockGuard                     */
3439cb69f7deSJames Smart 	uint32_t rsvd4     :  2;  /* Reserved                             */
3440cb69f7deSJames Smart 	uint32_t gasabt    :  1;  /* Grant async abts status notice       */
34410e75461aSJames Smart 	uint32_t rsvd3     : 20;  /* Reserved                             */
3442ed957684SJames Smart #endif
3443ed957684SJames Smart 
3444ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3445ed957684SJames Smart 	uint32_t max_rpi   : 16;  /* Max RPIs Port should configure       */
3446ed957684SJames Smart 	uint32_t max_xri   : 16;  /* Max XRIs Port should configure       */
3447ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3448ed957684SJames Smart 	uint32_t max_xri   : 16;  /* Max XRIs Port should configure       */
3449ed957684SJames Smart 	uint32_t max_rpi   : 16;  /* Max RPIs Port should configure       */
3450ed957684SJames Smart #endif
3451ed957684SJames Smart 
3452ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
3453ed957684SJames Smart 	uint32_t max_hbq   : 16;  /* Max HBQs Host expect to configure    */
3454da0436e9SJames Smart 	uint32_t rsvd5     : 16;  /* Max HBQs Host expect to configure    */
3455ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3456da0436e9SJames Smart 	uint32_t rsvd5     : 16;  /* Max HBQs Host expect to configure    */
3457ed957684SJames Smart 	uint32_t max_hbq   : 16;  /* Max HBQs Host expect to configure    */
3458ed957684SJames Smart #endif
3459ed957684SJames Smart 
3460da0436e9SJames Smart 	uint32_t rsvd6;           /* Reserved                             */
3461ed957684SJames Smart 
3462ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
34630e75461aSJames Smart 	uint32_t rsvd7      : 16;
3464ed957684SJames Smart 	uint32_t max_vpi    : 16;  /* Max number of virt N-Ports           */
3465ed957684SJames Smart #else	/*  __LITTLE_ENDIAN */
3466ed957684SJames Smart 	uint32_t max_vpi    : 16;  /* Max number of virt N-Ports           */
34670e75461aSJames Smart 	uint32_t rsvd7      : 16;
3468ed957684SJames Smart #endif
3469ed957684SJames Smart 
3470dea3101eS } CONFIG_PORT_VAR;
3471dea3101eS 
34729399627fSJames Smart /* Structure for MB Command CONFIG_MSI (0x30) */
34739399627fSJames Smart struct config_msi_var {
34749399627fSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
34759399627fSJames Smart 	uint32_t dfltMsgNum:8;	/* Default message number            */
34769399627fSJames Smart 	uint32_t rsvd1:11;	/* Reserved                          */
34779399627fSJames Smart 	uint32_t NID:5;		/* Number of secondary attention IDs */
34789399627fSJames Smart 	uint32_t rsvd2:5;	/* Reserved                          */
34799399627fSJames Smart 	uint32_t dfltPresent:1;	/* Default message number present    */
34809399627fSJames Smart 	uint32_t addFlag:1;	/* Add association flag              */
34819399627fSJames Smart 	uint32_t reportFlag:1;	/* Report association flag           */
34829399627fSJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
34839399627fSJames Smart 	uint32_t reportFlag:1;	/* Report association flag           */
34849399627fSJames Smart 	uint32_t addFlag:1;	/* Add association flag              */
34859399627fSJames Smart 	uint32_t dfltPresent:1;	/* Default message number present    */
34869399627fSJames Smart 	uint32_t rsvd2:5;	/* Reserved                          */
34879399627fSJames Smart 	uint32_t NID:5;		/* Number of secondary attention IDs */
34889399627fSJames Smart 	uint32_t rsvd1:11;	/* Reserved                          */
34899399627fSJames Smart 	uint32_t dfltMsgNum:8;	/* Default message number            */
34909399627fSJames Smart #endif
34919399627fSJames Smart 	uint32_t attentionConditions[2];
34929399627fSJames Smart 	uint8_t  attentionId[16];
34939399627fSJames Smart 	uint8_t  messageNumberByHA[64];
34949399627fSJames Smart 	uint8_t  messageNumberByID[16];
34959399627fSJames Smart 	uint32_t autoClearHA[2];
34969399627fSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
34979399627fSJames Smart 	uint32_t rsvd3:16;
34989399627fSJames Smart 	uint32_t autoClearID:16;
34999399627fSJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
35009399627fSJames Smart 	uint32_t autoClearID:16;
35019399627fSJames Smart 	uint32_t rsvd3:16;
35029399627fSJames Smart #endif
35039399627fSJames Smart 	uint32_t rsvd4;
35049399627fSJames Smart };
35059399627fSJames Smart 
3506dea3101eS /* SLI-2 Port Control Block */
3507dea3101eS 
3508dea3101eS /* SLIM POINTER */
3509dea3101eS #define SLIMOFF 0x30		/* WORD */
3510dea3101eS 
3511dea3101eS typedef struct _SLI2_RDSC {
3512dea3101eS 	uint32_t cmdEntries;
3513dea3101eS 	uint32_t cmdAddrLow;
3514dea3101eS 	uint32_t cmdAddrHigh;
3515dea3101eS 
3516dea3101eS 	uint32_t rspEntries;
3517dea3101eS 	uint32_t rspAddrLow;
3518dea3101eS 	uint32_t rspAddrHigh;
3519dea3101eS } SLI2_RDSC;
3520dea3101eS 
3521dea3101eS typedef struct _PCB {
3522dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3523dea3101eS 	uint32_t type:8;
3524497888cfSPhil Carmody #define TYPE_NATIVE_SLI2       0x01
3525dea3101eS 	uint32_t feature:8;
3526497888cfSPhil Carmody #define FEATURE_INITIAL_SLI2   0x01
3527dea3101eS 	uint32_t rsvd:12;
3528dea3101eS 	uint32_t maxRing:4;
3529dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3530dea3101eS 	uint32_t maxRing:4;
3531dea3101eS 	uint32_t rsvd:12;
3532dea3101eS 	uint32_t feature:8;
3533497888cfSPhil Carmody #define FEATURE_INITIAL_SLI2   0x01
3534dea3101eS 	uint32_t type:8;
3535497888cfSPhil Carmody #define TYPE_NATIVE_SLI2       0x01
3536dea3101eS #endif
3537dea3101eS 
3538dea3101eS 	uint32_t mailBoxSize;
3539dea3101eS 	uint32_t mbAddrLow;
3540dea3101eS 	uint32_t mbAddrHigh;
3541dea3101eS 
3542dea3101eS 	uint32_t hgpAddrLow;
3543dea3101eS 	uint32_t hgpAddrHigh;
3544dea3101eS 
3545dea3101eS 	uint32_t pgpAddrLow;
3546dea3101eS 	uint32_t pgpAddrHigh;
35472a76a283SJames Smart 	SLI2_RDSC rdsc[MAX_SLI3_RINGS];
3548dea3101eS } PCB_t;
3549dea3101eS 
3550dea3101eS /* NEW_FEATURE */
3551dea3101eS typedef struct {
3552dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3553dea3101eS 	uint32_t rsvd0:27;
3554dea3101eS 	uint32_t discardFarp:1;
3555dea3101eS 	uint32_t IPEnable:1;
3556dea3101eS 	uint32_t nodeName:1;
3557dea3101eS 	uint32_t portName:1;
3558dea3101eS 	uint32_t filterEnable:1;
3559dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3560dea3101eS 	uint32_t filterEnable:1;
3561dea3101eS 	uint32_t portName:1;
3562dea3101eS 	uint32_t nodeName:1;
3563dea3101eS 	uint32_t IPEnable:1;
3564dea3101eS 	uint32_t discardFarp:1;
3565dea3101eS 	uint32_t rsvd:27;
3566dea3101eS #endif
3567dea3101eS 
3568dea3101eS 	uint8_t portname[8];	/* Used to be struct lpfc_name */
3569dea3101eS 	uint8_t nodename[8];
3570dea3101eS 	uint32_t rsvd1;
3571dea3101eS 	uint32_t rsvd2;
3572dea3101eS 	uint32_t rsvd3;
3573dea3101eS 	uint32_t IPAddress;
3574dea3101eS } CONFIG_FARP_VAR;
3575dea3101eS 
357657127f15SJames Smart /* Structure for MB Command MBX_ASYNCEVT_ENABLE (0x33) */
357757127f15SJames Smart 
357857127f15SJames Smart typedef struct {
357957127f15SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
358057127f15SJames Smart 	uint32_t rsvd:30;
358157127f15SJames Smart 	uint32_t ring:2;	/* Ring for ASYNC_EVENT iocb Bits 0-1*/
358257127f15SJames Smart #else /*  __LITTLE_ENDIAN */
358357127f15SJames Smart 	uint32_t ring:2;	/* Ring for ASYNC_EVENT iocb Bits 0-1*/
358457127f15SJames Smart 	uint32_t rsvd:30;
358557127f15SJames Smart #endif
358657127f15SJames Smart } ASYNCEVT_ENABLE_VAR;
358757127f15SJames Smart 
3588dea3101eS /* Union of all Mailbox Command types */
3589dea3101eS #define MAILBOX_CMD_WSIZE	32
3590dea3101eS #define MAILBOX_CMD_SIZE	(MAILBOX_CMD_WSIZE * sizeof(uint32_t))
35917a470277SJames Smart /* ext_wsize times 4 bytes should not be greater than max xmit size */
35927a470277SJames Smart #define MAILBOX_EXT_WSIZE	512
35937a470277SJames Smart #define MAILBOX_EXT_SIZE	(MAILBOX_EXT_WSIZE * sizeof(uint32_t))
35947a470277SJames Smart #define MAILBOX_HBA_EXT_OFFSET  0x100
35957a470277SJames Smart /* max mbox xmit size is a page size for sysfs IO operations */
3596c0c11512SJames Smart #define MAILBOX_SYSFS_MAX	4096
3597dea3101eS 
3598dea3101eS typedef union {
3599ed957684SJames Smart 	uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/
3600ed957684SJames Smart 						    * feature/max ring number
3601ed957684SJames Smart 						    */
3602dea3101eS 	LOAD_SM_VAR varLdSM;		/* cmd =  1 (LOAD_SM)        */
3603dea3101eS 	READ_NV_VAR varRDnvp;		/* cmd =  2 (READ_NVPARMS)   */
3604dea3101eS 	WRITE_NV_VAR varWTnvp;		/* cmd =  3 (WRITE_NVPARMS)  */
3605dea3101eS 	BIU_DIAG_VAR varBIUdiag;	/* cmd =  4 (RUN_BIU_DIAG)   */
3606dea3101eS 	INIT_LINK_VAR varInitLnk;	/* cmd =  5 (INIT_LINK)      */
3607dea3101eS 	DOWN_LINK_VAR varDwnLnk;	/* cmd =  6 (DOWN_LINK)      */
3608dea3101eS 	CONFIG_LINK varCfgLnk;		/* cmd =  7 (CONFIG_LINK)    */
3609dea3101eS 	PART_SLIM_VAR varSlim;		/* cmd =  8 (PART_SLIM)      */
3610dea3101eS 	CONFIG_RING_VAR varCfgRing;	/* cmd =  9 (CONFIG_RING)    */
3611dea3101eS 	RESET_RING_VAR varRstRing;	/* cmd = 10 (RESET_RING)     */
3612dea3101eS 	READ_CONFIG_VAR varRdConfig;	/* cmd = 11 (READ_CONFIG)    */
3613dea3101eS 	READ_RCONF_VAR varRdRConfig;	/* cmd = 12 (READ_RCONFIG)   */
3614dea3101eS 	READ_SPARM_VAR varRdSparm;	/* cmd = 13 (READ_SPARM(64)) */
3615dea3101eS 	READ_STATUS_VAR varRdStatus;	/* cmd = 14 (READ_STATUS)    */
3616dea3101eS 	READ_RPI_VAR varRdRPI;		/* cmd = 15 (READ_RPI(64))   */
3617dea3101eS 	READ_XRI_VAR varRdXRI;		/* cmd = 16 (READ_XRI)       */
3618dea3101eS 	READ_REV_VAR varRdRev;		/* cmd = 17 (READ_REV)       */
3619dea3101eS 	READ_LNK_VAR varRdLnk;		/* cmd = 18 (READ_LNK_STAT)  */
3620dea3101eS 	REG_LOGIN_VAR varRegLogin;	/* cmd = 19 (REG_LOGIN(64))  */
3621dea3101eS 	UNREG_LOGIN_VAR varUnregLogin;	/* cmd = 20 (UNREG_LOGIN)    */
3622dea3101eS 	CLEAR_LA_VAR varClearLA;	/* cmd = 22 (CLEAR_LA)       */
3623dea3101eS 	DUMP_VAR varDmp;		/* Warm Start DUMP mbx cmd   */
3624dea3101eS 	UNREG_D_ID_VAR varUnregDID;	/* cmd = 0x23 (UNREG_D_ID)   */
3625ed957684SJames Smart 	CONFIG_FARP_VAR varCfgFarp;	/* cmd = 0x25 (CONFIG_FARP)
3626ed957684SJames Smart 					 * NEW_FEATURE
3627ed957684SJames Smart 					 */
3628ed957684SJames Smart 	struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ)  */
3629d7c255b2SJames Smart 	struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/
3630dea3101eS 	CONFIG_PORT_VAR varCfgPort;	/* cmd = 0x88 (CONFIG_PORT)  */
363176a95d75SJames Smart 	struct lpfc_mbx_read_top varReadTop; /* cmd = 0x95 (READ_TOPOLOGY) */
363292d7f7b0SJames Smart 	REG_VPI_VAR varRegVpi;		/* cmd = 0x96 (REG_VPI) */
363392d7f7b0SJames Smart 	UNREG_VPI_VAR varUnregVpi;	/* cmd = 0x97 (UNREG_VPI) */
363457127f15SJames Smart 	ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */
3635c7495937SJames Smart 	struct READ_EVENT_LOG_VAR varRdEventLog;	/* cmd = 0x38
3636c7495937SJames Smart 							 * (READ_EVENT_LOG)
3637c7495937SJames Smart 							 */
36389399627fSJames Smart 	struct config_msi_var varCfgMSI;/* cmd = x30 (CONFIG_MSI)     */
3639dea3101eS } MAILVARIANTS;
3640dea3101eS 
3641dea3101eS /*
3642dea3101eS  * SLI-2 specific structures
3643dea3101eS  */
3644dea3101eS 
36454cc2da1dSJames.Smart@Emulex.Com struct lpfc_hgp {
36464cc2da1dSJames.Smart@Emulex.Com 	__le32 cmdPutInx;
36474cc2da1dSJames.Smart@Emulex.Com 	__le32 rspGetInx;
36484cc2da1dSJames.Smart@Emulex.Com };
3649dea3101eS 
36504cc2da1dSJames.Smart@Emulex.Com struct lpfc_pgp {
36514cc2da1dSJames.Smart@Emulex.Com 	__le32 cmdGetInx;
36524cc2da1dSJames.Smart@Emulex.Com 	__le32 rspPutInx;
36534cc2da1dSJames.Smart@Emulex.Com };
3654dea3101eS 
3655ed957684SJames Smart struct sli2_desc {
3656dea3101eS 	uint32_t unused1[16];
36572a76a283SJames Smart 	struct lpfc_hgp host[MAX_SLI3_RINGS];
36582a76a283SJames Smart 	struct lpfc_pgp port[MAX_SLI3_RINGS];
3659ed957684SJames Smart };
3660ed957684SJames Smart 
3661ed957684SJames Smart struct sli3_desc {
36622a76a283SJames Smart 	struct lpfc_hgp host[MAX_SLI3_RINGS];
3663ed957684SJames Smart 	uint32_t reserved[8];
3664ed957684SJames Smart 	uint32_t hbq_put[16];
3665ed957684SJames Smart };
3666ed957684SJames Smart 
3667ed957684SJames Smart struct sli3_pgp {
36682a76a283SJames Smart 	struct lpfc_pgp port[MAX_SLI3_RINGS];
3669ed957684SJames Smart 	uint32_t hbq_get[16];
3670ed957684SJames Smart };
3671dea3101eS 
367234b02dcdSJames Smart union sli_var {
3673ed957684SJames Smart 	struct sli2_desc	s2;
3674ed957684SJames Smart 	struct sli3_desc	s3;
3675ed957684SJames Smart 	struct sli3_pgp		s3_pgp;
367634b02dcdSJames Smart };
3677dea3101eS 
3678dea3101eS typedef struct {
3679c167dd0bSKees Cook 	struct_group_tagged(MAILBOX_word0, bits,
3680c167dd0bSKees Cook 		union {
3681c167dd0bSKees Cook 			struct {
3682dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3683dea3101eS 				uint16_t mbxStatus;
3684dea3101eS 				uint8_t mbxCommand;
3685dea3101eS 				uint8_t mbxReserved:6;
3686dea3101eS 				uint8_t mbxHc:1;
3687dea3101eS 				uint8_t mbxOwner:1;	/* Low order bit first word */
3688dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3689dea3101eS 				uint8_t mbxOwner:1;	/* Low order bit first word */
3690dea3101eS 				uint8_t mbxHc:1;
3691dea3101eS 				uint8_t mbxReserved:6;
3692dea3101eS 				uint8_t mbxCommand;
3693dea3101eS 				uint16_t mbxStatus;
3694dea3101eS #endif
3695c167dd0bSKees Cook 			};
3696c167dd0bSKees Cook 			u32 word0;
3697c167dd0bSKees Cook 		};
3698c167dd0bSKees Cook 	);
3699dea3101eS 
3700dea3101eS 	MAILVARIANTS un;
370134b02dcdSJames Smart 	union sli_var us;
3702dea3101eS } MAILBOX_t;
3703dea3101eS 
3704dea3101eS /*
3705dea3101eS  *    Begin Structure Definitions for IOCB Commands
3706dea3101eS  */
3707dea3101eS 
3708dea3101eS typedef struct {
3709dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3710dea3101eS 	uint8_t statAction;
3711dea3101eS 	uint8_t statRsn;
3712dea3101eS 	uint8_t statBaExp;
3713dea3101eS 	uint8_t statLocalError;
3714dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3715dea3101eS 	uint8_t statLocalError;
3716dea3101eS 	uint8_t statBaExp;
3717dea3101eS 	uint8_t statRsn;
3718dea3101eS 	uint8_t statAction;
3719dea3101eS #endif
3720dea3101eS 	/* statRsn  P/F_RJT reason codes */
3721dea3101eS #define RJT_BAD_D_ID       0x01	/* Invalid D_ID field */
3722dea3101eS #define RJT_BAD_S_ID       0x02	/* Invalid S_ID field */
3723dea3101eS #define RJT_UNAVAIL_TEMP   0x03	/* N_Port unavailable temp. */
3724dea3101eS #define RJT_UNAVAIL_PERM   0x04	/* N_Port unavailable perm. */
3725dea3101eS #define RJT_UNSUP_CLASS    0x05	/* Class not supported */
3726dea3101eS #define RJT_DELIM_ERR      0x06	/* Delimiter usage error */
3727dea3101eS #define RJT_UNSUP_TYPE     0x07	/* Type not supported */
3728dea3101eS #define RJT_BAD_CONTROL    0x08	/* Invalid link conrtol */
3729dea3101eS #define RJT_BAD_RCTL       0x09	/* R_CTL invalid */
3730dea3101eS #define RJT_BAD_FCTL       0x0A	/* F_CTL invalid */
3731dea3101eS #define RJT_BAD_OXID       0x0B	/* OX_ID invalid */
3732dea3101eS #define RJT_BAD_RXID       0x0C	/* RX_ID invalid */
3733dea3101eS #define RJT_BAD_SEQID      0x0D	/* SEQ_ID invalid */
3734dea3101eS #define RJT_BAD_DFCTL      0x0E	/* DF_CTL invalid */
3735dea3101eS #define RJT_BAD_SEQCNT     0x0F	/* SEQ_CNT invalid */
3736dea3101eS #define RJT_BAD_PARM       0x10	/* Param. field invalid */
3737dea3101eS #define RJT_XCHG_ERR       0x11	/* Exchange error */
3738dea3101eS #define RJT_PROT_ERR       0x12	/* Protocol error */
3739dea3101eS #define RJT_BAD_LENGTH     0x13	/* Invalid Length */
3740dea3101eS #define RJT_UNEXPECTED_ACK 0x14	/* Unexpected ACK */
3741dea3101eS #define RJT_LOGIN_REQUIRED 0x16	/* Login required */
3742dea3101eS #define RJT_TOO_MANY_SEQ   0x17	/* Excessive sequences */
3743dea3101eS #define RJT_XCHG_NOT_STRT  0x18	/* Exchange not started */
3744dea3101eS #define RJT_UNSUP_SEC_HDR  0x19	/* Security hdr not supported */
3745dea3101eS #define RJT_UNAVAIL_PATH   0x1A	/* Fabric Path not available */
3746dea3101eS #define RJT_VENDOR_UNIQUE  0xFF	/* Vendor unique error */
3747dea3101eS 
3748dea3101eS #define IOERR_SUCCESS                 0x00	/* statLocalError */
3749dea3101eS #define IOERR_MISSING_CONTINUE        0x01
3750dea3101eS #define IOERR_SEQUENCE_TIMEOUT        0x02
3751dea3101eS #define IOERR_INTERNAL_ERROR          0x03
3752dea3101eS #define IOERR_INVALID_RPI             0x04
3753dea3101eS #define IOERR_NO_XRI                  0x05
3754dea3101eS #define IOERR_ILLEGAL_COMMAND         0x06
3755dea3101eS #define IOERR_XCHG_DROPPED            0x07
3756dea3101eS #define IOERR_ILLEGAL_FIELD           0x08
37572e81b1a3SJames Smart #define IOERR_RPI_SUSPENDED           0x09
3758dea3101eS #define IOERR_TOO_MANY_BUFFERS        0x0A
3759dea3101eS #define IOERR_RCV_BUFFER_WAITING      0x0B
3760dea3101eS #define IOERR_NO_CONNECTION           0x0C
3761dea3101eS #define IOERR_TX_DMA_FAILED           0x0D
3762dea3101eS #define IOERR_RX_DMA_FAILED           0x0E
3763dea3101eS #define IOERR_ILLEGAL_FRAME           0x0F
3764dea3101eS #define IOERR_EXTRA_DATA              0x10
3765dea3101eS #define IOERR_NO_RESOURCES            0x11
3766dea3101eS #define IOERR_RESERVED                0x12
3767dea3101eS #define IOERR_ILLEGAL_LENGTH          0x13
3768dea3101eS #define IOERR_UNSUPPORTED_FEATURE     0x14
3769dea3101eS #define IOERR_ABORT_IN_PROGRESS       0x15
3770dea3101eS #define IOERR_ABORT_REQUESTED         0x16
3771dea3101eS #define IOERR_RECEIVE_BUFFER_TIMEOUT  0x17
3772dea3101eS #define IOERR_LOOP_OPEN_FAILURE       0x18
3773dea3101eS #define IOERR_RING_RESET              0x19
3774dea3101eS #define IOERR_LINK_DOWN               0x1A
3775dea3101eS #define IOERR_CORRUPTED_DATA          0x1B
3776dea3101eS #define IOERR_CORRUPTED_RPI           0x1C
3777dea3101eS #define IOERR_OUT_OF_ORDER_DATA       0x1D
3778dea3101eS #define IOERR_OUT_OF_ORDER_ACK        0x1E
3779dea3101eS #define IOERR_DUP_FRAME               0x1F
3780dea3101eS #define IOERR_LINK_CONTROL_FRAME      0x20	/* ACK_N received */
3781dea3101eS #define IOERR_BAD_HOST_ADDRESS        0x21
3782dea3101eS #define IOERR_RCV_HDRBUF_WAITING      0x22
3783dea3101eS #define IOERR_MISSING_HDR_BUFFER      0x23
3784dea3101eS #define IOERR_MSEQ_CHAIN_CORRUPTED    0x24
3785dea3101eS #define IOERR_ABORTMULT_REQUESTED     0x25
3786dea3101eS #define IOERR_BUFFER_SHORTAGE         0x28
3787dea3101eS #define IOERR_DEFAULT                 0x29
3788dea3101eS #define IOERR_CNT                     0x2A
3789b92938b4SJames Smart #define IOERR_SLER_FAILURE            0x46
3790b92938b4SJames Smart #define IOERR_SLER_CMD_RCV_FAILURE    0x47
3791b92938b4SJames Smart #define IOERR_SLER_REC_RJT_ERR        0x48
3792b92938b4SJames Smart #define IOERR_SLER_REC_SRR_RETRY_ERR  0x49
3793b92938b4SJames Smart #define IOERR_SLER_SRR_RJT_ERR        0x4A
3794b92938b4SJames Smart #define IOERR_SLER_RRQ_RJT_ERR        0x4C
3795b92938b4SJames Smart #define IOERR_SLER_RRQ_RETRY_ERR      0x4D
3796b92938b4SJames Smart #define IOERR_SLER_ABTS_ERR           0x4E
3797ab56dc2eSJames Smart #define IOERR_ELXSEC_KEY_UNWRAP_ERROR		0xF0
3798ab56dc2eSJames Smart #define IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR	0xF1
3799ab56dc2eSJames Smart #define IOERR_ELXSEC_CRYPTO_ERROR		0xF2
3800ab56dc2eSJames Smart #define IOERR_ELXSEC_CRYPTO_COMPARE_ERROR	0xF3
3801dea3101eS #define IOERR_DRVR_MASK               0x100
3802dea3101eS #define IOERR_SLI_DOWN                0x101  /* ulpStatus  - Driver defined */
3803dea3101eS #define IOERR_SLI_BRESET              0x102
3804dea3101eS #define IOERR_SLI_ABORTED             0x103
3805e3d2b802SJames Smart #define IOERR_PARAM_MASK              0x1ff
3806dea3101eS } PARM_ERR;
3807dea3101eS 
3808dea3101eS typedef union {
3809dea3101eS 	struct {
3810dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3811dea3101eS 		uint8_t Rctl;	/* R_CTL field */
3812dea3101eS 		uint8_t Type;	/* TYPE field */
3813dea3101eS 		uint8_t Dfctl;	/* DF_CTL field */
3814dea3101eS 		uint8_t Fctl;	/* Bits 0-7 of IOCB word 5 */
3815dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3816dea3101eS 		uint8_t Fctl;	/* Bits 0-7 of IOCB word 5 */
3817dea3101eS 		uint8_t Dfctl;	/* DF_CTL field */
3818dea3101eS 		uint8_t Type;	/* TYPE field */
3819dea3101eS 		uint8_t Rctl;	/* R_CTL field */
3820dea3101eS #endif
3821dea3101eS 
3822dea3101eS #define BC      0x02		/* Broadcast Received  - Fctl */
3823dea3101eS #define SI      0x04		/* Sequence Initiative */
3824dea3101eS #define LA      0x08		/* Ignore Link Attention state */
3825dea3101eS #define LS      0x80		/* Last Sequence */
3826dea3101eS 	} hcsw;
3827dea3101eS 	uint32_t reserved;
3828dea3101eS } WORD5;
3829dea3101eS 
3830dea3101eS /* IOCB Command template for a generic response */
3831dea3101eS typedef struct {
3832dea3101eS 	uint32_t reserved[4];
3833dea3101eS 	PARM_ERR perr;
3834dea3101eS } GENERIC_RSP;
3835dea3101eS 
3836dea3101eS /* IOCB Command template for XMIT / XMIT_BCAST / RCV_SEQUENCE / XMIT_ELS */
3837dea3101eS typedef struct {
3838dea3101eS 	struct ulp_bde xrsqbde[2];
3839dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3840dea3101eS 	WORD5 w5;		/* Header control/status word */
3841dea3101eS } XR_SEQ_FIELDS;
3842dea3101eS 
3843dea3101eS /* IOCB Command template for ELS_REQUEST */
3844dea3101eS typedef struct {
3845dea3101eS 	struct ulp_bde elsReq;
3846dea3101eS 	struct ulp_bde elsRsp;
3847dea3101eS 
3848dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3849dea3101eS 	uint32_t word4Rsvd:7;
3850dea3101eS 	uint32_t fl:1;
3851dea3101eS 	uint32_t myID:24;
3852dea3101eS 	uint32_t word5Rsvd:8;
3853dea3101eS 	uint32_t remoteID:24;
3854dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3855dea3101eS 	uint32_t myID:24;
3856dea3101eS 	uint32_t fl:1;
3857dea3101eS 	uint32_t word4Rsvd:7;
3858dea3101eS 	uint32_t remoteID:24;
3859dea3101eS 	uint32_t word5Rsvd:8;
3860dea3101eS #endif
3861dea3101eS } ELS_REQUEST;
3862dea3101eS 
3863dea3101eS /* IOCB Command template for RCV_ELS_REQ */
3864dea3101eS typedef struct {
3865dea3101eS 	struct ulp_bde elsReq[2];
3866dea3101eS 	uint32_t parmRo;
3867dea3101eS 
3868dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3869dea3101eS 	uint32_t word5Rsvd:8;
3870dea3101eS 	uint32_t remoteID:24;
3871dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3872dea3101eS 	uint32_t remoteID:24;
3873dea3101eS 	uint32_t word5Rsvd:8;
3874dea3101eS #endif
3875dea3101eS } RCV_ELS_REQ;
3876dea3101eS 
3877dea3101eS /* IOCB Command template for ABORT / CLOSE_XRI */
3878dea3101eS typedef struct {
3879dea3101eS 	uint32_t rsvd[3];
3880dea3101eS 	uint32_t abortType;
3881dea3101eS #define ABORT_TYPE_ABTX  0x00000000
3882dea3101eS #define ABORT_TYPE_ABTS  0x00000001
3883dea3101eS 	uint32_t parm;
3884dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3885dea3101eS 	uint16_t abortContextTag; /* ulpContext from command to abort/close */
3886dea3101eS 	uint16_t abortIoTag;	/* ulpIoTag from command to abort/close */
3887dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3888dea3101eS 	uint16_t abortIoTag;	/* ulpIoTag from command to abort/close */
3889dea3101eS 	uint16_t abortContextTag; /* ulpContext from command to abort/close */
3890dea3101eS #endif
3891dea3101eS } AC_XRI;
3892dea3101eS 
3893dea3101eS /* IOCB Command template for ABORT_MXRI64 */
3894dea3101eS typedef struct {
3895dea3101eS 	uint32_t rsvd[3];
3896dea3101eS 	uint32_t abortType;
3897dea3101eS 	uint32_t parm;
3898dea3101eS 	uint32_t iotag32;
3899dea3101eS } A_MXRI64;
3900dea3101eS 
3901dea3101eS /* IOCB Command template for GET_RPI */
3902dea3101eS typedef struct {
3903dea3101eS 	uint32_t rsvd[4];
3904dea3101eS 	uint32_t parmRo;
3905dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3906dea3101eS 	uint32_t word5Rsvd:8;
3907dea3101eS 	uint32_t remoteID:24;
3908dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3909dea3101eS 	uint32_t remoteID:24;
3910dea3101eS 	uint32_t word5Rsvd:8;
3911dea3101eS #endif
3912dea3101eS } GET_RPI;
3913dea3101eS 
3914dea3101eS /* IOCB Command template for all FCP Initiator commands */
3915dea3101eS typedef struct {
3916dea3101eS 	struct ulp_bde fcpi_cmnd;	/* FCP_CMND payload descriptor */
3917dea3101eS 	struct ulp_bde fcpi_rsp;	/* Rcv buffer */
3918dea3101eS 	uint32_t fcpi_parm;
3919dea3101eS 	uint32_t fcpi_XRdy;	/* transfer ready for IWRITE */
3920dea3101eS } FCPI_FIELDS;
3921dea3101eS 
3922dea3101eS /* IOCB Command template for all FCP Target commands */
3923dea3101eS typedef struct {
3924dea3101eS 	struct ulp_bde fcpt_Buffer[2];	/* FCP_CMND payload descriptor */
3925dea3101eS 	uint32_t fcpt_Offset;
3926dea3101eS 	uint32_t fcpt_Length;	/* transfer ready for IWRITE */
3927dea3101eS } FCPT_FIELDS;
3928dea3101eS 
3929dea3101eS /* SLI-2 IOCB structure definitions */
3930dea3101eS 
3931dea3101eS /* IOCB Command template for 64 bit XMIT / XMIT_BCAST / XMIT_ELS */
3932dea3101eS typedef struct {
3933dea3101eS 	ULP_BDL bdl;
3934dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3935dea3101eS 	WORD5 w5;		/* Header control/status word */
3936dea3101eS } XMT_SEQ_FIELDS64;
3937dea3101eS 
3938939723a4SJames Smart /* This word is remote ports D_ID for XMIT_ELS_RSP64 */
3939939723a4SJames Smart #define xmit_els_remoteID xrsqRo
3940939723a4SJames Smart 
3941dea3101eS /* IOCB Command template for 64 bit RCV_SEQUENCE64 */
3942dea3101eS typedef struct {
3943dea3101eS 	struct ulp_bde64 rcvBde;
3944dea3101eS 	uint32_t rsvd1;
3945dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3946dea3101eS 	WORD5 w5;		/* Header control/status word */
3947dea3101eS } RCV_SEQ_FIELDS64;
3948dea3101eS 
3949dea3101eS /* IOCB Command template for ELS_REQUEST64 */
3950dea3101eS typedef struct {
3951dea3101eS 	ULP_BDL bdl;
3952dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3953dea3101eS 	uint32_t word4Rsvd:7;
3954dea3101eS 	uint32_t fl:1;
3955dea3101eS 	uint32_t myID:24;
3956dea3101eS 	uint32_t word5Rsvd:8;
3957dea3101eS 	uint32_t remoteID:24;
3958dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3959dea3101eS 	uint32_t myID:24;
3960dea3101eS 	uint32_t fl:1;
3961dea3101eS 	uint32_t word4Rsvd:7;
3962dea3101eS 	uint32_t remoteID:24;
3963dea3101eS 	uint32_t word5Rsvd:8;
3964dea3101eS #endif
3965dea3101eS } ELS_REQUEST64;
3966dea3101eS 
3967dea3101eS /* IOCB Command template for GEN_REQUEST64 */
3968dea3101eS typedef struct {
3969dea3101eS 	ULP_BDL bdl;
3970dea3101eS 	uint32_t xrsqRo;	/* Starting Relative Offset */
3971dea3101eS 	WORD5 w5;		/* Header control/status word */
3972dea3101eS } GEN_REQUEST64;
3973dea3101eS 
3974dea3101eS /* IOCB Command template for RCV_ELS_REQ64 */
3975dea3101eS typedef struct {
3976dea3101eS 	struct ulp_bde64 elsReq;
3977dea3101eS 	uint32_t rcvd1;
3978dea3101eS 	uint32_t parmRo;
3979dea3101eS 
3980dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
3981dea3101eS 	uint32_t word5Rsvd:8;
3982dea3101eS 	uint32_t remoteID:24;
3983dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
3984dea3101eS 	uint32_t remoteID:24;
3985dea3101eS 	uint32_t word5Rsvd:8;
3986dea3101eS #endif
3987dea3101eS } RCV_ELS_REQ64;
3988dea3101eS 
39899c2face6SJames Smart /* IOCB Command template for RCV_SEQ64 */
39909c2face6SJames Smart struct rcv_seq64 {
39919c2face6SJames Smart 	struct ulp_bde64 elsReq;
39929c2face6SJames Smart 	uint32_t hbq_1;
39939c2face6SJames Smart 	uint32_t parmRo;
39949c2face6SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
39959c2face6SJames Smart 	uint32_t rctl:8;
39969c2face6SJames Smart 	uint32_t type:8;
39979c2face6SJames Smart 	uint32_t dfctl:8;
39989c2face6SJames Smart 	uint32_t ls:1;
39999c2face6SJames Smart 	uint32_t fs:1;
40009c2face6SJames Smart 	uint32_t rsvd2:3;
40019c2face6SJames Smart 	uint32_t si:1;
40029c2face6SJames Smart 	uint32_t bc:1;
40039c2face6SJames Smart 	uint32_t rsvd3:1;
40049c2face6SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
40059c2face6SJames Smart 	uint32_t rsvd3:1;
40069c2face6SJames Smart 	uint32_t bc:1;
40079c2face6SJames Smart 	uint32_t si:1;
40089c2face6SJames Smart 	uint32_t rsvd2:3;
40099c2face6SJames Smart 	uint32_t fs:1;
40109c2face6SJames Smart 	uint32_t ls:1;
40119c2face6SJames Smart 	uint32_t dfctl:8;
40129c2face6SJames Smart 	uint32_t type:8;
40139c2face6SJames Smart 	uint32_t rctl:8;
40149c2face6SJames Smart #endif
40159c2face6SJames Smart };
40169c2face6SJames Smart 
4017dea3101eS /* IOCB Command template for all 64 bit FCP Initiator commands */
4018dea3101eS typedef struct {
4019dea3101eS 	ULP_BDL bdl;
4020dea3101eS 	uint32_t fcpi_parm;
4021dea3101eS 	uint32_t fcpi_XRdy;	/* transfer ready for IWRITE */
4022dea3101eS } FCPI_FIELDS64;
4023dea3101eS 
4024dea3101eS /* IOCB Command template for all 64 bit FCP Target commands */
4025dea3101eS typedef struct {
4026dea3101eS 	ULP_BDL bdl;
4027dea3101eS 	uint32_t fcpt_Offset;
4028dea3101eS 	uint32_t fcpt_Length;	/* transfer ready for IWRITE */
4029dea3101eS } FCPT_FIELDS64;
4030dea3101eS 
403157127f15SJames Smart /* IOCB Command template for Async Status iocb commands */
403257127f15SJames Smart typedef struct {
403357127f15SJames Smart 	uint32_t rsvd[4];
403457127f15SJames Smart 	uint32_t param;
403557127f15SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
403657127f15SJames Smart 	uint16_t evt_code;		/* High order bits word 5 */
403757127f15SJames Smart 	uint16_t sub_ctxt_tag;		/* Low  order bits word 5 */
403857127f15SJames Smart #else   /*  __LITTLE_ENDIAN_BITFIELD */
403957127f15SJames Smart 	uint16_t sub_ctxt_tag;		/* High order bits word 5 */
404057127f15SJames Smart 	uint16_t evt_code;		/* Low  order bits word 5 */
404157127f15SJames Smart #endif
404257127f15SJames Smart } ASYNCSTAT_FIELDS;
404357127f15SJames Smart #define ASYNC_TEMP_WARN		0x100
404457127f15SJames Smart #define ASYNC_TEMP_SAFE		0x101
4045cb69f7deSJames Smart #define ASYNC_STATUS_CN		0x102
404657127f15SJames Smart 
4047ed957684SJames Smart /* IOCB Command template for CMD_IOCB_RCV_ELS64_CX (0xB7)
4048ed957684SJames Smart    or CMD_IOCB_RCV_SEQ64_CX (0xB5) */
4049ed957684SJames Smart 
4050ed957684SJames Smart struct rcv_sli3 {
4051ed957684SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
40527851fe2cSJames Smart 	uint16_t ox_id;
40537851fe2cSJames Smart 	uint16_t seq_cnt;
40547851fe2cSJames Smart 
4055ed957684SJames Smart 	uint16_t vpi;
4056ed957684SJames Smart 	uint16_t word9Rsvd;
4057ed957684SJames Smart #else  /*  __LITTLE_ENDIAN */
40587851fe2cSJames Smart 	uint16_t seq_cnt;
40597851fe2cSJames Smart 	uint16_t ox_id;
40607851fe2cSJames Smart 
4061ed957684SJames Smart 	uint16_t word9Rsvd;
4062ed957684SJames Smart 	uint16_t vpi;
4063ed957684SJames Smart #endif
4064ed957684SJames Smart 	uint32_t word10Rsvd;
4065ed957684SJames Smart 	uint32_t acc_len;      /* accumulated length */
4066ed957684SJames Smart 	struct ulp_bde64 bde2;
4067ed957684SJames Smart };
4068ed957684SJames Smart 
406976bb24efSJames Smart /* Structure used for a single HBQ entry */
407076bb24efSJames Smart struct lpfc_hbq_entry {
407176bb24efSJames Smart 	struct ulp_bde64 bde;
407276bb24efSJames Smart 	uint32_t buffer_tag;
407376bb24efSJames Smart };
407492d7f7b0SJames Smart 
407576bb24efSJames Smart /* IOCB Command template for QUE_XRI64_CX (0xB3) command */
407676bb24efSJames Smart typedef struct {
407776bb24efSJames Smart 	struct lpfc_hbq_entry   buff;
407876bb24efSJames Smart 	uint32_t                rsvd;
407976bb24efSJames Smart 	uint32_t		rsvd1;
408076bb24efSJames Smart } QUE_XRI64_CX_FIELDS;
408176bb24efSJames Smart 
408276bb24efSJames Smart struct que_xri64cx_ext_fields {
408376bb24efSJames Smart 	uint32_t	iotag64_low;
408476bb24efSJames Smart 	uint32_t	iotag64_high;
408576bb24efSJames Smart 	uint32_t	ebde_count;
408676bb24efSJames Smart 	uint32_t	rsvd;
408776bb24efSJames Smart 	struct lpfc_hbq_entry	buff[5];
408876bb24efSJames Smart };
408992d7f7b0SJames Smart 
409081301a9bSJames Smart struct sli3_bg_fields {
409181301a9bSJames Smart 	uint32_t filler[6];	/* word 8-13 in IOCB */
409281301a9bSJames Smart 	uint32_t bghm;		/* word 14 - BlockGuard High Water Mark */
409381301a9bSJames Smart /* Bitfields for bgstat (BlockGuard Status - word 15 of IOCB) */
409481301a9bSJames Smart #define BGS_BIDIR_BG_PROF_MASK		0xff000000
409581301a9bSJames Smart #define BGS_BIDIR_BG_PROF_SHIFT		24
409681301a9bSJames Smart #define BGS_BIDIR_ERR_COND_FLAGS_MASK	0x003f0000
409781301a9bSJames Smart #define BGS_BIDIR_ERR_COND_SHIFT	16
409881301a9bSJames Smart #define BGS_BG_PROFILE_MASK		0x0000ff00
409981301a9bSJames Smart #define BGS_BG_PROFILE_SHIFT		8
410081301a9bSJames Smart #define BGS_INVALID_PROF_MASK		0x00000020
410181301a9bSJames Smart #define BGS_INVALID_PROF_SHIFT		5
410281301a9bSJames Smart #define BGS_UNINIT_DIF_BLOCK_MASK	0x00000010
410381301a9bSJames Smart #define BGS_UNINIT_DIF_BLOCK_SHIFT	4
410481301a9bSJames Smart #define BGS_HI_WATER_MARK_PRESENT_MASK	0x00000008
410581301a9bSJames Smart #define BGS_HI_WATER_MARK_PRESENT_SHIFT	3
410681301a9bSJames Smart #define BGS_REFTAG_ERR_MASK		0x00000004
410781301a9bSJames Smart #define BGS_REFTAG_ERR_SHIFT		2
410881301a9bSJames Smart #define BGS_APPTAG_ERR_MASK		0x00000002
410981301a9bSJames Smart #define BGS_APPTAG_ERR_SHIFT		1
411081301a9bSJames Smart #define BGS_GUARD_ERR_MASK		0x00000001
411181301a9bSJames Smart #define BGS_GUARD_ERR_SHIFT		0
411281301a9bSJames Smart 	uint32_t bgstat;	/* word 15 - BlockGuard Status */
411381301a9bSJames Smart };
411481301a9bSJames Smart 
411581301a9bSJames Smart static inline uint32_t
411681301a9bSJames Smart lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat)
411781301a9bSJames Smart {
4118bc73905aSJames Smart 	return (bgstat & BGS_BIDIR_BG_PROF_MASK) >>
411981301a9bSJames Smart 				BGS_BIDIR_BG_PROF_SHIFT;
412081301a9bSJames Smart }
412181301a9bSJames Smart 
412281301a9bSJames Smart static inline uint32_t
412381301a9bSJames Smart lpfc_bgs_get_bidir_err_cond(uint32_t bgstat)
412481301a9bSJames Smart {
4125bc73905aSJames Smart 	return (bgstat & BGS_BIDIR_ERR_COND_FLAGS_MASK) >>
412681301a9bSJames Smart 				BGS_BIDIR_ERR_COND_SHIFT;
412781301a9bSJames Smart }
412881301a9bSJames Smart 
412981301a9bSJames Smart static inline uint32_t
413081301a9bSJames Smart lpfc_bgs_get_bg_prof(uint32_t bgstat)
413181301a9bSJames Smart {
4132bc73905aSJames Smart 	return (bgstat & BGS_BG_PROFILE_MASK) >>
413381301a9bSJames Smart 				BGS_BG_PROFILE_SHIFT;
413481301a9bSJames Smart }
413581301a9bSJames Smart 
413681301a9bSJames Smart static inline uint32_t
413781301a9bSJames Smart lpfc_bgs_get_invalid_prof(uint32_t bgstat)
413881301a9bSJames Smart {
4139bc73905aSJames Smart 	return (bgstat & BGS_INVALID_PROF_MASK) >>
414081301a9bSJames Smart 				BGS_INVALID_PROF_SHIFT;
414181301a9bSJames Smart }
414281301a9bSJames Smart 
414381301a9bSJames Smart static inline uint32_t
414481301a9bSJames Smart lpfc_bgs_get_uninit_dif_block(uint32_t bgstat)
414581301a9bSJames Smart {
4146bc73905aSJames Smart 	return (bgstat & BGS_UNINIT_DIF_BLOCK_MASK) >>
414781301a9bSJames Smart 				BGS_UNINIT_DIF_BLOCK_SHIFT;
414881301a9bSJames Smart }
414981301a9bSJames Smart 
415081301a9bSJames Smart static inline uint32_t
415181301a9bSJames Smart lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat)
415281301a9bSJames Smart {
4153bc73905aSJames Smart 	return (bgstat & BGS_HI_WATER_MARK_PRESENT_MASK) >>
415481301a9bSJames Smart 				BGS_HI_WATER_MARK_PRESENT_SHIFT;
415581301a9bSJames Smart }
415681301a9bSJames Smart 
415781301a9bSJames Smart static inline uint32_t
415881301a9bSJames Smart lpfc_bgs_get_reftag_err(uint32_t bgstat)
415981301a9bSJames Smart {
4160bc73905aSJames Smart 	return (bgstat & BGS_REFTAG_ERR_MASK) >>
416181301a9bSJames Smart 				BGS_REFTAG_ERR_SHIFT;
416281301a9bSJames Smart }
416381301a9bSJames Smart 
416481301a9bSJames Smart static inline uint32_t
416581301a9bSJames Smart lpfc_bgs_get_apptag_err(uint32_t bgstat)
416681301a9bSJames Smart {
4167bc73905aSJames Smart 	return (bgstat & BGS_APPTAG_ERR_MASK) >>
416881301a9bSJames Smart 				BGS_APPTAG_ERR_SHIFT;
416981301a9bSJames Smart }
417081301a9bSJames Smart 
417181301a9bSJames Smart static inline uint32_t
417281301a9bSJames Smart lpfc_bgs_get_guard_err(uint32_t bgstat)
417381301a9bSJames Smart {
4174bc73905aSJames Smart 	return (bgstat & BGS_GUARD_ERR_MASK) >>
417581301a9bSJames Smart 				BGS_GUARD_ERR_SHIFT;
417681301a9bSJames Smart }
417781301a9bSJames Smart 
417834b02dcdSJames Smart #define LPFC_EXT_DATA_BDE_COUNT 3
417934b02dcdSJames Smart struct fcp_irw_ext {
418034b02dcdSJames Smart 	uint32_t	io_tag64_low;
418134b02dcdSJames Smart 	uint32_t	io_tag64_high;
418234b02dcdSJames Smart #ifdef __BIG_ENDIAN_BITFIELD
418334b02dcdSJames Smart 	uint8_t		reserved1;
418434b02dcdSJames Smart 	uint8_t		reserved2;
418534b02dcdSJames Smart 	uint8_t		reserved3;
418634b02dcdSJames Smart 	uint8_t		ebde_count;
418734b02dcdSJames Smart #else  /* __LITTLE_ENDIAN */
418834b02dcdSJames Smart 	uint8_t		ebde_count;
418934b02dcdSJames Smart 	uint8_t		reserved3;
419034b02dcdSJames Smart 	uint8_t		reserved2;
419134b02dcdSJames Smart 	uint8_t		reserved1;
419234b02dcdSJames Smart #endif
419334b02dcdSJames Smart 	uint32_t	reserved4;
419434b02dcdSJames Smart 	struct ulp_bde64 rbde;		/* response bde */
419534b02dcdSJames Smart 	struct ulp_bde64 dbde[LPFC_EXT_DATA_BDE_COUNT];	/* data BDE or BPL */
419634b02dcdSJames Smart 	uint8_t icd[32];		/* immediate command data (32 bytes) */
419734b02dcdSJames Smart };
419834b02dcdSJames Smart 
4199dea3101eS typedef struct _IOCB {	/* IOCB structure */
4200dea3101eS 	union {
4201dea3101eS 		GENERIC_RSP grsp;	/* Generic response */
4202dea3101eS 		XR_SEQ_FIELDS xrseq;	/* XMIT / BCAST / RCV_SEQUENCE cmd */
4203dea3101eS 		struct ulp_bde cont[3];	/* up to 3 continuation bdes */
4204dea3101eS 		RCV_ELS_REQ rcvels;	/* RCV_ELS_REQ template */
4205dea3101eS 		AC_XRI acxri;	/* ABORT / CLOSE_XRI template */
4206dea3101eS 		A_MXRI64 amxri;	/* abort multiple xri command overlay */
4207dea3101eS 		GET_RPI getrpi;	/* GET_RPI template */
4208dea3101eS 		FCPI_FIELDS fcpi;	/* FCP Initiator template */
4209dea3101eS 		FCPT_FIELDS fcpt;	/* FCP target template */
4210dea3101eS 
4211dea3101eS 		/* SLI-2 structures */
4212dea3101eS 
4213dea3101eS 		struct ulp_bde64 cont64[2];  /* up to 2 64 bit continuation
4214ed957684SJames Smart 					      * bde_64s */
4215dea3101eS 		ELS_REQUEST64 elsreq64;	/* ELS_REQUEST template */
4216dea3101eS 		GEN_REQUEST64 genreq64;	/* GEN_REQUEST template */
4217dea3101eS 		RCV_ELS_REQ64 rcvels64;	/* RCV_ELS_REQ template */
4218dea3101eS 		XMT_SEQ_FIELDS64 xseq64;	/* XMIT / BCAST cmd */
4219dea3101eS 		FCPI_FIELDS64 fcpi64;	/* FCP 64 bit Initiator template */
4220dea3101eS 		FCPT_FIELDS64 fcpt64;	/* FCP 64 bit target template */
422157127f15SJames Smart 		ASYNCSTAT_FIELDS asyncstat; /* async_status iocb */
422276bb24efSJames Smart 		QUE_XRI64_CX_FIELDS quexri64cx; /* que_xri64_cx fields */
42239c2face6SJames Smart 		struct rcv_seq64 rcvseq64;	/* RCV_SEQ64 and RCV_CONT64 */
4224546fc854SJames Smart 		struct sli4_bls_rsp bls_rsp; /* UNSOL ABTS BLS_RSP params */
4225dea3101eS 		uint32_t ulpWord[IOCB_WORD_SZ - 2];	/* generic 6 'words' */
4226dea3101eS 	} un;
4227dea3101eS 	union {
4228dea3101eS 		struct {
4229dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
4230dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
4231dea3101eS 			uint16_t ulpIoTag;	/* Low  order bits word 6 */
4232dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
4233dea3101eS 			uint16_t ulpIoTag;	/* Low  order bits word 6 */
4234dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
4235dea3101eS #endif
4236dea3101eS 		} t1;
4237dea3101eS 		struct {
4238dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
4239dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
4240dea3101eS 			uint16_t ulpIoTag1:2;	/* Low  order bits word 6 */
4241dea3101eS 			uint16_t ulpIoTag0:14;	/* Low  order bits word 6 */
4242dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
4243dea3101eS 			uint16_t ulpIoTag0:14;	/* Low  order bits word 6 */
4244dea3101eS 			uint16_t ulpIoTag1:2;	/* Low  order bits word 6 */
4245dea3101eS 			uint16_t ulpContext;	/* High order bits word 6 */
4246dea3101eS #endif
4247dea3101eS 		} t2;
4248dea3101eS 	} un1;
4249dea3101eS #define ulpContext un1.t1.ulpContext
4250dea3101eS #define ulpIoTag   un1.t1.ulpIoTag
4251dea3101eS #define ulpIoTag0  un1.t2.ulpIoTag0
4252dea3101eS 
4253dea3101eS #ifdef __BIG_ENDIAN_BITFIELD
4254dea3101eS 	uint32_t ulpTimeout:8;
4255dea3101eS 	uint32_t ulpXS:1;
4256dea3101eS 	uint32_t ulpFCP2Rcvy:1;
4257dea3101eS 	uint32_t ulpPU:2;
4258dea3101eS 	uint32_t ulpIr:1;
4259dea3101eS 	uint32_t ulpClass:3;
4260dea3101eS 	uint32_t ulpCommand:8;
4261dea3101eS 	uint32_t ulpStatus:4;
4262dea3101eS 	uint32_t ulpBdeCount:2;
4263dea3101eS 	uint32_t ulpLe:1;
4264dea3101eS 	uint32_t ulpOwner:1;	/* Low order bit word 7 */
4265dea3101eS #else	/*  __LITTLE_ENDIAN_BITFIELD */
4266dea3101eS 	uint32_t ulpOwner:1;	/* Low order bit word 7 */
4267dea3101eS 	uint32_t ulpLe:1;
4268dea3101eS 	uint32_t ulpBdeCount:2;
4269dea3101eS 	uint32_t ulpStatus:4;
4270dea3101eS 	uint32_t ulpCommand:8;
4271dea3101eS 	uint32_t ulpClass:3;
4272dea3101eS 	uint32_t ulpIr:1;
4273dea3101eS 	uint32_t ulpPU:2;
4274dea3101eS 	uint32_t ulpFCP2Rcvy:1;
4275dea3101eS 	uint32_t ulpXS:1;
4276dea3101eS 	uint32_t ulpTimeout:8;
4277dea3101eS #endif
427892d7f7b0SJames Smart 
4279ed957684SJames Smart 	union {
4280ed957684SJames Smart 		struct rcv_sli3 rcvsli3; /* words 8 - 15 */
428176bb24efSJames Smart 
428276bb24efSJames Smart 		/* words 8-31 used for que_xri_cx iocb */
428376bb24efSJames Smart 		struct que_xri64cx_ext_fields que_xri64cx_ext_words;
428434b02dcdSJames Smart 		struct fcp_irw_ext fcp_ext;
4285ed957684SJames Smart 		uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */
428681301a9bSJames Smart 
428781301a9bSJames Smart 		/* words 8-15 for BlockGuard */
428881301a9bSJames Smart 		struct sli3_bg_fields sli3_bg;
4289ed957684SJames Smart 	} unsli3;
4290dea3101eS 
4291ed957684SJames Smart #define ulpCt_h ulpXS
4292ed957684SJames Smart #define ulpCt_l ulpFCP2Rcvy
4293ed957684SJames Smart 
4294ed957684SJames Smart #define IOCB_FCP	   1	/* IOCB is used for FCP ELS cmds-ulpRsvByte */
4295ed957684SJames Smart #define IOCB_IP		   2	/* IOCB is used for IP ELS cmds */
4296dea3101eS #define PARM_UNUSED        0	/* PU field (Word 4) not used */
4297dea3101eS #define PARM_REL_OFF       1	/* PU field (Word 4) = R. O. */
4298dea3101eS #define PARM_READ_CHECK    2	/* PU field (Word 4) = Data Transfer Length */
429992d7f7b0SJames Smart #define PARM_NPIV_DID	   3
4300dea3101eS #define CLASS1             0	/* Class 1 */
4301dea3101eS #define CLASS2             1	/* Class 2 */
4302dea3101eS #define CLASS3             2	/* Class 3 */
4303dea3101eS #define CLASS_FCP_INTERMIX 7	/* FCP Data->Cls 1, all else->Cls 2 */
4304dea3101eS 
4305dea3101eS #define IOSTAT_SUCCESS         0x0	/* ulpStatus  - HBA defined */
4306dea3101eS #define IOSTAT_FCP_RSP_ERROR   0x1
4307dea3101eS #define IOSTAT_REMOTE_STOP     0x2
4308dea3101eS #define IOSTAT_LOCAL_REJECT    0x3
4309dea3101eS #define IOSTAT_NPORT_RJT       0x4
4310dea3101eS #define IOSTAT_FABRIC_RJT      0x5
4311dea3101eS #define IOSTAT_NPORT_BSY       0x6
4312dea3101eS #define IOSTAT_FABRIC_BSY      0x7
4313dea3101eS #define IOSTAT_INTERMED_RSP    0x8
4314dea3101eS #define IOSTAT_LS_RJT          0x9
4315dea3101eS #define IOSTAT_BA_RJT          0xA
4316dea3101eS #define IOSTAT_RSVD1           0xB
4317dea3101eS #define IOSTAT_RSVD2           0xC
4318dea3101eS #define IOSTAT_RSVD3           0xD
4319dea3101eS #define IOSTAT_RSVD4           0xE
432092d7f7b0SJames Smart #define IOSTAT_NEED_BUFFER     0xF
4321dea3101eS #define IOSTAT_DRIVER_REJECT   0x10   /* ulpStatus  - Driver defined */
4322dea3101eS #define IOSTAT_DEFAULT         0xF    /* Same as rsvd5 for now */
4323dea3101eS #define IOSTAT_CNT             0x11
4324dea3101eS 
4325dea3101eS } IOCB_t;
4326dea3101eS 
4327dea3101eS 
4328dea3101eS #define SLI1_SLIM_SIZE   (4 * 1024)
4329dea3101eS 
4330dea3101eS /* Up to 498 IOCBs will fit into 16k
4331dea3101eS  * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384
4332dea3101eS  */
4333ed957684SJames Smart #define SLI2_SLIM_SIZE   (64 * 1024)
4334dea3101eS 
4335dea3101eS /* Maximum IOCBs that will fit in SLI2 slim */
4336dea3101eS #define MAX_SLI2_IOCB    498
4337ed957684SJames Smart #define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \
43387a470277SJames Smart 			    (sizeof(MAILBOX_t) + sizeof(PCB_t) + \
43397a470277SJames Smart 			    sizeof(uint32_t) * MAILBOX_EXT_WSIZE))
4340ed957684SJames Smart 
4341ed957684SJames Smart /* HBQ entries are 4 words each = 4k */
4342ed957684SJames Smart #define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) *  \
4343ed957684SJames Smart 			     lpfc_sli_hbq_count())
4344dea3101eS 
4345dea3101eS struct lpfc_sli2_slim {
4346dea3101eS 	MAILBOX_t mbx;
43477a470277SJames Smart 	uint32_t  mbx_ext_words[MAILBOX_EXT_WSIZE];
4348dea3101eS 	PCB_t pcb;
4349ed957684SJames Smart 	IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE];
4350dea3101eS };
4351dea3101eS 
43522e0fef85SJames Smart /*
43532e0fef85SJames Smart  * This function checks PCI device to allow special handling for LC HBAs.
43542e0fef85SJames Smart  *
43552e0fef85SJames Smart  * Parameters:
43562e0fef85SJames Smart  * device : struct pci_dev 's device field
43572e0fef85SJames Smart  *
43582e0fef85SJames Smart  * return 1 => TRUE
43592e0fef85SJames Smart  *        0 => FALSE
43602e0fef85SJames Smart  */
4361dea3101eS static inline int
4362dea3101eS lpfc_is_LC_HBA(unsigned short device)
4363dea3101eS {
4364dea3101eS 	if ((device == PCI_DEVICE_ID_TFLY) ||
4365dea3101eS 	    (device == PCI_DEVICE_ID_PFLY) ||
4366dea3101eS 	    (device == PCI_DEVICE_ID_LP101) ||
4367dea3101eS 	    (device == PCI_DEVICE_ID_BMID) ||
4368dea3101eS 	    (device == PCI_DEVICE_ID_BSMB) ||
4369dea3101eS 	    (device == PCI_DEVICE_ID_ZMID) ||
4370dea3101eS 	    (device == PCI_DEVICE_ID_ZSMB) ||
437109372820SJames Smart 	    (device == PCI_DEVICE_ID_SAT_MID) ||
437209372820SJames Smart 	    (device == PCI_DEVICE_ID_SAT_SMB) ||
4373dea3101eS 	    (device == PCI_DEVICE_ID_RFLY))
4374dea3101eS 		return 1;
4375dea3101eS 	else
4376dea3101eS 		return 0;
4377dea3101eS }
4378858c9f6cSJames Smart 
4379858c9f6cSJames Smart /*
43806831ce12SJames Smart  * Determine if failed because of a link event or firmware reset.
4381858c9f6cSJames Smart  */
4382858c9f6cSJames Smart static inline int
43836831ce12SJames Smart lpfc_error_lost_link(u32 ulp_status, u32 ulp_word4)
4384858c9f6cSJames Smart {
43856831ce12SJames Smart 	return (ulp_status == IOSTAT_LOCAL_REJECT &&
43866831ce12SJames Smart 		(ulp_word4 == IOERR_SLI_ABORTED ||
43876831ce12SJames Smart 		 ulp_word4 == IOERR_LINK_DOWN ||
43886831ce12SJames Smart 		 ulp_word4 == IOERR_SLI_DOWN));
4389858c9f6cSJames Smart }
439084774a4dSJames Smart 
439184774a4dSJames Smart #define MENLO_TRANSPORT_TYPE 0xfe
439284774a4dSJames Smart #define MENLO_CONTEXT 0
439384774a4dSJames Smart #define MENLO_PU 3
439484774a4dSJames Smart #define MENLO_TIMEOUT 30
439584774a4dSJames Smart #define SETVAR_MLOMNT 0x103107
439684774a4dSJames Smart #define SETVAR_MLORST 0x103007
4397da0436e9SJames Smart 
4398da0436e9SJames Smart #define BPL_ALIGN_SZ 8 /* 8 byte alignment for bpl and mbufs */
4399