Merge branch 'vendor/OPENSSL'
[dragonfly.git] / sys / dev / disk / mpt / mpilib / mpi_raid.h
1 /* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_raid.h,v 1.8 2007/06/03 22:58:27 scottl Exp $ */
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  *           Name:  mpi_raid.h
33  *          Title:  MPI RAID message and structures
34  *  Creation Date:  February 27, 2001
35  *
36  *    mpi_raid.h Version:  01.05.03
37  *
38  *  Version History
39  *  ---------------
40  *
41  *  Date      Version   Description
42  *  --------  --------  ------------------------------------------------------
43  *  02-27-01  01.01.01  Original release for this file.
44  *  03-27-01  01.01.02  Added structure offset comments.
45  *  08-08-01  01.02.01  Original release for v1.2 work.
46  *  09-28-01  01.02.02  Major rework for MPI v1.2 Integrated RAID changes.
47  *  10-04-01  01.02.03  Added ActionData defines for
48  *                      MPI_RAID_ACTION_DELETE_VOLUME action.
49  *  11-01-01  01.02.04  Added define for MPI_RAID_ACTION_ADATA_DO_NOT_SYNC.
50  *  03-14-02  01.02.05  Added define for MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT.
51  *  05-07-02  01.02.06  Added define for MPI_RAID_ACTION_ACTIVATE_VOLUME,
52  *                      MPI_RAID_ACTION_INACTIVATE_VOLUME, and
53  *                      MPI_RAID_ACTION_ADATA_INACTIVATE_ALL.
54  *  07-12-02  01.02.07  Added structures for Mailbox request and reply.
55  *  11-15-02  01.02.08  Added missing MsgContext field to MSG_MAILBOX_REQUEST.
56  *  04-01-03  01.02.09  New action data option flag for
57  *                      MPI_RAID_ACTION_DELETE_VOLUME.
58  *  05-11-04  01.03.01  Original release for MPI v1.3.
59  *  08-19-04  01.05.01  Original release for MPI v1.5.
60  *  01-15-05  01.05.02  Added defines for the two new RAID Actions for
61  *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
62  *  02-28-07  01.05.03  Added new RAID Action, Device FW Update Mode, and
63  *                      associated defines.
64  *  --------------------------------------------------------------------------
65  */
66
67 #ifndef MPI_RAID_H
68 #define MPI_RAID_H
69
70
71 /******************************************************************************
72 *
73 *        R A I D    M e s s a g e s
74 *
75 *******************************************************************************/
76
77
78 /****************************************************************************/
79 /* RAID Action Request                                                      */
80 /****************************************************************************/
81
82 typedef struct _MSG_RAID_ACTION
83 {
84     U8                      Action;             /* 00h */
85     U8                      Reserved1;          /* 01h */
86     U8                      ChainOffset;        /* 02h */
87     U8                      Function;           /* 03h */
88     U8                      VolumeID;           /* 04h */
89     U8                      VolumeBus;          /* 05h */
90     U8                      PhysDiskNum;        /* 06h */
91     U8                      MsgFlags;           /* 07h */
92     U32                     MsgContext;         /* 08h */
93     U32                     Reserved2;          /* 0Ch */
94     U32                     ActionDataWord;     /* 10h */
95     SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */
96 } MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,
97   MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;
98
99
100 /* RAID Action request Action values */
101
102 #define MPI_RAID_ACTION_STATUS                      (0x00)
103 #define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)
104 #define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)
105 #define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)
106 #define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)
107 #define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)
108 #define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)
109 #define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)
110 #define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)
111 #define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)
112 #define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)
113 #define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)
114 #define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)
115 #define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)
116 #define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)
117 #define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)
118 #define MPI_RAID_ACTION_ACTIVATE_VOLUME             (0x11)
119 #define MPI_RAID_ACTION_INACTIVATE_VOLUME           (0x12)
120 #define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
121 #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
122 #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)
123
124 /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
125 #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
126 #define MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT        (0x00000002)
127
128 /* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */
129 #define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)
130 #define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)
131
132 #define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
133 #define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
134
135 /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
136 #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
137
138 /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_RESYNC_RATE action */
139 #define MPI_RAID_ACTION_ADATA_RESYNC_RATE_MASK      (0x000000FF)
140
141 /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_DATA_SCRUB_RATE action */
142 #define MPI_RAID_ACTION_ADATA_DATA_SCRUB_RATE_MASK  (0x000000FF)
143
144 /* ActionDataWord defines for use with MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */
145 #define MPI_RAID_ACTION_ADATA_ENABLE_FW_UPDATE          (0x00000001)
146 #define MPI_RAID_ACTION_ADATA_MASK_FW_UPDATE_TIMEOUT    (0x0000FF00)
147 #define MPI_RAID_ACTION_ADATA_SHIFT_FW_UPDATE_TIMEOUT   (8)
148
149
150 /* RAID Action reply message */
151
152 typedef struct _MSG_RAID_ACTION_REPLY
153 {
154     U8                      Action;             /* 00h */
155     U8                      Reserved;           /* 01h */
156     U8                      MsgLength;          /* 02h */
157     U8                      Function;           /* 03h */
158     U8                      VolumeID;           /* 04h */
159     U8                      VolumeBus;          /* 05h */
160     U8                      PhysDiskNum;        /* 06h */
161     U8                      MsgFlags;           /* 07h */
162     U32                     MsgContext;         /* 08h */
163     U16                     ActionStatus;       /* 0Ch */
164     U16                     IOCStatus;          /* 0Eh */
165     U32                     IOCLogInfo;         /* 10h */
166     U32                     VolumeStatus;       /* 14h */
167     U32                     ActionData;         /* 18h */
168 } MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,
169   MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;
170
171
172 /* RAID Volume reply ActionStatus values */
173
174 #define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)
175 #define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)
176 #define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)
177 #define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)
178
179
180 /* RAID Volume reply RAID Volume Indicator structure */
181
182 typedef struct _MPI_RAID_VOL_INDICATOR
183 {
184     U64                     TotalBlocks;        /* 00h */
185     U64                     BlocksRemaining;    /* 08h */
186 } MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,
187   MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;
188
189
190 /****************************************************************************/
191 /* SCSI IO RAID Passthrough Request                                         */
192 /****************************************************************************/
193
194 typedef struct _MSG_SCSI_IO_RAID_PT_REQUEST
195 {
196     U8                      PhysDiskNum;        /* 00h */
197     U8                      Reserved1;          /* 01h */
198     U8                      ChainOffset;        /* 02h */
199     U8                      Function;           /* 03h */
200     U8                      CDBLength;          /* 04h */
201     U8                      SenseBufferLength;  /* 05h */
202     U8                      Reserved2;          /* 06h */
203     U8                      MsgFlags;           /* 07h */
204     U32                     MsgContext;         /* 08h */
205     U8                      LUN[8];             /* 0Ch */
206     U32                     Control;            /* 14h */
207     U8                      CDB[16];            /* 18h */
208     U32                     DataLength;         /* 28h */
209     U32                     SenseBufferLowAddr; /* 2Ch */
210     SGE_IO_UNION            SGL;                /* 30h */
211 } MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,
212   SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;
213
214
215 /* SCSI IO RAID Passthrough reply structure */
216
217 typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
218 {
219     U8                      PhysDiskNum;        /* 00h */
220     U8                      Reserved1;          /* 01h */
221     U8                      MsgLength;          /* 02h */
222     U8                      Function;           /* 03h */
223     U8                      CDBLength;          /* 04h */
224     U8                      SenseBufferLength;  /* 05h */
225     U8                      Reserved2;          /* 06h */
226     U8                      MsgFlags;           /* 07h */
227     U32                     MsgContext;         /* 08h */
228     U8                      SCSIStatus;         /* 0Ch */
229     U8                      SCSIState;          /* 0Dh */
230     U16                     IOCStatus;          /* 0Eh */
231     U32                     IOCLogInfo;         /* 10h */
232     U32                     TransferCount;      /* 14h */
233     U32                     SenseCount;         /* 18h */
234     U32                     ResponseInfo;       /* 1Ch */
235 } MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,
236   SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;
237
238
239 /****************************************************************************/
240 /* Mailbox reqeust structure */
241 /****************************************************************************/
242
243 typedef struct _MSG_MAILBOX_REQUEST
244 {
245     U16                     Reserved1;
246     U8                      ChainOffset;
247     U8                      Function;
248     U16                     Reserved2;
249     U8                      Reserved3;
250     U8                      MsgFlags;
251     U32                     MsgContext;
252     U8                      Command[10];
253     U16                     Reserved4;
254     SGE_IO_UNION            SGL;
255 } MSG_MAILBOX_REQUEST, MPI_POINTER PTR_MSG_MAILBOX_REQUEST,
256   MailboxRequest_t, MPI_POINTER pMailboxRequest_t;
257
258
259 /* Mailbox reply structure */
260 typedef struct _MSG_MAILBOX_REPLY
261 {
262     U16                     Reserved1;          /* 00h */
263     U8                      MsgLength;          /* 02h */
264     U8                      Function;           /* 03h */
265     U16                     Reserved2;          /* 04h */
266     U8                      Reserved3;          /* 06h */
267     U8                      MsgFlags;           /* 07h */
268     U32                     MsgContext;         /* 08h */
269     U16                     MailboxStatus;      /* 0Ch */
270     U16                     IOCStatus;          /* 0Eh */
271     U32                     IOCLogInfo;         /* 10h */
272     U32                     Reserved4;          /* 14h */
273 } MSG_MAILBOX_REPLY, MPI_POINTER PTR_MSG_MAILBOX_REPLY,
274   MailboxReply_t, MPI_POINTER pMailboxReply_t;
275
276 #endif
277
278
279