xref: /titanic_52/usr/src/uts/common/sys/mpt/mpi.h (revision 936b7af69172dce89b577831f79c0e18d15e854b)
17c478bd9Sstevel@tonic-gate /*
2*936b7af6Sjw149990  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate #ifndef _SYS_MPI_H
77c478bd9Sstevel@tonic-gate #define	_SYS_MPI_H
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
107c478bd9Sstevel@tonic-gate 
117c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
127c478bd9Sstevel@tonic-gate extern "C" {
137c478bd9Sstevel@tonic-gate #endif
147c478bd9Sstevel@tonic-gate 
157c478bd9Sstevel@tonic-gate /*
167c478bd9Sstevel@tonic-gate  * This header file is based on Version 1.2 of the MPT
177c478bd9Sstevel@tonic-gate  * Specification by LSI Logic, Inc.
187c478bd9Sstevel@tonic-gate  */
197c478bd9Sstevel@tonic-gate 
207c478bd9Sstevel@tonic-gate /*
217c478bd9Sstevel@tonic-gate  *  MPI Version Definitions
227c478bd9Sstevel@tonic-gate  */
237c478bd9Sstevel@tonic-gate #define	MPI_VERSION_MAJOR	(0x01)
247c478bd9Sstevel@tonic-gate #define	MPI_VERSION_MINOR	(0x05)
257c478bd9Sstevel@tonic-gate #define	MPI_VERSION_MAJOR_MASK	(0xFF00)
267c478bd9Sstevel@tonic-gate #define	MPI_VERSION_MAJOR_SHIFT	(8)
277c478bd9Sstevel@tonic-gate #define	MPI_VERSION_MINOR_MASK	(0x00FF)
287c478bd9Sstevel@tonic-gate #define	MPI_VERSION_MINOR_SHIFT	(0)
297c478bd9Sstevel@tonic-gate #define	MPI_VERSION	((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) |   \
307c478bd9Sstevel@tonic-gate 	MPI_VERSION_MINOR)
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #define	MPI_HEADER_VERSION_UNIT	(0x00)
337c478bd9Sstevel@tonic-gate #define	MPI_HEADER_VERSION_DEV	(0x00)
347c478bd9Sstevel@tonic-gate #define	MPI_HEADER_VERSION_UNIT_MASK	(0xFF00)
357c478bd9Sstevel@tonic-gate #define	MPI_HEADER_VERSION_UNIT_SHIFT	(8)
367c478bd9Sstevel@tonic-gate #define	MPI_HEADER_VERSION_DEV_MASK	(0x00FF)
377c478bd9Sstevel@tonic-gate #define	MPI_HEADER_VERSION_DEV_SHIFT	(0)
387c478bd9Sstevel@tonic-gate #define	MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) |  \
397c478bd9Sstevel@tonic-gate 	MPI_HEADER_VERSION_DEV)
407c478bd9Sstevel@tonic-gate /* Note: The major versions of 0xe0 through 0xff are reserved */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * IOC State Definitions
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate #define	MPI_IOC_STATE_RESET			0x00000000
467c478bd9Sstevel@tonic-gate #define	MPI_IOC_STATE_READY			0x10000000
477c478bd9Sstevel@tonic-gate #define	MPI_IOC_STATE_OPERATIONAL		0x20000000
487c478bd9Sstevel@tonic-gate #define	MPI_IOC_STATE_FAULT			0x40000000
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #define	MPI_IOC_STATE_MASK			0xF0000000
517c478bd9Sstevel@tonic-gate #define	MPI_IOC_STATE_SHIFT			28
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Fault state codes (product independent range 0x8000-0xFFFF)
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate #define	MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR	0x8111
577c478bd9Sstevel@tonic-gate #define	MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT		0x8112
587c478bd9Sstevel@tonic-gate #define	MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR	0x8113
597c478bd9Sstevel@tonic-gate #define	MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT		0x8114
607c478bd9Sstevel@tonic-gate #define	MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR		0x8115
617c478bd9Sstevel@tonic-gate #define	MPI_FAULT_DATA_SEND_PCI_BUS_FAULT		0x8116
627c478bd9Sstevel@tonic-gate #define	MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR		0x8117
637c478bd9Sstevel@tonic-gate #define	MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT		0x8118
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /*
677c478bd9Sstevel@tonic-gate  * System Doorbell
687c478bd9Sstevel@tonic-gate  */
697c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_OFFSET			0x00000000
707c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_ACTIVE			0x08000000
717c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_USED			MPI_DOORBELL_ACTIVE
727c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_ACTIVE_SHIFT		27
737c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_WHO_INIT_MASK		0x07000000
747c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_WHO_INIT_SHIFT		24
757c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_FUNCTION_MASK		0xFF000000
767c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_FUNCTION_SHIFT		24
777c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_ADD_DWORDS_MASK		0x00FF0000
787c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_ADD_DWORDS_SHIFT		16
797c478bd9Sstevel@tonic-gate #define	MPI_DOORBELL_DATA_MASK			0x0000FFFF
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /*
837c478bd9Sstevel@tonic-gate  * PCI System Interface Registers
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate #define	MPI_WRITE_SEQUENCE_OFFSET		0x00000004
867c478bd9Sstevel@tonic-gate #define	MPI_WRSEQ_KEY_VALUE_MASK		0x0000000F
877c478bd9Sstevel@tonic-gate #define	MPI_WRSEQ_1ST_KEY_VALUE			0x04
887c478bd9Sstevel@tonic-gate #define	MPI_WRSEQ_2ND_KEY_VALUE			0x0B
897c478bd9Sstevel@tonic-gate #define	MPI_WRSEQ_3RD_KEY_VALUE			0x02
907c478bd9Sstevel@tonic-gate #define	MPI_WRSEQ_4TH_KEY_VALUE			0x07
917c478bd9Sstevel@tonic-gate #define	MPI_WRSEQ_5TH_KEY_VALUE			0x0D
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #define	MPI_DIAGNOSTIC_OFFSET			0x00000008
947c478bd9Sstevel@tonic-gate #define	MPI_DIAG_CLEAR_FLASH_BAD_SIG		0x00000400
957c478bd9Sstevel@tonic-gate #define	MPI_DIAG_PREVENT_IOC_BOOT		0x00000200
967c478bd9Sstevel@tonic-gate #define	MPI_DIAG_DRWE				0x00000080
977c478bd9Sstevel@tonic-gate #define	MPI_DIAG_FLASH_BAD_SIG			0x00000040
987c478bd9Sstevel@tonic-gate #define	MPI_DIAG_RESET_HISTORY			0x00000020
997c478bd9Sstevel@tonic-gate #define	MPI_DIAG_RW_ENABLE			0x00000010
1007c478bd9Sstevel@tonic-gate #define	MPI_DIAG_RESET_ADAPTER			0x00000004
1017c478bd9Sstevel@tonic-gate #define	MPI_DIAG_DISABLE_ARM			0x00000002
1027c478bd9Sstevel@tonic-gate #define	MPI_DIAG_MEM_ENABLE			0x00000001
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #define	MPI_TEST_BASE_ADDRESS_OFFSET		0x0000000C
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate #define	MPI_DIAG_RW_DATA_OFFSET			0x00000010
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate #define	MPI_DIAG_RW_ADDRESS_OFFSET		0x00000014
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #define	MPI_HOST_INTERRUPT_STATUS_OFFSET	0x00000030
1117c478bd9Sstevel@tonic-gate #define	MPI_HIS_IOP_DOORBELL_STATUS		0x80000000
1127c478bd9Sstevel@tonic-gate #define	MPI_HIS_REPLY_MESSAGE_INTERRUPT		0x00000008
1137c478bd9Sstevel@tonic-gate #define	MPI_HIS_DOORBELL_INTERRUPT		0x00000001
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #define	MPI_HOST_INTERRUPT_MASK_OFFSET		0x00000034
1167c478bd9Sstevel@tonic-gate #define	MPI_HIM_RIM				0x00000008
1177c478bd9Sstevel@tonic-gate #define	MPI_HIM_DIM				0x00000001
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate #define	MPI_REQUEST_QUEUE_OFFSET		0x00000040
1207c478bd9Sstevel@tonic-gate #define	MPI_REQUEST_POST_FIFO_OFFSET		0x00000040
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate #define	MPI_REPLY_QUEUE_OFFSET			0x00000044
1237c478bd9Sstevel@tonic-gate #define	MPI_REPLY_POST_FIFO_OFFSET		0x00000044
1247c478bd9Sstevel@tonic-gate #define	MPI_REPLY_FREE_FIFO_OFFSET		0x00000044
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate #define	MPI_HI_PRI_REQUEST_QUEUE_OFFSET		0x00000048
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /*
1297c478bd9Sstevel@tonic-gate  * Message Frame Descriptors
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate #define	MPI_REQ_MF_DESCRIPTOR_NB_MASK		0x00000003
1327c478bd9Sstevel@tonic-gate #define	MPI_REQ_MF_DESCRIPTOR_F_BIT		0x00000004
1337c478bd9Sstevel@tonic-gate #define	MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK	0xFFFFFFF8
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate #define	MPI_ADDRESS_REPLY_A_BIT			0x80000000
1367c478bd9Sstevel@tonic-gate #define	MPI_ADDRESS_REPLY_ADDRESS_MASK		0x7FFFFFFF
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate #define	MPI_CONTEXT_REPLY_A_BIT			0x80000000
1397c478bd9Sstevel@tonic-gate #define	MPI_CONTEXT_REPLY_TYPE_MASK		0x60000000
1407c478bd9Sstevel@tonic-gate #define	MPI_CONTEXT_REPLY_TYPE_SCSI_INIT	0x00
1417c478bd9Sstevel@tonic-gate #define	MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET	0x01
1427c478bd9Sstevel@tonic-gate #define	MPI_CONTEXT_REPLY_TYPE_LAN		0x02
1437c478bd9Sstevel@tonic-gate #define	MPI_CONTEXT_REPLY_TYPE_SHIFT		29
1447c478bd9Sstevel@tonic-gate #define	MPI_CONTEXT_REPLY_CONTEXT_MASK		0x1FFFFFFF
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * Context Reply macros
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate #define	MPI_GET_CONTEXT_REPLY_TYPE(x)  \
1517c478bd9Sstevel@tonic-gate 	(((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \
1527c478bd9Sstevel@tonic-gate 		>> MPI_CONTEXT_REPLY_TYPE_SHIFT)
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #define	MPI_SET_CONTEXT_REPLY_TYPE(x, typ) \
1557c478bd9Sstevel@tonic-gate 	((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) | \
1567c478bd9Sstevel@tonic-gate 		(((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) & \
1577c478bd9Sstevel@tonic-gate 			MPI_CONTEXT_REPLY_TYPE_MASK))
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate /*
1617c478bd9Sstevel@tonic-gate  * Message Functions
1627c478bd9Sstevel@tonic-gate  *     0x80 -> 0x8F reserved for private message use per product
1637c478bd9Sstevel@tonic-gate  */
1647c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_SCSI_IO_REQUEST			0x00
1657c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_SCSI_TASK_MGMT			0x01
1667c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_IOC_INIT				0x02
1677c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_IOC_FACTS				0x03
1687c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_CONFIG				0x04
1697c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_PORT_FACTS				0x05
1707c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_PORT_ENABLE			0x06
1717c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_EVENT_NOTIFICATION			0x07
1727c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_EVENT_ACK				0x08
1737c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_FW_DOWNLOAD			0x09
1747c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_TARGET_CMD_BUFFER_POST		0x0A
1757c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_TARGET_ASSIST			0x0B
1767c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_TARGET_STATUS_SEND			0x0C
1777c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_TARGET_MODE_ABORT			0x0D
1787c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_FC_LINK_SRVC_BUF_POST		0x0E
1797c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_FC_LINK_SRVC_RSP			0x0F
1807c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_FC_EX_LINK_SRVC_SEND		0x10
1817c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_FC_ABORT				0x11
1827c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_FW_UPLOAD				0x12
1837c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND		0x13
1847c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_FC_PRIMITIVE_SEND			0x14
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_RAID_ACTION			0x15
1877c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH		0x16
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_TOOLBOX				0x17
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR		0x18
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_MAILBOX				0x19
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_SMP_PASSTHROUGH			0x1A
1967c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_SAS_IO_UNIT_CONTROL		0x1B
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate #define	MPI_DIAG_BUFFER_POST				0x1D
1997c478bd9Sstevel@tonic-gate #define	MPI_DIAG_RELEASE				0x1E
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_SCSI_IO_32				0x1F
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_LAN_SEND				0x20
2047c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_LAN_RECEIVE			0x21
2057c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_LAN_RESET				0x22
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_INBAND_BUFFER_POST			0x28
2087c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_INBAND_SEND			0x29
2097c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_INBAND_RSP				0x2A
2107c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_INBAND_ABORT			0x2B
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET		0x40
2137c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_IO_UNIT_RESET			0x41
2147c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_HANDSHAKE				0x42
2157c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_REPLY_FRAME_REMOVAL		0x43
2167c478bd9Sstevel@tonic-gate #define	MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL	0x44
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate /*
2197c478bd9Sstevel@tonic-gate  * Version format
2207c478bd9Sstevel@tonic-gate  */
2217c478bd9Sstevel@tonic-gate typedef struct mpi_version_struct {
2227c478bd9Sstevel@tonic-gate 	uint8_t		Dev;
2237c478bd9Sstevel@tonic-gate 	uint8_t		Unit;
2247c478bd9Sstevel@tonic-gate 	uint8_t		Minor;
2257c478bd9Sstevel@tonic-gate 	uint8_t		Major;
2267c478bd9Sstevel@tonic-gate } mpi_version_struct_t;
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate typedef union mpi_version_format {
2297c478bd9Sstevel@tonic-gate 	mpi_version_struct_t	Struct;
2307c478bd9Sstevel@tonic-gate 	uint32_t		Word;
2317c478bd9Sstevel@tonic-gate } mpi_version_format_t;
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate /*
2347c478bd9Sstevel@tonic-gate  * Scatter Gather Elements
2357c478bd9Sstevel@tonic-gate  */
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate /*
2387c478bd9Sstevel@tonic-gate  * Simple element structures
2397c478bd9Sstevel@tonic-gate  */
2407c478bd9Sstevel@tonic-gate typedef struct sge_simple32 {
2417c478bd9Sstevel@tonic-gate 	uint32_t	FlagsLength;
2427c478bd9Sstevel@tonic-gate 	uint32_t	Address;
2437c478bd9Sstevel@tonic-gate } sge_simple32_t;
2447c478bd9Sstevel@tonic-gate 
2457c478bd9Sstevel@tonic-gate typedef struct sge_simple64 {
2467c478bd9Sstevel@tonic-gate 	uint32_t	FlagsLength;
2477c478bd9Sstevel@tonic-gate 	uint32_t	Address_Low;
2487c478bd9Sstevel@tonic-gate 	uint32_t	Address_High;
2497c478bd9Sstevel@tonic-gate } sge_simple64_t;
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate typedef struct sge_simple_union {
2527c478bd9Sstevel@tonic-gate 	uint32_t	FlagsLength;
2537c478bd9Sstevel@tonic-gate 	union {
2547c478bd9Sstevel@tonic-gate 		uint32_t	Address32;
2557c478bd9Sstevel@tonic-gate 		uint32_t	Address64_Low;
2567c478bd9Sstevel@tonic-gate 		uint32_t	Address64_High;
2577c478bd9Sstevel@tonic-gate 	} u1;
2587c478bd9Sstevel@tonic-gate } sge_simple_union_t;
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate /*
2617c478bd9Sstevel@tonic-gate  * Chain element structures
2627c478bd9Sstevel@tonic-gate  */
2637c478bd9Sstevel@tonic-gate typedef struct sge_chain32 {
2647c478bd9Sstevel@tonic-gate 	uint16_t	Length;
2657c478bd9Sstevel@tonic-gate 	uint8_t		NextChainOffset;
2667c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
2677c478bd9Sstevel@tonic-gate 	uint32_t	Address;
2687c478bd9Sstevel@tonic-gate } sge_chain32_t;
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate typedef struct sge_chain64 {
2717c478bd9Sstevel@tonic-gate 	uint16_t	Length;
2727c478bd9Sstevel@tonic-gate 	uint8_t		NextChainOffset;
2737c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
2747c478bd9Sstevel@tonic-gate 	uint32_t	Address64_Low;
2757c478bd9Sstevel@tonic-gate 	uint32_t	Address64_High;
2767c478bd9Sstevel@tonic-gate } sge_chain64_t;
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate typedef struct sge_chain_union {
2797c478bd9Sstevel@tonic-gate 	uint16_t	Length;
2807c478bd9Sstevel@tonic-gate 	uint8_t		NextChainOffset;
2817c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
2827c478bd9Sstevel@tonic-gate 	union {
2837c478bd9Sstevel@tonic-gate 		uint32_t	Address32;
2847c478bd9Sstevel@tonic-gate 		uint32_t	Address64_Low;
2857c478bd9Sstevel@tonic-gate 		uint32_t	Address64_High;
2867c478bd9Sstevel@tonic-gate 	} u1;
2877c478bd9Sstevel@tonic-gate } sge_chain_union_t;
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate /*
2907c478bd9Sstevel@tonic-gate  *  Transaction Context element
2917c478bd9Sstevel@tonic-gate  */
2927c478bd9Sstevel@tonic-gate typedef struct sge_transaction32 {
2937c478bd9Sstevel@tonic-gate 	uint8_t		Reserved;
2947c478bd9Sstevel@tonic-gate 	uint8_t		ContextSize;
2957c478bd9Sstevel@tonic-gate 	uint8_t		DetailsLength;
2967c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
2977c478bd9Sstevel@tonic-gate 	uint32_t	TransactionContext[1];
2987c478bd9Sstevel@tonic-gate 	uint32_t	TransactionDetails[1];
2997c478bd9Sstevel@tonic-gate } sge_transaction32_t;
3007c478bd9Sstevel@tonic-gate 
3017c478bd9Sstevel@tonic-gate typedef struct sge_transaction64 {
3027c478bd9Sstevel@tonic-gate 	uint8_t		Reserved;
3037c478bd9Sstevel@tonic-gate 	uint8_t		ContextSize;
3047c478bd9Sstevel@tonic-gate 	uint8_t		DetailsLength;
3057c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
3067c478bd9Sstevel@tonic-gate 	uint32_t	TransactionContext[2];
3077c478bd9Sstevel@tonic-gate 	uint32_t	TransactionDetails[1];
3087c478bd9Sstevel@tonic-gate } sge_transaction64_t;
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate typedef struct sge_transaction96 {
3117c478bd9Sstevel@tonic-gate 	uint8_t		Reserved;
3127c478bd9Sstevel@tonic-gate 	uint8_t		ContextSize;
3137c478bd9Sstevel@tonic-gate 	uint8_t		DetailsLength;
3147c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
3157c478bd9Sstevel@tonic-gate 	uint32_t	TransactionContext[3];
3167c478bd9Sstevel@tonic-gate 	uint32_t	TransactionDetails[1];
3177c478bd9Sstevel@tonic-gate } sge_transaction96_t;
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate typedef struct sge_transaction128 {
3207c478bd9Sstevel@tonic-gate 	uint8_t		Reserved;
3217c478bd9Sstevel@tonic-gate 	uint8_t		ContextSize;
3227c478bd9Sstevel@tonic-gate 	uint8_t		DetailsLength;
3237c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
3247c478bd9Sstevel@tonic-gate 	uint32_t	TransactionContext[4];
3257c478bd9Sstevel@tonic-gate 	uint32_t	TransactionDetails[1];
3267c478bd9Sstevel@tonic-gate } sge_transaction128_t;
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate typedef struct sge_transaction_union {
3297c478bd9Sstevel@tonic-gate 	uint8_t		Reserved;
3307c478bd9Sstevel@tonic-gate 	uint8_t		ContextSize;
3317c478bd9Sstevel@tonic-gate 	uint8_t		DetailsLength;
3327c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
3337c478bd9Sstevel@tonic-gate 	union {
3347c478bd9Sstevel@tonic-gate 		uint32_t	TransactionContext32[1];
3357c478bd9Sstevel@tonic-gate 		uint32_t	TransactionContext64[2];
3367c478bd9Sstevel@tonic-gate 		uint32_t	TransactionContext96[3];
3377c478bd9Sstevel@tonic-gate 		uint32_t	TransactionContext128[4];
3387c478bd9Sstevel@tonic-gate 	} u1;
3397c478bd9Sstevel@tonic-gate 	uint32_t	TransactionDetails[1];
3407c478bd9Sstevel@tonic-gate } sge_transaction_union_t;
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate /*
3447c478bd9Sstevel@tonic-gate  * SGE IO types union  for IO SGL's
3457c478bd9Sstevel@tonic-gate  */
3467c478bd9Sstevel@tonic-gate typedef struct sge_io_union {
3477c478bd9Sstevel@tonic-gate 	union {
3487c478bd9Sstevel@tonic-gate 		sge_simple_union_t	Simple;
3497c478bd9Sstevel@tonic-gate 		sge_chain_union_t	Chain;
3507c478bd9Sstevel@tonic-gate 	} u1;
3517c478bd9Sstevel@tonic-gate } sge_io_union_t;
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate /*
3547c478bd9Sstevel@tonic-gate  * SGE union for SGL's with Simple and Transaction elements
3557c478bd9Sstevel@tonic-gate  */
3567c478bd9Sstevel@tonic-gate typedef struct sge_trans_simple_union {
3577c478bd9Sstevel@tonic-gate 	union {
3587c478bd9Sstevel@tonic-gate 		sge_simple_union_t	Simple;
3597c478bd9Sstevel@tonic-gate 		sge_transaction_union_t	Transaction;
3607c478bd9Sstevel@tonic-gate 	} u1;
3617c478bd9Sstevel@tonic-gate } sge_trans_simple_union_t;
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate /*
3647c478bd9Sstevel@tonic-gate  * All SGE types union
3657c478bd9Sstevel@tonic-gate  */
3667c478bd9Sstevel@tonic-gate typedef struct sge_mpi_union {
3677c478bd9Sstevel@tonic-gate 	union {
3687c478bd9Sstevel@tonic-gate 		sge_simple_union_t	Simple;
3697c478bd9Sstevel@tonic-gate 		sge_chain_union_t	Chain;
3707c478bd9Sstevel@tonic-gate 		sge_transaction_union_t	Transaction;
3717c478bd9Sstevel@tonic-gate 	} u1;
3727c478bd9Sstevel@tonic-gate } sge_mpi_union_t;
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate /*
3767c478bd9Sstevel@tonic-gate  * SGE field definition and masks
3777c478bd9Sstevel@tonic-gate  */
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate /*
3807c478bd9Sstevel@tonic-gate  * Flags field bit definitions
3817c478bd9Sstevel@tonic-gate  */
3827c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_LAST_ELEMENT		0x80
3837c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_END_OF_BUFFER		0x40
3847c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_ELEMENT_TYPE_MASK		0x30
3857c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_LOCAL_ADDRESS		0x08
3867c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_DIRECTION			0x04
3877c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_ADDRESS_SIZE		0x02
3887c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_END_OF_LIST		0x01
3897c478bd9Sstevel@tonic-gate 
3907c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_SHIFT			24
3917c478bd9Sstevel@tonic-gate 
3927c478bd9Sstevel@tonic-gate #define	MPI_SGE_LENGTH_MASK			0x00FFFFFF
3937c478bd9Sstevel@tonic-gate #define	MPI_SGE_CHAIN_LENGTH_MASK		0x0000FFFF
3947c478bd9Sstevel@tonic-gate 
3957c478bd9Sstevel@tonic-gate /*
3967c478bd9Sstevel@tonic-gate  * Element Type
3977c478bd9Sstevel@tonic-gate  */
3987c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_TRANSACTION_ELEMENT	0x00
3997c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_SIMPLE_ELEMENT		0x10
4007c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_CHAIN_ELEMENT		0x30
4017c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_ELEMENT_MASK		0x30
4027c478bd9Sstevel@tonic-gate 
4037c478bd9Sstevel@tonic-gate /*
4047c478bd9Sstevel@tonic-gate  * Address location
4057c478bd9Sstevel@tonic-gate  */
4067c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_SYSTEM_ADDRESS		0x00
4077c478bd9Sstevel@tonic-gate 
4087c478bd9Sstevel@tonic-gate /*
4097c478bd9Sstevel@tonic-gate  * Direction
4107c478bd9Sstevel@tonic-gate  */
4117c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_IOC_TO_HOST		0x00
4127c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_HOST_TO_IOC		0x04
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate /*
4157c478bd9Sstevel@tonic-gate  * Address Size
4167c478bd9Sstevel@tonic-gate  */
4177c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_32_BIT_ADDRESSING		0x00
4187c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_64_BIT_ADDRESSING		0x02
4197c478bd9Sstevel@tonic-gate 
4207c478bd9Sstevel@tonic-gate /*
4217c478bd9Sstevel@tonic-gate  * Context Size
4227c478bd9Sstevel@tonic-gate  */
4237c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_32_BIT_CONTEXT		0x00
4247c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_64_BIT_CONTEXT		0x02
4257c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_96_BIT_CONTEXT		0x04
4267c478bd9Sstevel@tonic-gate #define	MPI_SGE_FLAGS_128_BIT_CONTEXT		0x06
4277c478bd9Sstevel@tonic-gate 
4287c478bd9Sstevel@tonic-gate #define	MPI_SGE_CHAIN_OFFSET_MASK		0x00FF0000
4297c478bd9Sstevel@tonic-gate #define	MPI_SGE_CHAIN_OFFSET_SHIFT		16
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate 
4327c478bd9Sstevel@tonic-gate /*
4337c478bd9Sstevel@tonic-gate  * SGE operation Macros
4347c478bd9Sstevel@tonic-gate  */
4357c478bd9Sstevel@tonic-gate 
4367c478bd9Sstevel@tonic-gate /*
4377c478bd9Sstevel@tonic-gate  * SIMPLE FlagsLength manipulations...
4387c478bd9Sstevel@tonic-gate  */
4397c478bd9Sstevel@tonic-gate #define	MPI_SGE_SET_FLAGS(f)		((uint32_t)(f) << MPI_SGE_FLAGS_SHIFT)
4407c478bd9Sstevel@tonic-gate #define	MPI_SGE_GET_FLAGS(fl) \
4417c478bd9Sstevel@tonic-gate 	(((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT)
4427c478bd9Sstevel@tonic-gate #define	MPI_SGE_LENGTH(fl)		((fl) & MPI_SGE_LENGTH_MASK)
4437c478bd9Sstevel@tonic-gate #define	MPI_SGE_CHAIN_LENGTH(fl)	((fl) & MPI_SGE_CHAIN_LENGTH_MASK)
4447c478bd9Sstevel@tonic-gate 
4457c478bd9Sstevel@tonic-gate #define	MPI_SGE_SET_FLAGS_LENGTH(f, l) \
4467c478bd9Sstevel@tonic-gate 	(MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l))
4477c478bd9Sstevel@tonic-gate 
4487c478bd9Sstevel@tonic-gate #define	MPI_pSGE_GET_FLAGS(psg)		MPI_SGE_GET_FLAGS((psg)->FlagsLength)
4497c478bd9Sstevel@tonic-gate #define	MPI_pSGE_GET_LENGTH(psg)	MPI_SGE_LENGTH((psg)->FlagsLength)
4507c478bd9Sstevel@tonic-gate #define	MPI_pSGE_SET_FLAGS_LENGTH(psg, f, l) \
4517c478bd9Sstevel@tonic-gate 	(psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f, l)
4527c478bd9Sstevel@tonic-gate 
4537c478bd9Sstevel@tonic-gate /*
4547c478bd9Sstevel@tonic-gate  * CAUTION - The following are READ-MODIFY-WRITE!
4557c478bd9Sstevel@tonic-gate  */
4567c478bd9Sstevel@tonic-gate #define	MPI_pSGE_SET_FLAGS(psg, f) \
4577c478bd9Sstevel@tonic-gate 	(psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f)
4587c478bd9Sstevel@tonic-gate #define	MPI_pSGE_SET_LENGTH(psg, l) \
4597c478bd9Sstevel@tonic-gate 	(psg)->FlagsLength |= MPI_SGE_LENGTH(l)
4607c478bd9Sstevel@tonic-gate 
4617c478bd9Sstevel@tonic-gate #define	MPI_GET_CHAIN_OFFSET(x) \
4627c478bd9Sstevel@tonic-gate 	((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT)
4637c478bd9Sstevel@tonic-gate 
4647c478bd9Sstevel@tonic-gate 
4657c478bd9Sstevel@tonic-gate /*
4667c478bd9Sstevel@tonic-gate  * Standard Message Structures
4677c478bd9Sstevel@tonic-gate  */
4687c478bd9Sstevel@tonic-gate 
4697c478bd9Sstevel@tonic-gate /*
4707c478bd9Sstevel@tonic-gate  * Standard message request header for all request messages
4717c478bd9Sstevel@tonic-gate  */
4727c478bd9Sstevel@tonic-gate typedef struct msg_request_header {
4737c478bd9Sstevel@tonic-gate 	uint8_t		Reserved[2];	/* function specific */
4747c478bd9Sstevel@tonic-gate 	uint8_t		ChainOffset;
4757c478bd9Sstevel@tonic-gate 	uint8_t		Function;
4767c478bd9Sstevel@tonic-gate 	uint8_t		Reserved1[3];	/* function specific */
4777c478bd9Sstevel@tonic-gate 	uint8_t		MsgFlags;
4787c478bd9Sstevel@tonic-gate 	uint32_t	MsgContext;
4797c478bd9Sstevel@tonic-gate } msg_request_header_t;
4807c478bd9Sstevel@tonic-gate 
4817c478bd9Sstevel@tonic-gate 
4827c478bd9Sstevel@tonic-gate /*
4837c478bd9Sstevel@tonic-gate  * Default Reply
4847c478bd9Sstevel@tonic-gate  */
4857c478bd9Sstevel@tonic-gate typedef struct msg_default_reply {
4867c478bd9Sstevel@tonic-gate 	uint8_t		Reserved[2];	/* function specific */
4877c478bd9Sstevel@tonic-gate 	uint8_t		MsgLength;
4887c478bd9Sstevel@tonic-gate 	uint8_t		Function;
4897c478bd9Sstevel@tonic-gate 	uint8_t		Reserved1[3];	/* function specific */
4907c478bd9Sstevel@tonic-gate 	uint8_t		MsgFlags;
4917c478bd9Sstevel@tonic-gate 	uint32_t	MsgContext;
4927c478bd9Sstevel@tonic-gate 	uint8_t		Reserved2[2];	/* function specific */
4937c478bd9Sstevel@tonic-gate 	uint16_t	IOCStatus;
4947c478bd9Sstevel@tonic-gate 	uint32_t	IOCLogInfo;
4957c478bd9Sstevel@tonic-gate } msg_default_reply_t;
4967c478bd9Sstevel@tonic-gate 
4977c478bd9Sstevel@tonic-gate /*
4987c478bd9Sstevel@tonic-gate  * MsgFlags definition for all replies
4997c478bd9Sstevel@tonic-gate  */
5007c478bd9Sstevel@tonic-gate #define	MPI_MSGFLAGS_CONTINUATION_REPLY		0x80
5017c478bd9Sstevel@tonic-gate 
5027c478bd9Sstevel@tonic-gate 
5037c478bd9Sstevel@tonic-gate /*
5047c478bd9Sstevel@tonic-gate  * IOC Status Values
5057c478bd9Sstevel@tonic-gate  */
5067c478bd9Sstevel@tonic-gate 
5077c478bd9Sstevel@tonic-gate /*
5087c478bd9Sstevel@tonic-gate  * Common IOCStatus values for all replies
5097c478bd9Sstevel@tonic-gate  */
5107c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SUCCESS				0x0000
5117c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_INVALID_FUNCTION			0x0001
5127c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_BUSY				0x0002
5137c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_INVALID_SGL			0x0003
5147c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_INTERNAL_ERROR			0x0004
5157c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_RESERVED				0x0005
5167c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_INSUFFICIENT_RESOURCES		0x0006
5177c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_INVALID_FIELD			0x0007
5187c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_INVALID_STATE			0x0008
5197c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED		0x0009
5207c478bd9Sstevel@tonic-gate 
5217c478bd9Sstevel@tonic-gate /*
5227c478bd9Sstevel@tonic-gate  * Config IOCStatus values
5237c478bd9Sstevel@tonic-gate  */
5247c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_CONFIG_INVALID_ACTION		0x0020
5257c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_CONFIG_INVALID_TYPE		0x0021
5267c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_CONFIG_INVALID_PAGE		0x0022
5277c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_CONFIG_INVALID_DATA		0x0023
5287c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_CONFIG_NO_DEFAULTS		0x0024
5297c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_CONFIG_CANT_COMMIT		0x0025
5307c478bd9Sstevel@tonic-gate 
5317c478bd9Sstevel@tonic-gate /*
5327c478bd9Sstevel@tonic-gate  * SCSIIO Reply (SPI & FCP) initiator values
5337c478bd9Sstevel@tonic-gate  */
5347c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_RECOVERED_ERROR		0x0040
5357c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_INVALID_BUS			0x0041
5367c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_INVALID_TARGETID		0x0042
5377c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE		0x0043
5387c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_DATA_OVERRUN			0x0044
5397c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_DATA_UNDERRUN		0x0045
5407c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_IO_DATA_ERROR		0x0046
5417c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR		0x0047
5427c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_TASK_TERMINATED		0x0048
5437c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH		0x0049
5447c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED		0x004A
5457c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_IOC_TERMINATED		0x004B
5467c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SCSI_EXT_TERMINATED		0x004C
5477c478bd9Sstevel@tonic-gate 
5487c478bd9Sstevel@tonic-gate /*
5497c478bd9Sstevel@tonic-gate  * SCSI Initiator/Target end-to-end data protection
5507c478bd9Sstevel@tonic-gate  */
5517c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_EEDP_CRC_ERROR			0x004D
5527c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_EEDP_LBA_TAG_ERROR		0x004E
5537c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_EEDP_APP_TAG_ERROR		0x004F
5547c478bd9Sstevel@tonic-gate /*
5557c478bd9Sstevel@tonic-gate  * SCSI (SPI & FCP) target values
5567c478bd9Sstevel@tonic-gate  */
5577c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_PRIORITY_IO		0x0060
5587c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_INVALID_PORT		0x0061
5597c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX		0x0062
5607c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_ABORTED			0x0063
5617c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE		0x0064
5627c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_NO_CONNECTION		0x0065
5637c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH	0x006A
5647c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT		0x006B
5657c478bd9Sstevel@tonic-gate 
5667c478bd9Sstevel@tonic-gate /*
5677c478bd9Sstevel@tonic-gate  * Additional FCP target values
5687c478bd9Sstevel@tonic-gate  */
5697c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_FC_ABORTED			0x0066	/* obsolete */
5707c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID		0x0067	/* obsolete */
5717c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_FC_DID_INVALID		0x0068	/* obsolete */
5727c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT		0x0069	/* obsolete */
5737c478bd9Sstevel@tonic-gate 
5747c478bd9Sstevel@tonic-gate /*
5757c478bd9Sstevel@tonic-gate  * Fibre Channel Direct Access values
5767c478bd9Sstevel@tonic-gate  */
5777c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_FC_ABORTED			0x0066
5787c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_FC_RX_ID_INVALID			0x0067
5797c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_FC_DID_INVALID			0x0068
5807c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_FC_NODE_LOGGED_OUT		0x0069
5817c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_FC_EXCHANGE_CANCELED		0x006C
5827c478bd9Sstevel@tonic-gate 
5837c478bd9Sstevel@tonic-gate /*
5847c478bd9Sstevel@tonic-gate  * LAN values
5857c478bd9Sstevel@tonic-gate  */
5867c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND		0x0080
5877c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_LAN_DEVICE_FAILURE		0x0081
5887c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_LAN_TRANSMIT_ERROR		0x0082
5897c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED		0x0083
5907c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_LAN_RECEIVE_ERROR			0x0084
5917c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_LAN_RECEIVE_ABORTED		0x0085
5927c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_LAN_PARTIAL_PACKET		0x0086
5937c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_LAN_CANCELED			0x0087
5947c478bd9Sstevel@tonic-gate 
5957c478bd9Sstevel@tonic-gate /*
5967c478bd9Sstevel@tonic-gate  * SAS values
5977c478bd9Sstevel@tonic-gate  */
5987c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED		0x0090
599*936b7af6Sjw149990 #define	MPI_IOCSTATUS_SAS_SMP_DATA_OVERRUN		0x0091
6007c478bd9Sstevel@tonic-gate 
6017c478bd9Sstevel@tonic-gate /*
6027c478bd9Sstevel@tonic-gate  * Inband values
6037c478bd9Sstevel@tonic-gate  */
6047c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_INBAND_ABORTED			0x0098
6057c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_INBAND_NO_CONNECTION		0x0099
6067c478bd9Sstevel@tonic-gate 
6077c478bd9Sstevel@tonic-gate /*
6087c478bd9Sstevel@tonic-gate  * Diagnostic Tools values
6097c478bd9Sstevel@tonic-gate  */
6107c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_DIAGNOSTIC_RELEASED		0x00A0
6117c478bd9Sstevel@tonic-gate 
6127c478bd9Sstevel@tonic-gate /*
6137c478bd9Sstevel@tonic-gate  * IOCStatus flag to indicate that log info is available
6147c478bd9Sstevel@tonic-gate  */
6157c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE		0x8000
6167c478bd9Sstevel@tonic-gate #define	MPI_IOCSTATUS_MASK				0x7FFF
6177c478bd9Sstevel@tonic-gate 
6187c478bd9Sstevel@tonic-gate /*
6197c478bd9Sstevel@tonic-gate  * LogInfo Types
6207c478bd9Sstevel@tonic-gate  */
6217c478bd9Sstevel@tonic-gate #define	MPI_IOCLOGINFO_TYPE_MASK			0xF0000000
6227c478bd9Sstevel@tonic-gate #define	MPI_IOCLOGINFO_TYPE_NONE			0x0
6237c478bd9Sstevel@tonic-gate #define	MPI_IOCLOGINFO_TYPE_SCSI			0x1
6247c478bd9Sstevel@tonic-gate #define	MPI_IOCLOGINFO_TYPE_FC				0x2
6257c478bd9Sstevel@tonic-gate #define	MPI_IOCLOGINFO_TYPE_SAS				0x3
6267c478bd9Sstevel@tonic-gate #define	MPI_IOCLOGINFO_TYPE_ISCSI			0x4
6277c478bd9Sstevel@tonic-gate #define	MPI_IOCLOGINFO_LOG_DATA_MASK			0x0FFFFFFF
6287c478bd9Sstevel@tonic-gate 
629*936b7af6Sjw149990 /*
630*936b7af6Sjw149990  * SMP passthrough messages
631*936b7af6Sjw149990  */
632*936b7af6Sjw149990 typedef struct msg_smp_passthrough {
633*936b7af6Sjw149990 	uint8_t			Flags;
634*936b7af6Sjw149990 	uint8_t			PhysicalPort;
635*936b7af6Sjw149990 	uint8_t			ChainOffset;
636*936b7af6Sjw149990 	uint8_t			Function;
637*936b7af6Sjw149990 	uint16_t		RequestDataLength;
638*936b7af6Sjw149990 	uint8_t			ConnectionRate;
639*936b7af6Sjw149990 	uint8_t			MsgFlags;
640*936b7af6Sjw149990 	uint32_t		MsgContext;
641*936b7af6Sjw149990 	uint8_t			Reserved[4];
642*936b7af6Sjw149990 	uint64_t		SASAddress;
643*936b7af6Sjw149990 	uint8_t			Reserved1[8];
644*936b7af6Sjw149990 } msg_smp_passthrough_t;
645*936b7af6Sjw149990 
646*936b7af6Sjw149990 
647*936b7af6Sjw149990 /* SMP passthrough Reply */
648*936b7af6Sjw149990 
649*936b7af6Sjw149990 typedef struct msg_smp_passthrough_reply {
650*936b7af6Sjw149990 	uint8_t			Flags;
651*936b7af6Sjw149990 	uint8_t			PhysicalPort;
652*936b7af6Sjw149990 	uint8_t			MsgLength;
653*936b7af6Sjw149990 	uint8_t			Function;
654*936b7af6Sjw149990 	uint16_t		ResponseDataLength;
655*936b7af6Sjw149990 	uint8_t			Reserved;
656*936b7af6Sjw149990 	uint8_t			MsgFlags;
657*936b7af6Sjw149990 	uint32_t		MsgContext;
658*936b7af6Sjw149990 	uint8_t			Reserved1;
659*936b7af6Sjw149990 	uint8_t			SASStatus;
660*936b7af6Sjw149990 	uint16_t		IOCStatus;
661*936b7af6Sjw149990 	uint32_t		IOCLogInfo;
662*936b7af6Sjw149990 	uint8_t			Reserved2[4];
663*936b7af6Sjw149990 } msg_smp_passthrough_reply_t;
664*936b7af6Sjw149990 
665*936b7af6Sjw149990 #define	MPI_SMP_PT_REQ_CONNECT_RATE_NEGOTIATED	(0x00)
666*936b7af6Sjw149990 #define	MPI_SMP_PT_REQ_CONNECT_RATE_1_5		(0x08)
667*936b7af6Sjw149990 #define	MPI_SMP_PT_REQ_CONNECT_RATE_3_0		(0x09)
668*936b7af6Sjw149990 #define	MPI_SASSTATUS_SUCCESS			0
669*936b7af6Sjw149990 
6707c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
6717c478bd9Sstevel@tonic-gate }
6727c478bd9Sstevel@tonic-gate #endif
6737c478bd9Sstevel@tonic-gate 
6747c478bd9Sstevel@tonic-gate #endif	/* _SYS_MPI_H */
675