mpi_sas.h revision 156000
1/* $FreeBSD: head/sys/dev/mpt/mpilib/mpi_sas.h 156000 2006-02-25 07:45:54Z mjacob $ */
2/*-
3 * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12 *    substantially similar to the "NO WARRANTY" disclaimer below
13 *    ("Disclaimer") and any redistribution must be conditioned upon including
14 *    a substantially similar Disclaimer requirement for further binary
15 *    redistribution.
16 * 3. Neither the name of the LSI Logic Corporation nor the names of its
17 *    contributors may be used to endorse or promote products derived from
18 *    this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
30 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *
33 *           Name:  mpi_sas.h
34 *          Title:  MPI Serial Attached SCSI structures and definitions
35 *  Creation Date:  August 19, 2004
36 *
37 *    mpi_sas.h Version:  01.05.02
38 *
39 *  Version History
40 *  ---------------
41 *
42 *  Date      Version   Description
43 *  --------  --------  ------------------------------------------------------
44 *  08-19-04  01.05.01  Original release.
45 *  08-30-05  01.05.02  Added DeviceInfo bit for SEP.
46 *                      Added PrimFlags and Primitive field to SAS IO Unit
47 *                      Control request, and added a new operation code.
48 *  --------------------------------------------------------------------------
49 */
50
51#ifndef MPI_SAS_H
52#define MPI_SAS_H
53
54
55/*
56 * Values for SASStatus.
57 */
58#define MPI_SASSTATUS_SUCCESS                           (0x00)
59#define MPI_SASSTATUS_UNKNOWN_ERROR                     (0x01)
60#define MPI_SASSTATUS_INVALID_FRAME                     (0x02)
61#define MPI_SASSTATUS_UTC_BAD_DEST                      (0x03)
62#define MPI_SASSTATUS_UTC_BREAK_RECEIVED                (0x04)
63#define MPI_SASSTATUS_UTC_CONNECT_RATE_NOT_SUPPORTED    (0x05)
64#define MPI_SASSTATUS_UTC_PORT_LAYER_REQUEST            (0x06)
65#define MPI_SASSTATUS_UTC_PROTOCOL_NOT_SUPPORTED        (0x07)
66#define MPI_SASSTATUS_UTC_STP_RESOURCES_BUSY            (0x08)
67#define MPI_SASSTATUS_UTC_WRONG_DESTINATION             (0x09)
68#define MPI_SASSTATUS_SHORT_INFORMATION_UNIT            (0x0A)
69#define MPI_SASSTATUS_LONG_INFORMATION_UNIT             (0x0B)
70#define MPI_SASSTATUS_XFER_RDY_INCORRECT_WRITE_DATA     (0x0C)
71#define MPI_SASSTATUS_XFER_RDY_REQUEST_OFFSET_ERROR     (0x0D)
72#define MPI_SASSTATUS_XFER_RDY_NOT_EXPECTED             (0x0E)
73#define MPI_SASSTATUS_DATA_INCORRECT_DATA_LENGTH        (0x0F)
74#define MPI_SASSTATUS_DATA_TOO_MUCH_READ_DATA           (0x10)
75#define MPI_SASSTATUS_DATA_OFFSET_ERROR                 (0x11)
76#define MPI_SASSTATUS_SDSF_NAK_RECEIVED                 (0x12)
77#define MPI_SASSTATUS_SDSF_CONNECTION_FAILED            (0x13)
78#define MPI_SASSTATUS_INITIATOR_RESPONSE_TIMEOUT        (0x14)
79
80
81/*
82 * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
83 * data and SAS IO Unit Configuration pages.
84 */
85#define MPI_SAS_DEVICE_INFO_SEP                 (0x00004000)
86#define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE        (0x00002000)
87#define MPI_SAS_DEVICE_INFO_LSI_DEVICE          (0x00001000)
88#define MPI_SAS_DEVICE_INFO_DIRECT_ATTACH       (0x00000800)
89#define MPI_SAS_DEVICE_INFO_SSP_TARGET          (0x00000400)
90#define MPI_SAS_DEVICE_INFO_STP_TARGET          (0x00000200)
91#define MPI_SAS_DEVICE_INFO_SMP_TARGET          (0x00000100)
92#define MPI_SAS_DEVICE_INFO_SATA_DEVICE         (0x00000080)
93#define MPI_SAS_DEVICE_INFO_SSP_INITIATOR       (0x00000040)
94#define MPI_SAS_DEVICE_INFO_STP_INITIATOR       (0x00000020)
95#define MPI_SAS_DEVICE_INFO_SMP_INITIATOR       (0x00000010)
96#define MPI_SAS_DEVICE_INFO_SATA_HOST           (0x00000008)
97
98#define MPI_SAS_DEVICE_INFO_MASK_DEVICE_TYPE    (0x00000007)
99#define MPI_SAS_DEVICE_INFO_NO_DEVICE           (0x00000000)
100#define MPI_SAS_DEVICE_INFO_END_DEVICE          (0x00000001)
101#define MPI_SAS_DEVICE_INFO_EDGE_EXPANDER       (0x00000002)
102#define MPI_SAS_DEVICE_INFO_FANOUT_EXPANDER     (0x00000003)
103
104
105
106/*****************************************************************************
107*
108*        S e r i a l    A t t a c h e d    S C S I     M e s s a g e s
109*
110*****************************************************************************/
111
112/****************************************************************************/
113/* Serial Management Protocol Passthrough Request                           */
114/****************************************************************************/
115
116typedef struct _MSG_SMP_PASSTHROUGH_REQUEST
117{
118    U8                      PassthroughFlags;   /* 00h */
119    U8                      PhysicalPort;       /* 01h */
120    U8                      ChainOffset;        /* 02h */
121    U8                      Function;           /* 03h */
122    U16                     RequestDataLength;  /* 04h */
123    U8                      ConnectionRate;     /* 06h */
124    U8                      MsgFlags;           /* 07h */
125    U32                     MsgContext;         /* 08h */
126    U32                     Reserved1;          /* 0Ch */
127    U64                     SASAddress;         /* 10h */
128    U32                     Reserved2;          /* 18h */
129    U32                     Reserved3;          /* 1Ch */
130    SGE_SIMPLE_UNION        SGL;                /* 20h */
131} MSG_SMP_PASSTHROUGH_REQUEST, MPI_POINTER PTR_MSG_SMP_PASSTHROUGH_REQUEST,
132  SmpPassthroughRequest_t, MPI_POINTER pSmpPassthroughRequest_t;
133
134/* values for PassthroughFlags field */
135#define MPI_SMP_PT_REQ_PT_FLAGS_IMMEDIATE       (0x80)
136
137/* values for ConnectionRate field */
138#define MPI_SMP_PT_REQ_CONNECT_RATE_NEGOTIATED  (0x00)
139#define MPI_SMP_PT_REQ_CONNECT_RATE_1_5         (0x08)
140#define MPI_SMP_PT_REQ_CONNECT_RATE_3_0         (0x09)
141
142
143/* Serial Management Protocol Passthrough Reply */
144typedef struct _MSG_SMP_PASSTHROUGH_REPLY
145{
146    U8                      PassthroughFlags;   /* 00h */
147    U8                      PhysicalPort;       /* 01h */
148    U8                      MsgLength;          /* 02h */
149    U8                      Function;           /* 03h */
150    U16                     ResponseDataLength; /* 04h */
151    U8                      Reserved1;          /* 06h */
152    U8                      MsgFlags;           /* 07h */
153    U32                     MsgContext;         /* 08h */
154    U8                      Reserved2;          /* 0Ch */
155    U8                      SASStatus;          /* 0Dh */
156    U16                     IOCStatus;          /* 0Eh */
157    U32                     IOCLogInfo;         /* 10h */
158    U32                     Reserved3;          /* 14h */
159    U8                      ResponseData[4];    /* 18h */
160} MSG_SMP_PASSTHROUGH_REPLY, MPI_POINTER PTR_MSG_SMP_PASSTHROUGH_REPLY,
161  SmpPassthroughReply_t, MPI_POINTER pSmpPassthroughReply_t;
162
163#define MPI_SMP_PT_REPLY_PT_FLAGS_IMMEDIATE     (0x80)
164
165
166/****************************************************************************/
167/* SATA Passthrough Request                                                 */
168/****************************************************************************/
169
170typedef struct _MSG_SATA_PASSTHROUGH_REQUEST
171{
172    U8                      TargetID;           /* 00h */
173    U8                      Bus;                /* 01h */
174    U8                      ChainOffset;        /* 02h */
175    U8                      Function;           /* 03h */
176    U16                     PassthroughFlags;   /* 04h */
177    U8                      ConnectionRate;     /* 06h */
178    U8                      MsgFlags;           /* 07h */
179    U32                     MsgContext;         /* 08h */
180    U32                     Reserved1;          /* 0Ch */
181    U32                     Reserved2;          /* 10h */
182    U32                     Reserved3;          /* 14h */
183    U32                     DataLength;         /* 18h */
184    U8                      CommandFIS[20];     /* 1Ch */
185    SGE_SIMPLE_UNION        SGL;                /* 30h */
186} MSG_SATA_PASSTHROUGH_REQUEST, MPI_POINTER PTR_MSG_SATA_PASSTHROUGH_REQUEST,
187  SataPassthroughRequest_t, MPI_POINTER pSataPassthroughRequest_t;
188
189/* values for PassthroughFlags field */
190#define MPI_SATA_PT_REQ_PT_FLAGS_RESET_DEVICE   (0x0200)
191#define MPI_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG   (0x0100)
192#define MPI_SATA_PT_REQ_PT_FLAGS_DMA_QUEUED     (0x0080)
193#define MPI_SATA_PT_REQ_PT_FLAGS_PACKET_COMMAND (0x0040)
194#define MPI_SATA_PT_REQ_PT_FLAGS_DMA            (0x0020)
195#define MPI_SATA_PT_REQ_PT_FLAGS_PIO            (0x0010)
196#define MPI_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU (0x0004)
197#define MPI_SATA_PT_REQ_PT_FLAGS_WRITE          (0x0002)
198#define MPI_SATA_PT_REQ_PT_FLAGS_READ           (0x0001)
199
200/* values for ConnectionRate field */
201#define MPI_SATA_PT_REQ_CONNECT_RATE_NEGOTIATED (0x00)
202#define MPI_SATA_PT_REQ_CONNECT_RATE_1_5        (0x08)
203#define MPI_SATA_PT_REQ_CONNECT_RATE_3_0        (0x09)
204
205
206/* SATA Passthrough Reply */
207typedef struct _MSG_SATA_PASSTHROUGH_REPLY
208{
209    U8                      TargetID;           /* 00h */
210    U8                      Bus;                /* 01h */
211    U8                      MsgLength;          /* 02h */
212    U8                      Function;           /* 03h */
213    U16                     PassthroughFlags;   /* 04h */
214    U8                      Reserved1;          /* 06h */
215    U8                      MsgFlags;           /* 07h */
216    U32                     MsgContext;         /* 08h */
217    U8                      Reserved2;          /* 0Ch */
218    U8                      SASStatus;          /* 0Dh */
219    U16                     IOCStatus;          /* 0Eh */
220    U32                     IOCLogInfo;         /* 10h */
221    U8                      StatusFIS[20];      /* 14h */
222    U32                     StatusControlRegisters; /* 28h */
223    U32                     TransferCount;      /* 2Ch */
224} MSG_SATA_PASSTHROUGH_REPLY, MPI_POINTER PTR_MSG_SATA_PASSTHROUGH_REPLY,
225  SataPassthroughReply_t, MPI_POINTER pSataPassthroughReply_t;
226
227
228
229
230/****************************************************************************/
231/* SAS IO Unit Control Request                                              */
232/****************************************************************************/
233
234typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
235{
236    U8                      Operation;          /* 00h */
237    U8                      Reserved1;          /* 01h */
238    U8                      ChainOffset;        /* 02h */
239    U8                      Function;           /* 03h */
240    U16                     Reserved2;          /* 04h */
241    U8                      Reserved3;          /* 06h */
242    U8                      MsgFlags;           /* 07h */
243    U32                     MsgContext;         /* 08h */
244    U8                      TargetID;           /* 0Ch */
245    U8                      Bus;                /* 0Dh */
246    U8                      PhyNum;             /* 0Eh */
247    U8                      PrimFlags;          /* 0Fh */
248    U32                     Primitive;          /* 10h */
249    U64                     SASAddress;         /* 14h */
250    U32                     Reserved4;          /* 1Ch */
251} MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST,
252  SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t;
253
254/* values for the Operation field */
255#define MPI_SAS_OP_CLEAR_NOT_PRESENT             (0x01)
256#define MPI_SAS_OP_CLEAR_ALL_PERSISTENT          (0x02)
257#define MPI_SAS_OP_PHY_LINK_RESET                (0x06)
258#define MPI_SAS_OP_PHY_HARD_RESET                (0x07)
259#define MPI_SAS_OP_PHY_CLEAR_ERROR_LOG           (0x08)
260#define MPI_SAS_OP_MAP_CURRENT                   (0x09)
261#define MPI_SAS_OP_SEND_PRIMITIVE               (0x0A)
262
263/* values for the PrimFlags field */
264#define MPI_SAS_PRIMFLAGS_SINGLE                (0x08)
265#define MPI_SAS_PRIMFLAGS_TRIPLE                (0x02)
266#define MPI_SAS_PRIMFLAGS_REDUNDANT             (0x01)
267
268
269/* SAS IO Unit Control Reply */
270typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY
271{
272    U8                      Operation;          /* 00h */
273    U8                      Reserved1;          /* 01h */
274    U8                      MsgLength;          /* 02h */
275    U8                      Function;           /* 03h */
276    U16                     Reserved2;          /* 04h */
277    U8                      Reserved3;          /* 06h */
278    U8                      MsgFlags;           /* 07h */
279    U32                     MsgContext;         /* 08h */
280    U16                     Reserved4;          /* 0Ch */
281    U16                     IOCStatus;          /* 0Eh */
282    U32                     IOCLogInfo;         /* 10h */
283} MSG_SAS_IOUNIT_CONTROL_REPLY, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REPLY,
284  SasIoUnitControlReply_t, MPI_POINTER pSasIoUnitControlReply_t;
285
286#endif
287
288
289