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