1 /*
2  * Copyright (c) 2000-2012 LSI Corporation.
3  *
4  *
5  *          Name:  mpi2_raid.h
6  *         Title:  MPI Integrated RAID messages and structures
7  * Creation Date:  April 26, 2007
8  *
9  *   mpi2_raid.h Version:  02.00.08
10  *
11  * Version History
12  * ---------------
13  *
14  * Date      Version   Description
15  * --------  --------  ------------------------------------------------------
16  * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
17  * 08-31-07  02.00.01  Modifications to RAID Action request and reply,
18  *                     including the Actions and ActionData.
19  * 02-29-08  02.00.02  Added MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD.
20  * 05-21-08  02.00.03  Added MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS so that
21  *                     the PhysDisk array in MPI2_RAID_VOLUME_CREATION_STRUCT
22  *                     can be sized by the build environment.
23  * 07-30-09  02.00.04  Added proper define for the Use Default Settings bit of
24  *                     VolumeCreationFlags and marked the old one as obsolete.
25  * 05-12-10  02.00.05  Added MPI2_RAID_VOL_FLAGS_OP_MDC define.
26  * 08-24-10  02.00.06  Added MPI2_RAID_ACTION_COMPATIBILITY_CHECK along with
27  *                     related structures and defines.
28  *                     Added product-specific range to RAID Action values.
29  * 11-18-11  02.00.07  Incorporating additions for MPI v2.5.
30  * 02-06-12  02.00.08  Added MPI2_RAID_ACTION_PHYSDISK_HIDDEN.
31  * --------------------------------------------------------------------------
32  */
33 
34 #ifndef MPI2_RAID_H
35 #define MPI2_RAID_H
36 
37 /*****************************************************************************
38 *
39 *              Integrated RAID Messages
40 *
41 *****************************************************************************/
42 
43 /****************************************************************************
44 * RAID Action messages
45 ****************************************************************************/
46 
47 /*ActionDataWord defines for use with MPI2_RAID_ACTION_DELETE_VOLUME action */
48 #define MPI2_RAID_ACTION_ADATA_KEEP_LBA0            (0x00000000)
49 #define MPI2_RAID_ACTION_ADATA_ZERO_LBA0            (0x00000001)
50 
51 /*use MPI2_RAIDVOL0_SETTING_ defines from mpi2_cnfg.h for
52  *MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE action */
53 
54 /*ActionDataWord defines for use with
55  *MPI2_RAID_ACTION_DISABLE_ALL_VOLUMES action */
56 #define MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD  (0x00000001)
57 
58 /*ActionDataWord for MPI2_RAID_ACTION_SET_RAID_FUNCTION_RATE Action */
59 typedef struct _MPI2_RAID_ACTION_RATE_DATA {
60 	U8 RateToChange;	/*0x00 */
61 	U8 RateOrMode;		/*0x01 */
62 	U16 DataScrubDuration;	/*0x02 */
63 } MPI2_RAID_ACTION_RATE_DATA, *PTR_MPI2_RAID_ACTION_RATE_DATA,
64 	Mpi2RaidActionRateData_t, *pMpi2RaidActionRateData_t;
65 
66 #define MPI2_RAID_ACTION_SET_RATE_RESYNC            (0x00)
67 #define MPI2_RAID_ACTION_SET_RATE_DATA_SCRUB        (0x01)
68 #define MPI2_RAID_ACTION_SET_RATE_POWERSAVE_MODE    (0x02)
69 
70 /*ActionDataWord for MPI2_RAID_ACTION_START_RAID_FUNCTION Action */
71 typedef struct _MPI2_RAID_ACTION_START_RAID_FUNCTION {
72 	U8 RAIDFunction;	/*0x00 */
73 	U8 Flags;		/*0x01 */
74 	U16 Reserved1;		/*0x02 */
75 } MPI2_RAID_ACTION_START_RAID_FUNCTION,
76 	*PTR_MPI2_RAID_ACTION_START_RAID_FUNCTION,
77 	Mpi2RaidActionStartRaidFunction_t,
78 	*pMpi2RaidActionStartRaidFunction_t;
79 
80 /*defines for the RAIDFunction field */
81 #define MPI2_RAID_ACTION_START_BACKGROUND_INIT      (0x00)
82 #define MPI2_RAID_ACTION_START_ONLINE_CAP_EXPANSION (0x01)
83 #define MPI2_RAID_ACTION_START_CONSISTENCY_CHECK    (0x02)
84 
85 /*defines for the Flags field */
86 #define MPI2_RAID_ACTION_START_NEW                  (0x00)
87 #define MPI2_RAID_ACTION_START_RESUME               (0x01)
88 
89 /*ActionDataWord for MPI2_RAID_ACTION_STOP_RAID_FUNCTION Action */
90 typedef struct _MPI2_RAID_ACTION_STOP_RAID_FUNCTION {
91 	U8 RAIDFunction;	/*0x00 */
92 	U8 Flags;		/*0x01 */
93 	U16 Reserved1;		/*0x02 */
94 } MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
95 	*PTR_MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
96 	Mpi2RaidActionStopRaidFunction_t,
97 	*pMpi2RaidActionStopRaidFunction_t;
98 
99 /*defines for the RAIDFunction field */
100 #define MPI2_RAID_ACTION_STOP_BACKGROUND_INIT       (0x00)
101 #define MPI2_RAID_ACTION_STOP_ONLINE_CAP_EXPANSION  (0x01)
102 #define MPI2_RAID_ACTION_STOP_CONSISTENCY_CHECK     (0x02)
103 
104 /*defines for the Flags field */
105 #define MPI2_RAID_ACTION_STOP_ABORT                 (0x00)
106 #define MPI2_RAID_ACTION_STOP_PAUSE                 (0x01)
107 
108 /*ActionDataWord for MPI2_RAID_ACTION_CREATE_HOT_SPARE Action */
109 typedef struct _MPI2_RAID_ACTION_HOT_SPARE {
110 	U8 HotSparePool;	/*0x00 */
111 	U8 Reserved1;		/*0x01 */
112 	U16 DevHandle;		/*0x02 */
113 } MPI2_RAID_ACTION_HOT_SPARE, *PTR_MPI2_RAID_ACTION_HOT_SPARE,
114 	Mpi2RaidActionHotSpare_t, *pMpi2RaidActionHotSpare_t;
115 
116 /*ActionDataWord for MPI2_RAID_ACTION_DEVICE_FW_UPDATE_MODE Action */
117 typedef struct _MPI2_RAID_ACTION_FW_UPDATE_MODE {
118 	U8 Flags;		/*0x00 */
119 	U8 DeviceFirmwareUpdateModeTimeout;	/*0x01 */
120 	U16 Reserved1;		/*0x02 */
121 } MPI2_RAID_ACTION_FW_UPDATE_MODE,
122 	*PTR_MPI2_RAID_ACTION_FW_UPDATE_MODE,
123 	Mpi2RaidActionFwUpdateMode_t,
124 	*pMpi2RaidActionFwUpdateMode_t;
125 
126 /*ActionDataWord defines for use with
127  *MPI2_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */
128 #define MPI2_RAID_ACTION_ADATA_DISABLE_FW_UPDATE        (0x00)
129 #define MPI2_RAID_ACTION_ADATA_ENABLE_FW_UPDATE         (0x01)
130 
131 typedef union _MPI2_RAID_ACTION_DATA {
132 	U32 Word;
133 	MPI2_RAID_ACTION_RATE_DATA Rates;
134 	MPI2_RAID_ACTION_START_RAID_FUNCTION StartRaidFunction;
135 	MPI2_RAID_ACTION_STOP_RAID_FUNCTION StopRaidFunction;
136 	MPI2_RAID_ACTION_HOT_SPARE HotSpare;
137 	MPI2_RAID_ACTION_FW_UPDATE_MODE FwUpdateMode;
138 } MPI2_RAID_ACTION_DATA, *PTR_MPI2_RAID_ACTION_DATA,
139 	Mpi2RaidActionData_t, *pMpi2RaidActionData_t;
140 
141 /*RAID Action Request Message */
142 typedef struct _MPI2_RAID_ACTION_REQUEST {
143 	U8 Action;		/*0x00 */
144 	U8 Reserved1;		/*0x01 */
145 	U8 ChainOffset;		/*0x02 */
146 	U8 Function;		/*0x03 */
147 	U16 VolDevHandle;	/*0x04 */
148 	U8 PhysDiskNum;		/*0x06 */
149 	U8 MsgFlags;		/*0x07 */
150 	U8 VP_ID;		/*0x08 */
151 	U8 VF_ID;		/*0x09 */
152 	U16 Reserved2;		/*0x0A */
153 	U32 Reserved3;		/*0x0C */
154 	MPI2_RAID_ACTION_DATA ActionDataWord;	/*0x10 */
155 	MPI2_SGE_SIMPLE_UNION ActionDataSGE;	/*0x14 */
156 } MPI2_RAID_ACTION_REQUEST, *PTR_MPI2_RAID_ACTION_REQUEST,
157 	Mpi2RaidActionRequest_t, *pMpi2RaidActionRequest_t;
158 
159 /*RAID Action request Action values */
160 
161 #define MPI2_RAID_ACTION_INDICATOR_STRUCT           (0x01)
162 #define MPI2_RAID_ACTION_CREATE_VOLUME              (0x02)
163 #define MPI2_RAID_ACTION_DELETE_VOLUME              (0x03)
164 #define MPI2_RAID_ACTION_DISABLE_ALL_VOLUMES        (0x04)
165 #define MPI2_RAID_ACTION_ENABLE_ALL_VOLUMES         (0x05)
166 #define MPI2_RAID_ACTION_PHYSDISK_OFFLINE           (0x0A)
167 #define MPI2_RAID_ACTION_PHYSDISK_ONLINE            (0x0B)
168 #define MPI2_RAID_ACTION_FAIL_PHYSDISK              (0x0F)
169 #define MPI2_RAID_ACTION_ACTIVATE_VOLUME            (0x11)
170 #define MPI2_RAID_ACTION_DEVICE_FW_UPDATE_MODE      (0x15)
171 #define MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE     (0x17)
172 #define MPI2_RAID_ACTION_SET_VOLUME_NAME            (0x18)
173 #define MPI2_RAID_ACTION_SET_RAID_FUNCTION_RATE     (0x19)
174 #define MPI2_RAID_ACTION_ENABLE_FAILED_VOLUME       (0x1C)
175 #define MPI2_RAID_ACTION_CREATE_HOT_SPARE           (0x1D)
176 #define MPI2_RAID_ACTION_DELETE_HOT_SPARE           (0x1E)
177 #define MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED  (0x20)
178 #define MPI2_RAID_ACTION_START_RAID_FUNCTION        (0x21)
179 #define MPI2_RAID_ACTION_STOP_RAID_FUNCTION         (0x22)
180 #define MPI2_RAID_ACTION_COMPATIBILITY_CHECK        (0x23)
181 #define MPI2_RAID_ACTION_PHYSDISK_HIDDEN            (0x24)
182 #define MPI2_RAID_ACTION_MIN_PRODUCT_SPECIFIC       (0x80)
183 #define MPI2_RAID_ACTION_MAX_PRODUCT_SPECIFIC       (0xFF)
184 
185 /*RAID Volume Creation Structure */
186 
187 /*
188  *The following define can be customized for the targeted product.
189  */
190 #ifndef MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS
191 #define MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS        (1)
192 #endif
193 
194 typedef struct _MPI2_RAID_VOLUME_PHYSDISK {
195 	U8 RAIDSetNum;		/*0x00 */
196 	U8 PhysDiskMap;		/*0x01 */
197 	U16 PhysDiskDevHandle;	/*0x02 */
198 } MPI2_RAID_VOLUME_PHYSDISK, *PTR_MPI2_RAID_VOLUME_PHYSDISK,
199 	Mpi2RaidVolumePhysDisk_t, *pMpi2RaidVolumePhysDisk_t;
200 
201 /*defines for the PhysDiskMap field */
202 #define MPI2_RAIDACTION_PHYSDISK_PRIMARY            (0x01)
203 #define MPI2_RAIDACTION_PHYSDISK_SECONDARY          (0x02)
204 
205 typedef struct _MPI2_RAID_VOLUME_CREATION_STRUCT {
206 	U8 NumPhysDisks;	/*0x00 */
207 	U8 VolumeType;		/*0x01 */
208 	U16 Reserved1;		/*0x02 */
209 	U32 VolumeCreationFlags;	/*0x04 */
210 	U32 VolumeSettings;	/*0x08 */
211 	U8 Reserved2;		/*0x0C */
212 	U8 ResyncRate;		/*0x0D */
213 	U16 DataScrubDuration;	/*0x0E */
214 	U64 VolumeMaxLBA;	/*0x10 */
215 	U32 StripeSize;		/*0x18 */
216 	U8 Name[16];		/*0x1C */
217 	MPI2_RAID_VOLUME_PHYSDISK
218 		PhysDisk[MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS];	/*0x2C */
219 } MPI2_RAID_VOLUME_CREATION_STRUCT,
220 	*PTR_MPI2_RAID_VOLUME_CREATION_STRUCT,
221 	Mpi2RaidVolumeCreationStruct_t,
222 	*pMpi2RaidVolumeCreationStruct_t;
223 
224 /*use MPI2_RAID_VOL_TYPE_ defines from mpi2_cnfg.h for VolumeType */
225 
226 /*defines for the VolumeCreationFlags field */
227 #define MPI2_RAID_VOL_CREATION_DEFAULT_SETTINGS     (0x80000000)
228 #define MPI2_RAID_VOL_CREATION_BACKGROUND_INIT      (0x00000004)
229 #define MPI2_RAID_VOL_CREATION_LOW_LEVEL_INIT       (0x00000002)
230 #define MPI2_RAID_VOL_CREATION_MIGRATE_DATA         (0x00000001)
231 /*The following is an obsolete define.
232  *It must be shifted left 24 bits in order to set the proper bit.
233  */
234 #define MPI2_RAID_VOL_CREATION_USE_DEFAULT_SETTINGS (0x80)
235 
236 /*RAID Online Capacity Expansion Structure */
237 
238 typedef struct _MPI2_RAID_ONLINE_CAPACITY_EXPANSION {
239 	U32 Flags;		/*0x00 */
240 	U16 DevHandle0;		/*0x04 */
241 	U16 Reserved1;		/*0x06 */
242 	U16 DevHandle1;		/*0x08 */
243 	U16 Reserved2;		/*0x0A */
244 } MPI2_RAID_ONLINE_CAPACITY_EXPANSION,
245 	*PTR_MPI2_RAID_ONLINE_CAPACITY_EXPANSION,
246 	Mpi2RaidOnlineCapacityExpansion_t,
247 	*pMpi2RaidOnlineCapacityExpansion_t;
248 
249 /*RAID Compatibility Input Structure */
250 
251 typedef struct _MPI2_RAID_COMPATIBILITY_INPUT_STRUCT {
252 	U16 SourceDevHandle;	/*0x00 */
253 	U16 CandidateDevHandle;	/*0x02 */
254 	U32 Flags;		/*0x04 */
255 	U32 Reserved1;		/*0x08 */
256 	U32 Reserved2;		/*0x0C */
257 } MPI2_RAID_COMPATIBILITY_INPUT_STRUCT,
258 	*PTR_MPI2_RAID_COMPATIBILITY_INPUT_STRUCT,
259 	Mpi2RaidCompatibilityInputStruct_t,
260 	*pMpi2RaidCompatibilityInputStruct_t;
261 
262 /*defines for RAID Compatibility Structure Flags field */
263 #define MPI2_RAID_COMPAT_SOURCE_IS_VOLUME_FLAG      (0x00000002)
264 #define MPI2_RAID_COMPAT_REPORT_SOURCE_INFO_FLAG    (0x00000001)
265 
266 /*RAID Volume Indicator Structure */
267 
268 typedef struct _MPI2_RAID_VOL_INDICATOR {
269 	U64 TotalBlocks;	/*0x00 */
270 	U64 BlocksRemaining;	/*0x08 */
271 	U32 Flags;		/*0x10 */
272 } MPI2_RAID_VOL_INDICATOR, *PTR_MPI2_RAID_VOL_INDICATOR,
273 	Mpi2RaidVolIndicator_t, *pMpi2RaidVolIndicator_t;
274 
275 /*defines for RAID Volume Indicator Flags field */
276 #define MPI2_RAID_VOL_FLAGS_OP_MASK                 (0x0000000F)
277 #define MPI2_RAID_VOL_FLAGS_OP_BACKGROUND_INIT      (0x00000000)
278 #define MPI2_RAID_VOL_FLAGS_OP_ONLINE_CAP_EXPANSION (0x00000001)
279 #define MPI2_RAID_VOL_FLAGS_OP_CONSISTENCY_CHECK    (0x00000002)
280 #define MPI2_RAID_VOL_FLAGS_OP_RESYNC               (0x00000003)
281 #define MPI2_RAID_VOL_FLAGS_OP_MDC                  (0x00000004)
282 
283 /*RAID Compatibility Result Structure */
284 
285 typedef struct _MPI2_RAID_COMPATIBILITY_RESULT_STRUCT {
286 	U8 State;		/*0x00 */
287 	U8 Reserved1;		/*0x01 */
288 	U16 Reserved2;		/*0x02 */
289 	U32 GenericAttributes;	/*0x04 */
290 	U32 OEMSpecificAttributes;	/*0x08 */
291 	U32 Reserved3;		/*0x0C */
292 	U32 Reserved4;		/*0x10 */
293 } MPI2_RAID_COMPATIBILITY_RESULT_STRUCT,
294 	*PTR_MPI2_RAID_COMPATIBILITY_RESULT_STRUCT,
295 	Mpi2RaidCompatibilityResultStruct_t,
296 	*pMpi2RaidCompatibilityResultStruct_t;
297 
298 /*defines for RAID Compatibility Result Structure State field */
299 #define MPI2_RAID_COMPAT_STATE_COMPATIBLE           (0x00)
300 #define MPI2_RAID_COMPAT_STATE_NOT_COMPATIBLE       (0x01)
301 
302 /*defines for RAID Compatibility Result Structure GenericAttributes field */
303 #define MPI2_RAID_COMPAT_GENATTRIB_4K_SECTOR            (0x00000010)
304 
305 #define MPI2_RAID_COMPAT_GENATTRIB_MEDIA_MASK           (0x0000000C)
306 #define MPI2_RAID_COMPAT_GENATTRIB_SOLID_STATE_DRIVE    (0x00000008)
307 #define MPI2_RAID_COMPAT_GENATTRIB_HARD_DISK_DRIVE      (0x00000004)
308 
309 #define MPI2_RAID_COMPAT_GENATTRIB_PROTOCOL_MASK        (0x00000003)
310 #define MPI2_RAID_COMPAT_GENATTRIB_SAS_PROTOCOL         (0x00000002)
311 #define MPI2_RAID_COMPAT_GENATTRIB_SATA_PROTOCOL        (0x00000001)
312 
313 /*RAID Action Reply ActionData union */
314 typedef union _MPI2_RAID_ACTION_REPLY_DATA {
315 	U32 Word[5];
316 	MPI2_RAID_VOL_INDICATOR RaidVolumeIndicator;
317 	U16 VolDevHandle;
318 	U8 VolumeState;
319 	U8 PhysDiskNum;
320 	MPI2_RAID_COMPATIBILITY_RESULT_STRUCT RaidCompatibilityResult;
321 } MPI2_RAID_ACTION_REPLY_DATA, *PTR_MPI2_RAID_ACTION_REPLY_DATA,
322 	Mpi2RaidActionReplyData_t, *pMpi2RaidActionReplyData_t;
323 
324 /*use MPI2_RAIDVOL0_SETTING_ defines from mpi2_cnfg.h for
325  *MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE action */
326 
327 /*RAID Action Reply Message */
328 typedef struct _MPI2_RAID_ACTION_REPLY {
329 	U8 Action;		/*0x00 */
330 	U8 Reserved1;		/*0x01 */
331 	U8 MsgLength;		/*0x02 */
332 	U8 Function;		/*0x03 */
333 	U16 VolDevHandle;	/*0x04 */
334 	U8 PhysDiskNum;		/*0x06 */
335 	U8 MsgFlags;		/*0x07 */
336 	U8 VP_ID;		/*0x08 */
337 	U8 VF_ID;		/*0x09 */
338 	U16 Reserved2;		/*0x0A */
339 	U16 Reserved3;		/*0x0C */
340 	U16 IOCStatus;		/*0x0E */
341 	U32 IOCLogInfo;		/*0x10 */
342 	MPI2_RAID_ACTION_REPLY_DATA ActionData;	/*0x14 */
343 } MPI2_RAID_ACTION_REPLY, *PTR_MPI2_RAID_ACTION_REPLY,
344 	Mpi2RaidActionReply_t, *pMpi2RaidActionReply_t;
345 
346 #endif
347