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