xref: /freebsd/sys/dev/mpt/mpilib/mpi_raid.h (revision 40a8ac8f62b535d30349faf28cf47106b7041b83)
1 /* $FreeBSD$ */
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.05
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  *  08-07-07  01.05.04  Added Disable Full Rebuild bit to the ActionDataWord
65  *                      for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
66  *  01-15-08  01.05.05  Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
67  *  --------------------------------------------------------------------------
68  */
69 
70 #ifndef MPI_RAID_H
71 #define MPI_RAID_H
72 
73 
74 /******************************************************************************
75 *
76 *        R A I D    M e s s a g e s
77 *
78 *******************************************************************************/
79 
80 
81 /****************************************************************************/
82 /* RAID Action Request                                                      */
83 /****************************************************************************/
84 
85 typedef struct _MSG_RAID_ACTION
86 {
87     U8                      Action;             /* 00h */
88     U8                      Reserved1;          /* 01h */
89     U8                      ChainOffset;        /* 02h */
90     U8                      Function;           /* 03h */
91     U8                      VolumeID;           /* 04h */
92     U8                      VolumeBus;          /* 05h */
93     U8                      PhysDiskNum;        /* 06h */
94     U8                      MsgFlags;           /* 07h */
95     U32                     MsgContext;         /* 08h */
96     U32                     Reserved2;          /* 0Ch */
97     U32                     ActionDataWord;     /* 10h */
98     SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */
99 } MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,
100   MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;
101 
102 
103 /* RAID Action request Action values */
104 
105 #define MPI_RAID_ACTION_STATUS                      (0x00)
106 #define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)
107 #define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)
108 #define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)
109 #define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)
110 #define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)
111 #define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)
112 #define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)
113 #define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)
114 #define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)
115 #define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)
116 #define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)
117 #define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)
118 #define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)
119 #define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)
120 #define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)
121 #define MPI_RAID_ACTION_ACTIVATE_VOLUME             (0x11)
122 #define MPI_RAID_ACTION_INACTIVATE_VOLUME           (0x12)
123 #define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
124 #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
125 #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)
126 #define MPI_RAID_ACTION_SET_VOLUME_NAME             (0x16)
127 
128 /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
129 #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
130 #define MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT        (0x00000002)
131 
132 /* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */
133 #define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)
134 #define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)
135 
136 #define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
137 #define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
138 
139 /* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
140 #define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD  (0x00000001)
141 
142 /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
143 #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
144 
145 /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_RESYNC_RATE action */
146 #define MPI_RAID_ACTION_ADATA_RESYNC_RATE_MASK      (0x000000FF)
147 
148 /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_DATA_SCRUB_RATE action */
149 #define MPI_RAID_ACTION_ADATA_DATA_SCRUB_RATE_MASK  (0x000000FF)
150 
151 /* ActionDataWord defines for use with MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */
152 #define MPI_RAID_ACTION_ADATA_ENABLE_FW_UPDATE          (0x00000001)
153 #define MPI_RAID_ACTION_ADATA_MASK_FW_UPDATE_TIMEOUT    (0x0000FF00)
154 #define MPI_RAID_ACTION_ADATA_SHIFT_FW_UPDATE_TIMEOUT   (8)
155 
156 
157 /* RAID Action reply message */
158 
159 typedef struct _MSG_RAID_ACTION_REPLY
160 {
161     U8                      Action;             /* 00h */
162     U8                      Reserved;           /* 01h */
163     U8                      MsgLength;          /* 02h */
164     U8                      Function;           /* 03h */
165     U8                      VolumeID;           /* 04h */
166     U8                      VolumeBus;          /* 05h */
167     U8                      PhysDiskNum;        /* 06h */
168     U8                      MsgFlags;           /* 07h */
169     U32                     MsgContext;         /* 08h */
170     U16                     ActionStatus;       /* 0Ch */
171     U16                     IOCStatus;          /* 0Eh */
172     U32                     IOCLogInfo;         /* 10h */
173     U32                     VolumeStatus;       /* 14h */
174     U32                     ActionData;         /* 18h */
175 } MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,
176   MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;
177 
178 
179 /* RAID Volume reply ActionStatus values */
180 
181 #define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)
182 #define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)
183 #define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)
184 #define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)
185 
186 
187 /* RAID Volume reply RAID Volume Indicator structure */
188 
189 typedef struct _MPI_RAID_VOL_INDICATOR
190 {
191     U64                     TotalBlocks;        /* 00h */
192     U64                     BlocksRemaining;    /* 08h */
193 } MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,
194   MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;
195 
196 
197 /****************************************************************************/
198 /* SCSI IO RAID Passthrough Request                                         */
199 /****************************************************************************/
200 
201 typedef struct _MSG_SCSI_IO_RAID_PT_REQUEST
202 {
203     U8                      PhysDiskNum;        /* 00h */
204     U8                      Reserved1;          /* 01h */
205     U8                      ChainOffset;        /* 02h */
206     U8                      Function;           /* 03h */
207     U8                      CDBLength;          /* 04h */
208     U8                      SenseBufferLength;  /* 05h */
209     U8                      Reserved2;          /* 06h */
210     U8                      MsgFlags;           /* 07h */
211     U32                     MsgContext;         /* 08h */
212     U8                      LUN[8];             /* 0Ch */
213     U32                     Control;            /* 14h */
214     U8                      CDB[16];            /* 18h */
215     U32                     DataLength;         /* 28h */
216     U32                     SenseBufferLowAddr; /* 2Ch */
217     SGE_IO_UNION            SGL;                /* 30h */
218 } MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,
219   SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;
220 
221 
222 /* SCSI IO RAID Passthrough reply structure */
223 
224 typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
225 {
226     U8                      PhysDiskNum;        /* 00h */
227     U8                      Reserved1;          /* 01h */
228     U8                      MsgLength;          /* 02h */
229     U8                      Function;           /* 03h */
230     U8                      CDBLength;          /* 04h */
231     U8                      SenseBufferLength;  /* 05h */
232     U8                      Reserved2;          /* 06h */
233     U8                      MsgFlags;           /* 07h */
234     U32                     MsgContext;         /* 08h */
235     U8                      SCSIStatus;         /* 0Ch */
236     U8                      SCSIState;          /* 0Dh */
237     U16                     IOCStatus;          /* 0Eh */
238     U32                     IOCLogInfo;         /* 10h */
239     U32                     TransferCount;      /* 14h */
240     U32                     SenseCount;         /* 18h */
241     U32                     ResponseInfo;       /* 1Ch */
242 } MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,
243   SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;
244 
245 
246 /****************************************************************************/
247 /* Mailbox reqeust structure */
248 /****************************************************************************/
249 
250 typedef struct _MSG_MAILBOX_REQUEST
251 {
252     U16                     Reserved1;
253     U8                      ChainOffset;
254     U8                      Function;
255     U16                     Reserved2;
256     U8                      Reserved3;
257     U8                      MsgFlags;
258     U32                     MsgContext;
259     U8                      Command[10];
260     U16                     Reserved4;
261     SGE_IO_UNION            SGL;
262 } MSG_MAILBOX_REQUEST, MPI_POINTER PTR_MSG_MAILBOX_REQUEST,
263   MailboxRequest_t, MPI_POINTER pMailboxRequest_t;
264 
265 
266 /* Mailbox reply structure */
267 typedef struct _MSG_MAILBOX_REPLY
268 {
269     U16                     Reserved1;          /* 00h */
270     U8                      MsgLength;          /* 02h */
271     U8                      Function;           /* 03h */
272     U16                     Reserved2;          /* 04h */
273     U8                      Reserved3;          /* 06h */
274     U8                      MsgFlags;           /* 07h */
275     U32                     MsgContext;         /* 08h */
276     U16                     MailboxStatus;      /* 0Ch */
277     U16                     IOCStatus;          /* 0Eh */
278     U32                     IOCLogInfo;         /* 10h */
279     U32                     Reserved4;          /* 14h */
280 } MSG_MAILBOX_REPLY, MPI_POINTER PTR_MSG_MAILBOX_REPLY,
281   MailboxReply_t, MPI_POINTER pMailboxReply_t;
282 
283 #endif
284 
285 
286 
287