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