1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Emulex.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _EMLXS_MBOX_H
28 #define	_EMLXS_MBOX_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /* SLI 2/3 Mailbox defines */
35 
36 #define	MBOX_SIZE			256
37 #define	MBOX_EXTENSION_OFFSET		MBOX_SIZE
38 
39 #ifdef MBOX_EXT_SUPPORT
40 #define	MBOX_EXTENSION_SIZE		1024
41 #else
42 #define	MBOX_EXTENSION_SIZE		0
43 #endif /* MBOX_EXT_SUPPORT */
44 
45 
46 
47 /* ==== Mailbox Commands ==== */
48 #define	MBX_SHUTDOWN			0x00	/* terminate testing */
49 #define	MBX_LOAD_SM			0x01
50 #define	MBX_READ_NV			0x02
51 #define	MBX_WRITE_NV			0x03
52 #define	MBX_RUN_BIU_DIAG		0x04
53 #define	MBX_INIT_LINK			0x05
54 #define	MBX_DOWN_LINK			0x06
55 #define	MBX_CONFIG_LINK			0x07
56 #define	MBX_PART_SLIM			0x08
57 #define	MBX_CONFIG_RING			0x09
58 #define	MBX_RESET_RING			0x0A
59 #define	MBX_READ_CONFIG			0x0B
60 #define	MBX_READ_RCONFIG		0x0C
61 #define	MBX_READ_SPARM			0x0D
62 #define	MBX_READ_STATUS			0x0E
63 #define	MBX_READ_RPI			0x0F
64 #define	MBX_READ_XRI			0x10
65 #define	MBX_READ_REV			0x11
66 #define	MBX_READ_LNK_STAT		0x12
67 #define	MBX_REG_LOGIN			0x13
68 #define	MBX_UNREG_LOGIN			0x14  /* SLI2/3 */
69 #define	MBX_UNREG_RPI			0x14  /* SLI4 */
70 #define	MBX_READ_LA			0x15
71 #define	MBX_CLEAR_LA			0x16
72 #define	MBX_DUMP_MEMORY			0x17
73 #define	MBX_DUMP_CONTEXT		0x18
74 #define	MBX_RUN_DIAGS			0x19
75 #define	MBX_RESTART			0x1A
76 #define	MBX_UPDATE_CFG			0x1B
77 #define	MBX_DOWN_LOAD			0x1C
78 #define	MBX_DEL_LD_ENTRY		0x1D
79 #define	MBX_RUN_PROGRAM			0x1E
80 #define	MBX_SET_MASK			0x20
81 #define	MBX_SET_VARIABLE		0x21
82 #define	MBX_UNREG_D_ID			0x23
83 #define	MBX_KILL_BOARD			0x24
84 #define	MBX_CONFIG_FARP			0x25
85 #define	MBX_BEACON			0x2A
86 #define	MBX_READ_VPI			0x2B
87 #define	MBX_CONFIG_MSIX			0x30
88 #define	MBX_HEARTBEAT			0x31
89 #define	MBX_WRITE_VPARMS		0x32
90 #define	MBX_ASYNC_EVENT			0x33
91 
92 #define	MBX_READ_EVENT_LOG_STATUS	0x37
93 #define	MBX_READ_EVENT_LOG		0x38
94 #define	MBX_WRITE_EVENT_LOG		0x39
95 #define	MBX_NV_LOG			0x3A
96 #define	MBX_PORT_CAPABILITIES		0x3B
97 #define	MBX_IOV_CONTROL			0x3C
98 #define	MBX_IOV_MBX			0x3D
99 
100 
101 #define	MBX_CONFIG_HBQ			0x7C  /* SLI3 */
102 #define	MBX_LOAD_AREA			0x81
103 #define	MBX_RUN_BIU_DIAG64		0x84
104 #define	MBX_GET_DEBUG			0x86
105 #define	MBX_CONFIG_PORT			0x88
106 #define	MBX_READ_SPARM64		0x8D
107 #define	MBX_READ_RPI64			0x8F
108 #define	MBX_CONFIG_MSI			0x90
109 #define	MBX_REG_LOGIN64			0x93  /* SLI2/3 */
110 #define	MBX_REG_RPI			0x93  /* SLI4 */
111 #define	MBX_READ_LA64			0x95
112 #define	MBX_REG_VPI			0x96	/* NPIV */
113 #define	MBX_UNREG_VPI			0x97	/* NPIV */
114 #define	MBX_FLASH_WR_ULA		0x98
115 #define	MBX_SET_DEBUG			0x99
116 #define	MBX_SLI_CONFIG			0x9B
117 #define	MBX_LOAD_EXP_ROM		0x9C
118 #define	MBX_REQUEST_FEATURES		0x9D
119 #define	MBX_RESUME_RPI			0x9E
120 #define	MBX_REG_VFI			0x9F
121 #define	MBX_REG_FCFI			0xA0
122 #define	MBX_UNREG_VFI			0xA1
123 #define	MBX_UNREG_FCFI			0xA2
124 #define	MBX_INIT_VFI			0xA3
125 #define	MBX_INIT_VPI			0xA4
126 #define	MBX_ACCESS_VDATA		0xA5
127 #define	MBX_MAX_CMDS			0xA6
128 
129 
130 /*
131  * Define Status
132  */
133 #define	MBX_SUCCESS			0x0
134 #define	MBX_FAILURE			0x1
135 #define	MBXERR_NUM_IOCBS		0x2
136 #define	MBXERR_IOCBS_EXCEEDED		0x3
137 #define	MBXERR_BAD_RING_NUMBER		0x4
138 #define	MBXERR_MASK_ENTRIES_RANGE	0x5
139 #define	MBXERR_MASKS_EXCEEDED		0x6
140 #define	MBXERR_BAD_PROFILE		0x7
141 #define	MBXERR_BAD_DEF_CLASS		0x8
142 #define	MBXERR_BAD_MAX_RESPONDER	0x9
143 #define	MBXERR_BAD_MAX_ORIGINATOR	0xA
144 #define	MBXERR_RPI_REGISTERED		0xB
145 #define	MBXERR_RPI_FULL			0xC
146 #define	MBXERR_NO_RESOURCES		0xD
147 #define	MBXERR_BAD_RCV_LENGTH		0xE
148 #define	MBXERR_DMA_ERROR		0xF
149 #define	MBXERR_NOT_SUPPORTED		0x10
150 #define	MBXERR_UNSUPPORTED_FEATURE	0x11
151 #define	MBXERR_UNKNOWN_COMMAND		0x12
152 
153 /* Driver special codes */
154 #define	MBX_DRIVER_RESERVED		0xF9 /* Set to lowest drv status */
155 #define	MBX_NONEMBED_ERROR		0xF9
156 #define	MBX_OVERTEMP_ERROR		0xFA
157 #define	MBX_HARDWARE_ERROR		0xFB
158 #define	MBX_DRVR_ERROR			0xFC
159 #define	MBX_BUSY			0xFD
160 #define	MBX_TIMEOUT			0xFE
161 #define	MBX_NOT_FINISHED		0xFF
162 
163 /*
164  * flags for EMLXS_SLI_ISSUE_MBOX_CMD()
165  */
166 #define	MBX_POLL	0x01	/* poll mailbox till command done, */
167 				/* then return */
168 #define	MBX_SLEEP	0x02	/* sleep till mailbox intr cmpl */
169 				/* wakes thread up */
170 #define	MBX_WAIT	0x03	/* wait for comand done, then return */
171 #define	MBX_NOWAIT	0x04	/* issue command then return immediately */
172 #define	MBX_BOOTSTRAP	0x80	/* issue a command on the bootstrap mbox */
173 
174 
175 
176 /*
177  * Begin Structure Definitions for Mailbox Commands
178  */
179 
180 typedef struct revcompat
181 {
182 #ifdef EMLXS_BIG_ENDIAN
183 	uint32_t	ldflag:1;	/* Set in SRAM descriptor */
184 	uint32_t	ldcount:7;	/* For use by program load */
185 	uint32_t	kernel:4;	/* Kernel ID */
186 	uint32_t	kver:4;	/* Kernel compatibility version */
187 	uint32_t	SMver:4;	/* Sequence Manager version */
188 					/* 0 if none */
189 	uint32_t	ENDECver:4;	/* ENDEC+ version, 0 if none */
190 	uint32_t	BIUtype:4;	/* PCI = 0 */
191 	uint32_t	BIUver:4;	/* BIU version, 0 if none */
192 #endif
193 #ifdef EMLXS_LITTLE_ENDIAN
194 	uint32_t	BIUver:4;	/* BIU version, 0 if none */
195 	uint32_t	BIUtype:4;	/* PCI = 0 */
196 	uint32_t	ENDECver:4;	/* ENDEC+ version, 0 if none */
197 	uint32_t	SMver:4;	/* Sequence Manager version */
198 					/* 0 if none */
199 	uint32_t	kver:4;	/* Kernel compatibility version */
200 	uint32_t	kernel:4;	/* Kernel ID */
201 	uint32_t	ldcount:7;	/* For use by program load */
202 	uint32_t	ldflag:1;	/* Set in SRAM descriptor */
203 #endif
204 } REVCOMPAT;
205 
206 typedef struct id_word
207 {
208 #ifdef EMLXS_BIG_ENDIAN
209 	uint8_t		Type;
210 	uint8_t		Id;
211 	uint8_t		Ver;
212 	uint8_t		Rev;
213 #endif
214 #ifdef EMLXS_LITTLE_ENDIAN
215 	uint8_t		Rev;
216 	uint8_t		Ver;
217 	uint8_t		Id;
218 	uint8_t		Type;
219 #endif
220 	union
221 	{
222 		REVCOMPAT	cp;
223 		uint32_t	revcomp;
224 	} un;
225 } PROG_ID;
226 
227 typedef struct
228 {
229 #ifdef EMLXS_BIG_ENDIAN
230 	uint8_t		tval;
231 	uint8_t		tmask;
232 	uint8_t		rval;
233 	uint8_t		rmask;
234 #endif
235 #ifdef EMLXS_LITTLE_ENDIAN
236 	uint8_t		rmask;
237 	uint8_t		rval;
238 	uint8_t		tmask;
239 	uint8_t		tval;
240 #endif
241 } RR_REG;
242 
243 
244 /* Structure used for a HBQ entry */
245 typedef struct
246 {
247 	ULP_BDE64	bde;
248 	union UN_TAG
249 	{
250 		uint32_t	w;
251 		struct
252 		{
253 #ifdef EMLXS_BIG_ENDIAN
254 			uint32_t	HBQ_tag:4;
255 			uint32_t	HBQE_tag:28;
256 #endif
257 #ifdef EMLXS_LITTLE_ENDIAN
258 			uint32_t	HBQE_tag:28;
259 			uint32_t	HBQ_tag:4;
260 #endif
261 		} ext;
262 	} unt;
263 } HBQE_t;
264 
265 typedef struct
266 {
267 #ifdef EMLXS_BIG_ENDIAN
268 	uint8_t		tmatch;
269 	uint8_t		tmask;
270 	uint8_t		rctlmatch;
271 	uint8_t		rctlmask;
272 #endif
273 #ifdef EMLXS_LITTLE_ENDIAN
274 	uint8_t		rctlmask;
275 	uint8_t		rctlmatch;
276 	uint8_t		tmask;
277 	uint8_t		tmatch;
278 #endif
279 } HBQ_MASK;
280 
281 #define	EMLXS_MAX_HBQ_BUFFERS	4096
282 
283 typedef struct
284 {
285 	uint32_t	HBQ_num_mask;		/* number of mask entries in */
286 						/* port array */
287 	uint32_t	HBQ_recvNotify;		/* Rcv buffer notification */
288 	uint32_t	HBQ_numEntries;		/* # of entries in HBQ */
289 	uint32_t	HBQ_headerLen;		/* 0 if not profile 4 or 5 */
290 	uint32_t	HBQ_logEntry;		/* Set to 1 if this HBQ used */
291 						/* for LogEntry */
292 	uint32_t	HBQ_profile;		/* Selection profile 0=all, */
293 						/* 7=logentry */
294 	uint32_t	HBQ_ringMask;		/* Binds HBQ to a ring e.g. */
295 						/* Ring0=b0001, ring2=b0100 */
296 	uint32_t	HBQ_id;			/* index of this hbq in ring */
297 						/* of HBQs[] */
298 	uint32_t	HBQ_PutIdx_next;	/* Index to next HBQ slot to */
299 						/* use */
300 	uint32_t	HBQ_PutIdx;		/* HBQ slot to use */
301 	uint32_t	HBQ_GetIdx;		/* Local copy of Get index */
302 						/* from Port */
303 	uint16_t	HBQ_PostBufCnt;		/* Current number of entries */
304 						/* in list */
305 	MATCHMAP	*HBQ_PostBufs[EMLXS_MAX_HBQ_BUFFERS];
306 	MATCHMAP	HBQ_host_buf;		/* HBQ host buffer for HBQEs */
307 	HBQ_MASK	HBQ_Masks[6];
308 
309 	union
310 	{
311 		uint32_t	allprofiles[12];
312 
313 		struct
314 		{
315 #ifdef EMLXS_BIG_ENDIAN
316 			uint32_t	seqlenoff:16;
317 			uint32_t	maxlen:16;
318 #endif
319 #ifdef EMLXS_LITTLE_ENDIAN
320 			uint32_t	maxlen:16;
321 			uint32_t	seqlenoff:16;
322 #endif
323 #ifdef EMLXS_BIG_ENDIAN
324 			uint32_t	rsvd1:28;
325 			uint32_t	seqlenbcnt:4;
326 #endif
327 #ifdef EMLXS_LITTLE_ENDIAN
328 			uint32_t	seqlenbcnt:4;
329 			uint32_t	rsvd1:28;
330 #endif
331 			uint32_t	rsvd[10];
332 		} profile2;
333 
334 		struct
335 		{
336 #ifdef EMLXS_BIG_ENDIAN
337 			uint32_t	seqlenoff:16;
338 			uint32_t	maxlen:16;
339 #endif
340 #ifdef EMLXS_LITTLE_ENDIAN
341 			uint32_t	maxlen:16;
342 			uint32_t	seqlenoff:16;
343 #endif
344 #ifdef EMLXS_BIG_ENDIAN
345 			uint32_t	cmdcodeoff:28;
346 			uint32_t	rsvd1:12;
347 			uint32_t	seqlenbcnt:4;
348 #endif
349 #ifdef EMLXS_LITTLE_ENDIAN
350 			uint32_t	seqlenbcnt:4;
351 			uint32_t	rsvd1:12;
352 			uint32_t	cmdcodeoff:28;
353 #endif
354 			uint32_t	cmdmatch[8];
355 
356 			uint32_t	rsvd[2];
357 		} profile3;
358 
359 		struct
360 		{
361 #ifdef EMLXS_BIG_ENDIAN
362 			uint32_t	seqlenoff:16;
363 			uint32_t	maxlen:16;
364 #endif
365 #ifdef EMLXS_LITTLE_ENDIAN
366 			uint32_t	maxlen:16;
367 			uint32_t	seqlenoff:16;
368 #endif
369 #ifdef EMLXS_BIG_ENDIAN
370 			uint32_t	cmdcodeoff:28;
371 			uint32_t	rsvd1:12;
372 			uint32_t	seqlenbcnt:4;
373 #endif
374 #ifdef EMLXS_LITTLE_ENDIAN
375 			uint32_t	seqlenbcnt:4;
376 			uint32_t	rsvd1:12;
377 			uint32_t	cmdcodeoff:28;
378 #endif
379 			uint32_t	cmdmatch[8];
380 
381 			uint32_t	rsvd[2];
382 		} profile5;
383 	} profiles;
384 } HBQ_INIT_t;
385 
386 
387 
388 /* Structure for MB Command LOAD_SM and DOWN_LOAD */
389 
390 
391 typedef struct
392 {
393 #ifdef EMLXS_BIG_ENDIAN
394 	uint32_t	rsvd2:25;
395 	uint32_t	acknowledgment:1;
396 	uint32_t	version:1;
397 	uint32_t	erase_or_prog:1;
398 	uint32_t	update_flash:1;
399 	uint32_t	update_ram:1;
400 	uint32_t	method:1;
401 	uint32_t	load_cmplt:1;
402 #endif
403 #ifdef EMLXS_LITTLE_ENDIAN
404 	uint32_t	load_cmplt:1;
405 	uint32_t	method:1;
406 	uint32_t	update_ram:1;
407 	uint32_t	update_flash:1;
408 	uint32_t	erase_or_prog:1;
409 	uint32_t	version:1;
410 	uint32_t	acknowledgment:1;
411 	uint32_t	rsvd2:25;
412 #endif
413 
414 #define	DL_FROM_BDE	0	/* method */
415 #define	DL_FROM_SLIM	1
416 
417 #define	PROGRAM_FLASH	0	/* erase_or_prog */
418 #define	ERASE_FLASH	1
419 
420 	uint32_t	dl_to_adr;
421 	uint32_t	dl_len;
422 	union
423 	{
424 		uint32_t	dl_from_slim_offset;
425 		ULP_BDE		dl_from_bde;
426 		ULP_BDE64	dl_from_bde64;
427 		PROG_ID		prog_id;
428 	} un;
429 } LOAD_SM_VAR;
430 
431 
432 /* Structure for MB Command READ_NVPARM (02) */
433 /* Good for SLI2/3 and SLI4 */
434 
435 typedef struct
436 {
437 	uint32_t	rsvd1[3];	/* Read as all one's */
438 	uint32_t	rsvd2;		/* Read as all zero's */
439 	uint32_t	portname[2];	/* N_PORT name */
440 	uint32_t	nodename[2];	/* NODE name */
441 #ifdef EMLXS_BIG_ENDIAN
442 	uint32_t	pref_DID:24;
443 	uint32_t	hardAL_PA:8;
444 #endif
445 #ifdef EMLXS_LITTLE_ENDIAN
446 	uint32_t	hardAL_PA:8;
447 	uint32_t	pref_DID:24;
448 #endif
449 	uint32_t	rsvd3[21];	/* Read as all one's */
450 } READ_NV_VAR;
451 
452 
453 /* Structure for MB Command WRITE_NVPARMS (03) */
454 /* Good for SLI2/3 and SLI4 */
455 
456 typedef struct
457 {
458 	uint32_t	rsvd1[3];	/* Must be all one's */
459 	uint32_t	rsvd2;		/* Must be all zero's */
460 	uint32_t	portname[2];	/* N_PORT name */
461 	uint32_t	nodename[2];	/* NODE name */
462 #ifdef EMLXS_BIG_ENDIAN
463 	uint32_t	pref_DID:24;
464 	uint32_t	hardAL_PA:8;
465 #endif
466 #ifdef EMLXS_LITTLE_ENDIAN
467 	uint32_t	hardAL_PA:8;
468 	uint32_t	pref_DID:24;
469 #endif
470 	uint32_t	rsvd3[21];	/* Must be all one's */
471 } WRITE_NV_VAR;
472 
473 
474 /* Structure for MB Command RUN_BIU_DIAG64 (0x84) */
475 /* Good for SLI2/3 and SLI4 */
476 
477 typedef struct
478 {
479 	uint32_t	rsvd1;
480 	union
481 	{
482 		struct
483 		{
484 			ULP_BDE64	xmit_bde64;
485 			ULP_BDE64	rcv_bde64;
486 		} s2;
487 	} un;
488 } BIU_DIAG_VAR;
489 
490 
491 /* Structure for MB Command INIT_LINK (05) */
492 /* Good for SLI2/3 and SLI4 */
493 
494 typedef struct
495 {
496 #ifdef EMLXS_BIG_ENDIAN
497 	uint32_t	rsvd1:24;
498 	uint32_t	lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective */
499 					/* Reset to */
500 #endif
501 #ifdef EMLXS_LITTLE_ENDIAN
502 	uint32_t	lipsr_AL_PA:8;	/* AL_PA to issue Lip Selective */
503 					/* Reset to */
504 	uint32_t	rsvd1:24;
505 #endif
506 
507 #ifdef EMLXS_BIG_ENDIAN
508 	uint8_t		fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
509 	uint8_t		rsvd2;
510 	uint16_t	link_flags;
511 #endif
512 #ifdef EMLXS_LITTLE_ENDIAN
513 	uint16_t	link_flags;
514 	uint8_t		rsvd2;
515 	uint8_t		fabric_AL_PA;	/* If using a Fabric Assigned AL_PA */
516 #endif
517 #define	FLAGS_LOCAL_LB			0x01	/* link_flags (=1) */
518 						/* ENDEC loopback */
519 #define	FLAGS_TOPOLOGY_MODE_LOOP_PT	0x00	/* Attempt loop then pt-pt */
520 #define	FLAGS_TOPOLOGY_MODE_PT_PT	0x02	/* Attempt pt-pt only */
521 #define	FLAGS_TOPOLOGY_MODE_LOOP	0x04	/* Attempt loop only */
522 #define	FLAGS_TOPOLOGY_MODE_PT_LOOP	0x06	/* Attempt pt-pt then loop */
523 #define	FLAGS_LIRP_LILP			0x80	/* LIRP / LILP is disabled */
524 
525 #define	FLAGS_TOPOLOGY_FAILOVER		0x0400	/* Bit 10 */
526 #define	FLAGS_LINK_SPEED		0x0800	/* Bit 11 */
527 #define	FLAGS_PREABORT_RETURN		0x4000	/* Bit 14 */
528 
529 	uint32_t	link_speed;	/* NEW_FEATURE */
530 #define	LINK_SPEED_AUTO			0	/* Auto selection */
531 #define	LINK_SPEED_1G			1	/* 1 Gigabaud */
532 #define	LINK_SPEED_2G			2	/* 2 Gigabaud */
533 } INIT_LINK_VAR;
534 
535 
536 /* Structure for MB Command DOWN_LINK (06) */
537 /* Good for SLI2/3 and SLI4 */
538 
539 typedef struct
540 {
541 	uint32_t	rsvd1;
542 } DOWN_LINK_VAR;
543 
544 
545 /* Structure for MB Command CONFIG_LINK (07) */
546 
547 typedef struct
548 {
549 #ifdef EMLXS_BIG_ENDIAN
550 	uint32_t	cr:1;
551 	uint32_t	ci:1;
552 	uint32_t	cr_delay:6;
553 	uint32_t	cr_count:8;
554 	uint32_t	rsvd1:8;
555 	uint32_t	MaxBBC:8;
556 #endif
557 #ifdef EMLXS_LITTLE_ENDIAN
558 	uint32_t	MaxBBC:8;
559 	uint32_t	rsvd1:8;
560 	uint32_t	cr_count:8;
561 	uint32_t	cr_delay:6;
562 	uint32_t	ci:1;
563 	uint32_t	cr:1;
564 #endif
565 	uint32_t	myId;
566 	uint32_t	rsvd2;
567 	uint32_t	edtov;
568 	uint32_t	arbtov;
569 	uint32_t	ratov;
570 	uint32_t	rttov;
571 	uint32_t	altov;
572 	uint32_t	crtov;
573 	uint32_t	citov;
574 #ifdef EMLXS_BIG_ENDIAN
575 	uint32_t	rrq_enable:1;
576 	uint32_t	rrq_immed:1;
577 	uint32_t	rsvd4:29;
578 	uint32_t	ack0_enable:1;
579 #endif
580 #ifdef EMLXS_LITTLE_ENDIAN
581 	uint32_t	ack0_enable:1;
582 	uint32_t	rsvd4:29;
583 	uint32_t	rrq_immed:1;
584 	uint32_t	rrq_enable:1;
585 #endif
586 } CONFIG_LINK;
587 
588 
589 /* Structure for MB Command PART_SLIM (08) */
590 
591 typedef struct
592 {
593 #ifdef EMLXS_BIG_ENDIAN
594 	uint32_t		unused1:24;
595 	uint32_t		numRing:8;
596 #endif
597 #ifdef EMLXS_LITTLE_ENDIAN
598 	uint32_t		numRing:8;
599 	uint32_t		unused1:24;
600 #endif
601 	emlxs_ring_def_t	ringdef[4];
602 	uint32_t		hbainit;
603 } PART_SLIM_VAR;
604 
605 
606 /* Structure for MB Command CONFIG_RING (09) */
607 
608 typedef struct
609 {
610 #ifdef EMLXS_BIG_ENDIAN
611 	uint32_t	unused2:6;
612 	uint32_t	recvSeq:1;
613 	uint32_t	recvNotify:1;
614 	uint32_t	numMask:8;
615 	uint32_t	profile:8;
616 	uint32_t	unused1:4;
617 	uint32_t	ring:4;
618 #endif
619 #ifdef EMLXS_LITTLE_ENDIAN
620 	uint32_t	ring:4;
621 	uint32_t	unused1:4;
622 	uint32_t	profile:8;
623 	uint32_t	numMask:8;
624 	uint32_t	recvNotify:1;
625 	uint32_t	recvSeq:1;
626 	uint32_t	unused2:6;
627 #endif
628 #ifdef EMLXS_BIG_ENDIAN
629 	uint16_t	maxRespXchg;
630 	uint16_t	maxOrigXchg;
631 #endif
632 #ifdef EMLXS_LITTLE_ENDIAN
633 	uint16_t	maxOrigXchg;
634 	uint16_t	maxRespXchg;
635 #endif
636 	RR_REG		rrRegs[6];
637 } CONFIG_RING_VAR;
638 
639 
640 /* Structure for MB Command RESET_RING (10) */
641 
642 typedef struct
643 {
644 	uint32_t	ring_no;
645 } RESET_RING_VAR;
646 
647 
648 /* Structure for MB Command READ_CONFIG (11) */
649 /* Good for SLI2/3 only */
650 
651 typedef struct
652 {
653 #ifdef EMLXS_BIG_ENDIAN
654 	uint32_t	cr:1;
655 	uint32_t	ci:1;
656 	uint32_t	cr_delay:6;
657 	uint32_t	cr_count:8;
658 	uint32_t	InitBBC:8;
659 	uint32_t	MaxBBC:8;
660 #endif
661 #ifdef EMLXS_LITTLE_ENDIAN
662 	uint32_t	MaxBBC:8;
663 	uint32_t	InitBBC:8;
664 	uint32_t	cr_count:8;
665 	uint32_t	cr_delay:6;
666 	uint32_t	ci:1;
667 	uint32_t	cr:1;
668 #endif
669 #ifdef EMLXS_BIG_ENDIAN
670 	uint32_t	topology:8;
671 	uint32_t	myDid:24;
672 #endif
673 #ifdef EMLXS_LITTLE_ENDIAN
674 	uint32_t	myDid:24;
675 	uint32_t	topology:8;
676 #endif
677 	/* Defines for topology (defined previously) */
678 #ifdef EMLXS_BIG_ENDIAN
679 	uint32_t	AR:1;
680 	uint32_t	IR:1;
681 	uint32_t	rsvd1:29;
682 	uint32_t	ack0:1;
683 #endif
684 #ifdef EMLXS_LITTLE_ENDIAN
685 	uint32_t	ack0:1;
686 	uint32_t	rsvd1:29;
687 	uint32_t	IR:1;
688 	uint32_t	AR:1;
689 #endif
690 	uint32_t	edtov;
691 	uint32_t	arbtov;
692 	uint32_t	ratov;
693 	uint32_t	rttov;
694 	uint32_t	altov;
695 	uint32_t	lmt;
696 
697 #define	LMT_1GB_CAPABLE		0x0004
698 #define	LMT_2GB_CAPABLE		0x0008
699 #define	LMT_4GB_CAPABLE		0x0040
700 #define	LMT_8GB_CAPABLE		0x0080
701 #define	LMT_10GB_CAPABLE	0x0100
702 /* E2E supported on adapters >= 8GB */
703 #define	LMT_E2E_CAPABLE		(LMT_8GB_CAPABLE|LMT_10GB_CAPABLE)
704 
705 	uint32_t	rsvd2;
706 	uint32_t	rsvd3;
707 	uint32_t	max_xri;
708 	uint32_t	max_iocb;
709 	uint32_t	max_rpi;
710 	uint32_t	avail_xri;
711 	uint32_t	avail_iocb;
712 	uint32_t	avail_rpi;
713 	uint32_t	max_vpi;
714 	uint32_t	max_alpa;
715 	uint32_t	rsvd4;
716 	uint32_t	avail_vpi;
717 
718 } READ_CONFIG_VAR;
719 
720 
721 /* Structure for MB Command READ_CONFIG(0x11) */
722 /* Good for SLI4 only */
723 
724 typedef struct
725 {
726 	uint32_t	rsvd1;		/* Word 1 */
727 #ifdef EMLXS_BIG_ENDIAN
728 	uint32_t	topology:8;
729 	uint32_t	rsvd2:24;	/* Word 2 */
730 #endif
731 #ifdef EMLXS_LITTLE_ENDIAN
732 	uint32_t	rsvd2:24;	/* Word 2 */
733 	uint32_t	topology:8;
734 #endif
735 	uint32_t	rsvd3;		/* Word 3 */
736 	uint32_t	edtov;		/* Word 4 */
737 	uint32_t	rsvd4;		/* Word 5 */
738 	uint32_t	ratov;		/* Word 6 */
739 	uint32_t	rsvd5;		/* Word 7 */
740 	uint32_t	rsvd6;		/* Word 8 */
741 	uint32_t	lmt;		/* Word 9 */
742 	uint32_t	rsvd8;		/* Word 10 */
743 	uint32_t	rsvd9;		/* Word 11 */
744 
745 #ifdef EMLXS_BIG_ENDIAN
746 	uint16_t	XRICount;	/* Word 12 */
747 	uint16_t	XRIBase;	/* Word 12 */
748 
749 	uint16_t	RPICount;	/* Word 13 */
750 	uint16_t	RPIBase;	/* Word 13 */
751 
752 	uint16_t	VPICount;	/* Word 14 */
753 	uint16_t	VPIBase;	/* Word 14 */
754 
755 	uint16_t	VFICount;	/* Word 15 */
756 	uint16_t	VFIBase;	/* Word 15 */
757 
758 	uint16_t	FCFICount;	/* Word 16 */
759 	uint16_t	rsvd10;		/* Word 16 */
760 
761 	uint16_t	EQCount;	/* Word 17 */
762 	uint16_t	RQCount;	/* Word 17 */
763 
764 	uint16_t	CQCount;	/* Word 18 */
765 	uint16_t	WQCount;	/* Word 18 */
766 #endif
767 #ifdef EMLXS_LITTLE_ENDIAN
768 	uint16_t	XRIBase;	/* Word 12 */
769 	uint16_t	XRICount;	/* Word 12 */
770 
771 	uint16_t	RPIBase;	/* Word 13 */
772 	uint16_t	RPICount;	/* Word 13 */
773 
774 	uint16_t	VPIBase;	/* Word 14 */
775 	uint16_t	VPICount;	/* Word 14 */
776 
777 	uint16_t	VFIBase;	/* Word 15 */
778 	uint16_t	VFICount;	/* Word 15 */
779 
780 	uint16_t	rsvd10;		/* Word 16 */
781 	uint16_t	FCFICount;	/* Word 16 */
782 
783 	uint16_t	EQCount;	/* Word 17 */
784 	uint16_t	RQCount;	/* Word 17 */
785 
786 	uint16_t	CQCount;	/* Word 18 */
787 	uint16_t	WQCount;	/* Word 18 */
788 #endif
789 
790 } READ_CONFIG4_VAR;
791 
792 /* Structure for MB Command READ_RCONFIG (12) */
793 
794 typedef struct
795 {
796 #ifdef EMLXS_BIG_ENDIAN
797 	uint32_t	rsvd2:7;
798 	uint32_t	recvNotify:1;
799 	uint32_t	numMask:8;
800 	uint32_t	profile:8;
801 	uint32_t	rsvd1:4;
802 	uint32_t	ring:4;
803 #endif
804 #ifdef EMLXS_LITTLE_ENDIAN
805 	uint32_t	ring:4;
806 	uint32_t	rsvd1:4;
807 	uint32_t	profile:8;
808 	uint32_t	numMask:8;
809 	uint32_t	recvNotify:1;
810 	uint32_t	rsvd2:7;
811 #endif
812 #ifdef EMLXS_BIG_ENDIAN
813 	uint16_t	maxResp;
814 	uint16_t	maxOrig;
815 #endif
816 #ifdef EMLXS_LITTLE_ENDIAN
817 	uint16_t	maxOrig;
818 	uint16_t	maxResp;
819 #endif
820 	RR_REG		rrRegs[6];
821 #ifdef EMLXS_BIG_ENDIAN
822 	uint16_t	cmdRingOffset;
823 	uint16_t	cmdEntryCnt;
824 	uint16_t	rspRingOffset;
825 	uint16_t	rspEntryCnt;
826 	uint16_t	nextCmdOffset;
827 	uint16_t	rsvd3;
828 	uint16_t	nextRspOffset;
829 	uint16_t	rsvd4;
830 #endif
831 #ifdef EMLXS_LITTLE_ENDIAN
832 	uint16_t	cmdEntryCnt;
833 	uint16_t	cmdRingOffset;
834 	uint16_t	rspEntryCnt;
835 	uint16_t	rspRingOffset;
836 	uint16_t	rsvd3;
837 	uint16_t	nextCmdOffset;
838 	uint16_t	rsvd4;
839 	uint16_t	nextRspOffset;
840 #endif
841 } READ_RCONF_VAR;
842 
843 
844 /* Structure for MB Command READ_SPARM (13) */
845 /* Structure for MB Command READ_SPARM64 (0x8D) */
846 /* Good for SLI2/3 and SLI4 */
847 
848 typedef struct
849 {
850 	uint32_t	rsvd1;
851 	uint32_t	rsvd2;
852 	union
853 	{
854 		ULP_BDE		sp;	/* This BDE points to SERV_PARM */
855 					/* structure */
856 		ULP_BDE64	sp64;
857 	} un;
858 	uint32_t	rsvd3;
859 
860 #ifdef EMLXS_BIG_ENDIAN
861 	uint16_t	portNameCnt;
862 	uint16_t	portNameOffset;
863 
864 	uint16_t	fabricNameCnt;
865 	uint16_t	fabricNameOffset;
866 
867 	uint16_t	lportNameCnt;
868 	uint16_t	lportNameOffset;
869 
870 	uint16_t	lfabricNameCnt;
871 	uint16_t	lfabricNameOffset;
872 
873 #endif
874 #ifdef EMLXS_LITTLE_ENDIAN
875 	uint16_t	portNameOffset;
876 	uint16_t	portNameCnt;
877 
878 	uint16_t	fabricNameOffset;
879 	uint16_t	fabricNameCnt;
880 
881 	uint16_t	lportNameOffset;
882 	uint16_t	lportNameCnt;
883 
884 	uint16_t	lfabricNameOffset;
885 	uint16_t	lfabricNameCnt;
886 
887 #endif
888 
889 } READ_SPARM_VAR;
890 
891 
892 /* Structure for MB Command READ_STATUS (14) */
893 /* Good for SLI2/3 and SLI4 */
894 
895 typedef struct
896 {
897 #ifdef EMLXS_BIG_ENDIAN
898 	uint32_t	rsvd1:31;
899 	uint32_t	clrCounters:1;
900 
901 	uint16_t	activeXriCnt;
902 	uint16_t	activeRpiCnt;
903 #endif
904 #ifdef EMLXS_LITTLE_ENDIAN
905 	uint32_t	clrCounters:1;
906 	uint32_t	rsvd1:31;
907 
908 	uint16_t	activeRpiCnt;
909 	uint16_t	activeXriCnt;
910 #endif
911 	uint32_t	xmitByteCnt;
912 	uint32_t	rcvByteCnt;
913 	uint32_t	xmitFrameCnt;
914 	uint32_t	rcvFrameCnt;
915 	uint32_t	xmitSeqCnt;
916 	uint32_t	rcvSeqCnt;
917 	uint32_t	totalOrigExchanges;
918 	uint32_t	totalRespExchanges;
919 	uint32_t	rcvPbsyCnt;
920 	uint32_t	rcvFbsyCnt;
921 } READ_STATUS_VAR;
922 
923 
924 /* Structure for MB Command READ_RPI (15) */
925 /* Structure for MB Command READ_RPI64 (0x8F) */
926 
927 typedef struct
928 {
929 #ifdef EMLXS_BIG_ENDIAN
930 	uint16_t	nextRpi;
931 	uint16_t	reqRpi;
932 	uint32_t	rsvd2:8;
933 	uint32_t	DID:24;
934 #endif
935 #ifdef EMLXS_LITTLE_ENDIAN
936 	uint16_t	reqRpi;
937 	uint16_t	nextRpi;
938 	uint32_t	DID:24;
939 	uint32_t	rsvd2:8;
940 #endif
941 	union
942 	{
943 		ULP_BDE		sp;
944 		ULP_BDE64	sp64;
945 	} un;
946 } READ_RPI_VAR;
947 
948 
949 /* Structure for MB Command READ_XRI (16) */
950 
951 typedef struct
952 {
953 #ifdef EMLXS_BIG_ENDIAN
954 	uint16_t	nextXri;
955 	uint16_t	reqXri;
956 	uint16_t	rsvd1;
957 	uint16_t	rpi;
958 	uint32_t	rsvd2:8;
959 	uint32_t	DID:24;
960 	uint32_t	rsvd3:8;
961 	uint32_t	SID:24;
962 	uint32_t	rsvd4;
963 	uint8_t		seqId;
964 	uint8_t		rsvd5;
965 	uint16_t	seqCount;
966 	uint16_t	oxId;
967 	uint16_t	rxId;
968 	uint32_t	rsvd6:30;
969 	uint32_t	si:1;
970 	uint32_t	exchOrig:1;
971 #endif
972 #ifdef EMLXS_LITTLE_ENDIAN
973 	uint16_t	reqXri;
974 	uint16_t	nextXri;
975 	uint16_t	rpi;
976 	uint16_t	rsvd1;
977 	uint32_t	DID:24;
978 	uint32_t	rsvd2:8;
979 	uint32_t	SID:24;
980 	uint32_t	rsvd3:8;
981 	uint32_t	rsvd4;
982 	uint16_t	seqCount;
983 	uint8_t		rsvd5;
984 	uint8_t		seqId;
985 	uint16_t	rxId;
986 	uint16_t	oxId;
987 	uint32_t	exchOrig:1;
988 	uint32_t	si:1;
989 	uint32_t	rsvd6:30;
990 #endif
991 } READ_XRI_VAR;
992 
993 
994 /* Structure for MB Command READ_REV (17) */
995 /* Good for SLI2/3 only */
996 
997 typedef struct
998 {
999 #ifdef EMLXS_BIG_ENDIAN
1000 	uint32_t	cv:1;
1001 	uint32_t	rr:1;
1002 	uint32_t	co:1;
1003 	uint32_t	rp:1;
1004 	uint32_t	cv3:1;
1005 	uint32_t	rf3:1;
1006 	uint32_t	rsvd1:10;
1007 	uint32_t	offset:14;
1008 	uint32_t	rv:2;
1009 #endif
1010 #ifdef EMLXS_LITTLE_ENDIAN
1011 	uint32_t	rv:2;
1012 	uint32_t	offset:14;
1013 	uint32_t	rsvd1:10;
1014 	uint32_t	rf3:1;
1015 	uint32_t	cv3:1;
1016 	uint32_t	rp:1;
1017 	uint32_t	co:1;
1018 	uint32_t	rr:1;
1019 	uint32_t	cv:1;
1020 #endif
1021 	uint32_t	biuRev;
1022 	uint32_t	smRev;
1023 	union
1024 	{
1025 		uint32_t	smFwRev;
1026 		struct
1027 		{
1028 #ifdef EMLXS_BIG_ENDIAN
1029 			uint8_t		ProgType;
1030 			uint8_t		ProgId;
1031 			uint16_t	ProgVer:4;
1032 			uint16_t	ProgRev:4;
1033 			uint16_t	ProgFixLvl:2;
1034 			uint16_t	ProgDistType:2;
1035 			uint16_t	DistCnt:4;
1036 #endif
1037 #ifdef EMLXS_LITTLE_ENDIAN
1038 			uint16_t	DistCnt:4;
1039 			uint16_t	ProgDistType:2;
1040 			uint16_t	ProgFixLvl:2;
1041 			uint16_t	ProgRev:4;
1042 			uint16_t	ProgVer:4;
1043 			uint8_t		ProgId;
1044 			uint8_t		ProgType;
1045 #endif
1046 		} b;
1047 	} un;
1048 	uint32_t	endecRev;
1049 #ifdef EMLXS_BIG_ENDIAN
1050 	uint8_t		feaLevelHigh;
1051 	uint8_t		feaLevelLow;
1052 	uint8_t		fcphHigh;
1053 	uint8_t		fcphLow;
1054 #endif
1055 #ifdef EMLXS_LITTLE_ENDIAN
1056 	uint8_t		fcphLow;
1057 	uint8_t		fcphHigh;
1058 	uint8_t		feaLevelLow;
1059 	uint8_t		feaLevelHigh;
1060 #endif
1061 	uint32_t	postKernRev;
1062 	uint32_t	opFwRev;
1063 	uint8_t		opFwName[16];
1064 
1065 	uint32_t	sliFwRev1;
1066 	uint8_t		sliFwName1[16];
1067 	uint32_t	sliFwRev2;
1068 	uint8_t		sliFwName2[16];
1069 } READ_REV_VAR;
1070 
1071 /* Structure for MB Command READ_REV (17) */
1072 /* Good for SLI4 only */
1073 
1074 typedef struct
1075 {
1076 #ifdef EMLXS_BIG_ENDIAN
1077 	uint32_t	Rsvd3:2;
1078 	uint32_t	VPD:1;
1079 	uint32_t	rsvd2:6;
1080 	uint32_t	dcbxMode:2;
1081 	uint32_t	FCoE:1;
1082 	uint32_t	sliLevel:4;
1083 	uint32_t	rsvd1:16;
1084 #endif
1085 #ifdef EMLXS_LITTLE_ENDIAN
1086 	uint32_t	rsvd1:16;
1087 	uint32_t	sliLevel:4;
1088 	uint32_t	FCoE:1;
1089 	uint32_t	dcbxMode:2;
1090 	uint32_t	rsvd2:6;
1091 	uint32_t	VPD:1;
1092 	uint32_t	Rsvd3:2;
1093 #endif
1094 
1095 	uint32_t	HwRev1;
1096 	uint32_t	HwRev2;
1097 	uint32_t	Rsvd4;
1098 	uint32_t	HwRev3;
1099 
1100 #ifdef EMLXS_BIG_ENDIAN
1101 	uint8_t		feaLevelHigh;
1102 	uint8_t		feaLevelLow;
1103 	uint8_t		fcphHigh;
1104 	uint8_t		fcphLow;
1105 #endif
1106 #ifdef EMLXS_LITTLE_ENDIAN
1107 	uint8_t		fcphLow;
1108 	uint8_t		fcphHigh;
1109 	uint8_t		feaLevelLow;
1110 	uint8_t		feaLevelHigh;
1111 #endif
1112 
1113 	uint32_t	Redboot;
1114 
1115 	uint32_t	ARMFwId;
1116 	uint8_t		ARMFwName[16];
1117 
1118 	uint32_t	ULPFwId;
1119 	uint8_t		ULPFwName[16];
1120 
1121 	uint32_t	Rsvd6[30];
1122 
1123 	ULP_BDE64	VPDBde;
1124 
1125 	uint32_t	ReturnedVPDLength;
1126 
1127 } READ_REV4_VAR;
1128 
1129 #define	EMLXS_DCBX_MODE_CIN	0	/* Mapped to nonFIP mode */
1130 #define	EMLXS_DCBX_MODE_CEE	1	/* Mapped to FIP mode */
1131 
1132 /* Structure for MB Command READ_LINK_STAT (18) */
1133 /* Good for SLI2/3 and SLI4 */
1134 
1135 typedef struct
1136 {
1137 	uint32_t	rsvd1;
1138 	uint32_t	linkFailureCnt;
1139 	uint32_t	lossSyncCnt;
1140 
1141 	uint32_t	lossSignalCnt;
1142 	uint32_t	primSeqErrCnt;
1143 	uint32_t	invalidXmitWord;
1144 	uint32_t	crcCnt;
1145 	uint32_t	primSeqTimeout;
1146 	uint32_t	elasticOverrun;
1147 	uint32_t	arbTimeout;
1148 
1149 	uint32_t	rxBufCredit;
1150 	uint32_t	rxBufCreditCur;
1151 
1152 	uint32_t	txBufCredit;
1153 	uint32_t	txBufCreditCur;
1154 
1155 	uint32_t	EOFaCnt;
1156 	uint32_t	EOFdtiCnt;
1157 	uint32_t	EOFniCnt;
1158 	uint32_t	SOFfCnt;
1159 	uint32_t	DropAERCnt;
1160 	uint32_t	DropRcv;
1161 } READ_LNK_VAR;
1162 
1163 
1164 /* Structure for MB Command REG_LOGIN (19) */
1165 /* Structure for MB Command REG_LOGIN64 (0x93) */
1166 /* Structure for MB Command REG_RPI (0x93) */
1167 /* Good for SLI2/3 and SLI4 */
1168 
1169 typedef struct
1170 {
1171 #ifdef EMLXS_BIG_ENDIAN
1172 	uint16_t	rsvd1;
1173 	uint16_t	rpi;
1174 	uint32_t	CI:1;
1175 	uint32_t	rsvd2:7;
1176 	uint32_t	did:24;
1177 #endif
1178 #ifdef EMLXS_LITTLE_ENDIAN
1179 	uint16_t	rpi;
1180 	uint16_t	rsvd1;
1181 	uint32_t	did:24;
1182 	uint32_t	rsvd2:7;
1183 	uint32_t	CI:1;
1184 #endif
1185 	union
1186 	{
1187 		ULP_BDE		sp;
1188 		ULP_BDE64	sp64;
1189 	} un;
1190 
1191 #ifdef EMLXS_BIG_ENDIAN
1192 	uint16_t	rsvd6;
1193 	uint16_t	vpi;
1194 #endif
1195 #ifdef EMLXS_LITTLE_ENDIAN
1196 	uint16_t	vpi;
1197 	uint16_t	rsvd6;
1198 #endif
1199 } REG_LOGIN_VAR;
1200 
1201 /* Word 30 contents for REG_LOGIN */
1202 typedef union
1203 {
1204 	struct
1205 	{
1206 #ifdef EMLXS_BIG_ENDIAN
1207 		uint16_t	rsvd1:12;
1208 		uint16_t	class:4;
1209 		uint16_t	xri;
1210 #endif
1211 #ifdef EMLXS_LITTLE_ENDIAN
1212 		uint16_t	xri;
1213 		uint16_t	class:4;
1214 		uint16_t	rsvd1:12;
1215 #endif
1216 	} f;
1217 	uint32_t	word;
1218 } REG_WD30;
1219 
1220 
1221 /* Structure for MB Command UNREG_LOGIN (0x14) - SLI2/3 */
1222 /* Structure for MB Command UNREG_RPI (0x14) - SLI4 */
1223 
1224 typedef struct
1225 {
1226 #ifdef EMLXS_BIG_ENDIAN
1227 	uint16_t	ll:2;		/* SLI4 only */
1228 	uint16_t	rsvd1:14;
1229 	uint16_t	rpi;
1230 #endif
1231 #ifdef EMLXS_LITTLE_ENDIAN
1232 	uint16_t	rpi;
1233 	uint16_t	rsvd1:14;
1234 	uint16_t	ll:2;		/* SLI4 only */
1235 #endif
1236 
1237 	uint32_t	rsvd2;
1238 	uint32_t	rsvd3;
1239 	uint32_t	rsvd4;
1240 	uint32_t	rsvd5;
1241 #ifdef EMLXS_BIG_ENDIAN
1242 	uint16_t	rsvd6;
1243 	uint16_t	vpi;
1244 #endif
1245 #ifdef EMLXS_LITTLE_ENDIAN
1246 	uint16_t	vpi;
1247 	uint16_t	rsvd6;
1248 #endif
1249 } UNREG_LOGIN_VAR;
1250 
1251 /* Structure for MB Command REG_FCFI (0xA0) */
1252 /* Good for SLI4 only */
1253 
1254 typedef struct
1255 {
1256 #ifdef EMLXS_BIG_ENDIAN
1257 	uint16_t	FCFI;
1258 	uint16_t	InfoIndex;
1259 
1260 	uint16_t	RQId0;
1261 	uint16_t	RQId1;
1262 	uint16_t	RQId2;
1263 	uint16_t	RQId3;
1264 
1265 	uint8_t		Id0_type;
1266 	uint8_t		Id0_type_mask;
1267 	uint8_t		Id0_rctl;
1268 	uint8_t		Id0_rctl_mask;
1269 
1270 	uint8_t		Id1_type;
1271 	uint8_t		Id1_type_mask;
1272 	uint8_t		Id1_rctl;
1273 	uint8_t		Id1_rctl_mask;
1274 
1275 	uint8_t		Id2_type;
1276 	uint8_t		Id2_type_mask;
1277 	uint8_t		Id2_rctl;
1278 	uint8_t		Id2_rctl_mask;
1279 
1280 	uint8_t		Id3_type;
1281 	uint8_t		Id3_type_mask;
1282 	uint8_t		Id3_rctl;
1283 	uint8_t		Id3_rctl_mask;
1284 
1285 	uint32_t	Rsvd1: 17;
1286 	uint32_t	mam: 2;
1287 	uint32_t	vv: 1;
1288 	uint32_t	vlanTag: 12;
1289 #endif
1290 #ifdef EMLXS_LITTLE_ENDIAN
1291 	uint16_t	InfoIndex;
1292 	uint16_t	FCFI;
1293 
1294 	uint16_t	RQId1;
1295 	uint16_t	RQId0;
1296 	uint16_t	RQId3;
1297 	uint16_t	RQId2;
1298 
1299 	uint8_t		Id0_rctl_mask;
1300 	uint8_t		Id0_rctl;
1301 	uint8_t		Id0_type_mask;
1302 	uint8_t		Id0_type;
1303 
1304 	uint8_t		Id1_rctl_mask;
1305 	uint8_t		Id1_rctl;
1306 	uint8_t		Id1_type_mask;
1307 	uint8_t		Id1_type;
1308 
1309 	uint8_t		Id2_rctl_mask;
1310 	uint8_t		Id2_rctl;
1311 	uint8_t		Id2_type_mask;
1312 	uint8_t		Id2_type;
1313 
1314 	uint8_t		Id3_rctl_mask;
1315 	uint8_t		Id3_rctl;
1316 	uint8_t		Id3_type_mask;
1317 	uint8_t		Id3_type;
1318 
1319 	uint32_t	vlanTag: 12;
1320 	uint32_t	vv: 1;
1321 	uint32_t	mam: 2;
1322 	uint32_t	Rsvd1: 17;
1323 #endif
1324 
1325 }  REG_FCFI_VAR;
1326 
1327 /* Defines for mam */
1328 #define	EMLXS_REG_FCFI_MAM_SPMA	1	/* Server Provided MAC Address */
1329 #define	EMLXS_REG_FCFI_MAM_FPMA	2	/* Fabric Provided MAC Address */
1330 
1331 /* Structure for MB Command UNREG_FCFI (0xA2) */
1332 /* Good for SLI4 only */
1333 
1334 typedef struct
1335 {
1336 	uint32_t	Rsvd1;
1337 #ifdef EMLXS_BIG_ENDIAN
1338 	uint16_t	Rsvd2;
1339 	uint16_t	FCFI;
1340 #endif
1341 #ifdef EMLXS_LITTLE_ENDIAN
1342 	uint16_t	FCFI;
1343 	uint16_t	Rsvd2;
1344 #endif
1345 }  UNREG_FCFI_VAR;
1346 
1347 /* Structure for MB Command RESUME_RPI (0x9E) */
1348 /* Good for SLI4 only */
1349 
1350 typedef struct
1351 {
1352 #ifdef EMLXS_BIG_ENDIAN
1353 	uint16_t	Rsvd1;
1354 	uint16_t	RPI;
1355 
1356 	uint32_t	EventTag;
1357 	uint32_t	rsvd2[3];
1358 
1359 	uint16_t	VFI;
1360 	uint16_t	VPI;
1361 #endif
1362 #ifdef EMLXS_LITTLE_ENDIAN
1363 	uint16_t	RPI;
1364 	uint16_t	Rsvd1;
1365 
1366 	uint32_t	EventTag;
1367 	uint32_t	rsvd2[3];
1368 
1369 	uint16_t	VPI;
1370 	uint16_t	VFI;
1371 #endif
1372 
1373 }  RESUME_RPI_VAR;
1374 
1375 
1376 /* Structure for MB Command UNREG_D_ID (0x23) */
1377 
1378 typedef struct
1379 {
1380 	uint32_t	did;
1381 
1382 	uint32_t	rsvd2;
1383 	uint32_t	rsvd3;
1384 	uint32_t	rsvd4;
1385 	uint32_t	rsvd5;
1386 #ifdef EMLXS_BIG_ENDIAN
1387 	uint16_t	rsvd6;
1388 	uint16_t	vpi;
1389 #endif
1390 #ifdef EMLXS_LITTLE_ENDIAN
1391 	uint16_t	vpi;
1392 	uint16_t	rsvd6;
1393 #endif
1394 } UNREG_D_ID_VAR;
1395 
1396 
1397 /* Structure for MB Command READ_LA (21) */
1398 /* Structure for MB Command READ_LA64 (0x95) */
1399 
1400 typedef struct
1401 {
1402 	uint32_t	eventTag;	/* Event tag */
1403 #ifdef EMLXS_BIG_ENDIAN
1404 	uint32_t	rsvd2:19;
1405 	uint32_t	fa:1;
1406 	uint32_t	mm:1;
1407 	uint32_t	tc:1;
1408 	uint32_t	pb:1;
1409 	uint32_t	il:1;
1410 	uint32_t	attType:8;
1411 #endif
1412 #ifdef EMLXS_LITTLE_ENDIAN
1413 	uint32_t	attType:8;
1414 	uint32_t	il:1;
1415 	uint32_t	pb:1;
1416 	uint32_t	tc:1;
1417 	uint32_t	mm:1;
1418 	uint32_t	fa:1;
1419 	uint32_t	rsvd2:19;
1420 #endif
1421 #define	AT_RESERVED	0x00	/* Reserved - attType */
1422 #define	AT_LINK_UP	0x01	/* Link is up */
1423 #define	AT_LINK_DOWN	0x02	/* Link is down */
1424 #ifdef EMLXS_BIG_ENDIAN
1425 	uint8_t		granted_AL_PA;
1426 	uint8_t		lipAlPs;
1427 	uint8_t		lipType;
1428 	uint8_t		topology;
1429 #endif
1430 #ifdef EMLXS_LITTLE_ENDIAN
1431 	uint8_t		topology;
1432 	uint8_t		lipType;
1433 	uint8_t		lipAlPs;
1434 	uint8_t		granted_AL_PA;
1435 #endif
1436 
1437 	/* lipType */
1438 #define	LT_PORT_INIT	0x00	/* An L_PORT initing (F7, AL_PS) - lipType */
1439 #define	LT_PORT_ERR	0x01	/* Err @L_PORT rcv'er (F8, AL_PS) */
1440 #define	LT_RESET_APORT	0x02	/* Lip Reset of some other port */
1441 #define	LT_RESET_MYPORT	0x03	/* Lip Reset of my port */
1442 
1443 	/* topology */
1444 #define	TOPOLOGY_PT_PT	0x01	/* Topology is pt-pt / pt-fabric */
1445 #define	TOPOLOGY_LOOP	0x02	/* Topology is FC-AL (private) */
1446 
1447 	union
1448 	{
1449 		ULP_BDE		lilpBde;	/* This BDE points to a */
1450 						/* 128 byte buffer to store */
1451 						/* the LILP AL_PA position */
1452 						/* map into */
1453 		ULP_BDE64	lilpBde64;
1454 	} un;
1455 #ifdef EMLXS_BIG_ENDIAN
1456 	uint32_t	Dlu:1;
1457 	uint32_t	Dtf:1;
1458 	uint32_t	Drsvd2:14;
1459 	uint32_t	DlnkSpeed:8;
1460 	uint32_t	DnlPort:4;
1461 	uint32_t	Dtx:2;
1462 	uint32_t	Drx:2;
1463 #endif
1464 #ifdef EMLXS_LITTLE_ENDIAN
1465 	uint32_t	Drx:2;
1466 	uint32_t	Dtx:2;
1467 	uint32_t	DnlPort:4;
1468 	uint32_t	DlnkSpeed:8;
1469 	uint32_t	Drsvd2:14;
1470 	uint32_t	Dtf:1;
1471 	uint32_t	Dlu:1;
1472 #endif
1473 #ifdef EMLXS_BIG_ENDIAN
1474 	uint32_t	Ulu:1;
1475 	uint32_t	Utf:1;
1476 	uint32_t	Ursvd2:14;
1477 	uint32_t	UlnkSpeed:8;
1478 	uint32_t	UnlPort:4;
1479 	uint32_t	Utx:2;
1480 	uint32_t	Urx:2;
1481 #endif
1482 #ifdef EMLXS_LITTLE_ENDIAN
1483 	uint32_t	Urx:2;
1484 	uint32_t	Utx:2;
1485 	uint32_t	UnlPort:4;
1486 	uint32_t	UlnkSpeed:8;
1487 	uint32_t	Ursvd2:14;
1488 	uint32_t	Utf:1;
1489 	uint32_t	Ulu:1;
1490 #endif
1491 
1492 #define	LA_1GHZ_LINK   0x04	/* lnkSpeed */
1493 #define	LA_2GHZ_LINK   0x08	/* lnkSpeed */
1494 #define	LA_4GHZ_LINK   0x10	/* lnkSpeed */
1495 #define	LA_8GHZ_LINK   0x20	/* lnkSpeed */
1496 #define	LA_10GHZ_LINK  0x40	/* lnkSpeed */
1497 } READ_LA_VAR;
1498 
1499 
1500 /* Structure for MB Command CLEAR_LA (22) */
1501 
1502 typedef struct
1503 {
1504 	uint32_t	eventTag;	/* Event tag */
1505 	uint32_t	rsvd1;
1506 } CLEAR_LA_VAR;
1507 
1508 /* Structure for MB Command DUMP */
1509 /* Good for SLI2/3 only */
1510 
1511 typedef struct
1512 {
1513 #ifdef EMLXS_BIG_ENDIAN
1514 	uint32_t	rsvd:25;
1515 	uint32_t	ra:1;
1516 	uint32_t	co:1;
1517 	uint32_t	cv:1;
1518 	uint32_t	type:4;
1519 
1520 	uint32_t	entry_index:16;
1521 	uint32_t	region_id:16;
1522 #endif
1523 #ifdef EMLXS_LITTLE_ENDIAN
1524 	uint32_t	type:4;
1525 	uint32_t	cv:1;
1526 	uint32_t	co:1;
1527 	uint32_t	ra:1;
1528 	uint32_t	rsvd:25;
1529 
1530 	uint32_t	region_id:16;
1531 	uint32_t	entry_index:16;
1532 #endif
1533 	uint32_t	base_adr;
1534 	uint32_t	word_cnt;
1535 	uint32_t	resp_offset;
1536 } DUMP_VAR;
1537 
1538 /* Structure for MB Command DUMP */
1539 /* Good for SLI4 only */
1540 
1541 typedef struct
1542 {
1543 #ifdef EMLXS_BIG_ENDIAN
1544 	uint32_t	ppi:4;
1545 	uint32_t	phy_index:4;
1546 	uint32_t	rsvd:20;
1547 	uint32_t	type:4;
1548 
1549 	uint32_t	entry_index:16;
1550 	uint32_t	region_id:16;
1551 #endif
1552 #ifdef EMLXS_LITTLE_ENDIAN
1553 	uint32_t	type:4;
1554 	uint32_t	rsvd:20;
1555 	uint32_t	phy_index:4;
1556 	uint32_t	ppi:4;
1557 
1558 	uint32_t	region_id:16;
1559 	uint32_t	entry_index:16;
1560 #endif
1561 	uint32_t	available_cnt;
1562 	uint32_t	addrLow;
1563 	uint32_t	addrHigh;
1564 	uint32_t	rsp_cnt;
1565 } DUMP4_VAR;
1566 
1567 /*
1568  * Dump type
1569  */
1570 #define	DMP_MEM_REG	0x1
1571 #define	DMP_NV_PARAMS	0x2
1572 
1573 /*
1574  * Dump region ID
1575  */
1576 #define	NODE_CFG_A_REGION_ID	0
1577 #define	NODE_CFG_B_REGION_ID	1
1578 #define	NODE_CFG_C_REGION_ID	2
1579 #define	NODE_CFG_D_REGION_ID	3
1580 #define	WAKE_UP_PARMS_REGION_ID	4
1581 #define	DEF_PCI_CFG_REGION_ID	5
1582 #define	PCI_CFG_1_REGION_ID	6
1583 #define	PCI_CFG_2_REGION_ID	7
1584 #define	RSVD1_REGION_ID		8
1585 #define	RSVD2_REGION_ID		9
1586 #define	RSVD3_REGION_ID		10
1587 #define	RSVD4_REGION_ID		11
1588 #define	RSVD5_REGION_ID		12
1589 #define	RSVD6_REGION_ID		13
1590 #define	RSVD7_REGION_ID		14
1591 #define	DIAG_TRACE_REGION_ID	15
1592 #define	WWN_REGION_ID		16
1593 
1594 #define	DMP_VPD_REGION		14
1595 #define	DMP_VPD_SIZE		1024
1596 #define	DMP_VPD_DUMP_WCOUNT	24
1597 
1598 #define	DMP_FCOE_REGION		23
1599 #define	DMP_FCOE_DUMP_WCOUNT	256
1600 
1601 
1602 /* Structure for MB Command UPDATE_CFG */
1603 /* Good for SLI2/3 and SLI4 */
1604 
1605 typedef struct
1606 {
1607 #ifdef EMLXS_BIG_ENDIAN
1608 	uint32_t	rsvd2:16;
1609 	uint32_t	proc_type:8;
1610 	uint32_t	rsvd1:1;
1611 	uint32_t	Abit:1;
1612 	uint32_t	Obit:1;
1613 	uint32_t	Vbit:1;
1614 	uint32_t	req_type:4;
1615 #define	INIT_REGION	1
1616 #define	UPDATE_DATA	2
1617 #define	CLEAN_UP_CFG	3
1618 	uint32_t	entry_len:16;
1619 	uint32_t	region_id:16;
1620 #endif
1621 
1622 #ifdef EMLXS_LITTLE_ENDIAN
1623 	uint32_t	req_type:4;
1624 #define	INIT_REGION	1
1625 #define	UPDATE_DATA	2
1626 #define	CLEAN_UP_CFG	3
1627 	uint32_t	Vbit:1;
1628 	uint32_t	Obit:1;
1629 	uint32_t	Abit:1;
1630 	uint32_t	rsvd1:1;
1631 	uint32_t	proc_type:8;
1632 	uint32_t	rsvd2:16;
1633 
1634 	uint32_t	region_id:16;
1635 	uint32_t	entry_len:16;
1636 #endif
1637 
1638 	uint32_t	rsp_info;
1639 	uint32_t	byte_len;
1640 	uint32_t	cfg_data;
1641 } UPDATE_CFG_VAR;
1642 
1643 /* Structure for MB Command DEL_LD_ENTRY (29) */
1644 
1645 typedef struct
1646 {
1647 #ifdef EMLXS_LITTLE_ENDIAN
1648 	uint32_t	list_req:2;
1649 	uint32_t	list_rsp:2;
1650 	uint32_t	rsvd:28;
1651 #else
1652 	uint32_t	rsvd:28;
1653 	uint32_t	list_rsp:2;
1654 	uint32_t	list_req:2;
1655 #endif
1656 
1657 #define	FLASH_LOAD_LIST	1
1658 #define	RAM_LOAD_LIST	2
1659 #define	BOTH_LISTS	3
1660 
1661 	PROG_ID		prog_id;
1662 } DEL_LD_ENTRY_VAR;
1663 
1664 /* Structure for MB Command LOAD_AREA (81) */
1665 typedef struct
1666 {
1667 #ifdef EMLXS_LITTLE_ENDIAN
1668 	uint32_t	load_cmplt:1;
1669 	uint32_t	method:1;
1670 	uint32_t	rsvd1:1;
1671 	uint32_t	update_flash:1;
1672 	uint32_t	erase_or_prog:1;
1673 	uint32_t	version:1;
1674 	uint32_t	rsvd2:2;
1675 	uint32_t	progress:8;
1676 	uint32_t	step:8;
1677 	uint32_t	area_id:8;
1678 #else
1679 	uint32_t	area_id:8;
1680 	uint32_t	step:8;
1681 	uint32_t	progress:8;
1682 	uint32_t	rsvd2:2;
1683 	uint32_t	version:1;
1684 	uint32_t	erase_or_prog:1;
1685 	uint32_t	update_flash:1;
1686 	uint32_t	rsvd1:1;
1687 	uint32_t	method:1;
1688 	uint32_t	load_cmplt:1;
1689 #endif
1690 	uint32_t	dl_to_adr;
1691 	uint32_t	dl_len;
1692 	union
1693 	{
1694 		uint32_t	dl_from_slim_offset;
1695 		ULP_BDE		dl_from_bde;
1696 		ULP_BDE64	dl_from_bde64;
1697 		PROG_ID		prog_id;
1698 	} un;
1699 } LOAD_AREA_VAR;
1700 
1701 /* Structure for MB Command LOAD_EXP_ROM (9C) */
1702 typedef struct
1703 {
1704 #ifdef EMLXS_LITTLE_ENDIAN
1705 	uint32_t	rsvd1:8;
1706 	uint32_t	progress:8;
1707 	uint32_t	step:8;
1708 	uint32_t	rsvd2:8;
1709 #else
1710 	uint32_t	rsvd2:8;
1711 	uint32_t	step:8;
1712 	uint32_t	progress:8;
1713 	uint32_t	rsvd1:8;
1714 #endif
1715 	uint32_t	dl_to_adr;
1716 	uint32_t	rsvd3;
1717 	union
1718 	{
1719 		uint32_t	word[2];
1720 		PROG_ID		prog_id;
1721 	} un;
1722 } LOAD_EXP_ROM_VAR;
1723 
1724 
1725 /* Structure for MB Command CONFIG_HBQ (7C) */
1726 
1727 typedef struct
1728 {
1729 #ifdef EMLXS_BIG_ENDIAN
1730 	uint32_t	rsvd1:7;
1731 	uint32_t	recvNotify:1;	/* Receive Notification */
1732 	uint32_t	numMask:8;	/* # Mask Entries */
1733 	uint32_t	profile:8;	/* Selection Profile */
1734 	uint32_t	rsvd2:8;
1735 #endif
1736 #ifdef EMLXS_LITTLE_ENDIAN
1737 	uint32_t	rsvd2:8;
1738 	uint32_t	profile:8;	/* Selection Profile */
1739 	uint32_t	numMask:8;	/* # Mask Entries */
1740 	uint32_t	recvNotify:1;	/* Receive Notification */
1741 	uint32_t	rsvd1:7;
1742 #endif
1743 
1744 #ifdef EMLXS_BIG_ENDIAN
1745 	uint32_t	hbqId:16;
1746 	uint32_t	rsvd3:12;
1747 	uint32_t	ringMask:4;
1748 #endif
1749 #ifdef EMLXS_LITTLE_ENDIAN
1750 	uint32_t	ringMask:4;
1751 	uint32_t	rsvd3:12;
1752 	uint32_t	hbqId:16;
1753 #endif
1754 
1755 #ifdef EMLXS_BIG_ENDIAN
1756 	uint32_t	numEntries:16;
1757 	uint32_t	rsvd4:8;
1758 	uint32_t	headerLen:8;
1759 #endif
1760 #ifdef EMLXS_LITTLE_ENDIAN
1761 	uint32_t	headerLen:8;
1762 	uint32_t	rsvd4:8;
1763 	uint32_t	numEntries:16;
1764 #endif
1765 
1766 	uint32_t	hbqaddrLow;
1767 	uint32_t	hbqaddrHigh;
1768 
1769 #ifdef EMLXS_BIG_ENDIAN
1770 	uint32_t	rsvd5:31;
1771 	uint32_t	logEntry:1;
1772 #endif
1773 #ifdef EMLXS_LITTLE_ENDIAN
1774 	uint32_t	logEntry:1;
1775 	uint32_t	rsvd5:31;
1776 #endif
1777 
1778 	uint32_t	rsvd6;	/* w7 */
1779 	uint32_t	rsvd7;	/* w8 */
1780 	uint32_t	rsvd8;	/* w9 */
1781 
1782 	HBQ_MASK	hbqMasks[6];
1783 
1784 	union
1785 	{
1786 		uint32_t	allprofiles[12];
1787 
1788 		struct
1789 		{
1790 #ifdef EMLXS_BIG_ENDIAN
1791 			uint32_t	seqlenoff:16;
1792 			uint32_t	maxlen:16;
1793 #endif
1794 #ifdef EMLXS_LITTLE_ENDIAN
1795 			uint32_t	maxlen:16;
1796 			uint32_t	seqlenoff:16;
1797 #endif
1798 #ifdef EMLXS_BIG_ENDIAN
1799 			uint32_t	rsvd1:28;
1800 			uint32_t	seqlenbcnt:4;
1801 #endif
1802 #ifdef EMLXS_LITTLE_ENDIAN
1803 			uint32_t	seqlenbcnt:4;
1804 			uint32_t	rsvd1:28;
1805 #endif
1806 			uint32_t	rsvd[10];
1807 		} profile2;
1808 
1809 		struct
1810 		{
1811 #ifdef EMLXS_BIG_ENDIAN
1812 			uint32_t	seqlenoff:16;
1813 			uint32_t	maxlen:16;
1814 #endif
1815 #ifdef EMLXS_LITTLE_ENDIAN
1816 			uint32_t	maxlen:16;
1817 			uint32_t	seqlenoff:16;
1818 #endif
1819 #ifdef EMLXS_BIG_ENDIAN
1820 			uint32_t	cmdcodeoff:28;
1821 			uint32_t	rsvd1:12;
1822 			uint32_t	seqlenbcnt:4;
1823 #endif
1824 #ifdef EMLXS_LITTLE_ENDIAN
1825 			uint32_t	seqlenbcnt:4;
1826 			uint32_t	rsvd1:12;
1827 			uint32_t	cmdcodeoff:28;
1828 #endif
1829 			uint32_t	cmdmatch[8];
1830 
1831 			uint32_t	rsvd[2];
1832 		} profile3;
1833 
1834 		struct
1835 		{
1836 #ifdef EMLXS_BIG_ENDIAN
1837 			uint32_t	seqlenoff:16;
1838 			uint32_t	maxlen:16;
1839 #endif
1840 #ifdef EMLXS_LITTLE_ENDIAN
1841 			uint32_t	maxlen:16;
1842 			uint32_t	seqlenoff:16;
1843 #endif
1844 #ifdef EMLXS_BIG_ENDIAN
1845 			uint32_t	cmdcodeoff:28;
1846 			uint32_t	rsvd1:12;
1847 			uint32_t	seqlenbcnt:4;
1848 #endif
1849 #ifdef EMLXS_LITTLE_ENDIAN
1850 			uint32_t	seqlenbcnt:4;
1851 			uint32_t	rsvd1:12;
1852 			uint32_t	cmdcodeoff:28;
1853 #endif
1854 			uint32_t	cmdmatch[8];
1855 
1856 			uint32_t	rsvd[2];
1857 		} profile5;
1858 	} profiles;
1859 } CONFIG_HBQ_VAR;
1860 
1861 
1862 /* Structure for MB Command REG_VPI(0x96) */
1863 /* Good for SLI2/3 and SLI4 */
1864 
1865 typedef struct
1866 {
1867 #ifdef EMLXS_BIG_ENDIAN
1868 	uint32_t	rsvd1;
1869 	uint32_t	rsvd2:8;
1870 	uint32_t	sid:24;
1871 	uint32_t	rsvd3;
1872 	uint32_t	rsvd4;
1873 	uint32_t	rsvd5;
1874 	uint16_t	vfi;
1875 	uint16_t	vpi;
1876 #endif
1877 #ifdef EMLXS_LITTLE_ENDIAN
1878 	uint32_t	rsvd1;
1879 	uint32_t	sid:24;
1880 	uint32_t	rsvd2:8;
1881 	uint32_t	rsvd3;
1882 	uint32_t	rsvd4;
1883 	uint32_t	rsvd5;
1884 	uint16_t	vpi;
1885 	uint16_t	vfi;
1886 #endif
1887 } REG_VPI_VAR;
1888 
1889 /* Structure for MB Command INIT_VPI(0xA3) */
1890 /* Good for SLI4 only */
1891 
1892 typedef struct
1893 {
1894 #ifdef EMLXS_BIG_ENDIAN
1895 	uint16_t	vfi;
1896 	uint16_t	vpi;
1897 #endif
1898 #ifdef EMLXS_LITTLE_ENDIAN
1899 	uint16_t	vpi;
1900 	uint16_t	vfi;
1901 #endif
1902 } INIT_VPI_VAR;
1903 
1904 /* Structure for MB Command UNREG_VPI (0x97) */
1905 /* Good for SLI2/3 and SLI4 */
1906 
1907 typedef struct
1908 {
1909 	uint32_t	rsvd1;
1910 #ifdef EMLXS_BIG_ENDIAN
1911 	uint16_t	rsvd2;
1912 	uint16_t	vpi;
1913 #endif
1914 #ifdef EMLXS_LITTLE_ENDIAN
1915 	uint16_t	vpi;
1916 	uint16_t	rsvd2;
1917 #endif
1918 } UNREG_VPI_VAR;
1919 
1920 /* Structure for MB Command REG_VFI(0x9F) */
1921 /* Good for SLI4 only */
1922 
1923 typedef struct
1924 {
1925 #ifdef EMLXS_BIG_ENDIAN
1926 	uint32_t	rsvd1:3;
1927 	uint32_t	vp:1;
1928 	uint32_t	rsvd2:12;
1929 	uint16_t	vfi;
1930 
1931 	uint16_t	vpi;
1932 	uint16_t	fcfi;
1933 
1934 	uint32_t	rsvd3;
1935 	uint32_t	rsvd4;
1936 
1937 	ULP_BDE64	bde;
1938 
1939 /* CHANGE with next firmware drop */
1940 	uint32_t	edtov;
1941 	uint32_t	ratov;
1942 
1943 	uint32_t	rsvd5:8;
1944 	uint32_t	sid:24;
1945 #endif
1946 #ifdef EMLXS_LITTLE_ENDIAN
1947 	uint16_t	vfi;
1948 	uint32_t	rsvd2:12;
1949 	uint32_t	vp:1;
1950 	uint32_t	rsvd1:3;
1951 
1952 	uint16_t	fcfi;
1953 	uint16_t	vpi;
1954 
1955 	uint32_t	rsvd3;
1956 	uint32_t	rsvd4;
1957 
1958 	ULP_BDE64	bde;
1959 
1960 /* CHANGE with next firmware drop */
1961 	uint32_t	edtov;
1962 	uint32_t	ratov;
1963 
1964 	uint32_t	sid:24;
1965 	uint32_t	rsvd5:8;
1966 #endif
1967 } REG_VFI_VAR;
1968 
1969 /* Structure for MB Command INIT_VFI(0xA4) */
1970 /* Good for SLI4 only */
1971 
1972 typedef struct
1973 {
1974 #ifdef EMLXS_BIG_ENDIAN
1975 	uint32_t	vr:1;
1976 	uint32_t	vt:1;
1977 	uint32_t	vf:1;
1978 	uint32_t	rsvd1:13;
1979 	uint32_t	vfi:16;
1980 
1981 	uint16_t	rsvd2;
1982 	uint16_t	fcfi;
1983 
1984 	uint32_t	rsvd3:16;
1985 	uint32_t	pri:3;
1986 	uint32_t	vf_id:12;
1987 	uint32_t	rsvd4:1;
1988 
1989 	uint32_t	hop_count:8;
1990 	uint32_t	rsvd5:24;
1991 #endif
1992 #ifdef EMLXS_LITTLE_ENDIAN
1993 	uint32_t	vfi:16;
1994 	uint32_t	rsvd1:13;
1995 	uint32_t	vf:1;
1996 	uint32_t	vt:1;
1997 	uint32_t	vr:1;
1998 
1999 	uint16_t	fcfi;
2000 	uint16_t	rsvd2;
2001 
2002 	uint32_t	rsvd4:1;
2003 	uint32_t	vf_id:12;
2004 	uint32_t	pri:3;
2005 	uint32_t	rsvd3:16;
2006 
2007 	uint32_t	rsvd5:24;
2008 	uint32_t	hop_count:8;
2009 #endif
2010 } INIT_VFI_VAR;
2011 
2012 /* Structure for MB Command UNREG_VFI (0xA1) */
2013 /* Good for SLI4 only */
2014 
2015 typedef struct
2016 {
2017 #ifdef EMLXS_BIG_ENDIAN
2018 	uint32_t	rsvd1:3;
2019 	uint32_t	vp:1;
2020 	uint32_t	rsvd2:28;
2021 
2022 	uint16_t	vpi;
2023 	uint16_t	vfi;
2024 #endif
2025 #ifdef EMLXS_LITTLE_ENDIAN
2026 	uint32_t	rsvd2:28;
2027 	uint32_t	vp:1;
2028 	uint32_t	rsvd1:3;
2029 
2030 	uint16_t	vfi;
2031 	uint16_t	vpi;
2032 #endif
2033 } UNREG_VFI_VAR;
2034 
2035 
2036 
2037 typedef struct
2038 {
2039 #ifdef EMLXS_BIG_ENDIAN
2040 	uint32_t	read_log:1;
2041 	uint32_t	clear_log:1;
2042 	uint32_t	mbox_rsp:1;
2043 	uint32_t	resv:28;
2044 #endif
2045 #ifdef EMLXS_LITTLE_ENDIAN
2046 	uint32_t	resv:28;
2047 	uint32_t	mbox_rsp:1;
2048 	uint32_t	clear_log:1;
2049 	uint32_t	read_log:1;
2050 #endif
2051 
2052 	uint32_t	offset;
2053 
2054 	union
2055 	{
2056 		ULP_BDE		sp;
2057 		ULP_BDE64	sp64;
2058 	} un;
2059 } READ_EVT_LOG_VAR;
2060 
2061 typedef struct
2062 {
2063 
2064 #ifdef EMLXS_BIG_ENDIAN
2065 	uint16_t	split_log_next;
2066 	uint16_t	log_next;
2067 
2068 	uint32_t	size;
2069 
2070 	uint32_t	format:8;
2071 	uint32_t	resv2:22;
2072 	uint32_t	log_level:1;
2073 	uint32_t	split_log:1;
2074 #endif
2075 #ifdef EMLXS_LITTLE_ENDIAN
2076 	uint16_t	log_next;
2077 	uint16_t	split_log_next;
2078 
2079 	uint32_t	size;
2080 
2081 	uint32_t	split_log:1;
2082 	uint32_t	log_level:1;
2083 	uint32_t	resv2:22;
2084 	uint32_t	format:8;
2085 #endif
2086 
2087 	uint32_t	offset;
2088 } LOG_STATUS_VAR;
2089 
2090 
2091 /* Structure for MB Command CONFIG_PORT (0x88) */
2092 typedef struct
2093 {
2094 #ifdef EMLXS_BIG_ENDIAN
2095 	uint32_t	cBE:1;
2096 	uint32_t	cET:1;
2097 	uint32_t	cHpcb:1;
2098 	uint32_t	rMA:1;
2099 	uint32_t	sli_mode:4;
2100 	uint32_t	pcbLen:24;	/* bit 23:0 of memory based port */
2101 					/* config block */
2102 #endif
2103 #ifdef EMLXS_LITTLE_ENDIAN
2104 	uint32_t	pcbLen:24;	/* bit 23:0 of memory based port */
2105 					/* config block */
2106 	uint32_t	sli_mode:4;
2107 	uint32_t	rMA:1;
2108 	uint32_t	cHpcb:1;
2109 	uint32_t	cET:1;
2110 	uint32_t	cBE:1;
2111 #endif
2112 
2113 	uint32_t	pcbLow;		/* bit 31:0 of memory based port */
2114 					/* config block */
2115 	uint32_t	pcbHigh; 	/* bit 63:32 of memory based port */
2116 					/* config block */
2117 	uint32_t	hbainit[5];
2118 
2119 #ifdef EMLXS_BIG_ENDIAN
2120 	uint32_t	hps:1; /* Host pointers in SLIM */
2121 	uint32_t	rsvd:31;
2122 #endif
2123 #ifdef EMLXS_LITTLE_ENDIAN
2124 	uint32_t	rsvd:31;
2125 	uint32_t	hps:1; /* Host pointers in SLIM */
2126 #endif
2127 
2128 #ifdef EMLXS_BIG_ENDIAN
2129 	uint32_t	rsvd1:24;
2130 	uint32_t	cmv:1;		/* Configure Max VPIs */
2131 	uint32_t	ccrp:1;		/* Config Command Ring Polling */
2132 	uint32_t	csah:1;		/* Configure Synchronous Abort */
2133 					/* Handling */
2134 	uint32_t	chbs:1;		/* Cofigure Host Backing store */
2135 	uint32_t	cinb:1;		/* Enable Interrupt Notification */
2136 					/* Block */
2137 	uint32_t	cerbm:1;	/* Configure Enhanced Receive */
2138 					/* Buffer Management */
2139 	uint32_t	cmx:1;		/* Configure Max XRIs */
2140 	uint32_t	cmr:1;		/* Configure Max RPIs */
2141 #endif
2142 #ifdef EMLXS_LITTLE_ENDIAN
2143 	uint32_t	cmr:1;		/* Configure Max RPIs */
2144 	uint32_t	cmx:1;		/* Configure Max XRIs */
2145 	uint32_t	cerbm:1;	/* Configure Enhanced Receive */
2146 					/* Buffer Management */
2147 	uint32_t	cinb:1;		/* Enable Interrupt Notification */
2148 					/* Block */
2149 	uint32_t	chbs:1;		/* Cofigure Host Backing store */
2150 	uint32_t	csah:1;		/* Configure Synchronous Abort */
2151 					/* Handling */
2152 	uint32_t	ccrp:1;		/* Config Command Ring Polling */
2153 	uint32_t	cmv:1;		/* Configure Max VPIs */
2154 	uint32_t	rsvd1:24;
2155 #endif
2156 #ifdef EMLXS_BIG_ENDIAN
2157 	uint32_t	rsvd2:24;
2158 	uint32_t	gmv:1;		/* Grant Max VPIs */
2159 	uint32_t	gcrp:1;		/* Grant Command Ring Polling */
2160 	uint32_t	gsah:1;		/* Grant Synchronous Abort Handling */
2161 	uint32_t	ghbs:1;		/* Grant Host Backing Store */
2162 	uint32_t	ginb:1;		/* Grant Interrupt Notification Block */
2163 	uint32_t	gerbm:1;	/* Grant ERBM Request */
2164 	uint32_t	gmx:1;		/* Grant Max XRIs */
2165 	uint32_t	gmr:1;		/* Grant Max RPIs */
2166 #endif
2167 #ifdef EMLXS_LITTLE_ENDIAN
2168 	uint32_t	gmr:1;		/* Grant Max RPIs */
2169 	uint32_t	gmx:1;		/* Grant Max XRIs */
2170 	uint32_t	gerbm:1;	/* Grant ERBM Request */
2171 	uint32_t	ginb:1;		/* Grant Interrupt Notification Block */
2172 	uint32_t	ghbs:1;		/* Grant Host Backing Store */
2173 	uint32_t	gsah:1;		/* Grant Synchronous Abort Handling */
2174 	uint32_t	gcrp:1;		/* Grant Command Ring Polling */
2175 	uint32_t	gmv:1;		/* Grant Max VPIs */
2176 	uint32_t	rsvd2:24;
2177 #endif
2178 
2179 #ifdef EMLXS_BIG_ENDIAN
2180 	uint32_t	max_rpi:16;	/* Max RPIs Port should configure */
2181 	uint32_t	max_xri:16;	/* Max XRIs Port should configure */
2182 #endif
2183 #ifdef EMLXS_LITTLE_ENDIAN
2184 	uint32_t	max_xri:16;	/* Max XRIs Port should configure */
2185 	uint32_t	max_rpi:16;	/* Max RPIs Port should configure */
2186 #endif
2187 
2188 #ifdef EMLXS_BIG_ENDIAN
2189 	uint32_t	max_hbq:16;	/* Max HBQs Host expect to configure */
2190 	uint32_t	rsvd3:16;	/* Max HBQs Host expect to configure */
2191 #endif
2192 #ifdef EMLXS_LITTLE_ENDIAN
2193 	uint32_t	rsvd3:16;	/* Max HBQs Host expect to configure */
2194 	uint32_t	max_hbq:16;	/* Max HBQs Host expect to configure */
2195 #endif
2196 
2197 	uint32_t	rsvd4;	/* Reserved */
2198 
2199 #ifdef EMLXS_BIG_ENDIAN
2200 	uint32_t	rsvd5:16;	/* Reserved */
2201 	uint32_t	vpi_max:16;	/* Max number of virt N-Ports */
2202 #endif
2203 #ifdef EMLXS_LITTLE_ENDIAN
2204 	uint32_t	vpi_max:16;	/* Max number of virt N-Ports */
2205 	uint32_t	rsvd5:16;	/* Reserved */
2206 #endif
2207 } CONFIG_PORT_VAR;
2208 
2209 /* Structure for MB Command REQUEST_FEATURES (0x9D) */
2210 /* Good for SLI4 only */
2211 
2212 typedef struct
2213 {
2214 #ifdef EMLXS_BIG_ENDIAN
2215 	uint32_t	rsvd1:31;
2216 	uint32_t	QueryMode:1;
2217 #endif
2218 #ifdef EMLXS_LITTLE_ENDIAN
2219 	uint32_t	QueryMode:1;
2220 	uint32_t	rsvd1:31;
2221 #endif
2222 
2223 	uint32_t	featuresRequested;
2224 	uint32_t	featuresEnabled;
2225 
2226 } REQUEST_FEATURES_VAR;
2227 
2228 #define	SLI4_FEATURE_INHIBIT_AUTO_ABTS	0x0001
2229 #define	SLI4_FEATURE_NPIV		0x0002
2230 #define	SLI4_FEATURE_DIF		0x0004
2231 #define	SLI4_FEATURE_VIRTUAL_FABRICS	0x0008
2232 #define	SLI4_FEATURE_FCP_INITIATOR	0x0010
2233 #define	SLI4_FEATURE_FCP_TARGET		0x0020
2234 #define	SLI4_FEATURE_FCP_COMBO		0x0040
2235 #define	SLI4_FEATURE_INHIBIT_FIP	0x0080
2236 
2237 
2238 /* SLI-2 Port Control Block */
2239 
2240 /* SLIM POINTER */
2241 #define	SLIMOFF	0x30	/* WORD */
2242 
2243 typedef struct _SLI2_RDSC
2244 {
2245 	uint32_t	cmdEntries;
2246 	uint32_t	cmdAddrLow;
2247 	uint32_t	cmdAddrHigh;
2248 
2249 	uint32_t	rspEntries;
2250 	uint32_t	rspAddrLow;
2251 	uint32_t	rspAddrHigh;
2252 } SLI2_RDSC;
2253 
2254 typedef struct _PCB
2255 {
2256 #ifdef EMLXS_BIG_ENDIAN
2257 	uint32_t	type:8;
2258 #define	TYPE_NATIVE_SLI2	0x01;
2259 	uint32_t	feature:8;
2260 #define	FEATURE_INITIAL_SLI2	0x01;
2261 	uint32_t	rsvd:12;
2262 	uint32_t	maxRing:4;
2263 #endif
2264 #ifdef EMLXS_LITTLE_ENDIAN
2265 	uint32_t	maxRing:4;
2266 	uint32_t	rsvd:12;
2267 	uint32_t	feature:8;
2268 #define	FEATURE_INITIAL_SLI2	0x01;
2269 	uint32_t	type:8;
2270 #define	TYPE_NATIVE_SLI2	0x01;
2271 #endif
2272 
2273 	uint32_t	mailBoxSize;
2274 	uint32_t	mbAddrLow;
2275 	uint32_t	mbAddrHigh;
2276 
2277 	uint32_t	hgpAddrLow;
2278 	uint32_t	hgpAddrHigh;
2279 
2280 	uint32_t	pgpAddrLow;
2281 	uint32_t	pgpAddrHigh;
2282 	SLI2_RDSC	rdsc[MAX_RINGS_AVAILABLE];
2283 } PCB;
2284 
2285 /* NEW_FEATURE */
2286 typedef struct
2287 {
2288 #ifdef EMLXS_BIG_ENDIAN
2289 	uint32_t	rsvd0:27;
2290 	uint32_t	discardFarp:1;
2291 	uint32_t	IPEnable:1;
2292 	uint32_t	nodeName:1;
2293 	uint32_t	portName:1;
2294 	uint32_t	filterEnable:1;
2295 #endif
2296 #ifdef EMLXS_LITTLE_ENDIAN
2297 	uint32_t	filterEnable:1;
2298 	uint32_t	portName:1;
2299 	uint32_t	nodeName:1;
2300 	uint32_t	IPEnable:1;
2301 	uint32_t	discardFarp:1;
2302 	uint32_t	rsvd:27;
2303 #endif
2304 	NAME_TYPE	portname;
2305 	NAME_TYPE	nodename;
2306 	uint32_t	rsvd1;
2307 	uint32_t	rsvd2;
2308 	uint32_t	rsvd3;
2309 	uint32_t	IPAddress;
2310 } CONFIG_FARP_VAR;
2311 
2312 
2313 /* NEW_FEATURE */
2314 typedef struct
2315 {
2316 #ifdef EMLXS_BIG_ENDIAN
2317 	uint32_t	defaultMessageNumber:16;
2318 	uint32_t	rsvd1:3;
2319 	uint32_t	nid:5;
2320 	uint32_t	rsvd2:5;
2321 	uint32_t	defaultPresent:1;
2322 	uint32_t	addAssociations:1;
2323 	uint32_t	reportAssociations:1;
2324 #endif
2325 #ifdef EMLXS_LITTLE_ENDIAN
2326 	uint32_t	reportAssociations:1;
2327 	uint32_t	addAssociations:1;
2328 	uint32_t	defaultPresent:1;
2329 	uint32_t	rsvd2:5;
2330 	uint32_t	nid:5;
2331 	uint32_t	rsvd1:3;
2332 	uint32_t	defaultMessageNumber:16;
2333 #endif
2334 	uint32_t	attConditions;
2335 	uint8_t		attentionId[16];
2336 	uint16_t	messageNumberByHA[32];
2337 	uint16_t	messageNumberByID[16];
2338 	uint32_t	rsvd3;
2339 } CONFIG_MSI_VAR;
2340 
2341 
2342 /* NEW_FEATURE */
2343 typedef struct
2344 {
2345 #ifdef EMLXS_BIG_ENDIAN
2346 	uint32_t	defaultMessageNumber:8;
2347 	uint32_t	rsvd1:11;
2348 	uint32_t	nid:5;
2349 	uint32_t	rsvd2:5;
2350 	uint32_t	defaultPresent:1;
2351 	uint32_t	addAssociations:1;
2352 	uint32_t	reportAssociations:1;
2353 #endif
2354 #ifdef EMLXS_LITTLE_ENDIAN
2355 	uint32_t	reportAssociations:1;
2356 	uint32_t	addAssociations:1;
2357 	uint32_t	defaultPresent:1;
2358 	uint32_t	rsvd2:5;
2359 	uint32_t	nid:5;
2360 	uint32_t	rsvd1:11;
2361 	uint32_t	defaultMessageNumber:8;
2362 #endif
2363 	uint32_t	attConditions1;
2364 	uint32_t	attConditions2;
2365 	uint8_t		attentionId[16];
2366 	uint8_t		messageNumberByHA[64];
2367 	uint8_t		messageNumberByID[16];
2368 	uint32_t	autoClearByHA1;
2369 	uint32_t	autoClearByHA2;
2370 	uint32_t	autoClearByID;
2371 	uint32_t	resv3;
2372 } CONFIG_MSIX_VAR;
2373 
2374 
2375 /* Union of all Mailbox Command types */
2376 
2377 typedef union
2378 {
2379 	uint32_t		varWords[31];
2380 	LOAD_SM_VAR		varLdSM;	/* cmd =  1 (LOAD_SM) */
2381 	READ_NV_VAR		varRDnvp;	/* cmd =  2 (READ_NVPARMS) */
2382 	WRITE_NV_VAR		varWTnvp;	/* cmd =  3 (WRITE_NVPARMS) */
2383 	BIU_DIAG_VAR		varBIUdiag;	/* cmd =  4 (RUN_BIU_DIAG) */
2384 	INIT_LINK_VAR		varInitLnk;	/* cmd =  5 (INIT_LINK) */
2385 	DOWN_LINK_VAR		varDwnLnk;	/* cmd =  6 (DOWN_LINK) */
2386 	CONFIG_LINK		varCfgLnk;	/* cmd =  7 (CONFIG_LINK) */
2387 	PART_SLIM_VAR		varSlim;	/* cmd =  8 (PART_SLIM) */
2388 	CONFIG_RING_VAR		varCfgRing;	/* cmd =  9 (CONFIG_RING) */
2389 	RESET_RING_VAR		varRstRing;	/* cmd = 10 (RESET_RING) */
2390 	READ_CONFIG_VAR		varRdConfig;	/* cmd = 11 (READ_CONFIG) */
2391 	READ_RCONF_VAR		varRdRConfig;	/* cmd = 12 (READ_RCONFIG) */
2392 	READ_SPARM_VAR		varRdSparm;	/* cmd = 13 (READ_SPARM(64)) */
2393 	READ_STATUS_VAR		varRdStatus;	/* cmd = 14 (READ_STATUS) */
2394 	READ_RPI_VAR		varRdRPI;	/* cmd = 15 (READ_RPI(64)) */
2395 	READ_XRI_VAR		varRdXRI;	/* cmd = 16 (READ_XRI) */
2396 	READ_REV_VAR		varRdRev;	/* cmd = 17 (READ_REV) */
2397 	READ_LNK_VAR		varRdLnk;	/* cmd = 18 (READ_LNK_STAT) */
2398 	REG_LOGIN_VAR		varRegLogin;	/* cmd = 19 (REG_LOGIN(64)) */
2399 	UNREG_LOGIN_VAR		varUnregLogin;	/* cmd = 20 (UNREG_LOGIN) */
2400 	READ_LA_VAR		varReadLA;	/* cmd = 21 (READ_LA(64)) */
2401 	CLEAR_LA_VAR		varClearLA;	/* cmd = 22 (CLEAR_LA) */
2402 	DUMP_VAR		varDmp;		/* Warm Start DUMP mbx cmd */
2403 	UPDATE_CFG_VAR		varUpdateCfg;	/* cmd = 0x1b Warm Start */
2404 						/* UPDATE_CFG cmd */
2405 	DEL_LD_ENTRY_VAR	varDelLdEntry;	/* cmd = 0x1d (DEL_LD_ENTRY) */
2406 	UNREG_D_ID_VAR		varUnregDID;	/* cmd = 0x23 (UNREG_D_ID) */
2407 	CONFIG_FARP_VAR		varCfgFarp;	/* cmd = 0x25 (CONFIG_FARP) */
2408 	CONFIG_MSI_VAR		varCfgMSI;	/* cmd = 0x90 (CONFIG_MSI) */
2409 	CONFIG_MSIX_VAR		varCfgMSIX;	/* cmd = 0x30 (CONFIG_MSIX) */
2410 	CONFIG_HBQ_VAR		varCfgHbq;	/* cmd = 0x7C (CONFIG_HBQ) */
2411 	LOAD_AREA_VAR		varLdArea;	/* cmd = 0x81 (LOAD_AREA) */
2412 	CONFIG_PORT_VAR		varCfgPort;	/* cmd = 0x88 (CONFIG_PORT) */
2413 	LOAD_EXP_ROM_VAR	varLdExpRom;	/* cmd = 0x9C (LOAD_XP_ROM) */
2414 	REG_VPI_VAR		varRegVpi;	/* cmd = 0x96 (REG_VPI) */
2415 	UNREG_VPI_VAR		varUnregVpi;	/* cmd = 0x97 (UNREG_VPI) */
2416 	READ_EVT_LOG_VAR	varRdEvtLog;	/* cmd = 0x38 (READ_EVT_LOG) */
2417 	LOG_STATUS_VAR		varLogStat;	/* cmd = 0x37 */
2418 
2419 } MAILVARIANTS;
2420 
2421 #define	MAILBOX_CMD_BSIZE	128
2422 #define	MAILBOX_CMD_WSIZE	32
2423 
2424 /*
2425  * SLI-2 specific structures
2426  */
2427 
2428 typedef struct _SLI1_DESC
2429 {
2430 	emlxs_rings_t	mbxCring[4];
2431 	uint32_t	mbxUnused[24];
2432 } SLI1_DESC; /* 128 bytes */
2433 
2434 typedef struct
2435 {
2436 	uint32_t	cmdPutInx;
2437 	uint32_t	rspGetInx;
2438 } HGP;
2439 
2440 typedef struct
2441 {
2442 	uint32_t	cmdGetInx;
2443 	uint32_t	rspPutInx;
2444 } PGP;
2445 
2446 typedef struct _SLI2_DESC
2447 {
2448 	HGP		host[4];
2449 	PGP		port[4];
2450 	uint32_t	HBQ_PortGetIdx[16];
2451 } SLI2_DESC; /* 128 bytes */
2452 
2453 typedef union
2454 {
2455 	SLI1_DESC	s1;	/* 32 words, 128 bytes */
2456 	SLI2_DESC	s2;	/* 32 words, 128 bytes */
2457 } SLI_VAR;
2458 
2459 typedef volatile struct
2460 {
2461 #ifdef EMLXS_BIG_ENDIAN
2462 	uint16_t	mbxStatus;
2463 	uint8_t		mbxCommand;
2464 	uint8_t		mbxReserved:6;
2465 	uint8_t		mbxHc:1;
2466 	uint8_t		mbxOwner:1;	/* Low order bit first word */
2467 #endif
2468 #ifdef EMLXS_LITTLE_ENDIAN
2469 	uint8_t		mbxOwner:1;	/* Low order bit first word */
2470 	uint8_t		mbxHc:1;
2471 	uint8_t		mbxReserved:6;
2472 	uint8_t		mbxCommand;
2473 	uint16_t	mbxStatus;
2474 #endif
2475 	MAILVARIANTS	un;		/* 124 bytes */
2476 	SLI_VAR		us;		/* 128 bytes */
2477 } MAILBOX;				/* 256 bytes */
2478 
2479 
2480 
2481 /* SLI4 IOCTL Mailbox */
2482 /* ALL SLI4 specific mbox commands have a standard request /response header */
2483 /* Word 0 is just like SLI 3 */
2484 
2485 typedef struct mbox_req_hdr
2486 {
2487 #ifdef EMLXS_BIG_ENDIAN
2488 	uint32_t	domain:8;		/* word 6 */
2489 	uint32_t	port:8;
2490 	uint32_t	subsystem:8;
2491 	uint32_t	opcode:8;
2492 #endif
2493 #ifdef EMLXS_LITTLE_ENDIAN
2494 	uint32_t	opcode:8;
2495 	uint32_t	subsystem:8;
2496 	uint32_t	port:8;
2497 	uint32_t	domain:8;		/* word 6 */
2498 #endif
2499 	uint32_t	timeout;		/* word 7 */
2500 	uint32_t	req_length;		/* word 8 */
2501 	uint32_t	reserved1;		/* word 9 */
2502 } mbox_req_hdr_t;
2503 
2504 typedef struct mbox_rsp_hdr
2505 {
2506 #ifdef EMLXS_BIG_ENDIAN
2507 	uint32_t	domain:8;		/* word 6 */
2508 	uint32_t	reserved1:8;
2509 	uint32_t	subsystem:8;
2510 	uint32_t	opcode:8;
2511 
2512 	uint32_t	reserved2:16;		/* word 7 */
2513 	uint32_t	extra_status:8;
2514 	uint32_t	status:8;
2515 #endif
2516 #ifdef EMLXS_LITTLE_ENDIAN
2517 	uint32_t	opcode:8;
2518 	uint32_t	subsystem:8;
2519 	uint32_t	reserved1:8;
2520 	uint32_t	domain:8;		/* word 6 */
2521 
2522 	uint32_t	status:8;
2523 	uint32_t	extra_status:8;
2524 	uint32_t	reserved2:16;		/* word 7 */
2525 #endif
2526 	uint32_t	rsp_length;		/* word 8 */
2527 	uint32_t	allocated_length;	/* word 9 */
2528 } mbox_rsp_hdr_t;
2529 
2530 typedef struct be_req_hdr
2531 {
2532 #ifdef EMLXS_BIG_ENDIAN
2533 	uint32_t	special:8;		/* word 1 */
2534 	uint32_t	reserved2:16;		/* word 1 */
2535 	uint32_t	sge_cnt:5;		/* word 1 */
2536 	uint32_t	reserved1:2;		/* word 1 */
2537 	uint32_t	embedded:1;		/* word 1 */
2538 #endif
2539 #ifdef EMLXS_LITTLE_ENDIAN
2540 	uint32_t	embedded:1;		/* word 1 */
2541 	uint32_t	reserved1:2;		/* word 1 */
2542 	uint32_t	sge_cnt:5;		/* word 1 */
2543 	uint32_t	reserved2:16;		/* word 1 */
2544 	uint32_t	special:8;		/* word 1 */
2545 #endif
2546 	uint32_t	payload_length;		/* word 2 */
2547 	uint32_t	tag_low;		/* word 3 */
2548 	uint32_t	tag_hi;			/* word 4 */
2549 	uint32_t	reserved3;		/* word 5 */
2550 	union
2551 	{
2552 		mbox_req_hdr_t	hdr_req;
2553 		mbox_rsp_hdr_t	hdr_rsp;
2554 	} un_hdr;
2555 } be_req_hdr_t;
2556 
2557 #define	EMLXS_MAX_NONEMBED_SIZE		(1024 * 64)
2558 
2559 /* SLI_CONFIG Mailbox commands */
2560 
2561 #define	IOCTL_SUBSYSTEM_COMMON			0x01
2562 #define	IOCTL_SUBSYSTEM_FCOE			0x0C
2563 #define	IOCTL_SUBSYSTEM_DCBX			0x10
2564 
2565 #define	COMMON_OPCODE_READ_FLASHROM		0x06
2566 #define	COMMON_OPCODE_WRITE_FLASHROM		0x07
2567 #define	COMMON_OPCODE_CQ_CREATE			0x0C
2568 #define	COMMON_OPCODE_EQ_CREATE			0x0D
2569 #define	COMMON_OPCODE_MQ_CREATE 		0x15
2570 #define	COMMON_OPCODE_GET_CNTL_ATTRIB		0x20
2571 #define	COMMON_OPCODE_NOP			0x21
2572 #define	COMMON_OPCODE_QUERY_FIRMWARE_CONFIG	0x3A
2573 #define	COMMON_OPCODE_RESET			0x3D
2574 #define	COMMON_OPCODE_MANAGE_FAT		0x44
2575 
2576 #define	FCOE_OPCODE_WQ_CREATE			0x01
2577 #define	FCOE_OPCODE_CFG_POST_SGL_PAGES		0x03
2578 #define	FCOE_OPCODE_RQ_CREATE			0x05
2579 #define	FCOE_OPCODE_READ_FCF_TABLE		0x08
2580 #define	FCOE_OPCODE_ADD_FCF_TABLE		0x09
2581 #define	FCOE_OPCODE_POST_HDR_TEMPLATES		0x0B
2582 
2583 #define	DCBX_OPCODE_GET_DCBX_MODE		0x04
2584 #define	DCBX_OPCODE_SET_DCBX_MODE		0x05
2585 
2586 typedef	struct
2587 {
2588 	struct
2589 	{
2590 		uint32_t opcode;
2591 #define	MGMT_FLASHROM_OPCODE_FLASH		1
2592 #define	MGMT_FLASHROM_OPCODE_SAVE		2
2593 #define	MGMT_FLASHROM_OPCODE_CLEAR		3
2594 #define	MGMT_FLASHROM_OPCODE_REPORT		4
2595 #define	MGMT_FLASHROM_OPCODE_INFO		5
2596 #define	MGMT_FLASHROM_OPCODE_CRC		6
2597 
2598 		uint32_t optype;
2599 #define	MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE	0
2600 #define	MGMT_FLASHROM_OPTYPE_REDBOOT		1
2601 #define	MGMT_FLASHROM_OPTYPE_ISCSI_BIOS		2
2602 #define	MGMT_FLASHROM_OPTYPE_PXE_BIOS		3
2603 #define	MGMT_FLASHROM_OPTYPE_CTRLS		4
2604 #define	MGMT_FLASHROM_OPTYPE_CFG_IPSEC		5
2605 #define	MGMT_FLASHROM_OPTYPE_CFG_INI		6
2606 #define	MGMT_FLASHROM_OPTYPE_ROM_OFFSET		7
2607 #define	MGMT_FLASHROM_OPTYPE_FCOE_BIOS		8
2608 #define	MGMT_FLASHROM_OPTYPE_ISCSI_BACKUP	9
2609 #define	MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE	10
2610 #define	MGMT_FLASHROM_OPTYPE_FCOE_BACKUP	11
2611 #define	MGMT_FLASHROM_OPTYPE_CTRLP		12
2612 
2613 		uint32_t data_buffer_size; /* Align to 4KB */
2614 		uint32_t offset;
2615 		uint32_t data_buffer; /* image starts here */
2616 
2617 	} params;
2618 
2619 } IOCTL_COMMON_FLASHROM;
2620 
2621 
2622 typedef	struct
2623 {
2624 	union
2625 	{
2626 		struct
2627 		{
2628 			uint32_t fat_operation;
2629 #define	RETRIEVE_FAT		0
2630 #define	QUERY_FAT		1
2631 #define	CLEAR_FAT		2
2632 
2633 			uint32_t read_log_offset;
2634 			uint32_t read_log_length;
2635 			uint32_t data_buffer_size;
2636 			uint32_t data_buffer;
2637 		} request;
2638 
2639 		struct
2640 		{
2641 			uint32_t log_size;
2642 			uint32_t read_log_length;
2643 			uint32_t rsvd0;
2644 			uint32_t rsvd1;
2645 			uint32_t data_buffer;
2646 		} response;
2647 
2648 	} params;
2649 
2650 } IOCTL_COMMON_MANAGE_FAT;
2651 
2652 
2653 /* IOCTL_COMMON_QUERY_FIRMWARE_CONFIG */
2654 typedef struct _BE_FW_CFG
2655 {
2656 	uint32_t	BEConfigNumber;
2657 	uint32_t	ASICRevision;
2658 	uint32_t	PhysicalPort;
2659 	uint32_t	FunctionMode;
2660 	uint32_t	ULPMode;
2661 
2662 } BE_FW_CFG;
2663 
2664 typedef	struct _IOCTL_COMMON_QUERY_FIRMWARE_CONFIG
2665 {
2666 	union
2667 	{
2668 		struct
2669 		{
2670 			uint32_t	rsvd0;
2671 		} request;
2672 
2673 		BE_FW_CFG	response;
2674 
2675 	}	params;
2676 
2677 } IOCTL_COMMON_QUERY_FIRMWARE_CONFIG;
2678 
2679 
2680 
2681 /* IOCTL_FCOE_READ_FCF_TABLE */
2682 typedef struct
2683 {
2684 	uint32_t	max_recv_size;
2685 	uint32_t	fka_adv_period;
2686 	uint32_t	fip_priority;
2687 
2688 #ifdef EMLXS_BIG_ENDIAN
2689 	uint8_t		fcf_mac_address_hi[4];
2690 
2691 	uint8_t		mac_address_provider;
2692 	uint8_t		fcf_available;
2693 	uint8_t		fcf_mac_address_low[2];
2694 
2695 	uint8_t		fabric_name_identifier[8];
2696 
2697 	uint8_t		fcf_valid;
2698 	uint8_t		fc_map[3];
2699 
2700 	uint16_t	fcf_state;
2701 	uint16_t	fcf_index;
2702 #endif
2703 #ifdef EMLXS_LITTLE_ENDIAN
2704 	uint8_t		fcf_mac_address_hi[4];
2705 
2706 	uint8_t		fcf_mac_address_low[2];
2707 	uint8_t		fcf_available;
2708 	uint8_t		mac_address_provider;
2709 
2710 	uint8_t		fabric_name_identifier[8];
2711 
2712 	uint8_t		fc_map[3];
2713 	uint8_t		fcf_valid;
2714 
2715 	uint16_t	fcf_index;
2716 	uint16_t	fcf_state;
2717 #endif
2718 
2719 	uint8_t		vlan_bitmap[512];
2720 	uint8_t		switch_name_identifier[8];
2721 
2722 } FCF_RECORD_t;
2723 
2724 #define	EMLXS_FCOE_MAX_RCV_SZ	0x800
2725 
2726 /* defines for mac_address_provider */
2727 #define	EMLXS_MAM_BOTH	0	/* Both SPMA and FPMA */
2728 #define	EMLXS_MAM_FPMA	1	/* Fabric Provided MAC Address */
2729 #define	EMLXS_MAM_SPMA	2	/* Server Provided MAC Address */
2730 
2731 typedef struct
2732 {
2733 	union
2734 	{
2735 		struct
2736 		{
2737 #ifdef EMLXS_BIG_ENDIAN
2738 			uint16_t	rsvd0;
2739 			uint16_t	fcf_index;
2740 #endif
2741 #ifdef EMLXS_LITTLE_ENDIAN
2742 			uint16_t	fcf_index;
2743 			uint16_t	rsvd0;
2744 #endif
2745 
2746 		} request;
2747 
2748 		struct
2749 		{
2750 			uint32_t	event_tag;
2751 #ifdef EMLXS_BIG_ENDIAN
2752 			uint16_t	rsvd0;
2753 			uint16_t	next_valid_fcf_index;
2754 #endif
2755 #ifdef EMLXS_LITTLE_ENDIAN
2756 			uint16_t	next_valid_fcf_index;
2757 			uint16_t	rsvd0;
2758 #endif
2759 			FCF_RECORD_t fcf_entry[1];
2760 
2761 		} response;
2762 
2763 	} params;
2764 
2765 } IOCTL_FCOE_READ_FCF_TABLE;
2766 
2767 
2768 /* IOCTL_FCOE_ADD_FCF_TABLE */
2769 typedef struct
2770 {
2771 	union
2772 	{
2773 		struct
2774 		{
2775 #ifdef EMLXS_BIG_ENDIAN
2776 			uint16_t	rsvd0;
2777 			uint16_t	fcf_index;
2778 #endif
2779 #ifdef EMLXS_LITTLE_ENDIAN
2780 			uint16_t	fcf_index;
2781 			uint16_t	rsvd0;
2782 #endif
2783 			FCF_RECORD_t fcf_entry;
2784 
2785 		} request;
2786 
2787 		struct
2788 		{
2789 #ifdef EMLXS_BIG_ENDIAN
2790 			uint16_t	rsvd0;
2791 			uint16_t	fcf_index;
2792 #endif
2793 #ifdef EMLXS_LITTLE_ENDIAN
2794 			uint16_t	fcf_index;
2795 			uint16_t	rsvd0;
2796 #endif
2797 		} response;
2798 	} params;
2799 
2800 } IOCTL_FCOE_ADD_FCF_TABLE;
2801 
2802 #define	FCOE_FCF_MAC0	0x0E
2803 #define	FCOE_FCF_MAC1	0xFC
2804 #define	FCOE_FCF_MAC2	0x00
2805 #define	FCOE_FCF_MAC3	0xFF
2806 #define	FCOE_FCF_MAC4	0xFF
2807 #define	FCOE_FCF_MAC5	0xFE
2808 
2809 #define	FCOE_FCF_MAP0	0x0E
2810 #define	FCOE_FCF_MAP1	0xFC
2811 #define	FCOE_FCF_MAP2	0x00
2812 
2813 #define	MGMT_STATUS_FCF_IN_USE	0x3a
2814 
2815 /* IOCTL_COMMON_NOP */
2816 typedef	struct _IOCTL_COMMON_NOP
2817 {
2818 	union
2819 	{
2820 		struct
2821 		{
2822 			uint64_t	context;
2823 		} request;
2824 
2825 		struct
2826 		{
2827 			uint64_t	context;
2828 		} response;
2829 
2830 	} params;
2831 
2832 } IOCTL_COMMON_NOP;
2833 
2834 
2835 /*	Context for EQ create	*/
2836 typedef	struct _EQ_CONTEXT
2837 {
2838 #ifdef EMLXS_BIG_ENDIAN
2839 	uint32_t	Size:1;
2840 	uint32_t	Rsvd2:1;
2841 	uint32_t	Valid:1;
2842 	uint32_t	EPIndex:13;
2843 	uint32_t	Rsvd1:3;
2844 	uint32_t	ConsumerIndex:13;
2845 
2846 	uint32_t	Armed:1;
2847 	uint32_t	Stalled:1;
2848 	uint32_t	SolEvent:1;
2849 	uint32_t	Count:3;
2850 	uint32_t	ProtectionDomain:10;
2851 	uint32_t	Rsvd3:3;
2852 	uint32_t	ProduderIndex:13;
2853 
2854 	uint32_t	Rsvd7:4;
2855 	uint32_t	NoDelay:1;
2856 	uint32_t	Phase:2;
2857 	uint32_t	Rsvd6:2;
2858 	uint32_t	DelayMult:10;
2859 	uint32_t	Rsvd5:1;
2860 	uint32_t	Func:8;
2861 	uint32_t	Rsvd4:4;
2862 #endif
2863 #ifdef EMLXS_LITTLE_ENDIAN
2864 	uint32_t	ConsumerIndex:13;
2865 	uint32_t	Rsvd1:3;
2866 	uint32_t	EPIndex:13;
2867 	uint32_t	Valid:1;
2868 	uint32_t	Rsvd2:1;
2869 	uint32_t	Size:1;
2870 
2871 	uint32_t	ProduderIndex:13;
2872 	uint32_t	Rsvd3:3;
2873 	uint32_t	ProtectionDomain:10;
2874 	uint32_t	Count:3;
2875 	uint32_t	SolEvent:1;
2876 	uint32_t	Stalled:1;
2877 	uint32_t	Armed:1;
2878 
2879 	uint32_t	Rsvd4:4;
2880 	uint32_t	Func:8;
2881 	uint32_t	Rsvd5:1;
2882 	uint32_t	DelayMult:10;
2883 	uint32_t	Rsvd6:2;
2884 	uint32_t	Phase:2;
2885 	uint32_t	NoDelay:1;
2886 	uint32_t	Rsvd7:4;
2887 #endif
2888 
2889 	uint32_t	Rsvd8;
2890 
2891 }EQ_CONTEXT;
2892 
2893 /* define for Count field */
2894 #define	EQ_ELEMENT_COUNT_1024	2
2895 #define	EQ_ELEMENT_COUNT_2048	3
2896 #define	EQ_ELEMENT_COUNT_4096	4
2897 
2898 /* define for Size field */
2899 #define	EQ_ELEMENT_SIZE_4	0
2900 
2901 /* define for DelayMullt - used for interrupt coalescing */
2902 #define	EQ_DELAY_MULT		256
2903 
2904 /*	Context for CQ create	*/
2905 typedef	struct _CQ_CONTEXT
2906 {
2907 #ifdef EMLXS_BIG_ENDIAN
2908 	uint32_t	Eventable:1;
2909 	uint32_t	SolEvent:1;
2910 	uint32_t	Valid:1;
2911 	uint32_t	Count:2;
2912 	uint32_t	Rsvd2:1;
2913 	uint32_t	EPIndex:11;
2914 	uint32_t	NoDelay:1;
2915 	uint32_t	CoalesceWM:2;
2916 	uint32_t	Rsvd1:1;
2917 	uint32_t	ConsumerIndex:11;
2918 
2919 	uint32_t	Armed:1;
2920 	uint32_t	Stalled:1;
2921 	uint32_t	EQId:8;
2922 	uint32_t	ProtectionDomain:10;
2923 	uint32_t	Rsvd3:1;
2924 	uint32_t	ProduderIndex:11;
2925 
2926 	uint32_t	Rsvd5:20;
2927 	uint32_t	Func:8;
2928 	uint32_t	Rsvd4:4;
2929 #endif
2930 #ifdef EMLXS_LITTLE_ENDIAN
2931 	uint32_t	ConsumerIndex:11;
2932 	uint32_t	Rsvd1:1;
2933 	uint32_t	CoalesceWM:2;
2934 	uint32_t	NoDelay:1;
2935 	uint32_t	EPIndex:11;
2936 	uint32_t	Rsvd2:1;
2937 	uint32_t	Count:2;
2938 	uint32_t	Valid:1;
2939 	uint32_t	SolEvent:1;
2940 	uint32_t	Eventable:1;
2941 
2942 	uint32_t	ProduderIndex:11;
2943 	uint32_t	Rsvd3:1;
2944 	uint32_t	ProtectionDomain:10;
2945 	uint32_t	EQId:8;
2946 	uint32_t	Stalled:1;
2947 	uint32_t	Armed:1;
2948 
2949 	uint32_t	Rsvd4:4;
2950 	uint32_t	Func:8;
2951 	uint32_t	Rsvd5:20;
2952 #endif
2953 
2954 	uint32_t	Rsvd6;
2955 
2956 } CQ_CONTEXT;
2957 
2958 /* define for Count field */
2959 #define	CQ_ELEMENT_COUNT_256	0
2960 #define	CQ_ELEMENT_COUNT_512	1
2961 #define	CQ_ELEMENT_COUNT_1024	2
2962 
2963 /*	Context for MQ create	*/
2964 typedef	struct _MQ_CONTEXT
2965 {
2966 #ifdef EMLXS_BIG_ENDIAN
2967 	uint32_t	CQId:10;
2968 	uint32_t	Rsvd2:2;
2969 	uint32_t	Size:4;
2970 	uint32_t	Rsvd1:2;
2971 	uint32_t	ConsumerIndex:14;
2972 
2973 	uint32_t	Valid:1;
2974 	uint32_t	ProtectionDomain:9;
2975 	uint32_t	FunctionNumber:8;
2976 	uint32_t	ProduderIndex:14;
2977 #endif
2978 #ifdef EMLXS_LITTLE_ENDIAN
2979 	uint32_t	ConsumerIndex:14;
2980 	uint32_t	Rsvd1:2;
2981 	uint32_t	Size:4;
2982 	uint32_t	Rsvd2:2;
2983 	uint32_t	CQId:10;
2984 
2985 	uint32_t	ProduderIndex:14;
2986 	uint32_t	FunctionNumber:8;
2987 	uint32_t	ProtectionDomain:9;
2988 	uint32_t	Valid:1;
2989 #endif
2990 
2991 	uint32_t	Rsvd3;
2992 	uint32_t	Rsvd4;
2993 
2994 } MQ_CONTEXT;
2995 
2996 /* define for Size field */
2997 #define	MQ_ELEMENT_COUNT_16 0x05
2998 
2999 /*	Context for RQ create	*/
3000 typedef	struct _RQ_CONTEXT
3001 {
3002 #ifdef EMLXS_BIG_ENDIAN
3003 	uint32_t	Rsvd2:8;
3004 	uint32_t	RQState:4;
3005 	uint32_t	RQSize:4;
3006 	uint32_t	Rsvd1:16;
3007 
3008 	uint32_t	Rsvd3;
3009 
3010 	uint32_t	Rsvd4:6;
3011 	uint32_t	CQIdRecv:10;
3012 	uint32_t	BufferSize:16;
3013 #endif
3014 #ifdef EMLXS_LITTLE_ENDIAN
3015 	uint32_t	Rsvd1:16;
3016 	uint32_t	RQSize:4;
3017 	uint32_t	RQState:4;
3018 	uint32_t	Rsvd2:8;
3019 
3020 	uint32_t	Rsvd3;
3021 
3022 	uint32_t	BufferSize:16;
3023 	uint32_t	CQIdRecv:10;
3024 	uint32_t	Rsvd4:6;
3025 #endif
3026 
3027 	uint32_t  Rsvd5;
3028 
3029 } RQ_CONTEXT;
3030 
3031 
3032 /* IOCTL_COMMON_EQ_CREATE */
3033 typedef	struct
3034 {
3035 	union
3036 	{
3037 		struct
3038 		{
3039 #ifdef EMLXS_BIG_ENDIAN
3040 			uint16_t	Rsvd1;
3041 			uint16_t	NumPages;
3042 #endif
3043 #ifdef EMLXS_LITTLE_ENDIAN
3044 			uint16_t	NumPages;
3045 			uint16_t	Rsvd1;
3046 #endif
3047 			EQ_CONTEXT	EQContext;
3048 			BE_PHYS_ADDR	Pages[8];
3049 		} request;
3050 
3051 		struct
3052 		{
3053 #ifdef EMLXS_BIG_ENDIAN
3054 			uint16_t	Rsvd1;
3055 			uint16_t	EQId;
3056 #endif
3057 #ifdef EMLXS_LITTLE_ENDIAN
3058 			uint16_t	EQId;
3059 			uint16_t	Rsvd1;
3060 #endif
3061 		} response;
3062 	} params;
3063 
3064 } IOCTL_COMMON_EQ_CREATE;
3065 
3066 
3067 /* IOCTL_COMMON_CQ_CREATE */
3068 typedef	struct
3069 {
3070 	union
3071 	{
3072 		struct
3073 		{
3074 #ifdef EMLXS_BIG_ENDIAN
3075 			uint16_t	Rsvd1;
3076 			uint16_t	NumPages;
3077 #endif
3078 #ifdef EMLXS_LITTLE_ENDIAN
3079 			uint16_t	NumPages;
3080 			uint16_t	Rsvd1;
3081 #endif
3082 			CQ_CONTEXT	CQContext;
3083 			BE_PHYS_ADDR	Pages[4];
3084 		} request;
3085 
3086 		struct
3087 		{
3088 #ifdef EMLXS_BIG_ENDIAN
3089 			uint16_t	Rsvd1;
3090 			uint16_t	CQId;
3091 #endif
3092 #ifdef EMLXS_LITTLE_ENDIAN
3093 			uint16_t	CQId;
3094 			uint16_t	Rsvd1;
3095 #endif
3096 		} response;
3097 	} params;
3098 
3099 } IOCTL_COMMON_CQ_CREATE;
3100 
3101 
3102 /* IOCTL_COMMON_MQ_CREATE */
3103 typedef	struct
3104 {
3105 	union
3106 	{
3107 		struct
3108 		{
3109 #ifdef EMLXS_BIG_ENDIAN
3110 			uint16_t	Rsvd1;
3111 			uint16_t	NumPages;
3112 #endif
3113 #ifdef EMLXS_LITTLE_ENDIAN
3114 			uint16_t	NumPages;
3115 			uint16_t	Rsvd1;
3116 #endif
3117 			MQ_CONTEXT	MQContext;
3118 			BE_PHYS_ADDR	Pages[8];
3119 		} request;
3120 
3121 		struct
3122 		{
3123 #ifdef EMLXS_BIG_ENDIAN
3124 			uint16_t	Rsvd1;
3125 			uint16_t	MQId;
3126 #endif
3127 #ifdef EMLXS_LITTLE_ENDIAN
3128 			uint16_t	MQId;
3129 			uint16_t	Rsvd1;
3130 #endif
3131 		} response;
3132 	} params;
3133 
3134 } IOCTL_COMMON_MQ_CREATE;
3135 
3136 
3137 /* IOCTL_FCOE_RQ_CREATE */
3138 typedef	struct
3139 {
3140 	union
3141 	{
3142 		struct
3143 		{
3144 #ifdef EMLXS_BIG_ENDIAN
3145 			uint8_t		rsvd0;
3146 			uint8_t		ulpNum;
3147 			uint16_t	NumPages;
3148 #endif
3149 #ifdef EMLXS_LITTLE_ENDIAN
3150 			uint16_t	NumPages;
3151 			uint8_t		ulpNum;
3152 			uint8_t		rsvd0;
3153 #endif
3154 			RQ_CONTEXT	RQContext;
3155 			BE_PHYS_ADDR	Pages[8];
3156 		} request;
3157 
3158 		struct
3159 		{
3160 #ifdef EMLXS_BIG_ENDIAN
3161 			uint16_t	Rsvd1;
3162 			uint16_t	RQId;
3163 #endif
3164 #ifdef EMLXS_LITTLE_ENDIAN
3165 			uint16_t	RQId;
3166 			uint16_t	Rsvd1;
3167 #endif
3168 		} response;
3169 
3170 	} params;
3171 
3172 } IOCTL_FCOE_RQ_CREATE;
3173 
3174 
3175 /* IOCTL_FCOE_WQ_CREATE */
3176 typedef	struct
3177 {
3178 	union
3179 	{
3180 		struct
3181 		{
3182 #ifdef EMLXS_BIG_ENDIAN
3183 			uint16_t	CQId;
3184 			uint16_t	NumPages;
3185 #endif
3186 #ifdef EMLXS_LITTLE_ENDIAN
3187 			uint16_t	NumPages;
3188 			uint16_t	CQId;
3189 #endif
3190 			BE_PHYS_ADDR	Pages[4];
3191 		} request;
3192 
3193 		struct
3194 		{
3195 #ifdef EMLXS_BIG_ENDIAN
3196 			uint16_t	Rsvd0;
3197 			uint16_t	WQId;
3198 #endif
3199 #ifdef EMLXS_LITTLE_ENDIAN
3200 			uint16_t	WQId;
3201 			uint16_t	Rsvd0;
3202 #endif
3203 		} response;
3204 
3205 	} params;
3206 
3207 } IOCTL_FCOE_WQ_CREATE;
3208 
3209 
3210 /* IOCTL_FCOE_CFG_POST_SGL_PAGES */
3211 typedef	struct _FCOE_SGL_PAGES
3212 {
3213 	BE_PHYS_ADDR	sgl_page0;	/* 1st page per XRI */
3214 	BE_PHYS_ADDR	sgl_page1;	/* 2nd page per XRI */
3215 
3216 } FCOE_SGL_PAGES;
3217 
3218 typedef	struct
3219 {
3220 	union
3221 	{
3222 		struct
3223 		{
3224 #ifdef EMLXS_BIG_ENDIAN
3225 			uint16_t	xri_count;
3226 			uint16_t	xri_start;
3227 #endif
3228 #ifdef EMLXS_LITTLE_ENDIAN
3229 			uint16_t	xri_start;
3230 			uint16_t	xri_count;
3231 #endif
3232 			FCOE_SGL_PAGES	pages[1];
3233 		} request;
3234 
3235 		struct
3236 		{
3237 			uint32_t	rsvd0;
3238 		} response;
3239 
3240 	} params;
3241 
3242 	uint32_t	rsvd0[2];
3243 
3244 } IOCTL_FCOE_CFG_POST_SGL_PAGES;
3245 
3246 
3247 /* IOCTL_FCOE_POST_HDR_TEMPLATES */
3248 typedef struct _IOCTL_FCOE_POST_HDR_TEMPLATES
3249 {
3250 	union
3251 	{
3252 		struct
3253 		{
3254 #ifdef EMLXS_BIG_ENDIAN
3255 			uint16_t	num_pages;
3256 			uint16_t	starting_rpi_index;
3257 #endif
3258 #ifdef EMLXS_LITTLE_ENDIAN
3259 			uint16_t	starting_rpi_index;
3260 			uint16_t	num_pages;
3261 #endif
3262 			BE_PHYS_ADDR	pages[32];
3263 
3264 		}request;
3265 
3266 	}params;
3267 
3268 } IOCTL_FCOE_POST_HDR_TEMPLATES;
3269 
3270 
3271 
3272 #define	EMLXS_IOCTL_DCBX_MODE_CEE	0	/* Mapped to FIP mode */
3273 #define	EMLXS_IOCTL_DCBX_MODE_CIN	1	/* Mapped to nonFIP mode */
3274 
3275 /* IOCTL_DCBX_GET_DCBX_MODE */
3276 typedef struct _IOCTL_DCBX_GET_DCBX_MODE
3277 {
3278 	union
3279 	{
3280 		struct
3281 		{
3282 #ifdef EMLXS_BIG_ENDIAN
3283 			uint8_t		rsvd0[3];
3284 			uint8_t		port_num;
3285 #endif
3286 #ifdef EMLXS_LITTLE_ENDIAN
3287 			uint8_t		port_num;
3288 			uint8_t		rsvd0[3];
3289 #endif
3290 		} request;
3291 
3292 		struct
3293 		{
3294 #ifdef EMLXS_BIG_ENDIAN
3295 			uint8_t		rsvd1[3];
3296 			uint8_t		dcbx_mode;
3297 #endif
3298 #ifdef EMLXS_LITTLE_ENDIAN
3299 			uint8_t		dcbx_mode;
3300 			uint8_t		rsvd1[3];
3301 #endif
3302 		} response;
3303 
3304 	} params;
3305 
3306 } IOCTL_DCBX_GET_DCBX_MODE;
3307 
3308 
3309 /* IOCTL_DCBX_SET_DCBX_MODE */
3310 typedef struct _IOCTL_DCBX_SET_DCBX_MODE
3311 {
3312 	union
3313 	{
3314 		struct
3315 		{
3316 #ifdef EMLXS_BIG_ENDIAN
3317 			uint8_t		rsvd0[2];
3318 			uint8_t		dcbx_mode;
3319 			uint8_t		port_num;
3320 #endif
3321 #ifdef EMLXS_LITTLE_ENDIAN
3322 			uint8_t		port_num;
3323 			uint8_t		dcbx_mode;
3324 			uint8_t		rsvd0[2];
3325 #endif
3326 		} request;
3327 
3328 		struct
3329 		{
3330 			uint32_t	rsvd1;
3331 		} response;
3332 
3333 	} params;
3334 
3335 } IOCTL_DCBX_SET_DCBX_MODE;
3336 
3337 
3338 /* IOCTL_COMMON_GET_CNTL_ATTRIB */
3339 typedef	struct
3340 {
3341 	char		flashrom_version_string[32];
3342 	char		manufacturer_name[32];
3343 	char		rsvd0[28];
3344 	uint32_t	default_extended_timeout;
3345 	char		controller_model_number[32];
3346 	char		controller_description[64];
3347 	char		controller_serial_number[32];
3348 	char		ip_version_string[32];
3349 	char		firmware_version_string[32];
3350 	char		bios_version_string[32];
3351 	char		redboot_version_string[32];
3352 	char		driver_version_string[32];
3353 	char		fw_on_flash_version_string[32];
3354 	uint32_t	functionalities_supported;
3355 	uint16_t	max_cdblength;
3356 	uint8_t		asic_revision;
3357 	uint8_t		generational_guid[16];
3358 	uint8_t		hba_port_count;
3359 	uint16_t	default_link_down_timeout;
3360 	uint8_t		iscsi_ver_min_max;
3361 	uint8_t		multifunction_device;
3362 	uint8_t		cache_valid;
3363 	uint8_t		hba_status;
3364 	uint8_t		max_domains_supported;
3365 	uint8_t		phy_port;
3366 	uint32_t	firmware_post_status;
3367 	uint32_t	hba_mtu[2];
3368 
3369 } MGMT_HBA_ATTRIB;
3370 
3371 typedef	struct
3372 {
3373 	MGMT_HBA_ATTRIB		hba_attribs;
3374 	uint16_t		pci_vendor_id;
3375 	uint16_t		pci_device_id;
3376 	uint16_t		pci_sub_vendor_id;
3377 	uint16_t		pci_sub_system_id;
3378 	uint8_t			pci_bus_number;
3379 	uint8_t			pci_device_number;
3380 	uint8_t			pci_function_number;
3381 	uint8_t			interface_type;
3382 	uint64_t		unique_identifier;
3383 
3384 } MGMT_CONTROLLER_ATTRIB;
3385 
3386 typedef	struct
3387 {
3388 	union
3389 	{
3390 		struct
3391 		{
3392 			uint32_t rsvd0;
3393 		} request;
3394 
3395 		struct
3396 		{
3397 			MGMT_CONTROLLER_ATTRIB cntl_attributes_info;
3398 		} response;
3399 
3400 	} params;
3401 
3402 } IOCTL_COMMON_GET_CNTL_ATTRIB;
3403 
3404 
3405 typedef	union
3406 {
3407 	IOCTL_COMMON_NOP		NOPVar;
3408 	IOCTL_FCOE_WQ_CREATE		WQCreateVar;
3409 	IOCTL_COMMON_EQ_CREATE		EQCreateVar;
3410 	IOCTL_COMMON_CQ_CREATE		CQCreateVar;
3411 	IOCTL_COMMON_MQ_CREATE		MQCreateVar;
3412 	IOCTL_FCOE_CFG_POST_SGL_PAGES	PostSGLVar;
3413 	IOCTL_COMMON_GET_CNTL_ATTRIB	GetCntlAttributesVar;
3414 	IOCTL_FCOE_READ_FCF_TABLE	ReadFCFTableVar;
3415 	IOCTL_FCOE_ADD_FCF_TABLE	AddFCFTableVar;
3416 	IOCTL_COMMON_FLASHROM		FlashRomVar;
3417 	IOCTL_COMMON_MANAGE_FAT		FATVar;
3418 	IOCTL_DCBX_GET_DCBX_MODE	GetDCBX;
3419 	IOCTL_DCBX_SET_DCBX_MODE	SetDCBX;
3420 
3421 } IOCTL_VARIANTS;
3422 
3423 /* Structure for MB Command SLI_CONFIG(0x9b) */
3424 /* Good for SLI4 only */
3425 
3426 typedef struct
3427 {
3428 	be_req_hdr_t	be;
3429 	BE_PHYS_ADDR	payload;
3430 } SLI_CONFIG_VAR;
3431 
3432 #define	IOCTL_HEADER_SZ	(4 * sizeof (uint32_t))
3433 
3434 
3435 typedef union
3436 {
3437 	uint32_t		varWords[63];
3438 	READ_NV_VAR		varRDnvp;	/* cmd = x02 (READ_NVPARMS) */
3439 	INIT_LINK_VAR		varInitLnk;	/* cmd = x05 (INIT_LINK) */
3440 	CONFIG_LINK		varCfgLnk;	/* cmd = x07 (CONFIG_LINK) */
3441 	READ_REV4_VAR		varRdRev4;	/* cmd = x11 (READ_REV) */
3442 	READ_LNK_VAR		varRdLnk;	/* cmd = x12 (READ_LNK_STAT) */
3443 	DUMP4_VAR		varDmp4;	/* cmd = x17 (DUMP) */
3444 	READ_SPARM_VAR		varRdSparm;	/* cmd = x8D (READ_SPARM64) */
3445 	REG_FCFI_VAR		varRegFCFI;	/* cmd = xA0 (REG_FCFI) */
3446 	UNREG_FCFI_VAR		varUnRegFCFI;	/* cmd = xA2 (UNREG_FCFI) */
3447 	READ_LA_VAR		varReadLA;	/* cmd = x95 (READ_LA64) */
3448 	READ_CONFIG4_VAR	varRdConfig4;	/* cmd = x0B (READ_CONFIG) */
3449 	RESUME_RPI_VAR		varResumeRPI;	/* cmd = x9E (RESUME_RPI) */
3450 	REG_LOGIN_VAR		varRegLogin;	/* cmd = x93 (REG_RPI) */
3451 	UNREG_LOGIN_VAR		varUnregLogin;	/* cmd = x14 (UNREG_RPI) */
3452 	REG_VPI_VAR		varRegVPI4;	/* cmd = x96 (REG_VPI) */
3453 	UNREG_VPI_VAR		varUnRegVPI4;	/* cmd = x97 (UNREG_VPI) */
3454 	REG_VFI_VAR		varRegVFI4;	/* cmd = x9F (REG_VFI) */
3455 	UNREG_VFI_VAR		varUnRegVFI4;	/* cmd = xA1 (UNREG_VFI) */
3456 	REQUEST_FEATURES_VAR	varReqFeatures;	/* cmd = x9D (REQ_FEATURES) */
3457 	SLI_CONFIG_VAR		varSLIConfig;	/* cmd = x9B (SLI_CONFIG) */
3458 	INIT_VPI_VAR		varInitVPI4;	/* cmd = xA3 (INIT_VPI) */
3459 	INIT_VFI_VAR		varInitVFI4;	/* cmd = xA4 (INIT_VFI) */
3460 
3461 } MAILVARIANTS4;		/* Used for SLI-4 */
3462 
3463 #define	MAILBOX_CMD_SLI4_BSIZE	256
3464 #define	MAILBOX_CMD_SLI4_WSIZE	64
3465 
3466 #define	MAILBOX_CMD_MAX_BSIZE	256
3467 #define	MAILBOX_CMD_MAX_WSIZE	64
3468 
3469 
3470 typedef volatile struct
3471 {
3472 #ifdef EMLXS_BIG_ENDIAN
3473 	uint16_t	mbxStatus;
3474 	uint8_t		mbxCommand;
3475 	uint8_t		mbxReserved:6;
3476 	uint8_t		mbxHc:1;
3477 	uint8_t		mbxOwner:1;	/* Low order bit first word */
3478 #endif
3479 #ifdef EMLXS_LITTLE_ENDIAN
3480 	uint8_t		mbxOwner:1;	/* Low order bit first word */
3481 	uint8_t		mbxHc:1;
3482 	uint8_t		mbxReserved:6;
3483 	uint8_t		mbxCommand;
3484 	uint16_t	mbxStatus;
3485 #endif
3486 	MAILVARIANTS4	un;		/* 124 bytes */
3487 } MAILBOX4;				/* Used for SLI-4 */
3488 
3489 /*
3490  * End Structure Definitions for Mailbox Commands
3491  */
3492 
3493 
3494 typedef struct emlxs_mbq
3495 {
3496 	volatile uint32_t	mbox[MAILBOX_CMD_MAX_WSIZE];
3497 	struct emlxs_mbq	*next;
3498 
3499 	/* Defferred handling pointers */
3500 	uint8_t			*nonembed;	/* ptr to data buffer */
3501 						/* structure */
3502 	uint8_t			*bp;		/* ptr to data buffer */
3503 						/* structure */
3504 	uint8_t			*sbp;		/* ptr to emlxs_buf_t */
3505 						/* structure */
3506 	uint8_t			*ubp;		/* ptr to fc_unsol_buf_t */
3507 						/* structure */
3508 	uint8_t			*iocbq;		/* ptr to IOCBQ structure */
3509 	uint8_t			*context;	/* ptr to mbox context data */
3510 	uint32_t		flag;
3511 
3512 #define	MBQ_POOL_ALLOCATED	0x00000001
3513 #define	MBQ_PASSTHRU		0x00000002
3514 #define	MBQ_EMBEDDED		0x00000004
3515 #define	MBQ_BOOTSTRAP		0x00000008
3516 #define	MBQ_COMPLETED		0x00010000	/* Used for MBX_SLEEP */
3517 #define	MBQ_INIT_MASK		0x0000ffff
3518 
3519 #ifdef MBOX_EXT_SUPPORT
3520 	uint8_t			*extbuf;	/* ptr to mailbox ext buffer */
3521 	uint32_t		extsize;	/* size of mailbox ext buffer */
3522 #endif /* MBOX_EXT_SUPPORT */
3523 	int			(*mbox_cmpl)(void *, struct emlxs_mbq *);
3524 } emlxs_mbq_t;
3525 typedef emlxs_mbq_t MAILBOXQ;
3526 
3527 
3528 /* We currently do not support IOCBs in SLI1 mode */
3529 typedef struct
3530 {
3531 	MAILBOX		mbx;
3532 #ifdef MBOX_EXT_SUPPORT
3533 	uint8_t		mbxExt[MBOX_EXTENSION_SIZE];
3534 #endif /* MBOX_EXT_SUPPORT */
3535 	uint8_t		pad[(SLI_SLIM1_SIZE -
3536 				(sizeof (MAILBOX) + MBOX_EXTENSION_SIZE))];
3537 } SLIM1;
3538 
3539 
3540 typedef struct
3541 {
3542 	MAILBOX		mbx;
3543 #ifdef MBOX_EXT_SUPPORT
3544 	uint8_t		mbxExt[MBOX_EXTENSION_SIZE];
3545 #endif /* MBOX_EXT_SUPPORT */
3546 	PCB		pcb;
3547 	uint8_t		IOCBs[SLI_IOCB_MAX_SIZE];
3548 } SLIM2;
3549 
3550 
3551 /* def for new 2MB Flash (Pegasus ...) */
3552 #define	MBX_LOAD_AREA		0x81
3553 #define	MBX_LOAD_EXP_ROM	0x9C
3554 
3555 #define	FILE_TYPE_AWC		0xE1A01001
3556 #define	FILE_TYPE_DWC		0xE1A02002
3557 #define	FILE_TYPE_BWC		0xE1A03003
3558 
3559 #define	AREA_ID_MASK		0xFFFFFF0F
3560 #define	AREA_ID_AWC		0x00000001
3561 #define	AREA_ID_DWC		0x00000002
3562 #define	AREA_ID_BWC		0x00000003
3563 
3564 #define	CMD_START_ERASE		1
3565 #define	CMD_CONTINUE_ERASE	2
3566 #define	CMD_DOWNLOAD		3
3567 #define	CMD_END_DOWNLOAD	4
3568 
3569 #define	RSP_ERASE_STARTED	1
3570 #define	RSP_ERASE_COMPLETE	2
3571 #define	RSP_DOWNLOAD_MORE	3
3572 #define	RSP_DOWNLOAD_DONE	4
3573 
3574 #define	EROM_CMD_FIND_IMAGE	8
3575 #define	EROM_CMD_CONTINUE_ERASE	9
3576 #define	EROM_CMD_COPY		10
3577 
3578 #define	EROM_RSP_ERASE_STARTED	8
3579 #define	EROM_RSP_ERASE_COMPLETE	9
3580 #define	EROM_RSP_COPY_MORE	10
3581 #define	EROM_RSP_COPY_DONE	11
3582 
3583 #define	ALLext			1
3584 #define	DWCext			2
3585 #define	BWCext			3
3586 
3587 #define	NO_ALL			0
3588 #define	ALL_WITHOUT_BWC		1
3589 #define	ALL_WITH_BWC		2
3590 
3591 #define	KERNEL_START_ADDRESS	0x000000
3592 #define	DOWNLOAD_START_ADDRESS	0x040000
3593 #define	EXP_ROM_START_ADDRESS	0x180000
3594 #define	SCRATCH_START_ADDRESS	0x1C0000
3595 #define	CONFIG_START_ADDRESS	0x1E0000
3596 
3597 
3598 typedef struct SliAifHdr
3599 {
3600 	uint32_t	CompressBr;
3601 	uint32_t	RelocBr;
3602 	uint32_t	ZinitBr;
3603 	uint32_t	EntryBr;
3604 	uint32_t	Area_ID;
3605 	uint32_t	RoSize;
3606 	uint32_t	RwSize;
3607 	uint32_t	DbgSize;
3608 	uint32_t	ZinitSize;
3609 	uint32_t	DbgType;
3610 	uint32_t	ImageBase;
3611 	uint32_t	Area_Size;
3612 	uint32_t	AddressMode;
3613 	uint32_t	DataBase;
3614 	uint32_t	AVersion;
3615 	uint32_t	Spare2;
3616 	uint32_t	DebugSwi;
3617 	uint32_t	ZinitCode[15];
3618 } AIF_HDR, *PAIF_HDR;
3619 
3620 typedef struct ImageHdr
3621 {
3622 	uint32_t	BlockSize;
3623 	PROG_ID		Id;
3624 	uint32_t	Flags;
3625 	uint32_t	EntryAdr;
3626 	uint32_t	InitAdr;
3627 	uint32_t	ExitAdr;
3628 	uint32_t	ImageBase;
3629 	uint32_t	ImageSize;
3630 	uint32_t	ZinitSize;
3631 	uint32_t	RelocSize;
3632 	uint32_t	HdrCks;
3633 } IMAGE_HDR, *PIMAGE_HDR;
3634 
3635 
3636 
3637 typedef struct
3638 {
3639 	PROG_ID		prog_id;
3640 #ifdef EMLXS_BIG_ENDIAN
3641 	uint32_t	pci_cfg_rsvd:27;
3642 	uint32_t	use_hdw_def:1;
3643 	uint32_t	pci_cfg_sel:3;
3644 	uint32_t	pci_cfg_lookup_sel:1;
3645 #endif
3646 #ifdef EMLXS_LITTLE_ENDIAN
3647 	uint32_t	pci_cfg_lookup_sel:1;
3648 	uint32_t	pci_cfg_sel:3;
3649 	uint32_t	use_hdw_def:1;
3650 	uint32_t	pci_cfg_rsvd:27;
3651 #endif
3652 	union
3653 	{
3654 		PROG_ID		boot_bios_id;
3655 		uint32_t	boot_bios_wd[2];
3656 	} u0;
3657 	PROG_ID		sli1_prog_id;
3658 	PROG_ID		sli2_prog_id;
3659 	PROG_ID		sli3_prog_id;
3660 	PROG_ID		sli4_prog_id;
3661 	union
3662 	{
3663 		PROG_ID		EROM_prog_id;
3664 		uint32_t	EROM_prog_wd[2];
3665 	} u1;
3666 } WAKE_UP_PARMS, *PWAKE_UP_PARMS;
3667 
3668 
3669 #define	PROG_DESCR_STR_LEN	24
3670 #define	MAX_LOAD_ENTRY		10
3671 
3672 typedef struct
3673 {
3674 	uint32_t	next;
3675 	uint32_t	prev;
3676 	uint32_t	start_adr;
3677 	uint32_t	len;
3678 	union
3679 	{
3680 		PROG_ID		id;
3681 		uint32_t	wd[2];
3682 	} un;
3683 	uint8_t		prog_descr[PROG_DESCR_STR_LEN];
3684 } LOAD_ENTRY;
3685 
3686 typedef struct
3687 {
3688 	uint32_t	head;
3689 	uint32_t	tail;
3690 	uint32_t	entry_cnt;
3691 	LOAD_ENTRY	load_entry[MAX_LOAD_ENTRY];
3692 } LOAD_LIST;
3693 
3694 #ifdef	__cplusplus
3695 }
3696 #endif
3697 
3698 #endif	/* _EMLXS_MBOX_H */
3699