Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / sas / include / mpi_init.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: mpi_init.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23/*
24 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28#ifndef _SYS_MPI_INIT_H
29#define _SYS_MPI_INIT_H
30
31#pragma ident "@(#)mpi_init.h 1.2 04/11/08 SMI"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/*
38 * SCSI Initiator Messages
39 */
40
41/*
42 * SCSI IO messages and assocaited structures
43 */
44typedef struct msg_scsi_io_request {
45 uint8_t TargetID;
46 uint8_t Bus;
47 uint8_t ChainOffset;
48 uint8_t Function;
49 uint8_t CDBLength;
50 uint8_t SenseBufferLength;
51 uint8_t Reserved;
52 uint8_t MsgFlags;
53 uint32_t MsgContext;
54 uint8_t LUN[8];
55 uint32_t Control;
56 uint8_t CDB[16];
57 uint32_t DataLength;
58 uint32_t SenseBufferLowAddr;
59 sge_io_union_t SGL;
60} msg_scsi_io_request_t;
61
62/* SCSIO MsgFlags bits */
63
64#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH 0x01
65#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32 0x00
66#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64 0x01
67#define MPI_SCSIIO_MSGFLGS_SENSE_LOCATION 0x02
68#define MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST 0x00
69#define MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC 0x02
70
71/*
72 * SCSIIO LUN fields
73 */
74#define MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING 0x0000FFFF
75#define MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING 0xFFFF0000
76#define MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING 0x0000FFFF
77#define MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING 0xFFFF0000
78#define MPI_SCSIIO_LUN_LEVEL_1_WORD 0xFF00
79#define MPI_SCSIIO_LUN_LEVEL_1_DWORD 0x0000FF00
80
81/*
82 * SCSIO Control bits
83 */
84#define MPI_SCSIIO_CONTROL_DATADIRECTION_MASK 0x03000000
85#define MPI_SCSIIO_CONTROL_NODATATRANSFER 0x00000000
86#define MPI_SCSIIO_CONTROL_WRITE 0x01000000
87#define MPI_SCSIIO_CONTROL_READ 0x02000000
88
89#define MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK 0x3C000000
90#define MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT 26
91
92#define MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK 0x00000700
93#define MPI_SCSIIO_CONTROL_SIMPLEQ 0x00000000
94#define MPI_SCSIIO_CONTROL_HEADOFQ 0x00000100
95#define MPI_SCSIIO_CONTROL_ORDEREDQ 0x00000200
96#define MPI_SCSIIO_CONTROL_ACAQ 0x00000400
97#define MPI_SCSIIO_CONTROL_UNTAGGED 0x00000500
98#define MPI_SCSIIO_CONTROL_NO_DISCONNECT 0x00000700
99
100#define MPI_SCSIIO_CONTROL_TASKMANAGE_MASK 0x00FF0000
101#define MPI_SCSIIO_CONTROL_OBSOLETE 0x00800000
102#define MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV 0x00400000
103#define MPI_SCSIIO_CONTROL_TARGET_RESET 0x00200000
104#define MPI_SCSIIO_CONTROL_LUN_RESET_RSV 0x00100000
105#define MPI_SCSIIO_CONTROL_RESERVED 0x00080000
106#define MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV 0x00040000
107#define MPI_SCSIIO_CONTROL_ABORT_TASK_SET 0x00020000
108#define MPI_SCSIIO_CONTROL_RESERVED2 0x00010000
109
110
111/*
112 * SCSIIO reply structure
113 */
114typedef struct msg_scsi_io_reply {
115 uint8_t TargetID;
116 uint8_t Bus;
117 uint8_t MsgLength;
118 uint8_t Function;
119 uint8_t CDBLength;
120 uint8_t SenseBufferLength;
121 uint8_t Reserved;
122 uint8_t MsgFlags;
123 uint32_t MsgContext;
124 uint8_t SCSIStatus;
125 uint8_t SCSIState;
126 uint16_t IOCStatus;
127 uint32_t IOCLogInfo;
128 uint32_t TransferCount;
129 uint32_t SenseCount;
130 uint32_t ResponseInfo;
131 uint16_t TaskTag;
132 uint16_t Reserved1;
133} msg_scsi_io_reply_t;
134
135/*
136 * SCSIIO Reply SCSIStatus values (SAM-2 status codes)
137 */
138#define MPI_SCSI_STATUS_SUCCESS 0x00
139#define MPI_SCSI_STATUS_CHECK_CONDITION 0x02
140#define MPI_SCSI_STATUS_CONDITION_MET 0x04
141#define MPI_SCSI_STATUS_BUSY 0x08
142#define MPI_SCSI_STATUS_INTERMEDIATE 0x10
143#define MPI_SCSI_STATUS_INTERMEDIATE_CONDMET 0x14
144#define MPI_SCSI_STATUS_RESERVATION_CONFLICT 0x18
145#define MPI_SCSI_STATUS_COMMAND_TERMINATED 0x22
146#define MPI_SCSI_STATUS_TASK_SET_FULL 0x28
147#define MPI_SCSI_STATUS_ACA_ACTIVE 0x30
148
149/*
150 * SCSIIO Reply SCSIState values
151 */
152#define MPI_SCSI_STATE_AUTOSENSE_VALID 0x01
153#define MPI_SCSI_STATE_AUTOSENSE_FAILED 0x02
154#define MPI_SCSI_STATE_NO_SCSI_STATUS 0x04
155#define MPI_SCSI_STATE_TERMINATED 0x08
156#define MPI_SCSI_STATE_RESPONSE_INFO_VALID 0x10
157#define MPI_SCSI_STATE_QUEUE_TAG_REJECTED 0x20
158
159/*
160 * SCSIIO Reply ResponseInfo values
161 * (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes)
162 */
163#define MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE 0x00000000
164#define MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR 0x01000000
165#define MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID 0x02000000
166#define MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR 0x03000000
167#define MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED 0x04000000
168#define MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED 0x05000000
169#define MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE 0x06000000
170
171/*
172 * SCSI Task Management messages
173 */
174typedef struct msg_scsi_task_mgmt {
175 uint8_t TargetID;
176 uint8_t Bus;
177 uint8_t ChainOffset;
178 uint8_t Function;
179 uint8_t Reserved;
180 uint8_t TaskType;
181 uint8_t Reserved1;
182 uint8_t MsgFlags;
183 uint32_t MsgContext;
184 uint8_t LUN[8];
185 uint32_t Reserved2[7];
186 uint32_t TaskMsgContext;
187} msg_scsi_task_mgmt_t;
188
189/*
190 * TaskType values
191 */
192#define MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK 0x00000001
193#define MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET 0x00000002
194#define MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET 0x00000003
195#define MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS 0x00000004
196#define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET 0x00000005
197
198/*
199 * MsgFlags bits
200 */
201#define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION 0x00000000
202#define MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION 0x00000002
203#define MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION 0x00000004
204
205/* SCSI Task Management Reply */
206
207typedef struct msg_scsi_task_mgmt_reply {
208 uint8_t TargetID;
209 uint8_t Bus;
210 uint8_t MsgLength;
211 uint8_t Function;
212 uint8_t Reserved;
213 uint8_t TaskType;
214 uint8_t Reserved1;
215 uint8_t MsgFlags;
216 uint32_t MsgContext;
217 uint8_t Reserved2[2];
218 uint16_t IOCStatus;
219 uint32_t IOCLogInfo;
220 uint32_t TerminationCount;
221} msg_scsi_task_mgmt_reply_t;
222
223/*
224 * SCSI enclosure processor messages
225 */
226typedef struct msg_sep_request {
227 uint8_t TargetID;
228 uint8_t Bus;
229 uint8_t ChainOffset;
230 uint8_t Function;
231 uint8_t Action;
232 uint8_t Reserved1;
233 uint8_t Reserved2;
234 uint8_t MsgFlags;
235 uint32_t MsgContext;
236 uint32_t SlotStatus;
237} msg_sep_request_t;
238
239#define MPI_SEP_REQ_ACTION_WRITE_STATUS 0x00
240#define MPI_SEP_REQ_ACTION_READ_STATUS 0x01
241
242#define MPI_SEP_REQ_SLOTSTATUS_NO_ERROR 0x00000001
243#define MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY 0x00000002
244#define MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING 0x00000004
245
246#ifdef __cplusplus
247}
248#endif
249
250#endif /* _SYS_MPI_INIT_H */