xref: /freebsd/sys/dev/mpt/mpilib/mpi_raid.h (revision 81ad6265)
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 *        R A I D    M e s s a g e s
78 *
79 *******************************************************************************/
80 
81 /****************************************************************************/
82 /* RAID Action Request                                                      */
83 /****************************************************************************/
84 
85 typedef struct _MSG_RAID_ACTION
86 {
87     U8                      Action;             /* 00h */
88     U8                      Reserved1;          /* 01h */
89     U8                      ChainOffset;        /* 02h */
90     U8                      Function;           /* 03h */
91     U8                      VolumeID;           /* 04h */
92     U8                      VolumeBus;          /* 05h */
93     U8                      PhysDiskNum;        /* 06h */
94     U8                      MsgFlags;           /* 07h */
95     U32                     MsgContext;         /* 08h */
96     U32                     Reserved2;          /* 0Ch */
97     U32                     ActionDataWord;     /* 10h */
98     SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */
99 } MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,
100   MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;
101 
102 /* RAID Action request Action values */
103 
104 #define MPI_RAID_ACTION_STATUS                      (0x00)
105 #define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)
106 #define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)
107 #define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)
108 #define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)
109 #define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)
110 #define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)
111 #define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)
112 #define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)
113 #define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)
114 #define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)
115 #define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)
116 #define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)
117 #define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)
118 #define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)
119 #define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)
120 #define MPI_RAID_ACTION_ACTIVATE_VOLUME             (0x11)
121 #define MPI_RAID_ACTION_INACTIVATE_VOLUME           (0x12)
122 #define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
123 #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
124 #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)
125 #define MPI_RAID_ACTION_SET_VOLUME_NAME             (0x16)
126 
127 /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
128 #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
129 #define MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT        (0x00000002)
130 
131 /* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */
132 #define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)
133 #define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)
134 
135 #define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
136 #define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
137 
138 /* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
139 #define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD  (0x00000001)
140 
141 /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
142 #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
143 
144 /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_RESYNC_RATE action */
145 #define MPI_RAID_ACTION_ADATA_RESYNC_RATE_MASK      (0x000000FF)
146 
147 /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_DATA_SCRUB_RATE action */
148 #define MPI_RAID_ACTION_ADATA_DATA_SCRUB_RATE_MASK  (0x000000FF)
149 
150 /* ActionDataWord defines for use with MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */
151 #define MPI_RAID_ACTION_ADATA_ENABLE_FW_UPDATE          (0x00000001)
152 #define MPI_RAID_ACTION_ADATA_MASK_FW_UPDATE_TIMEOUT    (0x0000FF00)
153 #define MPI_RAID_ACTION_ADATA_SHIFT_FW_UPDATE_TIMEOUT   (8)
154 
155 /* RAID Action reply message */
156 
157 typedef struct _MSG_RAID_ACTION_REPLY
158 {
159     U8                      Action;             /* 00h */
160     U8                      Reserved;           /* 01h */
161     U8                      MsgLength;          /* 02h */
162     U8                      Function;           /* 03h */
163     U8                      VolumeID;           /* 04h */
164     U8                      VolumeBus;          /* 05h */
165     U8                      PhysDiskNum;        /* 06h */
166     U8                      MsgFlags;           /* 07h */
167     U32                     MsgContext;         /* 08h */
168     U16                     ActionStatus;       /* 0Ch */
169     U16                     IOCStatus;          /* 0Eh */
170     U32                     IOCLogInfo;         /* 10h */
171     U32                     VolumeStatus;       /* 14h */
172     U32                     ActionData;         /* 18h */
173 } MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,
174   MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;
175 
176 /* RAID Volume reply ActionStatus values */
177 
178 #define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)
179 #define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)
180 #define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)
181 #define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)
182 
183 /* RAID Volume reply RAID Volume Indicator structure */
184 
185 typedef struct _MPI_RAID_VOL_INDICATOR
186 {
187     U64                     TotalBlocks;        /* 00h */
188     U64                     BlocksRemaining;    /* 08h */
189 } MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,
190   MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;
191 
192 /****************************************************************************/
193 /* SCSI IO RAID Passthrough Request                                         */
194 /****************************************************************************/
195 
196 typedef struct _MSG_SCSI_IO_RAID_PT_REQUEST
197 {
198     U8                      PhysDiskNum;        /* 00h */
199     U8                      Reserved1;          /* 01h */
200     U8                      ChainOffset;        /* 02h */
201     U8                      Function;           /* 03h */
202     U8                      CDBLength;          /* 04h */
203     U8                      SenseBufferLength;  /* 05h */
204     U8                      Reserved2;          /* 06h */
205     U8                      MsgFlags;           /* 07h */
206     U32                     MsgContext;         /* 08h */
207     U8                      LUN[8];             /* 0Ch */
208     U32                     Control;            /* 14h */
209     U8                      CDB[16];            /* 18h */
210     U32                     DataLength;         /* 28h */
211     U32                     SenseBufferLowAddr; /* 2Ch */
212     SGE_IO_UNION            SGL;                /* 30h */
213 } MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,
214   SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;
215 
216 /* SCSI IO RAID Passthrough reply structure */
217 
218 typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
219 {
220     U8                      PhysDiskNum;        /* 00h */
221     U8                      Reserved1;          /* 01h */
222     U8                      MsgLength;          /* 02h */
223     U8                      Function;           /* 03h */
224     U8                      CDBLength;          /* 04h */
225     U8                      SenseBufferLength;  /* 05h */
226     U8                      Reserved2;          /* 06h */
227     U8                      MsgFlags;           /* 07h */
228     U32                     MsgContext;         /* 08h */
229     U8                      SCSIStatus;         /* 0Ch */
230     U8                      SCSIState;          /* 0Dh */
231     U16                     IOCStatus;          /* 0Eh */
232     U32                     IOCLogInfo;         /* 10h */
233     U32                     TransferCount;      /* 14h */
234     U32                     SenseCount;         /* 18h */
235     U32                     ResponseInfo;       /* 1Ch */
236 } MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,
237   SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;
238 
239 /****************************************************************************/
240 /* Mailbox reqeust structure */
241 /****************************************************************************/
242 
243 typedef struct _MSG_MAILBOX_REQUEST
244 {
245     U16                     Reserved1;
246     U8                      ChainOffset;
247     U8                      Function;
248     U16                     Reserved2;
249     U8                      Reserved3;
250     U8                      MsgFlags;
251     U32                     MsgContext;
252     U8                      Command[10];
253     U16                     Reserved4;
254     SGE_IO_UNION            SGL;
255 } MSG_MAILBOX_REQUEST, MPI_POINTER PTR_MSG_MAILBOX_REQUEST,
256   MailboxRequest_t, MPI_POINTER pMailboxRequest_t;
257 
258 /* Mailbox reply structure */
259 typedef struct _MSG_MAILBOX_REPLY
260 {
261     U16                     Reserved1;          /* 00h */
262     U8                      MsgLength;          /* 02h */
263     U8                      Function;           /* 03h */
264     U16                     Reserved2;          /* 04h */
265     U8                      Reserved3;          /* 06h */
266     U8                      MsgFlags;           /* 07h */
267     U32                     MsgContext;         /* 08h */
268     U16                     MailboxStatus;      /* 0Ch */
269     U16                     IOCStatus;          /* 0Eh */
270     U32                     IOCLogInfo;         /* 10h */
271     U32                     Reserved4;          /* 14h */
272 } MSG_MAILBOX_REPLY, MPI_POINTER PTR_MSG_MAILBOX_REPLY,
273   MailboxReply_t, MPI_POINTER pMailboxReply_t;
274 
275 #endif
276