xref: /illumos-gate/usr/src/uts/common/sys/mpt/mpi.h (revision 2d6eb4a5)
1 /*
2  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #ifndef _SYS_MPI_H
7 #define	_SYS_MPI_H
8 
9 #ifdef	__cplusplus
10 extern "C" {
11 #endif
12 
13 /*
14  * This header file is based on Version 1.2 of the MPT
15  * Specification by LSI Logic, Inc.
16  */
17 
18 /*
19  *  MPI Version Definitions
20  */
21 #define	MPI_VERSION_MAJOR	(0x01)
22 #define	MPI_VERSION_MINOR	(0x05)
23 #define	MPI_VERSION_MAJOR_MASK	(0xFF00)
24 #define	MPI_VERSION_MAJOR_SHIFT	(8)
25 #define	MPI_VERSION_MINOR_MASK	(0x00FF)
26 #define	MPI_VERSION_MINOR_SHIFT	(0)
27 #define	MPI_VERSION	((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) |   \
28 	MPI_VERSION_MINOR)
29 
30 #define	MPI_HEADER_VERSION_UNIT	(0x00)
31 #define	MPI_HEADER_VERSION_DEV	(0x00)
32 #define	MPI_HEADER_VERSION_UNIT_MASK	(0xFF00)
33 #define	MPI_HEADER_VERSION_UNIT_SHIFT	(8)
34 #define	MPI_HEADER_VERSION_DEV_MASK	(0x00FF)
35 #define	MPI_HEADER_VERSION_DEV_SHIFT	(0)
36 #define	MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) |  \
37 	MPI_HEADER_VERSION_DEV)
38 /* Note: The major versions of 0xe0 through 0xff are reserved */
39 
40 /*
41  * IOC State Definitions
42  */
43 #define	MPI_IOC_STATE_RESET			0x00000000
44 #define	MPI_IOC_STATE_READY			0x10000000
45 #define	MPI_IOC_STATE_OPERATIONAL		0x20000000
46 #define	MPI_IOC_STATE_FAULT			0x40000000
47 
48 #define	MPI_IOC_STATE_MASK			0xF0000000
49 #define	MPI_IOC_STATE_SHIFT			28
50 
51 /*
52  * Fault state codes (product independent range 0x8000-0xFFFF)
53  */
54 #define	MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR	0x8111
55 #define	MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT		0x8112
56 #define	MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR	0x8113
57 #define	MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT		0x8114
58 #define	MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR		0x8115
59 #define	MPI_FAULT_DATA_SEND_PCI_BUS_FAULT		0x8116
60 #define	MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR		0x8117
61 #define	MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT		0x8118
62 
63 
64 /*
65  * System Doorbell
66  */
67 #define	MPI_DOORBELL_OFFSET			0x00000000
68 #define	MPI_DOORBELL_ACTIVE			0x08000000
69 #define	MPI_DOORBELL_USED			MPI_DOORBELL_ACTIVE
70 #define	MPI_DOORBELL_ACTIVE_SHIFT		27
71 #define	MPI_DOORBELL_WHO_INIT_MASK		0x07000000
72 #define	MPI_DOORBELL_WHO_INIT_SHIFT		24
73 #define	MPI_DOORBELL_FUNCTION_MASK		0xFF000000
74 #define	MPI_DOORBELL_FUNCTION_SHIFT		24
75 #define	MPI_DOORBELL_ADD_DWORDS_MASK		0x00FF0000
76 #define	MPI_DOORBELL_ADD_DWORDS_SHIFT		16
77 #define	MPI_DOORBELL_DATA_MASK			0x0000FFFF
78 
79 
80 /*
81  * PCI System Interface Registers
82  */
83 #define	MPI_WRITE_SEQUENCE_OFFSET		0x00000004
84 #define	MPI_WRSEQ_KEY_VALUE_MASK		0x0000000F
85 #define	MPI_WRSEQ_1ST_KEY_VALUE			0x04
86 #define	MPI_WRSEQ_2ND_KEY_VALUE			0x0B
87 #define	MPI_WRSEQ_3RD_KEY_VALUE			0x02
88 #define	MPI_WRSEQ_4TH_KEY_VALUE			0x07
89 #define	MPI_WRSEQ_5TH_KEY_VALUE			0x0D
90 
91 #define	MPI_DIAGNOSTIC_OFFSET			0x00000008
92 #define	MPI_DIAG_CLEAR_FLASH_BAD_SIG		0x00000400
93 #define	MPI_DIAG_PREVENT_IOC_BOOT		0x00000200
94 #define	MPI_DIAG_DRWE				0x00000080
95 #define	MPI_DIAG_FLASH_BAD_SIG			0x00000040
96 #define	MPI_DIAG_RESET_HISTORY			0x00000020
97 #define	MPI_DIAG_RW_ENABLE			0x00000010
98 #define	MPI_DIAG_RESET_ADAPTER			0x00000004
99 #define	MPI_DIAG_DISABLE_ARM			0x00000002
100 #define	MPI_DIAG_MEM_ENABLE			0x00000001
101 
102 #define	MPI_TEST_BASE_ADDRESS_OFFSET		0x0000000C
103 
104 #define	MPI_DIAG_RW_DATA_OFFSET			0x00000010
105 
106 #define	MPI_DIAG_RW_ADDRESS_OFFSET		0x00000014
107 
108 #define	MPI_HOST_INTERRUPT_STATUS_OFFSET	0x00000030
109 #define	MPI_HIS_IOP_DOORBELL_STATUS		0x80000000
110 #define	MPI_HIS_REPLY_MESSAGE_INTERRUPT		0x00000008
111 #define	MPI_HIS_DOORBELL_INTERRUPT		0x00000001
112 
113 #define	MPI_HOST_INTERRUPT_MASK_OFFSET		0x00000034
114 #define	MPI_HIM_RIM				0x00000008
115 #define	MPI_HIM_DIM				0x00000001
116 
117 #define	MPI_REQUEST_QUEUE_OFFSET		0x00000040
118 #define	MPI_REQUEST_POST_FIFO_OFFSET		0x00000040
119 
120 #define	MPI_REPLY_QUEUE_OFFSET			0x00000044
121 #define	MPI_REPLY_POST_FIFO_OFFSET		0x00000044
122 #define	MPI_REPLY_FREE_FIFO_OFFSET		0x00000044
123 
124 #define	MPI_HI_PRI_REQUEST_QUEUE_OFFSET		0x00000048
125 
126 /*
127  * Message Frame Descriptors
128  */
129 #define	MPI_REQ_MF_DESCRIPTOR_NB_MASK		0x00000003
130 #define	MPI_REQ_MF_DESCRIPTOR_F_BIT		0x00000004
131 #define	MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK	0xFFFFFFF8
132 
133 #define	MPI_ADDRESS_REPLY_A_BIT			0x80000000
134 #define	MPI_ADDRESS_REPLY_ADDRESS_MASK		0x7FFFFFFF
135 
136 #define	MPI_CONTEXT_REPLY_A_BIT			0x80000000
137 #define	MPI_CONTEXT_REPLY_TYPE_MASK		0x60000000
138 #define	MPI_CONTEXT_REPLY_TYPE_SCSI_INIT	0x00
139 #define	MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET	0x01
140 #define	MPI_CONTEXT_REPLY_TYPE_LAN		0x02
141 #define	MPI_CONTEXT_REPLY_TYPE_SHIFT		29
142 #define	MPI_CONTEXT_REPLY_CONTEXT_MASK		0x1FFFFFFF
143 
144 
145 /*
146  * Context Reply macros
147  */
148 #define	MPI_GET_CONTEXT_REPLY_TYPE(x)  \
149 	(((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \
150 		>> MPI_CONTEXT_REPLY_TYPE_SHIFT)
151 
152 #define	MPI_SET_CONTEXT_REPLY_TYPE(x, typ) \
153 	((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) | \
154 		(((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) & \
155 			MPI_CONTEXT_REPLY_TYPE_MASK))
156 
157 
158 /*
159  * Message Functions
160  *     0x80 -> 0x8F reserved for private message use per product
161  */
162 #define	MPI_FUNCTION_SCSI_IO_REQUEST			0x00
163 #define	MPI_FUNCTION_SCSI_TASK_MGMT			0x01
164 #define	MPI_FUNCTION_IOC_INIT				0x02
165 #define	MPI_FUNCTION_IOC_FACTS				0x03
166 #define	MPI_FUNCTION_CONFIG				0x04
167 #define	MPI_FUNCTION_PORT_FACTS				0x05
168 #define	MPI_FUNCTION_PORT_ENABLE			0x06
169 #define	MPI_FUNCTION_EVENT_NOTIFICATION			0x07
170 #define	MPI_FUNCTION_EVENT_ACK				0x08
171 #define	MPI_FUNCTION_FW_DOWNLOAD			0x09
172 #define	MPI_FUNCTION_TARGET_CMD_BUFFER_POST		0x0A
173 #define	MPI_FUNCTION_TARGET_ASSIST			0x0B
174 #define	MPI_FUNCTION_TARGET_STATUS_SEND			0x0C
175 #define	MPI_FUNCTION_TARGET_MODE_ABORT			0x0D
176 #define	MPI_FUNCTION_FC_LINK_SRVC_BUF_POST		0x0E
177 #define	MPI_FUNCTION_FC_LINK_SRVC_RSP			0x0F
178 #define	MPI_FUNCTION_FC_EX_LINK_SRVC_SEND		0x10
179 #define	MPI_FUNCTION_FC_ABORT				0x11
180 #define	MPI_FUNCTION_FW_UPLOAD				0x12
181 #define	MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND		0x13
182 #define	MPI_FUNCTION_FC_PRIMITIVE_SEND			0x14
183 
184 #define	MPI_FUNCTION_RAID_ACTION			0x15
185 #define	MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH		0x16
186 
187 #define	MPI_FUNCTION_TOOLBOX				0x17
188 
189 #define	MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR		0x18
190 
191 #define	MPI_FUNCTION_MAILBOX				0x19
192 
193 #define	MPI_FUNCTION_SMP_PASSTHROUGH			0x1A
194 #define	MPI_FUNCTION_SAS_IO_UNIT_CONTROL		0x1B
195 
196 #define	MPI_DIAG_BUFFER_POST				0x1D
197 #define	MPI_DIAG_RELEASE				0x1E
198 
199 #define	MPI_FUNCTION_SCSI_IO_32				0x1F
200 
201 #define	MPI_FUNCTION_LAN_SEND				0x20
202 #define	MPI_FUNCTION_LAN_RECEIVE			0x21
203 #define	MPI_FUNCTION_LAN_RESET				0x22
204 
205 #define	MPI_FUNCTION_INBAND_BUFFER_POST			0x28
206 #define	MPI_FUNCTION_INBAND_SEND			0x29
207 #define	MPI_FUNCTION_INBAND_RSP				0x2A
208 #define	MPI_FUNCTION_INBAND_ABORT			0x2B
209 
210 #define	MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET		0x40
211 #define	MPI_FUNCTION_IO_UNIT_RESET			0x41
212 #define	MPI_FUNCTION_HANDSHAKE				0x42
213 #define	MPI_FUNCTION_REPLY_FRAME_REMOVAL		0x43
214 #define	MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL	0x44
215 
216 /*
217  * Version format
218  */
219 typedef struct mpi_version_struct {
220 	uint8_t		Dev;
221 	uint8_t		Unit;
222 	uint8_t		Minor;
223 	uint8_t		Major;
224 } mpi_version_struct_t;
225 
226 typedef union mpi_version_format {
227 	mpi_version_struct_t	Struct;
228 	uint32_t		Word;
229 } mpi_version_format_t;
230 
231 /*
232  * Scatter Gather Elements
233  */
234 
235 /*
236  * Simple element structures
237  */
238 typedef struct sge_simple32 {
239 	uint32_t	FlagsLength;
240 	uint32_t	Address;
241 } sge_simple32_t;
242 
243 typedef struct sge_simple64 {
244 	uint32_t	FlagsLength;
245 	uint32_t	Address_Low;
246 	uint32_t	Address_High;
247 } sge_simple64_t;
248 
249 typedef struct sge_simple_union {
250 	uint32_t	FlagsLength;
251 	union {
252 		uint32_t	Address32;
253 		uint32_t	Address64_Low;
254 		uint32_t	Address64_High;
255 	} u1;
256 } sge_simple_union_t;
257 
258 /*
259  * Chain element structures
260  */
261 typedef struct sge_chain32 {
262 	uint16_t	Length;
263 	uint8_t		NextChainOffset;
264 	uint8_t		Flags;
265 	uint32_t	Address;
266 } sge_chain32_t;
267 
268 typedef struct sge_chain64 {
269 	uint16_t	Length;
270 	uint8_t		NextChainOffset;
271 	uint8_t		Flags;
272 	uint32_t	Address64_Low;
273 	uint32_t	Address64_High;
274 } sge_chain64_t;
275 
276 typedef struct sge_chain_union {
277 	uint16_t	Length;
278 	uint8_t		NextChainOffset;
279 	uint8_t		Flags;
280 	union {
281 		uint32_t	Address32;
282 		uint32_t	Address64_Low;
283 		uint32_t	Address64_High;
284 	} u1;
285 } sge_chain_union_t;
286 
287 /*
288  *  Transaction Context element
289  */
290 typedef struct sge_transaction32 {
291 	uint8_t		Reserved;
292 	uint8_t		ContextSize;
293 	uint8_t		DetailsLength;
294 	uint8_t		Flags;
295 	uint32_t	TransactionContext[1];
296 	uint32_t	TransactionDetails[1];
297 } sge_transaction32_t;
298 
299 typedef struct sge_transaction64 {
300 	uint8_t		Reserved;
301 	uint8_t		ContextSize;
302 	uint8_t		DetailsLength;
303 	uint8_t		Flags;
304 	uint32_t	TransactionContext[2];
305 	uint32_t	TransactionDetails[1];
306 } sge_transaction64_t;
307 
308 typedef struct sge_transaction96 {
309 	uint8_t		Reserved;
310 	uint8_t		ContextSize;
311 	uint8_t		DetailsLength;
312 	uint8_t		Flags;
313 	uint32_t	TransactionContext[3];
314 	uint32_t	TransactionDetails[1];
315 } sge_transaction96_t;
316 
317 typedef struct sge_transaction128 {
318 	uint8_t		Reserved;
319 	uint8_t		ContextSize;
320 	uint8_t		DetailsLength;
321 	uint8_t		Flags;
322 	uint32_t	TransactionContext[4];
323 	uint32_t	TransactionDetails[1];
324 } sge_transaction128_t;
325 
326 typedef struct sge_transaction_union {
327 	uint8_t		Reserved;
328 	uint8_t		ContextSize;
329 	uint8_t		DetailsLength;
330 	uint8_t		Flags;
331 	union {
332 		uint32_t	TransactionContext32[1];
333 		uint32_t	TransactionContext64[2];
334 		uint32_t	TransactionContext96[3];
335 		uint32_t	TransactionContext128[4];
336 	} u1;
337 	uint32_t	TransactionDetails[1];
338 } sge_transaction_union_t;
339 
340 
341 /*
342  * SGE IO types union  for IO SGL's
343  */
344 typedef struct sge_io_union {
345 	union {
346 		sge_simple_union_t	Simple;
347 		sge_chain_union_t	Chain;
348 	} u1;
349 } sge_io_union_t;
350 
351 /*
352  * SGE union for SGL's with Simple and Transaction elements
353  */
354 typedef struct sge_trans_simple_union {
355 	union {
356 		sge_simple_union_t	Simple;
357 		sge_transaction_union_t	Transaction;
358 	} u1;
359 } sge_trans_simple_union_t;
360 
361 /*
362  * All SGE types union
363  */
364 typedef struct sge_mpi_union {
365 	union {
366 		sge_simple_union_t	Simple;
367 		sge_chain_union_t	Chain;
368 		sge_transaction_union_t	Transaction;
369 	} u1;
370 } sge_mpi_union_t;
371 
372 
373 /*
374  * SGE field definition and masks
375  */
376 
377 /*
378  * Flags field bit definitions
379  */
380 #define	MPI_SGE_FLAGS_LAST_ELEMENT		0x80
381 #define	MPI_SGE_FLAGS_END_OF_BUFFER		0x40
382 #define	MPI_SGE_FLAGS_ELEMENT_TYPE_MASK		0x30
383 #define	MPI_SGE_FLAGS_LOCAL_ADDRESS		0x08
384 #define	MPI_SGE_FLAGS_DIRECTION			0x04
385 #define	MPI_SGE_FLAGS_ADDRESS_SIZE		0x02
386 #define	MPI_SGE_FLAGS_END_OF_LIST		0x01
387 
388 #define	MPI_SGE_FLAGS_SHIFT			24
389 
390 #define	MPI_SGE_LENGTH_MASK			0x00FFFFFF
391 #define	MPI_SGE_CHAIN_LENGTH_MASK		0x0000FFFF
392 
393 /*
394  * Element Type
395  */
396 #define	MPI_SGE_FLAGS_TRANSACTION_ELEMENT	0x00
397 #define	MPI_SGE_FLAGS_SIMPLE_ELEMENT		0x10
398 #define	MPI_SGE_FLAGS_CHAIN_ELEMENT		0x30
399 #define	MPI_SGE_FLAGS_ELEMENT_MASK		0x30
400 
401 /*
402  * Address location
403  */
404 #define	MPI_SGE_FLAGS_SYSTEM_ADDRESS		0x00
405 
406 /*
407  * Direction
408  */
409 #define	MPI_SGE_FLAGS_IOC_TO_HOST		0x00
410 #define	MPI_SGE_FLAGS_HOST_TO_IOC		0x04
411 
412 /*
413  * Address Size
414  */
415 #define	MPI_SGE_FLAGS_32_BIT_ADDRESSING		0x00
416 #define	MPI_SGE_FLAGS_64_BIT_ADDRESSING		0x02
417 
418 /*
419  * Context Size
420  */
421 #define	MPI_SGE_FLAGS_32_BIT_CONTEXT		0x00
422 #define	MPI_SGE_FLAGS_64_BIT_CONTEXT		0x02
423 #define	MPI_SGE_FLAGS_96_BIT_CONTEXT		0x04
424 #define	MPI_SGE_FLAGS_128_BIT_CONTEXT		0x06
425 
426 #define	MPI_SGE_CHAIN_OFFSET_MASK		0x00FF0000
427 #define	MPI_SGE_CHAIN_OFFSET_SHIFT		16
428 
429 
430 /*
431  * SGE operation Macros
432  */
433 
434 /*
435  * SIMPLE FlagsLength manipulations...
436  */
437 #define	MPI_SGE_SET_FLAGS(f)		((uint32_t)(f) << MPI_SGE_FLAGS_SHIFT)
438 #define	MPI_SGE_GET_FLAGS(fl) \
439 	(((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT)
440 #define	MPI_SGE_LENGTH(fl)		((fl) & MPI_SGE_LENGTH_MASK)
441 #define	MPI_SGE_CHAIN_LENGTH(fl)	((fl) & MPI_SGE_CHAIN_LENGTH_MASK)
442 
443 #define	MPI_SGE_SET_FLAGS_LENGTH(f, l) \
444 	(MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l))
445 
446 #define	MPI_pSGE_GET_FLAGS(psg)		MPI_SGE_GET_FLAGS((psg)->FlagsLength)
447 #define	MPI_pSGE_GET_LENGTH(psg)	MPI_SGE_LENGTH((psg)->FlagsLength)
448 #define	MPI_pSGE_SET_FLAGS_LENGTH(psg, f, l) \
449 	(psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f, l)
450 
451 /*
452  * CAUTION - The following are READ-MODIFY-WRITE!
453  */
454 #define	MPI_pSGE_SET_FLAGS(psg, f) \
455 	(psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f)
456 #define	MPI_pSGE_SET_LENGTH(psg, l) \
457 	(psg)->FlagsLength |= MPI_SGE_LENGTH(l)
458 
459 #define	MPI_GET_CHAIN_OFFSET(x) \
460 	((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT)
461 
462 
463 /*
464  * Standard Message Structures
465  */
466 
467 /*
468  * Standard message request header for all request messages
469  */
470 typedef struct msg_request_header {
471 	uint8_t		Reserved[2];	/* function specific */
472 	uint8_t		ChainOffset;
473 	uint8_t		Function;
474 	uint8_t		Reserved1[3];	/* function specific */
475 	uint8_t		MsgFlags;
476 	uint32_t	MsgContext;
477 } msg_request_header_t;
478 
479 
480 /*
481  * Default Reply
482  */
483 typedef struct msg_default_reply {
484 	uint8_t		Reserved[2];	/* function specific */
485 	uint8_t		MsgLength;
486 	uint8_t		Function;
487 	uint8_t		Reserved1[3];	/* function specific */
488 	uint8_t		MsgFlags;
489 	uint32_t	MsgContext;
490 	uint8_t		Reserved2[2];	/* function specific */
491 	uint16_t	IOCStatus;
492 	uint32_t	IOCLogInfo;
493 } msg_default_reply_t;
494 
495 /*
496  * MsgFlags definition for all replies
497  */
498 #define	MPI_MSGFLAGS_CONTINUATION_REPLY		0x80
499 
500 
501 /*
502  * IOC Status Values
503  */
504 
505 /*
506  * Common IOCStatus values for all replies
507  */
508 #define	MPI_IOCSTATUS_SUCCESS				0x0000
509 #define	MPI_IOCSTATUS_INVALID_FUNCTION			0x0001
510 #define	MPI_IOCSTATUS_BUSY				0x0002
511 #define	MPI_IOCSTATUS_INVALID_SGL			0x0003
512 #define	MPI_IOCSTATUS_INTERNAL_ERROR			0x0004
513 #define	MPI_IOCSTATUS_RESERVED				0x0005
514 #define	MPI_IOCSTATUS_INSUFFICIENT_RESOURCES		0x0006
515 #define	MPI_IOCSTATUS_INVALID_FIELD			0x0007
516 #define	MPI_IOCSTATUS_INVALID_STATE			0x0008
517 #define	MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED		0x0009
518 
519 /*
520  * Config IOCStatus values
521  */
522 #define	MPI_IOCSTATUS_CONFIG_INVALID_ACTION		0x0020
523 #define	MPI_IOCSTATUS_CONFIG_INVALID_TYPE		0x0021
524 #define	MPI_IOCSTATUS_CONFIG_INVALID_PAGE		0x0022
525 #define	MPI_IOCSTATUS_CONFIG_INVALID_DATA		0x0023
526 #define	MPI_IOCSTATUS_CONFIG_NO_DEFAULTS		0x0024
527 #define	MPI_IOCSTATUS_CONFIG_CANT_COMMIT		0x0025
528 
529 /*
530  * SCSIIO Reply (SPI & FCP) initiator values
531  */
532 #define	MPI_IOCSTATUS_SCSI_RECOVERED_ERROR		0x0040
533 #define	MPI_IOCSTATUS_SCSI_INVALID_BUS			0x0041
534 #define	MPI_IOCSTATUS_SCSI_INVALID_TARGETID		0x0042
535 #define	MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE		0x0043
536 #define	MPI_IOCSTATUS_SCSI_DATA_OVERRUN			0x0044
537 #define	MPI_IOCSTATUS_SCSI_DATA_UNDERRUN		0x0045
538 #define	MPI_IOCSTATUS_SCSI_IO_DATA_ERROR		0x0046
539 #define	MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR		0x0047
540 #define	MPI_IOCSTATUS_SCSI_TASK_TERMINATED		0x0048
541 #define	MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH		0x0049
542 #define	MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED		0x004A
543 #define	MPI_IOCSTATUS_SCSI_IOC_TERMINATED		0x004B
544 #define	MPI_IOCSTATUS_SCSI_EXT_TERMINATED		0x004C
545 
546 /*
547  * SCSI Initiator/Target end-to-end data protection
548  */
549 #define	MPI_IOCSTATUS_EEDP_CRC_ERROR			0x004D
550 #define	MPI_IOCSTATUS_EEDP_LBA_TAG_ERROR		0x004E
551 #define	MPI_IOCSTATUS_EEDP_APP_TAG_ERROR		0x004F
552 /*
553  * SCSI (SPI & FCP) target values
554  */
555 #define	MPI_IOCSTATUS_TARGET_PRIORITY_IO		0x0060
556 #define	MPI_IOCSTATUS_TARGET_INVALID_PORT		0x0061
557 #define	MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX		0x0062
558 #define	MPI_IOCSTATUS_TARGET_ABORTED			0x0063
559 #define	MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE		0x0064
560 #define	MPI_IOCSTATUS_TARGET_NO_CONNECTION		0x0065
561 #define	MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH	0x006A
562 #define	MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT		0x006B
563 
564 /*
565  * Additional FCP target values
566  */
567 #define	MPI_IOCSTATUS_TARGET_FC_ABORTED			0x0066	/* obsolete */
568 #define	MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID		0x0067	/* obsolete */
569 #define	MPI_IOCSTATUS_TARGET_FC_DID_INVALID		0x0068	/* obsolete */
570 #define	MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT		0x0069	/* obsolete */
571 
572 /*
573  * Fibre Channel Direct Access values
574  */
575 #define	MPI_IOCSTATUS_FC_ABORTED			0x0066
576 #define	MPI_IOCSTATUS_FC_RX_ID_INVALID			0x0067
577 #define	MPI_IOCSTATUS_FC_DID_INVALID			0x0068
578 #define	MPI_IOCSTATUS_FC_NODE_LOGGED_OUT		0x0069
579 #define	MPI_IOCSTATUS_FC_EXCHANGE_CANCELED		0x006C
580 
581 /*
582  * LAN values
583  */
584 #define	MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND		0x0080
585 #define	MPI_IOCSTATUS_LAN_DEVICE_FAILURE		0x0081
586 #define	MPI_IOCSTATUS_LAN_TRANSMIT_ERROR		0x0082
587 #define	MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED		0x0083
588 #define	MPI_IOCSTATUS_LAN_RECEIVE_ERROR			0x0084
589 #define	MPI_IOCSTATUS_LAN_RECEIVE_ABORTED		0x0085
590 #define	MPI_IOCSTATUS_LAN_PARTIAL_PACKET		0x0086
591 #define	MPI_IOCSTATUS_LAN_CANCELED			0x0087
592 
593 /*
594  * SAS values
595  */
596 #define	MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED		0x0090
597 #define	MPI_IOCSTATUS_SAS_SMP_DATA_OVERRUN		0x0091
598 
599 /*
600  * Inband values
601  */
602 #define	MPI_IOCSTATUS_INBAND_ABORTED			0x0098
603 #define	MPI_IOCSTATUS_INBAND_NO_CONNECTION		0x0099
604 
605 /*
606  * Diagnostic Tools values
607  */
608 #define	MPI_IOCSTATUS_DIAGNOSTIC_RELEASED		0x00A0
609 
610 /*
611  * IOCStatus flag to indicate that log info is available
612  */
613 #define	MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE		0x8000
614 #define	MPI_IOCSTATUS_MASK				0x7FFF
615 
616 /*
617  * LogInfo Types
618  */
619 #define	MPI_IOCLOGINFO_TYPE_MASK			0xF0000000
620 #define	MPI_IOCLOGINFO_TYPE_NONE			0x0
621 #define	MPI_IOCLOGINFO_TYPE_SCSI			0x1
622 #define	MPI_IOCLOGINFO_TYPE_FC				0x2
623 #define	MPI_IOCLOGINFO_TYPE_SAS				0x3
624 #define	MPI_IOCLOGINFO_TYPE_ISCSI			0x4
625 #define	MPI_IOCLOGINFO_LOG_DATA_MASK			0x0FFFFFFF
626 
627 /*
628  * SMP passthrough messages
629  */
630 typedef struct msg_smp_passthrough {
631 	uint8_t			Flags;
632 	uint8_t			PhysicalPort;
633 	uint8_t			ChainOffset;
634 	uint8_t			Function;
635 	uint16_t		RequestDataLength;
636 	uint8_t			ConnectionRate;
637 	uint8_t			MsgFlags;
638 	uint32_t		MsgContext;
639 	uint8_t			Reserved[4];
640 	uint64_t		SASAddress;
641 	uint8_t			Reserved1[8];
642 } msg_smp_passthrough_t;
643 
644 
645 /* SMP passthrough Reply */
646 
647 typedef struct msg_smp_passthrough_reply {
648 	uint8_t			Flags;
649 	uint8_t			PhysicalPort;
650 	uint8_t			MsgLength;
651 	uint8_t			Function;
652 	uint16_t		ResponseDataLength;
653 	uint8_t			Reserved;
654 	uint8_t			MsgFlags;
655 	uint32_t		MsgContext;
656 	uint8_t			Reserved1;
657 	uint8_t			SASStatus;
658 	uint16_t		IOCStatus;
659 	uint32_t		IOCLogInfo;
660 	uint8_t			Reserved2[4];
661 } msg_smp_passthrough_reply_t;
662 
663 #define	MPI_SMP_PT_REQ_CONNECT_RATE_NEGOTIATED	(0x00)
664 #define	MPI_SMP_PT_REQ_CONNECT_RATE_1_5		(0x08)
665 #define	MPI_SMP_PT_REQ_CONNECT_RATE_3_0		(0x09)
666 #define	MPI_SASSTATUS_SUCCESS			0
667 
668 #ifdef	__cplusplus
669 }
670 #endif
671 
672 #endif	/* _SYS_MPI_H */
673