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  *
88f23e9faSHans Rosenfeld  * You can obtain a copy of the license at
98f23e9faSHans 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 /*
238f23e9faSHans Rosenfeld  * Copyright (c) 2004-2011 Emulex. All rights reserved.
2482527734SSukumar Swaminathan  * Use is subject to license terms.
25a3170057SPaul Winder  * Copyright 2020 RackTop Systems, Inc.
26fcf3ce44SJohn Forte  */
27fcf3ce44SJohn Forte 
28fcf3ce44SJohn Forte #ifndef _EMLXS_HW_H
29fcf3ce44SJohn Forte #define	_EMLXS_HW_H
30fcf3ce44SJohn Forte 
31fcf3ce44SJohn Forte #ifdef	__cplusplus
32fcf3ce44SJohn Forte extern "C" {
33fcf3ce44SJohn Forte #endif
34fcf3ce44SJohn Forte 
35291a2b48SSukumar Swaminathan #define	MAX_VPORTS			256	/* Max virtual ports per HBA */
36291a2b48SSukumar Swaminathan 						/* (includes physical port) */
37fcf3ce44SJohn Forte #define	MAX_VPORTS_LIMITED		101
38fcf3ce44SJohn Forte 
39291a2b48SSukumar Swaminathan #define	FC_MAX_TRANSFER			0x40000	/* Max transfer size per */
40291a2b48SSukumar Swaminathan 						/* operation */
41fcf3ce44SJohn Forte 
42fcf3ce44SJohn Forte #define	MAX_RINGS_AVAILABLE		4	/* # rings available */
43fcf3ce44SJohn Forte #define	MAX_RINGS			4	/* Max # rings used */
44fcf3ce44SJohn Forte 
45fcf3ce44SJohn Forte #define	PCB_SIZE			128
46fcf3ce44SJohn Forte 
47fcf3ce44SJohn Forte #define	SLIM_IOCB_CMD_R0_ENTRIES	128	/* SLI FCP cmd ring entries  */
48fcf3ce44SJohn Forte #define	SLIM_IOCB_RSP_R0_ENTRIES	128	/* SLI FCP rsp ring entries */
4982527734SSukumar Swaminathan #define	SLIM_IOCB_CMD_R1_ENTRIES	128	/* SLI IP cmd ring entries   */
5082527734SSukumar Swaminathan #define	SLIM_IOCB_RSP_R1_ENTRIES	128	/* SLI IP rsp ring entries  */
5182527734SSukumar Swaminathan #define	SLIM_IOCB_CMD_R2_ENTRIES	128	/* SLI ELS cmd ring entries  */
5282527734SSukumar Swaminathan #define	SLIM_IOCB_RSP_R2_ENTRIES	128	/* SLI ELS rspe ring entries */
5382527734SSukumar Swaminathan #define	SLIM_IOCB_CMD_R3_ENTRIES	128	/* SLI CT cmd ring entries   */
5482527734SSukumar Swaminathan #define	SLIM_IOCB_RSP_R3_ENTRIES	128	/* SLI CT rsp ring entries  */
55291a2b48SSukumar Swaminathan 
56291a2b48SSukumar Swaminathan /*
57291a2b48SSukumar Swaminathan  * Total: 184 Cmd's + 184 Rsp's = 368
58291a2b48SSukumar Swaminathan  * Command and response entry counts are not required to be equal
59291a2b48SSukumar Swaminathan  */
60fcf3ce44SJohn Forte 
61291a2b48SSukumar Swaminathan #define	SLIM_IOCB_CMD_ENTRIES		(SLIM_IOCB_CMD_R0_ENTRIES + \
62291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_R1_ENTRIES + \
63291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_R2_ENTRIES + \
64291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_R3_ENTRIES)
65fcf3ce44SJohn Forte 
66291a2b48SSukumar Swaminathan #define	SLIM_IOCB_RSP_ENTRIES		(SLIM_IOCB_RSP_R0_ENTRIES + \
67291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_R1_ENTRIES + \
68291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_R2_ENTRIES + \
69291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_R3_ENTRIES)
70fcf3ce44SJohn Forte 
71291a2b48SSukumar Swaminathan #define	SLIM_IOCB_ENTRIES		(SLIM_IOCB_CMD_ENTRIES + \
72291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_ENTRIES)
73fcf3ce44SJohn Forte 
74fcf3ce44SJohn Forte 
75fcf3ce44SJohn Forte /* SLI1 Definitions */
76291a2b48SSukumar Swaminathan #define	SLI_SLIM1_SIZE			4096 /* Fixed size memory */
77fcf3ce44SJohn Forte 
78fcf3ce44SJohn Forte 
79fcf3ce44SJohn Forte /* SLI2 Definitions */
80fcf3ce44SJohn Forte #define	SLI2_IOCB_CMD_SIZE		32
81fcf3ce44SJohn Forte #define	SLI2_IOCB_RSP_SIZE		32
82291a2b48SSukumar Swaminathan #define	SLI2_IOCB_MAX_SIZE		((SLI2_IOCB_CMD_SIZE * \
83291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_ENTRIES) + \
84291a2b48SSukumar Swaminathan 					(SLI2_IOCB_RSP_SIZE * \
85291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_ENTRIES))
86291a2b48SSukumar Swaminathan #define	SLI2_SLIM2_SIZE			(MBOX_SIZE + MBOX_EXTENSION_SIZE + \
87291a2b48SSukumar Swaminathan 					PCB_SIZE + SLI2_IOCB_MAX_SIZE)
88291a2b48SSukumar Swaminathan 
89fcf3ce44SJohn Forte 
90fcf3ce44SJohn Forte /* SLI3 Definitions */
91fcf3ce44SJohn Forte #define	SLI3_MAX_BDE			7
92fcf3ce44SJohn Forte #define	SLI3_IOCB_CMD_SIZE		128
93fcf3ce44SJohn Forte #define	SLI3_IOCB_RSP_SIZE		64
94291a2b48SSukumar Swaminathan #define	SLI3_IOCB_MAX_SIZE		((SLI3_IOCB_CMD_SIZE * \
95291a2b48SSukumar Swaminathan 					SLIM_IOCB_CMD_ENTRIES) + \
96291a2b48SSukumar Swaminathan 					(SLI3_IOCB_RSP_SIZE * \
97291a2b48SSukumar Swaminathan 					SLIM_IOCB_RSP_ENTRIES))
98291a2b48SSukumar Swaminathan #define	SLI3_SLIM2_SIZE			(MBOX_SIZE + MBOX_EXTENSION_SIZE + \
99291a2b48SSukumar Swaminathan 					PCB_SIZE + SLI3_IOCB_MAX_SIZE)
100fcf3ce44SJohn Forte 
101fcf3ce44SJohn Forte #define	SLI_SLIM2_SIZE			SLI3_SLIM2_SIZE
102fcf3ce44SJohn Forte #define	SLI_IOCB_MAX_SIZE		SLI3_IOCB_MAX_SIZE
103fcf3ce44SJohn Forte 
104fcf3ce44SJohn Forte 
10582527734SSukumar Swaminathan /* These two are defined to indicate FCP cmd or non FCP cmd */
10682527734SSukumar Swaminathan #define	FC_FCP_CMD		0
10782527734SSukumar Swaminathan #define	FC_FCT_CMD		0
10882527734SSukumar Swaminathan #define	FC_IP_CMD		1
10982527734SSukumar Swaminathan #define	FC_ELS_CMD		2
11082527734SSukumar Swaminathan #define	FC_CT_CMD		3
11182527734SSukumar Swaminathan 
11282527734SSukumar Swaminathan #define	FC_NFCP_CMD		1	/* could be a bit mask */
113fcf3ce44SJohn Forte 
114fcf3ce44SJohn Forte #define	FC_MAXRETRY		3	/* max retries for ELS commands */
115291a2b48SSukumar Swaminathan #define	FC_FCP_RING		0	/* use ring 0 for FCP initiator cmds */
116291a2b48SSukumar Swaminathan #define	FC_FCT_RING		0	/* use ring 0 for FCP target cmds */
117fcf3ce44SJohn Forte 
118fcf3ce44SJohn Forte #define	FC_IP_RING		1	/* use ring 1 for IP commands */
119fcf3ce44SJohn Forte #define	FC_ELS_RING		2	/* use ring 2 for ELS commands */
120fcf3ce44SJohn Forte #define	FC_CT_RING		3	/* use ring 3 for CT commands */
121fcf3ce44SJohn Forte 
122fcf3ce44SJohn Forte #define	FF_DEF_EDTOV		2000	/* Default E_D_TOV (2000ms) */
123fcf3ce44SJohn Forte #define	FF_DEF_ALTOV		15	/* Default AL_TIME (15ms) */
124*e2d1a434SCarsten Grzemba #define	FF_DEF_RATOV		10	/* Default RA_TOV (10s) */
125fcf3ce44SJohn Forte #define	FF_DEF_ARBTOV		1900	/* Default ARB_TOV (1900ms) */
126291a2b48SSukumar Swaminathan #define	MAX_MSG_DATA		28	/* max msg data in CMD_ADAPTER_MSG */
127291a2b48SSukumar Swaminathan 					/* iocb */
128291a2b48SSukumar Swaminathan #define	FF_REG_AREA_SIZE	256	/* size, in bytes, of i/o register */
129291a2b48SSukumar Swaminathan 					/* area */
130fcf3ce44SJohn Forte 
131fcf3ce44SJohn Forte /*
132fcf3ce44SJohn Forte  * Miscellaneous stuff....
133fcf3ce44SJohn Forte  */
1348f23e9faSHans Rosenfeld 
1358f23e9faSHans Rosenfeld #define	MAX_NODE_THROTTLE	2048
1368f23e9faSHans Rosenfeld 
137fcf3ce44SJohn Forte /* HBA Mgmt */
138fcf3ce44SJohn Forte #define	FDMI_DID		((uint32_t)0xfffffa)
13982527734SSukumar Swaminathan #define	NAMESERVER_DID		((uint32_t)0xfffffc)
140fcf3ce44SJohn Forte #define	SCR_DID			((uint32_t)0xfffffd)
14182527734SSukumar Swaminathan #define	FABRIC_DID		((uint32_t)0xfffffe)
14282527734SSukumar Swaminathan #define	BCAST_DID		((uint32_t)0xffffff)
14382527734SSukumar Swaminathan #define	MASK_DID		((uint32_t)0xffffff)
144fcf3ce44SJohn Forte #define	CT_DID_MASK		((uint32_t)0xffff00)
14582527734SSukumar Swaminathan #define	FABRIC_DID_MASK		((uint32_t)0xfff000)
146fcf3ce44SJohn Forte #define	WELL_KNOWN_DID_MASK	((uint32_t)0xfffff0)
147fcf3ce44SJohn Forte 
148fcf3ce44SJohn Forte #define	EMLXS_MENLO_DID		((uint32_t)0x00fc0e)
149fcf3ce44SJohn Forte 
150fcf3ce44SJohn Forte #define	OWN_CHIP	1	/* IOCB / Mailbox is owned by FireFly */
151fcf3ce44SJohn Forte #define	OWN_HOST	0	/* IOCB / Mailbox is owned by Host */
152291a2b48SSukumar Swaminathan #define	END_OF_CHAIN	0
153fcf3ce44SJohn Forte 
154fcf3ce44SJohn Forte 
155fcf3ce44SJohn Forte /* defines for type field in fc header */
156fcf3ce44SJohn Forte #define	EMLXS_MENLO_TYPE	0xFE
157fcf3ce44SJohn Forte 
158fcf3ce44SJohn Forte /* defines for rctl field in fc header */
159fcf3ce44SJohn Forte #define	FC_DEV_DATA	0x0
160fcf3ce44SJohn Forte #define	FC_UNSOL_CTL	0x2
161fcf3ce44SJohn Forte #define	FC_SOL_CTL	0x3
162fcf3ce44SJohn Forte #define	FC_UNSOL_DATA	0x4
163fcf3ce44SJohn Forte #define	FC_FCP_CMND	0x6
164fcf3ce44SJohn Forte #define	FC_ELS_REQ	0x22
165fcf3ce44SJohn Forte #define	FC_ELS_RSP	0x23
166fcf3ce44SJohn Forte #define	FC_NET_HDR	0x20	/* network headers for Dfctl field */
167fcf3ce44SJohn Forte 
168fcf3ce44SJohn Forte /*
169fcf3ce44SJohn Forte  * Common Transport structures and definitions
170fcf3ce44SJohn Forte  *
171fcf3ce44SJohn Forte  */
172fcf3ce44SJohn Forte #define	EMLXS_COMMAND	0
173fcf3ce44SJohn Forte #define	EMLXS_RESPONSE	1
174fcf3ce44SJohn Forte 
175291a2b48SSukumar Swaminathan typedef union CtRevisionId
176291a2b48SSukumar Swaminathan {
177fcf3ce44SJohn Forte 	/* Structure is in Big Endian format */
178291a2b48SSukumar Swaminathan 	struct
179291a2b48SSukumar Swaminathan 	{
180291a2b48SSukumar Swaminathan 		uint32_t	Revision:8;
181291a2b48SSukumar Swaminathan 		uint32_t	InId:24;
182fcf3ce44SJohn Forte 	} bits;
183291a2b48SSukumar Swaminathan 	uint32_t	word;
184fcf3ce44SJohn Forte } CtRevisionId_t;
185fcf3ce44SJohn Forte 
186291a2b48SSukumar Swaminathan typedef union CtCommandResponse
187291a2b48SSukumar Swaminathan {
188fcf3ce44SJohn Forte 	/* Structure is in Big Endian format */
189291a2b48SSukumar Swaminathan 	struct
190291a2b48SSukumar Swaminathan 	{
191291a2b48SSukumar Swaminathan 		uint32_t	CmdRsp:16;
192291a2b48SSukumar Swaminathan 		uint32_t	Size:16;
193fcf3ce44SJohn Forte 	} bits;
194291a2b48SSukumar Swaminathan 	uint32_t	word;
195fcf3ce44SJohn Forte } CtCommandResponse_t;
196fcf3ce44SJohn Forte 
197291a2b48SSukumar Swaminathan typedef struct SliCtRequest
198291a2b48SSukumar Swaminathan {
199fcf3ce44SJohn Forte 	/* Structure is in Big Endian format */
200291a2b48SSukumar Swaminathan 	CtRevisionId_t		RevisionId;
201291a2b48SSukumar Swaminathan 	uint8_t			FsType;
202291a2b48SSukumar Swaminathan 	uint8_t			FsSubType;
203291a2b48SSukumar Swaminathan 	uint8_t			Options;
204291a2b48SSukumar Swaminathan 	uint8_t			Rsrvd1;
205291a2b48SSukumar Swaminathan 	CtCommandResponse_t	CommandResponse;
206291a2b48SSukumar Swaminathan 	uint8_t			Rsrvd2;
207291a2b48SSukumar Swaminathan 	uint8_t			ReasonCode;
208291a2b48SSukumar Swaminathan 	uint8_t			Explanation;
209291a2b48SSukumar Swaminathan 	uint8_t			VendorUnique;
210291a2b48SSukumar Swaminathan 
211291a2b48SSukumar Swaminathan 	union
212291a2b48SSukumar Swaminathan 	{
213291a2b48SSukumar Swaminathan 		uint32_t	data;
214291a2b48SSukumar Swaminathan 		uint32_t	PortID;
215291a2b48SSukumar Swaminathan 
216291a2b48SSukumar Swaminathan 		struct gid
217291a2b48SSukumar Swaminathan 		{
218291a2b48SSukumar Swaminathan 			uint8_t	PortType;	/* for GID_PT requests */
219291a2b48SSukumar Swaminathan 			uint8_t	DomainScope;
220291a2b48SSukumar Swaminathan 			uint8_t	AreaScope;
221291a2b48SSukumar Swaminathan 			uint8_t	Fc4Type;	/* for GID_FT requests */
222fcf3ce44SJohn Forte 		} gid;
223291a2b48SSukumar Swaminathan 		struct rft
224291a2b48SSukumar Swaminathan 		{
225291a2b48SSukumar Swaminathan 			uint32_t	PortId;	/* For RFT_ID requests */
226fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
227291a2b48SSukumar Swaminathan 			uint32_t	rsvd0:16;
228291a2b48SSukumar Swaminathan 			uint32_t	rsvd1:7;
229291a2b48SSukumar Swaminathan 			uint32_t	fcpReg:1;	/* Type 8 */
230291a2b48SSukumar Swaminathan 			uint32_t	rsvd2:2;
231291a2b48SSukumar Swaminathan 			uint32_t	ipReg:1;	/* Type 5 */
232291a2b48SSukumar Swaminathan 			uint32_t	rsvd3:5;
233fcf3ce44SJohn Forte #endif
234fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
235291a2b48SSukumar Swaminathan 			uint32_t	rsvd0:16;
236291a2b48SSukumar Swaminathan 			uint32_t	fcpReg:1;	/* Type 8 */
237291a2b48SSukumar Swaminathan 			uint32_t	rsvd1:7;
238291a2b48SSukumar Swaminathan 			uint32_t	rsvd3:5;
239291a2b48SSukumar Swaminathan 			uint32_t	ipReg:1;	/* Type 5 */
240291a2b48SSukumar Swaminathan 			uint32_t	rsvd2:2;
241291a2b48SSukumar Swaminathan #endif
242291a2b48SSukumar Swaminathan 			uint32_t	rsvd[7];
243fcf3ce44SJohn Forte 		} rft;
244fcf3ce44SJohn Forte 
245291a2b48SSukumar Swaminathan 		struct rsnn
246291a2b48SSukumar Swaminathan 		{
247291a2b48SSukumar Swaminathan 			uint8_t		wwnn[8];
248291a2b48SSukumar Swaminathan 			uint8_t		snn_len;
249291a2b48SSukumar Swaminathan 			char		snn[256];
250fcf3ce44SJohn Forte 		} rsnn;
251fcf3ce44SJohn Forte 
252291a2b48SSukumar Swaminathan 		struct rspn
253291a2b48SSukumar Swaminathan 		{
254291a2b48SSukumar Swaminathan 			uint32_t	PortId;
255291a2b48SSukumar Swaminathan 			uint8_t		spn_len;
256291a2b48SSukumar Swaminathan 			char		spn[256];
257fcf3ce44SJohn Forte 		} rspn;
258fcf3ce44SJohn Forte 	} un;
259fcf3ce44SJohn Forte } SliCtRequest_t;
260fcf3ce44SJohn Forte typedef SliCtRequest_t SLI_CT_REQUEST;
261fcf3ce44SJohn Forte 
262291a2b48SSukumar Swaminathan #define	SLI_CT_REVISION	1
263fcf3ce44SJohn Forte 
264fcf3ce44SJohn Forte 
265fcf3ce44SJohn Forte /*
266fcf3ce44SJohn Forte  * FsType Definitions
267fcf3ce44SJohn Forte  */
268fcf3ce44SJohn Forte 
269291a2b48SSukumar Swaminathan #define	SLI_CT_MANAGEMENT_SERVICE		0xFA
270291a2b48SSukumar Swaminathan #define	SLI_CT_TIME_SERVICE			0xFB
271291a2b48SSukumar Swaminathan #define	SLI_CT_DIRECTORY_SERVICE		0xFC
272291a2b48SSukumar Swaminathan #define	SLI_CT_FABRIC_CONTROLLER_SERVICE	0xFD
273fcf3ce44SJohn Forte 
274fcf3ce44SJohn Forte /*
275fcf3ce44SJohn Forte  * Directory Service Subtypes
276fcf3ce44SJohn Forte  */
277fcf3ce44SJohn Forte 
278291a2b48SSukumar Swaminathan #define	SLI_CT_DIRECTORY_NAME_SERVER	0x02
279fcf3ce44SJohn Forte 
280fcf3ce44SJohn Forte /*
281fcf3ce44SJohn Forte  * Response Codes
282fcf3ce44SJohn Forte  */
283fcf3ce44SJohn Forte 
284291a2b48SSukumar Swaminathan #define	SLI_CT_RESPONSE_FS_RJT	0x8001
285291a2b48SSukumar Swaminathan #define	SLI_CT_RESPONSE_FS_ACC	0x8002
286fcf3ce44SJohn Forte 
287fcf3ce44SJohn Forte /*
288fcf3ce44SJohn Forte  * Reason Codes
289fcf3ce44SJohn Forte  */
290fcf3ce44SJohn Forte 
291291a2b48SSukumar Swaminathan #define	SLI_CT_NO_ADDITIONAL_EXPL		0x0
292291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_COMMAND			0x01
293291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_VERSION			0x02
294291a2b48SSukumar Swaminathan #define	SLI_CT_LOGICAL_ERROR			0x03
295291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_IU_SIZE			0x04
296291a2b48SSukumar Swaminathan #define	SLI_CT_LOGICAL_BUSY			0x05
297291a2b48SSukumar Swaminathan #define	SLI_CT_PROTOCOL_ERROR			0x07
298291a2b48SSukumar Swaminathan #define	SLI_CT_UNABLE_TO_PERFORM_REQ		0x09
299291a2b48SSukumar Swaminathan #define	SLI_CT_REQ_NOT_SUPPORTED		0x0b
300291a2b48SSukumar Swaminathan #define	SLI_CT_HBA_INFO_NOT_REGISTERED		0x10
301291a2b48SSukumar Swaminathan #define	SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE	0x11
302291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN	0x12
303291a2b48SSukumar Swaminathan #define	SLI_CT_HBA_ATTR_NOT_PRESENT		0x13
304291a2b48SSukumar Swaminathan #define	SLI_CT_PORT_INFO_NOT_REGISTERED		0x20
305291a2b48SSukumar Swaminathan #define	SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE	0x21
306291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN	0x22
307291a2b48SSukumar Swaminathan #define	SLI_CT_VENDOR_UNIQUE			0xff
308fcf3ce44SJohn Forte 
309fcf3ce44SJohn Forte /*
310fcf3ce44SJohn Forte  * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
311fcf3ce44SJohn Forte  */
312fcf3ce44SJohn Forte 
313291a2b48SSukumar Swaminathan #define	SLI_CT_NO_PORT_ID		0x01
314291a2b48SSukumar Swaminathan #define	SLI_CT_NO_PORT_NAME		0x02
315291a2b48SSukumar Swaminathan #define	SLI_CT_NO_NODE_NAME		0x03
316291a2b48SSukumar Swaminathan #define	SLI_CT_NO_CLASS_OF_SERVICE	0x04
317291a2b48SSukumar Swaminathan #define	SLI_CT_NO_IP_ADDRESS		0x05
318291a2b48SSukumar Swaminathan #define	SLI_CT_NO_IPA			0x06
319291a2b48SSukumar Swaminathan #define	SLI_CT_NO_FC4_TYPES		0x07
320291a2b48SSukumar Swaminathan #define	SLI_CT_NO_SYMBOLIC_PORT_NAME	0x08
321291a2b48SSukumar Swaminathan #define	SLI_CT_NO_SYMBOLIC_NODE_NAME	0x09
322291a2b48SSukumar Swaminathan #define	SLI_CT_NO_PORT_TYPE		0x0A
323291a2b48SSukumar Swaminathan #define	SLI_CT_ACCESS_DENIED		0x10
324291a2b48SSukumar Swaminathan #define	SLI_CT_INVALID_PORT_ID		0x11
325291a2b48SSukumar Swaminathan #define	SLI_CT_DATABASE_EMPTY		0x12
326fcf3ce44SJohn Forte 
327fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
328fcf3ce44SJohn Forte #define	CT_CMD_MASK	0xffff0000
329fcf3ce44SJohn Forte #endif
330fcf3ce44SJohn Forte 
331fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
332fcf3ce44SJohn Forte #define	CT_CMD_MASK	0xffff
333fcf3ce44SJohn Forte #endif
334fcf3ce44SJohn Forte 
335fcf3ce44SJohn Forte /*
336fcf3ce44SJohn Forte  * Management Server Interface Command Codes
337fcf3ce44SJohn Forte  */
338fcf3ce44SJohn Forte 
339291a2b48SSukumar Swaminathan #define	MS_GTIN		0x0100
340291a2b48SSukumar Swaminathan #define	MS_GIEL		0x0101
341291a2b48SSukumar Swaminathan #define	MS_GIET		0x0111
342291a2b48SSukumar Swaminathan #define	MS_GDID		0x0112
343291a2b48SSukumar Swaminathan #define	MS_GMID		0x0113
344291a2b48SSukumar Swaminathan #define	MS_GFN		0x0114
345291a2b48SSukumar Swaminathan #define	MS_GIELN	0x0115
346291a2b48SSukumar Swaminathan #define	MS_GMAL		0x0116
347291a2b48SSukumar Swaminathan #define	MS_GIEIL	0x0117
348291a2b48SSukumar Swaminathan #define	MS_GPL		0x0118
349291a2b48SSukumar Swaminathan #define	MS_GPT		0x0121
350291a2b48SSukumar Swaminathan #define	MS_GPPN		0x0122
351291a2b48SSukumar Swaminathan #define	MS_GAPNL	0x0124
352291a2b48SSukumar Swaminathan #define	MS_GPS		0x0126
353291a2b48SSukumar Swaminathan #define	MS_GPSC		0x0127
354291a2b48SSukumar Swaminathan #define	MS_GATIN	0x0128
355291a2b48SSukumar Swaminathan #define	MS_GSES		0x0130
356291a2b48SSukumar Swaminathan #define	MS_GPLNL	0x0191
357291a2b48SSukumar Swaminathan #define	MS_GPLT		0x0192
358291a2b48SSukumar Swaminathan #define	MS_GPLML	0x0193
359291a2b48SSukumar Swaminathan #define	MS_GPAB		0x0197
360291a2b48SSukumar Swaminathan #define	MS_GNPL		0x01A1
361291a2b48SSukumar Swaminathan #define	MS_GPNL		0x01A2
362291a2b48SSukumar Swaminathan #define	MS_GPFCP	0x01A4
363291a2b48SSukumar Swaminathan #define	MS_GPLI		0x01A5
364291a2b48SSukumar Swaminathan #define	MS_GNID		0x01B1
365291a2b48SSukumar Swaminathan #define	MS_RIELN	0x0215
366291a2b48SSukumar Swaminathan #define	MS_RPL		0x0280
367291a2b48SSukumar Swaminathan #define	MS_RPLN		0x0291
368291a2b48SSukumar Swaminathan #define	MS_RPLT		0x0292
369291a2b48SSukumar Swaminathan #define	MS_RPLM		0x0293
370291a2b48SSukumar Swaminathan #define	MS_RPAB		0x0298
371291a2b48SSukumar Swaminathan #define	MS_RPFCP	0x029A
372291a2b48SSukumar Swaminathan #define	MS_RPLI		0x029B
373291a2b48SSukumar Swaminathan #define	MS_DPL		0x0380
374291a2b48SSukumar Swaminathan #define	MS_DPLN		0x0391
375291a2b48SSukumar Swaminathan #define	MS_DPLM		0x0392
376291a2b48SSukumar Swaminathan #define	MS_DPLML	0x0393
377291a2b48SSukumar Swaminathan #define	MS_DPLI		0x0394
378291a2b48SSukumar Swaminathan #define	MS_DPAB		0x0395
379291a2b48SSukumar Swaminathan #define	MS_DPALL	0x039F
380fcf3ce44SJohn Forte 
381fcf3ce44SJohn Forte /*
382fcf3ce44SJohn Forte  * Name Server Command Codes
383fcf3ce44SJohn Forte  */
384291a2b48SSukumar Swaminathan #define	SLI_CTNS_GA_NXT		0x0100
385291a2b48SSukumar Swaminathan #define	SLI_CTNS_GPN_ID		0x0112
386291a2b48SSukumar Swaminathan #define	SLI_CTNS_GNN_ID		0x0113
387291a2b48SSukumar Swaminathan #define	SLI_CTNS_GCS_ID		0x0114
388291a2b48SSukumar Swaminathan #define	SLI_CTNS_GFT_ID		0x0117
389291a2b48SSukumar Swaminathan #define	SLI_CTNS_GSPN_ID	0x0118
390291a2b48SSukumar Swaminathan #define	SLI_CTNS_GPT_ID		0x011A
391291a2b48SSukumar Swaminathan #define	SLI_CTNS_GID_PN		0x0121
392291a2b48SSukumar Swaminathan #define	SLI_CTNS_GID_NN		0x0131
393291a2b48SSukumar Swaminathan #define	SLI_CTNS_GIP_NN		0x0135
394291a2b48SSukumar Swaminathan #define	SLI_CTNS_GIPA_NN	0x0136
395291a2b48SSukumar Swaminathan #define	SLI_CTNS_GSNN_NN	0x0139
396291a2b48SSukumar Swaminathan #define	SLI_CTNS_GNN_IP		0x0153
397291a2b48SSukumar Swaminathan #define	SLI_CTNS_GIPA_IP	0x0156
398291a2b48SSukumar Swaminathan #define	SLI_CTNS_GID_FT		0x0171
399291a2b48SSukumar Swaminathan #define	SLI_CTNS_GID_PT		0x01A1
400291a2b48SSukumar Swaminathan #define	SLI_CTNS_RPN_ID		0x0212
401291a2b48SSukumar Swaminathan #define	SLI_CTNS_RNN_ID		0x0213
402291a2b48SSukumar Swaminathan #define	SLI_CTNS_RCS_ID		0x0214
403291a2b48SSukumar Swaminathan #define	SLI_CTNS_RFT_ID		0x0217
404291a2b48SSukumar Swaminathan #define	SLI_CTNS_RSPN_ID	0x0218
405291a2b48SSukumar Swaminathan #define	SLI_CTNS_RPT_ID		0x021A
406291a2b48SSukumar Swaminathan #define	SLI_CTNS_RIP_NN		0x0235
407291a2b48SSukumar Swaminathan #define	SLI_CTNS_RIPA_NN	0x0236
408291a2b48SSukumar Swaminathan #define	SLI_CTNS_RSNN_NN	0x0239
409291a2b48SSukumar Swaminathan #define	SLI_CTNS_DA_ID		0x0300
410291a2b48SSukumar Swaminathan 
411291a2b48SSukumar Swaminathan #define	SLI_CT_LOOPBACK		0xFCFC
412fcf3ce44SJohn Forte 
413fcf3ce44SJohn Forte 
414fcf3ce44SJohn Forte /*
415fcf3ce44SJohn Forte  * Port Types
416fcf3ce44SJohn Forte  */
417fcf3ce44SJohn Forte 
418291a2b48SSukumar Swaminathan #define	SLI_CTPT_N_PORT		0x01
419291a2b48SSukumar Swaminathan #define	SLI_CTPT_NL_PORT	0x02
420291a2b48SSukumar Swaminathan #define	SLI_CTPT_FNL_PORT	0x03
421291a2b48SSukumar Swaminathan #define	SLI_CTPT_IP		0x04
422291a2b48SSukumar Swaminathan #define	SLI_CTPT_FCP		0x08
423291a2b48SSukumar Swaminathan #define	SLI_CTPT_NX_PORT	0x7F
424291a2b48SSukumar Swaminathan #define	SLI_CTPT_F_PORT		0x81
425291a2b48SSukumar Swaminathan #define	SLI_CTPT_FL_PORT	0x82
426291a2b48SSukumar Swaminathan #define	SLI_CTPT_E_PORT		0x84
427fcf3ce44SJohn Forte 
428fcf3ce44SJohn Forte #define	SLI_CT_LAST_ENTRY	0x80000000
429fcf3ce44SJohn Forte 
430fcf3ce44SJohn Forte /* ===================================================================== */
431fcf3ce44SJohn Forte 
432fcf3ce44SJohn Forte /*
433fcf3ce44SJohn Forte  * Start FireFly Register definitions
434fcf3ce44SJohn Forte  */
435fcf3ce44SJohn Forte 
436fcf3ce44SJohn Forte /* PCI register offsets */
437291a2b48SSukumar Swaminathan #define	MEM_ADDR_OFFSET	0x10	/* SLIM base memory address */
438fcf3ce44SJohn Forte #define	MEMH_OFFSET	0x14	/* SLIM base memory high address */
439291a2b48SSukumar Swaminathan #define	REG_ADDR_OFFSET	0x18	/* REGISTER base memory address */
440fcf3ce44SJohn Forte #define	REGH_OFFSET	0x1c	/* REGISTER base memory high address */
441291a2b48SSukumar Swaminathan #define	IO_ADDR_OFFSET	0x20	/* BIU I/O registers */
442291a2b48SSukumar Swaminathan #define	REGIOH_OFFSET	0x24	/* REGISTER base io high address */
443fcf3ce44SJohn Forte 
444291a2b48SSukumar Swaminathan #define	CMD_REG_OFFSET	0x4	/* PCI command configuration */
445fcf3ce44SJohn Forte 
446fcf3ce44SJohn Forte /* General PCI Register Definitions */
447fcf3ce44SJohn Forte /* Refer To The PCI Specification For Detailed Explanations */
448fcf3ce44SJohn Forte 
449291a2b48SSukumar Swaminathan #define	PCI_VENDOR_ID_REGISTER		0x00	/* PCI Vendor ID Reg */
450291a2b48SSukumar Swaminathan #define	PCI_DEVICE_ID_REGISTER		0x02	/* PCI Device ID Reg */
451fcf3ce44SJohn Forte #define	PCI_CONFIG_ID_REGISTER		0x00	/* PCI Configuration ID Reg */
452291a2b48SSukumar Swaminathan #define	PCI_COMMAND_REGISTER		0x04	/* PCI Command Reg */
453291a2b48SSukumar Swaminathan #define	PCI_STATUS_REGISTER		0x06	/* PCI Status Reg */
454291a2b48SSukumar Swaminathan #define	PCI_REV_ID_REGISTER		0x08	/* PCI Revision ID Reg */
455291a2b48SSukumar Swaminathan #define	PCI_CLASS_CODE_REGISTER		0x09	/* PCI Class Code Reg */
456291a2b48SSukumar Swaminathan #define	PCI_CACHE_LINE_REGISTER		0x0C	/* PCI Cache Line Reg */
457291a2b48SSukumar Swaminathan #define	PCI_LATENCY_TMR_REGISTER	0x0D	/* PCI Latency Timer Reg */
458291a2b48SSukumar Swaminathan #define	PCI_HEADER_TYPE_REGISTER	0x0E	/* PCI Header Type Reg */
459fcf3ce44SJohn Forte #define	PCI_BIST_REGISTER		0x0F	/* PCI Built-In SelfTest Reg */
460fcf3ce44SJohn Forte #define	PCI_BAR_0_REGISTER		0x10	/* PCI Base Address Reg 0 */
461fcf3ce44SJohn Forte #define	PCI_BAR_1_REGISTER		0x14	/* PCI Base Address Reg 1 */
462fcf3ce44SJohn Forte #define	PCI_BAR_2_REGISTER		0x18	/* PCI Base Address Reg 2 */
463fcf3ce44SJohn Forte #define	PCI_BAR_3_REGISTER		0x1C	/* PCI Base Address Reg 3 */
464fcf3ce44SJohn Forte #define	PCI_BAR_4_REGISTER		0x20	/* PCI Base Address Reg 4 */
465fcf3ce44SJohn Forte #define	PCI_BAR_5_REGISTER		0x24	/* PCI Base Address Reg 5 */
466fcf3ce44SJohn Forte #define	PCI_SSID_REGISTER		0x2C
467fcf3ce44SJohn Forte #define	PCI_SSVID_REGISTER		0x2C
468fcf3ce44SJohn Forte #define	PCI_SSDID_REGISTER		0x2E
469fcf3ce44SJohn Forte #define	PCI_EXPANSION_ROM		0x30	/* PCI Expansion ROM Base Reg */
470fcf3ce44SJohn Forte #define	PCI_CAP_POINTER			0x34
471fcf3ce44SJohn Forte 
4728f23e9faSHans Rosenfeld /* PCI capatability registers are defined in pci.h */
4738f23e9faSHans Rosenfeld #define	PCI_CAP_ID_SHIFT			0
4748f23e9faSHans Rosenfeld #define	PCI_CAP_ID_MASK				0xff
4758f23e9faSHans Rosenfeld #define	PCI_CAP_NEXT_PTR_SHIFT			8
4768f23e9faSHans Rosenfeld #define	PCI_CAP_NEXT_PTR_MASK			0xff
4778f23e9faSHans Rosenfeld 
4788f23e9faSHans Rosenfeld /* PCI extended capatability registers are defined in pcie.h */
4798f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_MAX_PTR		0x30
4808f23e9faSHans Rosenfeld 
4818f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_MRIOV		0x0000 /* ??? */
4828f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_SRIOV		0x0010
4838f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_11		0x0011
4848f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_12		0x0012
4858f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_13		0x0013
4868f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_14		0x0014
4878f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_15		0x0015
4888f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_16		0x0016
4898f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_TPH		0x0017
4908f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_18		0x0018
4918f23e9faSHans Rosenfeld #define	PCI_EXT_CAP_ID_SEC_PCI		0x0019
4928f23e9faSHans Rosenfeld 
4938f23e9faSHans Rosenfeld /* Vendor Specific (VS) register */
4948f23e9faSHans Rosenfeld #define	PCI_VS_SLI_INTF_OFFSET	4
495fcf3ce44SJohn Forte 
496fcf3ce44SJohn Forte /* PCI access methods */
497fcf3ce44SJohn Forte #define	P_CONF_T1	1
498fcf3ce44SJohn Forte #define	P_CONF_T2	2
499fcf3ce44SJohn Forte 
500fcf3ce44SJohn Forte /* max number of pci buses */
501291a2b48SSukumar Swaminathan #define	MAX_PCI_BUSES	0xFF
502fcf3ce44SJohn Forte 
503fcf3ce44SJohn Forte /* number of PCI config bytes to access */
504fcf3ce44SJohn Forte #define	PCI_BYTE	1
505fcf3ce44SJohn Forte #define	PCI_WORD	2
506fcf3ce44SJohn Forte #define	PCI_DWORD	4
507fcf3ce44SJohn Forte 
508fcf3ce44SJohn Forte /* PCI related constants */
509fcf3ce44SJohn Forte #define	CMD_IO_ENBL	0x0001
510291a2b48SSukumar Swaminathan #define	CMD_MEM_ENBL	0x0002
511291a2b48SSukumar Swaminathan #define	CMD_BUS_MASTER	0x0004
512fcf3ce44SJohn Forte #define	CMD_MWI		0x0010
513291a2b48SSukumar Swaminathan #define	CMD_PARITY_CHK	0x0040
514291a2b48SSukumar Swaminathan #define	CMD_SERR_ENBL	0x0100
515fcf3ce44SJohn Forte 
516291a2b48SSukumar Swaminathan #define	CMD_CFG_VALUE	0x156	/* mem enable, master, MWI, SERR, PERR */
517fcf3ce44SJohn Forte 
518fcf3ce44SJohn Forte /* PCI addresses */
519fcf3ce44SJohn Forte #define	PCI_SPACE_ENABLE		0x0CF8
520fcf3ce44SJohn Forte #define	CF1_CONFIG_ADDR_REGISTER	0x0CF8
521fcf3ce44SJohn Forte #define	CF1_CONFIG_DATA_REGISTER	0x0CFC
522fcf3ce44SJohn Forte #define	CF2_FORWARD_REGISTER		0x0CFA
523fcf3ce44SJohn Forte #define	CF2_BASE_ADDRESS		0xC000
524fcf3ce44SJohn Forte 
525fcf3ce44SJohn Forte 
526291a2b48SSukumar Swaminathan #define	DEFAULT_PCI_LATENCY_CLOCKS	0xf8	/* 0xF8 is a special value */
527291a2b48SSukumar Swaminathan 						/* for FF11.1N6 firmware. */
528291a2b48SSukumar Swaminathan 						/* Use 0x80 for pre-FF11.1N6 */
529291a2b48SSukumar Swaminathan 						/* &N7, etc */
530fcf3ce44SJohn Forte #define	PCI_LATENCY_VALUE		0xf8
531fcf3ce44SJohn Forte 
532fcf3ce44SJohn Forte 
533fcf3ce44SJohn Forte 
534fcf3ce44SJohn Forte /* ==== Register Bit Definitions ==== */
535fcf3ce44SJohn Forte 
536fcf3ce44SJohn Forte /* Used by SBUS adapter */
537fcf3ce44SJohn Forte /* SBUS Control Register */
538fcf3ce44SJohn Forte #define	SBUS_CTRL_REG_OFFSET	0	/* Word offset from reg base addr */
539fcf3ce44SJohn Forte 
540fcf3ce44SJohn Forte #define	SBUS_CTRL_SBRST 	0x00000001	/* Bit  0 */
541fcf3ce44SJohn Forte #define	SBUS_CTRL_BKOFF 	0x00000002	/* Bit  1 */
542fcf3ce44SJohn Forte #define	SBUS_CTRL_ENP 		0x00000004	/* Bit  2 */
543fcf3ce44SJohn Forte #define	SBUS_CTRL_EN64		0x00000008	/* Bit  3 */
544291a2b48SSukumar Swaminathan #define	SBUS_CTRL_SIR_1 	0x00000010	/* Bit [6:4] IRL 1, */
545291a2b48SSukumar Swaminathan 						/* lowset priority */
546fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_2 	0x00000020
547fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_3 	0x00000030
548fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_4 	0x00000040
549fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_5 	0x00000050
550fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_6 	0x00000060
551fcf3ce44SJohn Forte #define	SBUS_CTRL_SIR_7 	0x00000070	/* IRL 7, highest priority */
552fcf3ce44SJohn Forte 
553fcf3ce44SJohn Forte /* SBUS Status Register */
554fcf3ce44SJohn Forte #define	SBUS_STAT_REG_OFFSET	1	/* Word offset from reg base addr */
555fcf3ce44SJohn Forte #define	SBUS_STAT_IP		0x00000001	/* Bit  0 */
556fcf3ce44SJohn Forte #define	SBUS_STAT_LERR		0x00000002	/* Bit  1 */
557fcf3ce44SJohn Forte #define	SBUS_STAT_SBPE		0x00000004	/* Bit  2 */
558fcf3ce44SJohn Forte #define	SBUS_STAT_TE		0x00000008	/* Bit  3 */
559fcf3ce44SJohn Forte #define	SBUS_STAT_WPE		0x00000010	/* Bit  4 */
560fcf3ce44SJohn Forte #define	SBUS_STAT_PERR		0x00000020	/* Bit  5 */
561fcf3ce44SJohn Forte #define	SBUS_STAT_SERR		0x00000040	/* Bit  6 */
562fcf3ce44SJohn Forte #define	SBUS_STAT_PTA		0x00000080	/* Bit  7 */
563fcf3ce44SJohn Forte 
564fcf3ce44SJohn Forte /* SBUS Update Register */
565fcf3ce44SJohn Forte #define	SBUS_UPDATE_REG_OFFSET	2	/* Word offfset from reg base addr */
566fcf3ce44SJohn Forte 
567fcf3ce44SJohn Forte #define	SBUS_UPDATE_DATA	0x00000001	/* Bit  0 */
568fcf3ce44SJohn Forte #define	SBUS_UPDATE_SPCLK	0x00000002	/* Bit  1 */
569fcf3ce44SJohn Forte #define	SBUS_UPDATE_SPCE	0x00000004	/* Bit  2 */
570fcf3ce44SJohn Forte #define	SBUS_UPDATE_SPRST	0x00000008	/* Bit  3 */
571fcf3ce44SJohn Forte #define	SBUS_UPDATE_SPWE	0x00000010	/* Bit  4 */
572fcf3ce44SJohn Forte #define	SBUS_UPDATE_LDFPGA	0x00000080	/* Bit  7 */
573fcf3ce44SJohn Forte 
574fcf3ce44SJohn Forte /* Host Attention Register */
575fcf3ce44SJohn Forte 
576fcf3ce44SJohn Forte #define	HA_REG_OFFSET  0	/* Word offset from register base address */
577fcf3ce44SJohn Forte 
578fcf3ce44SJohn Forte #define	HA_R0RE_REQ	0x00000001	/* Bit  0 */
579fcf3ce44SJohn Forte #define	HA_R0CE_RSP	0x00000002	/* Bit  1 */
580fcf3ce44SJohn Forte #define	HA_R0ATT	0x00000008	/* Bit  3 */
581fcf3ce44SJohn Forte #define	HA_R1RE_REQ	0x00000010	/* Bit  4 */
582fcf3ce44SJohn Forte #define	HA_R1CE_RSP	0x00000020	/* Bit  5 */
583fcf3ce44SJohn Forte #define	HA_R1ATT	0x00000080	/* Bit  7 */
584fcf3ce44SJohn Forte #define	HA_R2RE_REQ	0x00000100	/* Bit  8 */
585fcf3ce44SJohn Forte #define	HA_R2CE_RSP	0x00000200	/* Bit  9 */
586fcf3ce44SJohn Forte #define	HA_R2ATT	0x00000800	/* Bit 11 */
587fcf3ce44SJohn Forte #define	HA_R3RE_REQ	0x00001000	/* Bit 12 */
588fcf3ce44SJohn Forte #define	HA_R3CE_RSP	0x00002000	/* Bit 13 */
589fcf3ce44SJohn Forte #define	HA_R3ATT	0x00008000	/* Bit 15 */
590fcf3ce44SJohn Forte #define	HA_LATT		0x20000000	/* Bit 29 */
591fcf3ce44SJohn Forte #define	HA_MBATT	0x40000000	/* Bit 30 */
592fcf3ce44SJohn Forte #define	HA_ERATT	0x80000000	/* Bit 31 */
593fcf3ce44SJohn Forte 
594fcf3ce44SJohn Forte 
595fcf3ce44SJohn Forte #ifdef MSI_SUPPORT
596fcf3ce44SJohn Forte 
59782527734SSukumar Swaminathan 
598fcf3ce44SJohn Forte /* Host attention interrupt map */
599291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAP8	{0, HA_R0ATT, HA_R1ATT, HA_R2ATT, \
600291a2b48SSukumar Swaminathan 	HA_R3ATT, HA_LATT, HA_MBATT, HA_ERATT}
601291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAP4	{0, HA_R0ATT, HA_R1ATT, HA_R2ATT, 0, 0, 0, 0}
602291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAP2	{0, HA_R0ATT, 0, 0, 0, 0, 0, 0}
603291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAP1	{0, 0, 0, 0, 0, 0, 0, 0}
604fcf3ce44SJohn Forte 
605fcf3ce44SJohn Forte /* MSI 0 interrupt mask */
606291a2b48SSukumar Swaminathan #define	EMLXS_MSI0_MASK8	0
607291a2b48SSukumar Swaminathan #define	EMLXS_MSI0_MASK4	(HC_R3INT_ENA|HC_MBINT_ENA|HC_LAINT_ENA| \
608291a2b48SSukumar Swaminathan 				HC_ERINT_ENA)
609291a2b48SSukumar Swaminathan #define	EMLXS_MSI0_MASK2	(HC_R1INT_ENA|HC_R2INT_ENA|HC_R3INT_ENA| \
610291a2b48SSukumar Swaminathan 				HC_MBINT_ENA|HC_LAINT_ENA|HC_ERINT_ENA)
611291a2b48SSukumar Swaminathan #define	EMLXS_MSI0_MASK1	(HC_R0INT_ENA|HC_R1INT_ENA|HC_R2INT_ENA| \
612291a2b48SSukumar Swaminathan 				HC_R3INT_ENA|HC_MBINT_ENA|HC_LAINT_ENA| \
613291a2b48SSukumar Swaminathan 				HC_ERINT_ENA)
614fcf3ce44SJohn Forte 
615fcf3ce44SJohn Forte 
616291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MAX_INTRS	8
617fcf3ce44SJohn Forte 
618291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODE1		0
619291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODE2		1
620291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODE4		2
621291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODE8		3
622291a2b48SSukumar Swaminathan #define	EMLXS_MSI_MODES		4
623fcf3ce44SJohn Forte 
624fcf3ce44SJohn Forte #endif	/* MSI_SUPPORT */
625fcf3ce44SJohn Forte 
626fcf3ce44SJohn Forte 
627291a2b48SSukumar Swaminathan #define	IO_THROTTLE_RESERVE	12
628fcf3ce44SJohn Forte 
629fcf3ce44SJohn Forte 
630fcf3ce44SJohn Forte 
631fcf3ce44SJohn Forte 
632fcf3ce44SJohn Forte /* Chip Attention Register */
633fcf3ce44SJohn Forte 
634291a2b48SSukumar Swaminathan #define	CA_REG_OFFSET	1	/* Word offset from register base address */
635fcf3ce44SJohn Forte 
636fcf3ce44SJohn Forte #define	CA_R0CE_REQ	0x00000001	/* Bit  0 */
637fcf3ce44SJohn Forte #define	CA_R0RE_RSP	0x00000002	/* Bit  1 */
638fcf3ce44SJohn Forte #define	CA_R0ATT	0x00000008	/* Bit  3 */
639fcf3ce44SJohn Forte #define	CA_R1CE_REQ	0x00000010	/* Bit  4 */
640fcf3ce44SJohn Forte #define	CA_R1RE_RSP	0x00000020	/* Bit  5 */
641fcf3ce44SJohn Forte #define	CA_R1ATT	0x00000080	/* Bit  7 */
642fcf3ce44SJohn Forte #define	CA_R2CE_REQ	0x00000100	/* Bit  8 */
643fcf3ce44SJohn Forte #define	CA_R2RE_RSP	0x00000200	/* Bit  9 */
644fcf3ce44SJohn Forte #define	CA_R2ATT	0x00000800	/* Bit 11 */
645fcf3ce44SJohn Forte #define	CA_R3CE_REQ	0x00001000	/* Bit 12 */
646fcf3ce44SJohn Forte #define	CA_R3RE_RSP	0x00002000	/* Bit 13 */
647fcf3ce44SJohn Forte #define	CA_R3ATT	0x00008000	/* Bit 15 */
648fcf3ce44SJohn Forte #define	CA_MBATT	0x40000000	/* Bit 30 */
649fcf3ce44SJohn Forte 
650fcf3ce44SJohn Forte /* Host Status Register */
651fcf3ce44SJohn Forte 
652291a2b48SSukumar Swaminathan #define	HS_REG_OFFSET	2	/* Word offset from register base address */
653fcf3ce44SJohn Forte 
654fcf3ce44SJohn Forte #define	HS_OVERTEMP	0x00000100	/* Bit 8 */
655fcf3ce44SJohn Forte #define	HS_MBRDY	0x00400000	/* Bit 22 */
656fcf3ce44SJohn Forte #define	HS_FFRDY	0x00800000	/* Bit 23 */
657fcf3ce44SJohn Forte #define	HS_FFER8	0x01000000	/* Bit 24 */
658fcf3ce44SJohn Forte #define	HS_FFER7	0x02000000	/* Bit 25 */
659fcf3ce44SJohn Forte #define	HS_FFER6	0x04000000	/* Bit 26 */
660fcf3ce44SJohn Forte #define	HS_FFER5	0x08000000	/* Bit 27 */
661fcf3ce44SJohn Forte #define	HS_FFER4	0x10000000	/* Bit 28 */
662fcf3ce44SJohn Forte #define	HS_FFER3	0x20000000	/* Bit 29 */
663fcf3ce44SJohn Forte #define	HS_FFER2	0x40000000	/* Bit 30 */
664fcf3ce44SJohn Forte #define	HS_FFER1	0x80000000	/* Bit 31 */
665fcf3ce44SJohn Forte #define	HS_FFERM	0xFF000000	/* Mask for error bits 31:24 */
666fcf3ce44SJohn Forte 
667fcf3ce44SJohn Forte /* Host Control Register */
668fcf3ce44SJohn Forte 
669291a2b48SSukumar Swaminathan #define	HC_REG_OFFSET	3	/* Word offset from register base address */
670fcf3ce44SJohn Forte 
671fcf3ce44SJohn Forte #define	HC_MBINT_ENA	0x00000001	/* Bit  0 */
672fcf3ce44SJohn Forte #define	HC_R0INT_ENA	0x00000002	/* Bit  1 */
673fcf3ce44SJohn Forte #define	HC_R1INT_ENA	0x00000004	/* Bit  2 */
674fcf3ce44SJohn Forte #define	HC_R2INT_ENA	0x00000008	/* Bit  3 */
675fcf3ce44SJohn Forte #define	HC_R3INT_ENA	0x00000010	/* Bit  4 */
676fcf3ce44SJohn Forte #define	HC_INITHBI	0x02000000	/* Bit 25 */
677fcf3ce44SJohn Forte #define	HC_INITMB	0x04000000	/* Bit 26 */
678fcf3ce44SJohn Forte #define	HC_INITFF	0x08000000	/* Bit 27 */
679fcf3ce44SJohn Forte #define	HC_LAINT_ENA	0x20000000	/* Bit 29 */
680fcf3ce44SJohn Forte #define	HC_ERINT_ENA	0x80000000	/* Bit 31 */
681fcf3ce44SJohn Forte 
682fcf3ce44SJohn Forte /* BIU Configuration Register */
683fcf3ce44SJohn Forte 
684291a2b48SSukumar Swaminathan #define	BC_REG_OFFSET	4	/* Word offset from register base address */
685fcf3ce44SJohn Forte 
686fcf3ce44SJohn Forte #define	BC_BSE		0x00000001	/* Bit 0 */
687fcf3ce44SJohn Forte #define	BC_BSE_SWAP	0x01000000	/* Bit 0 - swapped */
688fcf3ce44SJohn Forte 
689fcf3ce44SJohn Forte /*
690fcf3ce44SJohn Forte  * End FireFly Register definitions
691fcf3ce44SJohn Forte  */
692fcf3ce44SJohn Forte 
69382527734SSukumar Swaminathan /*
69482527734SSukumar Swaminathan  * Start SLI 4 section.
69582527734SSukumar Swaminathan  */
69682527734SSukumar Swaminathan 
69782527734SSukumar Swaminathan /* PCI Config Register offsets */
69882527734SSukumar Swaminathan #define	PCICFG_UE_STATUS_LO_OFFSET	0xA0	/* Error Indication - low */
69982527734SSukumar Swaminathan #define	PCICFG_UE_STATUS_HI_OFFSET	0xA4	/* Error Indication - high */
700fe199829SSukumar Swaminathan #define	PCICFG_UE_MASK_LO_OFFSET	0xA8	/* Error mask - low */
701fe199829SSukumar Swaminathan #define	PCICFG_UE_MASK_HI_OFFSET	0xAC	/* Error mask - high */
70282527734SSukumar Swaminathan #define	PCICFG_UE_STATUS_ONLINE1	0xB0	/* Error status1 */
70382527734SSukumar Swaminathan #define	PCICFG_UE_STATUS_ONLINE2	0xB4	/* Error status2 */
70482527734SSukumar Swaminathan 
70582527734SSukumar Swaminathan /* BAR1 and BAR2 register offsets */
70682527734SSukumar Swaminathan 
70782527734SSukumar Swaminathan /* BAR1 offsets for principal registers */
70882527734SSukumar Swaminathan #define	CSR_ISR0_OFFSET		0x0C18	/* CSR for EQ interrupt indications */
70982527734SSukumar Swaminathan #define	CSR_IMR0_OFFSET		0x0C48	/* CSR for EQ interrupt masking */
71082527734SSukumar Swaminathan #define	CSR_ISCR0_OFFSET	0x0C78	/* CSR for EQ interrupt clearing */
71182527734SSukumar Swaminathan 
71282527734SSukumar Swaminathan #define	ISR0_EQ0_INDC	0x00000001	/* Indication bit for EQ0 */
71382527734SSukumar Swaminathan #define	ISR0_EQ1_INDC	0x00000002	/* Indication bit for EQ1 */
71482527734SSukumar Swaminathan #define	ISR0_EQ2_INDC	0x00000004	/* Indication bit for EQ2 */
71582527734SSukumar Swaminathan #define	ISR0_EQ3_INDC	0x00000008	/* Indication bit for EQ3 */
71682527734SSukumar Swaminathan #define	ISR0_EQ4_INDC	0x00000010	/* Indication bit for EQ4 */
71782527734SSukumar Swaminathan #define	ISR0_EQ5_INDC	0x00000020	/* Indication bit for EQ5 */
71882527734SSukumar Swaminathan #define	ISR0_EQ6_INDC	0x00000040	/* Indication bit for EQ6 */
71982527734SSukumar Swaminathan #define	ISR0_EQ7_INDC	0x00000080	/* Indication bit for EQ7 */
72082527734SSukumar Swaminathan 
72182527734SSukumar Swaminathan /* MPU EP Semaphore register (ARM POST) */
72282527734SSukumar Swaminathan #define	CSR_MPU_EP_SEMAPHORE_OFFSET	0x00AC
72382527734SSukumar Swaminathan 
7248f23e9faSHans Rosenfeld /* SLI Status register */
725*e2d1a434SCarsten Grzemba #define	SLI_STATUS_ERROR		0x80000000  /* b31 */
726*e2d1a434SCarsten Grzemba #define	SLI_STATUS_BE			0x40000000  /* b30 big endian */
727*e2d1a434SCarsten Grzemba #define	SLI_STATUS_OTI			0x20000000  /* b29 over temp */
728*e2d1a434SCarsten Grzemba 
7298f23e9faSHans Rosenfeld #define	SLI_STATUS_DUMP_LOCATION	0x04000000
730*e2d1a434SCarsten Grzemba #define	SLI_STATUS_DUMP_IMAGE_PRESENT	0x02000000  /* b25 */
731*e2d1a434SCarsten Grzemba #define	SLI_STATUS_RESET_NEEDED		0x01000000  /* b24 */
732*e2d1a434SCarsten Grzemba #define	SLI_STATUS_READY		0x00800000  /* b23 */
7338f23e9faSHans Rosenfeld #define	SLI_STATUS_INTERRUPT_DISABLE	0x00400000
734*e2d1a434SCarsten Grzemba #define	SLI_STATUS_FDP			0x00200000  /* b21 func dump present */
7358f23e9faSHans Rosenfeld 
7368f23e9faSHans Rosenfeld /* SLI Control register */
7378f23e9faSHans Rosenfeld #define	SLI_CNTL_BE		0x40000000
7388f23e9faSHans Rosenfeld #define	SLI_CNTL_INIT_PORT	0x08000000
7398f23e9faSHans Rosenfeld 
7408f23e9faSHans Rosenfeld /* SLI PHYDEV Control register */
7418f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RERROR	0x80000000
7428f23e9faSHans Rosenfeld #define	SLI_PHYDEV_INP		0x40000000
7438f23e9faSHans Rosenfeld #define	SLI_PHYDEV_IPLD		0x00008000
7448f23e9faSHans Rosenfeld #define	SLI_PHYDEV_GPC		0x00004000
7458f23e9faSHans Rosenfeld #define	SLI_PHYDEV_GP		0x00002000
7468f23e9faSHans Rosenfeld 
7478f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RC_MASK	0x00000700
7488f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RC_UNKNOWN	0x00000000
7498f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RC_PROFILE	0x00000100
7508f23e9faSHans Rosenfeld #define	SLI_PHYDEV_RC_FACTORY	0x00000200
7518f23e9faSHans Rosenfeld 
7528f23e9faSHans Rosenfeld #define	SLI_PHYDEV_FRL_MASK	0x000000F0
7538f23e9faSHans Rosenfeld #define	SLI_PHYDEV_FRL_ALL	0x00000000
7548f23e9faSHans Rosenfeld #define	SLI_PHYDEV_FRL_FCOE	0x00000010
7558f23e9faSHans Rosenfeld 
7568f23e9faSHans Rosenfeld #define	SLI_PHYDEV_LC		0x00000008
7578f23e9faSHans Rosenfeld #define	SLI_PHYDEV_DD		0x00000004
7588f23e9faSHans Rosenfeld #define	SLI_PHYDEV_FRST		0x00000002
7598f23e9faSHans Rosenfeld #define	SLI_PHYDEV_DRST		0x00000001
7608f23e9faSHans Rosenfeld 
76182527734SSukumar Swaminathan /* POST Stages of interest */
76282527734SSukumar Swaminathan #define	ARM_POST_FATAL	0x80000000
76382527734SSukumar Swaminathan #define	ARM_POST_READY	0xc000
76482527734SSukumar Swaminathan #define	ARM_POST_MASK	0xffff
7658f23e9faSHans Rosenfeld #define	ARM_UNRECOVERABLE_ERROR	0xf000
76682527734SSukumar Swaminathan 
76782527734SSukumar Swaminathan #define	MPU_EP_DL	0x04000000	/* Driverloadedbitmask */
76882527734SSukumar Swaminathan #define	MPU_EP_ORI	0x08000000	/* OptionROMinstalledbitmask */
76982527734SSukumar Swaminathan #define	MPU_EP_IPC	0x10000000	/* IPaddressconflictmask */
77082527734SSukumar Swaminathan #define	MPU_EP_NIP	0x20000000	/* NoIPaddressmask */
77182527734SSukumar Swaminathan #define	MPU_EP_BFW	0x40000000	/* BackupFWinusemask */
77282527734SSukumar Swaminathan #define	MPU_EP_ERR	0x80000000	/* POSTfatalerrormask */
77382527734SSukumar Swaminathan 
774*e2d1a434SCarsten Grzemba /* physical devices BAR2 offsets for principal doorbell registers */
77582527734SSukumar Swaminathan 
77682527734SSukumar Swaminathan #define	PD_RQ_DB_OFFSET	0x00A0	/* Doorbell notify of posted RQEs */
77782527734SSukumar Swaminathan #define	PD_WQ_DB_OFFSET	0x0040	/* Doorbell notify of posted WQEs */
77882527734SSukumar Swaminathan #define	PD_CQ_DB_OFFSET	0x0120	/* Doorbell notify of processed CQEs or EQEs */
77982527734SSukumar Swaminathan #define	PD_MQ_DB_OFFSET	0x0140	/* Doorbell notify of posted MQEs */
780*e2d1a434SCarsten Grzemba 
78182527734SSukumar Swaminathan #define	PD_MB_DB_OFFSET	0x0160	/* Doorbell Bootstrap Mailbox */
78282527734SSukumar Swaminathan 
783*e2d1a434SCarsten Grzemba /* physical devices BAR1 offsets for principal doorbell registers */
784*e2d1a434SCarsten Grzemba 
785*e2d1a434SCarsten Grzemba #define	PD_IF6_RQ_DB_OFFSET	0x0080	/* Doorbell notify of posted RQEs */
786*e2d1a434SCarsten Grzemba #define	PD_IF6_WQ_DB_OFFSET	0x0040	/* Doorbell notify of posted WQEs */
787*e2d1a434SCarsten Grzemba #define	PD_IF6_CQ_DB_OFFSET	0x00C0	/* Doorbell notify of processed CQEs */
788*e2d1a434SCarsten Grzemba #define	PD_IF6_EQ_DB_OFFSET	0x0120	/* Doorbell notify of processed EQEs */
789*e2d1a434SCarsten Grzemba #define	PD_IF6_MQ_DB_OFFSET	0x0160	/* Doorbell notify of posted MQEs */
790*e2d1a434SCarsten Grzemba 
791*e2d1a434SCarsten Grzemba /* physical devices BAR0 offsets for principal doorbell registers */
792*e2d1a434SCarsten Grzemba 
7938f23e9faSHans Rosenfeld #define	SLIPORT_SEMAPHORE_OFFSET	0x0400
7948f23e9faSHans Rosenfeld #define	SLIPORT_STATUS_OFFSET		0x0404
7958f23e9faSHans Rosenfeld #define	SLIPORT_CONTROL_OFFSET		0x0408
7968f23e9faSHans Rosenfeld #define	SLIPORT_ERROR1_OFFSET		0x040C
7978f23e9faSHans Rosenfeld #define	SLIPORT_ERROR2_OFFSET		0x0410
7988f23e9faSHans Rosenfeld #define	PHYSDEV_CONTROL_OFFSET		0x0414
799*e2d1a434SCarsten Grzemba #define	SLIPORT_EQDELAY_OFFSET		0x0418
8008f23e9faSHans Rosenfeld 
80182527734SSukumar Swaminathan /* Doorbell definitions */
80282527734SSukumar Swaminathan 
80382527734SSukumar Swaminathan /* Defines for MQ doorbell */
80482527734SSukumar Swaminathan #define	MQ_DB_POP_SHIFT 16		/* shift for entries popped */
80582527734SSukumar Swaminathan #define	MQ_DB_POP_MASK  0x1FFF0000	/* Mask for number of entries popped */
80682527734SSukumar Swaminathan 
80782527734SSukumar Swaminathan /* Defines for CQ doorbell */
80882527734SSukumar Swaminathan #define	CQ_DB_POP_SHIFT 16		/* shift for entries popped */
80982527734SSukumar Swaminathan #define	CQ_DB_POP_MASK  0x1FFF0000	/* Mask for number of entries popped */
81082527734SSukumar Swaminathan #define	CQ_DB_REARM	0x20000000	/* Bit 29, rearm */
811a3170057SPaul Winder #define	CQ_ID_LO_BITS	10		/* num of id bits that are "low" */
812a3170057SPaul Winder #define	CQ_DB_ID_LO_MASK	((1 << CQ_ID_LO_BITS) - 1)
813a3170057SPaul Winder #define	CQ_DB_ID_HI_SHIFT	11
814a3170057SPaul Winder #define	CQ_DB_ID_HI_MASK	(0x1F << CQ_DB_ID_HI_SHIFT)
81582527734SSukumar Swaminathan 
81682527734SSukumar Swaminathan /* Defines for EQ doorbell */
81782527734SSukumar Swaminathan #define	EQ_DB_CLEAR	0x00000200	/* Bit 9, designates clear EQ ISR */
81882527734SSukumar Swaminathan #define	EQ_DB_EVENT	0x00000400	/* Bit 10, designates EQ */
81982527734SSukumar Swaminathan #define	EQ_DB_POP_SHIFT 16		/* shift for entries popped */
82082527734SSukumar Swaminathan #define	EQ_DB_POP_MASK  0x1FFF0000	/* Mask for number of entries popped */
82182527734SSukumar Swaminathan #define	EQ_DB_REARM	0x20000000	/* Bit 29, rearm */
822a3170057SPaul Winder #define	EQ_ID_LO_BITS	9		/* num of id bits that are "low" */
823a3170057SPaul Winder #define	EQ_DB_ID_LO_MASK	((1 << EQ_ID_LO_BITS) - 1)
824a3170057SPaul Winder #define	EQ_DB_ID_HI_SHIFT	11
825a3170057SPaul Winder #define	EQ_DB_ID_HI_MASK	(0x1F << EQ_DB_ID_HI_SHIFT)
826a3170057SPaul Winder 
827a3170057SPaul Winder /* Defines for WQ doorbell */
828a3170057SPaul Winder #define	WQ_DB_POST_SHIFT	24
829a3170057SPaul Winder #define	WQ_DB_POST_MASK		(0xFF << WQ_DB_POST_SHIFT)
830a3170057SPaul Winder #define	WQ_DB_IDX_SHIFT		16
831a3170057SPaul Winder #define	WQ_DB_IDX_MASK		(0xFF << WQ_DB_IDX_SHIFT)
83282527734SSukumar Swaminathan 
83382527734SSukumar Swaminathan /* bootstrap mailbox doorbell defines */
83482527734SSukumar Swaminathan #define	BMBX_READY	0x00000001	/* Mask for Port Ready bit */
83582527734SSukumar Swaminathan #define	BMBX_ADDR_HI	0x00000002	/* Mask for Addr Hi bit */
836a3170057SPaul Winder #define	BMBX_ADDR	0xFFFFFFFC	/* Mask for Addr bits */
83782527734SSukumar Swaminathan 
83882527734SSukumar Swaminathan /* Sizeof bootstrap mailbox */
83982527734SSukumar Swaminathan #define	EMLXS_BOOTSTRAP_MB_SIZE	256
84082527734SSukumar Swaminathan 
8418f23e9faSHans Rosenfeld #define	FW_INITIALIZE_WORD0	0xFF1234FF /* Initialize bootstrap wd 0 */
8428f23e9faSHans Rosenfeld #define	FW_INITIALIZE_WORD1	0xFF5678FF /* Initialize bootstrap wd 1 */
84382527734SSukumar Swaminathan 
8448f23e9faSHans Rosenfeld #define	FW_DEINITIALIZE_WORD0	0xFFAABBFF /* DeInitialize bootstrap wd 0 */
8458f23e9faSHans Rosenfeld #define	FW_DEINITIALIZE_WORD1	0xFFCCDDFF /* DeInitialize bootstrap wd 1 */
84682527734SSukumar Swaminathan 
847fcf3ce44SJohn Forte /* ===================================================================== */
848fcf3ce44SJohn Forte 
849fcf3ce44SJohn Forte /*
850fcf3ce44SJohn Forte  * Start of FCP specific structures
851fcf3ce44SJohn Forte  */
852fcf3ce44SJohn Forte 
853291a2b48SSukumar Swaminathan typedef struct emlxs_fcp_rsp
854291a2b48SSukumar Swaminathan {
855291a2b48SSukumar Swaminathan 	uint32_t	rspRsvd1;	/* FC Word 0, byte 0:3 */
856291a2b48SSukumar Swaminathan 	uint32_t	rspRsvd2;	/* FC Word 1, byte 0:3 */
857fcf3ce44SJohn Forte 
858291a2b48SSukumar Swaminathan 	uint8_t		rspStatus0;	/* FCP_STATUS byte 0 (reserved) */
859291a2b48SSukumar Swaminathan 	uint8_t		rspStatus1;	/* FCP_STATUS byte 1 (reserved) */
860291a2b48SSukumar Swaminathan 	uint8_t		rspStatus2;	/* FCP_STATUS byte 2 field validity */
861fcf3ce44SJohn Forte #define	RSP_LEN_VALID	0x01	/* bit 0 */
862fcf3ce44SJohn Forte #define	SNS_LEN_VALID	0x02	/* bit 1 */
863fcf3ce44SJohn Forte #define	RESID_OVER	0x04	/* bit 2 */
864fcf3ce44SJohn Forte #define	RESID_UNDER	0x08	/* bit 3 */
865291a2b48SSukumar Swaminathan 
866291a2b48SSukumar Swaminathan 	uint8_t		rspStatus3;	/* FCP_STATUS byte 3 SCSI status byte */
867fcf3ce44SJohn Forte #define	SCSI_STAT_GOOD		0x00
868fcf3ce44SJohn Forte #define	SCSI_STAT_CHECK_COND	0x02
869fcf3ce44SJohn Forte #define	SCSI_STAT_COND_MET	0x04
870fcf3ce44SJohn Forte #define	SCSI_STAT_BUSY		0x08
871fcf3ce44SJohn Forte #define	SCSI_STAT_INTERMED	0x10
872fcf3ce44SJohn Forte #define	SCSI_STAT_INTERMED_CM	0x14
873fcf3ce44SJohn Forte #define	SCSI_STAT_RES_CNFLCT	0x18
874fcf3ce44SJohn Forte #define	SCSI_STAT_CMD_TERM	0x22
875fcf3ce44SJohn Forte #define	SCSI_STAT_QUE_FULL	0x28
876fcf3ce44SJohn Forte #define	SCSI_STAT_ACA_ACTIVE	0x30
877fcf3ce44SJohn Forte #define	SCSI_STAT_TASK_ABORT	0x40
878fcf3ce44SJohn Forte 
879291a2b48SSukumar Swaminathan 	uint32_t	rspResId;	/* Residual xfer if RESID_xxxx set */
880291a2b48SSukumar Swaminathan 					/* in fcpStatus2. */
88182527734SSukumar Swaminathan 					/* Received in Big Endian format */
882291a2b48SSukumar Swaminathan 	uint32_t	rspSnsLen;	/* Length of sense data in fcpSnsInfo */
88382527734SSukumar Swaminathan 					/* Received in Big Endian format */
884291a2b48SSukumar Swaminathan 	uint32_t	rspRspLen;	/* Length of FCP response data */
885291a2b48SSukumar Swaminathan 					/* in fcpRspInfo */
88682527734SSukumar Swaminathan 					/* Received in Big Endian format */
887fcf3ce44SJohn Forte 
888291a2b48SSukumar Swaminathan 	uint8_t		rspInfo0;	/* FCP_RSP_INFO byte 0 (reserved) */
889291a2b48SSukumar Swaminathan 	uint8_t		rspInfo1;	/* FCP_RSP_INFO byte 1 (reserved) */
890291a2b48SSukumar Swaminathan 	uint8_t		rspInfo2;	/* FCP_RSP_INFO byte 2 (reserved) */
891291a2b48SSukumar Swaminathan 	uint8_t		rspInfo3;	/* FCP_RSP_INFO RSP_CODE byte 3 */
892fcf3ce44SJohn Forte 
893fcf3ce44SJohn Forte #define	RSP_NO_FAILURE		0x00
894fcf3ce44SJohn Forte #define	RSP_DATA_BURST_ERR	0x01
895fcf3ce44SJohn Forte #define	RSP_CMD_FIELD_ERR	0x02
896fcf3ce44SJohn Forte #define	RSP_RO_MISMATCH_ERR	0x03
897fcf3ce44SJohn Forte #define	RSP_TM_NOT_SUPPORTED	0x04	/* Task mgmt function not supported */
898fcf3ce44SJohn Forte #define	RSP_TM_NOT_COMPLETED	0x05	/* Task mgmt function not performed */
899fcf3ce44SJohn Forte 
900291a2b48SSukumar Swaminathan 	uint32_t	rspInfoRsvd;	/* FCP_RSP_INFO bytes 4-7 (reserved) */
901fcf3ce44SJohn Forte 
902fcf3ce44SJohn Forte 	/*
903291a2b48SSukumar Swaminathan 	 * Define maximum size of SCSI Sense buffer.
904291a2b48SSukumar Swaminathan 	 * Seagate never issues more than 18 bytes of Sense data
905fcf3ce44SJohn Forte 	 */
906291a2b48SSukumar Swaminathan #define	MAX_FCP_SNS	128
907291a2b48SSukumar Swaminathan 	uint8_t		rspSnsInfo[MAX_FCP_SNS];
908fcf3ce44SJohn Forte } emlxs_fcp_rsp;
909fcf3ce44SJohn Forte typedef emlxs_fcp_rsp FCP_RSP;
910fcf3ce44SJohn Forte 
911fcf3ce44SJohn Forte 
912291a2b48SSukumar Swaminathan typedef struct emlxs_fcp_cmd
913291a2b48SSukumar Swaminathan {
914291a2b48SSukumar Swaminathan 	uint32_t	fcpLunMsl;	/* most significant lun word */
915291a2b48SSukumar Swaminathan 	uint32_t	fcpLunLsl;	/* least significant lun word */
916fcf3ce44SJohn Forte 
917fcf3ce44SJohn Forte 	/*
918291a2b48SSukumar Swaminathan 	 * # of bits to shift lun id to end up in right payload word,
919291a2b48SSukumar Swaminathan 	 * little endian = 8, big = 16.
920fcf3ce44SJohn Forte 	 */
921fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
922fcf3ce44SJohn Forte #define	FC_LUN_SHIFT		8
923fcf3ce44SJohn Forte #define	FC_ADDR_MODE_SHIFT	0
924fcf3ce44SJohn Forte #endif
925fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
926fcf3ce44SJohn Forte #define	FC_LUN_SHIFT		16
927fcf3ce44SJohn Forte #define	FC_ADDR_MODE_SHIFT	24
928fcf3ce44SJohn Forte #endif
929fcf3ce44SJohn Forte 
930291a2b48SSukumar Swaminathan 	uint8_t		fcpCntl0;	/* FCP_CNTL byte 0 (reserved) */
931291a2b48SSukumar Swaminathan 	uint8_t		fcpCntl1;	/* FCP_CNTL byte 1 task codes */
932291a2b48SSukumar Swaminathan #define	SIMPLE_Q	0x00
933291a2b48SSukumar Swaminathan #define	HEAD_OF_Q	0x01
934291a2b48SSukumar Swaminathan #define	ORDERED_Q	0x02
935291a2b48SSukumar Swaminathan #define	ACA_Q		0x04
936291a2b48SSukumar Swaminathan #define	UNTAGGED	0x05
937291a2b48SSukumar Swaminathan 
938291a2b48SSukumar Swaminathan 	uint8_t		fcpCntl2;	/* FCP_CTL byte 2 task management */
939291a2b48SSukumar Swaminathan 					/* codes */
940291a2b48SSukumar Swaminathan #define	ABORT_TASK_SET	0x02	/* Bit 1 */
941291a2b48SSukumar Swaminathan #define	CLEAR_TASK_SET	0x04	/* bit 2 */
942291a2b48SSukumar Swaminathan #define	LUN_RESET	0x10	/* bit 4 */
943291a2b48SSukumar Swaminathan #define	TARGET_RESET	0x20	/* bit 5 */
944291a2b48SSukumar Swaminathan #define	CLEAR_ACA	0x40	/* bit 6 */
945291a2b48SSukumar Swaminathan #define	TERMINATE_TASK	0x80	/* bit 7 */
946291a2b48SSukumar Swaminathan 
947291a2b48SSukumar Swaminathan 	uint8_t		fcpCntl3;
948291a2b48SSukumar Swaminathan #define	WRITE_DATA	0x01	/* Bit 0 */
949291a2b48SSukumar Swaminathan #define	READ_DATA	0x02	/* Bit 1 */
950291a2b48SSukumar Swaminathan 
951291a2b48SSukumar Swaminathan 	uint8_t		fcpCdb[16];	/* SRB cdb field is copied here */
952291a2b48SSukumar Swaminathan 	uint32_t	fcpDl;	/* Total transfer length */
953fcf3ce44SJohn Forte } emlxs_fcp_cmd_t;
954fcf3ce44SJohn Forte typedef emlxs_fcp_cmd_t FCP_CMND;
955fcf3ce44SJohn Forte 
956fcf3ce44SJohn Forte 
957fcf3ce44SJohn Forte 
958fcf3ce44SJohn Forte 
959fcf3ce44SJohn Forte /* SCSI INQUIRY Command Structure */
960fcf3ce44SJohn Forte 
961291a2b48SSukumar Swaminathan typedef struct emlxs_inquiryDataType
962291a2b48SSukumar Swaminathan {
963291a2b48SSukumar Swaminathan 	uint8_t		DeviceType:5;
964291a2b48SSukumar Swaminathan 	uint8_t		DeviceTypeQualifier:3;
965291a2b48SSukumar Swaminathan 
966291a2b48SSukumar Swaminathan 	uint8_t		DeviceTypeModifier:7;
967291a2b48SSukumar Swaminathan 	uint8_t		RemovableMedia:1;
968291a2b48SSukumar Swaminathan 
969291a2b48SSukumar Swaminathan 	uint8_t		Versions;
970291a2b48SSukumar Swaminathan 	uint8_t		ResponseDataFormat;
971291a2b48SSukumar Swaminathan 	uint8_t		AdditionalLength;
972291a2b48SSukumar Swaminathan 	uint8_t		Reserved[2];
973291a2b48SSukumar Swaminathan 
974291a2b48SSukumar Swaminathan 	uint8_t		SoftReset:1;
975291a2b48SSukumar Swaminathan 	uint8_t		CommandQueue:1;
976291a2b48SSukumar Swaminathan 	uint8_t		Reserved2:1;
977291a2b48SSukumar Swaminathan 	uint8_t		LinkedCommands:1;
978291a2b48SSukumar Swaminathan 	uint8_t		Synchronous:1;
979291a2b48SSukumar Swaminathan 	uint8_t		Wide16Bit:1;
980291a2b48SSukumar Swaminathan 	uint8_t		Wide32Bit:1;
981291a2b48SSukumar Swaminathan 	uint8_t		RelativeAddressing:1;
982291a2b48SSukumar Swaminathan 
983291a2b48SSukumar Swaminathan 	uint8_t		VendorId[8];
984291a2b48SSukumar Swaminathan 	uint8_t		ProductId[16];
985291a2b48SSukumar Swaminathan 	uint8_t		ProductRevisionLevel[4];
986291a2b48SSukumar Swaminathan 	uint8_t		VendorSpecific[20];
987291a2b48SSukumar Swaminathan 	uint8_t		Reserved3[40];
988fcf3ce44SJohn Forte } emlxs_inquiry_data_type_t;
989fcf3ce44SJohn Forte typedef emlxs_inquiry_data_type_t INQUIRY_DATA_DEF;
990fcf3ce44SJohn Forte 
991fcf3ce44SJohn Forte 
992291a2b48SSukumar Swaminathan typedef struct emlxs_read_capacity_data
993291a2b48SSukumar Swaminathan {
994291a2b48SSukumar Swaminathan 	uint32_t	LogicalBlockAddress;
995291a2b48SSukumar Swaminathan 	uint32_t	BytesPerBlock;
996fcf3ce44SJohn Forte } emlxs_read_capacity_data_t;
997fcf3ce44SJohn Forte typedef emlxs_read_capacity_data_t READ_CAPACITY_DATA_DEF;
998fcf3ce44SJohn Forte 
999fcf3ce44SJohn Forte 
1000fcf3ce44SJohn Forte /* SCSI CDB command codes */
1001fcf3ce44SJohn Forte #define	FCP_SCSI_FORMAT_UNIT			0x04
1002fcf3ce44SJohn Forte #define	FCP_SCSI_INQUIRY			0x12
1003fcf3ce44SJohn Forte #define	FCP_SCSI_MODE_SELECT			0x15
1004fcf3ce44SJohn Forte #define	FCP_SCSI_MODE_SENSE			0x1A
1005fcf3ce44SJohn Forte #define	FCP_SCSI_PAUSE_RESUME			0x4B
1006fcf3ce44SJohn Forte #define	FCP_SCSI_PLAY_AUDIO			0x45
1007fcf3ce44SJohn Forte #define	FCP_SCSI_PLAY_AUDIO_EXT			0xA5
1008fcf3ce44SJohn Forte #define	FCP_SCSI_PLAY_AUDIO_MSF			0x47
1009fcf3ce44SJohn Forte #define	FCP_SCSI_PLAY_AUDIO_TRK_INDX		0x48
1010fcf3ce44SJohn Forte #define	FCP_SCSI_PREVENT_ALLOW_REMOVAL		0x1E
1011fcf3ce44SJohn Forte #define	FCP_SCSI_READ_CMD			0x08
1012fcf3ce44SJohn Forte #define	FCP_SCSI_READ_BUFFER			0x3C
1013fcf3ce44SJohn Forte #define	FCP_SCSI_READ_CAPACITY			0x25
1014fcf3ce44SJohn Forte #define	FCP_SCSI_READ_DEFECT_LIST		0x37
1015fcf3ce44SJohn Forte #define	FCP_SCSI_READ_EXTENDED			0x28
1016fcf3ce44SJohn Forte #define	FCP_SCSI_READ_HEADER			0x44
1017fcf3ce44SJohn Forte #define	FCP_SCSI_READ_LONG			0xE8
1018fcf3ce44SJohn Forte #define	FCP_SCSI_READ_SUB_CHANNEL		0x42
1019fcf3ce44SJohn Forte #define	FCP_SCSI_READ_TOC			0x43
1020fcf3ce44SJohn Forte #define	FCP_SCSI_REASSIGN_BLOCK			0x07
1021fcf3ce44SJohn Forte #define	FCP_SCSI_RECEIVE_DIAGNOSTIC_RESULTS	0x1C
1022fcf3ce44SJohn Forte #define	FCP_SCSI_RELEASE_UNIT			0x17
1023fcf3ce44SJohn Forte #define	FCP_SCSI_REPORT_LUNS			0xa0
1024fcf3ce44SJohn Forte #define	FCP_SCSI_REQUEST_SENSE			0x03
1025fcf3ce44SJohn Forte #define	FCP_SCSI_RESERVE_UNIT			0x16
1026fcf3ce44SJohn Forte #define	FCP_SCSI_REZERO_UNIT			0x01
1027fcf3ce44SJohn Forte #define	FCP_SCSI_SEEK				0x0B
1028fcf3ce44SJohn Forte #define	FCP_SCSI_SEEK_EXTENDED			0x2B
1029fcf3ce44SJohn Forte #define	FCP_SCSI_SEND_DIAGNOSTIC		0x1D
1030fcf3ce44SJohn Forte #define	FCP_SCSI_START_STOP_UNIT		0x1B
1031fcf3ce44SJohn Forte #define	FCP_SCSI_TEST_UNIT_READY		0x00
1032fcf3ce44SJohn Forte #define	FCP_SCSI_VERIFY				0x2F
1033fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_CMD			0x0A
1034fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_AND_VERIFY		0x2E
1035fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_BUFFER			0x3B
1036fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_EXTENDED			0x2A
1037fcf3ce44SJohn Forte #define	FCP_SCSI_WRITE_LONG			0xEA
1038fcf3ce44SJohn Forte #define	FCP_SCSI_RELEASE_LUNR			0xBB
1039fcf3ce44SJohn Forte #define	FCP_SCSI_RELEASE_LUNV			0xBF
1040fcf3ce44SJohn Forte 
1041fcf3ce44SJohn Forte #define	HPVA_SETPASSTHROUGHMODE			0x27
1042fcf3ce44SJohn Forte #define	HPVA_EXECUTEPASSTHROUGH			0x29
1043fcf3ce44SJohn Forte #define	HPVA_CREATELUN				0xE2
1044fcf3ce44SJohn Forte #define	HPVA_SETLUNSECURITYLIST			0xED
1045fcf3ce44SJohn Forte #define	HPVA_SETCLOCK				0xF9
1046fcf3ce44SJohn Forte #define	HPVA_RECOVER				0xFA
1047fcf3ce44SJohn Forte #define	HPVA_GENERICSERVICEOUT			0xFD
1048fcf3ce44SJohn Forte 
1049fcf3ce44SJohn Forte #define	DMEP_EXPORT_IN				0x85
1050fcf3ce44SJohn Forte #define	DMEP_EXPORT_OUT				0x89
1051fcf3ce44SJohn Forte 
1052fcf3ce44SJohn Forte #define	MDACIOCTL_DIRECT_CMD			0x22
1053fcf3ce44SJohn Forte #define	MDACIOCTL_STOREIMAGE			0x2C
1054fcf3ce44SJohn Forte #define	MDACIOCTL_WRITESIGNATURE		0xA6
1055fcf3ce44SJohn Forte #define	MDACIOCTL_SETREALTIMECLOCK		0xAC
1056fcf3ce44SJohn Forte #define	MDACIOCTL_PASS_THRU_CDB			0xAD
1057fcf3ce44SJohn Forte #define	MDACIOCTL_PASS_THRU_INITIATE		0xAE
1058fcf3ce44SJohn Forte #define	MDACIOCTL_CREATENEWCONF			0xC0
1059fcf3ce44SJohn Forte #define	MDACIOCTL_ADDNEWCONF			0xC4
1060fcf3ce44SJohn Forte #define	MDACIOCTL_MORE				0xC6
1061fcf3ce44SJohn Forte #define	MDACIOCTL_SETPHYSDEVPARAMETER		0xC8
1062fcf3ce44SJohn Forte #define	MDACIOCTL_SETLOGDEVPARAMETER		0xCF
1063fcf3ce44SJohn Forte #define	MDACIOCTL_SETCONTROLLERPARAMETER	0xD1
1064fcf3ce44SJohn Forte #define	MDACIOCTL_WRITESANMAP			0xD4
1065fcf3ce44SJohn Forte #define	MDACIOCTL_SETMACADDRESS			0xD5
1066fcf3ce44SJohn Forte 
1067fcf3ce44SJohn Forte /*
1068fcf3ce44SJohn Forte  * End of FCP specific structures
1069fcf3ce44SJohn Forte  */
1070fcf3ce44SJohn Forte 
1071291a2b48SSukumar Swaminathan #define	FL_ALPA		0x00	/* AL_PA of FL_Port */
1072fcf3ce44SJohn Forte 
1073fcf3ce44SJohn Forte /* Fibre Channel Service Parameter definitions */
1074fcf3ce44SJohn Forte 
1075291a2b48SSukumar Swaminathan #define	FC_PH_4_0	6	/* FC-PH version 4.0 */
1076291a2b48SSukumar Swaminathan #define	FC_PH_4_1	7	/* FC-PH version 4.1 */
1077291a2b48SSukumar Swaminathan #define	FC_PH_4_2	8	/* FC-PH version 4.2 */
1078291a2b48SSukumar Swaminathan #define	FC_PH_4_3	9	/* FC-PH version 4.3 */
1079fcf3ce44SJohn Forte 
1080291a2b48SSukumar Swaminathan #define	FC_PH_LOW	8	/* Lowest supported FC-PH version */
1081291a2b48SSukumar Swaminathan #define	FC_PH_HIGH	9	/* Highest supported FC-PH version */
1082291a2b48SSukumar Swaminathan #define	FC_PH3		0x20	/* FC-PH-3 version */
1083fcf3ce44SJohn Forte 
1084291a2b48SSukumar Swaminathan #define	FF_FRAME_SIZE	2048
1085fcf3ce44SJohn Forte 
1086fcf3ce44SJohn Forte 
1087291a2b48SSukumar Swaminathan typedef struct emlxs_rings
1088291a2b48SSukumar Swaminathan {
1089fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1090291a2b48SSukumar Swaminathan 	uint32_t	crReserved:16;
1091291a2b48SSukumar Swaminathan 	uint32_t	crBegin:8;
1092291a2b48SSukumar Swaminathan 	uint32_t	crEnd:8;	/* Low order bit first word */
1093291a2b48SSukumar Swaminathan 	uint32_t	rrReserved:16;
1094291a2b48SSukumar Swaminathan 	uint32_t	rrBegin:8;
1095291a2b48SSukumar Swaminathan 	uint32_t	rrEnd:8;	/* Low order bit second word */
1096fcf3ce44SJohn Forte #endif
1097fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1098291a2b48SSukumar Swaminathan 	uint32_t	crEnd:8;	/* Low order bit first word */
1099291a2b48SSukumar Swaminathan 	uint32_t	crBegin:8;
1100291a2b48SSukumar Swaminathan 	uint32_t	crReserved:16;
1101291a2b48SSukumar Swaminathan 	uint32_t	rrEnd:8;	/* Low order bit second word */
1102291a2b48SSukumar Swaminathan 	uint32_t	rrBegin:8;
1103291a2b48SSukumar Swaminathan 	uint32_t	rrReserved:16;
1104fcf3ce44SJohn Forte #endif
1105fcf3ce44SJohn Forte } emlxs_rings_t;
1106fcf3ce44SJohn Forte typedef emlxs_rings_t RINGS;
1107fcf3ce44SJohn Forte 
1108fcf3ce44SJohn Forte 
1109291a2b48SSukumar Swaminathan typedef struct emlxs_ring_def
1110291a2b48SSukumar Swaminathan {
1111fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1112291a2b48SSukumar Swaminathan 	uint16_t	offCiocb;
1113291a2b48SSukumar Swaminathan 	uint16_t	numCiocb;
1114291a2b48SSukumar Swaminathan 	uint16_t	offRiocb;
1115291a2b48SSukumar Swaminathan 	uint16_t	numRiocb;
1116fcf3ce44SJohn Forte #endif
1117fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1118291a2b48SSukumar Swaminathan 	uint16_t	numCiocb;
1119291a2b48SSukumar Swaminathan 	uint16_t	offCiocb;
1120291a2b48SSukumar Swaminathan 	uint16_t	numRiocb;
1121291a2b48SSukumar Swaminathan 	uint16_t	offRiocb;
1122fcf3ce44SJohn Forte #endif
1123fcf3ce44SJohn Forte } emlxs_ring_def_t;
1124fcf3ce44SJohn Forte typedef emlxs_ring_def_t RING_DEF;
1125fcf3ce44SJohn Forte 
1126fcf3ce44SJohn Forte /*
1127fcf3ce44SJohn Forte  * The following F.C. frame stuctures are defined in Big Endian format.
1128fcf3ce44SJohn Forte  */
1129fcf3ce44SJohn Forte 
1130291a2b48SSukumar Swaminathan typedef struct emlxs_name_type
1131291a2b48SSukumar Swaminathan {
1132fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1133291a2b48SSukumar Swaminathan 	uint8_t		nameType:4;	/* FC Word 0, bit 28:31 */
1134291a2b48SSukumar Swaminathan 	uint8_t		IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit 8:11 */
1135291a2b48SSukumar Swaminathan 					/* of IEEE ext */
1136fcf3ce44SJohn Forte #endif
1137fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1138291a2b48SSukumar Swaminathan 	uint8_t		IEEEextMsn:4;	/* FC Word 0, bit 24:27, bit 8:11 */
1139291a2b48SSukumar Swaminathan 					/* of IEEE ext */
1140291a2b48SSukumar Swaminathan 	uint8_t		nameType:4;	/* FC Word 0, bit 28:31 */
1141fcf3ce44SJohn Forte #endif
1142fcf3ce44SJohn Forte #define	NAME_IEEE		0x1	/* IEEE name - nameType */
1143fcf3ce44SJohn Forte #define	NAME_IEEE_EXT		0x2	/* IEEE extended name */
1144fcf3ce44SJohn Forte #define	NAME_FC_TYPE		0x3	/* FC native name type */
1145fcf3ce44SJohn Forte #define	NAME_IP_TYPE		0x4	/* IP address */
1146fcf3ce44SJohn Forte #define	NAME_CCITT_TYPE		0xC
1147fcf3ce44SJohn Forte #define	NAME_CCITT_GR_TYPE	0xE
1148291a2b48SSukumar Swaminathan 	uint8_t		IEEEextLsb;	/* FC Word 0, bit 16:23, */
1149291a2b48SSukumar Swaminathan 					/* IEEE extended Lsb */
1150291a2b48SSukumar Swaminathan 	uint8_t		IEEE[6];	/* FC IEEE address */
1151fcf3ce44SJohn Forte } emlxs_name_type_t;
1152fcf3ce44SJohn Forte typedef emlxs_name_type_t NAME_TYPE;
1153fcf3ce44SJohn Forte 
1154fcf3ce44SJohn Forte 
11558f23e9faSHans Rosenfeld /*
11568f23e9faSHans Rosenfeld  * Word 1 Bit 31 in common service parameter is overloaded.
11578f23e9faSHans Rosenfeld  * Word 1 Bit 31 in FLOGI/FDISC request is multiple NPort request
11588f23e9faSHans Rosenfeld  * Word 1 Bit 31 in FLOGI/FDISC response is clean address bit
11598f23e9faSHans Rosenfeld  */
11608f23e9faSHans Rosenfeld #define	CLEAN_ADDRESS_BIT reqMultipleNPort /* Word 1, bit 31 */
11618f23e9faSHans Rosenfeld 
1162291a2b48SSukumar Swaminathan typedef struct emlxs_csp
1163291a2b48SSukumar Swaminathan {
1164291a2b48SSukumar Swaminathan 	uint8_t		fcphHigh;		/* FC Word 0, byte 0 */
1165291a2b48SSukumar Swaminathan 	uint8_t		fcphLow;
1166291a2b48SSukumar Swaminathan 	uint8_t		bbCreditMsb;
1167291a2b48SSukumar Swaminathan 	uint8_t		bbCreditlsb;		/* FC Word 0, byte 3 */
1168fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1169291a2b48SSukumar Swaminathan 	uint16_t	reqMultipleNPort:1;	/* FC Word 1, bit 31 */
1170291a2b48SSukumar Swaminathan 	uint16_t	randomOffset:1;		/* FC Word 1, bit 30 */
1171291a2b48SSukumar Swaminathan 	uint16_t	rspMultipleNPort:1;	/* FC Word 1, bit 29 */
1172291a2b48SSukumar Swaminathan 	uint16_t	fPort:1;		/* FC Word 1, bit 28 */
1173291a2b48SSukumar Swaminathan 	uint16_t	altBbCredit:1;		/* FC Word 1, bit 27 */
1174291a2b48SSukumar Swaminathan 	uint16_t	edtovResolution:1;	/* FC Word 1, bit 26 */
1175291a2b48SSukumar Swaminathan 	uint16_t	multicast:1;		/* FC Word 1, bit 25 */
1176291a2b48SSukumar Swaminathan 	uint16_t	broadcast:1;		/* FC Word 1, bit 24 */
1177291a2b48SSukumar Swaminathan 
1178291a2b48SSukumar Swaminathan 	uint16_t	huntgroup:1;		/* FC Word 1, bit 23 */
1179291a2b48SSukumar Swaminathan 	uint16_t	simplex:1;		/* FC Word 1, bit 22 */
1180291a2b48SSukumar Swaminathan 
1181291a2b48SSukumar Swaminathan 	uint16_t	fcsp_support:1;		/* FC Word 1, bit 21 */
1182291a2b48SSukumar Swaminathan 	uint16_t	word1Reserved20:1;	/* FC Word 1, bit 20 */
1183291a2b48SSukumar Swaminathan 	uint16_t	word1Reserved19:1;	/* FC Word 1, bit 19 */
1184291a2b48SSukumar Swaminathan 
1185291a2b48SSukumar Swaminathan 	uint16_t	dhd:1;			/* FC Word 1, bit 18 */
1186291a2b48SSukumar Swaminathan 	uint16_t	contIncSeqCnt:1;	/* FC Word 1, bit 17 */
1187291a2b48SSukumar Swaminathan 	uint16_t	payloadlength:1;	/* FC Word 1, bit 16 */
1188fcf3ce44SJohn Forte #endif
1189fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1190291a2b48SSukumar Swaminathan 	uint16_t	broadcast:1;		/* FC Word 1, bit 24 */
1191291a2b48SSukumar Swaminathan 	uint16_t	multicast:1;		/* FC Word 1, bit 25 */
1192291a2b48SSukumar Swaminathan 	uint16_t	edtovResolution:1;	/* FC Word 1, bit 26 */
1193291a2b48SSukumar Swaminathan 	uint16_t	altBbCredit:1;		/* FC Word 1, bit 27 */
1194291a2b48SSukumar Swaminathan 	uint16_t	fPort:1;		/* FC Word 1, bit 28 */
1195291a2b48SSukumar Swaminathan 	uint16_t	rspMultipleNPort:1;	/* FC Word 1, bit 29 */
1196291a2b48SSukumar Swaminathan 	uint16_t	randomOffset:1;		/* FC Word 1, bit 30 */
1197291a2b48SSukumar Swaminathan 	uint16_t	reqMultipleNPort:1;	/* FC Word 1, bit 31 */
1198291a2b48SSukumar Swaminathan 
1199291a2b48SSukumar Swaminathan 	uint16_t	payloadlength:1;	/* FC Word 1, bit 16 */
1200291a2b48SSukumar Swaminathan 	uint16_t	contIncSeqCnt:1;	/* FC Word 1, bit 17 */
1201291a2b48SSukumar Swaminathan 	uint16_t	dhd:1;			/* FC Word 1, bit 18 */
1202291a2b48SSukumar Swaminathan 
1203291a2b48SSukumar Swaminathan 	uint16_t	word1Reserved19:1;	/* FC Word 1, bit 19 */
1204291a2b48SSukumar Swaminathan 	uint16_t	word1Reserved20:1;	/* FC Word 1, bit 20 */
1205291a2b48SSukumar Swaminathan 	uint16_t	fcsp_support:1;		/* FC Word 1, bit 21 */
1206291a2b48SSukumar Swaminathan 
1207291a2b48SSukumar Swaminathan 	uint16_t	simplex:1;		/* FC Word 1, bit 22 */
1208291a2b48SSukumar Swaminathan 	uint16_t	huntgroup:1;		/* FC Word 1, bit 23 */
1209291a2b48SSukumar Swaminathan #endif
1210291a2b48SSukumar Swaminathan 	uint8_t		bbRcvSizeMsb;		/* Upper nibble is reserved */
1211291a2b48SSukumar Swaminathan 	uint8_t		bbRcvSizeLsb;		/* FC Word 1, byte 3 */
1212291a2b48SSukumar Swaminathan 	union
1213291a2b48SSukumar Swaminathan 	{
1214291a2b48SSukumar Swaminathan 		struct
1215291a2b48SSukumar Swaminathan 		{
1216291a2b48SSukumar Swaminathan 			uint8_t	word2Reserved1;	/* FC Word 2 byte 0 */
1217291a2b48SSukumar Swaminathan 
1218291a2b48SSukumar Swaminathan 			uint8_t	totalConcurrSeq; /* FC Word 2 byte 1 */
1219291a2b48SSukumar Swaminathan 			uint8_t	roByCategoryMsb; /* FC Word 2 byte 2 */
1220291a2b48SSukumar Swaminathan 
1221291a2b48SSukumar Swaminathan 			uint8_t	roByCategoryLsb; /* FC Word 2 byte 3 */
1222fcf3ce44SJohn Forte 		} nPort;
1223291a2b48SSukumar Swaminathan 		uint32_t	r_a_tov;	/* R_A_TOV must be in Big */
1224291a2b48SSukumar Swaminathan 						/* Endian format */
1225fcf3ce44SJohn Forte 	} w2;
1226fcf3ce44SJohn Forte 
1227291a2b48SSukumar Swaminathan 	uint32_t	e_d_tov;		/* E_D_TOV must be in Big */
1228291a2b48SSukumar Swaminathan 						/* Endian format */
1229fcf3ce44SJohn Forte } emlxs_csp_t;
1230fcf3ce44SJohn Forte typedef emlxs_csp_t CSP;
1231fcf3ce44SJohn Forte 
1232fcf3ce44SJohn Forte 
1233291a2b48SSukumar Swaminathan typedef struct emlxs_class_parms
1234291a2b48SSukumar Swaminathan {
1235fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1236291a2b48SSukumar Swaminathan 	uint8_t	classValid:1;		/* FC Word 0, bit 31 */
1237291a2b48SSukumar Swaminathan 	uint8_t	intermix:1;		/* FC Word 0, bit 30 */
1238291a2b48SSukumar Swaminathan 	uint8_t	stackedXparent:1;	/* FC Word 0, bit 29 */
1239291a2b48SSukumar Swaminathan 	uint8_t	stackedLockDown:1;	/* FC Word 0, bit 28 */
1240291a2b48SSukumar Swaminathan 	uint8_t	seqDelivery:1;		/* FC Word 0, bit 27 */
1241291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved1:3;	/* FC Word 0, bit 24:26 */
1242fcf3ce44SJohn Forte #endif
1243fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1244291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved1:3;	/* FC Word 0, bit 24:26 */
1245291a2b48SSukumar Swaminathan 	uint8_t	seqDelivery:1;		/* FC Word 0, bit 27 */
1246291a2b48SSukumar Swaminathan 	uint8_t	stackedLockDown:1;	/* FC Word 0, bit 28 */
1247291a2b48SSukumar Swaminathan 	uint8_t	stackedXparent:1;	/* FC Word 0, bit 29 */
1248291a2b48SSukumar Swaminathan 	uint8_t	intermix:1;		/* FC Word 0, bit 30 */
1249291a2b48SSukumar Swaminathan 	uint8_t	classValid:1;		/* FC Word 0, bit 31 */
1250fcf3ce44SJohn Forte 
1251fcf3ce44SJohn Forte #endif
1252291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved2;		/* FC Word 0, bit 16:23 */
1253fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1254291a2b48SSukumar Swaminathan 	uint8_t	iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
1255291a2b48SSukumar Swaminathan 	uint8_t	iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
1256291a2b48SSukumar Swaminathan 	uint8_t	iCtlAck0capable:1;	/* FC Word 0, bit 11 */
1257291a2b48SSukumar Swaminathan 	uint8_t	iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
1258291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
1259fcf3ce44SJohn Forte #endif
1260fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1261291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved3:2;	/* FC Word 0, bit  8: 9 */
1262291a2b48SSukumar Swaminathan 	uint8_t	iCtlAckNcapable:1;	/* FC Word 0, bit 10 */
1263291a2b48SSukumar Swaminathan 	uint8_t	iCtlAck0capable:1;	/* FC Word 0, bit 11 */
1264291a2b48SSukumar Swaminathan 	uint8_t	iCtlInitialPa:2;	/* FC Word 0, bit 12:13 */
1265291a2b48SSukumar Swaminathan 	uint8_t	iCtlXidReAssgn:2;	/* FC Word 0, Bit 14:15 */
1266fcf3ce44SJohn Forte #endif
1267291a2b48SSukumar Swaminathan 	uint8_t	word0Reserved4;		/* FC Word 0, bit  0: 7 */
1268fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1269291a2b48SSukumar Swaminathan 	uint8_t	rCtlAck0capable:1;	/* FC Word 1, bit 31 */
1270291a2b48SSukumar Swaminathan 	uint8_t	rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
1271291a2b48SSukumar Swaminathan 	uint8_t	rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
1272291a2b48SSukumar Swaminathan 	uint8_t	rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
1273291a2b48SSukumar Swaminathan 	uint8_t	word1Reserved1:1;	/* FC Word 1, bit 26 */
1274291a2b48SSukumar Swaminathan 	uint8_t	rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
1275fcf3ce44SJohn Forte #endif
1276fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1277291a2b48SSukumar Swaminathan 	uint8_t	rCtlCatPerSeq:2;	/* FC Word 1, bit 24:25 */
1278291a2b48SSukumar Swaminathan 	uint8_t	word1Reserved1:1;	/* FC Word 1, bit 26 */
1279291a2b48SSukumar Swaminathan 	uint8_t	rCtlErrorPolicy:2;	/* FC Word 1, bit 27:28 */
1280291a2b48SSukumar Swaminathan 	uint8_t	rCtlXidInterlck:1;	/* FC Word 1, bit 29 */
1281291a2b48SSukumar Swaminathan 	uint8_t	rCtlAckNcapable:1;	/* FC Word 1, bit 30 */
1282291a2b48SSukumar Swaminathan 	uint8_t	rCtlAck0capable:1;	/* FC Word 1, bit 31 */
1283291a2b48SSukumar Swaminathan #endif
1284291a2b48SSukumar Swaminathan 	uint8_t	word1Reserved2;		/* FC Word 1, bit 16:23 */
1285291a2b48SSukumar Swaminathan 	uint8_t	rcvDataSizeMsb;		/* FC Word 1, bit  8:15 */
1286291a2b48SSukumar Swaminathan 	uint8_t	rcvDataSizeLsb;		/* FC Word 1, bit  0: 7 */
1287291a2b48SSukumar Swaminathan 
1288291a2b48SSukumar Swaminathan 	uint8_t	concurrentSeqMsb;	/* FC Word 2, bit 24:31 */
1289291a2b48SSukumar Swaminathan 	uint8_t	concurrentSeqLsb;	/* FC Word 2, bit 16:23 */
1290291a2b48SSukumar Swaminathan 	uint8_t	EeCreditSeqMsb;		/* FC Word 2, bit  8:15 */
1291291a2b48SSukumar Swaminathan 	uint8_t	EeCreditSeqLsb;		/* FC Word 2, bit  0: 7 */
1292291a2b48SSukumar Swaminathan 
1293291a2b48SSukumar Swaminathan 	uint8_t	openSeqPerXchgMsb;	/* FC Word 3, bit 24:31 */
1294291a2b48SSukumar Swaminathan 	uint8_t	openSeqPerXchgLsb;	/* FC Word 3, bit 16:23 */
1295291a2b48SSukumar Swaminathan 	uint8_t	word3Reserved1;		/* Fc Word 3, bit  8:15 */
1296291a2b48SSukumar Swaminathan 	uint8_t	word3Reserved2;		/* Fc Word 3, bit  0: 7 */
1297fcf3ce44SJohn Forte } emlxs_class_parms_t;
1298fcf3ce44SJohn Forte typedef emlxs_class_parms_t CLASS_PARMS;
1299fcf3ce44SJohn Forte 
1300fcf3ce44SJohn Forte 
1301291a2b48SSukumar Swaminathan typedef struct emlxs_serv_parms
1302291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1303291a2b48SSukumar Swaminathan 	CSP		cmn;
1304291a2b48SSukumar Swaminathan 	NAME_TYPE	portName;
1305291a2b48SSukumar Swaminathan 	NAME_TYPE	nodeName;
1306291a2b48SSukumar Swaminathan 	CLASS_PARMS	cls1;
1307291a2b48SSukumar Swaminathan 	CLASS_PARMS	cls2;
1308291a2b48SSukumar Swaminathan 	CLASS_PARMS	cls3;
1309291a2b48SSukumar Swaminathan 	CLASS_PARMS	cls4;
1310291a2b48SSukumar Swaminathan 	uint8_t		vendorVersion[16];
1311fcf3ce44SJohn Forte } emlxs_serv_parms_t;
1312fcf3ce44SJohn Forte typedef emlxs_serv_parms_t SERV_PARM;
1313fcf3ce44SJohn Forte 
1314291a2b48SSukumar Swaminathan typedef struct
1315291a2b48SSukumar Swaminathan {
1316291a2b48SSukumar Swaminathan 	union
1317291a2b48SSukumar Swaminathan 	{
1318291a2b48SSukumar Swaminathan 		uint32_t	word0;
1319291a2b48SSukumar Swaminathan 		struct
1320291a2b48SSukumar Swaminathan 		{
1321fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1322fcf3ce44SJohn Forte 			uint32_t rsvd0:8;	/* Word 0, Byte 3 */
1323291a2b48SSukumar Swaminathan 			uint32_t oui:24;	/* Elx Organization */
1324291a2b48SSukumar Swaminathan 						/* Unique ID (0000C9) */
1325fcf3ce44SJohn Forte #endif
1326fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1327291a2b48SSukumar Swaminathan 			uint32_t oui:24;	/* Elx Organization */
1328291a2b48SSukumar Swaminathan 						/* Unique ID (0000C9) */
1329fcf3ce44SJohn Forte 			uint32_t rsvd0:8;	/* Word 0, Byte 3 */
1330fcf3ce44SJohn Forte #endif
1331fcf3ce44SJohn Forte 		} w0;
1332fcf3ce44SJohn Forte 	} un0;
1333291a2b48SSukumar Swaminathan 	union
1334291a2b48SSukumar Swaminathan 	{
1335291a2b48SSukumar Swaminathan 		uint32_t	word1;
1336291a2b48SSukumar Swaminathan 		struct
1337291a2b48SSukumar Swaminathan 		{
1338fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1339fcf3ce44SJohn Forte 			uint32_t vport:1;	/* Word 1, Bit 31 */
1340fcf3ce44SJohn Forte 			uint32_t rsvd1:31;	/* Word 1, Bit 0-30 */
1341fcf3ce44SJohn Forte #endif
1342fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1343fcf3ce44SJohn Forte 			uint32_t rsvd1:31;	/* Word 1, Bit 0-30 */
1344fcf3ce44SJohn Forte 			uint32_t vport:1;	/* Word 1, Bit 31 */
1345fcf3ce44SJohn Forte #endif
1346fcf3ce44SJohn Forte 		} w1;
1347fcf3ce44SJohn Forte 	} un1;
1348291a2b48SSukumar Swaminathan 	uint8_t		rsvd2[8];
1349fcf3ce44SJohn Forte } emlxs_vvl_fmt_t;
1350fcf3ce44SJohn Forte 
135182527734SSukumar Swaminathan #define	VALID_VENDOR_VERSION	cmn.rspMultipleNPort
1352fcf3ce44SJohn Forte 
1353fcf3ce44SJohn Forte 
1354fcf3ce44SJohn Forte 
1355fcf3ce44SJohn Forte /*
1356fcf3ce44SJohn Forte  * Extended Link Service LS_COMMAND codes (Payload BYTE 0)
1357fcf3ce44SJohn Forte  */
1358fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1359291a2b48SSukumar Swaminathan #define	ELS_CMD_SHIFT	24
1360291a2b48SSukumar Swaminathan #define	ELS_CMD_MASK	0xff000000
1361291a2b48SSukumar Swaminathan #define	ELS_RSP_MASK	0xff000000
1362291a2b48SSukumar Swaminathan #define	ELS_CMD_LS_RJT	0x01000000
1363291a2b48SSukumar Swaminathan #define	ELS_CMD_ACC	0x02000000
1364291a2b48SSukumar Swaminathan #define	ELS_CMD_PLOGI	0x03000000
1365291a2b48SSukumar Swaminathan #define	ELS_CMD_FLOGI	0x04000000
1366291a2b48SSukumar Swaminathan #define	ELS_CMD_LOGO	0x05000000
1367291a2b48SSukumar Swaminathan #define	ELS_CMD_ABTX	0x06000000
1368291a2b48SSukumar Swaminathan #define	ELS_CMD_RCS	0x07000000
1369291a2b48SSukumar Swaminathan #define	ELS_CMD_RES	0x08000000
1370291a2b48SSukumar Swaminathan #define	ELS_CMD_RSS	0x09000000
1371291a2b48SSukumar Swaminathan #define	ELS_CMD_RSI	0x0A000000
1372291a2b48SSukumar Swaminathan #define	ELS_CMD_ESTS	0x0B000000
1373291a2b48SSukumar Swaminathan #define	ELS_CMD_ESTC	0x0C000000
1374291a2b48SSukumar Swaminathan #define	ELS_CMD_ADVC	0x0D000000
1375291a2b48SSukumar Swaminathan #define	ELS_CMD_RTV	0x0E000000
1376291a2b48SSukumar Swaminathan #define	ELS_CMD_RLS	0x0F000000
1377291a2b48SSukumar Swaminathan #define	ELS_CMD_ECHO	0x10000000
1378291a2b48SSukumar Swaminathan #define	ELS_CMD_TEST	0x11000000
1379291a2b48SSukumar Swaminathan #define	ELS_CMD_RRQ	0x12000000
1380a9800bebSGarrett D'Amore #define	ELS_CMD_REC	0x13000000
1381291a2b48SSukumar Swaminathan #define	ELS_CMD_PRLI	0x20000000
1382291a2b48SSukumar Swaminathan #define	ELS_CMD_PRLO	0x21000000
1383291a2b48SSukumar Swaminathan #define	ELS_CMD_SCN	0x22000000
1384291a2b48SSukumar Swaminathan #define	ELS_CMD_TPLS	0x23000000
1385291a2b48SSukumar Swaminathan #define	ELS_CMD_GPRLO	0x24000000
1386291a2b48SSukumar Swaminathan #define	ELS_CMD_GAID	0x30000000
1387291a2b48SSukumar Swaminathan #define	ELS_CMD_FACT	0x31000000
1388291a2b48SSukumar Swaminathan #define	ELS_CMD_FDACT	0x32000000
1389291a2b48SSukumar Swaminathan #define	ELS_CMD_NACT	0x33000000
1390291a2b48SSukumar Swaminathan #define	ELS_CMD_NDACT	0x34000000
1391291a2b48SSukumar Swaminathan #define	ELS_CMD_QoSR	0x40000000
1392291a2b48SSukumar Swaminathan #define	ELS_CMD_RVCS	0x41000000
1393291a2b48SSukumar Swaminathan #define	ELS_CMD_PDISC	0x50000000
1394291a2b48SSukumar Swaminathan #define	ELS_CMD_FDISC	0x51000000
1395291a2b48SSukumar Swaminathan #define	ELS_CMD_ADISC	0x52000000
1396291a2b48SSukumar Swaminathan #define	ELS_CMD_FARP	0x54000000
1397291a2b48SSukumar Swaminathan #define	ELS_CMD_FARPR	0x55000000
1398291a2b48SSukumar Swaminathan #define	ELS_CMD_FAN	0x60000000
1399291a2b48SSukumar Swaminathan #define	ELS_CMD_RSCN	0x61000000
1400291a2b48SSukumar Swaminathan #define	ELS_CMD_SCR	0x62000000
1401291a2b48SSukumar Swaminathan #define	ELS_CMD_LINIT	0x70000000
1402291a2b48SSukumar Swaminathan #define	ELS_CMD_RNID	0x78000000
1403291a2b48SSukumar Swaminathan #define	ELS_CMD_AUTH	0x90000000
1404fcf3ce44SJohn Forte #endif
1405fcf3ce44SJohn Forte 
1406fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1407291a2b48SSukumar Swaminathan #define	ELS_CMD_SHIFT	0
1408291a2b48SSukumar Swaminathan #define	ELS_CMD_MASK	0xff
1409291a2b48SSukumar Swaminathan #define	ELS_RSP_MASK	0xff
1410291a2b48SSukumar Swaminathan #define	ELS_CMD_LS_RJT	0x01
1411291a2b48SSukumar Swaminathan #define	ELS_CMD_ACC	0x02
1412291a2b48SSukumar Swaminathan #define	ELS_CMD_PLOGI	0x03
1413291a2b48SSukumar Swaminathan #define	ELS_CMD_FLOGI	0x04
1414291a2b48SSukumar Swaminathan #define	ELS_CMD_LOGO	0x05
1415291a2b48SSukumar Swaminathan #define	ELS_CMD_ABTX	0x06
1416291a2b48SSukumar Swaminathan #define	ELS_CMD_RCS	0x07
1417291a2b48SSukumar Swaminathan #define	ELS_CMD_RES	0x08
1418291a2b48SSukumar Swaminathan #define	ELS_CMD_RSS	0x09
1419291a2b48SSukumar Swaminathan #define	ELS_CMD_RSI	0x0A
1420291a2b48SSukumar Swaminathan #define	ELS_CMD_ESTS	0x0B
1421291a2b48SSukumar Swaminathan #define	ELS_CMD_ESTC	0x0C
1422291a2b48SSukumar Swaminathan #define	ELS_CMD_ADVC	0x0D
1423291a2b48SSukumar Swaminathan #define	ELS_CMD_RTV	0x0E
1424291a2b48SSukumar Swaminathan #define	ELS_CMD_RLS	0x0F
1425291a2b48SSukumar Swaminathan #define	ELS_CMD_ECHO	0x10
1426291a2b48SSukumar Swaminathan #define	ELS_CMD_TEST	0x11
1427291a2b48SSukumar Swaminathan #define	ELS_CMD_RRQ	0x12
1428a9800bebSGarrett D'Amore #define	ELS_CMD_REC	0x13
1429291a2b48SSukumar Swaminathan #define	ELS_CMD_PRLI	0x20
1430291a2b48SSukumar Swaminathan #define	ELS_CMD_PRLO	0x21
1431291a2b48SSukumar Swaminathan #define	ELS_CMD_SCN	0x22
1432291a2b48SSukumar Swaminathan #define	ELS_CMD_TPLS	0x23
1433291a2b48SSukumar Swaminathan #define	ELS_CMD_GPRLO	0x24
1434291a2b48SSukumar Swaminathan #define	ELS_CMD_GAID	0x30
1435291a2b48SSukumar Swaminathan #define	ELS_CMD_FACT	0x31
1436291a2b48SSukumar Swaminathan #define	ELS_CMD_FDACT	0x32
1437291a2b48SSukumar Swaminathan #define	ELS_CMD_NACT	0x33
1438291a2b48SSukumar Swaminathan #define	ELS_CMD_NDACT	0x34
1439291a2b48SSukumar Swaminathan #define	ELS_CMD_QoSR	0x40
1440291a2b48SSukumar Swaminathan #define	ELS_CMD_RVCS	0x41
1441291a2b48SSukumar Swaminathan #define	ELS_CMD_PDISC	0x50
1442291a2b48SSukumar Swaminathan #define	ELS_CMD_FDISC	0x51
1443291a2b48SSukumar Swaminathan #define	ELS_CMD_ADISC	0x52
1444291a2b48SSukumar Swaminathan #define	ELS_CMD_FARP	0x54
1445291a2b48SSukumar Swaminathan #define	ELS_CMD_FARPR	0x55
1446291a2b48SSukumar Swaminathan #define	ELS_CMD_FAN	0x60
1447291a2b48SSukumar Swaminathan #define	ELS_CMD_RSCN	0x61
1448291a2b48SSukumar Swaminathan #define	ELS_CMD_SCR	0x62
1449291a2b48SSukumar Swaminathan #define	ELS_CMD_LINIT	0x70
1450291a2b48SSukumar Swaminathan #define	ELS_CMD_RNID	0x78
1451291a2b48SSukumar Swaminathan #define	ELS_CMD_AUTH	0x90
1452fcf3ce44SJohn Forte #endif
1453fcf3ce44SJohn Forte 
1454fcf3ce44SJohn Forte 
1455fcf3ce44SJohn Forte /*
1456fcf3ce44SJohn Forte  * LS_RJT Payload Definition
1457fcf3ce44SJohn Forte  */
1458fcf3ce44SJohn Forte 
1459291a2b48SSukumar Swaminathan typedef struct _LS_RJT
1460291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1461291a2b48SSukumar Swaminathan 	union
1462291a2b48SSukumar Swaminathan 	{
1463291a2b48SSukumar Swaminathan 		uint32_t	lsRjtError;
1464291a2b48SSukumar Swaminathan 		struct
1465291a2b48SSukumar Swaminathan 		{
1466291a2b48SSukumar Swaminathan 			uint8_t	lsRjtRsvd0;	/* FC Word 0, */
1467291a2b48SSukumar Swaminathan 						/* bit 24:31 */
1468291a2b48SSukumar Swaminathan 
1469291a2b48SSukumar Swaminathan 			uint8_t	lsRjtRsnCode;	/* FC Word 0, */
1470291a2b48SSukumar Swaminathan 						/* bit 16:23 */
1471fcf3ce44SJohn Forte 			/* LS_RJT reason codes */
1472fcf3ce44SJohn Forte #define	LSRJT_INVALID_CMD	0x01
1473fcf3ce44SJohn Forte #define	LSRJT_LOGICAL_ERR	0x03
1474fcf3ce44SJohn Forte #define	LSRJT_LOGICAL_BSY	0x05
1475fcf3ce44SJohn Forte #define	LSRJT_PROTOCOL_ERR	0x07
1476fcf3ce44SJohn Forte #define	LSRJT_UNABLE_TPC	0x09	/* Unable to perform command */
1477fcf3ce44SJohn Forte #define	LSRJT_CMD_UNSUPPORTED	0x0B
1478fcf3ce44SJohn Forte #define	LSRJT_VENDOR_UNIQUE	0xFF	/* See Byte 3 */
1479fcf3ce44SJohn Forte 
1480291a2b48SSukumar Swaminathan 			uint8_t	lsRjtRsnCodeExp;	/* FC Word 0, */
1481291a2b48SSukumar Swaminathan 							/* bit 8:15 */
1482fcf3ce44SJohn Forte 			/* LS_RJT reason explanation */
1483fcf3ce44SJohn Forte #define	LSEXP_NOTHING_MORE	0x00
1484fcf3ce44SJohn Forte #define	LSEXP_SPARM_OPTIONS	0x01
1485fcf3ce44SJohn Forte #define	LSEXP_SPARM_ICTL	0x03
1486fcf3ce44SJohn Forte #define	LSEXP_SPARM_RCTL	0x05
1487fcf3ce44SJohn Forte #define	LSEXP_SPARM_RCV_SIZE	0x07
1488fcf3ce44SJohn Forte #define	LSEXP_SPARM_CONCUR_SEQ	0x09
1489fcf3ce44SJohn Forte #define	LSEXP_SPARM_CREDIT	0x0B
1490fcf3ce44SJohn Forte #define	LSEXP_INVALID_PNAME	0x0D
1491fcf3ce44SJohn Forte #define	LSEXP_INVALID_NNAME	0x0E
1492fcf3ce44SJohn Forte #define	LSEXP_INVALID_CSP	0x0F
1493fcf3ce44SJohn Forte #define	LSEXP_INVALID_ASSOC_HDR	0x11
1494fcf3ce44SJohn Forte #define	LSEXP_ASSOC_HDR_REQ	0x13
1495fcf3ce44SJohn Forte #define	LSEXP_INVALID_O_SID	0x15
1496fcf3ce44SJohn Forte #define	LSEXP_INVALID_OX_RX	0x17
1497fcf3ce44SJohn Forte #define	LSEXP_CMD_IN_PROGRESS	0x19
1498fcf3ce44SJohn Forte #define	LSEXP_INVALID_NPORT_ID	0x1F
1499fcf3ce44SJohn Forte #define	LSEXP_INVALID_SEQ_ID	0x21
1500fcf3ce44SJohn Forte #define	LSEXP_INVALID_XCHG	0x23
1501fcf3ce44SJohn Forte #define	LSEXP_INACTIVE_XCHG	0x25
1502fcf3ce44SJohn Forte #define	LSEXP_RQ_REQUIRED	0x27
1503fcf3ce44SJohn Forte #define	LSEXP_OUT_OF_RESOURCE	0x29
1504fcf3ce44SJohn Forte #define	LSEXP_CANT_GIVE_DATA	0x2A
1505291a2b48SSukumar Swaminathan #define	LSEXP_REQ_UNSUPPORTED	0x2C
1506291a2b48SSukumar Swaminathan 			uint8_t	vendorUnique;	/* FC Word 0, bit  0: 7 */
1507fcf3ce44SJohn Forte 		} b;
1508fcf3ce44SJohn Forte 	} un;
1509fcf3ce44SJohn Forte } LS_RJT;
1510fcf3ce44SJohn Forte 
1511fcf3ce44SJohn Forte 
1512fcf3ce44SJohn Forte /*
1513fcf3ce44SJohn Forte  * N_Port Login (FLOGO/PLOGO Request) Payload Definition
1514fcf3ce44SJohn Forte  */
1515fcf3ce44SJohn Forte 
1516291a2b48SSukumar Swaminathan typedef struct _LOGO
1517291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1518291a2b48SSukumar Swaminathan 	union
1519291a2b48SSukumar Swaminathan 	{
1520291a2b48SSukumar Swaminathan 		uint32_t	nPortId32;	/* Access nPortId as a word */
1521291a2b48SSukumar Swaminathan 		struct
1522291a2b48SSukumar Swaminathan 		{
1523291a2b48SSukumar Swaminathan 			uint8_t	word1Reserved1;	/* FC Word 1, bit 31:24 */
1524291a2b48SSukumar Swaminathan 			uint8_t	nPortIdByte0;	/* N_port  ID bit 16:23 */
1525291a2b48SSukumar Swaminathan 			uint8_t	nPortIdByte1;	/* N_port  ID bit  8:15 */
1526291a2b48SSukumar Swaminathan 			uint8_t	nPortIdByte2;	/* N_port  ID bit  0: 7 */
1527fcf3ce44SJohn Forte 		} b;
1528fcf3ce44SJohn Forte 	} un;
1529291a2b48SSukumar Swaminathan 	NAME_TYPE		portName;	/* N_port name field */
1530fcf3ce44SJohn Forte } LOGO;
1531fcf3ce44SJohn Forte 
1532fcf3ce44SJohn Forte 
1533fcf3ce44SJohn Forte /*
1534fcf3ce44SJohn Forte  * FCP Login (PRLI Request / ACC) Payload Definition
1535fcf3ce44SJohn Forte  */
1536fcf3ce44SJohn Forte 
1537291a2b48SSukumar Swaminathan #define	PRLX_PAGE_LEN	0x10
1538291a2b48SSukumar Swaminathan #define	TPRLO_PAGE_LEN	0x14
1539fcf3ce44SJohn Forte 
1540291a2b48SSukumar Swaminathan typedef struct _PRLI
1541291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1542291a2b48SSukumar Swaminathan 	uint8_t		prliType;		/* FC Parm Word 0, bit 24:31 */
1543fcf3ce44SJohn Forte 
1544fcf3ce44SJohn Forte #define	PRLI_FCP_TYPE 0x08
1545291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved1;		/* FC Parm Word 0, bit 16:23 */
1546fcf3ce44SJohn Forte 
1547fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1548291a2b48SSukumar Swaminathan 	uint8_t		origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
1549291a2b48SSukumar Swaminathan 	uint8_t		respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
1550291a2b48SSukumar Swaminathan 	uint8_t		estabImagePair:1;	/* FC Parm Word 0, bit 13 */
1551fcf3ce44SJohn Forte 
1552fcf3ce44SJohn Forte 	/* ACC = imagePairEstablished */
1553291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
1554291a2b48SSukumar Swaminathan 	uint8_t		acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, */
1555291a2b48SSukumar Swaminathan 						/* ACC ONLY */
1556fcf3ce44SJohn Forte #endif
1557fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1558291a2b48SSukumar Swaminathan 	uint8_t		acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, */
1559291a2b48SSukumar Swaminathan 						/* ACC ONLY */
1560291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved2:1;	/* FC Parm Word 0, bit 12 */
1561291a2b48SSukumar Swaminathan 	uint8_t		estabImagePair:1;	/* FC Parm Word 0, bit 13 */
1562291a2b48SSukumar Swaminathan 	uint8_t		respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
1563291a2b48SSukumar Swaminathan 	uint8_t		origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
1564fcf3ce44SJohn Forte 	/* ACC = imagePairEstablished */
1565fcf3ce44SJohn Forte #endif
1566291a2b48SSukumar Swaminathan #define	PRLI_REQ_EXECUTED	0x1		/* acceptRspCode */
1567fcf3ce44SJohn Forte #define	PRLI_NO_RESOURCES	0x2
1568fcf3ce44SJohn Forte #define	PRLI_INIT_INCOMPLETE	0x3
1569fcf3ce44SJohn Forte #define	PRLI_NO_SUCH_PA		0x4
1570fcf3ce44SJohn Forte #define	PRLI_PREDEF_CONFIG	0x5
1571fcf3ce44SJohn Forte #define	PRLI_PARTIAL_SUCCESS	0x6
1572fcf3ce44SJohn Forte #define	PRLI_INVALID_PAGE_CNT	0x7
1573291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved3;		/* FC Parm Word 0, bit 0:7 */
1574fcf3ce44SJohn Forte 
1575291a2b48SSukumar Swaminathan 	uint32_t	origProcAssoc;		/* FC Parm Word 1, bit 0:31 */
1576fcf3ce44SJohn Forte 
1577291a2b48SSukumar Swaminathan 	uint32_t	respProcAssoc;		/* FC Parm Word 2, bit 0:31 */
1578fcf3ce44SJohn Forte 
1579291a2b48SSukumar Swaminathan 	uint8_t		word3Reserved1;		/* FC Parm Word 3, bit 24:31 */
1580291a2b48SSukumar Swaminathan 	uint8_t		word3Reserved2;		/* FC Parm Word 3, bit 16:23 */
1581fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1582291a2b48SSukumar Swaminathan 	uint16_t	Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
1583291a2b48SSukumar Swaminathan 	uint16_t	Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
1584291a2b48SSukumar Swaminathan 	uint16_t	Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
1585291a2b48SSukumar Swaminathan 	uint16_t	Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
1586291a2b48SSukumar Swaminathan 	uint16_t	Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
1587291a2b48SSukumar Swaminathan 	uint16_t	Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
1588291a2b48SSukumar Swaminathan 	uint16_t	TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
1589291a2b48SSukumar Swaminathan 	uint16_t	Retry:1;		/* FC Parm Word 3, bit  8 */
1590291a2b48SSukumar Swaminathan 	uint16_t	ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
1591291a2b48SSukumar Swaminathan 	uint16_t	dataOverLay:1;		/* FC Parm Word 3, bit  6 */
1592291a2b48SSukumar Swaminathan 	uint16_t	initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
1593291a2b48SSukumar Swaminathan 	uint16_t	targetFunc:1;		/* FC Parm Word 3, bit  4 */
1594291a2b48SSukumar Swaminathan 	uint16_t	cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
1595291a2b48SSukumar Swaminathan 	uint16_t	dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
1596291a2b48SSukumar Swaminathan 	uint16_t	readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
1597291a2b48SSukumar Swaminathan 	uint16_t	writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
1598fcf3ce44SJohn Forte #endif
1599fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1600291a2b48SSukumar Swaminathan 	uint16_t	Retry:1;		/* FC Parm Word 3, bit  8 */
1601291a2b48SSukumar Swaminathan 	uint16_t	TaskRetryIdReq:1;	/* FC Parm Word 3, bit  9 */
1602291a2b48SSukumar Swaminathan 	uint16_t	Word3bit10Resved:1;	/* FC Parm Word 3, bit 10 */
1603291a2b48SSukumar Swaminathan 	uint16_t	Word3bit11Resved:1;	/* FC Parm Word 3, bit 11 */
1604291a2b48SSukumar Swaminathan 	uint16_t	Word3bit12Resved:1;	/* FC Parm Word 3, bit 12 */
1605291a2b48SSukumar Swaminathan 	uint16_t	Word3bit13Resved:1;	/* FC Parm Word 3, bit 13 */
1606291a2b48SSukumar Swaminathan 	uint16_t	Word3bit14Resved:1;	/* FC Parm Word 3, bit 14 */
1607291a2b48SSukumar Swaminathan 	uint16_t	Word3bit15Resved:1;	/* FC Parm Word 3, bit 15 */
1608291a2b48SSukumar Swaminathan 	uint16_t	writeXferRdyDis:1;	/* FC Parm Word 3, bit  0 */
1609291a2b48SSukumar Swaminathan 	uint16_t	readXferRdyDis:1;	/* FC Parm Word 3, bit  1 */
1610291a2b48SSukumar Swaminathan 	uint16_t	dataRspMixEna:1;	/* FC Parm Word 3, bit  2 */
1611291a2b48SSukumar Swaminathan 	uint16_t	cmdDataMixEna:1;	/* FC Parm Word 3, bit  3 */
1612291a2b48SSukumar Swaminathan 	uint16_t	targetFunc:1;		/* FC Parm Word 3, bit  4 */
1613291a2b48SSukumar Swaminathan 	uint16_t	initiatorFunc:1;	/* FC Parm Word 3, bit  5 */
1614291a2b48SSukumar Swaminathan 	uint16_t	dataOverLay:1;		/* FC Parm Word 3, bit  6 */
1615291a2b48SSukumar Swaminathan 	uint16_t	ConfmComplAllowed:1;	/* FC Parm Word 3, bit  7 */
1616fcf3ce44SJohn Forte #endif
1617fcf3ce44SJohn Forte } PRLI;
1618fcf3ce44SJohn Forte 
1619fcf3ce44SJohn Forte /*
1620fcf3ce44SJohn Forte  * FCP Logout (PRLO Request / ACC) Payload Definition
1621fcf3ce44SJohn Forte  */
1622fcf3ce44SJohn Forte 
1623291a2b48SSukumar Swaminathan typedef struct _PRLO
1624291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1625291a2b48SSukumar Swaminathan 	uint8_t		prloType;	/* FC Parm Word 0, bit 24:31 */
1626fcf3ce44SJohn Forte 
1627291a2b48SSukumar Swaminathan #define	PRLO_FCP_TYPE	0x08
1628291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved1;	/* FC Parm Word 0, bit 16:23 */
1629fcf3ce44SJohn Forte 
1630fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1631291a2b48SSukumar Swaminathan 	uint8_t		origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
1632291a2b48SSukumar Swaminathan 	uint8_t		respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
1633291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
1634291a2b48SSukumar Swaminathan 	uint8_t		acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, */
1635291a2b48SSukumar Swaminathan 						/* ACC ONLY */
1636fcf3ce44SJohn Forte #endif
1637fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1638291a2b48SSukumar Swaminathan 	uint8_t		acceptRspCode:4;	/* FC Parm Word 0, bit 8:11, */
1639291a2b48SSukumar Swaminathan 						/* ACC ONLY */
1640291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved2:2;	/* FC Parm Word 0, bit 12:13 */
1641291a2b48SSukumar Swaminathan 	uint8_t		respProcAssocV:1;	/* FC Parm Word 0, bit 14 */
1642291a2b48SSukumar Swaminathan 	uint8_t		origProcAssocV:1;	/* FC Parm Word 0, bit 15 */
1643fcf3ce44SJohn Forte #endif
1644291a2b48SSukumar Swaminathan #define	PRLO_REQ_EXECUTED	0x1		/* acceptRspCode */
1645fcf3ce44SJohn Forte #define	PRLO_NO_SUCH_IMAGE	0x4
1646fcf3ce44SJohn Forte #define	PRLO_INVALID_PAGE_CNT	0x7
1647fcf3ce44SJohn Forte 
1648291a2b48SSukumar Swaminathan 	uint8_t		word0Reserved3;		/* FC Parm Word 0, bit 0:7 */
1649291a2b48SSukumar Swaminathan 	uint32_t	origProcAssoc;		/* FC Parm Word 1, bit 0:31 */
1650291a2b48SSukumar Swaminathan 	uint32_t	respProcAssoc;		/* FC Parm Word 2, bit 0:31 */
1651291a2b48SSukumar Swaminathan 	uint32_t	word3Reserved1;		/* FC Parm Word 3, bit 0:31 */
1652fcf3ce44SJohn Forte } PRLO;
1653fcf3ce44SJohn Forte 
1654fcf3ce44SJohn Forte 
1655291a2b48SSukumar Swaminathan typedef struct _ADISC
1656291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1657291a2b48SSukumar Swaminathan 	uint32_t	hardAL_PA;
1658291a2b48SSukumar Swaminathan 	NAME_TYPE	portName;
1659291a2b48SSukumar Swaminathan 	NAME_TYPE	nodeName;
1660291a2b48SSukumar Swaminathan 	uint32_t	DID;
1661fcf3ce44SJohn Forte } ADISC;
1662fcf3ce44SJohn Forte 
1663fcf3ce44SJohn Forte 
1664291a2b48SSukumar Swaminathan typedef struct _FARP
1665291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1666291a2b48SSukumar Swaminathan 	uint32_t	Mflags:8;
1667291a2b48SSukumar Swaminathan 	uint32_t	Odid:24;
1668291a2b48SSukumar Swaminathan #define	FARP_NO_ACTION	0	/* FARP information enclosed, no action */
1669291a2b48SSukumar Swaminathan #define	FARP_MATCH_PORT	0x1	/* Match on Responder Port Name */
1670291a2b48SSukumar Swaminathan #define	FARP_MATCH_NODE	0x2	/* Match on Responder Node Name */
1671291a2b48SSukumar Swaminathan #define	FARP_MATCH_IP	0x4	/* Match on IP address, not supported */
1672291a2b48SSukumar Swaminathan #define	FARP_MATCH_IPV4	0x5	/* Match on IPV4 address, not supported */
1673291a2b48SSukumar Swaminathan #define	FARP_MATCH_IPV6	0x6	/* Match on IPV6 address, not supported */
1674291a2b48SSukumar Swaminathan 	uint32_t	Rflags:8;
1675291a2b48SSukumar Swaminathan 	uint32_t	Rdid:24;
1676fcf3ce44SJohn Forte #define	FARP_REQUEST_PLOGI	0x1	/* Request for PLOGI */
1677fcf3ce44SJohn Forte #define	FARP_REQUEST_FARPR	0x2	/* Request for FARP Response */
1678291a2b48SSukumar Swaminathan 	NAME_TYPE	OportName;
1679291a2b48SSukumar Swaminathan 	NAME_TYPE	OnodeName;
1680291a2b48SSukumar Swaminathan 	NAME_TYPE	RportName;
1681291a2b48SSukumar Swaminathan 	NAME_TYPE	RnodeName;
1682291a2b48SSukumar Swaminathan 	uint8_t		Oipaddr[16];
1683291a2b48SSukumar Swaminathan 	uint8_t		Ripaddr[16];
1684fcf3ce44SJohn Forte } FARP;
1685fcf3ce44SJohn Forte 
1686291a2b48SSukumar Swaminathan typedef struct _FAN
1687291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1688291a2b48SSukumar Swaminathan 	uint32_t	Fdid;
1689291a2b48SSukumar Swaminathan 	NAME_TYPE	FportName;
1690291a2b48SSukumar Swaminathan 	NAME_TYPE	FnodeName;
1691fcf3ce44SJohn Forte } FAN;
1692fcf3ce44SJohn Forte 
1693291a2b48SSukumar Swaminathan typedef struct _SCR
1694291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1695291a2b48SSukumar Swaminathan 	uint8_t		resvd1;
1696291a2b48SSukumar Swaminathan 	uint8_t		resvd2;
1697291a2b48SSukumar Swaminathan 	uint8_t		resvd3;
1698291a2b48SSukumar Swaminathan 	uint8_t		Function;
1699291a2b48SSukumar Swaminathan #define	SCR_FUNC_FABRIC	0x01
1700291a2b48SSukumar Swaminathan #define	SCR_FUNC_NPORT	0x02
1701291a2b48SSukumar Swaminathan #define	SCR_FUNC_FULL	0x03
1702291a2b48SSukumar Swaminathan #define	SCR_CLEAR	0xff
1703fcf3ce44SJohn Forte } SCR;
1704fcf3ce44SJohn Forte 
1705291a2b48SSukumar Swaminathan typedef struct _RNID_TOP_DISC
1706291a2b48SSukumar Swaminathan {
1707291a2b48SSukumar Swaminathan 	NAME_TYPE	portName;
1708291a2b48SSukumar Swaminathan 	uint8_t		resvd[8];
1709291a2b48SSukumar Swaminathan 	uint32_t	unitType;
1710291a2b48SSukumar Swaminathan #define	RNID_HBA	0x7
1711291a2b48SSukumar Swaminathan #define	RNID_HOST	0xa
1712291a2b48SSukumar Swaminathan #define	RNID_DRIVER	0xd
1713291a2b48SSukumar Swaminathan 	uint32_t	physPort;
1714291a2b48SSukumar Swaminathan 	uint32_t	attachedNodes;
1715291a2b48SSukumar Swaminathan 	uint16_t	ipVersion;
1716291a2b48SSukumar Swaminathan #define	RNID_IPV4	0x1
1717291a2b48SSukumar Swaminathan #define	RNID_IPV6	0x2
1718291a2b48SSukumar Swaminathan 	uint16_t	UDPport;
1719291a2b48SSukumar Swaminathan 	uint8_t		ipAddr[16];
1720291a2b48SSukumar Swaminathan 	uint16_t	resvd1;
1721291a2b48SSukumar Swaminathan 	uint16_t	flags;
1722291a2b48SSukumar Swaminathan #define	RNID_TD_SUPPORT	0x1
1723291a2b48SSukumar Swaminathan #define	RNID_LP_VALID	0x2
1724fcf3ce44SJohn Forte } RNID_TOP_DISC;
1725fcf3ce44SJohn Forte 
1726291a2b48SSukumar Swaminathan typedef struct _RNID
1727291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1728291a2b48SSukumar Swaminathan 	uint8_t		Format;
1729fcf3ce44SJohn Forte #define	RNID_TOPOLOGY_DISC  0xdf
1730291a2b48SSukumar Swaminathan 	uint8_t		CommonLen;
1731291a2b48SSukumar Swaminathan 	uint8_t		resvd1;
1732291a2b48SSukumar Swaminathan 	uint8_t		SpecificLen;
1733291a2b48SSukumar Swaminathan 	NAME_TYPE	portName;
1734291a2b48SSukumar Swaminathan 	NAME_TYPE	nodeName;
1735291a2b48SSukumar Swaminathan 	union
1736291a2b48SSukumar Swaminathan 	{
1737fcf3ce44SJohn Forte 		RNID_TOP_DISC topologyDisc;	/* topology disc (0xdf) */
1738fcf3ce44SJohn Forte 	} un;
1739fcf3ce44SJohn Forte } RNID;
1740fcf3ce44SJohn Forte 
1741291a2b48SSukumar Swaminathan typedef struct _RRQ
1742291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1743291a2b48SSukumar Swaminathan 	uint32_t	SID;
1744291a2b48SSukumar Swaminathan 	uint16_t	Oxid;
1745291a2b48SSukumar Swaminathan 	uint16_t	Rxid;
1746291a2b48SSukumar Swaminathan 	uint8_t		resv[32];	/* optional association hdr */
1747fcf3ce44SJohn Forte } RRQ;
1748fcf3ce44SJohn Forte 
1749fcf3ce44SJohn Forte 
1750fcf3ce44SJohn Forte /* This is used for RSCN command */
1751291a2b48SSukumar Swaminathan typedef struct _D_ID
1752291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1753291a2b48SSukumar Swaminathan 	union
1754291a2b48SSukumar Swaminathan 	{
1755291a2b48SSukumar Swaminathan 		uint32_t	word;
1756291a2b48SSukumar Swaminathan 		struct
1757291a2b48SSukumar Swaminathan 		{
1758fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1759291a2b48SSukumar Swaminathan 			uint8_t	resv;
1760291a2b48SSukumar Swaminathan 			uint8_t	domain;
1761291a2b48SSukumar Swaminathan 			uint8_t	area;
1762291a2b48SSukumar Swaminathan 			uint8_t	id;
1763fcf3ce44SJohn Forte #endif
1764fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1765291a2b48SSukumar Swaminathan 			uint8_t	id;
1766291a2b48SSukumar Swaminathan 			uint8_t	area;
1767291a2b48SSukumar Swaminathan 			uint8_t	domain;
1768291a2b48SSukumar Swaminathan 			uint8_t	resv;
1769fcf3ce44SJohn Forte #endif
1770fcf3ce44SJohn Forte 		} b;
1771fcf3ce44SJohn Forte 	} un;
1772fcf3ce44SJohn Forte } D_ID;
1773fcf3ce44SJohn Forte 
1774fcf3ce44SJohn Forte /*
1775291a2b48SSukumar Swaminathan  * Structure to define	all ELS Payload types
1776fcf3ce44SJohn Forte  */
1777fcf3ce44SJohn Forte 
1778291a2b48SSukumar Swaminathan typedef struct _ELS_PKT
1779291a2b48SSukumar Swaminathan { /* Structure is in Big Endian format */
1780291a2b48SSukumar Swaminathan 	uint8_t		elsCode;		/* FC Word 0, bit 24:31 */
1781291a2b48SSukumar Swaminathan 	uint8_t		elsByte1;
1782291a2b48SSukumar Swaminathan 	uint8_t		elsByte2;
1783291a2b48SSukumar Swaminathan 	uint8_t		elsByte3;
1784291a2b48SSukumar Swaminathan 	union
1785291a2b48SSukumar Swaminathan 	{
1786291a2b48SSukumar Swaminathan 		LS_RJT		lsRjt;		/* Payload for LS_RJT */
1787291a2b48SSukumar Swaminathan 		SERV_PARM	logi;		/* Payload for PLOGI, FLOGI */
1788291a2b48SSukumar Swaminathan 						/* PDISC, ACC */
1789291a2b48SSukumar Swaminathan 		LOGO		logo;		/* Payload for PLOGO, FLOGO */
1790291a2b48SSukumar Swaminathan 						/* ACC */
1791291a2b48SSukumar Swaminathan 		PRLI		prli;		/* Payload for PRLI/ACC */
1792291a2b48SSukumar Swaminathan 		PRLO		prlo;		/* Payload for PRLO/ACC */
1793291a2b48SSukumar Swaminathan 		ADISC		adisc;		/* Payload for ADISC/ACC */
1794291a2b48SSukumar Swaminathan 		FARP		farp;		/* Payload for FARP/ACC */
1795291a2b48SSukumar Swaminathan 		FAN		fan;		/* Payload for FAN */
1796291a2b48SSukumar Swaminathan 		SCR		scr;		/* Payload for SCR/ACC */
1797291a2b48SSukumar Swaminathan 		RRQ		rrq;		/* Payload for RRQ */
1798291a2b48SSukumar Swaminathan 		RNID		rnid;		/* Payload for RNID */
1799291a2b48SSukumar Swaminathan 		uint8_t		pad[128 - 4];	/* Pad out to payload of */
1800291a2b48SSukumar Swaminathan 						/* 128 bytes */
1801fcf3ce44SJohn Forte 	} un;
1802fcf3ce44SJohn Forte } ELS_PKT;
1803fcf3ce44SJohn Forte 
1804fcf3ce44SJohn Forte 
1805291a2b48SSukumar Swaminathan typedef struct
1806291a2b48SSukumar Swaminathan {
1807291a2b48SSukumar Swaminathan 	uint32_t	bdeAddress;
1808fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1809291a2b48SSukumar Swaminathan 	uint32_t	bdeReserved:4;
1810291a2b48SSukumar Swaminathan 	uint32_t	bdeAddrHigh:4;
1811291a2b48SSukumar Swaminathan 	uint32_t	bdeSize:24;
1812fcf3ce44SJohn Forte #endif
1813fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1814291a2b48SSukumar Swaminathan 	uint32_t	bdeSize:24;
1815291a2b48SSukumar Swaminathan 	uint32_t	bdeAddrHigh:4;
1816291a2b48SSukumar Swaminathan 	uint32_t	bdeReserved:4;
1817fcf3ce44SJohn Forte #endif
1818fcf3ce44SJohn Forte } ULP_BDE;
1819fcf3ce44SJohn Forte 
1820291a2b48SSukumar Swaminathan typedef struct ULP_BDE_64
1821291a2b48SSukumar Swaminathan { /* SLI-2 */
1822291a2b48SSukumar Swaminathan 	union ULP_BDE_TUS
1823291a2b48SSukumar Swaminathan 	{
1824291a2b48SSukumar Swaminathan 		uint32_t	w;
1825291a2b48SSukumar Swaminathan 		struct
1826291a2b48SSukumar Swaminathan 		{
1827fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1828291a2b48SSukumar Swaminathan 			uint32_t	bdeFlags:8;	/* BDE Flags 0 IS A */
1829291a2b48SSukumar Swaminathan 							/* SUPPORTED VALUE !! */
1830291a2b48SSukumar Swaminathan 			uint32_t	bdeSize:24;	/* buff size in bytes */
1831fcf3ce44SJohn Forte #endif
1832fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1833291a2b48SSukumar Swaminathan 			uint32_t	bdeSize:24;	/* buff size in bytes */
1834291a2b48SSukumar Swaminathan 			uint32_t	bdeFlags:8;	/* BDE Flags 0 IS A */
1835291a2b48SSukumar Swaminathan 							/* SUPPORTED VALUE !! */
1836fcf3ce44SJohn Forte #endif
1837fcf3ce44SJohn Forte #define	BUFF_USE_RSVD		0x01	/* bdeFlags */
1838fcf3ce44SJohn Forte #define	BUFF_USE_INTRPT		0x02	/* Not Implemented with LP6000 */
1839291a2b48SSukumar Swaminathan #define	BUFF_USE_CMND		0x04	/* Optional, 1=cmd/rsp 0=data buffer */
1840291a2b48SSukumar Swaminathan #define	BUFF_USE_RCV		0x08	/* ""  "", 1=rcv buffer, */
1841291a2b48SSukumar Swaminathan 					/* 0=xmit buffer */
1842291a2b48SSukumar Swaminathan #define	BUFF_TYPE_32BIT		0x10	/* ""  "", 1=32 bit addr */
1843291a2b48SSukumar Swaminathan 					/* 0=64 bit addr */
1844fcf3ce44SJohn Forte #define	BUFF_TYPE_SPECIAL	0x20	/* Not Implemented with LP6000  */
1845fcf3ce44SJohn Forte #define	BUFF_TYPE_BDL		0x40	/* Optional,  may be set in BDL */
1846fcf3ce44SJohn Forte #define	BUFF_TYPE_INVALID	0x80	/* ""  "" */
1847fcf3ce44SJohn Forte 		} f;
1848fcf3ce44SJohn Forte 	} tus;
1849291a2b48SSukumar Swaminathan 	uint32_t	addrLow;
1850291a2b48SSukumar Swaminathan 	uint32_t	addrHigh;
1851fcf3ce44SJohn Forte } ULP_BDE64;
1852fcf3ce44SJohn Forte 
1853291a2b48SSukumar Swaminathan #define	BDE64_SIZE_WORD	0
1854291a2b48SSukumar Swaminathan #define	BPL64_SIZE_WORD	0x40
1855fcf3ce44SJohn Forte 
1856291a2b48SSukumar Swaminathan /*  ULP  */
1857291a2b48SSukumar Swaminathan typedef struct ULP_BPL_64
1858291a2b48SSukumar Swaminathan {
1859291a2b48SSukumar Swaminathan 	ULP_BDE64	fccmd_payload;
1860291a2b48SSukumar Swaminathan 	ULP_BDE64	fcrsp_payload;
1861291a2b48SSukumar Swaminathan 	ULP_BDE64	fcdat_payload;
1862291a2b48SSukumar Swaminathan 	ULP_BDE64	pat0;
1863fcf3ce44SJohn Forte } ULP_BPL64;
1864fcf3ce44SJohn Forte 
1865291a2b48SSukumar Swaminathan typedef struct ULP_BDL
1866291a2b48SSukumar Swaminathan { /* SLI-2 */
1867fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
1868291a2b48SSukumar Swaminathan 	uint32_t	bdeFlags:8;	/* BDL Flags */
1869291a2b48SSukumar Swaminathan 	uint32_t	bdeSize:24;	/* Size of BDL array in host */
1870291a2b48SSukumar Swaminathan 					/* memory (bytes) */
1871fcf3ce44SJohn Forte #endif
1872fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
1873291a2b48SSukumar Swaminathan 	uint32_t	bdeSize:24;	/* Size of BDL array in host */
1874291a2b48SSukumar Swaminathan 					/* memory (bytes) */
1875291a2b48SSukumar Swaminathan 	uint32_t	bdeFlags:8;	/* BDL Flags */
1876fcf3ce44SJohn Forte #endif
1877291a2b48SSukumar Swaminathan 	uint32_t	addrLow;	/* Address 0:31 */
1878291a2b48SSukumar Swaminathan 	uint32_t	addrHigh;	/* Address 32:63 */
1879291a2b48SSukumar Swaminathan 	uint32_t	ulpIoTag32;	/* Can be used for 32 bit I/O Tag */
1880fcf3ce44SJohn Forte } ULP_BDL;
1881fcf3ce44SJohn Forte 
188282527734SSukumar Swaminathan typedef struct ULP_SGE_64
188382527734SSukumar Swaminathan { /* SLI-4 */
188482527734SSukumar Swaminathan 	uint32_t	addrHigh;	/* Address 32:63 */
188582527734SSukumar Swaminathan 	uint32_t	addrLow;	/* Address 0:31 */
188682527734SSukumar Swaminathan #ifdef EMLXS_BIG_ENDIAN
188782527734SSukumar Swaminathan 	uint32_t	last:1;		/* Last entry in SGL */
18888f23e9faSHans Rosenfeld 	uint32_t	type:4;
18898f23e9faSHans Rosenfeld 	uint32_t	offset:27;
189082527734SSukumar Swaminathan #endif
189182527734SSukumar Swaminathan #ifdef EMLXS_LITTLE_ENDIAN
18928f23e9faSHans Rosenfeld 	uint32_t	offset:27;
18938f23e9faSHans Rosenfeld 	uint32_t	type:4;
189482527734SSukumar Swaminathan 	uint32_t	last:1;		/* Last entry in SGL */
189582527734SSukumar Swaminathan #endif
18968f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_DATA	0x0
18978f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_DIF	0x4
18988f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_LSP	0x5
18998f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_ENC_DIF	0x6
19008f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_ENC_SEED	0x7
19018f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_SEED	0x8
19028f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_ENC	0x9
19038f23e9faSHans Rosenfeld #define	EMLXS_SGE_TYPE_SKIP	0xC
19048f23e9faSHans Rosenfeld 
190582527734SSukumar Swaminathan 	uint32_t	length;
190682527734SSukumar Swaminathan #define	EMLXS_MAX_SGE_SIZE	0x10000	/* 64K max length */
190782527734SSukumar Swaminathan } ULP_SGE64;
190882527734SSukumar Swaminathan 
19098f23e9faSHans Rosenfeld #define	EMLXS_XFER_RDY_SIZE	12  /* Payload size of a FCP Transfer Ready */
191082527734SSukumar Swaminathan 
191182527734SSukumar Swaminathan typedef	struct _BE_PHYS_ADDR
191282527734SSukumar Swaminathan {
191382527734SSukumar Swaminathan 	uint32_t	addrLow;
191482527734SSukumar Swaminathan 	uint32_t	addrHigh;
191582527734SSukumar Swaminathan } BE_PHYS_ADDR;
191682527734SSukumar Swaminathan 
191782527734SSukumar Swaminathan 
1918291a2b48SSukumar Swaminathan typedef struct
1919291a2b48SSukumar Swaminathan {
1920a9800bebSGarrett D'Amore 	void		*fc_mptr;
192182527734SSukumar Swaminathan 	struct emlxs_memseg *segment;	/* Parent segment */
192282527734SSukumar Swaminathan 
1923a9800bebSGarrett D'Amore 	void		*virt;		/* virtual address ptr */
1924291a2b48SSukumar Swaminathan 	uint64_t	phys;		/* mapped address */
1925291a2b48SSukumar Swaminathan 	uint32_t	size;
192682527734SSukumar Swaminathan 
1927291a2b48SSukumar Swaminathan 	void		*data_handle;
1928291a2b48SSukumar Swaminathan 	void		*dma_handle;
1929291a2b48SSukumar Swaminathan 	uint32_t	tag;
1930291a2b48SSukumar Swaminathan 	uint32_t	flag;
1931291a2b48SSukumar Swaminathan #define	MAP_POOL_ALLOCATED	0x00000001
1932291a2b48SSukumar Swaminathan #define	MAP_BUF_ALLOCATED	0x00000002
1933291a2b48SSukumar Swaminathan #define	MAP_TABLE_ALLOCATED	0x00000004
19348f23e9faSHans Rosenfeld 
19358f23e9faSHans Rosenfeld #ifdef SFCT_SUPPORT
19368f23e9faSHans Rosenfeld 	void		*fct_private;
19378f23e9faSHans Rosenfeld #endif /* SFCT_SUPPORT */
1938fcf3ce44SJohn Forte } MATCHMAP;
1939fcf3ce44SJohn Forte 
1940291a2b48SSukumar Swaminathan 
194182527734SSukumar Swaminathan /*
194282527734SSukumar Swaminathan  * This file defines the Header File for the FDMI HBA Management Service
194382527734SSukumar Swaminathan  */
1944fcf3ce44SJohn Forte 
194582527734SSukumar Swaminathan /*
194682527734SSukumar Swaminathan  * FDMI HBA MAnagement Operations Command Codes
194782527734SSukumar Swaminathan  */
194882527734SSukumar Swaminathan #define	SLI_MGMT_GRHL	0x100	/* Get registered HBA list */
194982527734SSukumar Swaminathan #define	SLI_MGMT_GHAT	0x101	/* Get HBA attributes */
195082527734SSukumar Swaminathan #define	SLI_MGMT_GRPL	0x102	/* Get registered Port list */
195182527734SSukumar Swaminathan #define	SLI_MGMT_GPAT	0x110	/* Get Port attributes */
195282527734SSukumar Swaminathan #define	SLI_MGMT_RHBA	0x200	/* Register HBA */
195382527734SSukumar Swaminathan #define	SLI_MGMT_RHAT	0x201	/* Register HBA atttributes */
195482527734SSukumar Swaminathan #define	SLI_MGMT_RPRT	0x210	/* Register Port */
195582527734SSukumar Swaminathan #define	SLI_MGMT_RPA	0x211	/* Register Port attributes */
195682527734SSukumar Swaminathan #define	SLI_MGMT_DHBA	0x300	/* De-register HBA */
195782527734SSukumar Swaminathan #define	SLI_MGMT_DPRT	0x310	/* De-register Port */
1958fcf3ce44SJohn Forte 
195982527734SSukumar Swaminathan /*
196082527734SSukumar Swaminathan  * Management Service Subtypes
196182527734SSukumar Swaminathan  */
196282527734SSukumar Swaminathan #define	SLI_CT_FDMI_SUBTYPES	0x10
1963fcf3ce44SJohn Forte 
1964fcf3ce44SJohn Forte 
196582527734SSukumar Swaminathan /*
196682527734SSukumar Swaminathan  * HBA Management Service Reject Code
196782527734SSukumar Swaminathan  */
196882527734SSukumar Swaminathan #define	REJECT_CODE		0x9	/* Unable to perform command request */
1969fcf3ce44SJohn Forte 
197082527734SSukumar Swaminathan /*
197182527734SSukumar Swaminathan  * HBA Management Service Reject Reason Code
197282527734SSukumar Swaminathan  * Please refer to the Reason Codes above
197382527734SSukumar Swaminathan  */
1974fcf3ce44SJohn Forte 
197582527734SSukumar Swaminathan /*
197682527734SSukumar Swaminathan  * HBA Attribute Types
197782527734SSukumar Swaminathan  */
197882527734SSukumar Swaminathan #define	NODE_NAME		0x1
197982527734SSukumar Swaminathan #define	MANUFACTURER		0x2
198082527734SSukumar Swaminathan #define	SERIAL_NUMBER		0x3
198182527734SSukumar Swaminathan #define	MODEL			0x4
198282527734SSukumar Swaminathan #define	MODEL_DESCRIPTION	0x5
198382527734SSukumar Swaminathan #define	HARDWARE_VERSION	0x6
198482527734SSukumar Swaminathan #define	DRIVER_VERSION		0x7
198582527734SSukumar Swaminathan #define	OPTION_ROM_VERSION	0x8
198682527734SSukumar Swaminathan #define	FIRMWARE_VERSION	0x9
198782527734SSukumar Swaminathan #define	VENDOR_SPECIFIC		0xa
198882527734SSukumar Swaminathan #define	DRV_NAME		0xb
198982527734SSukumar Swaminathan #define	OS_NAME_VERSION		0xc
199082527734SSukumar Swaminathan #define	MAX_CT_PAYLOAD_LEN	0xd
1991fcf3ce44SJohn Forte 
199282527734SSukumar Swaminathan /*
199382527734SSukumar Swaminathan  * Port Attrubute Types
199482527734SSukumar Swaminathan  */
199582527734SSukumar Swaminathan #define	SUPPORTED_FC4_TYPES	0x1
199682527734SSukumar Swaminathan #define	SUPPORTED_SPEED		0x2
199782527734SSukumar Swaminathan #define	PORT_SPEED		0x3
199882527734SSukumar Swaminathan #define	MAX_FRAME_SIZE		0x4
199982527734SSukumar Swaminathan #define	OS_DEVICE_NAME		0x5
2000fcf3ce44SJohn Forte 
200182527734SSukumar Swaminathan union AttributesDef
200282527734SSukumar Swaminathan {
200382527734SSukumar Swaminathan 	/* Structure is in Big Endian format */
200482527734SSukumar Swaminathan 	struct
200582527734SSukumar Swaminathan 	{
200682527734SSukumar Swaminathan 		uint32_t	AttrType:16;
200782527734SSukumar Swaminathan 		uint32_t	AttrLen:16;
200882527734SSukumar Swaminathan 	} bits;
200982527734SSukumar Swaminathan 	uint32_t	word;
201082527734SSukumar Swaminathan };
2011fcf3ce44SJohn Forte 
201282527734SSukumar Swaminathan /*
201382527734SSukumar Swaminathan  * HBA Attribute Entry (8 - 260 bytes)
201482527734SSukumar Swaminathan  */
2015291a2b48SSukumar Swaminathan typedef struct
2016291a2b48SSukumar Swaminathan {
201782527734SSukumar Swaminathan 	union AttributesDef	ad;
2018291a2b48SSukumar Swaminathan 	union
2019291a2b48SSukumar Swaminathan 	{
202082527734SSukumar Swaminathan 		uint32_t	VendorSpecific;
202182527734SSukumar Swaminathan 		uint32_t	SupportSpeed;
202282527734SSukumar Swaminathan 		uint32_t	PortSpeed;
202382527734SSukumar Swaminathan 		uint32_t	MaxFrameSize;
202482527734SSukumar Swaminathan 		uint32_t	MaxCTPayloadLen;
202582527734SSukumar Swaminathan 		uint8_t		SupportFC4Types[32];
202682527734SSukumar Swaminathan 		uint8_t		OsDeviceName[256];
202782527734SSukumar Swaminathan 		uint8_t		Manufacturer[64];
202882527734SSukumar Swaminathan 		uint8_t		SerialNumber[64];
202982527734SSukumar Swaminathan 		uint8_t		Model[256];
203082527734SSukumar Swaminathan 		uint8_t		ModelDescription[256];
203182527734SSukumar Swaminathan 		uint8_t		HardwareVersion[256];
203282527734SSukumar Swaminathan 		uint8_t		DriverVersion[256];
203382527734SSukumar Swaminathan 		uint8_t		OptionROMVersion[256];
203482527734SSukumar Swaminathan 		uint8_t		FirmwareVersion[256];
203582527734SSukumar Swaminathan 		uint8_t		DriverName[256];
203682527734SSukumar Swaminathan 		NAME_TYPE	NodeName;
2037fcf3ce44SJohn Forte 	} un;
203882527734SSukumar Swaminathan } ATTRIBUTE_ENTRY, *PATTRIBUTE_ENTRY;
2039fcf3ce44SJohn Forte 
2040fcf3ce44SJohn Forte 
204182527734SSukumar Swaminathan /*
204282527734SSukumar Swaminathan  * HBA Attribute Block
204382527734SSukumar Swaminathan  */
2044291a2b48SSukumar Swaminathan typedef struct
2045291a2b48SSukumar Swaminathan {
204682527734SSukumar Swaminathan 	uint32_t	EntryCnt;	/* Number of HBA attribute entries */
204782527734SSukumar Swaminathan 	ATTRIBUTE_ENTRY	Entry;		/* Variable-length array */
204882527734SSukumar Swaminathan } ATTRIBUTE_BLOCK, *PATTRIBUTE_BLOCK;
2049fcf3ce44SJohn Forte 
2050fcf3ce44SJohn Forte 
2051fcf3ce44SJohn Forte /*
2052fcf3ce44SJohn Forte  * Port Entry
2053fcf3ce44SJohn Forte  */
2054291a2b48SSukumar Swaminathan typedef struct
2055291a2b48SSukumar Swaminathan {
2056291a2b48SSukumar Swaminathan 	NAME_TYPE	PortName;
2057fcf3ce44SJohn Forte } PORT_ENTRY, *PPORT_ENTRY;
2058fcf3ce44SJohn Forte 
2059fcf3ce44SJohn Forte /*
2060fcf3ce44SJohn Forte  * HBA Identifier
2061fcf3ce44SJohn Forte  */
2062291a2b48SSukumar Swaminathan typedef struct
2063291a2b48SSukumar Swaminathan {
2064291a2b48SSukumar Swaminathan 	NAME_TYPE	PortName;
2065fcf3ce44SJohn Forte } HBA_IDENTIFIER, *PHBA_IDENTIFIER;
2066fcf3ce44SJohn Forte 
2067fcf3ce44SJohn Forte /*
2068fcf3ce44SJohn Forte  * Registered Port List Format
2069fcf3ce44SJohn Forte  */
2070291a2b48SSukumar Swaminathan typedef struct
2071291a2b48SSukumar Swaminathan {
2072291a2b48SSukumar Swaminathan 	uint32_t	EntryCnt;
2073291a2b48SSukumar Swaminathan 	PORT_ENTRY	pe;	/* Variable-length array */
2074fcf3ce44SJohn Forte } REG_PORT_LIST, *PREG_PORT_LIST;
2075fcf3ce44SJohn Forte 
2076fcf3ce44SJohn Forte /*
2077fcf3ce44SJohn Forte  * Register HBA(RHBA)
2078fcf3ce44SJohn Forte  */
2079291a2b48SSukumar Swaminathan typedef struct
2080291a2b48SSukumar Swaminathan {
2081291a2b48SSukumar Swaminathan 	HBA_IDENTIFIER	hi;
2082291a2b48SSukumar Swaminathan 	REG_PORT_LIST	rpl;	/* variable-length array */
2083fcf3ce44SJohn Forte } REG_HBA, *PREG_HBA;
2084fcf3ce44SJohn Forte 
2085fcf3ce44SJohn Forte /*
2086fcf3ce44SJohn Forte  * Register HBA Attributes (RHAT)
2087fcf3ce44SJohn Forte  */
2088291a2b48SSukumar Swaminathan typedef struct
2089291a2b48SSukumar Swaminathan {
2090291a2b48SSukumar Swaminathan 	NAME_TYPE	HBA_PortName;
2091291a2b48SSukumar Swaminathan 	ATTRIBUTE_BLOCK	ab;
2092fcf3ce44SJohn Forte } REG_HBA_ATTRIBUTE, *PREG_HBA_ATTRIBUTE;
2093fcf3ce44SJohn Forte 
2094fcf3ce44SJohn Forte /*
2095fcf3ce44SJohn Forte  * Register Port Attributes (RPA)
2096fcf3ce44SJohn Forte  */
2097291a2b48SSukumar Swaminathan typedef struct
2098291a2b48SSukumar Swaminathan {
2099291a2b48SSukumar Swaminathan 	NAME_TYPE	HBA_PortName;
2100291a2b48SSukumar Swaminathan 	NAME_TYPE	PortName;
2101291a2b48SSukumar Swaminathan 	ATTRIBUTE_BLOCK	ab;
2102fcf3ce44SJohn Forte } REG_PORT_ATTRIBUTE, *PREG_PORT_ATTRIBUTE;
2103fcf3ce44SJohn Forte 
2104fcf3ce44SJohn Forte /*
2105fcf3ce44SJohn Forte  * Get Registered HBA List (GRHL) Accept Payload Format
2106fcf3ce44SJohn Forte  */
2107291a2b48SSukumar Swaminathan typedef struct
2108291a2b48SSukumar Swaminathan {
2109291a2b48SSukumar Swaminathan 	uint32_t	HBA__Entry_Cnt;	/* Number of Registered HBA Ids */
2110291a2b48SSukumar Swaminathan 	NAME_TYPE	HBA_PortName;	/* Variable-length array */
2111fcf3ce44SJohn Forte } GRHL_ACC_PAYLOAD, *PGRHL_ACC_PAYLOAD;
2112fcf3ce44SJohn Forte 
2113fcf3ce44SJohn Forte /*
2114fcf3ce44SJohn Forte  * Get Registered Port List (GRPL) Accept Payload Format
2115fcf3ce44SJohn Forte  */
2116291a2b48SSukumar Swaminathan typedef struct
2117291a2b48SSukumar Swaminathan {
2118291a2b48SSukumar Swaminathan 	uint32_t	RPL_Entry_Cnt;		/* No of Reg Port Entries */
2119291a2b48SSukumar Swaminathan 	PORT_ENTRY	eg_Port_Entry[1];	/* Variable-length array */
2120fcf3ce44SJohn Forte } GRPL_ACC_PAYLOAD, *PGRPL_ACC_PAYLOAD;
2121fcf3ce44SJohn Forte 
2122fcf3ce44SJohn Forte /*
2123fcf3ce44SJohn Forte  * Get Port Attributes (GPAT) Accept Payload Format
2124fcf3ce44SJohn Forte  */
2125fcf3ce44SJohn Forte 
2126291a2b48SSukumar Swaminathan typedef struct
2127291a2b48SSukumar Swaminathan {
2128291a2b48SSukumar Swaminathan 	ATTRIBUTE_BLOCK	pab;
2129fcf3ce44SJohn Forte } GPAT_ACC_PAYLOAD, *PGPAT_ACC_PAYLOAD;
2130fcf3ce44SJohn Forte 
2131fcf3ce44SJohn Forte /*
2132fcf3ce44SJohn Forte  * Use for Firmware DownLoad
2133fcf3ce44SJohn Forte  */
2134fcf3ce44SJohn Forte 
2135291a2b48SSukumar Swaminathan /* download.h */
2136291a2b48SSukumar Swaminathan 
2137291a2b48SSukumar Swaminathan #define	REDUCED_SRAM_CFG	0x7FFFC	/* 9802DC */
2138291a2b48SSukumar Swaminathan #define	FULL_SRAM_CFG		0x13FFFC	/* 9802   */
2139291a2b48SSukumar Swaminathan 
2140291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_SHIFT(x) ((x << 20))
2141291a2b48SSukumar Swaminathan #define	SLI_FW_ADAPTER_TYPE_MASK   0x00f00000
2142291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_6000  SLI_FW_TYPE_SHIFT(0)
2143291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_7000  SLI_FW_TYPE_SHIFT(1)
2144291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_8000  SLI_FW_TYPE_SHIFT(2)
2145291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_850   SLI_FW_TYPE_SHIFT(3)
2146291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_9000  SLI_FW_TYPE_SHIFT(4)
2147291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_950   SLI_FW_TYPE_SHIFT(5)
2148291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_9802  SLI_FW_TYPE_SHIFT(6)	/* [022702] */
2149291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_982   SLI_FW_TYPE_SHIFT(7)
2150291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_10000 SLI_FW_TYPE_SHIFT(8)
2151291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_1050  SLI_FW_TYPE_SHIFT(9)
2152291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_X1000 SLI_FW_TYPE_SHIFT(0xa)
2153291a2b48SSukumar Swaminathan #define	SLI_FW_TYPE_101   SLI_FW_TYPE_SHIFT(0xb)	/* LP101 */
2154291a2b48SSukumar Swaminathan 
2155291a2b48SSukumar Swaminathan 
21567e95e8d9SToomas Soome typedef enum emlxs_prog_type
2157291a2b48SSukumar Swaminathan {
2158fcf3ce44SJohn Forte 	TEST_PROGRAM,	/* 0 */
2159fcf3ce44SJohn Forte 	UTIL_PROGRAM,	/* 1 */
2160fcf3ce44SJohn Forte 	FUNC_FIRMWARE,	/* 2 */
2161fcf3ce44SJohn Forte 	BOOT_BIOS,	/* 3 */
2162fcf3ce44SJohn Forte 	CONFIG_DATA,	/* 4 */
2163fcf3ce44SJohn Forte 	SEQUENCER_CODE,	/* 5 */
2164fcf3ce44SJohn Forte 	SLI1_OVERLAY,	/* 6 */
2165fcf3ce44SJohn Forte 	SLI2_OVERLAY,	/* 7 */
216682527734SSukumar Swaminathan 	GASKET,		/* 8 */
2167fcf3ce44SJohn Forte 	HARDWARE_IMAGE,	/* 9 */
2168fcf3ce44SJohn Forte 	SBUS_FCODE,	/* A */
2169fcf3ce44SJohn Forte 	SLI3_OVERLAY,	/* B */
2170fcf3ce44SJohn Forte 	RESERVED_C,
2171fcf3ce44SJohn Forte 	RESERVED_D,
2172fcf3ce44SJohn Forte 	SLI4_OVERLAY,	/* E */
2173fcf3ce44SJohn Forte 	KERNEL_CODE,	/* F */
2174fcf3ce44SJohn Forte 	MAX_PROG_TYPES
2175fcf3ce44SJohn Forte } emlxs_prog_type_t;
2176fcf3ce44SJohn Forte 
2177fcf3ce44SJohn Forte 
2178291a2b48SSukumar Swaminathan typedef struct emlxs_fw_file
2179291a2b48SSukumar Swaminathan {
2180291a2b48SSukumar Swaminathan 	uint32_t	version;
2181291a2b48SSukumar Swaminathan 	uint32_t	revcomp;
2182291a2b48SSukumar Swaminathan 	char		label[16];
2183291a2b48SSukumar Swaminathan 	uint32_t	offset;
2184fcf3ce44SJohn Forte } emlxs_fw_file_t;
2185fcf3ce44SJohn Forte 
2186291a2b48SSukumar Swaminathan typedef struct emlxs_fw_image
2187291a2b48SSukumar Swaminathan {
2188fcf3ce44SJohn Forte 	emlxs_fw_file_t awc;
2189fcf3ce44SJohn Forte 	emlxs_fw_file_t bwc;
2190fcf3ce44SJohn Forte 	emlxs_fw_file_t dwc;
2191fcf3ce44SJohn Forte 	emlxs_fw_file_t prog[MAX_PROG_TYPES];
2192fcf3ce44SJohn Forte } emlxs_fw_image_t;
2193fcf3ce44SJohn Forte 
2194fcf3ce44SJohn Forte 
2195fcf3ce44SJohn Forte 
2196291a2b48SSukumar Swaminathan #define	NOP_IMAGE_TYPE		0xe1a00000
2197fcf3ce44SJohn Forte 
2198291a2b48SSukumar Swaminathan #define	FLASH_BASE_ADR		0x01400000
2199291a2b48SSukumar Swaminathan #define	DL_FROM_SLIM_OFFSET	MBOX_EXTENSION_OFFSET
2200fcf3ce44SJohn Forte 
2201fcf3ce44SJohn Forte #ifdef MBOX_EXT_SUPPORT
2202291a2b48SSukumar Swaminathan #define	DL_SLIM_SEG_BYTE_COUNT	MBOX_EXTENSION_SIZE
2203fcf3ce44SJohn Forte #else
2204291a2b48SSukumar Swaminathan #define	DL_SLIM_SEG_BYTE_COUNT	128
2205291a2b48SSukumar Swaminathan #endif /* MBOX_EXT_SUPPORT */
2206291a2b48SSukumar Swaminathan 
2207291a2b48SSukumar Swaminathan #define	SLI_CKSUM_LENGTH	4
2208291a2b48SSukumar Swaminathan #define	SLI_CKSUM_SEED		0x55555555
2209291a2b48SSukumar Swaminathan #define	SLI_CKSUM_ERR		0x1982abcd
2210291a2b48SSukumar Swaminathan 
2211291a2b48SSukumar Swaminathan #define	AIF_NOOP		0xe1a00000
2212291a2b48SSukumar Swaminathan #define	AIF_BLAL		0xeb000000
2213291a2b48SSukumar Swaminathan #define	OS_EXIT			0xef000011
2214291a2b48SSukumar Swaminathan #define	OS_GETENV		0xef000010
2215291a2b48SSukumar Swaminathan #define	AIF_IMAGEBASE		0x00008000
2216291a2b48SSukumar Swaminathan #define	AIF_BLZINIT		0xeb00000c
2217291a2b48SSukumar Swaminathan #define	DEBUG_TASK		0xef041d41
2218291a2b48SSukumar Swaminathan #define	AIF_DBG_SRC		2
2219291a2b48SSukumar Swaminathan #define	AIF_DBG_LL		1
2220291a2b48SSukumar Swaminathan #define	AIF_DATABASAT		0x100
2221291a2b48SSukumar Swaminathan 
2222291a2b48SSukumar Swaminathan #define	JEDEC_ID_ADDRESS	0x0080001c
2223291a2b48SSukumar Swaminathan #define	MAX_RBUS_SRAM_SIZE_ADR	0x788
2224291a2b48SSukumar Swaminathan #define	MAX_IBUS_SRAM_SIZE_ADR	0x78c
2225291a2b48SSukumar Swaminathan #define	FULL_RBUS_SRAM_CFG	0x7fffc
2226291a2b48SSukumar Swaminathan #define	FULL_IBUS_SRAM_CFG	0x187fffc
2227291a2b48SSukumar Swaminathan #define	REDUCED_RBUS_SRAM_CFG	0x5fffc
2228291a2b48SSukumar Swaminathan #define	REDUCED_IBUS_SRAM_CFG	0x183fffc
2229291a2b48SSukumar Swaminathan 
2230291a2b48SSukumar Swaminathan #define	FULL_SRAM_CFG_PROG_ID		1
2231291a2b48SSukumar Swaminathan #define	REDUCED_SRAM_CFG_PROG_ID	2
2232291a2b48SSukumar Swaminathan #define	OTHER_SRAM_CFG_PROG_ID		3
2233291a2b48SSukumar Swaminathan 
2234291a2b48SSukumar Swaminathan #define	NO_FLASH_MEM_AVAIL	0xf1
2235291a2b48SSukumar Swaminathan 
2236291a2b48SSukumar Swaminathan #define	PROG_TYPE_MASK		0xff000000
2237291a2b48SSukumar Swaminathan #define	PROG_TYPE_SHIFT		24
2238291a2b48SSukumar Swaminathan 
2239291a2b48SSukumar Swaminathan #define	FLASH_LOAD_LIST_ADR	0x79c
2240291a2b48SSukumar Swaminathan #define	RAM_LOAD_ENTRY_SIZE	9
2241291a2b48SSukumar Swaminathan #define	FLASH_LOAD_ENTRY_SIZE	6
2242291a2b48SSukumar Swaminathan #define	RAM_LOAD_ENTRY_TYPE	0
2243291a2b48SSukumar Swaminathan #define	FLASH_LOAD_ENTRY_TYPE	1
2244291a2b48SSukumar Swaminathan 
2245291a2b48SSukumar Swaminathan #define	CFG_DATA_NO_REGION	-3
2246291a2b48SSukumar Swaminathan 
2247291a2b48SSukumar Swaminathan #define	SLI_IMAGE_START		0x20080
2248291a2b48SSukumar Swaminathan #define	SLI_VERSION_LOC		0x270
2249fcf3ce44SJohn Forte 
2250fcf3ce44SJohn Forte 
2251291a2b48SSukumar Swaminathan #define	SLI_HW_REVISION_CHECK(x, y)	((x & 0xf0) == y)
2252291a2b48SSukumar Swaminathan #define	SLI_FCODE_REVISION_CHECK(x, y)	(x == y)
2253fcf3ce44SJohn Forte 
2254fcf3ce44SJohn Forte 
22558f23e9faSHans Rosenfeld /* ************ OBJ firmware ************** */
22568f23e9faSHans Rosenfeld #define	OBJ_MAX_XFER_SIZE	32768
22578f23e9faSHans Rosenfeld 
22588f23e9faSHans Rosenfeld 
2259a9800bebSGarrett D'Amore /* ************ BladeEngine ************** */
2260a9800bebSGarrett D'Amore #define	BE_SIGNATURE		"ServerEngines"
226182527734SSukumar Swaminathan #define	BE_DIR_SIGNATURE	"*** SE FLAS"
2262a9800bebSGarrett D'Amore #define	BE_BUILD_SIZE		24
226382527734SSukumar Swaminathan #define	BE_VERSION_SIZE		32
226482527734SSukumar Swaminathan #define	BE_COOKIE_SIZE		32
226582527734SSukumar Swaminathan #define	BE_CONTROLLER_SIZE	8
226682527734SSukumar Swaminathan #define	BE_FLASH_ENTRIES	32
226782527734SSukumar Swaminathan #define	BE_MAX_XFER_SIZE	32768 /* 4K aligned */
226882527734SSukumar Swaminathan 
2269a9800bebSGarrett D'Amore /* ************** BE3 **************** */
2270a9800bebSGarrett D'Amore #define	BE3_SIGNATURE_SIZE	52
2271a9800bebSGarrett D'Amore #define	BE3_MAX_IMAGE_HEADERS	32
2272a9800bebSGarrett D'Amore 
2273a9800bebSGarrett D'Amore typedef struct emlxs_be3_image_header
2274a9800bebSGarrett D'Amore {
2275a9800bebSGarrett D'Amore 	uint32_t id;
2276a9800bebSGarrett D'Amore #define	UFI_BE3_FLASH_ID	0x01
2277a9800bebSGarrett D'Amore 
2278a9800bebSGarrett D'Amore 	uint32_t offset;
2279a9800bebSGarrett D'Amore 	uint32_t length;
2280a9800bebSGarrett D'Amore 	uint32_t checksum;
2281a9800bebSGarrett D'Amore 	uint8_t version[BE_VERSION_SIZE];
2282a9800bebSGarrett D'Amore 
2283a9800bebSGarrett D'Amore } emlxs_be3_image_header_t;
2284a9800bebSGarrett D'Amore 
2285a9800bebSGarrett D'Amore typedef struct emlxs_be3_ufi_header
2286a9800bebSGarrett D'Amore {
2287a9800bebSGarrett D'Amore 	char signature[BE3_SIGNATURE_SIZE];
2288a9800bebSGarrett D'Amore 	uint32_t ufi_version;
2289a9800bebSGarrett D'Amore 	uint32_t file_length;
2290a9800bebSGarrett D'Amore 	uint32_t checksum;
2291a9800bebSGarrett D'Amore 	uint32_t antidote;
2292a9800bebSGarrett D'Amore 	uint32_t image_cnt;
2293a9800bebSGarrett D'Amore 	char build[BE_BUILD_SIZE];
2294a9800bebSGarrett D'Amore 	uint8_t resv1[32];
2295a9800bebSGarrett D'Amore 
2296a9800bebSGarrett D'Amore } emlxs_be3_ufi_header_t;
2297a9800bebSGarrett D'Amore 
2298a9800bebSGarrett D'Amore typedef struct emlxs_be3_ufi_controller
229982527734SSukumar Swaminathan {
230082527734SSukumar Swaminathan 	uint32_t vendor_id;
230182527734SSukumar Swaminathan 	uint32_t device_id;
230282527734SSukumar Swaminathan 	uint32_t sub_vendor_id;
230382527734SSukumar Swaminathan 	uint32_t sub_device_id;
230482527734SSukumar Swaminathan 
2305a9800bebSGarrett D'Amore } emlxs_be3_ufi_controller_t;
230682527734SSukumar Swaminathan 
2307a9800bebSGarrett D'Amore typedef struct emlxs_be3_flash_header
230882527734SSukumar Swaminathan {
2309a9800bebSGarrett D'Amore 	uint32_t format_rev;
231082527734SSukumar Swaminathan 	uint32_t checksum;
231182527734SSukumar Swaminathan 	uint32_t antidote;
2312a9800bebSGarrett D'Amore 	uint32_t entry_count;
2313a9800bebSGarrett D'Amore 	emlxs_be3_ufi_controller_t controller[BE_CONTROLLER_SIZE];
2314a9800bebSGarrett D'Amore 	uint32_t resv0;
2315a9800bebSGarrett D'Amore 	uint32_t resv1;
2316a9800bebSGarrett D'Amore 	uint32_t resv2;
2317a9800bebSGarrett D'Amore 	uint32_t resv3;
2318a9800bebSGarrett D'Amore } emlxs_be3_flash_header_t;
2319a9800bebSGarrett D'Amore 
2320a9800bebSGarrett D'Amore typedef struct emlxs_be3_flash_entry
2321a9800bebSGarrett D'Amore {
2322a9800bebSGarrett D'Amore 	uint32_t type;
2323a9800bebSGarrett D'Amore 	uint32_t offset;
2324a9800bebSGarrett D'Amore 	uint32_t block_size;
2325a9800bebSGarrett D'Amore 	uint32_t image_size;
2326a9800bebSGarrett D'Amore 	uint32_t checksum;
2327a9800bebSGarrett D'Amore 	uint32_t entry_point;
2328a9800bebSGarrett D'Amore 	uint32_t resv0;
2329a9800bebSGarrett D'Amore 	uint32_t resv1;
2330a9800bebSGarrett D'Amore 	char version[BE_VERSION_SIZE];
2331a9800bebSGarrett D'Amore 
2332a9800bebSGarrett D'Amore } emlxs_be3_flash_entry_t;
2333a9800bebSGarrett D'Amore 
2334a9800bebSGarrett D'Amore typedef struct emlxs_be3_flash_dir
2335a9800bebSGarrett D'Amore {
2336a9800bebSGarrett D'Amore 	char cookie[BE_COOKIE_SIZE];
2337a9800bebSGarrett D'Amore 	emlxs_be3_flash_header_t header;
2338a9800bebSGarrett D'Amore 	emlxs_be3_flash_entry_t entry[BE_FLASH_ENTRIES];
2339a9800bebSGarrett D'Amore 
2340a9800bebSGarrett D'Amore } emlxs_be3_flash_dir_t;
2341a9800bebSGarrett D'Amore 
2342a9800bebSGarrett D'Amore typedef struct emlxs_be3_ncsi_header {
2343a9800bebSGarrett D'Amore 	uint32_t magic;
2344a9800bebSGarrett D'Amore 	uint8_t hdr_len;
2345a9800bebSGarrett D'Amore 	uint8_t type;
2346a9800bebSGarrett D'Amore 	uint16_t hdr_ver;
2347a9800bebSGarrett D'Amore 	uint16_t rsvd0;
2348a9800bebSGarrett D'Amore 	uint16_t load_offset;
2349a9800bebSGarrett D'Amore 	uint32_t len;
2350a9800bebSGarrett D'Amore 	uint32_t flash_offset;
2351a9800bebSGarrett D'Amore 	uint8_t ver[16];
2352a9800bebSGarrett D'Amore 	uint8_t name[24];
2353a9800bebSGarrett D'Amore 	uint32_t img_cksum;
2354a9800bebSGarrett D'Amore 	uint32_t rsvd1;
2355a9800bebSGarrett D'Amore 	uint32_t hdr_cksum;
2356a9800bebSGarrett D'Amore } emlxs_be3_ncsi_header_t;
2357a9800bebSGarrett D'Amore 
2358a9800bebSGarrett D'Amore 
2359a9800bebSGarrett D'Amore /* ************** BE2 **************** */
2360a9800bebSGarrett D'Amore #define	BE2_SIGNATURE_SIZE	32
2361a9800bebSGarrett D'Amore 
2362a9800bebSGarrett D'Amore 
2363a9800bebSGarrett D'Amore typedef struct emlxs_be2_ufi_controller
2364a9800bebSGarrett D'Amore {
2365a9800bebSGarrett D'Amore 	uint32_t vendor_id;
2366a9800bebSGarrett D'Amore 	uint32_t device_id;
2367a9800bebSGarrett D'Amore 	uint32_t sub_vendor_id;
2368a9800bebSGarrett D'Amore 	uint32_t sub_device_id;
2369a9800bebSGarrett D'Amore 
2370a9800bebSGarrett D'Amore } emlxs_be2_ufi_controller_t;
2371a9800bebSGarrett D'Amore 
2372a9800bebSGarrett D'Amore typedef struct emlxs_be2_ufi_header
2373a9800bebSGarrett D'Amore {
2374a9800bebSGarrett D'Amore 	char signature[BE2_SIGNATURE_SIZE];
2375a9800bebSGarrett D'Amore 	uint32_t checksum;
2376a9800bebSGarrett D'Amore 	uint32_t antidote;
2377a9800bebSGarrett D'Amore 	emlxs_be2_ufi_controller_t  controller;
237882527734SSukumar Swaminathan 	uint32_t file_length;
237982527734SSukumar Swaminathan 	uint32_t chunk_num;
238082527734SSukumar Swaminathan 	uint32_t chunk_cnt;
238182527734SSukumar Swaminathan 	uint32_t image_cnt;
238282527734SSukumar Swaminathan 	char build[BE_BUILD_SIZE];
238382527734SSukumar Swaminathan 
2384a9800bebSGarrett D'Amore } emlxs_be2_ufi_header_t;
238582527734SSukumar Swaminathan 
2386a9800bebSGarrett D'Amore typedef struct emlxs_be2_flash_header /* 96 bytes */
238782527734SSukumar Swaminathan {
238882527734SSukumar Swaminathan 	uint32_t format_rev;
238982527734SSukumar Swaminathan 	uint32_t checksum;
239082527734SSukumar Swaminathan 	uint32_t antidote;
239182527734SSukumar Swaminathan 	uint32_t build_num;
2392a9800bebSGarrett D'Amore 	emlxs_be2_ufi_controller_t controller[BE_CONTROLLER_SIZE];
239382527734SSukumar Swaminathan 	uint32_t active_entry_mask;
239482527734SSukumar Swaminathan 	uint32_t valid_entry_mask;
239582527734SSukumar Swaminathan 	uint32_t orig_content_mask;
239682527734SSukumar Swaminathan 	uint32_t resv0;
239782527734SSukumar Swaminathan 	uint32_t resv1;
239882527734SSukumar Swaminathan 	uint32_t resv2;
239982527734SSukumar Swaminathan 	uint32_t resv3;
240082527734SSukumar Swaminathan 	uint32_t resv4;
240182527734SSukumar Swaminathan 
2402a9800bebSGarrett D'Amore } emlxs_be2_flash_header_t;
240382527734SSukumar Swaminathan 
2404a9800bebSGarrett D'Amore typedef struct emlxs_be2_flash_entry
240582527734SSukumar Swaminathan {
240682527734SSukumar Swaminathan 	uint32_t type;
240782527734SSukumar Swaminathan 	uint32_t offset;
240882527734SSukumar Swaminathan 	uint32_t pad_size;
240982527734SSukumar Swaminathan 	uint32_t image_size;
241082527734SSukumar Swaminathan 	uint32_t checksum;
241182527734SSukumar Swaminathan 	uint32_t entry_point;
241282527734SSukumar Swaminathan 	uint32_t resv0;
241382527734SSukumar Swaminathan 	uint32_t resv1;
241482527734SSukumar Swaminathan 	char version[BE_VERSION_SIZE];
241582527734SSukumar Swaminathan 
2416a9800bebSGarrett D'Amore } emlxs_be2_flash_entry_t;
241782527734SSukumar Swaminathan 
2418a9800bebSGarrett D'Amore typedef struct emlxs_be2_flash_dir
241982527734SSukumar Swaminathan {
242082527734SSukumar Swaminathan 	char cookie[BE_COOKIE_SIZE];
2421a9800bebSGarrett D'Amore 	emlxs_be2_flash_header_t header;
2422a9800bebSGarrett D'Amore 	emlxs_be2_flash_entry_t entry[BE_FLASH_ENTRIES];
242382527734SSukumar Swaminathan 
2424a9800bebSGarrett D'Amore } emlxs_be2_flash_dir_t;
242582527734SSukumar Swaminathan 
242682527734SSukumar Swaminathan 
242782527734SSukumar Swaminathan /* FLASH ENTRY TYPES */
24288f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_NCSI_FIRMWARE		0x10 /* BE3 */
24298f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_PXE_BIOS			0x20
24308f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_BIOS			0x21
24318f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_BIOS			0x22
24328f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FLASH_ISM			0x30 /* BE3 */
24338f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_FIRMWARE		0xA0
24348f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_FIRMWARE_COMP	0xA1
24358f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_FIRMWARE		0xA2
24368f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_FIRMWARE_COMP		0xA3
24378f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_BACKUP		0xB0
24388f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_ISCSI_BACKUP_COMP		0xB1
24398f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_BACKUP		0xB2
24408f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_FCOE_BACKUP_COMP		0xB3
24418f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_PHY_FIRMWARE		0xC0 /* 10Base-T */
24428f23e9faSHans Rosenfeld #define	BE_FLASHTYPE_REDBOOT			0xE0
244382527734SSukumar Swaminathan 
244482527734SSukumar Swaminathan /* Flash types in download order */
244582527734SSukumar Swaminathan typedef enum emlxs_be_flashtypes
244682527734SSukumar Swaminathan {
24478f23e9faSHans Rosenfeld 	PHY_FIRMWARE_FLASHTYPE,
2448a9800bebSGarrett D'Amore 	NCSI_FIRMWARE_FLASHTYPE,
244982527734SSukumar Swaminathan 	ISCSI_FIRMWARE_FLASHTYPE,
245082527734SSukumar Swaminathan 	ISCSI_BACKUP_FLASHTYPE,
245182527734SSukumar Swaminathan 	FCOE_FIRMWARE_FLASHTYPE,
245282527734SSukumar Swaminathan 	FCOE_BACKUP_FLASHTYPE,
245382527734SSukumar Swaminathan 	ISCSI_BIOS_FLASHTYPE,
245482527734SSukumar Swaminathan 	FCOE_BIOS_FLASHTYPE,
245582527734SSukumar Swaminathan 	PXE_BIOS_FLASHTYPE,
245682527734SSukumar Swaminathan 	REDBOOT_FLASHTYPE,
245782527734SSukumar Swaminathan 	BE_MAX_FLASHTYPES
245882527734SSukumar Swaminathan 
245982527734SSukumar Swaminathan } emlxs_be_flashtypes_t;
246082527734SSukumar Swaminathan 
246182527734SSukumar Swaminathan /* Driver level constructs */
246282527734SSukumar Swaminathan typedef struct emlxs_be_fw_file
246382527734SSukumar Swaminathan {
2464*e2d1a434SCarsten Grzemba 	uint32_t	be_version;
2465a9800bebSGarrett D'Amore 	uint32_t	ufi_plus;
2466a9800bebSGarrett D'Amore 
246782527734SSukumar Swaminathan 	uint32_t	type;
246882527734SSukumar Swaminathan 	uint32_t	image_offset;
246982527734SSukumar Swaminathan 	uint32_t	image_size;
247082527734SSukumar Swaminathan 	uint32_t	block_size;
247182527734SSukumar Swaminathan 	uint32_t	block_crc;
2472a9800bebSGarrett D'Amore 	uint32_t	load_address; /* BE3 */
247382527734SSukumar Swaminathan 	char		label[BE_VERSION_SIZE];
247482527734SSukumar Swaminathan } emlxs_be_fw_file_t;
247582527734SSukumar Swaminathan 
247682527734SSukumar Swaminathan typedef struct emlxs_be_fw_image
247782527734SSukumar Swaminathan {
2478*e2d1a434SCarsten Grzemba 	uint32_t	be_version;
2479a9800bebSGarrett D'Amore 	uint32_t	ufi_plus;
2480a9800bebSGarrett D'Amore 
2481a9800bebSGarrett D'Amore 	uint32_t fcoe_version;
2482a9800bebSGarrett D'Amore 	char fcoe_label[BE_VERSION_SIZE];
2483a9800bebSGarrett D'Amore 
2484a9800bebSGarrett D'Amore 	uint32_t iscsi_version;
2485a9800bebSGarrett D'Amore 	char iscsi_label[BE_VERSION_SIZE];
248682527734SSukumar Swaminathan 
248782527734SSukumar Swaminathan 	emlxs_be_fw_file_t file[BE_MAX_FLASHTYPES];
248882527734SSukumar Swaminathan } emlxs_be_fw_image_t;
248982527734SSukumar Swaminathan 
24908f23e9faSHans Rosenfeld 
24918f23e9faSHans Rosenfeld typedef struct emlxs_obj_header
24928f23e9faSHans Rosenfeld {
2493*e2d1a434SCarsten Grzemba 	uint32_t	FileSize;
24948f23e9faSHans Rosenfeld 
24958f23e9faSHans Rosenfeld #ifdef EMLXS_BIG_ENDIAN
2496*e2d1a434SCarsten Grzemba 	uint16_t	MagicNumHi;
2497*e2d1a434SCarsten Grzemba 	uint16_t	MagicNumLo;
24988f23e9faSHans Rosenfeld 
2499*e2d1a434SCarsten Grzemba 	uint32_t	FileType:8;
2500*e2d1a434SCarsten Grzemba 	uint32_t	Id:8;
2501*e2d1a434SCarsten Grzemba 	uint32_t	rsvd0:16;
25028f23e9faSHans Rosenfeld #endif
25038f23e9faSHans Rosenfeld 
25048f23e9faSHans Rosenfeld #ifdef EMLXS_LITTLE_ENDIAN
2505*e2d1a434SCarsten Grzemba 	uint16_t	MagicNumLo;
2506*e2d1a434SCarsten Grzemba 	uint16_t	MagicNumHi;
25078f23e9faSHans Rosenfeld 
2508*e2d1a434SCarsten Grzemba 	uint32_t	rsvd0:16;
2509*e2d1a434SCarsten Grzemba 	uint32_t	Id:8;
2510*e2d1a434SCarsten Grzemba 	uint32_t	FileType:8;
25118f23e9faSHans Rosenfeld #endif
25128f23e9faSHans Rosenfeld 
25138f23e9faSHans Rosenfeld #define	OBJ_MAGIC_NUM_HI		0xFEAA
25148f23e9faSHans Rosenfeld #define	OBJ_MAGIC_NUM_LO		0x0001
2515*e2d1a434SCarsten Grzemba #define	OBJ_MAGIC_NUM_LO_G6		0x0003
2516*e2d1a434SCarsten Grzemba #define	OBJ_MAGIC_NUM_LO_G7		0x0005
2517*e2d1a434SCarsten Grzemba #define	OBJ_MAGIC_NUM_LO_G7P		0x0020
25188f23e9faSHans Rosenfeld 
25198f23e9faSHans Rosenfeld #define	OBJ_GRP_FILE_TYPE		0xF7
25208f23e9faSHans Rosenfeld 
25218f23e9faSHans Rosenfeld #define	OBJ_LANCER_ID			0xA2
25228f23e9faSHans Rosenfeld 
25238f23e9faSHans Rosenfeld 	char		RevName[128];
25248f23e9faSHans Rosenfeld 	char		Date[12];
25258f23e9faSHans Rosenfeld 	char		Revision[32];
25268f23e9faSHans Rosenfeld } emlxs_obj_header_t;
25278f23e9faSHans Rosenfeld 
25288f23e9faSHans Rosenfeld 
2529fcf3ce44SJohn Forte #ifdef	__cplusplus
2530fcf3ce44SJohn Forte }
2531fcf3ce44SJohn Forte #endif
2532fcf3ce44SJohn Forte 
2533fcf3ce44SJohn Forte #endif	/* _EMLXS_HW_H */
2534