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