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