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