xref: /illumos-gate/usr/src/uts/common/sys/mpt/mpi_init.h (revision 2d6eb4a5)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
3*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate  */
5*7c478bd9Sstevel@tonic-gate 
6*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_MPI_INIT_H
7*7c478bd9Sstevel@tonic-gate #define	_SYS_MPI_INIT_H
8*7c478bd9Sstevel@tonic-gate 
9*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
10*7c478bd9Sstevel@tonic-gate extern "C" {
11*7c478bd9Sstevel@tonic-gate #endif
12*7c478bd9Sstevel@tonic-gate 
13*7c478bd9Sstevel@tonic-gate /*
14*7c478bd9Sstevel@tonic-gate  * SCSI Initiator Messages
15*7c478bd9Sstevel@tonic-gate  */
16*7c478bd9Sstevel@tonic-gate 
17*7c478bd9Sstevel@tonic-gate /*
18*7c478bd9Sstevel@tonic-gate  * SCSI IO messages and assocaited structures
19*7c478bd9Sstevel@tonic-gate  */
20*7c478bd9Sstevel@tonic-gate typedef struct msg_scsi_io_request {
21*7c478bd9Sstevel@tonic-gate 	uint8_t			TargetID;
22*7c478bd9Sstevel@tonic-gate 	uint8_t			Bus;
23*7c478bd9Sstevel@tonic-gate 	uint8_t			ChainOffset;
24*7c478bd9Sstevel@tonic-gate 	uint8_t			Function;
25*7c478bd9Sstevel@tonic-gate 	uint8_t			CDBLength;
26*7c478bd9Sstevel@tonic-gate 	uint8_t			SenseBufferLength;
27*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved;
28*7c478bd9Sstevel@tonic-gate 	uint8_t			MsgFlags;
29*7c478bd9Sstevel@tonic-gate 	uint32_t		MsgContext;
30*7c478bd9Sstevel@tonic-gate 	uint8_t			LUN[8];
31*7c478bd9Sstevel@tonic-gate 	uint32_t		Control;
32*7c478bd9Sstevel@tonic-gate 	uint8_t			CDB[16];
33*7c478bd9Sstevel@tonic-gate 	uint32_t		DataLength;
34*7c478bd9Sstevel@tonic-gate 	uint32_t		SenseBufferLowAddr;
35*7c478bd9Sstevel@tonic-gate 	sge_io_union_t		SGL;
36*7c478bd9Sstevel@tonic-gate } msg_scsi_io_request_t;
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate /* SCSIO MsgFlags bits */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_MSGFLGS_SENSE_WIDTH		0x01
41*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32	0x00
42*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64	0x01
43*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_MSGFLGS_SENSE_LOCATION	0x02
44*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST	0x00
45*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC	0x02
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate /*
48*7c478bd9Sstevel@tonic-gate  * SCSIIO LUN fields
49*7c478bd9Sstevel@tonic-gate  */
50*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING	0x0000FFFF
51*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING	0xFFFF0000
52*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING	0x0000FFFF
53*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING	0xFFFF0000
54*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_LUN_LEVEL_1_WORD		0xFF00
55*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_LUN_LEVEL_1_DWORD		0x0000FF00
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate /*
58*7c478bd9Sstevel@tonic-gate  * SCSIO Control bits
59*7c478bd9Sstevel@tonic-gate  */
60*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_DATADIRECTION_MASK	0x03000000
61*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_NODATATRANSFER	0x00000000
62*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_WRITE		0x01000000
63*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_READ			0x02000000
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK	0x3C000000
66*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT	26
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK	0x00000700
69*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_SIMPLEQ		0x00000000
70*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_HEADOFQ		0x00000100
71*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_ORDEREDQ		0x00000200
72*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_ACAQ			0x00000400
73*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_UNTAGGED		0x00000500
74*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_NO_DISCONNECT	0x00000700
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_TASKMANAGE_MASK	0x00FF0000
77*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_OBSOLETE		0x00800000
78*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV	0x00400000
79*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_TARGET_RESET		0x00200000
80*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_LUN_RESET_RSV	0x00100000
81*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_RESERVED		0x00080000
82*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV	0x00040000
83*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_ABORT_TASK_SET	0x00020000
84*7c478bd9Sstevel@tonic-gate #define	MPI_SCSIIO_CONTROL_RESERVED2		0x00010000
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate /*
88*7c478bd9Sstevel@tonic-gate  * SCSIIO reply structure
89*7c478bd9Sstevel@tonic-gate  */
90*7c478bd9Sstevel@tonic-gate typedef struct msg_scsi_io_reply {
91*7c478bd9Sstevel@tonic-gate 	uint8_t			TargetID;
92*7c478bd9Sstevel@tonic-gate 	uint8_t			Bus;
93*7c478bd9Sstevel@tonic-gate 	uint8_t			MsgLength;
94*7c478bd9Sstevel@tonic-gate 	uint8_t			Function;
95*7c478bd9Sstevel@tonic-gate 	uint8_t			CDBLength;
96*7c478bd9Sstevel@tonic-gate 	uint8_t			SenseBufferLength;
97*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved;
98*7c478bd9Sstevel@tonic-gate 	uint8_t			MsgFlags;
99*7c478bd9Sstevel@tonic-gate 	uint32_t		MsgContext;
100*7c478bd9Sstevel@tonic-gate 	uint8_t			SCSIStatus;
101*7c478bd9Sstevel@tonic-gate 	uint8_t			SCSIState;
102*7c478bd9Sstevel@tonic-gate 	uint16_t		IOCStatus;
103*7c478bd9Sstevel@tonic-gate 	uint32_t		IOCLogInfo;
104*7c478bd9Sstevel@tonic-gate 	uint32_t		TransferCount;
105*7c478bd9Sstevel@tonic-gate 	uint32_t		SenseCount;
106*7c478bd9Sstevel@tonic-gate 	uint32_t		ResponseInfo;
107*7c478bd9Sstevel@tonic-gate 	uint16_t		TaskTag;
108*7c478bd9Sstevel@tonic-gate 	uint16_t		Reserved1;
109*7c478bd9Sstevel@tonic-gate } msg_scsi_io_reply_t;
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate /*
112*7c478bd9Sstevel@tonic-gate  * SCSIIO Reply SCSIStatus values (SAM-2 status codes)
113*7c478bd9Sstevel@tonic-gate  */
114*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_SUCCESS			0x00
115*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_CHECK_CONDITION		0x02
116*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_CONDITION_MET		0x04
117*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_BUSY			0x08
118*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_INTERMEDIATE		0x10
119*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_INTERMEDIATE_CONDMET	0x14
120*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_RESERVATION_CONFLICT	0x18
121*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_COMMAND_TERMINATED	0x22
122*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_TASK_SET_FULL		0x28
123*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATUS_ACA_ACTIVE		0x30
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate /*
126*7c478bd9Sstevel@tonic-gate  * SCSIIO Reply SCSIState values
127*7c478bd9Sstevel@tonic-gate  */
128*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATE_AUTOSENSE_VALID		0x01
129*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATE_AUTOSENSE_FAILED		0x02
130*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATE_NO_SCSI_STATUS		0x04
131*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATE_TERMINATED		0x08
132*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATE_RESPONSE_INFO_VALID	0x10
133*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_STATE_QUEUE_TAG_REJECTED	0x20
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate /*
136*7c478bd9Sstevel@tonic-gate  * SCSIIO Reply ResponseInfo values
137*7c478bd9Sstevel@tonic-gate  * (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes)
138*7c478bd9Sstevel@tonic-gate  */
139*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE	0x00000000
140*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR	0x01000000
141*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID	0x02000000
142*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR	0x03000000
143*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED	0x04000000
144*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED	0x05000000
145*7c478bd9Sstevel@tonic-gate #define	MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE	0x06000000
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate /*
148*7c478bd9Sstevel@tonic-gate  * SCSI Task Management messages
149*7c478bd9Sstevel@tonic-gate  */
150*7c478bd9Sstevel@tonic-gate typedef struct msg_scsi_task_mgmt {
151*7c478bd9Sstevel@tonic-gate 	uint8_t			TargetID;
152*7c478bd9Sstevel@tonic-gate 	uint8_t			Bus;
153*7c478bd9Sstevel@tonic-gate 	uint8_t			ChainOffset;
154*7c478bd9Sstevel@tonic-gate 	uint8_t			Function;
155*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved;
156*7c478bd9Sstevel@tonic-gate 	uint8_t			TaskType;
157*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved1;
158*7c478bd9Sstevel@tonic-gate 	uint8_t			MsgFlags;
159*7c478bd9Sstevel@tonic-gate 	uint32_t		MsgContext;
160*7c478bd9Sstevel@tonic-gate 	uint8_t			LUN[8];
161*7c478bd9Sstevel@tonic-gate 	uint32_t		Reserved2[7];
162*7c478bd9Sstevel@tonic-gate 	uint32_t		TaskMsgContext;
163*7c478bd9Sstevel@tonic-gate } msg_scsi_task_mgmt_t;
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate /*
166*7c478bd9Sstevel@tonic-gate  * TaskType values
167*7c478bd9Sstevel@tonic-gate  */
168*7c478bd9Sstevel@tonic-gate #define	MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK		0x00000001
169*7c478bd9Sstevel@tonic-gate #define	MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET		0x00000002
170*7c478bd9Sstevel@tonic-gate #define	MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET		0x00000003
171*7c478bd9Sstevel@tonic-gate #define	MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS		0x00000004
172*7c478bd9Sstevel@tonic-gate #define	MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET	0x00000005
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate /*
175*7c478bd9Sstevel@tonic-gate  * MsgFlags bits
176*7c478bd9Sstevel@tonic-gate  */
177*7c478bd9Sstevel@tonic-gate #define	MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION	0x00000000
178*7c478bd9Sstevel@tonic-gate #define	MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION	0x00000002
179*7c478bd9Sstevel@tonic-gate #define	MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION	0x00000004
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate /* SCSI Task Management Reply */
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate typedef struct msg_scsi_task_mgmt_reply {
184*7c478bd9Sstevel@tonic-gate 	uint8_t			TargetID;
185*7c478bd9Sstevel@tonic-gate 	uint8_t			Bus;
186*7c478bd9Sstevel@tonic-gate 	uint8_t			MsgLength;
187*7c478bd9Sstevel@tonic-gate 	uint8_t			Function;
188*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved;
189*7c478bd9Sstevel@tonic-gate 	uint8_t			TaskType;
190*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved1;
191*7c478bd9Sstevel@tonic-gate 	uint8_t			MsgFlags;
192*7c478bd9Sstevel@tonic-gate 	uint32_t		MsgContext;
193*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved2[2];
194*7c478bd9Sstevel@tonic-gate 	uint16_t		IOCStatus;
195*7c478bd9Sstevel@tonic-gate 	uint32_t		IOCLogInfo;
196*7c478bd9Sstevel@tonic-gate 	uint32_t		TerminationCount;
197*7c478bd9Sstevel@tonic-gate } msg_scsi_task_mgmt_reply_t;
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate /*
200*7c478bd9Sstevel@tonic-gate  * SCSI enclosure processor messages
201*7c478bd9Sstevel@tonic-gate  */
202*7c478bd9Sstevel@tonic-gate typedef struct msg_sep_request {
203*7c478bd9Sstevel@tonic-gate 	uint8_t			TargetID;
204*7c478bd9Sstevel@tonic-gate 	uint8_t			Bus;
205*7c478bd9Sstevel@tonic-gate 	uint8_t			ChainOffset;
206*7c478bd9Sstevel@tonic-gate 	uint8_t			Function;
207*7c478bd9Sstevel@tonic-gate 	uint8_t			Action;
208*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved1;
209*7c478bd9Sstevel@tonic-gate 	uint8_t			Reserved2;
210*7c478bd9Sstevel@tonic-gate 	uint8_t			MsgFlags;
211*7c478bd9Sstevel@tonic-gate 	uint32_t		MsgContext;
212*7c478bd9Sstevel@tonic-gate 	uint32_t		SlotStatus;
213*7c478bd9Sstevel@tonic-gate } msg_sep_request_t;
214*7c478bd9Sstevel@tonic-gate 
215*7c478bd9Sstevel@tonic-gate #define	MPI_SEP_REQ_ACTION_WRITE_STATUS			0x00
216*7c478bd9Sstevel@tonic-gate #define	MPI_SEP_REQ_ACTION_READ_STATUS			0x01
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate #define	MPI_SEP_REQ_SLOTSTATUS_NO_ERROR			0x00000001
219*7c478bd9Sstevel@tonic-gate #define	MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY		0x00000002
220*7c478bd9Sstevel@tonic-gate #define	MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING		0x00000004
221*7c478bd9Sstevel@tonic-gate 
222*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
223*7c478bd9Sstevel@tonic-gate }
224*7c478bd9Sstevel@tonic-gate #endif
225*7c478bd9Sstevel@tonic-gate 
226*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_MPI_INIT_H */
227