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