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