1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8*8f23e9faSHans Rosenfeld  * You can obtain a copy of the license at
9*8f23e9faSHans Rosenfeld  * http://www.opensource.org/licenses/cddl1.txt.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte 
22fcf3ce44SJohn Forte /*
23*8f23e9faSHans Rosenfeld  * Copyright (c) 2004-2011 Emulex. All rights reserved.
2482527734SSukumar Swaminathan  * Use is subject to license terms.
25fcf3ce44SJohn Forte  */
26fcf3ce44SJohn Forte 
27fcf3ce44SJohn Forte #ifndef _EMLXS_HW_H
28fcf3ce44SJohn Forte #define	_EMLXS_HW_H
29fcf3ce44SJohn Forte 
30fcf3ce44SJohn Forte #ifdef	__cplusplus
31fcf3ce44SJohn Forte extern "C" {
32fcf3ce44SJohn Forte #endif
33fcf3ce44SJohn Forte 
34291a2b48SSukumar Swaminathan #define	MAX_VPORTS			256	/* Max virtual ports per HBA */
35291a2b48SSukumar Swaminathan 						/* (includes physical port) */
36fcf3ce44SJohn Forte #define	MAX_VPORTS_LIMITED		101
37fcf3ce44SJohn Forte 
38291a2b48SSukumar Swaminathan #define	FC_MAX_TRANSFER			0x40000	/* Max transfer size per */
39291a2b48SSukumar Swaminathan 						/* operation */
40fcf3ce44SJohn Forte 
41fcf3ce44SJohn Forte #define	MAX_RINGS_AVAILABLE		4	/* # rings available */
42fcf3ce44SJohn Forte #define	MAX_RINGS			4	/* Max # rings used */
43fcf3ce44SJohn Forte 
44fcf3ce44SJohn Forte #define	PCB_SIZE			128
45fcf3ce44SJohn Forte 
46fcf3ce44SJohn Forte #define	SLIM_IOCB_CMD_R0_ENTRIES	128	/* SLI FCP cmd ring entries  */
47fcf3ce44SJohn Forte #define	SLIM_IOCB_RSP_R0_ENTRIES	128	/* SLI FCP rsp ring entries */
4882527734SSukumar Swaminathan #define	SLIM_IOCB_CMD_R1_ENTRIES	128	/* SLI IP cmd ring entries   */
4982527734SSukumar Swaminathan #define	SLIM_IOCB_RSP_R1_ENTRIES	128	/* SLI IP rsp ring entries  */
5082527734SSukumar Swaminathan #define	SLIM_IOCB_CMD_R2_ENTRIES	128	/* SLI ELS cmd ring entries  */
5182527734SSukumar Swaminathan #define	SLIM_IOCB_RSP_R2_ENTRIES	128	/* SLI ELS rspe ring entries */
5282527734SSukumar Swaminathan #define	SLIM_IOCB_CMD_R3_ENTRIES	128	/* SLI CT cmd ring entries   */
5382527734SSukumar Swaminathan #define	SLIM_IOCB_RSP_R3_ENTRIES	128	/* SLI CT rsp ring entries  */
54291a2b48SSukumar Swaminathan 
55291a2b48SSukumar Swaminathan /*
56291a2b48SSukumar Swaminathan  * Total: 184 Cmd's + 184 Rsp's = 368
57291a2b48SSukumar Swaminathan  * Command and response entry counts are not required to be equal
58291a2b48SSukumar Swaminathan  */
59fcf3ce44SJohn Forte 
60291a2b48SSukumar Swaminathan #define	SLIM_IOCB_CMD_ENTRIES		(SLIM_IOCB_CMD_R0_ENTRIES + \
61291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_R1_ENTRIES + \
62291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_R2_ENTRIES + \
63291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_R3_ENTRIES)
64fcf3ce44SJohn Forte 
65291a2b48SSukumar Swaminathan #define	SLIM_IOCB_RSP_ENTRIES		(SLIM_IOCB_RSP_R0_ENTRIES + \
66291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_R1_ENTRIES + \
67291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_R2_ENTRIES + \
68291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_R3_ENTRIES)
69fcf3ce44SJohn Forte 
70291a2b48SSukumar Swaminathan #define	SLIM_IOCB_ENTRIES		(SLIM_IOCB_CMD_ENTRIES + \
71291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_ENTRIES)
72fcf3ce44SJohn Forte 
73fcf3ce44SJohn Forte 
74fcf3ce44SJohn Forte /* SLI1 Definitions */
75291a2b48SSukumar Swaminathan #define	SLI_SLIM1_SIZE			4096 /* Fixed size memory */
76fcf3ce44SJohn Forte 
77fcf3ce44SJohn Forte 
78fcf3ce44SJohn Forte /* SLI2 Definitions */
79fcf3ce44SJohn Forte #define	SLI2_IOCB_CMD_SIZE		32
80fcf3ce44SJohn Forte #define	SLI2_IOCB_RSP_SIZE		32
81291a2b48SSukumar Swaminathan #define	SLI2_IOCB_MAX_SIZE		((SLI2_IOCB_CMD_SIZE * \
82291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_ENTRIES) + \
83291a2b48SSukumar Swaminathan 					(SLI2_IOCB_RSP_SIZE * \
84291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_ENTRIES))
85291a2b48SSukumar Swaminathan #define	SLI2_SLIM2_SIZE			(MBOX_SIZE + MBOX_EXTENSION_SIZE + \
86291a2b48SSukumar Swaminathan 					PCB_SIZE + SLI2_IOCB_MAX_SIZE)
87291a2b48SSukumar Swaminathan 
88fcf3ce44SJohn Forte 
89fcf3ce44SJohn Forte /* SLI3 Definitions */
90fcf3ce44SJohn Forte #define	SLI3_MAX_BDE			7
91fcf3ce44SJohn Forte #define	SLI3_IOCB_CMD_SIZE		128
92fcf3ce44SJohn Forte #define	SLI3_IOCB_RSP_SIZE		64
93291a2b48SSukumar Swaminathan #define	SLI3_IOCB_MAX_SIZE		((SLI3_IOCB_CMD_SIZE * \
94291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_ENTRIES) + \
95291a2b48SSukumar Swaminathan 					(SLI3_IOCB_RSP_SIZE * \
96291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_ENTRIES))
97291a2b48SSukumar Swaminathan #define	SLI3_SLIM2_SIZE			(MBOX_SIZE + MBOX_EXTENSION_SIZE + \
98291a2b48SSukumar Swaminathan 					PCB_SIZE + SLI3_IOCB_MAX_SIZE)
99fcf3ce44SJohn Forte 
100fcf3ce44SJohn Forte #define	SLI_SLIM2_SIZE			SLI3_SLIM2_SIZE
101fcf3ce44SJohn Forte #define	SLI_IOCB_MAX_SIZE		SLI3_IOCB_MAX_SIZE
102fcf3ce44SJohn Forte 
103fcf3ce44SJohn Forte 
10482527734SSukumar Swaminathan /* These two are defined to indicate FCP cmd or non FCP cmd */
10582527734SSukumar Swaminathan #define	FC_FCP_CMD		0
10682527734SSukumar Swaminathan #define	FC_FCT_CMD		0
10782527734SSukumar Swaminathan #define	FC_IP_CMD		1
10882527734SSukumar Swaminathan #define	FC_ELS_CMD		2
10982527734SSukumar Swaminathan #define	FC_CT_CMD		3
11082527734SSukumar Swaminathan 
11182527734SSukumar Swaminathan #define	FC_NFCP_CMD		1	/* could be a bit mask */
112fcf3ce44SJohn Forte 
113fcf3ce44SJohn Forte #define	FC_MAXRETRY		3	/* max retries for ELS commands */
114291a2b48SSukumar Swaminathan #define	FC_FCP_RING		0	/* use ring 0 for FCP initiator cmds */
115291a2b48SSukumar Swaminathan #define	FC_FCT_RING		0	/* use ring 0 for FCP target cmds */
116fcf3ce44SJohn Forte 
117fcf3ce44SJohn Forte #define	FC_IP_RING		1	/* use ring 1 for IP commands */
118fcf3ce44SJohn Forte #define	FC_ELS_RING		2	/* use ring 2 for ELS commands */
119fcf3ce44SJohn Forte #define	FC_CT_RING		3	/* use ring 3 for CT commands */
120fcf3ce44SJohn Forte 
121fcf3ce44SJohn Forte #define	FF_DEF_EDTOV		2000	/* Default E_D_TOV (2000ms) */
122fcf3ce44SJohn Forte #define	FF_DEF_ALTOV		15	/* Default AL_TIME (15ms) */
123fcf3ce44SJohn Forte #define	FF_DEF_RATOV		2	/* Default RA_TOV (2s) */
124fcf3ce44SJohn Forte #define	FF_DEF_ARBTOV		1900	/* Default ARB_TOV (1900ms) */
125291a2b48SSukumar Swaminathan #define	MAX_MSG_DATA		28	/* max msg data in CMD_ADAPTER_MSG */
126291a2b48SSukumar Swaminathan 					/* iocb */
127291a2b48SSukumar Swaminathan #define	FF_REG_AREA_SIZE	256	/* size, in bytes, of i/o register */
128291a2b48SSukumar Swaminathan 					/* area */
129fcf3ce44SJohn Forte 
130fcf3ce44SJohn Forte /*
131fcf3ce44SJohn Forte  * Miscellaneous stuff....
132fcf3ce44SJohn Forte  */
133*8f23e9faSHans Rosenfeld 
134*8f23e9faSHans Rosenfeld #define	MAX_NODE_THROTTLE	2048
135*8f23e9faSHans Rosenfeld 
136fcf3ce44SJohn Forte /* HBA Mgmt */
137fcf3ce44SJohn Forte #define	FDMI_DID		((uint32_t)0xfffffa)
13882527734SSukumar Swaminathan #define	NAMESERVER_DID		((uint32_t)0xfffffc)
139fcf3ce44SJohn Forte #define	SCR_DID			((uint32_t)0xfffffd)
14082527734SSukumar Swaminathan #define	FABRIC_DID		((uint32_t)0xfffffe)
14182527734SSukumar Swaminathan #define	BCAST_DID		((uint32_t)0xffffff)
14282527734SSukumar Swaminathan #define	MASK_DID		((uint32_t)0xffffff)
143fcf3ce44SJohn Forte #define	CT_DID_MASK		((uint32_t)0xffff00)
14482527734SSukumar Swaminathan #define	FABRIC_DID_MASK		((uint32_t)0xfff000)
145fcf3ce44SJohn Forte #define	WELL_KNOWN_DID_MASK	((uint32_t)0xfffff0)
146fcf3ce44SJohn Forte 
147fcf3ce44SJohn Forte #define	EMLXS_MENLO_DID		((uint32_t)0x00fc0e)
148fcf3ce44SJohn Forte 
149fcf3ce44SJohn Forte #define	OWN_CHIP	1	/* IOCB / Mailbox is owned by FireFly */
150fcf3ce44SJohn Forte #define	OWN_HOST	0	/* IOCB / Mailbox is owned by Host */
151291a2b48SSukumar Swaminathan #define	END_OF_CHAIN	0
152fcf3ce44SJohn Forte 
153fcf3ce44SJohn Forte 
154fcf3ce44SJohn Forte /* defines for type field in fc header */
155fcf3ce44SJohn Forte #define	EMLXS_MENLO_TYPE	0xFE
156fcf3ce44SJohn Forte 
157fcf3ce44SJohn Forte /* defines for rctl field in fc header */
158fcf3ce44SJohn Forte #define	FC_DEV_DATA	0x0
159fcf3ce44SJohn Forte #define	FC_UNSOL_CTL	0x2
160fcf3ce44SJohn Forte #define	FC_SOL_CTL	0x3
161fcf3ce44SJohn Forte #define	FC_UNSOL_DATA	0x4
162fcf3ce44SJohn Forte #define	FC_FCP_CMND	0x6
163fcf3ce44SJohn Forte #define	FC_ELS_REQ	0x22
164fcf3ce44SJohn Forte #define	FC_ELS_RSP	0x23
165fcf3ce44SJohn Forte #define	FC_NET_HDR	0x20	/* network headers for Dfctl field */
166fcf3ce44SJohn Forte 
167fcf3ce44SJohn Forte /*
168fcf3ce44SJohn Forte  * Common Transport structures and definitions
169fcf3ce44SJohn Forte  *
170fcf3ce44SJohn Forte  */
171fcf3ce44SJohn Forte #define	EMLXS_COMMAND	0
172fcf3ce44SJohn Forte #define	EMLXS_RESPONSE	1
173fcf3ce44SJohn Forte 
174291a2b48SSukumar Swaminathan typedef union CtRevisionId
175291a2b48SSukumar Swaminathan {
176fcf3ce44SJohn Forte 	/* Structure is in Big Endian format */
177291a2b48SSukumar Swaminathan 	struct
178291a2b48SSukumar Swaminathan 	{
179291a2b48SSukumar Swaminathan 		uint32_t	Revision:8;
180291a2b48SSukumar Swaminathan 		uint32_t	InId:24;
181fcf3ce44SJohn Forte 	} bits;
182291a2b48SSukumar Swaminathan 	uint32_t	word;
183fcf3ce44SJohn Forte } CtRevisionId_t;
184fcf3ce44SJohn Forte 
185291a2b48SSukumar Swaminathan typedef union CtCommandResponse
186291a2b48SSukumar Swaminathan {
187fcf3ce44SJohn Forte 	/* Structure is in Big Endian format */
188291a2b48SSukumar Swaminathan 	struct
189291a2b48SSukumar Swaminathan 	{
190291a2b48SSukumar Swaminathan 		uint32_t	CmdRsp:16;
191291a2b48SSukumar Swaminathan 		uint32_t	Size:16;
192fcf3ce44SJohn Forte 	} bits;
193291a2b48SSukumar Swaminathan 	uint32_t	word;
194fcf3ce44SJohn Forte } CtCommandResponse_t;
195fcf3ce44SJohn Forte 
196291a2b48SSukumar Swaminathan typedef struct SliCtRequest
197291a2b48SSukumar Swaminathan {
198fcf3ce44SJohn Forte 	/* Structure is in Big Endian format */
199291a2b48SSukumar Swaminathan 	CtRevisionId_t		RevisionId;
200291a2b48SSukumar Swaminathan 	uint8_t			FsType;
201291a2b48SSukumar Swaminathan 	uint8_t			FsSubType;
202291a2b48SSukumar Swaminathan 	uint8_t			Options;
203291a2b48SSukumar Swaminathan 	uint8_t			Rsrvd1;
204291a2b48SSukumar Swaminathan 	CtCommandResponse_t	CommandResponse;
205291a2b48SSukumar Swaminathan 	uint8_t			Rsrvd2;
206291a2b48SSukumar Swaminathan 	uint8_t			ReasonCode;
207291a2b48SSukumar Swaminathan 	uint8_t			Explanation;
208291a2b48SSukumar Swaminathan 	uint8_t			VendorUnique;
209291a2b48SSukumar Swaminathan 
210291a2b48SSukumar Swaminathan 	union
211291a2b48SSukumar Swaminathan 	{
212291a2b48SSukumar Swaminathan 		uint32_t	data;
213291a2b48SSukumar Swaminathan 		uint32_t	PortID;
214291a2b48SSukumar Swaminathan 
215291a2b48SSukumar Swaminathan 		struct gid
216291a2b48SSukumar Swaminathan 		{
217291a2b48SSukumar Swaminathan 			uint8_t	PortType;	/* for GID_PT requests */
218291a2b48SSukumar Swaminathan 			uint8_t	DomainScope;
219291a2b48SSukumar Swaminathan 			uint8_t	AreaScope;
220291a2b48SSukumar Swaminathan 			uint8_t	Fc4Type;	/* for GID_FT requests */
221fcf3ce44SJohn Forte 		} gid;
222291a2b48SSukumar Swaminathan 		struct rft
223291a2b48SSukumar Swaminathan 		{
224291a2b48SSukumar Swaminathan 			uint32_t	PortId;	/* For RFT_ID requests */
225fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
226291a2b48SSukumar Swaminathan 			uint32_t	rsvd0:16;
227291a2b48SSukumar Swaminathan 			uint32_t	rsvd1:7;
228291a2b48SSukumar Swaminathan 			uint32_t	fcpReg:1;	/* Type 8 */
229291a2b48SSukumar Swaminathan 			uint32_t	rsvd2:2;
230291a2b48SSukumar Swaminathan 			uint32_t	ipReg:1;	/* Type 5 */
231291a2b48SSukumar Swaminathan 			uint32_t	rsvd3:5;
232fcf3ce44SJohn Forte #endif
233fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
234291a2b48SSukumar Swaminathan 			uint32_t	rsvd0:16;
235291a2b48SSukumar Swaminathan 			uint32_t	fcpReg:1;	/* Type 8 */
236291a2b48SSukumar Swaminathan 			uint32_t	rsvd1:7;
237291a2b48SSukumar Swaminathan 			uint32_t	rsvd3:5;
238291a2b48SSukumar Swaminathan 			uint32_t	ipReg:1;	/* Type 5 */
239291a2b48SSukumar Swaminathan 			uint32_t	rsvd2:2;
240291a2b48SSukumar Swaminathan #endif
241291a2b48SSukumar Swaminathan 			uint32_t	rsvd[7];
242fcf3ce44SJohn Forte 		} rft;
243fcf3ce44SJohn Forte 
244291a2b48SSukumar Swaminathan 		struct rsnn
245291a2b48SSukumar Swaminathan 		{
246291a2b48SSukumar Swaminathan 			uint8_t		wwnn[8];
247291a2b48SSukumar Swaminathan 			uint8_t		snn_len;
248291a2b48SSukumar Swaminathan 			char		snn[256];
249fcf3ce44SJohn Forte 		} rsnn;
250fcf3ce44SJohn Forte 
251291a2b48SSukumar Swaminathan 		struct rspn
252291a2b48SSukumar Swaminathan 		{
253291a2b48SSukumar Swaminathan 			uint32_t	PortId;
254291a2b48SSukumar Swaminathan 			uint8_t		spn_len;
255291a2b48SSukumar Swaminathan 			char		spn[256];
256fcf3ce44SJohn Forte 		} rspn;
257fcf3ce44SJohn Forte 	} un;
258fcf3ce44SJohn Forte } SliCtRequest_t;
259fcf3ce44SJohn Forte typedef SliCtRequest_t SLI_CT_REQUEST;
260fcf3ce44SJohn Forte 
261291a2b48SSukumar Swaminathan #define	SLI_CT_REVISION	1
262fcf3ce44SJohn Forte 
263fcf3ce44SJohn Forte 
264fcf3ce44SJohn Forte /*
265fcf3ce44SJohn Forte  * FsType Definitions
266fcf3ce44SJohn Forte  */
267fcf3ce44SJohn Forte 
268291a2b48SSukumar Swaminathan #define	SLI_CT_MANAGEMENT_SERVICE		0xFA
269291a2b48SSukumar Swaminathan #define	SLI_CT_TIME_SERVICE			0xFB
270291a2b48SSukumar Swaminathan #define	SLI_CT_DIRECTORY_SERVICE		0xFC
271291a2b48SSukumar Swaminathan #define	SLI_CT_FABRIC_CONTROLLER_SERVICE	0xFD
272fcf3ce44SJohn Forte 
273fcf3ce44SJohn Forte /*
274fcf3ce44SJohn Forte  * Directory Service Subtypes
275fcf3ce44SJohn Forte  */
276fcf3ce44SJohn Forte 
277291a2b48SSukumar Swaminathan #define	SLI_CT_DIRECTORY_NAME_SERVER	0x02
278fcf3ce44SJohn Forte 
279fcf3ce44SJohn Forte /*
280fcf3ce44SJohn Forte  * Response Codes
281fcf3ce44SJohn Forte  */
282fcf3ce44SJohn Forte 
283291a2b48SSukumar Swaminathan #define	SLI_CT_RESPONSE_FS_RJT	0x8001
284291a2b48SSukumar Swaminathan #define	SLI_CT_RESPONSE_FS_ACC	0x8002
285fcf3ce44SJohn Forte 
286fcf3ce44SJohn Forte /*
287fcf3ce44SJohn Forte  * Reason Codes
288fcf3ce44SJohn Forte  */
289fcf3ce44SJohn Forte 
290291a2b48SSukumar Swaminathan #define	SLI_CT_NO_ADDITIONAL_EXPL		0x0
291291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_COMMAND			0x01
292291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_VERSION			0x02
293291a2b48SSukumar Swaminathan #define	SLI_CT_LOGICAL_ERROR			0x03
294291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_IU_SIZE			0x04
295291a2b48SSukumar Swaminathan #define	SLI_CT_LOGICAL_BUSY			0x05
296291a2b48SSukumar Swaminathan #define	SLI_CT_PROTOCOL_ERROR			0x07
297291a2b48SSukumar Swaminathan #define	SLI_CT_UNABLE_TO_PERFORM_REQ		0x09
298291a2b48SSukumar Swaminathan #define	SLI_CT_REQ_NOT_SUPPORTED		0x0b
299291a2b48SSukumar Swaminathan #define	SLI_CT_HBA_INFO_NOT_REGISTERED		0x10
300291a2b48SSukumar Swaminathan #define	SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE	0x11
301291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN	0x12
302291a2b48SSukumar Swaminathan #define	SLI_CT_HBA_ATTR_NOT_PRESENT		0x13
303291a2b48SSukumar Swaminathan #define	SLI_CT_PORT_INFO_NOT_REGISTERED		0x20
304291a2b48SSukumar Swaminathan #define	SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE	0x21
305291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN	0x22
306291a2b48SSukumar Swaminathan #define	SLI_CT_VENDOR_UNIQUE			0xff
307fcf3ce44SJohn Forte 
308fcf3ce44SJohn Forte /*
309fcf3ce44SJohn Forte  * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
310fcf3ce44SJohn Forte  */
311fcf3ce44SJohn Forte 
312291a2b48SSukumar Swaminathan #define	SLI_CT_NO_PORT_ID		0x01
313291a2b48SSukumar Swaminathan #define	SLI_CT_NO_PORT_NAME		0x02
314291a2b48SSukumar Swaminathan #define	SLI_CT_NO_NODE_NAME		0x03
315291a2b48SSukumar Swaminathan #define	SLI_CT_NO_CLASS_OF_SERVICE	0x04
316291a2b48SSukumar Swaminathan #define	SLI_CT_NO_IP_ADDRESS		0x05
317291a2b48SSukumar Swaminathan #define	SLI_CT_NO_IPA			0x06
318291a2b48SSukumar Swaminathan #define	SLI_CT_NO_FC4_TYPES		0x07
319291a2b48SSukumar Swaminathan #define	SLI_CT_NO_SYMBOLIC_PORT_NAME	0x08
320291a2b48SSukumar Swaminathan #define	SLI_CT_NO_SYMBOLIC_NODE_NAME	0x09
321291a2b48SSukumar Swaminathan #define	SLI_CT_NO_PORT_TYPE		0x0A
322291a2b48SSukumar Swaminathan #define	SLI_CT_ACCESS_DENIED		0x10
323291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_PORT_ID		0x11
324291a2b48SSukumar Swaminathan #define	SLI_CT_DATABASE_EMPTY		0x12
325fcf3ce44SJohn Forte 
326fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
327fcf3ce44SJohn Forte #define	CT_CMD_MASK	0xffff0000
328fcf3ce44SJohn Forte #endif
329fcf3ce44SJohn Forte 
330fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
331fcf3ce44SJohn Forte #define	CT_CMD_MASK	0xffff
332fcf3ce44SJohn Forte #endif
333fcf3ce44SJohn Forte 
334fcf3ce44SJohn Forte /*
335fcf3ce44SJohn Forte  * Management Server Interface Command Codes
336fcf3ce44SJohn Forte  */
337fcf3ce44SJohn Forte 
338291a2b48SSukumar Swaminathan #define	MS_GTIN		0x0100
339291a2b48SSukumar Swaminathan #define	MS_GIEL		0x0101
340291a2b48SSukumar Swaminathan #define	MS_GIET		0x0111
341291a2b48SSukumar Swaminathan #define	MS_GDID		0x0112
342291a2b48SSukumar Swaminathan #define	MS_GMID		0x0113
343291a2b48SSukumar Swaminathan #define	MS_GFN		0x0114
344291a2b48SSukumar Swaminathan #define	MS_GIELN	0x0115
345291a2b48SSukumar Swaminathan #define	MS_GMAL		0x0116
346291a2b48SSukumar Swaminathan #define	MS_GIEIL	0x0117
347291a2b48SSukumar Swaminathan #define	MS_GPL		0x0118
348291a2b48SSukumar Swaminathan #define	MS_GPT		0x0121
349291a2b48SSukumar Swaminathan #define	MS_GPPN		0x0122
350291a2b48SSukumar Swaminathan #define	MS_GAPNL	0x0124
351291a2b48SSukumar Swaminathan #define	MS_GPS		0x0126
352291a2b48SSukumar Swaminathan #define	MS_GPSC		0x0127
353291a2b48SSukumar Swaminathan #define	MS_GATIN	0x0128
354291a2b48SSukumar Swaminathan #define	MS_GSES		0x0130
355291a2b48SSukumar Swaminathan #define	MS_GPLNL	0x0191
356291a2b48SSukumar Swaminathan #define	MS_GPLT		0x0192
357291a2b48SSukumar Swaminathan #define	MS_GPLML	0x0193
358291a2b48SSukumar Swaminathan #define	MS_GPAB		0x0197
359291a2b48SSukumar Swaminathan #define	MS_GNPL		0x01A1
360291a2b48SSukumar Swaminathan #define	MS_GPNL		0x01A2
361291a2b48SSukumar Swaminathan #define	MS_GPFCP	0x01A4
362291a2b48SSukumar Swaminathan #define	MS_GPLI		0x01A5
363291a2b48SSukumar Swaminathan #define	MS_GNID		0x01B1
364291a2b48SSukumar Swaminathan #define	MS_RIELN	0x0215
365291a2b48SSukumar Swaminathan #define	MS_RPL		0x0280
366291a2b48SSukumar Swaminathan #define	MS_RPLN		0x0291
367291a2b48SSukumar Swaminathan #define	MS_RPLT		0x0292
368291a2b48SSukumar Swaminathan #define	MS_RPLM		0x0293
369291a2b48SSukumar Swaminathan #define	MS_RPAB		0x0298
370291a2b48SSukumar Swaminathan #define	MS_RPFCP	0x029A
371291a2b48SSukumar Swaminathan #define	MS_RPLI		0x029B
372291a2b48SSukumar Swaminathan #define	MS_DPL		0x0380
373291a2b48SSukumar Swaminathan #define	MS_DPLN		0x0391
374291a2b48SSukumar Swaminathan #define	MS_DPLM		0x0392
375291a2b48SSukumar Swaminathan #define	MS_DPLML	0x0393
376291a2b48SSukumar Swaminathan #define	MS_DPLI		0x0394
377291a2b48SSukumar Swaminathan #define	MS_DPAB		0x0395
378291a2b48SSukumar Swaminathan #define	MS_DPALL	0x039F
379fcf3ce44SJohn Forte 
380fcf3ce44SJohn Forte /*
381fcf3ce44SJohn Forte  * Name Server Command Codes
382fcf3ce44SJohn Forte  */
383291a2b48SSukumar Swaminathan #define	SLI_CTNS_GA_NXT		0x0100
384291a2b48SSukumar Swaminathan #define	SLI_CTNS_GPN_ID		0x0112
385291a2b48SSukumar Swaminathan #define	SLI_CTNS_GNN_ID		0x0113
386291a2b48SSukumar Swaminathan #define	SLI_CTNS_GCS_ID		0x0114
387291a2b48SSukumar Swaminathan #define	SLI_CTNS_GFT_ID		0x0117
388291a2b48SSukumar Swaminathan #define	SLI_CTNS_GSPN_ID	0x0118
389291a2b48SSukumar Swaminathan #define	SLI_CTNS_GPT_ID		0x011A
390291a2b48SSukumar Swaminathan #define	SLI_CTNS_GID_PN		0x0121
391291a2b48SSukumar Swaminathan #define	SLI_CTNS_GID_NN		0x0131
392291a2b48SSukumar Swaminathan #define	SLI_CTNS_GIP_NN		0x0135
393291a2b48SSukumar Swaminathan #define	SLI_CTNS_GIPA_NN	0x0136
394291a2b48SSukumar Swaminathan #define	SLI_CTNS_GSNN_NN	0x0139
395291a2b48SSukumar Swaminathan #define	SLI_CTNS_GNN_IP		0x0153
396291a2b48SSukumar Swaminathan #define	SLI_CTNS_GIPA_IP	0x0156
397291a2b48SSukumar Swaminathan #define	SLI_CTNS_GID_FT		0x0171
398291a2b48SSukumar Swaminathan #define	SLI_CTNS_GID_PT		0x01A1
399291a2b48SSukumar Swaminathan #define	SLI_CTNS_RPN_ID		0x0212
400291a2b48SSukumar Swaminathan #define	SLI_CTNS_RNN_ID		0x0213
401291a2b48SSukumar Swaminathan #define	SLI_CTNS_RCS_ID		0x0214
402291a2b48SSukumar Swaminathan #define	SLI_CTNS_RFT_ID		0x0217
403291a2b48SSukumar Swaminathan #define	SLI_CTNS_RSPN_ID	0x0218
404291a2b48SSukumar Swaminathan #define	SLI_CTNS_RPT_ID		0x021A
405291a2b48SSukumar Swaminathan #define	SLI_CTNS_RIP_NN		0x0235
406291a2b48SSukumar Swaminathan #define	SLI_CTNS_RIPA_NN	0x0236
407291a2b48SSukumar Swaminathan #define	SLI_CTNS_RSNN_NN	0x0239
408291a2b48SSukumar Swaminathan #define	SLI_CTNS_DA_ID		0x0300
409291a2b48SSukumar Swaminathan 
410291a2b48SSukumar Swaminathan #define	SLI_CT_LOOPBACK		0xFCFC
411fcf3ce44SJohn Forte 
412fcf3ce44SJohn Forte 
413fcf3ce44SJohn Forte /*
414fcf3ce44SJohn Forte  * Port Types
415fcf3ce44SJohn Forte  */
416fcf3ce44SJohn Forte 
417291a2b48SSukumar Swaminathan #define	SLI_CTPT_N_PORT		0x01
418291a2b48SSukumar Swaminathan #define	SLI_CTPT_NL_PORT	0x02
419291a2b48SSukumar Swaminathan #define	SLI_CTPT_FNL_PORT	0x03
420291a2b48SSukumar Swaminathan #define	SLI_CTPT_IP		0x04
421291a2b48SSukumar Swaminathan #define	SLI_CTPT_FCP		0x08
422291a2b48SSukumar Swaminathan #define	SLI_CTPT_NX_PORT	0x7F
423291a2b48SSukumar Swaminathan #define	SLI_CTPT_F_PORT		0x81
424291a2b48SSukumar Swaminathan #define	SLI_CTPT_FL_PORT	0x82
425291a2b48SSukumar Swaminathan #define	SLI_CTPT_E_PORT		0x84
426fcf3ce44SJohn Forte 
427fcf3ce44SJohn Forte #define	SLI_CT_LAST_ENTRY	0x80000000
428fcf3ce44SJohn Forte 
429fcf3ce44SJohn Forte /* ===================================================================== */
430fcf3ce44SJohn Forte 
431fcf3ce44SJohn Forte /*
432fcf3ce44SJohn Forte  * Start FireFly Register definitions
433fcf3ce44SJohn Forte  */
434fcf3ce44SJohn Forte 
435fcf3ce44SJohn Forte /* PCI register offsets */
436291a2b48SSukumar Swaminathan #define	MEM_ADDR_OFFSET	0x10	/* SLIM base memory address */
437fcf3ce44SJohn Forte #define	MEMH_OFFSET	0x14	/* SLIM base memory high address */
438291a2b48SSukumar Swaminathan #define	REG_ADDR_OFFSET	0x18	/* REGISTER base memory address */
439fcf3ce44SJohn Forte #define	REGH_OFFSET	0x1c	/* REGISTER base memory high address */
440291a2b48SSukumar Swaminathan #define	IO_ADDR_OFFSET	0x20	/* BIU I/O registers */
441291a2b48SSukumar Swaminathan #define	REGIOH_OFFSET	0x24	/* REGISTER base io high address */
442fcf3ce44SJohn Forte 
443291a2b48SSukumar Swaminathan #define	CMD_REG_OFFSET	0x4	/* PCI command configuration */
444fcf3ce44SJohn Forte 
445fcf3ce44SJohn Forte /* General PCI Register Definitions */
446fcf3ce44SJohn Forte /* Refer To The PCI Specification For Detailed Explanations */
447fcf3ce44SJohn Forte 
448291a2b48SSukumar Swaminathan #define	PCI_VENDOR_ID_REGISTER		0x00	/* PCI Vendor ID Reg */
449291a2b48SSukumar Swaminathan #define	PCI_DEVICE_ID_REGISTER		0x02	/* PCI Device ID Reg */
450fcf3ce44SJohn Forte #define	PCI_CONFIG_ID_REGISTER		0x00	/* PCI Configuration ID Reg */
451291a2b48SSukumar Swaminathan #define	PCI_COMMAND_REGISTER		0x04	/* PCI Command Reg */
452291a2b48SSukumar Swaminathan #define	PCI_STATUS_REGISTER		0x06	/* PCI Status Reg */
453291a2b48SSukumar Swaminathan #define	PCI_REV_ID_REGISTER		0x08	/* PCI Revision ID Reg */
454291a2b48SSukumar Swaminathan #define	PCI_CLASS_CODE_REGISTER		0x09	/* PCI Class Code Reg */
455291a2b48SSukumar Swaminathan #define	PCI_CACHE_LINE_REGISTER		0x0C	/* PCI Cache Line Reg */
456291a2b48SSukumar Swaminathan #define	PCI_LATENCY_TMR_REGISTER	0x0D	/* PCI Latency Timer Reg */
457291a2b48SSukumar Swaminathan #define	PCI_HEADER_TYPE_REGISTER	0x0E	/* PCI Header Type Reg */
458fcf3ce44SJohn Forte #define	PCI_BIST_REGISTER		0x0F	/* PCI Built-In SelfTest Reg */
459fcf3ce44SJohn Forte #define	PCI_BAR_0_REGISTER		0x10	/* PCI Base Address Reg 0 */
460fcf3ce44SJohn Forte #define	PCI_BAR_1_REGISTER		0x14	/* PCI Base Address Reg 1 */
461fcf3ce44SJohn Forte #define	PCI_BAR_2_REGISTER		0x18	/* PCI Base Address Reg 2 */
462fcf3ce44SJohn Forte #define	PCI_BAR_3_REGISTER		0x1C	/* PCI Base Address Reg 3 */
463fcf3ce44SJohn Forte #define	PCI_BAR_4_REGISTER		0x20	/* PCI Base Address Reg 4 */
464fcf3ce44SJohn Forte #define	PCI_BAR_5_REGISTER		0x24	/* PCI Base Address Reg 5 */
465fcf3ce44SJohn Forte #define	PCI_SSID_REGISTER		0x2C
466fcf3ce44SJohn Forte #define	PCI_SSVID_REGISTER		0x2C
467fcf3ce44SJohn Forte #define	PCI_SSDID_REGISTER		0x2E
468fcf3ce44SJohn Forte #define	PCI_EXPANSION_ROM		0x30	/* PCI Expansion ROM Base Reg */
469fcf3ce44SJohn Forte #define	PCI_CAP_POINTER			0x34
470fcf3ce44SJohn Forte 
471*8f23e9faSHans Rosenfeld /* PCI capatability registers are defined in pci.h */
472*8f23e9faSHans Rosenfeld #define	PCI_CAP_ID_SHIFT			0
473*8f23e9faSHans Rosenfeld #define	PCI_CAP_ID_MASK				0xff
474*8f23e9faSHans Rosenfeld #define	PCI_CAP_NEXT_PTR_SHIFT			8
475*8f23e9faSHans Rosenfeld #define	PCI_CAP_NEXT_PTR_MASK			0xff
476*8f23e9faSHans Rosenfeld 
477*8f23e9faSHans Rosenfeld /* PCI extended capatability registers are defined in pcie.h */
478*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_MAX_PTR		0x30
479*8f23e9faSHans Rosenfeld 
480*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_MRIOV		0x0000 /* ??? */
481*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_SRIOV		0x0010
482*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_11		0x0011
483*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_12		0x0012
484*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_13		0x0013
485*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_14		0x0014
486*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_15		0x0015
487*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_16		0x0016
488*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_TPH		0x0017
489*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_18		0x0018
490*8f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_SEC_PCI		0x0019
491*8f23e9faSHans Rosenfeld 
492*8f23e9faSHans Rosenfeld /* Vendor Specific (VS) register */
493*8f23e9faSHans Rosenfeld #define	PCI_VS_SLI_INTF_OFFSET	4
494fcf3ce44SJohn Forte 
495fcf3ce44SJohn Forte /* PCI access methods */
496fcf3ce44SJohn Forte #define	P_CONF_T1	1
497fcf3ce44SJohn Forte #define	P_CONF_T2	2
498fcf3ce44SJohn Forte 
499fcf3ce44SJohn Forte /* max number of pci buses */
500291a2b48SSukumar Swaminathan #define	MAX_PCI_BUSES	0xFF
501fcf3ce44SJohn Forte 
502fcf3ce44SJohn Forte /* number of PCI config bytes to access */
503fcf3ce44SJohn Forte #define	PCI_BYTE	1
504fcf3ce44SJohn Forte #define	PCI_WORD	2
505fcf3ce44SJohn Forte #define	PCI_DWORD	4
506fcf3ce44SJohn Forte 
507fcf3ce44SJohn Forte /* PCI related constants */
508fcf3ce44SJohn Forte #define	CMD_IO_ENBL	0x0001
509291a2b48SSukumar Swaminathan #define	CMD_MEM_ENBL	0x0002
510291a2b48SSukumar Swaminathan #define	CMD_BUS_MASTER	0x0004
511fcf3ce44SJohn Forte #define	CMD_MWI		0x0010
512291a2b48SSukumar Swaminathan #define	CMD_PARITY_CHK	0x0040
513291a2b48SSukumar Swaminathan #define	CMD_SERR_ENBL	0x0100
514fcf3ce44SJohn Forte 
515291a2b48SSukumar Swaminathan #define	CMD_CFG_VALUE	0x156	/* mem enable, master, MWI, SERR, PERR */
516fcf3ce44SJohn Forte 
517fcf3ce44SJohn Forte /* PCI addresses */
518fcf3ce44SJohn Forte #define	PCI_SPACE_ENABLE		0x0CF8
519fcf3ce44SJohn Forte #define	CF1_CONFIG_ADDR_REGISTER	0x0CF8
520fcf3ce44SJohn Forte #define	CF1_CONFIG_DATA_REGISTER	0x0CFC
521fcf3ce44SJohn Forte #define	CF2_FORWARD_REGISTER		0x0CFA
522fcf3ce44SJohn Forte #define	CF2_BASE_ADDRESS		0xC000
523fcf3ce44SJohn Forte 
524fcf3ce44SJohn Forte 
525291a2b48SSukumar Swaminathan #define	DEFAULT_PCI_LATENCY_CLOCKS	0xf8	/* 0xF8 is a special value */
526291a2b48SSukumar Swaminathan 						/* for FF11.1N6 firmware. */
527291a2b48SSukumar Swaminathan 						/* Use 0x80 for pre-FF11.1N6 */
528291a2b48SSukumar Swaminathan 						/* &N7, etc */
529fcf3ce44SJohn Forte #define	PCI_LATENCY_VALUE		0xf8
530fcf3ce44SJohn Forte 
531fcf3ce44SJohn Forte 
532fcf3ce44SJohn Forte 
533fcf3ce44SJohn Forte /* ==== Register Bit Definitions ==== */
534fcf3ce44SJohn Forte 
535fcf3ce44SJohn Forte /* Used by SBUS adapter */
536fcf3ce44SJohn Forte /* SBUS Control Register */
537fcf3ce44SJohn Forte #define	SBUS_CTRL_REG_OFFSET	0	/* Word offset from reg base addr */
538fcf3ce44SJohn Forte 
539fcf3ce44SJohn Forte #define	SBUS_CTRL_SBRST 	0x00000001	/* Bit  0 */
540fcf3ce44SJohn Forte #define	SBUS_CTRL_BKOFF 	0x00000002	/* Bit  1 */
541fcf3ce44SJohn Forte #define	SBUS_CTRL_ENP 		0x00000004	/* Bit  2 */
542fcf3ce44SJohn Forte #define	SBUS_CTRL_EN64		0x00000008	/* Bit  3 */
543291a2b48SSukumar Swaminathan #define	SBUS_CTRL_SIR_1 	0x00000010	/* Bit [6:4] IRL 1, */
544291a2b48SSukumar Swaminathan 						/* lowset priority */
545fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_2 	0x00000020
546fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_3 	0x00000030
547fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_4 	0x00000040
548fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_5 	0x00000050
549fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_6 	0x00000060
550fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_7 	0x00000070	/* IRL 7, highest priority */
551fcf3ce44SJohn Forte 
552fcf3ce44SJohn Forte /* SBUS Status Register */
553fcf3ce44SJohn Forte #define	SBUS_STAT_REG_OFFSET	1	/* Word offset from reg base addr */
554fcf3ce44SJohn Forte #define	SBUS_STAT_IP		0x00000001	/* Bit  0 */
555fcf3ce44SJohn Forte #define	SBUS_STAT_LERR		0x00000002	/* Bit  1 */
556fcf3ce44SJohn Forte #define	SBUS_STAT_SBPE		0x00000004	/* Bit  2 */
557fcf3ce44SJohn Forte #define	SBUS_STAT_TE		0x00000008	/* Bit  3 */
558fcf3ce44SJohn Forte #define	SBUS_STAT_WPE		0x00000010	/* Bit  4 */
559fcf3ce44SJohn Forte #define	SBUS_STAT_PERR		0x00000020	/* Bit  5 */
560fcf3ce44SJohn Forte #define	SBUS_STAT_SERR		0x00000040	/* Bit  6 */
561fcf3ce44SJohn Forte #define	SBUS_STAT_PTA		0x00000080	/* Bit  7 */
562fcf3ce44SJohn Forte 
563fcf3ce44SJohn Forte /* SBUS Update Register */
564fcf3ce44SJohn Forte #define	SBUS_UPDATE_REG_OFFSET	2	/* Word offfset from reg base addr */
565fcf3ce44SJohn Forte 
566fcf3ce44SJohn Forte #define	SBUS_UPDATE_DATA	0x00000001	/* Bit  0 */
567fcf3ce44SJohn Forte #define	SBUS_UPDATE_SPCLK	0x00000002	/* Bit  1 */
568fcf3ce44SJohn Forte #define	SBUS_UPDATE_SPCE	0x00000004	/* Bit  2 */
569fcf3ce44SJohn Forte #define	SBUS_UPDATE_SPRST	0x00000008	/* Bit  3 */
570fcf3ce44SJohn Forte #define	SBUS_UPDATE_SPWE	0x00000010	/* Bit  4 */
571fcf3ce44SJohn Forte #define	SBUS_UPDATE_LDFPGA	0x00000080	/* Bit  7 */
572fcf3ce44SJohn Forte 
573fcf3ce44SJohn Forte /* Host Attention Register */
574fcf3ce44SJohn Forte 
575fcf3ce44SJohn Forte #define	HA_REG_OFFSET  0	/* Word offset from register base address */
576fcf3ce44SJohn Forte 
577fcf3ce44SJohn Forte #define	HA_R0RE_REQ	0x00000001	/* Bit  0 */
578fcf3ce44SJohn Forte #define	HA_R0CE_RSP	0x00000002	/* Bit  1 */
579fcf3ce44SJohn Forte #define	HA_R0ATT	0x00000008	/* Bit  3 */
580fcf3ce44SJohn Forte #define	HA_R1RE_REQ	0x00000010	/* Bit  4 */
581fcf3ce44SJohn Forte #define	HA_R1CE_RSP	0x00000020	/* Bit  5 */
582fcf3ce44SJohn Forte #define	HA_R1ATT	0x00000080	/* Bit  7 */
583fcf3ce44SJohn Forte #define	HA_R2RE_REQ	0x00000100	/* Bit  8 */
584fcf3ce44SJohn Forte #define	HA_R2CE_RSP	0x00000200	/* Bit  9 */
585fcf3ce44SJohn Forte #define	HA_R2ATT	0x00000800	/* Bit 11 */
586fcf3ce44SJohn Forte #define	HA_R3RE_REQ	0x00001000	/* Bit 12 */
587fcf3ce44SJohn Forte #define	HA_R3CE_RSP	0x00002000	/* Bit 13 */
588fcf3ce44SJohn Forte #define	HA_R3ATT	0x00008000	/* Bit 15 */
589fcf3ce44SJohn Forte #define	HA_LATT		0x20000000	/* Bit 29 */
590fcf3ce44SJohn Forte #define	HA_MBATT	0x40000000	/* Bit 30 */
591fcf3ce44SJohn Forte #define	HA_ERATT	0x80000000	/* Bit 31 */
592fcf3ce44SJohn Forte 
593fcf3ce44SJohn Forte 
594fcf3ce44SJohn Forte #ifdef MSI_SUPPORT
595fcf3ce44SJohn Forte 
59682527734SSukumar Swaminathan 
597fcf3ce44SJohn Forte /* Host attention interrupt map */
598291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAP8	{0, HA_R0ATT, HA_R1ATT, HA_R2ATT, \
599291a2b48SSukumar Swaminathan 	HA_R3ATT, HA_LATT, HA_MBATT, HA_ERATT}
600291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAP4	{0, HA_R0ATT, HA_R1ATT, HA_R2ATT, 0, 0, 0, 0}
601291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAP2	{0, HA_R0ATT, 0, 0, 0, 0, 0, 0}
602291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAP1	{0, 0, 0, 0, 0, 0, 0, 0}
603fcf3ce44SJohn Forte 
604fcf3ce44SJohn Forte /* MSI 0 interrupt mask */
605291a2b48SSukumar Swaminathan #define	EMLXS_MSI0_MASK8	0
606291a2b48SSukumar Swaminathan #define	EMLXS_MSI0_MASK4	(HC_R3INT_ENA|HC_MBINT_ENA|HC_LAINT_ENA| \
607291a2b48SSukumar Swaminathan 				HC_ERINT_ENA)
608291a2b48SSukumar Swaminathan #define	EMLXS_MSI0_MASK2	(HC_R1INT_ENA|HC_R2INT_ENA|HC_R3INT_ENA| \
609291a2b48SSukumar Swaminathan 				HC_MBINT_ENA|HC_LAINT_ENA|HC_ERINT_ENA)
610291a2b48SSukumar Swaminathan #define	EMLXS_MSI0_MASK1	(HC_R0INT_ENA|HC_R1INT_ENA|HC_R2INT_ENA| \
611291a2b48SSukumar Swaminathan 				HC_R3INT_ENA|HC_MBINT_ENA|HC_LAINT_ENA| \
612291a2b48SSukumar Swaminathan 				HC_ERINT_ENA)
613fcf3ce44SJohn Forte 
614fcf3ce44SJohn Forte 
615291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAX_INTRS	8
616fcf3ce44SJohn Forte 
617291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODE1		0
618291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODE2		1
619291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODE4		2
620291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODE8		3
621291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODES		4
622fcf3ce44SJohn Forte 
623fcf3ce44SJohn Forte #endif	/* MSI_SUPPORT */
624fcf3ce44SJohn Forte 
625fcf3ce44SJohn Forte 
626291a2b48SSukumar Swaminathan #define	IO_THROTTLE_RESERVE	12
627fcf3ce44SJohn Forte 
628fcf3ce44SJohn Forte 
629fcf3ce44SJohn Forte 
630fcf3ce44SJohn Forte 
631fcf3ce44SJohn Forte /* Chip Attention Register */
632fcf3ce44SJohn Forte 
633291a2b48SSukumar Swaminathan #define	CA_REG_OFFSET	1	/* Word offset from register base address */
634fcf3ce44SJohn Forte 
635fcf3ce44SJohn Forte #define	CA_R0CE_REQ	0x00000001	/* Bit  0 */
636fcf3ce44SJohn Forte #define	CA_R0RE_RSP	0x00000002	/* Bit  1 */
637fcf3ce44SJohn Forte #define	CA_R0ATT	0x00000008	/* Bit  3 */
638fcf3ce44SJohn Forte #define	CA_R1CE_REQ	0x00000010	/* Bit  4 */
639fcf3ce44SJohn Forte #define	CA_R1RE_RSP	0x00000020	/* Bit  5 */
640fcf3ce44SJohn Forte #define	CA_R1ATT	0x00000080	/* Bit  7 */
641fcf3ce44SJohn Forte #define	CA_R2CE_REQ	0x00000100	/* Bit  8 */
642fcf3ce44SJohn Forte #define	CA_R2RE_RSP	0x00000200	/* Bit  9 */
643fcf3ce44SJohn Forte #define	CA_R2ATT	0x00000800	/* Bit 11 */
644fcf3ce44SJohn Forte #define	CA_R3CE_REQ	0x00001000	/* Bit 12 */
645fcf3ce44SJohn Forte #define	CA_R3RE_RSP	0x00002000	/* Bit 13 */
646fcf3ce44SJohn Forte #define	CA_R3ATT	0x00008000	/* Bit 15 */
647fcf3ce44SJohn Forte #define	CA_MBATT	0x40000000	/* Bit 30 */
648fcf3ce44SJohn Forte 
649fcf3ce44SJohn Forte /* Host Status Register */
650fcf3ce44SJohn Forte 
651291a2b48SSukumar Swaminathan #define	HS_REG_OFFSET	2	/* Word offset from register base address */
652fcf3ce44SJohn Forte 
653fcf3ce44SJohn Forte #define	HS_OVERTEMP	0x00000100	/* Bit 8 */
654fcf3ce44SJohn Forte #define	HS_MBRDY	0x00400000	/* Bit 22 */
655fcf3ce44SJohn Forte #define	HS_FFRDY	0x00800000	/* Bit 23 */
656fcf3ce44SJohn Forte #define	HS_FFER8	0x01000000	/* Bit 24 */
657fcf3ce44SJohn Forte #define	HS_FFER7	0x02000000	/* Bit 25 */
658fcf3ce44SJohn Forte #define	HS_FFER6	0x04000000	/* Bit 26 */
659fcf3ce44SJohn Forte #define	HS_FFER5	0x08000000	/* Bit 27 */
660fcf3ce44SJohn Forte #define	HS_FFER4	0x10000000	/* Bit 28 */
661fcf3ce44SJohn Forte #define	HS_FFER3	0x20000000	/* Bit 29 */
662fcf3ce44SJohn Forte #define	HS_FFER2	0x40000000	/* Bit 30 */
663fcf3ce44SJohn Forte #define	HS_FFER1	0x80000000	/* Bit 31 */
664fcf3ce44SJohn Forte #define	HS_FFERM	0xFF000000	/* Mask for error bits 31:24 */
665fcf3ce44SJohn Forte 
666fcf3ce44SJohn Forte /* Host Control Register */
667fcf3ce44SJohn Forte 
668291a2b48SSukumar Swaminathan #define	HC_REG_OFFSET	3	/* Word offset from register base address */
669fcf3ce44SJohn Forte 
670fcf3ce44SJohn Forte #define	HC_MBINT_ENA	0x00000001	/* Bit  0 */
671fcf3ce44SJohn Forte #define	HC_R0INT_ENA	0x00000002	/* Bit  1 */
672fcf3ce44SJohn Forte #define	HC_R1INT_ENA	0x00000004	/* Bit  2 */
673fcf3ce44SJohn Forte #define	HC_R2INT_ENA	0x00000008	/* Bit  3 */
674fcf3ce44SJohn Forte #define	HC_R3INT_ENA	0x00000010	/* Bit  4 */
675fcf3ce44SJohn Forte #define	HC_INITHBI	0x02000000	/* Bit 25 */
676fcf3ce44SJohn Forte #define	HC_INITMB	0x04000000	/* Bit 26 */
677fcf3ce44SJohn Forte #define	HC_INITFF	0x08000000	/* Bit 27 */
678fcf3ce44SJohn Forte #define	HC_LAINT_ENA	0x20000000	/* Bit 29 */
679fcf3ce44SJohn Forte #define	HC_ERINT_ENA	0x80000000	/* Bit 31 */
680fcf3ce44SJohn Forte 
681fcf3ce44SJohn Forte /* BIU Configuration Register */
682fcf3ce44SJohn Forte 
683291a2b48SSukumar Swaminathan #define	BC_REG_OFFSET	4	/* Word offset from register base address */
684fcf3ce44SJohn Forte 
685fcf3ce44SJohn Forte #define	BC_BSE		0x00000001	/* Bit 0 */
686fcf3ce44SJohn Forte #define	BC_BSE_SWAP	0x01000000	/* Bit 0 - swapped */
687fcf3ce44SJohn Forte 
688fcf3ce44SJohn Forte /*
689fcf3ce44SJohn Forte  * End FireFly Register definitions
690fcf3ce44SJohn Forte  */
691fcf3ce44SJohn Forte 
69282527734SSukumar Swaminathan /*
69382527734SSukumar Swaminathan  * Start SLI 4 section.
69482527734SSukumar Swaminathan  */
69582527734SSukumar Swaminathan 
69682527734SSukumar Swaminathan /* PCI Config Register offsets */
69782527734SSukumar Swaminathan #define	PCICFG_UE_STATUS_LO_OFFSET	0xA0	/* Error Indication - low */
69882527734SSukumar Swaminathan #define	PCICFG_UE_STATUS_HI_OFFSET	0xA4	/* Error Indication - high */
699fe199829SSukumar Swaminathan #define	PCICFG_UE_MASK_LO_OFFSET	0xA8	/* Error mask - low */
700fe199829SSukumar Swaminathan #define	PCICFG_UE_MASK_HI_OFFSET	0xAC	/* Error mask - high */
70182527734SSukumar Swaminathan #define	PCICFG_UE_STATUS_ONLINE1	0xB0	/* Error status1 */
70282527734SSukumar Swaminathan #define	PCICFG_UE_STATUS_ONLINE2	0xB4	/* Error status2 */
70382527734SSukumar Swaminathan 
70482527734SSukumar Swaminathan /* BAR1 and BAR2 register offsets */
70582527734SSukumar Swaminathan 
70682527734SSukumar Swaminathan /* BAR1 offsets for principal registers */
70782527734SSukumar Swaminathan #define	CSR_ISR0_OFFSET		0x0C18	/* CSR for EQ interrupt indications */
70882527734SSukumar Swaminathan #define	CSR_IMR0_OFFSET		0x0C48	/* CSR for EQ interrupt masking */
70982527734SSukumar Swaminathan #define	CSR_ISCR0_OFFSET	0x0C78	/* CSR for EQ interrupt clearing */
71082527734SSukumar Swaminathan 
71182527734SSukumar Swaminathan #define	ISR0_EQ0_INDC	0x00000001	/* Indication bit for EQ0 */
71282527734SSukumar Swaminathan #define	ISR0_EQ1_INDC	0x00000002	/* Indication bit for EQ1 */
71382527734SSukumar Swaminathan #define	ISR0_EQ2_INDC	0x00000004	/* Indication bit for EQ2 */
71482527734SSukumar Swaminathan #define	ISR0_EQ3_INDC	0x00000008	/* Indication bit for EQ3 */
71582527734SSukumar Swaminathan #define	ISR0_EQ4_INDC	0x00000010	/* Indication bit for EQ4 */
71682527734SSukumar Swaminathan #define	ISR0_EQ5_INDC	0x00000020	/* Indication bit for EQ5 */
71782527734SSukumar Swaminathan #define	ISR0_EQ6_INDC	0x00000040	/* Indication bit for EQ6 */
71882527734SSukumar Swaminathan #define	ISR0_EQ7_INDC	0x00000080	/* Indication bit for EQ7 */
71982527734SSukumar Swaminathan 
72082527734SSukumar Swaminathan /* MPU EP Semaphore register (ARM POST) */
72182527734SSukumar Swaminathan #define	CSR_MPU_EP_SEMAPHORE_OFFSET	0x00AC
72282527734SSukumar Swaminathan 
723*8f23e9faSHans Rosenfeld /* SLI Status register */
724*8f23e9faSHans Rosenfeld #define	SLI_STATUS_ERROR		0x80000000
725*8f23e9faSHans Rosenfeld #define	SLI_STATUS_BE			0x40000000
726*8f23e9faSHans Rosenfeld #define	SLI_STATUS_OTI			0x20000000
727*8f23e9faSHans Rosenfeld #define	SLI_STATUS_DUMP_LOCATION	0x04000000
728*8f23e9faSHans Rosenfeld #define	SLI_STATUS_DUMP_IMAGE_PRESENT	0x02000000
729*8f23e9faSHans Rosenfeld #define	SLI_STATUS_RESET_NEEDED		0x01000000
730*8f23e9faSHans Rosenfeld #define	SLI_STATUS_READY		0x00800000
731*8f23e9faSHans Rosenfeld #define	SLI_STATUS_INTERRUPT_DISABLE	0x00400000
732*8f23e9faSHans Rosenfeld 
733*8f23e9faSHans Rosenfeld /* SLI Control register */
734*8f23e9faSHans Rosenfeld #define	SLI_CNTL_BE		0x40000000
735*8f23e9faSHans Rosenfeld #define	SLI_CNTL_INIT_PORT	0x08000000
736*8f23e9faSHans Rosenfeld 
737*8f23e9faSHans Rosenfeld /* SLI PHYDEV Control register */
738*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RERROR	0x80000000
739*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_INP		0x40000000
740*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_IPLD		0x00008000
741*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_GPC		0x00004000
742*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_GP		0x00002000
743*8f23e9faSHans Rosenfeld 
744*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RC_MASK	0x00000700
745*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RC_UNKNOWN	0x00000000
746*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RC_PROFILE	0x00000100
747*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RC_FACTORY	0x00000200
748*8f23e9faSHans Rosenfeld 
749*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_FRL_MASK	0x000000F0
750*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_FRL_ALL	0x00000000
751*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_FRL_FCOE	0x00000010
752*8f23e9faSHans Rosenfeld 
753*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_LC		0x00000008
754*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_DD		0x00000004
755*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_FRST		0x00000002
756*8f23e9faSHans Rosenfeld #define	SLI_PHYDEV_DRST		0x00000001
757*8f23e9faSHans Rosenfeld 
75882527734SSukumar Swaminathan /* POST Stages of interest */
75982527734SSukumar Swaminathan #define	ARM_POST_FATAL	0x80000000
76082527734SSukumar Swaminathan #define	ARM_POST_READY	0xc000
76182527734SSukumar Swaminathan #define	ARM_POST_MASK	0xffff
762*8f23e9faSHans Rosenfeld #define	ARM_UNRECOVERABLE_ERROR	0xf000
76382527734SSukumar Swaminathan 
76482527734SSukumar Swaminathan #define	MPU_EP_DL	0x04000000	/* Driverloadedbitmask */
76582527734SSukumar Swaminathan #define	MPU_EP_ORI	0x08000000	/* OptionROMinstalledbitmask */
76682527734SSukumar Swaminathan #define	MPU_EP_IPC	0x10000000	/* IPaddressconflictmask */
76782527734SSukumar Swaminathan #define	MPU_EP_NIP	0x20000000	/* NoIPaddressmask */
76882527734SSukumar Swaminathan #define	MPU_EP_BFW	0x40000000	/* BackupFWinusemask */
76982527734SSukumar Swaminathan #define	MPU_EP_ERR	0x80000000	/* POSTfatalerrormask */
77082527734SSukumar Swaminathan 
77182527734SSukumar Swaminathan /* BAR2 offsets for principal doorbell registers */
77282527734SSukumar Swaminathan 
77382527734SSukumar Swaminathan #define	PD_RQ_DB_OFFSET	0x00A0	/* Doorbell notify of posted RQEs */
77482527734SSukumar Swaminathan #define	PD_WQ_DB_OFFSET	0x0040	/* Doorbell notify of posted WQEs */
77582527734SSukumar Swaminathan #define	PD_CQ_DB_OFFSET	0x0120	/* Doorbell notify of processed CQEs or EQEs */
77682527734SSukumar Swaminathan #define	PD_MQ_DB_OFFSET	0x0140	/* Doorbell notify of posted MQEs */
77782527734SSukumar Swaminathan #define	PD_MB_DB_OFFSET	0x0160	/* Doorbell Bootstrap Mailbox */
77882527734SSukumar Swaminathan 
779*8f23e9faSHans Rosenfeld #define	SLIPORT_SEMAPHORE_OFFSET	0x0400
780*8f23e9faSHans Rosenfeld #define	SLIPORT_STATUS_OFFSET		0x0404
781*8f23e9faSHans Rosenfeld #define	SLIPORT_CONTROL_OFFSET		0x0408
782*8f23e9faSHans Rosenfeld #define	SLIPORT_ERROR1_OFFSET		0x040C
783*8f23e9faSHans Rosenfeld #define	SLIPORT_ERROR2_OFFSET		0x0410
784*8f23e9faSHans Rosenfeld #define	PHYSDEV_CONTROL_OFFSET		0x0414
785*8f23e9faSHans Rosenfeld 
786*8f23e9faSHans Rosenfeld 
78782527734SSukumar Swaminathan /* Doorbell definitions */
78882527734SSukumar Swaminathan 
78982527734SSukumar Swaminathan /* Defines for MQ doorbell */
79082527734SSukumar Swaminathan #define	MQ_DB_POP_SHIFT 16		/* shift for entries popped */
79182527734SSukumar Swaminathan #define	MQ_DB_POP_MASK  0x1FFF0000	/* Mask for number of entries popped */
79282527734SSukumar Swaminathan 
79382527734SSukumar Swaminathan /* Defines for CQ doorbell */
79482527734SSukumar Swaminathan #define	CQ_DB_POP_SHIFT 16		/* shift for entries popped */
79582527734SSukumar Swaminathan #define	CQ_DB_POP_MASK  0x1FFF0000	/* Mask for number of entries popped */
79682527734SSukumar Swaminathan #define	CQ_DB_REARM	0x20000000	/* Bit 29, rearm */
79782527734SSukumar Swaminathan 
79882527734SSukumar Swaminathan /* Defines for EQ doorbell */
79982527734SSukumar Swaminathan #define	EQ_DB_CLEAR	0x00000200	/* Bit 9, designates clear EQ ISR */
80082527734SSukumar Swaminathan #define	EQ_DB_EVENT	0x00000400	/* Bit 10, designates EQ */
80182527734SSukumar Swaminathan #define	EQ_DB_POP_SHIFT 16		/* shift for entries popped */
80282527734SSukumar Swaminathan #define	EQ_DB_POP_MASK  0x1FFF0000	/* Mask for number of entries popped */
80382527734SSukumar Swaminathan #define	EQ_DB_REARM	0x20000000	/* Bit 29, rearm */
80482527734SSukumar Swaminathan 
80582527734SSukumar Swaminathan /* bootstrap mailbox doorbell defines */
80682527734SSukumar Swaminathan #define	BMBX_READY	0x00000001	/* Mask for Port Ready bit */
80782527734SSukumar Swaminathan #define	BMBX_ADDR_HI	0x00000002	/* Mask for Addr Hi bit */
80882527734SSukumar Swaminathan #define	BMBX_ADDR	0xFFFFFFFA	/* Mask for Addr bits */
80982527734SSukumar Swaminathan 
81082527734SSukumar Swaminathan /* Sizeof bootstrap mailbox */
81182527734SSukumar Swaminathan #define	EMLXS_BOOTSTRAP_MB_SIZE	256
81282527734SSukumar Swaminathan 
813*8f23e9faSHans Rosenfeld #define	FW_INITIALIZE_WORD0	0xFF1234FF /* Initialize bootstrap wd 0 */
814*8f23e9faSHans Rosenfeld #define	FW_INITIALIZE_WORD1	0xFF5678FF /* Initialize bootstrap wd 1 */
81582527734SSukumar Swaminathan 
816*8f23e9faSHans Rosenfeld #define	FW_DEINITIALIZE_WORD0	0xFFAABBFF /* DeInitialize bootstrap wd 0 */
817*8f23e9faSHans Rosenfeld #define	FW_DEINITIALIZE_WORD1	0xFFCCDDFF /* DeInitialize bootstrap wd 1 */
81882527734SSukumar Swaminathan 
819fcf3ce44SJohn Forte /* ===================================================================== */
820fcf3ce44SJohn Forte 
821fcf3ce44SJohn Forte /*
822fcf3ce44SJohn Forte  * Start of FCP specific structures
823fcf3ce44SJohn Forte  */
824fcf3ce44SJohn Forte 
825291a2b48SSukumar Swaminathan typedef struct emlxs_fcp_rsp
826291a2b48SSukumar Swaminathan {
827291a2b48SSukumar Swaminathan 	uint32_t	rspRsvd1;	/* FC Word 0, byte 0:3 */
828291a2b48SSukumar Swaminathan 	uint32_t	rspRsvd2;	/* FC Word 1, byte 0:3 */
829fcf3ce44SJohn Forte 
830291a2b48SSukumar Swaminathan 	uint8_t		rspStatus0;	/* FCP_STATUS byte 0 (reserved) */
831291a2b48SSukumar Swaminathan 	uint8_t		rspStatus1;	/* FCP_STATUS byte 1 (reserved) */
832291a2b48SSukumar Swaminathan 	uint8_t		rspStatus2;	/* FCP_STATUS byte 2 field validity */
833fcf3ce44SJohn Forte #define	RSP_LEN_VALID	0x01	/* bit 0 */
834fcf3ce44SJohn Forte #define	SNS_LEN_VALID	0x02	/* bit 1 */
835fcf3ce44SJohn Forte #define	RESID_OVER	0x04	/* bit 2 */
836fcf3ce44SJohn Forte #define	RESID_UNDER	0x08	/* bit 3 */
837291a2b48SSukumar Swaminathan 
838291a2b48SSukumar Swaminathan 	uint8_t		rspStatus3;	/* FCP_STATUS byte 3 SCSI status byte */
839fcf3ce44SJohn Forte #define	SCSI_STAT_GOOD		0x00
840fcf3ce44SJohn Forte #define	SCSI_STAT_CHECK_COND	0x02
841fcf3ce44SJohn Forte #define	SCSI_STAT_COND_MET	0x04
842fcf3ce44SJohn Forte #define	SCSI_STAT_BUSY		0x08
843fcf3ce44SJohn Forte #define	SCSI_STAT_INTERMED	0x10
844fcf3ce44SJohn Forte #define	SCSI_STAT_INTERMED_CM	0x14
845fcf3ce44SJohn Forte #define	SCSI_STAT_RES_CNFLCT	0x18
846fcf3ce44SJohn Forte #define	SCSI_STAT_CMD_TERM	0x22
847fcf3ce44SJohn Forte #define	SCSI_STAT_QUE_FULL	0x28
848fcf3ce44SJohn Forte #define	SCSI_STAT_ACA_ACTIVE	0x30
849fcf3ce44SJohn Forte #define	SCSI_STAT_TASK_ABORT	0x40
850fcf3ce44SJohn Forte 
851291a2b48SSukumar Swaminathan 	uint32_t	rspResId;	/* Residual xfer if RESID_xxxx set */
852291a2b48SSukumar Swaminathan 					/* in fcpStatus2. */
85382527734SSukumar Swaminathan 					/* Received in Big Endian format */
854291a2b48SSukumar Swaminathan 	uint32_t	rspSnsLen;	/* Length of sense data in fcpSnsInfo */
85582527734SSukumar Swaminathan 					/* Received in Big Endian format */
856291a2b48SSukumar Swaminathan 	uint32_t	rspRspLen;	/* Length of FCP response data */
857291a2b48SSukumar Swaminathan 					/* in fcpRspInfo */
85882527734SSukumar Swaminathan 					/* Received in Big Endian format */
859fcf3ce44SJohn Forte 
860291a2b48SSukumar Swaminathan 	uint8_t		rspInfo0;	/* FCP_RSP_INFO byte 0 (reserved) */
861291a2b48SSukumar Swaminathan 	uint8_t		rspInfo1;	/* FCP_RSP_INFO byte 1 (reserved) */
862291a2b48SSukumar Swaminathan 	uint8_t		rspInfo2;	/* FCP_RSP_INFO byte 2 (reserved) */
863291a2b48SSukumar Swaminathan 	uint8_t		rspInfo3;	/* FCP_RSP_INFO RSP_CODE byte 3 */
864fcf3ce44SJohn Forte 
865fcf3ce44SJohn Forte #define	RSP_NO_FAILURE		0x00
866fcf3ce44SJohn Forte #define	RSP_DATA_BURST_ERR	0x01
867fcf3ce44SJohn Forte #define	RSP_CMD_FIELD_ERR	0x02
868fcf3ce44SJohn Forte #define	RSP_RO_MISMATCH_ERR	0x03
869fcf3ce44SJohn Forte #define	RSP_TM_NOT_SUPPORTED	0x04	/* Task mgmt function not supported */
870fcf3ce44SJohn Forte #define	RSP_TM_NOT_COMPLETED	0x05	/* Task mgmt function not performed */
871fcf3ce44SJohn Forte 
872291a2b48SSukumar Swaminathan 	uint32_t	rspInfoRsvd;	/* FCP_RSP_INFO bytes 4-7 (reserved) */
873fcf3ce44SJohn Forte 
874fcf3ce44SJohn Forte 	/*
875291a2b48SSukumar Swaminathan 	 * Define maximum size of SCSI Sense buffer.
876291a2b48SSukumar Swaminathan 	 * Seagate never issues more than 18 bytes of Sense data
877fcf3ce44SJohn Forte 	 */
878291a2b48SSukumar Swaminathan #define	MAX_FCP_SNS	128
879291a2b48SSukumar Swaminathan 	uint8_t		rspSnsInfo[MAX_FCP_SNS];
880fcf3ce44SJohn Forte } emlxs_fcp_rsp;
881fcf3ce44SJohn Forte typedef emlxs_fcp_rsp FCP_RSP;
882fcf3ce44SJohn Forte 
883fcf3ce44SJohn Forte 
884291a2b48SSukumar Swaminathan typedef struct emlxs_fcp_cmd
885291a2b48SSukumar Swaminathan {
886291a2b48SSukumar Swaminathan 	uint32_t	fcpLunMsl;	/* most significant lun word */
887291a2b48SSukumar Swaminathan 	uint32_t	fcpLunLsl;	/* least significant lun word */
888fcf3ce44SJohn Forte 
889fcf3ce44SJohn Forte 	/*
890291a2b48SSukumar Swaminathan 	 * # of bits to shift lun id to end up in right payload word,
891291a2b48SSukumar Swaminathan 	 * little endian = 8, big = 16.
892fcf3ce44SJohn Forte 	 */
893fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
894fcf3ce44SJohn Forte #define	FC_LUN_SHIFT		8
895fcf3ce44SJohn Forte #define	FC_ADDR_MODE_SHIFT	0
896fcf3ce44SJohn Forte #endif
897fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
898fcf3ce44SJohn Forte #define	FC_LUN_SHIFT		16
899fcf3ce44SJohn Forte #define	FC_ADDR_MODE_SHIFT	24
900fcf3ce44SJohn Forte #endif
901fcf3ce44SJohn Forte 
902291a2b48SSukumar Swaminathan 	uint8_t		fcpCntl0;	/* FCP_CNTL byte 0 (reserved) */
903291a2b48SSukumar Swaminathan 	uint8_t		fcpCntl1;	/* FCP_CNTL byte 1 task codes */
904291a2b48SSukumar Swaminathan #define	SIMPLE_Q	0x00
905291a2b48SSukumar Swaminathan #define	HEAD_OF_Q	0x01
906291a2b48SSukumar Swaminathan #define	ORDERED_Q	0x02
907291a2b48SSukumar Swaminathan #define	ACA_Q		0x04
908291a2b48SSukumar Swaminathan #define	UNTAGGED	0x05
909291a2b48SSukumar Swaminathan 
910291a2b48SSukumar Swaminathan 	uint8_t		fcpCntl2;	/* FCP_CTL byte 2 task management */
911291a2b48SSukumar Swaminathan 					/* codes */
912291a2b48SSukumar Swaminathan #define	ABORT_TASK_SET	0x02	/* Bit 1 */
913291a2b48SSukumar Swaminathan #define	CLEAR_TASK_SET	0x04	/* bit 2 */
914291a2b48SSukumar Swaminathan #define	LUN_RESET	0x10	/* bit 4 */
915291a2b48SSukumar Swaminathan #define	TARGET_RESET	0x20	/* bit 5 */
916291a2b48SSukumar Swaminathan #define	CLEAR_ACA	0x40	/* bit 6 */
917291a2b48SSukumar Swaminathan #define	TERMINATE_TASK	0x80	/* bit 7 */
918291a2b48SSukumar Swaminathan 
919291a2b48SSukumar Swaminathan 	uint8_t		fcpCntl3;
920291a2b48SSukumar Swaminathan #define	WRITE_DATA	0x01	/* Bit 0 */
921291a2b48SSukumar Swaminathan #define	READ_DATA	0x02	/* Bit 1 */
922291a2b48SSukumar Swaminathan 
923291a2b48SSukumar Swaminathan 	uint8_t		fcpCdb[16];	/* SRB cdb field is copied here */
924291a2b48SSukumar Swaminathan 	uint32_t	fcpDl;	/* Total transfer length */
925fcf3ce44SJohn Forte } emlxs_fcp_cmd_t;
926fcf3ce44SJohn Forte typedef emlxs_fcp_cmd_t FCP_CMND;
927fcf3ce44SJohn Forte 
928fcf3ce44SJohn Forte 
929fcf3ce44SJohn Forte 
930fcf3ce44SJohn Forte 
931fcf3ce44SJohn Forte /* SCSI INQUIRY Command Structure */
932fcf3ce44SJohn Forte 
933291a2b48SSukumar Swaminathan typedef struct emlxs_inquiryDataType
934291a2b48SSukumar Swaminathan {
935291a2b48SSukumar Swaminathan 	uint8_t		DeviceType:5;
936291a2b48SSukumar Swaminathan 	uint8_t		DeviceTypeQualifier:3;
937291a2b48SSukumar Swaminathan 
938291a2b48SSukumar Swaminathan 	uint8_t		DeviceTypeModifier:7;
939291a2b48SSukumar Swaminathan 	uint8_t		RemovableMedia:1;
940291a2b48SSukumar Swaminathan 
941291a2b48SSukumar Swaminathan 	uint8_t		Versions;
942291a2b48SSukumar Swaminathan 	uint8_t		ResponseDataFormat;
943291a2b48SSukumar Swaminathan 	uint8_t		AdditionalLength;
944291a2b48SSukumar Swaminathan 	uint8_t		Reserved[2];
945291a2b48SSukumar Swaminathan 
946291a2b48SSukumar Swaminathan 	uint8_t		SoftReset:1;
947291a2b48SSukumar Swaminathan 	uint8_t		CommandQueue:1;
948291a2b48SSukumar Swaminathan 	uint8_t		Reserved2:1;
949291a2b48SSukumar Swaminathan 	uint8_t		LinkedCommands:1;
950291a2b48SSukumar Swaminathan 	uint8_t		Synchronous:1;
951291a2b48SSukumar Swaminathan 	uint8_t		Wide16Bit:1;
952291a2b48SSukumar Swaminathan 	uint8_t		Wide32Bit:1;
953291a2b48SSukumar Swaminathan 	uint8_t		RelativeAddressing:1;
954291a2b48SSukumar Swaminathan 
955291a2b48SSukumar Swaminathan 	uint8_t		VendorId[8];
956291a2b48SSukumar Swaminathan 	uint8_t		ProductId[16];
957291a2b48SSukumar Swaminathan 	uint8_t		ProductRevisionLevel[4];
958291a2b48SSukumar Swaminathan 	uint8_t		VendorSpecific[20];
959291a2b48SSukumar Swaminathan 	uint8_t		Reserved3[40];
960fcf3ce44SJohn Forte } emlxs_inquiry_data_type_t;
961fcf3ce44SJohn Forte typedef emlxs_inquiry_data_type_t INQUIRY_DATA_DEF;
962fcf3ce44SJohn Forte 
963fcf3ce44SJohn Forte 
964291a2b48SSukumar Swaminathan typedef struct emlxs_read_capacity_data
965291a2b48SSukumar Swaminathan {
966291a2b48SSukumar Swaminathan 	uint32_t	LogicalBlockAddress;
967291a2b48SSukumar Swaminathan 	uint32_t	BytesPerBlock;
968fcf3ce44SJohn Forte } emlxs_read_capacity_data_t;
969fcf3ce44SJohn Forte typedef emlxs_read_capacity_data_t READ_CAPACITY_DATA_DEF;
970fcf3ce44SJohn Forte 
971fcf3ce44SJohn Forte 
972fcf3ce44SJohn Forte /* SCSI CDB command codes */
973fcf3ce44SJohn Forte #define	FCP_SCSI_FORMAT_UNIT			0x04
974fcf3ce44SJohn Forte #define	FCP_SCSI_INQUIRY			0x12
975fcf3ce44SJohn Forte #define	FCP_SCSI_MODE_SELECT			0x15
976fcf3ce44SJohn Forte #define	FCP_SCSI_MODE_SENSE			0x1A
977fcf3ce44SJohn Forte #define	FCP_SCSI_PAUSE_RESUME			0x4B
978fcf3ce44SJohn Forte #define	FCP_SCSI_PLAY_AUDIO			0x45
979fcf3ce44SJohn Forte #define	FCP_SCSI_PLAY_AUDIO_EXT			0xA5
980fcf3ce44SJohn Forte #define	FCP_SCSI_PLAY_AUDIO_MSF			0x47
981fcf3ce44SJohn Forte #define	FCP_SCSI_PLAY_AUDIO_TRK_INDX		0x48
982fcf3ce44SJohn Forte #define	FCP_SCSI_PREVENT_ALLOW_REMOVAL		0x1E
983fcf3ce44SJohn Forte #define	FCP_SCSI_READ_CMD			0x08
984fcf3ce44SJohn Forte #define	FCP_SCSI_READ_BUFFER			0x3C
985fcf3ce44SJohn Forte #define	FCP_SCSI_READ_CAPACITY			0x25
986fcf3ce44SJohn Forte #define	FCP_SCSI_READ_DEFECT_LIST		0x37
987fcf3ce44SJohn Forte #define	FCP_SCSI_READ_EXTENDED			0x28
988fcf3ce44SJohn Forte #define	FCP_SCSI_READ_HEADER			0x44
989fcf3ce44SJohn Forte #define	FCP_SCSI_READ_LONG			0xE8
990fcf3ce44SJohn Forte #define	FCP_SCSI_READ_SUB_CHANNEL		0x42
991fcf3ce44SJohn Forte #define	FCP_SCSI_READ_TOC			0x43
992fcf3ce44SJohn Forte #define	FCP_SCSI_REASSIGN_BLOCK			0x07
993fcf3ce44SJohn Forte #define	FCP_SCSI_RECEIVE_DIAGNOSTIC_RESULTS	0x1C
994fcf3ce44SJohn Forte #define	FCP_SCSI_RELEASE_UNIT			0x17
995fcf3ce44SJohn Forte #define	FCP_SCSI_REPORT_LUNS			0xa0
996fcf3ce44SJohn Forte #define	FCP_SCSI_REQUEST_SENSE			0x03
997fcf3ce44SJohn Forte #define	FCP_SCSI_RESERVE_UNIT			0x16
998fcf3ce44SJohn Forte #define	FCP_SCSI_REZERO_UNIT			0x01
999fcf3ce44SJohn Forte #define	FCP_SCSI_SEEK				0x0B
1000fcf3ce44SJohn Forte #define	FCP_SCSI_SEEK_EXTENDED			0x2B
1001fcf3ce44SJohn Forte #define	FCP_SCSI_SEND_DIAGNOSTIC		0x1D
1002fcf3ce44SJohn Forte #define	FCP_SCSI_START_STOP_UNIT		0x1B
1003fcf3ce44SJohn Forte #define	FCP_SCSI_TEST_UNIT_READY		0x00
1004fcf3ce44SJohn Forte #define	FCP_SCSI_VERIFY				0x2F
1005fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_CMD			0x0A
1006fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_AND_VERIFY		0x2E
1007fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_BUFFER			0x3B
1008fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_EXTENDED			0x2A
1009fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_LONG			0xEA
1010fcf3ce44SJohn Forte #define	FCP_SCSI_RELEASE_LUNR			0xBB
1011fcf3ce44SJohn Forte #define	FCP_SCSI_RELEASE_LUNV			0xBF
1012fcf3ce44SJohn Forte 
1013fcf3ce44SJohn Forte #define	HPVA_SETPASSTHROUGHMODE			0x27
1014fcf3ce44SJohn Forte #define	HPVA_EXECUTEPASSTHROUGH			0x29
1015fcf3ce44SJohn Forte #define	HPVA_CREATELUN				0xE2
1016fcf3ce44SJohn Forte #define	HPVA_SETLUNSECURITYLIST			0xED
1017fcf3ce44SJohn Forte #define	HPVA_SETCLOCK				0xF9
1018fcf3ce44SJohn Forte #define	HPVA_RECOVER				0xFA
1019fcf3ce44SJohn Forte #define	HPVA_GENERICSERVICEOUT			0xFD
1020fcf3ce44SJohn Forte 
1021fcf3ce44SJohn Forte #define	DMEP_EXPORT_IN				0x85
1022fcf3ce44SJohn Forte #define	DMEP_EXPORT_OUT				0x89
1023fcf3ce44SJohn Forte 
1024fcf3ce44SJohn Forte #define	MDACIOCTL_DIRECT_CMD			0x22
1025fcf3ce44SJohn Forte #define	MDACIOCTL_STOREIMAGE			0x2C
1026fcf3ce44SJohn Forte #define	MDACIOCTL_WRITESIGNATURE		0xA6
1027fcf3ce44SJohn Forte #define	MDACIOCTL_SETREALTIMECLOCK		0xAC
1028fcf3ce44SJohn Forte #define	MDACIOCTL_PASS_THRU_CDB			0xAD
1029fcf3ce44SJohn Forte #define	MDACIOCTL_PASS_THRU_INITIATE		0xAE
1030fcf3ce44SJohn Forte #define	MDACIOCTL_CREATENEWCONF			0xC0
1031fcf3ce44SJohn Forte #define	MDACIOCTL_ADDNEWCONF			0xC4
1032fcf3ce44SJohn Forte #define	MDACIOCTL_MORE				0xC6
1033fcf3ce44SJohn Forte #define	MDACIOCTL_SETPHYSDEVPARAMETER		0xC8
1034fcf3ce44SJohn Forte #define	MDACIOCTL_SETLOGDEVPARAMETER		0xCF
1035fcf3ce44SJohn Forte #define	MDACIOCTL_SETCONTROLLERPARAMETER	0xD1
1036fcf3ce44SJohn Forte #define	MDACIOCTL_WRITESANMAP			0xD4
1037fcf3ce44SJohn Forte #define	MDACIOCTL_SETMACADDRESS			0xD5
1038fcf3ce44SJohn Forte 
1039fcf3ce44SJohn Forte /*
1040fcf3ce44SJohn Forte  * End of FCP specific structures
1041fcf3ce44SJohn Forte  */
1042fcf3ce44SJohn Forte 
1043291a2b48SSukumar Swaminathan #define	FL_ALPA		0x00	/* AL_PA of FL_Port */
1044fcf3ce44SJohn Forte 
1045fcf3ce44SJohn Forte /* Fibre Channel Service Parameter definitions */
1046fcf3ce44SJohn Forte 
1047291a2b48SSukumar Swaminathan #define	FC_PH_4_0	6	/* FC-PH version 4.0 */
1048291a2b48SSukumar Swaminathan #define	FC_PH_4_1	7	/* FC-PH version 4.1 */
1049291a2b48SSukumar Swaminathan #define	FC_PH_4_2	8	/* FC-PH version 4.2 */
1050291a2b48SSukumar Swaminathan #define	FC_PH_4_3	9	/* FC-PH version 4.3 */
1051fcf3ce44SJohn Forte 
1052291a2b48SSukumar Swaminathan #define	FC_PH_LOW	8	/* Lowest supported FC-PH version */
1053291a2b48SSukumar Swaminathan #define	FC_PH_HIGH	9	/* Highest supported FC-PH version */
1054291a2b48SSukumar Swaminathan #define	FC_PH3		0x20	/* FC-PH-3 version */
1055fcf3ce44SJohn Forte 
1056291a2b48SSukumar Swaminathan #define	FF_FRAME_SIZE	2048
1057fcf3ce44SJohn Forte 
1058fcf3ce44SJohn Forte 
1059291a2b48SSukumar Swaminathan typedef struct emlxs_rings
1060291a2b48SSukumar Swaminathan {
1061fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1062291a2b48SSukumar Swaminathan 	uint32_t	crReserved:16;
1063291a2b48SSukumar Swaminathan 	uint32_t	crBegin:8;
1064291a2b48SSukumar Swaminathan 	uint32_t	crEnd:8;	/* Low order bit first word */
1065291a2b48SSukumar Swaminathan 	uint32_t	rrReserved:16;
1066291a2b48SSukumar Swaminathan 	uint32_t	rrBegin:8;
1067291a2b48SSukumar Swaminathan 	uint32_t	rrEnd:8;	/* Low order bit second word */
1068fcf3ce44SJohn Forte #endif
1069fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1070291a2b48SSukumar Swaminathan 	uint32_t	crEnd:8;	/* Low order bit first word */
1071291a2b48SSukumar Swaminathan 	uint32_t	crBegin:8;
1072291a2b48SSukumar Swaminathan 	uint32_t	crReserved:16;
1073291a2b48SSukumar Swaminathan 	uint32_t	rrEnd:8;	/* Low order bit second word */
1074291a2b48SSukumar Swaminathan 	uint32_t	rrBegin:8;
1075291a2b48SSukumar Swaminathan 	uint32_t	rrReserved:16;
1076fcf3ce44SJohn Forte #endif
1077fcf3ce44SJohn Forte } emlxs_rings_t;
1078fcf3ce44SJohn Forte typedef emlxs_rings_t RINGS;
1079fcf3ce44SJohn Forte 
1080fcf3ce44SJohn Forte 
1081291a2b48SSukumar Swaminathan typedef struct emlxs_ring_def
1082291a2b48SSukumar Swaminathan {
1083fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1084291a2b48SSukumar Swaminathan 	uint16_t	offCiocb;
1085291a2b48SSukumar Swaminathan 	uint16_t	numCiocb;
1086291a2b48SSukumar Swaminathan 	uint16_t	offRiocb;
1087291a2b48SSukumar Swaminathan 	uint16_t	numRiocb;
1088fcf3ce44SJohn Forte #endif
1089fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1090291a2b48SSukumar Swaminathan 	uint16_t	numCiocb;
1091291a2b48SSukumar Swaminathan 	uint16_t	offCiocb;
1092291a2b48SSukumar Swaminathan 	uint16_t	numRiocb;
1093291a2b48SSukumar Swaminathan 	uint16_t	offRiocb;
1094fcf3ce44SJohn Forte #endif
1095fcf3ce44SJohn Forte } emlxs_ring_def_t;
1096fcf3ce44SJohn Forte typedef emlxs_ring_def_t RING_DEF;
1097fcf3ce44SJohn Forte 
1098fcf3ce44SJohn Forte /*
1099fcf3ce44SJohn Forte  * The following F.C. frame stuctures are defined in Big Endian format.
1100fcf3ce44SJohn Forte  */
1101fcf3ce44SJohn Forte 
1102291a2b48SSukumar Swaminathan typedef struct emlxs_name_type
1103291a2b48SSukumar Swaminathan {
1104fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1105291a2b48SSukumar Swaminathan 	uint8_t		nameType:4;	/* FC Word 0, bit 28:31 */
1106291a2b48SSukumar Swaminathan 	uint8_t		IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit 8:11 */
1107291a2b48SSukumar Swaminathan 					/* of IEEE ext */
1108fcf3ce44SJohn Forte #endif
1109fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1110291a2b48SSukumar Swaminathan 	uint8_t		IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit 8:11 */
1111291a2b48SSukumar Swaminathan 					/* of IEEE ext */
1112291a2b48SSukumar Swaminathan 	uint8_t		nameType:4;	/* FC Word 0, bit 28:31 */
1113fcf3ce44SJohn Forte #endif
1114fcf3ce44SJohn Forte #define	NAME_IEEE		0x1	/* IEEE name - nameType */
1115fcf3ce44SJohn Forte #define	NAME_IEEE_EXT		0x2	/* IEEE extended name */
1116fcf3ce44SJohn Forte #define	NAME_FC_TYPE		0x3	/* FC native name type */
1117fcf3ce44SJohn Forte #define	NAME_IP_TYPE		0x4	/* IP address */
1118fcf3ce44SJohn Forte #define	NAME_CCITT_TYPE		0xC
1119fcf3ce44SJohn Forte #define	NAME_CCITT_GR_TYPE	0xE
1120291a2b48SSukumar Swaminathan 	uint8_t		IEEEextLsb;	/* FC Word 0, bit 16:23, */
1121291a2b48SSukumar Swaminathan 					/* IEEE extended Lsb */
1122291a2b48SSukumar Swaminathan 	uint8_t		IEEE[6];	/* FC IEEE address */
1123fcf3ce44SJohn Forte } emlxs_name_type_t;
1124fcf3ce44SJohn Forte typedef emlxs_name_type_t NAME_TYPE;
1125fcf3ce44SJohn Forte 
1126fcf3ce44SJohn Forte 
1127*8f23e9faSHans Rosenfeld /*
1128*8f23e9faSHans Rosenfeld  * Word 1 Bit 31 in common service parameter is overloaded.
1129*8f23e9faSHans Rosenfeld  * Word 1 Bit 31 in FLOGI/FDISC request is multiple NPort request
1130*8f23e9faSHans Rosenfeld  * Word 1 Bit 31 in FLOGI/FDISC response is clean address bit
1131*8f23e9faSHans Rosenfeld  */
1132*8f23e9faSHans Rosenfeld #define	CLEAN_ADDRESS_BIT reqMultipleNPort /* Word 1, bit 31 */
1133*8f23e9faSHans Rosenfeld 
1134291a2b48SSukumar Swaminathan typedef struct emlxs_csp
1135291a2b48SSukumar Swaminathan {
1136291a2b48SSukumar Swaminathan 	uint8_t		fcphHigh;		/* FC Word 0, byte 0 */
1137291a2b48SSukumar Swaminathan 	uint8_t		fcphLow;
1138291a2b48SSukumar Swaminathan 	uint8_t		bbCreditMsb;
1139291a2b48SSukumar Swaminathan 	uint8_t		bbCreditlsb;		/* FC Word 0, byte 3 */
1140fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1141291a2b48SSukumar Swaminathan 	uint16_t	reqMultipleNPort:1;	/* FC Word 1, bit 31 */
1142291a2b48SSukumar Swaminathan 	uint16_t	randomOffset:1;		/* FC Word 1, bit 30 */
1143291a2b48SSukumar Swaminathan 	uint16_t	rspMultipleNPort:1;	/* FC Word 1, bit 29 */
1144291a2b48SSukumar Swaminathan 	uint16_t	fPort:1;		/* FC Word 1, bit 28 */
1145291a2b48SSukumar Swaminathan 	uint16_t	altBbCredit:1;		/* FC Word 1, bit 27 */
1146291a2b48SSukumar Swaminathan 	uint16_t	edtovResolution:1;	/* FC Word 1, bit 26 */
1147291a2b48SSukumar Swaminathan 	uint16_t	multicast:1;		/* FC Word 1, bit 25 */
1148291a2b48SSukumar Swaminathan 	uint16_t	broadcast:1;		/* FC Word 1, bit 24 */
1149291a2b48SSukumar Swaminathan 
1150291a2b48SSukumar Swaminathan 	uint16_t	huntgroup:1;		/* FC Word 1, bit 23 */
1151291a2b48SSukumar Swaminathan 	uint16_t	simplex:1;		/* FC Word 1, bit 22 */
1152291a2b48SSukumar Swaminathan 
1153291a2b48SSukumar Swaminathan 	uint16_t	fcsp_support:1;		/* FC Word 1, bit 21 */
1154291a2b48SSukumar Swaminathan 	uint16_t	word1Reserved20:1;	/* FC Word 1, bit 20 */
1155291a2b48SSukumar Swaminathan 	uint16_t	word1Reserved19:1;	/* FC Word 1, bit 19 */
1156291a2b48SSukumar Swaminathan 
1157291a2b48SSukumar Swaminathan 	uint16_t	dhd:1;			/* FC Word 1, bit 18 */
1158291a2b48SSukumar Swaminathan 	uint16_t	contIncSeqCnt:1;	/* FC Word 1, bit 17 */
1159291a2b48SSukumar Swaminathan 	uint16_t	payloadlength:1;	/* FC Word 1, bit 16 */
1160fcf3ce44SJohn Forte #endif
1161fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1162291a2b48SSukumar Swaminathan 	uint16_t	broadcast:1;		/* FC Word 1, bit 24 */
1163291a2b48SSukumar Swaminathan 	uint16_t	multicast:1;		/* FC Word 1, bit 25 */
1164291a2b48SSukumar Swaminathan 	uint16_t	edtovResolution:1;	/* FC Word 1, bit 26 */
1165291a2b48SSukumar Swaminathan 	uint16_t	altBbCredit:1;		/* FC Word 1, bit 27 */
1166291a2b48SSukumar Swaminathan 	uint16_t	fPort:1;		/* FC Word 1, bit 28 */
1167291a2b48SSukumar Swaminathan 	uint16_t	rspMultipleNPort:1;	/* FC Word 1, bit 29 */
1168291a2b48SSukumar Swaminathan 	uint16_t	randomOffset:1;		/* FC Word 1, bit 30 */
1169291a2b48SSukumar Swaminathan 	uint16_t	reqMultipleNPort:1;	/* FC Word 1, bit 31 */
1170291a2b48SSukumar Swaminathan 
1171291a2b48SSukumar Swaminathan 	uint16_t	payloadlength:1;	/* FC Word 1, bit 16 */
1172291a2b48SSukumar Swaminathan 	uint16_t	contIncSeqCnt:1;	/* FC Word 1, bit 17 */
1173291a2b48SSukumar Swaminathan 	uint16_t	dhd:1;			/* FC Word 1, bit 18 */
1174291a2b48SSukumar Swaminathan 
1175291a2b48SSukumar Swaminathan 	uint16_t	word1Reserved19:1;	/* FC Word 1, bit 19 */
1176291a2b48SSukumar Swaminathan 	uint16_t	word1Reserved20:1;	/* FC Word 1, bit 20 */
1177291a2b48SSukumar Swaminathan 	uint16_t	fcsp_support:1;		/* FC Word 1, bit 21 */
1178291a2b48SSukumar Swaminathan 
1179291a2b48SSukumar Swaminathan 	uint16_t	simplex:1;		/* FC Word 1, bit 22 */
1180291a2b48SSukumar Swaminathan 	uint16_t	huntgroup:1;		/* FC Word 1, bit 23 */
1181291a2b48SSukumar Swaminathan #endif
1182291a2b48SSukumar Swaminathan 	uint8_t		bbRcvSizeMsb;		/* Upper nibble is reserved */
1183291a2b48SSukumar Swaminathan 	uint8_t		bbRcvSizeLsb;		/* FC Word 1, byte 3 */
1184291a2b48SSukumar Swaminathan 	union
1185291a2b48SSukumar Swaminathan 	{
1186291a2b48SSukumar Swaminathan 		struct
1187291a2b48SSukumar Swaminathan 		{
1188291a2b48SSukumar Swaminathan 			uint8_t	word2Reserved1;	/* FC Word 2 byte 0 */
1189291a2b48SSukumar Swaminathan 
1190291a2b48SSukumar Swaminathan 			uint8_t	totalConcurrSeq; /* FC Word 2 byte 1 */
1191291a2b48SSukumar Swaminathan 			uint8_t	roByCategoryMsb; /* FC Word 2 byte 2 */
1192291a2b48SSukumar Swaminathan 
1193291a2b48SSukumar Swaminathan 			uint8_t	roByCategoryLsb; /* FC Word 2 byte 3 */
1194fcf3ce44SJohn Forte 		} nPort;
1195291a2b48SSukumar Swaminathan 		uint32_t	r_a_tov;	/* R_A_TOV must be in Big */
1196291a2b48SSukumar Swaminathan 						/* Endian format */
1197fcf3ce44SJohn Forte 	} w2;
1198fcf3ce44SJohn Forte 
1199291a2b48SSukumar Swaminathan 	uint32_t	e_d_tov;		/* E_D_TOV must be in Big */
1200291a2b48SSukumar Swaminathan 						/* Endian format */
1201fcf3ce44SJohn Forte } emlxs_csp_t;
1202fcf3ce44SJohn Forte typedef emlxs_csp_t CSP;
1203fcf3ce44SJohn Forte 
1204fcf3ce44SJohn Forte 
1205291a2b48SSukumar Swaminathan typedef struct emlxs_class_parms
1206291a2b48SSukumar Swaminathan {
1207fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1208291a2b48SSukumar Swaminathan 	uint8_t	classValid:1;		/* FC Word 0, bit 31 */
1209291a2b48SSukumar Swaminathan 	uint8_t	intermix:1;		/* FC Word 0, bit 30 */
1210291a2b48SSukumar Swaminathan 	uint8_t	stackedXparent:1;	/* FC Word 0, bit 29 */
1211291a2b48SSukumar Swaminathan 	uint8_t	stackedLockDown:1;	/* FC Word 0, bit 28 */
1212291a2b48SSukumar Swaminathan 	uint8_t	seqDelivery:1;		/* FC Word 0, bit 27 */
1213291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved1:3;	/* FC Word 0, bit 24:26 */
1214fcf3ce44SJohn Forte #endif
1215fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1216291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved1:3;	/* FC Word 0, bit 24:26 */
1217291a2b48SSukumar Swaminathan 	uint8_t	seqDelivery:1;		/* FC Word 0, bit 27 */
1218291a2b48SSukumar Swaminathan 	uint8_t	stackedLockDown:1;	/* FC Word 0, bit 28 */
1219291a2b48SSukumar Swaminathan 	uint8_t	stackedXparent:1;	/* FC Word 0, bit 29 */
1220291a2b48SSukumar Swaminathan 	uint8_t	intermix:1;		/* FC Word 0, bit 30 */
1221291a2b48SSukumar Swaminathan 	uint8_t	classValid:1;		/* FC Word 0, bit 31 */
1222fcf3ce44SJohn Forte 
1223fcf3ce44SJohn Forte #endif
1224291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved2;		/* FC Word 0, bit 16:23 */
1225fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1226291a2b48SSukumar Swaminathan 	uint8_t	iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
1227291a2b48SSukumar Swaminathan 	uint8_t	iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
1228291a2b48SSukumar Swaminathan 	uint8_t	iCtlAck0capable:1;	/* FC Word 0, bit 11 */
1229291a2b48SSukumar Swaminathan 	uint8_t	iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
1230291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
1231fcf3ce44SJohn Forte #endif
1232fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1233291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
1234291a2b48SSukumar Swaminathan 	uint8_t	iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
1235291a2b48SSukumar Swaminathan 	uint8_t	iCtlAck0capable:1;	/* FC Word 0, bit 11 */
1236291a2b48SSukumar Swaminathan 	uint8_t	iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
1237291a2b48SSukumar Swaminathan 	uint8_t	iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
1238fcf3ce44SJohn Forte #endif
1239291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved4;		/* FC Word 0, bit  0: 7 */
1240fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1241291a2b48SSukumar Swaminathan 	uint8_t	rCtlAck0capable:1;	/* FC Word 1, bit 31 */
1242291a2b48SSukumar Swaminathan 	uint8_t	rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
1243291a2b48SSukumar Swaminathan 	uint8_t	rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
1244291a2b48SSukumar Swaminathan 	uint8_t	rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
1245291a2b48SSukumar Swaminathan 	uint8_t	word1Reserved1:1;	/* FC Word 1, bit 26 */
1246291a2b48SSukumar Swaminathan 	uint8_t	rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
1247fcf3ce44SJohn Forte #endif
1248fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1249291a2b48SSukumar Swaminathan 	uint8_t	rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
1250291a2b48SSukumar Swaminathan 	uint8_t	word1Reserved1:1;	/* FC Word 1, bit 26 */
1251291a2b48SSukumar Swaminathan 	uint8_t	rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
1252291a2b48SSukumar Swaminathan 	uint8_t	rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
1253291a2b48SSukumar Swaminathan 	uint8_t	rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
1254291a2b48SSukumar Swaminathan 	uint8_t	rCtlAck0capable:1;	/* FC Word 1, bit 31 */
1255291a2b48SSukumar Swaminathan #endif
1256291a2b48SSukumar Swaminathan 	uint8_t	word1Reserved2;		/* FC Word 1, bit 16:23 */
1257291a2b48SSukumar Swaminathan 	uint8_t	rcvDataSizeMsb;		/* FC Word 1, bit  8:15 */
1258291a2b48SSukumar Swaminathan 	uint8_t	rcvDataSizeLsb;		/* FC Word 1, bit  0: 7 */
1259291a2b48SSukumar Swaminathan 
1260291a2b48SSukumar Swaminathan 	uint8_t	concurrentSeqMsb;	/* FC Word 2, bit 24:31 */
1261291a2b48SSukumar Swaminathan 	uint8_t	concurrentSeqLsb;	/* FC Word 2, bit 16:23 */
1262291a2b48SSukumar Swaminathan 	uint8_t	EeCreditSeqMsb;		/* FC Word 2, bit  8:15 */
1263291a2b48SSukumar Swaminathan 	uint8_t	EeCreditSeqLsb;		/* FC Word 2, bit  0: 7 */
1264291a2b48SSukumar Swaminathan 
1265291a2b48SSukumar Swaminathan 	uint8_t	openSeqPerXchgMsb;	/* FC Word 3, bit 24:31 */
1266291a2b48SSukumar Swaminathan 	uint8_t	openSeqPerXchgLsb;	/* FC Word 3, bit 16:23 */
1267291a2b48SSukumar Swaminathan 	uint8_t	word3Reserved1;		/* Fc Word 3, bit  8:15 */
1268291a2b48SSukumar Swaminathan 	uint8_t	word3Reserved2;		/* Fc Word 3, bit  0: 7 */
1269fcf3ce44SJohn Forte } emlxs_class_parms_t;
1270fcf3ce44SJohn Forte typedef emlxs_class_parms_t CLASS_PARMS;
1271fcf3ce44SJohn Forte 
1272fcf3ce44SJohn Forte 
1273291a2b48SSukumar Swaminathan typedef struct emlxs_serv_parms
1274291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1275291a2b48SSukumar Swaminathan 	CSP		cmn;
1276291a2b48SSukumar Swaminathan 	NAME_TYPE	portName;
1277291a2b48SSukumar Swaminathan 	NAME_TYPE	nodeName;
1278291a2b48SSukumar Swaminathan 	CLASS_PARMS	cls1;
1279291a2b48SSukumar Swaminathan 	CLASS_PARMS	cls2;
1280291a2b48SSukumar Swaminathan 	CLASS_PARMS	cls3;
1281291a2b48SSukumar Swaminathan 	CLASS_PARMS	cls4;
1282291a2b48SSukumar Swaminathan 	uint8_t		vendorVersion[16];
1283fcf3ce44SJohn Forte } emlxs_serv_parms_t;
1284fcf3ce44SJohn Forte typedef emlxs_serv_parms_t SERV_PARM;
1285fcf3ce44SJohn Forte 
1286291a2b48SSukumar Swaminathan typedef struct
1287291a2b48SSukumar Swaminathan {
1288291a2b48SSukumar Swaminathan 	union
1289291a2b48SSukumar Swaminathan 	{
1290291a2b48SSukumar Swaminathan 		uint32_t	word0;
1291291a2b48SSukumar Swaminathan 		struct
1292291a2b48SSukumar Swaminathan 		{
1293fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1294fcf3ce44SJohn Forte 			uint32_t rsvd0:8;	/* Word 0, Byte 3 */
1295291a2b48SSukumar Swaminathan 			uint32_t oui:24;	/* Elx Organization */
1296291a2b48SSukumar Swaminathan 						/* Unique ID (0000C9) */
1297fcf3ce44SJohn Forte #endif
1298fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1299291a2b48SSukumar Swaminathan 			uint32_t oui:24;	/* Elx Organization */
1300291a2b48SSukumar Swaminathan 						/* Unique ID (0000C9) */
1301fcf3ce44SJohn Forte 			uint32_t rsvd0:8;	/* Word 0, Byte 3 */
1302fcf3ce44SJohn Forte #endif
1303fcf3ce44SJohn Forte 		} w0;
1304fcf3ce44SJohn Forte 	} un0;
1305291a2b48SSukumar Swaminathan 	union
1306291a2b48SSukumar Swaminathan 	{
1307291a2b48SSukumar Swaminathan 		uint32_t	word1;
1308291a2b48SSukumar Swaminathan 		struct
1309291a2b48SSukumar Swaminathan 		{
1310fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1311fcf3ce44SJohn Forte 			uint32_t vport:1;	/* Word 1, Bit 31 */
1312fcf3ce44SJohn Forte 			uint32_t rsvd1:31;	/* Word 1, Bit 0-30 */
1313fcf3ce44SJohn Forte #endif
1314fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1315fcf3ce44SJohn Forte 			uint32_t rsvd1:31;	/* Word 1, Bit 0-30 */
1316fcf3ce44SJohn Forte 			uint32_t vport:1;	/* Word 1, Bit 31 */
1317fcf3ce44SJohn Forte #endif
1318fcf3ce44SJohn Forte 		} w1;
1319fcf3ce44SJohn Forte 	} un1;
1320291a2b48SSukumar Swaminathan 	uint8_t		rsvd2[8];
1321fcf3ce44SJohn Forte } emlxs_vvl_fmt_t;
1322fcf3ce44SJohn Forte 
132382527734SSukumar Swaminathan #define	VALID_VENDOR_VERSION	cmn.rspMultipleNPort
1324fcf3ce44SJohn Forte 
1325fcf3ce44SJohn Forte 
1326fcf3ce44SJohn Forte 
1327fcf3ce44SJohn Forte /*
1328fcf3ce44SJohn Forte  * Extended Link Service LS_COMMAND codes (Payload BYTE 0)
1329fcf3ce44SJohn Forte  */
1330fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1331291a2b48SSukumar Swaminathan #define	ELS_CMD_SHIFT	24
1332291a2b48SSukumar Swaminathan #define	ELS_CMD_MASK	0xff000000
1333291a2b48SSukumar Swaminathan #define	ELS_RSP_MASK	0xff000000
1334291a2b48SSukumar Swaminathan #define	ELS_CMD_LS_RJT	0x01000000
1335291a2b48SSukumar Swaminathan #define	ELS_CMD_ACC	0x02000000
1336291a2b48SSukumar Swaminathan #define	ELS_CMD_PLOGI	0x03000000
1337291a2b48SSukumar Swaminathan #define	ELS_CMD_FLOGI	0x04000000
1338291a2b48SSukumar Swaminathan #define	ELS_CMD_LOGO	0x05000000
1339291a2b48SSukumar Swaminathan #define	ELS_CMD_ABTX	0x06000000
1340291a2b48SSukumar Swaminathan #define	ELS_CMD_RCS	0x07000000
1341291a2b48SSukumar Swaminathan #define	ELS_CMD_RES	0x08000000
1342291a2b48SSukumar Swaminathan #define	ELS_CMD_RSS	0x09000000
1343291a2b48SSukumar Swaminathan #define	ELS_CMD_RSI	0x0A000000
1344291a2b48SSukumar Swaminathan #define	ELS_CMD_ESTS	0x0B000000
1345291a2b48SSukumar Swaminathan #define	ELS_CMD_ESTC	0x0C000000
1346291a2b48SSukumar Swaminathan #define	ELS_CMD_ADVC	0x0D000000
1347291a2b48SSukumar Swaminathan #define	ELS_CMD_RTV	0x0E000000
1348291a2b48SSukumar Swaminathan #define	ELS_CMD_RLS	0x0F000000
1349291a2b48SSukumar Swaminathan #define	ELS_CMD_ECHO	0x10000000
1350291a2b48SSukumar Swaminathan #define	ELS_CMD_TEST	0x11000000
1351291a2b48SSukumar Swaminathan #define	ELS_CMD_RRQ	0x12000000
1352a9800bebSGarrett D'Amore #define	ELS_CMD_REC	0x13000000
1353291a2b48SSukumar Swaminathan #define	ELS_CMD_PRLI	0x20000000
1354291a2b48SSukumar Swaminathan #define	ELS_CMD_PRLO	0x21000000
1355291a2b48SSukumar Swaminathan #define	ELS_CMD_SCN	0x22000000
1356291a2b48SSukumar Swaminathan #define	ELS_CMD_TPLS	0x23000000
1357291a2b48SSukumar Swaminathan #define	ELS_CMD_GPRLO	0x24000000
1358291a2b48SSukumar Swaminathan #define	ELS_CMD_GAID	0x30000000
1359291a2b48SSukumar Swaminathan #define	ELS_CMD_FACT	0x31000000
1360291a2b48SSukumar Swaminathan #define	ELS_CMD_FDACT	0x32000000
1361291a2b48SSukumar Swaminathan #define	ELS_CMD_NACT	0x33000000
1362291a2b48SSukumar Swaminathan #define	ELS_CMD_NDACT	0x34000000
1363291a2b48SSukumar Swaminathan #define	ELS_CMD_QoSR	0x40000000
1364291a2b48SSukumar Swaminathan #define	ELS_CMD_RVCS	0x41000000
1365291a2b48SSukumar Swaminathan #define	ELS_CMD_PDISC	0x50000000
1366291a2b48SSukumar Swaminathan #define	ELS_CMD_FDISC	0x51000000
1367291a2b48SSukumar Swaminathan #define	ELS_CMD_ADISC	0x52000000
1368291a2b48SSukumar Swaminathan #define	ELS_CMD_FARP	0x54000000
1369291a2b48SSukumar Swaminathan #define	ELS_CMD_FARPR	0x55000000
1370291a2b48SSukumar Swaminathan #define	ELS_CMD_FAN	0x60000000
1371291a2b48SSukumar Swaminathan #define	ELS_CMD_RSCN	0x61000000
1372291a2b48SSukumar Swaminathan #define	ELS_CMD_SCR	0x62000000
1373291a2b48SSukumar Swaminathan #define	ELS_CMD_LINIT	0x70000000
1374291a2b48SSukumar Swaminathan #define	ELS_CMD_RNID	0x78000000
1375291a2b48SSukumar Swaminathan #define	ELS_CMD_AUTH	0x90000000
1376fcf3ce44SJohn Forte #endif
1377fcf3ce44SJohn Forte 
1378fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1379291a2b48SSukumar Swaminathan #define	ELS_CMD_SHIFT	0
1380291a2b48SSukumar Swaminathan #define	ELS_CMD_MASK	0xff
1381291a2b48SSukumar Swaminathan #define	ELS_RSP_MASK	0xff
1382291a2b48SSukumar Swaminathan #define	ELS_CMD_LS_RJT	0x01
1383291a2b48SSukumar Swaminathan #define	ELS_CMD_ACC	0x02
1384291a2b48SSukumar Swaminathan #define	ELS_CMD_PLOGI	0x03
1385291a2b48SSukumar Swaminathan #define	ELS_CMD_FLOGI	0x04
1386291a2b48SSukumar Swaminathan #define	ELS_CMD_LOGO	0x05
1387291a2b48SSukumar Swaminathan #define	ELS_CMD_ABTX	0x06
1388291a2b48SSukumar Swaminathan #define	ELS_CMD_RCS	0x07
1389291a2b48SSukumar Swaminathan #define	ELS_CMD_RES	0x08
1390291a2b48SSukumar Swaminathan #define	ELS_CMD_RSS	0x09
1391291a2b48SSukumar Swaminathan #define	ELS_CMD_RSI	0x0A
1392291a2b48SSukumar Swaminathan #define	ELS_CMD_ESTS	0x0B
1393291a2b48SSukumar Swaminathan #define	ELS_CMD_ESTC	0x0C
1394291a2b48SSukumar Swaminathan #define	ELS_CMD_ADVC	0x0D
1395291a2b48SSukumar Swaminathan #define	ELS_CMD_RTV	0x0E
1396291a2b48SSukumar Swaminathan #define	ELS_CMD_RLS	0x0F
1397291a2b48SSukumar Swaminathan #define	ELS_CMD_ECHO	0x10
1398291a2b48SSukumar Swaminathan #define	ELS_CMD_TEST	0x11
1399291a2b48SSukumar Swaminathan #define	ELS_CMD_RRQ	0x12
1400a9800bebSGarrett D'Amore #define	ELS_CMD_REC	0x13
1401291a2b48SSukumar Swaminathan #define	ELS_CMD_PRLI	0x20
1402291a2b48SSukumar Swaminathan #define	ELS_CMD_PRLO	0x21
1403291a2b48SSukumar Swaminathan #define	ELS_CMD_SCN	0x22
1404291a2b48SSukumar Swaminathan #define	ELS_CMD_TPLS	0x23
1405291a2b48SSukumar Swaminathan #define	ELS_CMD_GPRLO	0x24
1406291a2b48SSukumar Swaminathan #define	ELS_CMD_GAID	0x30
1407291a2b48SSukumar Swaminathan #define	ELS_CMD_FACT	0x31
1408291a2b48SSukumar Swaminathan #define	ELS_CMD_FDACT	0x32
1409291a2b48SSukumar Swaminathan #define	ELS_CMD_NACT	0x33
1410291a2b48SSukumar Swaminathan #define	ELS_CMD_NDACT	0x34
1411291a2b48SSukumar Swaminathan #define	ELS_CMD_QoSR	0x40
1412291a2b48SSukumar Swaminathan #define	ELS_CMD_RVCS	0x41
1413291a2b48SSukumar Swaminathan #define	ELS_CMD_PDISC	0x50
1414291a2b48SSukumar Swaminathan #define	ELS_CMD_FDISC	0x51
1415291a2b48SSukumar Swaminathan #define	ELS_CMD_ADISC	0x52
1416291a2b48SSukumar Swaminathan #define	ELS_CMD_FARP	0x54
1417291a2b48SSukumar Swaminathan #define	ELS_CMD_FARPR	0x55
1418291a2b48SSukumar Swaminathan #define	ELS_CMD_FAN	0x60
1419291a2b48SSukumar Swaminathan #define	ELS_CMD_RSCN	0x61
1420291a2b48SSukumar Swaminathan #define	ELS_CMD_SCR	0x62
1421291a2b48SSukumar Swaminathan #define	ELS_CMD_LINIT	0x70
1422291a2b48SSukumar Swaminathan #define	ELS_CMD_RNID	0x78
1423291a2b48SSukumar Swaminathan #define	ELS_CMD_AUTH	0x90
1424fcf3ce44SJohn Forte #endif
1425fcf3ce44SJohn Forte 
1426fcf3ce44SJohn Forte 
1427fcf3ce44SJohn Forte /*
1428fcf3ce44SJohn Forte  * LS_RJT Payload Definition
1429fcf3ce44SJohn Forte  */
1430fcf3ce44SJohn Forte 
1431291a2b48SSukumar Swaminathan typedef struct _LS_RJT
1432291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1433291a2b48SSukumar Swaminathan 	union
1434291a2b48SSukumar Swaminathan 	{
1435291a2b48SSukumar Swaminathan 		uint32_t	lsRjtError;
1436291a2b48SSukumar Swaminathan 		struct
1437291a2b48SSukumar Swaminathan 		{
1438291a2b48SSukumar Swaminathan 			uint8_t	lsRjtRsvd0;	/* FC Word 0, */
1439291a2b48SSukumar Swaminathan 						/* bit 24:31 */
1440291a2b48SSukumar Swaminathan 
1441291a2b48SSukumar Swaminathan 			uint8_t	lsRjtRsnCode;	/* FC Word 0, */
1442291a2b48SSukumar Swaminathan 						/* bit 16:23 */
1443fcf3ce44SJohn Forte 			/* LS_RJT reason codes */
1444fcf3ce44SJohn Forte #define	LSRJT_INVALID_CMD	0x01
1445fcf3ce44SJohn Forte #define	LSRJT_LOGICAL_ERR	0x03
1446fcf3ce44SJohn Forte #define	LSRJT_LOGICAL_BSY	0x05
1447fcf3ce44SJohn Forte #define	LSRJT_PROTOCOL_ERR	0x07
1448fcf3ce44SJohn Forte #define	LSRJT_UNABLE_TPC	0x09	/* Unable to perform command */
1449fcf3ce44SJohn Forte #define	LSRJT_CMD_UNSUPPORTED	0x0B
1450fcf3ce44SJohn Forte #define	LSRJT_VENDOR_UNIQUE	0xFF	/* See Byte 3 */
1451fcf3ce44SJohn Forte 
1452291a2b48SSukumar Swaminathan 			uint8_t	lsRjtRsnCodeExp;	/* FC Word 0, */
1453291a2b48SSukumar Swaminathan 							/* bit 8:15 */
1454fcf3ce44SJohn Forte 			/* LS_RJT reason explanation */
1455fcf3ce44SJohn Forte #define	LSEXP_NOTHING_MORE	0x00
1456fcf3ce44SJohn Forte #define	LSEXP_SPARM_OPTIONS	0x01
1457fcf3ce44SJohn Forte #define	LSEXP_SPARM_ICTL	0x03
1458fcf3ce44SJohn Forte #define	LSEXP_SPARM_RCTL	0x05
1459fcf3ce44SJohn Forte #define	LSEXP_SPARM_RCV_SIZE	0x07
1460fcf3ce44SJohn Forte #define	LSEXP_SPARM_CONCUR_SEQ	0x09
1461fcf3ce44SJohn Forte #define	LSEXP_SPARM_CREDIT	0x0B
1462fcf3ce44SJohn Forte #define	LSEXP_INVALID_PNAME	0x0D
1463fcf3ce44SJohn Forte #define	LSEXP_INVALID_NNAME	0x0E
1464fcf3ce44SJohn Forte #define	LSEXP_INVALID_CSP	0x0F
1465fcf3ce44SJohn Forte #define	LSEXP_INVALID_ASSOC_HDR	0x11
1466fcf3ce44SJohn Forte #define	LSEXP_ASSOC_HDR_REQ	0x13
1467fcf3ce44SJohn Forte #define	LSEXP_INVALID_O_SID	0x15
1468fcf3ce44SJohn Forte #define	LSEXP_INVALID_OX_RX	0x17
1469fcf3ce44SJohn Forte #define	LSEXP_CMD_IN_PROGRESS	0x19
1470fcf3ce44SJohn Forte #define	LSEXP_INVALID_NPORT_ID	0x1F
1471fcf3ce44SJohn Forte #define	LSEXP_INVALID_SEQ_ID	0x21
1472fcf3ce44SJohn Forte #define	LSEXP_INVALID_XCHG	0x23
1473fcf3ce44SJohn Forte #define	LSEXP_INACTIVE_XCHG	0x25
1474fcf3ce44SJohn Forte #define	LSEXP_RQ_REQUIRED	0x27
1475fcf3ce44SJohn Forte #define	LSEXP_OUT_OF_RESOURCE	0x29
1476fcf3ce44SJohn Forte #define	LSEXP_CANT_GIVE_DATA	0x2A
1477291a2b48SSukumar Swaminathan #define	LSEXP_REQ_UNSUPPORTED	0x2C
1478291a2b48SSukumar Swaminathan 			uint8_t	vendorUnique;	/* FC Word 0, bit  0: 7 */
1479fcf3ce44SJohn Forte 		} b;
1480fcf3ce44SJohn Forte 	} un;
1481fcf3ce44SJohn Forte } LS_RJT;
1482fcf3ce44SJohn Forte 
1483fcf3ce44SJohn Forte 
1484fcf3ce44SJohn Forte /*
1485fcf3ce44SJohn Forte  * N_Port Login (FLOGO/PLOGO Request) Payload Definition
1486fcf3ce44SJohn Forte  */
1487fcf3ce44SJohn Forte 
1488291a2b48SSukumar Swaminathan typedef struct _LOGO
1489291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1490291a2b48SSukumar Swaminathan 	union
1491291a2b48SSukumar Swaminathan 	{
1492291a2b48SSukumar Swaminathan 		uint32_t	nPortId32;	/* Access nPortId as a word */
1493291a2b48SSukumar Swaminathan 		struct
1494291a2b48SSukumar Swaminathan 		{
1495291a2b48SSukumar Swaminathan 			uint8_t	word1Reserved1;	/* FC Word 1, bit 31:24 */
1496291a2b48SSukumar Swaminathan 			uint8_t	nPortIdByte0;	/* N_port  ID bit 16:23 */
1497291a2b48SSukumar Swaminathan 			uint8_t	nPortIdByte1;	/* N_port  ID bit  8:15 */
1498291a2b48SSukumar Swaminathan 			uint8_t	nPortIdByte2;	/* N_port  ID bit  0: 7 */
1499fcf3ce44SJohn Forte 		} b;
1500fcf3ce44SJohn Forte 	} un;
1501291a2b48SSukumar Swaminathan 	NAME_TYPE		portName;	/* N_port name field */
1502fcf3ce44SJohn Forte } LOGO;
1503fcf3ce44SJohn Forte 
1504fcf3ce44SJohn Forte 
1505fcf3ce44SJohn Forte /*
1506fcf3ce44SJohn Forte  * FCP Login (PRLI Request / ACC) Payload Definition
1507fcf3ce44SJohn Forte  */
1508fcf3ce44SJohn Forte 
1509291a2b48SSukumar Swaminathan #define	PRLX_PAGE_LEN	0x10
1510291a2b48SSukumar Swaminathan #define	TPRLO_PAGE_LEN	0x14
1511fcf3ce44SJohn Forte 
1512291a2b48SSukumar Swaminathan typedef struct _PRLI
1513291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1514291a2b48SSukumar Swaminathan 	uint8_t		prliType;		/* FC Parm Word 0, bit 24:31 */
1515fcf3ce44SJohn Forte 
1516fcf3ce44SJohn Forte #define	PRLI_FCP_TYPE 0x08
1517291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved1;		/* FC Parm Word 0, bit 16:23 */
1518fcf3ce44SJohn Forte 
1519fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1520291a2b48SSukumar Swaminathan 	uint8_t		origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
1521291a2b48SSukumar Swaminathan 	uint8_t		respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
1522291a2b48SSukumar Swaminathan 	uint8_t		estabImagePair:1;	/* FC Parm Word 0, bit 13 */
1523fcf3ce44SJohn Forte 
1524fcf3ce44SJohn Forte 	/* ACC = imagePairEstablished */
1525291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
1526291a2b48SSukumar Swaminathan 	uint8_t		acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, */
1527291a2b48SSukumar Swaminathan 						/* ACC ONLY */
1528fcf3ce44SJohn Forte #endif
1529fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1530291a2b48SSukumar Swaminathan 	uint8_t		acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, */
1531291a2b48SSukumar Swaminathan 						/* ACC ONLY */
1532291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
1533291a2b48SSukumar Swaminathan 	uint8_t		estabImagePair:1;	/* FC Parm Word 0, bit 13 */
1534291a2b48SSukumar Swaminathan 	uint8_t		respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
1535291a2b48SSukumar Swaminathan 	uint8_t		origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
1536fcf3ce44SJohn Forte 	/* ACC = imagePairEstablished */
1537fcf3ce44SJohn Forte #endif
1538291a2b48SSukumar Swaminathan #define	PRLI_REQ_EXECUTED	0x1		/* acceptRspCode */
1539fcf3ce44SJohn Forte #define	PRLI_NO_RESOURCES	0x2
1540fcf3ce44SJohn Forte #define	PRLI_INIT_INCOMPLETE	0x3
1541fcf3ce44SJohn Forte #define	PRLI_NO_SUCH_PA		0x4
1542fcf3ce44SJohn Forte #define	PRLI_PREDEF_CONFIG	0x5
1543fcf3ce44SJohn Forte #define	PRLI_PARTIAL_SUCCESS	0x6
1544fcf3ce44SJohn Forte #define	PRLI_INVALID_PAGE_CNT	0x7
1545291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved3;		/* FC Parm Word 0, bit 0:7 */
1546fcf3ce44SJohn Forte 
1547291a2b48SSukumar Swaminathan 	uint32_t	origProcAssoc;		/* FC Parm Word 1, bit 0:31 */
1548fcf3ce44SJohn Forte 
1549291a2b48SSukumar Swaminathan 	uint32_t	respProcAssoc;		/* FC Parm Word 2, bit 0:31 */
1550fcf3ce44SJohn Forte 
1551291a2b48SSukumar Swaminathan 	uint8_t		word3Reserved1;		/* FC Parm Word 3, bit 24:31 */
1552291a2b48SSukumar Swaminathan 	uint8_t		word3Reserved2;		/* FC Parm Word 3, bit 16:23 */
1553fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1554291a2b48SSukumar Swaminathan 	uint16_t	Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
1555291a2b48SSukumar Swaminathan 	uint16_t	Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
1556291a2b48SSukumar Swaminathan 	uint16_t	Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
1557291a2b48SSukumar Swaminathan 	uint16_t	Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
1558291a2b48SSukumar Swaminathan 	uint16_t	Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
1559291a2b48SSukumar Swaminathan 	uint16_t	Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
1560291a2b48SSukumar Swaminathan 	uint16_t	TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
1561291a2b48SSukumar Swaminathan 	uint16_t	Retry:1;		/* FC Parm Word 3, bit  8 */
1562291a2b48SSukumar Swaminathan 	uint16_t	ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
1563291a2b48SSukumar Swaminathan 	uint16_t	dataOverLay:1;		/* FC Parm Word 3, bit  6 */
1564291a2b48SSukumar Swaminathan 	uint16_t	initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
1565291a2b48SSukumar Swaminathan 	uint16_t	targetFunc:1;		/* FC Parm Word 3, bit  4 */
1566291a2b48SSukumar Swaminathan 	uint16_t	cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
1567291a2b48SSukumar Swaminathan 	uint16_t	dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
1568291a2b48SSukumar Swaminathan 	uint16_t	readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
1569291a2b48SSukumar Swaminathan 	uint16_t	writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
1570fcf3ce44SJohn Forte #endif
1571fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1572291a2b48SSukumar Swaminathan 	uint16_t	Retry:1;		/* FC Parm Word 3, bit  8 */
1573291a2b48SSukumar Swaminathan 	uint16_t	TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
1574291a2b48SSukumar Swaminathan 	uint16_t	Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
1575291a2b48SSukumar Swaminathan 	uint16_t	Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
1576291a2b48SSukumar Swaminathan 	uint16_t	Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
1577291a2b48SSukumar Swaminathan 	uint16_t	Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
1578291a2b48SSukumar Swaminathan 	uint16_t	Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
1579291a2b48SSukumar Swaminathan 	uint16_t	Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
1580291a2b48SSukumar Swaminathan 	uint16_t	writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
1581291a2b48SSukumar Swaminathan 	uint16_t	readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
1582291a2b48SSukumar Swaminathan 	uint16_t	dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
1583291a2b48SSukumar Swaminathan 	uint16_t	cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
1584291a2b48SSukumar Swaminathan 	uint16_t	targetFunc:1;		/* FC Parm Word 3, bit  4 */
1585291a2b48SSukumar Swaminathan 	uint16_t	initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
1586291a2b48SSukumar Swaminathan 	uint16_t	dataOverLay:1;		/* FC Parm Word 3, bit  6 */
1587291a2b48SSukumar Swaminathan 	uint16_t	ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
1588fcf3ce44SJohn Forte #endif
1589fcf3ce44SJohn Forte } PRLI;
1590fcf3ce44SJohn Forte 
1591fcf3ce44SJohn Forte /*
1592fcf3ce44SJohn Forte  * FCP Logout (PRLO Request / ACC) Payload Definition
1593fcf3ce44SJohn Forte  */
1594fcf3ce44SJohn Forte 
1595291a2b48SSukumar Swaminathan typedef struct _PRLO
1596291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1597291a2b48SSukumar Swaminathan 	uint8_t		prloType;	/* FC Parm Word 0, bit 24:31 */
1598fcf3ce44SJohn Forte 
1599291a2b48SSukumar Swaminathan #define	PRLO_FCP_TYPE	0x08
1600291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
1601fcf3ce44SJohn Forte 
1602fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1603291a2b48SSukumar Swaminathan 	uint8_t		origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
1604291a2b48SSukumar Swaminathan 	uint8_t		respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
1605291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
1606291a2b48SSukumar Swaminathan 	uint8_t		acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, */
1607291a2b48SSukumar Swaminathan 						/* ACC ONLY */
1608fcf3ce44SJohn Forte #endif
1609fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1610291a2b48SSukumar Swaminathan 	uint8_t		acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, */
1611291a2b48SSukumar Swaminathan 						/* ACC ONLY */
1612291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
1613291a2b48SSukumar Swaminathan 	uint8_t		respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
1614291a2b48SSukumar Swaminathan 	uint8_t		origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
1615fcf3ce44SJohn Forte #endif
1616291a2b48SSukumar Swaminathan #define	PRLO_REQ_EXECUTED	0x1		/* acceptRspCode */
1617fcf3ce44SJohn Forte #define	PRLO_NO_SUCH_IMAGE	0x4
1618fcf3ce44SJohn Forte #define	PRLO_INVALID_PAGE_CNT	0x7
1619fcf3ce44SJohn Forte 
1620291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved3;		/* FC Parm Word 0, bit 0:7 */
1621291a2b48SSukumar Swaminathan 	uint32_t	origProcAssoc;		/* FC Parm Word 1, bit 0:31 */
1622291a2b48SSukumar Swaminathan 	uint32_t	respProcAssoc;		/* FC Parm Word 2, bit 0:31 */
1623291a2b48SSukumar Swaminathan 	uint32_t	word3Reserved1;		/* FC Parm Word 3, bit 0:31 */
1624fcf3ce44SJohn Forte } PRLO;
1625fcf3ce44SJohn Forte 
1626fcf3ce44SJohn Forte 
1627291a2b48SSukumar Swaminathan typedef struct _ADISC
1628291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1629291a2b48SSukumar Swaminathan 	uint32_t	hardAL_PA;
1630291a2b48SSukumar Swaminathan 	NAME_TYPE	portName;
1631291a2b48SSukumar Swaminathan 	NAME_TYPE	nodeName;
1632291a2b48SSukumar Swaminathan 	uint32_t	DID;
1633fcf3ce44SJohn Forte } ADISC;
1634fcf3ce44SJohn Forte 
1635fcf3ce44SJohn Forte 
1636291a2b48SSukumar Swaminathan typedef struct _FARP
1637291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1638291a2b48SSukumar Swaminathan 	uint32_t	Mflags:8;
1639291a2b48SSukumar Swaminathan 	uint32_t	Odid:24;
1640291a2b48SSukumar Swaminathan #define	FARP_NO_ACTION	0	/* FARP information enclosed, no action */
1641291a2b48SSukumar Swaminathan #define	FARP_MATCH_PORT	0x1	/* Match on Responder Port Name */
1642291a2b48SSukumar Swaminathan #define	FARP_MATCH_NODE	0x2	/* Match on Responder Node Name */
1643291a2b48SSukumar Swaminathan #define	FARP_MATCH_IP	0x4	/* Match on IP address, not supported */
1644291a2b48SSukumar Swaminathan #define	FARP_MATCH_IPV4	0x5	/* Match on IPV4 address, not supported */
1645291a2b48SSukumar Swaminathan #define	FARP_MATCH_IPV6	0x6	/* Match on IPV6 address, not supported */
1646291a2b48SSukumar Swaminathan 	uint32_t	Rflags:8;
1647291a2b48SSukumar Swaminathan 	uint32_t	Rdid:24;
1648fcf3ce44SJohn Forte #define	FARP_REQUEST_PLOGI	0x1	/* Request for PLOGI */
1649fcf3ce44SJohn Forte #define	FARP_REQUEST_FARPR	0x2	/* Request for FARP Response */
1650291a2b48SSukumar Swaminathan 	NAME_TYPE	OportName;
1651291a2b48SSukumar Swaminathan 	NAME_TYPE	OnodeName;
1652291a2b48SSukumar Swaminathan 	NAME_TYPE	RportName;
1653291a2b48SSukumar Swaminathan 	NAME_TYPE	RnodeName;
1654291a2b48SSukumar Swaminathan 	uint8_t		Oipaddr[16];
1655291a2b48SSukumar Swaminathan 	uint8_t		Ripaddr[16];
1656fcf3ce44SJohn Forte } FARP;
1657fcf3ce44SJohn Forte 
1658291a2b48SSukumar Swaminathan typedef struct _FAN
1659291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1660291a2b48SSukumar Swaminathan 	uint32_t	Fdid;
1661291a2b48SSukumar Swaminathan 	NAME_TYPE	FportName;
1662291a2b48SSukumar Swaminathan 	NAME_TYPE	FnodeName;
1663fcf3ce44SJohn Forte } FAN;
1664fcf3ce44SJohn Forte 
1665291a2b48SSukumar Swaminathan typedef struct _SCR
1666291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1667291a2b48SSukumar Swaminathan 	uint8_t		resvd1;
1668291a2b48SSukumar Swaminathan 	uint8_t		resvd2;
1669291a2b48SSukumar Swaminathan 	uint8_t		resvd3;
1670291a2b48SSukumar Swaminathan 	uint8_t		Function;
1671291a2b48SSukumar Swaminathan #define	SCR_FUNC_FABRIC	0x01
1672291a2b48SSukumar Swaminathan #define	SCR_FUNC_NPORT	0x02
1673291a2b48SSukumar Swaminathan #define	SCR_FUNC_FULL	0x03
1674291a2b48SSukumar Swaminathan #define	SCR_CLEAR	0xff
1675fcf3ce44SJohn Forte } SCR;
1676fcf3ce44SJohn Forte 
1677291a2b48SSukumar Swaminathan typedef struct _RNID_TOP_DISC
1678291a2b48SSukumar Swaminathan {
1679291a2b48SSukumar Swaminathan 	NAME_TYPE	portName;
1680291a2b48SSukumar Swaminathan 	uint8_t		resvd[8];
1681291a2b48SSukumar Swaminathan 	uint32_t	unitType;
1682291a2b48SSukumar Swaminathan #define	RNID_HBA	0x7
1683291a2b48SSukumar Swaminathan #define	RNID_HOST	0xa
1684291a2b48SSukumar Swaminathan #define	RNID_DRIVER	0xd
1685291a2b48SSukumar Swaminathan 	uint32_t	physPort;
1686291a2b48SSukumar Swaminathan 	uint32_t	attachedNodes;
1687291a2b48SSukumar Swaminathan 	uint16_t	ipVersion;
1688291a2b48SSukumar Swaminathan #define	RNID_IPV4	0x1
1689291a2b48SSukumar Swaminathan #define	RNID_IPV6	0x2
1690291a2b48SSukumar Swaminathan 	uint16_t	UDPport;
1691291a2b48SSukumar Swaminathan 	uint8_t		ipAddr[16];
1692291a2b48SSukumar Swaminathan 	uint16_t	resvd1;
1693291a2b48SSukumar Swaminathan 	uint16_t	flags;
1694291a2b48SSukumar Swaminathan #define	RNID_TD_SUPPORT	0x1
1695291a2b48SSukumar Swaminathan #define	RNID_LP_VALID	0x2
1696fcf3ce44SJohn Forte } RNID_TOP_DISC;
1697fcf3ce44SJohn Forte 
1698291a2b48SSukumar Swaminathan typedef struct _RNID
1699291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1700291a2b48SSukumar Swaminathan 	uint8_t		Format;
1701fcf3ce44SJohn Forte #define	RNID_TOPOLOGY_DISC  0xdf
1702291a2b48SSukumar Swaminathan 	uint8_t		CommonLen;
1703291a2b48SSukumar Swaminathan 	uint8_t		resvd1;
1704291a2b48SSukumar Swaminathan 	uint8_t		SpecificLen;
1705291a2b48SSukumar Swaminathan 	NAME_TYPE	portName;
1706291a2b48SSukumar Swaminathan 	NAME_TYPE	nodeName;
1707291a2b48SSukumar Swaminathan 	union
1708291a2b48SSukumar Swaminathan 	{
1709fcf3ce44SJohn Forte 		RNID_TOP_DISC topologyDisc;	/* topology disc (0xdf) */
1710fcf3ce44SJohn Forte 	} un;
1711fcf3ce44SJohn Forte } RNID;
1712fcf3ce44SJohn Forte 
1713291a2b48SSukumar Swaminathan typedef struct _RRQ
1714291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1715291a2b48SSukumar Swaminathan 	uint32_t	SID;
1716291a2b48SSukumar Swaminathan 	uint16_t	Oxid;
1717291a2b48SSukumar Swaminathan 	uint16_t	Rxid;
1718291a2b48SSukumar Swaminathan 	uint8_t		resv[32];	/* optional association hdr */
1719fcf3ce44SJohn Forte } RRQ;
1720fcf3ce44SJohn Forte 
1721fcf3ce44SJohn Forte 
1722fcf3ce44SJohn Forte /* This is used for RSCN command */
1723291a2b48SSukumar Swaminathan typedef struct _D_ID
1724291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1725291a2b48SSukumar Swaminathan 	union
1726291a2b48SSukumar Swaminathan 	{
1727291a2b48SSukumar Swaminathan 		uint32_t	word;
1728291a2b48SSukumar Swaminathan 		struct
1729291a2b48SSukumar Swaminathan 		{
1730fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1731291a2b48SSukumar Swaminathan 			uint8_t	resv;
1732291a2b48SSukumar Swaminathan 			uint8_t	domain;
1733291a2b48SSukumar Swaminathan 			uint8_t	area;
1734291a2b48SSukumar Swaminathan 			uint8_t	id;
1735fcf3ce44SJohn Forte #endif
1736fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1737291a2b48SSukumar Swaminathan 			uint8_t	id;
1738291a2b48SSukumar Swaminathan 			uint8_t	area;
1739291a2b48SSukumar Swaminathan 			uint8_t	domain;
1740291a2b48SSukumar Swaminathan 			uint8_t	resv;
1741fcf3ce44SJohn Forte #endif
1742fcf3ce44SJohn Forte 		} b;
1743fcf3ce44SJohn Forte 	} un;
1744fcf3ce44SJohn Forte } D_ID;
1745fcf3ce44SJohn Forte 
1746fcf3ce44SJohn Forte /*
1747291a2b48SSukumar Swaminathan  * Structure to define	all ELS Payload types
1748fcf3ce44SJohn Forte  */
1749fcf3ce44SJohn Forte 
1750291a2b48SSukumar Swaminathan typedef struct _ELS_PKT
1751291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1752291a2b48SSukumar Swaminathan 	uint8_t		elsCode;		/* FC Word 0, bit 24:31 */
1753291a2b48SSukumar Swaminathan 	uint8_t		elsByte1;
1754291a2b48SSukumar Swaminathan 	uint8_t		elsByte2;
1755291a2b48SSukumar Swaminathan 	uint8_t		elsByte3;
1756291a2b48SSukumar Swaminathan 	union
1757291a2b48SSukumar Swaminathan 	{
1758291a2b48SSukumar Swaminathan 		LS_RJT		lsRjt;		/* Payload for LS_RJT */
1759291a2b48SSukumar Swaminathan 		SERV_PARM	logi;		/* Payload for PLOGI, FLOGI */
1760291a2b48SSukumar Swaminathan 						/* PDISC, ACC */
1761291a2b48SSukumar Swaminathan 		LOGO		logo;		/* Payload for PLOGO, FLOGO */
1762291a2b48SSukumar Swaminathan 						/* ACC */
1763291a2b48SSukumar Swaminathan 		PRLI		prli;		/* Payload for PRLI/ACC */
1764291a2b48SSukumar Swaminathan 		PRLO		prlo;		/* Payload for PRLO/ACC */
1765291a2b48SSukumar Swaminathan 		ADISC		adisc;		/* Payload for ADISC/ACC */
1766291a2b48SSukumar Swaminathan 		FARP		farp;		/* Payload for FARP/ACC */
1767291a2b48SSukumar Swaminathan 		FAN		fan;		/* Payload for FAN */
1768291a2b48SSukumar Swaminathan 		SCR		scr;		/* Payload for SCR/ACC */
1769291a2b48SSukumar Swaminathan 		RRQ		rrq;		/* Payload for RRQ */
1770291a2b48SSukumar Swaminathan 		RNID		rnid;		/* Payload for RNID */
1771291a2b48SSukumar Swaminathan 		uint8_t		pad[128 - 4];	/* Pad out to payload of */
1772291a2b48SSukumar Swaminathan 						/* 128 bytes */
1773fcf3ce44SJohn Forte 	} un;
1774fcf3ce44SJohn Forte } ELS_PKT;
1775fcf3ce44SJohn Forte 
1776fcf3ce44SJohn Forte 
1777291a2b48SSukumar Swaminathan typedef struct
1778291a2b48SSukumar Swaminathan {
1779291a2b48SSukumar Swaminathan 	uint32_t	bdeAddress;
1780fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1781291a2b48SSukumar Swaminathan 	uint32_t	bdeReserved:4;
1782291a2b48SSukumar Swaminathan 	uint32_t	bdeAddrHigh:4;
1783291a2b48SSukumar Swaminathan 	uint32_t	bdeSize:24;
1784fcf3ce44SJohn Forte #endif
1785fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1786291a2b48SSukumar Swaminathan 	uint32_t	bdeSize:24;
1787291a2b48SSukumar Swaminathan 	uint32_t	bdeAddrHigh:4;
1788291a2b48SSukumar Swaminathan 	uint32_t	bdeReserved:4;
1789fcf3ce44SJohn Forte #endif
1790fcf3ce44SJohn Forte } ULP_BDE;
1791fcf3ce44SJohn Forte 
1792291a2b48SSukumar Swaminathan typedef struct ULP_BDE_64
1793291a2b48SSukumar Swaminathan { /* SLI-2 */
1794291a2b48SSukumar Swaminathan 	union ULP_BDE_TUS
1795291a2b48SSukumar Swaminathan 	{
1796291a2b48SSukumar Swaminathan 		uint32_t	w;
1797291a2b48SSukumar Swaminathan 		struct
1798291a2b48SSukumar Swaminathan 		{
1799fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1800291a2b48SSukumar Swaminathan 			uint32_t	bdeFlags:8;	/* BDE Flags 0 IS A */
1801291a2b48SSukumar Swaminathan 							/* SUPPORTED VALUE !! */
1802291a2b48SSukumar Swaminathan 			uint32_t	bdeSize:24;	/* buff size in bytes */
1803fcf3ce44SJohn Forte #endif
1804fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1805291a2b48SSukumar Swaminathan 			uint32_t	bdeSize:24;	/* buff size in bytes */
1806291a2b48SSukumar Swaminathan 			uint32_t	bdeFlags:8;	/* BDE Flags 0 IS A */
1807291a2b48SSukumar Swaminathan 							/* SUPPORTED VALUE !! */
1808fcf3ce44SJohn Forte #endif
1809fcf3ce44SJohn Forte #define	BUFF_USE_RSVD		0x01	/* bdeFlags */
1810fcf3ce44SJohn Forte #define	BUFF_USE_INTRPT		0x02	/* Not Implemented with LP6000 */
1811291a2b48SSukumar Swaminathan #define	BUFF_USE_CMND		0x04	/* Optional, 1=cmd/rsp 0=data buffer */
1812291a2b48SSukumar Swaminathan #define	BUFF_USE_RCV		0x08	/* ""  "", 1=rcv buffer, */
1813291a2b48SSukumar Swaminathan 					/* 0=xmit buffer */
1814291a2b48SSukumar Swaminathan #define	BUFF_TYPE_32BIT		0x10	/* ""  "", 1=32 bit addr */
1815291a2b48SSukumar Swaminathan 					/* 0=64 bit addr */
1816fcf3ce44SJohn Forte #define	BUFF_TYPE_SPECIAL	0x20	/* Not Implemented with LP6000  */
1817fcf3ce44SJohn Forte #define	BUFF_TYPE_BDL		0x40	/* Optional,  may be set in BDL */
1818fcf3ce44SJohn Forte #define	BUFF_TYPE_INVALID	0x80	/* ""  "" */
1819fcf3ce44SJohn Forte 		} f;
1820fcf3ce44SJohn Forte 	} tus;
1821291a2b48SSukumar Swaminathan 	uint32_t	addrLow;
1822291a2b48SSukumar Swaminathan 	uint32_t	addrHigh;
1823fcf3ce44SJohn Forte } ULP_BDE64;
1824fcf3ce44SJohn Forte 
1825291a2b48SSukumar Swaminathan #define	BDE64_SIZE_WORD	0
1826291a2b48SSukumar Swaminathan #define	BPL64_SIZE_WORD	0x40
1827fcf3ce44SJohn Forte 
1828291a2b48SSukumar Swaminathan /*  ULP  */
1829291a2b48SSukumar Swaminathan typedef struct ULP_BPL_64
1830291a2b48SSukumar Swaminathan {
1831291a2b48SSukumar Swaminathan 	ULP_BDE64	fccmd_payload;
1832291a2b48SSukumar Swaminathan 	ULP_BDE64	fcrsp_payload;
1833291a2b48SSukumar Swaminathan 	ULP_BDE64	fcdat_payload;
1834291a2b48SSukumar Swaminathan 	ULP_BDE64	pat0;
1835fcf3ce44SJohn Forte } ULP_BPL64;
1836fcf3ce44SJohn Forte 
1837291a2b48SSukumar Swaminathan typedef struct ULP_BDL
1838291a2b48SSukumar Swaminathan { /* SLI-2 */
1839fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1840291a2b48SSukumar Swaminathan 	uint32_t	bdeFlags:8;	/* BDL Flags */
1841291a2b48SSukumar Swaminathan 	uint32_t	bdeSize:24;	/* Size of BDL array in host */
1842291a2b48SSukumar Swaminathan 					/* memory (bytes) */
1843fcf3ce44SJohn Forte #endif
1844fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1845291a2b48SSukumar Swaminathan 	uint32_t	bdeSize:24;	/* Size of BDL array in host */
1846291a2b48SSukumar Swaminathan 					/* memory (bytes) */
1847291a2b48SSukumar Swaminathan 	uint32_t	bdeFlags:8;	/* BDL Flags */
1848fcf3ce44SJohn Forte #endif
1849291a2b48SSukumar Swaminathan 	uint32_t	addrLow;	/* Address 0:31 */
1850291a2b48SSukumar Swaminathan 	uint32_t	addrHigh;	/* Address 32:63 */
1851291a2b48SSukumar Swaminathan 	uint32_t	ulpIoTag32;	/* Can be used for 32 bit I/O Tag */
1852fcf3ce44SJohn Forte } ULP_BDL;
1853fcf3ce44SJohn Forte 
185482527734SSukumar Swaminathan typedef struct ULP_SGE_64
185582527734SSukumar Swaminathan { /* SLI-4 */
185682527734SSukumar Swaminathan 	uint32_t	addrHigh;	/* Address 32:63 */
185782527734SSukumar Swaminathan 	uint32_t	addrLow;	/* Address 0:31 */
185882527734SSukumar Swaminathan #ifdef EMLXS_BIG_ENDIAN
185982527734SSukumar Swaminathan 	uint32_t	last:1;		/* Last entry in SGL */
1860*8f23e9faSHans Rosenfeld 	uint32_t	type:4;
1861*8f23e9faSHans Rosenfeld 	uint32_t	offset:27;
186282527734SSukumar Swaminathan #endif
186382527734SSukumar Swaminathan #ifdef EMLXS_LITTLE_ENDIAN
1864*8f23e9faSHans Rosenfeld 	uint32_t	offset:27;
1865*8f23e9faSHans Rosenfeld 	uint32_t	type:4;
186682527734SSukumar Swaminathan 	uint32_t	last:1;		/* Last entry in SGL */
186782527734SSukumar Swaminathan #endif
1868*8f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_DATA	0x0
1869*8f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_DIF	0x4
1870*8f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_LSP	0x5
1871*8f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_ENC_DIF	0x6
1872*8f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_ENC_SEED	0x7
1873*8f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_SEED	0x8
1874*8f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_ENC	0x9
1875*8f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_SKIP	0xC
1876*8f23e9faSHans Rosenfeld 
187782527734SSukumar Swaminathan 	uint32_t	length;
187882527734SSukumar Swaminathan #define	EMLXS_MAX_SGE_SIZE	0x10000	/* 64K max length */
187982527734SSukumar Swaminathan } ULP_SGE64;
188082527734SSukumar Swaminathan 
1881*8f23e9faSHans Rosenfeld #define	EMLXS_XFER_RDY_SIZE	12  /* Payload size of a FCP Transfer Ready */
188282527734SSukumar Swaminathan 
188382527734SSukumar Swaminathan typedef	struct _BE_PHYS_ADDR
188482527734SSukumar Swaminathan {
188582527734SSukumar Swaminathan 	uint32_t	addrLow;
188682527734SSukumar Swaminathan 	uint32_t	addrHigh;
188782527734SSukumar Swaminathan } BE_PHYS_ADDR;
188882527734SSukumar Swaminathan 
188982527734SSukumar Swaminathan 
1890291a2b48SSukumar Swaminathan typedef struct
1891291a2b48SSukumar Swaminathan {
1892a9800bebSGarrett D'Amore 	void		*fc_mptr;
189382527734SSukumar Swaminathan 	struct emlxs_memseg *segment;	/* Parent segment */
189482527734SSukumar Swaminathan 
1895a9800bebSGarrett D'Amore 	void		*virt;		/* virtual address ptr */
1896291a2b48SSukumar Swaminathan 	uint64_t	phys;		/* mapped address */
1897291a2b48SSukumar Swaminathan 	uint32_t	size;
189882527734SSukumar Swaminathan 
1899291a2b48SSukumar Swaminathan 	void		*data_handle;
1900291a2b48SSukumar Swaminathan 	void		*dma_handle;
1901291a2b48SSukumar Swaminathan 	uint32_t	tag;
1902291a2b48SSukumar Swaminathan 	uint32_t	flag;
1903291a2b48SSukumar Swaminathan #define	MAP_POOL_ALLOCATED	0x00000001
1904291a2b48SSukumar Swaminathan #define	MAP_BUF_ALLOCATED	0x00000002
1905291a2b48SSukumar Swaminathan #define	MAP_TABLE_ALLOCATED	0x00000004
1906*8f23e9faSHans Rosenfeld 
1907*8f23e9faSHans Rosenfeld #ifdef SFCT_SUPPORT
1908*8f23e9faSHans Rosenfeld 	void		*fct_private;
1909*8f23e9faSHans Rosenfeld #endif /* SFCT_SUPPORT */
1910fcf3ce44SJohn Forte } MATCHMAP;
1911fcf3ce44SJohn Forte 
1912291a2b48SSukumar Swaminathan 
191382527734SSukumar Swaminathan /*
191482527734SSukumar Swaminathan  * This file defines the Header File for the FDMI HBA Management Service
191582527734SSukumar Swaminathan  */
1916fcf3ce44SJohn Forte 
191782527734SSukumar Swaminathan /*
191882527734SSukumar Swaminathan  * FDMI HBA MAnagement Operations Command Codes
191982527734SSukumar Swaminathan  */
192082527734SSukumar Swaminathan #define	SLI_MGMT_GRHL	0x100	/* Get registered HBA list */
192182527734SSukumar Swaminathan #define	SLI_MGMT_GHAT	0x101	/* Get HBA attributes */
192282527734SSukumar Swaminathan #define	SLI_MGMT_GRPL	0x102	/* Get registered Port list */
192382527734SSukumar Swaminathan #define	SLI_MGMT_GPAT	0x110	/* Get Port attributes */
192482527734SSukumar Swaminathan #define	SLI_MGMT_RHBA	0x200	/* Register HBA */
192582527734SSukumar Swaminathan #define	SLI_MGMT_RHAT	0x201	/* Register HBA atttributes */
192682527734SSukumar Swaminathan #define	SLI_MGMT_RPRT	0x210	/* Register Port */
192782527734SSukumar Swaminathan #define	SLI_MGMT_RPA	0x211	/* Register Port attributes */
192882527734SSukumar Swaminathan #define	SLI_MGMT_DHBA	0x300	/* De-register HBA */
192982527734SSukumar Swaminathan #define	SLI_MGMT_DPRT	0x310	/* De-register Port */
1930fcf3ce44SJohn Forte 
193182527734SSukumar Swaminathan /*
193282527734SSukumar Swaminathan  * Management Service Subtypes
193382527734SSukumar Swaminathan  */
193482527734SSukumar Swaminathan #define	SLI_CT_FDMI_SUBTYPES	0x10
1935fcf3ce44SJohn Forte 
1936fcf3ce44SJohn Forte 
193782527734SSukumar Swaminathan /*
193882527734SSukumar Swaminathan  * HBA Management Service Reject Code
193982527734SSukumar Swaminathan  */
194082527734SSukumar Swaminathan #define	REJECT_CODE		0x9	/* Unable to perform command request */
1941fcf3ce44SJohn Forte 
194282527734SSukumar Swaminathan /*
194382527734SSukumar Swaminathan  * HBA Management Service Reject Reason Code
194482527734SSukumar Swaminathan  * Please refer to the Reason Codes above
194582527734SSukumar Swaminathan  */
1946fcf3ce44SJohn Forte 
194782527734SSukumar Swaminathan /*
194882527734SSukumar Swaminathan  * HBA Attribute Types
194982527734SSukumar Swaminathan  */
195082527734SSukumar Swaminathan #define	NODE_NAME		0x1
195182527734SSukumar Swaminathan #define	MANUFACTURER		0x2
195282527734SSukumar Swaminathan #define	SERIAL_NUMBER		0x3
195382527734SSukumar Swaminathan #define	MODEL			0x4
195482527734SSukumar Swaminathan #define	MODEL_DESCRIPTION	0x5
195582527734SSukumar Swaminathan #define	HARDWARE_VERSION	0x6
195682527734SSukumar Swaminathan #define	DRIVER_VERSION		0x7
195782527734SSukumar Swaminathan #define	OPTION_ROM_VERSION	0x8
195882527734SSukumar Swaminathan #define	FIRMWARE_VERSION	0x9
195982527734SSukumar Swaminathan #define	VENDOR_SPECIFIC		0xa
196082527734SSukumar Swaminathan #define	DRV_NAME		0xb
196182527734SSukumar Swaminathan #define	OS_NAME_VERSION		0xc
196282527734SSukumar Swaminathan #define	MAX_CT_PAYLOAD_LEN	0xd
1963fcf3ce44SJohn Forte 
196482527734SSukumar Swaminathan /*
196582527734SSukumar Swaminathan  * Port Attrubute Types
196682527734SSukumar Swaminathan  */
196782527734SSukumar Swaminathan #define	SUPPORTED_FC4_TYPES	0x1
196882527734SSukumar Swaminathan #define	SUPPORTED_SPEED		0x2
196982527734SSukumar Swaminathan #define	PORT_SPEED		0x3
197082527734SSukumar Swaminathan #define	MAX_FRAME_SIZE		0x4
197182527734SSukumar Swaminathan #define	OS_DEVICE_NAME		0x5
1972fcf3ce44SJohn Forte 
197382527734SSukumar Swaminathan union AttributesDef
197482527734SSukumar Swaminathan {
197582527734SSukumar Swaminathan 	/* Structure is in Big Endian format */
197682527734SSukumar Swaminathan 	struct
197782527734SSukumar Swaminathan 	{
197882527734SSukumar Swaminathan 		uint32_t	AttrType:16;
197982527734SSukumar Swaminathan 		uint32_t	AttrLen:16;
198082527734SSukumar Swaminathan 	} bits;
198182527734SSukumar Swaminathan 	uint32_t	word;
198282527734SSukumar Swaminathan };
1983fcf3ce44SJohn Forte 
198482527734SSukumar Swaminathan /*
198582527734SSukumar Swaminathan  * HBA Attribute Entry (8 - 260 bytes)
198682527734SSukumar Swaminathan  */
1987291a2b48SSukumar Swaminathan typedef struct
1988291a2b48SSukumar Swaminathan {
198982527734SSukumar Swaminathan 	union AttributesDef	ad;
1990291a2b48SSukumar Swaminathan 	union
1991291a2b48SSukumar Swaminathan 	{
199282527734SSukumar Swaminathan 		uint32_t	VendorSpecific;
199382527734SSukumar Swaminathan 		uint32_t	SupportSpeed;
199482527734SSukumar Swaminathan 		uint32_t	PortSpeed;
199582527734SSukumar Swaminathan 		uint32_t	MaxFrameSize;
199682527734SSukumar Swaminathan 		uint32_t	MaxCTPayloadLen;
199782527734SSukumar Swaminathan 		uint8_t		SupportFC4Types[32];
199882527734SSukumar Swaminathan 		uint8_t		OsDeviceName[256];
199982527734SSukumar Swaminathan 		uint8_t		Manufacturer[64];
200082527734SSukumar Swaminathan 		uint8_t		SerialNumber[64];
200182527734SSukumar Swaminathan 		uint8_t		Model[256];
200282527734SSukumar Swaminathan 		uint8_t		ModelDescription[256];
200382527734SSukumar Swaminathan 		uint8_t		HardwareVersion[256];
200482527734SSukumar Swaminathan 		uint8_t		DriverVersion[256];
200582527734SSukumar Swaminathan 		uint8_t		OptionROMVersion[256];
200682527734SSukumar Swaminathan 		uint8_t		FirmwareVersion[256];
200782527734SSukumar Swaminathan 		uint8_t		DriverName[256];
200882527734SSukumar Swaminathan 		NAME_TYPE	NodeName;
2009fcf3ce44SJohn Forte 	} un;
201082527734SSukumar Swaminathan } ATTRIBUTE_ENTRY, *PATTRIBUTE_ENTRY;
2011fcf3ce44SJohn Forte 
2012fcf3ce44SJohn Forte 
201382527734SSukumar Swaminathan /*
201482527734SSukumar Swaminathan  * HBA Attribute Block
201582527734SSukumar Swaminathan  */
2016291a2b48SSukumar Swaminathan typedef struct
2017291a2b48SSukumar Swaminathan {
201882527734SSukumar Swaminathan 	uint32_t	EntryCnt;	/* Number of HBA attribute entries */
201982527734SSukumar Swaminathan 	ATTRIBUTE_ENTRY	Entry;		/* Variable-length array */
202082527734SSukumar Swaminathan } ATTRIBUTE_BLOCK, *PATTRIBUTE_BLOCK;
2021fcf3ce44SJohn Forte 
2022fcf3ce44SJohn Forte 
2023fcf3ce44SJohn Forte /*
2024fcf3ce44SJohn Forte  * Port Entry
2025fcf3ce44SJohn Forte  */
2026291a2b48SSukumar Swaminathan typedef struct
2027291a2b48SSukumar Swaminathan {
2028291a2b48SSukumar Swaminathan 	NAME_TYPE	PortName;
2029fcf3ce44SJohn Forte } PORT_ENTRY, *PPORT_ENTRY;
2030fcf3ce44SJohn Forte 
2031fcf3ce44SJohn Forte /*
2032fcf3ce44SJohn Forte  * HBA Identifier
2033fcf3ce44SJohn Forte  */
2034291a2b48SSukumar Swaminathan typedef struct
2035291a2b48SSukumar Swaminathan {
2036291a2b48SSukumar Swaminathan 	NAME_TYPE	PortName;
2037fcf3ce44SJohn Forte } HBA_IDENTIFIER, *PHBA_IDENTIFIER;
2038fcf3ce44SJohn Forte 
2039fcf3ce44SJohn Forte /*
2040fcf3ce44SJohn Forte  * Registered Port List Format
2041fcf3ce44SJohn Forte  */
2042291a2b48SSukumar Swaminathan typedef struct
2043291a2b48SSukumar Swaminathan {
2044291a2b48SSukumar Swaminathan 	uint32_t	EntryCnt;
2045291a2b48SSukumar Swaminathan 	PORT_ENTRY	pe;	/* Variable-length array */
2046fcf3ce44SJohn Forte } REG_PORT_LIST, *PREG_PORT_LIST;
2047fcf3ce44SJohn Forte 
2048fcf3ce44SJohn Forte /*
2049fcf3ce44SJohn Forte  * Register HBA(RHBA)
2050fcf3ce44SJohn Forte  */
2051291a2b48SSukumar Swaminathan typedef struct
2052291a2b48SSukumar Swaminathan {
2053291a2b48SSukumar Swaminathan 	HBA_IDENTIFIER	hi;
2054291a2b48SSukumar Swaminathan 	REG_PORT_LIST	rpl;	/* variable-length array */
2055fcf3ce44SJohn Forte } REG_HBA, *PREG_HBA;
2056fcf3ce44SJohn Forte 
2057fcf3ce44SJohn Forte /*
2058fcf3ce44SJohn Forte  * Register HBA Attributes (RHAT)
2059fcf3ce44SJohn Forte  */
2060291a2b48SSukumar Swaminathan typedef struct
2061291a2b48SSukumar Swaminathan {
2062291a2b48SSukumar Swaminathan 	NAME_TYPE	HBA_PortName;
2063291a2b48SSukumar Swaminathan 	ATTRIBUTE_BLOCK	ab;
2064fcf3ce44SJohn Forte } REG_HBA_ATTRIBUTE, *PREG_HBA_ATTRIBUTE;
2065fcf3ce44SJohn Forte 
2066fcf3ce44SJohn Forte /*
2067fcf3ce44SJohn Forte  * Register Port Attributes (RPA)
2068fcf3ce44SJohn Forte  */
2069291a2b48SSukumar Swaminathan typedef struct
2070291a2b48SSukumar Swaminathan {
2071291a2b48SSukumar Swaminathan 	NAME_TYPE	HBA_PortName;
2072291a2b48SSukumar Swaminathan 	NAME_TYPE	PortName;
2073291a2b48SSukumar Swaminathan 	ATTRIBUTE_BLOCK	ab;
2074fcf3ce44SJohn Forte } REG_PORT_ATTRIBUTE, *PREG_PORT_ATTRIBUTE;
2075fcf3ce44SJohn Forte 
2076fcf3ce44SJohn Forte /*
2077fcf3ce44SJohn Forte  * Get Registered HBA List (GRHL) Accept Payload Format
2078fcf3ce44SJohn Forte  */
2079291a2b48SSukumar Swaminathan typedef struct
2080291a2b48SSukumar Swaminathan {
2081291a2b48SSukumar Swaminathan 	uint32_t	HBA__Entry_Cnt;	/* Number of Registered HBA Ids */
2082291a2b48SSukumar Swaminathan 	NAME_TYPE	HBA_PortName;	/* Variable-length array */
2083fcf3ce44SJohn Forte } GRHL_ACC_PAYLOAD, *PGRHL_ACC_PAYLOAD;
2084fcf3ce44SJohn Forte 
2085fcf3ce44SJohn Forte /*
2086fcf3ce44SJohn Forte  * Get Registered Port List (GRPL) Accept Payload Format
2087fcf3ce44SJohn Forte  */
2088291a2b48SSukumar Swaminathan typedef struct
2089291a2b48SSukumar Swaminathan {
2090291a2b48SSukumar Swaminathan 	uint32_t	RPL_Entry_Cnt;		/* No of Reg Port Entries */
2091291a2b48SSukumar Swaminathan 	PORT_ENTRY	eg_Port_Entry[1];	/* Variable-length array */
2092fcf3ce44SJohn Forte } GRPL_ACC_PAYLOAD, *PGRPL_ACC_PAYLOAD;
2093fcf3ce44SJohn Forte 
2094fcf3ce44SJohn Forte /*
2095fcf3ce44SJohn Forte  * Get Port Attributes (GPAT) Accept Payload Format
2096fcf3ce44SJohn Forte  */
2097fcf3ce44SJohn Forte 
2098291a2b48SSukumar Swaminathan typedef struct
2099291a2b48SSukumar Swaminathan {
2100291a2b48SSukumar Swaminathan 	ATTRIBUTE_BLOCK	pab;
2101fcf3ce44SJohn Forte } GPAT_ACC_PAYLOAD, *PGPAT_ACC_PAYLOAD;
2102fcf3ce44SJohn Forte 
2103fcf3ce44SJohn Forte /*
2104fcf3ce44SJohn Forte  * Use for Firmware DownLoad
2105fcf3ce44SJohn Forte  */
2106fcf3ce44SJohn Forte 
2107291a2b48SSukumar Swaminathan /* download.h */
2108291a2b48SSukumar Swaminathan 
2109291a2b48SSukumar Swaminathan #define	REDUCED_SRAM_CFG	0x7FFFC	/* 9802DC */
2110291a2b48SSukumar Swaminathan #define	FULL_SRAM_CFG		0x13FFFC	/* 9802   */
2111291a2b48SSukumar Swaminathan 
2112291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_SHIFT(x) ((x << 20))
2113291a2b48SSukumar Swaminathan #define	SLI_FW_ADAPTER_TYPE_MASK   0x00f00000
2114291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_6000  SLI_FW_TYPE_SHIFT(0)
2115291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_7000  SLI_FW_TYPE_SHIFT(1)
2116291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_8000  SLI_FW_TYPE_SHIFT(2)
2117291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_850   SLI_FW_TYPE_SHIFT(3)
2118291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_9000  SLI_FW_TYPE_SHIFT(4)
2119291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_950   SLI_FW_TYPE_SHIFT(5)
2120291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_9802  SLI_FW_TYPE_SHIFT(6)	/* [022702] */
2121291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_982   SLI_FW_TYPE_SHIFT(7)
2122291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_10000 SLI_FW_TYPE_SHIFT(8)
2123291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_1050  SLI_FW_TYPE_SHIFT(9)
2124291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_X1000 SLI_FW_TYPE_SHIFT(0xa)
2125291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_101   SLI_FW_TYPE_SHIFT(0xb)	/* LP101 */
2126291a2b48SSukumar Swaminathan 
2127291a2b48SSukumar Swaminathan 
2128291a2b48SSukumar Swaminathan enum emlxs_prog_type
2129291a2b48SSukumar Swaminathan {
2130fcf3ce44SJohn Forte 	TEST_PROGRAM,	/* 0 */
2131fcf3ce44SJohn Forte 	UTIL_PROGRAM,	/* 1 */
2132fcf3ce44SJohn Forte 	FUNC_FIRMWARE,	/* 2 */
2133fcf3ce44SJohn Forte 	BOOT_BIOS,	/* 3 */
2134fcf3ce44SJohn Forte 	CONFIG_DATA,	/* 4 */
2135fcf3ce44SJohn Forte 	SEQUENCER_CODE,	/* 5 */
2136fcf3ce44SJohn Forte 	SLI1_OVERLAY,	/* 6 */
2137fcf3ce44SJohn Forte 	SLI2_OVERLAY,	/* 7 */
213882527734SSukumar Swaminathan 	GASKET,		/* 8 */
2139fcf3ce44SJohn Forte 	HARDWARE_IMAGE,	/* 9 */
2140fcf3ce44SJohn Forte 	SBUS_FCODE,	/* A */
2141fcf3ce44SJohn Forte 	SLI3_OVERLAY,	/* B */
2142fcf3ce44SJohn Forte 	RESERVED_C,
2143fcf3ce44SJohn Forte 	RESERVED_D,
2144fcf3ce44SJohn Forte 	SLI4_OVERLAY,	/* E */
2145fcf3ce44SJohn Forte 	KERNEL_CODE,	/* F */
2146fcf3ce44SJohn Forte 	MAX_PROG_TYPES
2147fcf3ce44SJohn Forte } emlxs_prog_type_t;
2148fcf3ce44SJohn Forte 
2149fcf3ce44SJohn Forte 
2150291a2b48SSukumar Swaminathan typedef struct emlxs_fw_file
2151291a2b48SSukumar Swaminathan {
2152291a2b48SSukumar Swaminathan 	uint32_t	version;
2153291a2b48SSukumar Swaminathan 	uint32_t	revcomp;
2154291a2b48SSukumar Swaminathan 	char		label[16];
2155291a2b48SSukumar Swaminathan 	uint32_t	offset;
2156fcf3ce44SJohn Forte } emlxs_fw_file_t;
2157fcf3ce44SJohn Forte 
2158291a2b48SSukumar Swaminathan typedef struct emlxs_fw_image
2159291a2b48SSukumar Swaminathan {
2160fcf3ce44SJohn Forte 	emlxs_fw_file_t awc;
2161fcf3ce44SJohn Forte 	emlxs_fw_file_t bwc;
2162fcf3ce44SJohn Forte 	emlxs_fw_file_t dwc;
2163fcf3ce44SJohn Forte 	emlxs_fw_file_t prog[MAX_PROG_TYPES];
2164fcf3ce44SJohn Forte } emlxs_fw_image_t;
2165fcf3ce44SJohn Forte 
2166fcf3ce44SJohn Forte 
2167fcf3ce44SJohn Forte 
2168291a2b48SSukumar Swaminathan #define	NOP_IMAGE_TYPE		0xe1a00000
2169fcf3ce44SJohn Forte 
2170291a2b48SSukumar Swaminathan #define	FLASH_BASE_ADR		0x01400000
2171291a2b48SSukumar Swaminathan #define	DL_FROM_SLIM_OFFSET	MBOX_EXTENSION_OFFSET
2172fcf3ce44SJohn Forte 
2173fcf3ce44SJohn Forte #ifdef MBOX_EXT_SUPPORT
2174291a2b48SSukumar Swaminathan #define	DL_SLIM_SEG_BYTE_COUNT	MBOX_EXTENSION_SIZE
2175fcf3ce44SJohn Forte #else
2176291a2b48SSukumar Swaminathan #define	DL_SLIM_SEG_BYTE_COUNT	128
2177291a2b48SSukumar Swaminathan #endif /* MBOX_EXT_SUPPORT */
2178291a2b48SSukumar Swaminathan 
2179291a2b48SSukumar Swaminathan #define	SLI_CKSUM_LENGTH	4
2180291a2b48SSukumar Swaminathan #define	SLI_CKSUM_SEED		0x55555555
2181291a2b48SSukumar Swaminathan #define	SLI_CKSUM_ERR		0x1982abcd
2182291a2b48SSukumar Swaminathan 
2183291a2b48SSukumar Swaminathan #define	AIF_NOOP		0xe1a00000
2184291a2b48SSukumar Swaminathan #define	AIF_BLAL		0xeb000000
2185291a2b48SSukumar Swaminathan #define	OS_EXIT			0xef000011
2186291a2b48SSukumar Swaminathan #define	OS_GETENV		0xef000010
2187291a2b48SSukumar Swaminathan #define	AIF_IMAGEBASE		0x00008000
2188291a2b48SSukumar Swaminathan #define	AIF_BLZINIT		0xeb00000c
2189291a2b48SSukumar Swaminathan #define	DEBUG_TASK		0xef041d41
2190291a2b48SSukumar Swaminathan #define	AIF_DBG_SRC		2
2191291a2b48SSukumar Swaminathan #define	AIF_DBG_LL		1
2192291a2b48SSukumar Swaminathan #define	AIF_DATABASAT		0x100
2193291a2b48SSukumar Swaminathan 
2194291a2b48SSukumar Swaminathan #define	JEDEC_ID_ADDRESS	0x0080001c
2195291a2b48SSukumar Swaminathan #define	MAX_RBUS_SRAM_SIZE_ADR	0x788
2196291a2b48SSukumar Swaminathan #define	MAX_IBUS_SRAM_SIZE_ADR	0x78c
2197291a2b48SSukumar Swaminathan #define	FULL_RBUS_SRAM_CFG	0x7fffc
2198291a2b48SSukumar Swaminathan #define	FULL_IBUS_SRAM_CFG	0x187fffc
2199291a2b48SSukumar Swaminathan #define	REDUCED_RBUS_SRAM_CFG	0x5fffc
2200291a2b48SSukumar Swaminathan #define	REDUCED_IBUS_SRAM_CFG	0x183fffc
2201291a2b48SSukumar Swaminathan 
2202291a2b48SSukumar Swaminathan #define	FULL_SRAM_CFG_PROG_ID		1
2203291a2b48SSukumar Swaminathan #define	REDUCED_SRAM_CFG_PROG_ID	2
2204291a2b48SSukumar Swaminathan #define	OTHER_SRAM_CFG_PROG_ID		3
2205291a2b48SSukumar Swaminathan 
2206291a2b48SSukumar Swaminathan #define	NO_FLASH_MEM_AVAIL	0xf1
2207291a2b48SSukumar Swaminathan 
2208291a2b48SSukumar Swaminathan #define	PROG_TYPE_MASK		0xff000000
2209291a2b48SSukumar Swaminathan #define	PROG_TYPE_SHIFT		24
2210291a2b48SSukumar Swaminathan 
2211291a2b48SSukumar Swaminathan #define	FLASH_LOAD_LIST_ADR	0x79c
2212291a2b48SSukumar Swaminathan #define	RAM_LOAD_ENTRY_SIZE	9
2213291a2b48SSukumar Swaminathan #define	FLASH_LOAD_ENTRY_SIZE	6
2214291a2b48SSukumar Swaminathan #define	RAM_LOAD_ENTRY_TYPE	0
2215291a2b48SSukumar Swaminathan #define	FLASH_LOAD_ENTRY_TYPE	1
2216291a2b48SSukumar Swaminathan 
2217291a2b48SSukumar Swaminathan #define	CFG_DATA_NO_REGION	-3
2218291a2b48SSukumar Swaminathan 
2219291a2b48SSukumar Swaminathan #define	SLI_IMAGE_START		0x20080
2220291a2b48SSukumar Swaminathan #define	SLI_VERSION_LOC		0x270
2221fcf3ce44SJohn Forte 
2222fcf3ce44SJohn Forte 
2223291a2b48SSukumar Swaminathan #define	SLI_HW_REVISION_CHECK(x, y)	((x & 0xf0) == y)
2224291a2b48SSukumar Swaminathan #define	SLI_FCODE_REVISION_CHECK(x, y)	(x == y)
2225fcf3ce44SJohn Forte 
2226fcf3ce44SJohn Forte 
2227*8f23e9faSHans Rosenfeld /* ************ OBJ firmware ************** */
2228*8f23e9faSHans Rosenfeld #define	OBJ_MAX_XFER_SIZE	32768
2229*8f23e9faSHans Rosenfeld 
2230*8f23e9faSHans Rosenfeld 
2231a9800bebSGarrett D'Amore /* ************ BladeEngine ************** */
2232a9800bebSGarrett D'Amore #define	BE_SIGNATURE		"ServerEngines"
223382527734SSukumar Swaminathan #define	BE_DIR_SIGNATURE	"*** SE FLAS"
2234a9800bebSGarrett D'Amore #define	BE_BUILD_SIZE		24
223582527734SSukumar Swaminathan #define	BE_VERSION_SIZE		32
223682527734SSukumar Swaminathan #define	BE_COOKIE_SIZE		32
223782527734SSukumar Swaminathan #define	BE_CONTROLLER_SIZE	8
223882527734SSukumar Swaminathan #define	BE_FLASH_ENTRIES	32
223982527734SSukumar Swaminathan #define	BE_MAX_XFER_SIZE	32768 /* 4K aligned */
224082527734SSukumar Swaminathan 
2241a9800bebSGarrett D'Amore /* ************** BE3 **************** */
2242a9800bebSGarrett D'Amore #define	BE3_SIGNATURE_SIZE	52
2243a9800bebSGarrett D'Amore #define	BE3_MAX_IMAGE_HEADERS	32
2244a9800bebSGarrett D'Amore 
2245a9800bebSGarrett D'Amore typedef struct emlxs_be3_image_header
2246a9800bebSGarrett D'Amore {
2247a9800bebSGarrett D'Amore 	uint32_t id;
2248a9800bebSGarrett D'Amore #define	UFI_BE3_FLASH_ID	0x01
2249a9800bebSGarrett D'Amore 
2250a9800bebSGarrett D'Amore 	uint32_t offset;
2251a9800bebSGarrett D'Amore 	uint32_t length;
2252a9800bebSGarrett D'Amore 	uint32_t checksum;
2253a9800bebSGarrett D'Amore 	uint8_t version[BE_VERSION_SIZE];
2254a9800bebSGarrett D'Amore 
2255a9800bebSGarrett D'Amore } emlxs_be3_image_header_t;
2256a9800bebSGarrett D'Amore 
2257a9800bebSGarrett D'Amore typedef struct emlxs_be3_ufi_header
2258a9800bebSGarrett D'Amore {
2259a9800bebSGarrett D'Amore 	char signature[BE3_SIGNATURE_SIZE];
2260a9800bebSGarrett D'Amore 	uint32_t ufi_version;
2261a9800bebSGarrett D'Amore 	uint32_t file_length;
2262a9800bebSGarrett D'Amore 	uint32_t checksum;
2263a9800bebSGarrett D'Amore 	uint32_t antidote;
2264a9800bebSGarrett D'Amore 	uint32_t image_cnt;
2265a9800bebSGarrett D'Amore 	char build[BE_BUILD_SIZE];
2266a9800bebSGarrett D'Amore 	uint8_t resv1[32];
2267a9800bebSGarrett D'Amore 
2268a9800bebSGarrett D'Amore } emlxs_be3_ufi_header_t;
2269a9800bebSGarrett D'Amore 
2270a9800bebSGarrett D'Amore typedef struct emlxs_be3_ufi_controller
227182527734SSukumar Swaminathan {
227282527734SSukumar Swaminathan 	uint32_t vendor_id;
227382527734SSukumar Swaminathan 	uint32_t device_id;
227482527734SSukumar Swaminathan 	uint32_t sub_vendor_id;
227582527734SSukumar Swaminathan 	uint32_t sub_device_id;
227682527734SSukumar Swaminathan 
2277a9800bebSGarrett D'Amore } emlxs_be3_ufi_controller_t;
227882527734SSukumar Swaminathan 
2279a9800bebSGarrett D'Amore typedef struct emlxs_be3_flash_header
228082527734SSukumar Swaminathan {
2281a9800bebSGarrett D'Amore 	uint32_t format_rev;
228282527734SSukumar Swaminathan 	uint32_t checksum;
228382527734SSukumar Swaminathan 	uint32_t antidote;
2284a9800bebSGarrett D'Amore 	uint32_t entry_count;
2285a9800bebSGarrett D'Amore 	emlxs_be3_ufi_controller_t controller[BE_CONTROLLER_SIZE];
2286a9800bebSGarrett D'Amore 	uint32_t resv0;
2287a9800bebSGarrett D'Amore 	uint32_t resv1;
2288a9800bebSGarrett D'Amore 	uint32_t resv2;
2289a9800bebSGarrett D'Amore 	uint32_t resv3;
2290a9800bebSGarrett D'Amore } emlxs_be3_flash_header_t;
2291a9800bebSGarrett D'Amore 
2292a9800bebSGarrett D'Amore typedef struct emlxs_be3_flash_entry
2293a9800bebSGarrett D'Amore {
2294a9800bebSGarrett D'Amore 	uint32_t type;
2295a9800bebSGarrett D'Amore 	uint32_t offset;
2296a9800bebSGarrett D'Amore 	uint32_t block_size;
2297a9800bebSGarrett D'Amore 	uint32_t image_size;
2298a9800bebSGarrett D'Amore 	uint32_t checksum;
2299a9800bebSGarrett D'Amore 	uint32_t entry_point;
2300a9800bebSGarrett D'Amore 	uint32_t resv0;
2301a9800bebSGarrett D'Amore 	uint32_t resv1;
2302a9800bebSGarrett D'Amore 	char version[BE_VERSION_SIZE];
2303a9800bebSGarrett D'Amore 
2304a9800bebSGarrett D'Amore } emlxs_be3_flash_entry_t;
2305a9800bebSGarrett D'Amore 
2306a9800bebSGarrett D'Amore typedef struct emlxs_be3_flash_dir
2307a9800bebSGarrett D'Amore {
2308a9800bebSGarrett D'Amore 	char cookie[BE_COOKIE_SIZE];
2309a9800bebSGarrett D'Amore 	emlxs_be3_flash_header_t header;
2310a9800bebSGarrett D'Amore 	emlxs_be3_flash_entry_t entry[BE_FLASH_ENTRIES];
2311a9800bebSGarrett D'Amore 
2312a9800bebSGarrett D'Amore } emlxs_be3_flash_dir_t;
2313a9800bebSGarrett D'Amore 
2314a9800bebSGarrett D'Amore typedef struct emlxs_be3_ncsi_header {
2315a9800bebSGarrett D'Amore 	uint32_t magic;
2316a9800bebSGarrett D'Amore 	uint8_t hdr_len;
2317a9800bebSGarrett D'Amore 	uint8_t type;
2318a9800bebSGarrett D'Amore 	uint16_t hdr_ver;
2319a9800bebSGarrett D'Amore 	uint16_t rsvd0;
2320a9800bebSGarrett D'Amore 	uint16_t load_offset;
2321a9800bebSGarrett D'Amore 	uint32_t len;
2322a9800bebSGarrett D'Amore 	uint32_t flash_offset;
2323a9800bebSGarrett D'Amore 	uint8_t ver[16];
2324a9800bebSGarrett D'Amore 	uint8_t name[24];
2325a9800bebSGarrett D'Amore 	uint32_t img_cksum;
2326a9800bebSGarrett D'Amore 	uint32_t rsvd1;
2327a9800bebSGarrett D'Amore 	uint32_t hdr_cksum;
2328a9800bebSGarrett D'Amore } emlxs_be3_ncsi_header_t;
2329a9800bebSGarrett D'Amore 
2330a9800bebSGarrett D'Amore 
2331a9800bebSGarrett D'Amore /* ************** BE2 **************** */
2332a9800bebSGarrett D'Amore #define	BE2_SIGNATURE_SIZE	32
2333a9800bebSGarrett D'Amore 
2334a9800bebSGarrett D'Amore 
2335a9800bebSGarrett D'Amore typedef struct emlxs_be2_ufi_controller
2336a9800bebSGarrett D'Amore {
2337a9800bebSGarrett D'Amore 	uint32_t vendor_id;
2338a9800bebSGarrett D'Amore 	uint32_t device_id;
2339a9800bebSGarrett D'Amore 	uint32_t sub_vendor_id;
2340a9800bebSGarrett D'Amore 	uint32_t sub_device_id;
2341a9800bebSGarrett D'Amore 
2342a9800bebSGarrett D'Amore } emlxs_be2_ufi_controller_t;
2343a9800bebSGarrett D'Amore 
2344a9800bebSGarrett D'Amore typedef struct emlxs_be2_ufi_header
2345a9800bebSGarrett D'Amore {
2346a9800bebSGarrett D'Amore 	char signature[BE2_SIGNATURE_SIZE];
2347a9800bebSGarrett D'Amore 	uint32_t checksum;
2348a9800bebSGarrett D'Amore 	uint32_t antidote;
2349a9800bebSGarrett D'Amore 	emlxs_be2_ufi_controller_t  controller;
235082527734SSukumar Swaminathan 	uint32_t file_length;
235182527734SSukumar Swaminathan 	uint32_t chunk_num;
235282527734SSukumar Swaminathan 	uint32_t chunk_cnt;
235382527734SSukumar Swaminathan 	uint32_t image_cnt;
235482527734SSukumar Swaminathan 	char build[BE_BUILD_SIZE];
235582527734SSukumar Swaminathan 
2356a9800bebSGarrett D'Amore } emlxs_be2_ufi_header_t;
235782527734SSukumar Swaminathan 
2358a9800bebSGarrett D'Amore typedef struct emlxs_be2_flash_header /* 96 bytes */
235982527734SSukumar Swaminathan {
236082527734SSukumar Swaminathan 	uint32_t format_rev;
236182527734SSukumar Swaminathan 	uint32_t checksum;
236282527734SSukumar Swaminathan 	uint32_t antidote;
236382527734SSukumar Swaminathan 	uint32_t build_num;
2364a9800bebSGarrett D'Amore 	emlxs_be2_ufi_controller_t controller[BE_CONTROLLER_SIZE];
236582527734SSukumar Swaminathan 	uint32_t active_entry_mask;
236682527734SSukumar Swaminathan 	uint32_t valid_entry_mask;
236782527734SSukumar Swaminathan 	uint32_t orig_content_mask;
236882527734SSukumar Swaminathan 	uint32_t resv0;
236982527734SSukumar Swaminathan 	uint32_t resv1;
237082527734SSukumar Swaminathan 	uint32_t resv2;
237182527734SSukumar Swaminathan 	uint32_t resv3;
237282527734SSukumar Swaminathan 	uint32_t resv4;
237382527734SSukumar Swaminathan 
2374a9800bebSGarrett D'Amore } emlxs_be2_flash_header_t;
237582527734SSukumar Swaminathan 
2376a9800bebSGarrett D'Amore typedef struct emlxs_be2_flash_entry
237782527734SSukumar Swaminathan {
237882527734SSukumar Swaminathan 	uint32_t type;
237982527734SSukumar Swaminathan 	uint32_t offset;
238082527734SSukumar Swaminathan 	uint32_t pad_size;
238182527734SSukumar Swaminathan 	uint32_t image_size;
238282527734SSukumar Swaminathan 	uint32_t checksum;
238382527734SSukumar Swaminathan 	uint32_t entry_point;
238482527734SSukumar Swaminathan 	uint32_t resv0;
238582527734SSukumar Swaminathan 	uint32_t resv1;
238682527734SSukumar Swaminathan 	char version[BE_VERSION_SIZE];
238782527734SSukumar Swaminathan 
2388a9800bebSGarrett D'Amore } emlxs_be2_flash_entry_t;
238982527734SSukumar Swaminathan 
2390a9800bebSGarrett D'Amore typedef struct emlxs_be2_flash_dir
239182527734SSukumar Swaminathan {
239282527734SSukumar Swaminathan 	char cookie[BE_COOKIE_SIZE];
2393a9800bebSGarrett D'Amore 	emlxs_be2_flash_header_t header;
2394a9800bebSGarrett D'Amore 	emlxs_be2_flash_entry_t entry[BE_FLASH_ENTRIES];
239582527734SSukumar Swaminathan 
2396a9800bebSGarrett D'Amore } emlxs_be2_flash_dir_t;
239782527734SSukumar Swaminathan 
239882527734SSukumar Swaminathan 
239982527734SSukumar Swaminathan /* FLASH ENTRY TYPES */
2400*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_NCSI_FIRMWARE		0x10 /* BE3 */
2401*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_PXE_BIOS			0x20
2402*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_BIOS			0x21
2403*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_BIOS			0x22
2404*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FLASH_ISM			0x30 /* BE3 */
2405*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_FIRMWARE		0xA0
2406*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_FIRMWARE_COMP	0xA1
2407*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_FIRMWARE		0xA2
2408*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_FIRMWARE_COMP		0xA3
2409*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_BACKUP		0xB0
2410*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_BACKUP_COMP		0xB1
2411*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_BACKUP		0xB2
2412*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_BACKUP_COMP		0xB3
2413*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_PHY_FIRMWARE		0xC0 /* 10Base-T */
2414*8f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_REDBOOT			0xE0
241582527734SSukumar Swaminathan 
241682527734SSukumar Swaminathan /* Flash types in download order */
241782527734SSukumar Swaminathan typedef enum emlxs_be_flashtypes
241882527734SSukumar Swaminathan {
2419*8f23e9faSHans Rosenfeld 	PHY_FIRMWARE_FLASHTYPE,
2420a9800bebSGarrett D'Amore 	NCSI_FIRMWARE_FLASHTYPE,
242182527734SSukumar Swaminathan 	ISCSI_FIRMWARE_FLASHTYPE,
242282527734SSukumar Swaminathan 	ISCSI_BACKUP_FLASHTYPE,
242382527734SSukumar Swaminathan 	FCOE_FIRMWARE_FLASHTYPE,
242482527734SSukumar Swaminathan 	FCOE_BACKUP_FLASHTYPE,
242582527734SSukumar Swaminathan 	ISCSI_BIOS_FLASHTYPE,
242682527734SSukumar Swaminathan 	FCOE_BIOS_FLASHTYPE,
242782527734SSukumar Swaminathan 	PXE_BIOS_FLASHTYPE,
242882527734SSukumar Swaminathan 	REDBOOT_FLASHTYPE,
242982527734SSukumar Swaminathan 	BE_MAX_FLASHTYPES
243082527734SSukumar Swaminathan 
243182527734SSukumar Swaminathan } emlxs_be_flashtypes_t;
243282527734SSukumar Swaminathan 
243382527734SSukumar Swaminathan /* Driver level constructs */
243482527734SSukumar Swaminathan typedef struct emlxs_be_fw_file
243582527734SSukumar Swaminathan {
2436a9800bebSGarrett D'Amore 	uint32_t 	be_version;
2437a9800bebSGarrett D'Amore 	uint32_t	ufi_plus;
2438a9800bebSGarrett D'Amore 
243982527734SSukumar Swaminathan 	uint32_t	type;
244082527734SSukumar Swaminathan 	uint32_t	image_offset;
244182527734SSukumar Swaminathan 	uint32_t	image_size;
244282527734SSukumar Swaminathan 	uint32_t	block_size;
244382527734SSukumar Swaminathan 	uint32_t	block_crc;
2444a9800bebSGarrett D'Amore 	uint32_t	load_address; /* BE3 */
244582527734SSukumar Swaminathan 	char		label[BE_VERSION_SIZE];
244682527734SSukumar Swaminathan } emlxs_be_fw_file_t;
244782527734SSukumar Swaminathan 
244882527734SSukumar Swaminathan typedef struct emlxs_be_fw_image
244982527734SSukumar Swaminathan {
2450a9800bebSGarrett D'Amore 	uint32_t 	be_version;
2451a9800bebSGarrett D'Amore 	uint32_t	ufi_plus;
2452a9800bebSGarrett D'Amore 
2453a9800bebSGarrett D'Amore 	uint32_t fcoe_version;
2454a9800bebSGarrett D'Amore 	char fcoe_label[BE_VERSION_SIZE];
2455a9800bebSGarrett D'Amore 
2456a9800bebSGarrett D'Amore 	uint32_t iscsi_version;
2457a9800bebSGarrett D'Amore 	char iscsi_label[BE_VERSION_SIZE];
245882527734SSukumar Swaminathan 
245982527734SSukumar Swaminathan 	emlxs_be_fw_file_t file[BE_MAX_FLASHTYPES];
246082527734SSukumar Swaminathan } emlxs_be_fw_image_t;
246182527734SSukumar Swaminathan 
2462*8f23e9faSHans Rosenfeld 
2463*8f23e9faSHans Rosenfeld typedef struct emlxs_obj_header
2464*8f23e9faSHans Rosenfeld {
2465*8f23e9faSHans Rosenfeld 	uint32_t 	FileSize;
2466*8f23e9faSHans Rosenfeld 
2467*8f23e9faSHans Rosenfeld #ifdef EMLXS_BIG_ENDIAN
2468*8f23e9faSHans Rosenfeld 	uint16_t 	MagicNumHi;
2469*8f23e9faSHans Rosenfeld 	uint16_t 	MagicNumLo;
2470*8f23e9faSHans Rosenfeld 
2471*8f23e9faSHans Rosenfeld 	uint32_t 	FileType:8;
2472*8f23e9faSHans Rosenfeld 	uint32_t 	Id:8;
2473*8f23e9faSHans Rosenfeld 	uint32_t 	rsvd0:16;
2474*8f23e9faSHans Rosenfeld #endif
2475*8f23e9faSHans Rosenfeld 
2476*8f23e9faSHans Rosenfeld #ifdef EMLXS_LITTLE_ENDIAN
2477*8f23e9faSHans Rosenfeld 	uint16_t 	MagicNumLo;
2478*8f23e9faSHans Rosenfeld 	uint16_t 	MagicNumHi;
2479*8f23e9faSHans Rosenfeld 
2480*8f23e9faSHans Rosenfeld 	uint32_t 	rsvd0:16;
2481*8f23e9faSHans Rosenfeld 	uint32_t 	Id:8;
2482*8f23e9faSHans Rosenfeld 	uint32_t 	FileType:8;
2483*8f23e9faSHans Rosenfeld #endif
2484*8f23e9faSHans Rosenfeld 
2485*8f23e9faSHans Rosenfeld #define	OBJ_MAGIC_NUM_HI		0xFEAA
2486*8f23e9faSHans Rosenfeld #define	OBJ_MAGIC_NUM_LO		0x0001
2487*8f23e9faSHans Rosenfeld 
2488*8f23e9faSHans Rosenfeld #define	OBJ_GRP_FILE_TYPE		0xF7
2489*8f23e9faSHans Rosenfeld 
2490*8f23e9faSHans Rosenfeld #define	OBJ_LANCER_ID			0xA2
2491*8f23e9faSHans Rosenfeld 
2492*8f23e9faSHans Rosenfeld 	char		RevName[128];
2493*8f23e9faSHans Rosenfeld 	char		Date[12];
2494*8f23e9faSHans Rosenfeld 	char		Revision[32];
2495*8f23e9faSHans Rosenfeld } emlxs_obj_header_t;
2496*8f23e9faSHans Rosenfeld 
2497*8f23e9faSHans Rosenfeld 
2498fcf3ce44SJohn Forte #ifdef	__cplusplus
2499fcf3ce44SJohn Forte }
2500fcf3ce44SJohn Forte #endif
2501fcf3ce44SJohn Forte 
2502fcf3ce44SJohn Forte #endif	/* _EMLXS_HW_H */
2503