xref: /freebsd/sys/dev/mpt/mpilib/mpi_raid.h (revision 13ea0450a9c8742119d36f3bf8f47accdce46e54)
1 /* $FreeBSD$ */
2 /*-
3  * SPDX-License-Identifier: BSD-3-Clause
4  *
5  * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14  *    substantially similar to the "NO WARRANTY" disclaimer below
15  *    ("Disclaimer") and any redistribution must be conditioned upon including
16  *    a substantially similar Disclaimer requirement for further binary
17  *    redistribution.
18  * 3. Neither the name of the LSI Logic Corporation nor the names of its
19  *    contributors may be used to endorse or promote products derived from
20  *    this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
32  * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  *           Name:  mpi_raid.h
35  *          Title:  MPI RAID message and structures
36  *  Creation Date:  February 27, 2001
37  *
38  *    mpi_raid.h Version:  01.05.05
39  *
40  *  Version History
41  *  ---------------
42  *
43  *  Date      Version   Description
44  *  --------  --------  ------------------------------------------------------
45  *  02-27-01  01.01.01  Original release for this file.
46  *  03-27-01  01.01.02  Added structure offset comments.
47  *  08-08-01  01.02.01  Original release for v1.2 work.
48  *  09-28-01  01.02.02  Major rework for MPI v1.2 Integrated RAID changes.
49  *  10-04-01  01.02.03  Added ActionData defines for
50  *                      MPI_RAID_ACTION_DELETE_VOLUME action.
51  *  11-01-01  01.02.04  Added define for MPI_RAID_ACTION_ADATA_DO_NOT_SYNC.
52  *  03-14-02  01.02.05  Added define for MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT.
53  *  05-07-02  01.02.06  Added define for MPI_RAID_ACTION_ACTIVATE_VOLUME,
54  *                      MPI_RAID_ACTION_INACTIVATE_VOLUME, and
55  *                      MPI_RAID_ACTION_ADATA_INACTIVATE_ALL.
56  *  07-12-02  01.02.07  Added structures for Mailbox request and reply.
57  *  11-15-02  01.02.08  Added missing MsgContext field to MSG_MAILBOX_REQUEST.
58  *  04-01-03  01.02.09  New action data option flag for
59  *                      MPI_RAID_ACTION_DELETE_VOLUME.
60  *  05-11-04  01.03.01  Original release for MPI v1.3.
61  *  08-19-04  01.05.01  Original release for MPI v1.5.
62  *  01-15-05  01.05.02  Added defines for the two new RAID Actions for
63  *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
64  *  02-28-07  01.05.03  Added new RAID Action, Device FW Update Mode, and
65  *                      associated defines.
66  *  08-07-07  01.05.04  Added Disable Full Rebuild bit to the ActionDataWord
67  *                      for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
68  *  01-15-08  01.05.05  Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
69  *  --------------------------------------------------------------------------
70  */
71 
72 #ifndef MPI_RAID_H
73 #define MPI_RAID_H
74 
75 
76 /******************************************************************************
77 *
78 *        R A I D    M e s s a g e s
79 *
80 *******************************************************************************/
81 
82 
83 /****************************************************************************/
84 /* RAID Action Request                                                      */
85 /****************************************************************************/
86 
87 typedef struct _MSG_RAID_ACTION
88 {
89     U8                      Action;             /* 00h */
90     U8                      Reserved1;          /* 01h */
91     U8                      ChainOffset;        /* 02h */
92     U8                      Function;           /* 03h */
93     U8                      VolumeID;           /* 04h */
94     U8                      VolumeBus;          /* 05h */
95     U8                      PhysDiskNum;        /* 06h */
96     U8                      MsgFlags;           /* 07h */
97     U32                     MsgContext;         /* 08h */
98     U32                     Reserved2;          /* 0Ch */
99     U32                     ActionDataWord;     /* 10h */
100     SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */
101 } MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,
102   MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;
103 
104 
105 /* RAID Action request Action values */
106 
107 #define MPI_RAID_ACTION_STATUS                      (0x00)
108 #define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)
109 #define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)
110 #define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)
111 #define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)
112 #define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)
113 #define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)
114 #define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)
115 #define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)
116 #define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)
117 #define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)
118 #define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)
119 #define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)
120 #define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)
121 #define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)
122 #define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)
123 #define MPI_RAID_ACTION_ACTIVATE_VOLUME             (0x11)
124 #define MPI_RAID_ACTION_INACTIVATE_VOLUME           (0x12)
125 #define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
126 #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
127 #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)
128 #define MPI_RAID_ACTION_SET_VOLUME_NAME             (0x16)
129 
130 /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
131 #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
132 #define MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT        (0x00000002)
133 
134 /* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */
135 #define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)
136 #define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)
137 
138 #define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
139 #define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
140 
141 /* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
142 #define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD  (0x00000001)
143 
144 /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
145 #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
146 
147 /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_RESYNC_RATE action */
148 #define MPI_RAID_ACTION_ADATA_RESYNC_RATE_MASK      (0x000000FF)
149 
150 /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_DATA_SCRUB_RATE action */
151 #define MPI_RAID_ACTION_ADATA_DATA_SCRUB_RATE_MASK  (0x000000FF)
152 
153 /* ActionDataWord defines for use with MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */
154 #define MPI_RAID_ACTION_ADATA_ENABLE_FW_UPDATE          (0x00000001)
155 #define MPI_RAID_ACTION_ADATA_MASK_FW_UPDATE_TIMEOUT    (0x0000FF00)
156 #define MPI_RAID_ACTION_ADATA_SHIFT_FW_UPDATE_TIMEOUT   (8)
157 
158 
159 /* RAID Action reply message */
160 
161 typedef struct _MSG_RAID_ACTION_REPLY
162 {
163     U8                      Action;             /* 00h */
164     U8                      Reserved;           /* 01h */
165     U8                      MsgLength;          /* 02h */
166     U8                      Function;           /* 03h */
167     U8                      VolumeID;           /* 04h */
168     U8                      VolumeBus;          /* 05h */
169     U8                      PhysDiskNum;        /* 06h */
170     U8                      MsgFlags;           /* 07h */
171     U32                     MsgContext;         /* 08h */
172     U16                     ActionStatus;       /* 0Ch */
173     U16                     IOCStatus;          /* 0Eh */
174     U32                     IOCLogInfo;         /* 10h */
175     U32                     VolumeStatus;       /* 14h */
176     U32                     ActionData;         /* 18h */
177 } MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,
178   MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;
179 
180 
181 /* RAID Volume reply ActionStatus values */
182 
183 #define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)
184 #define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)
185 #define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)
186 #define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)
187 
188 
189 /* RAID Volume reply RAID Volume Indicator structure */
190 
191 typedef struct _MPI_RAID_VOL_INDICATOR
192 {
193     U64                     TotalBlocks;        /* 00h */
194     U64                     BlocksRemaining;    /* 08h */
195 } MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,
196   MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;
197 
198 
199 /****************************************************************************/
200 /* SCSI IO RAID Passthrough Request                                         */
201 /****************************************************************************/
202 
203 typedef struct _MSG_SCSI_IO_RAID_PT_REQUEST
204 {
205     U8                      PhysDiskNum;        /* 00h */
206     U8                      Reserved1;          /* 01h */
207     U8                      ChainOffset;        /* 02h */
208     U8                      Function;           /* 03h */
209     U8                      CDBLength;          /* 04h */
210     U8                      SenseBufferLength;  /* 05h */
211     U8                      Reserved2;          /* 06h */
212     U8                      MsgFlags;           /* 07h */
213     U32                     MsgContext;         /* 08h */
214     U8                      LUN[8];             /* 0Ch */
215     U32                     Control;            /* 14h */
216     U8                      CDB[16];            /* 18h */
217     U32                     DataLength;         /* 28h */
218     U32                     SenseBufferLowAddr; /* 2Ch */
219     SGE_IO_UNION            SGL;                /* 30h */
220 } MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,
221   SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;
222 
223 
224 /* SCSI IO RAID Passthrough reply structure */
225 
226 typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
227 {
228     U8                      PhysDiskNum;        /* 00h */
229     U8                      Reserved1;          /* 01h */
230     U8                      MsgLength;          /* 02h */
231     U8                      Function;           /* 03h */
232     U8                      CDBLength;          /* 04h */
233     U8                      SenseBufferLength;  /* 05h */
234     U8                      Reserved2;          /* 06h */
235     U8                      MsgFlags;           /* 07h */
236     U32                     MsgContext;         /* 08h */
237     U8                      SCSIStatus;         /* 0Ch */
238     U8                      SCSIState;          /* 0Dh */
239     U16                     IOCStatus;          /* 0Eh */
240     U32                     IOCLogInfo;         /* 10h */
241     U32                     TransferCount;      /* 14h */
242     U32                     SenseCount;         /* 18h */
243     U32                     ResponseInfo;       /* 1Ch */
244 } MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,
245   SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;
246 
247 
248 /****************************************************************************/
249 /* Mailbox reqeust structure */
250 /****************************************************************************/
251 
252 typedef struct _MSG_MAILBOX_REQUEST
253 {
254     U16                     Reserved1;
255     U8                      ChainOffset;
256     U8                      Function;
257     U16                     Reserved2;
258     U8                      Reserved3;
259     U8                      MsgFlags;
260     U32                     MsgContext;
261     U8                      Command[10];
262     U16                     Reserved4;
263     SGE_IO_UNION            SGL;
264 } MSG_MAILBOX_REQUEST, MPI_POINTER PTR_MSG_MAILBOX_REQUEST,
265   MailboxRequest_t, MPI_POINTER pMailboxRequest_t;
266 
267 
268 /* Mailbox reply structure */
269 typedef struct _MSG_MAILBOX_REPLY
270 {
271     U16                     Reserved1;          /* 00h */
272     U8                      MsgLength;          /* 02h */
273     U8                      Function;           /* 03h */
274     U16                     Reserved2;          /* 04h */
275     U8                      Reserved3;          /* 06h */
276     U8                      MsgFlags;           /* 07h */
277     U32                     MsgContext;         /* 08h */
278     U16                     MailboxStatus;      /* 0Ch */
279     U16                     IOCStatus;          /* 0Eh */
280     U32                     IOCLogInfo;         /* 10h */
281     U32                     Reserved4;          /* 14h */
282 } MSG_MAILBOX_REPLY, MPI_POINTER PTR_MSG_MAILBOX_REPLY,
283   MailboxReply_t, MPI_POINTER pMailboxReply_t;
284 
285 #endif
286 
287 
288 
289