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