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