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