Initial import from FreeBSD RELENG_4:
[games.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 /*
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 Version:  01.02.04
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  *  --------------------------------------------------------------------------
46  */
47
48 #ifndef MPI_RAID_H
49 #define MPI_RAID_H
50
51
52 /******************************************************************************
53 *
54 *        R A I D    M e s s a g e s
55 *
56 *******************************************************************************/
57
58
59 /****************************************************************************/
60 /* RAID Volume Request                                                      */
61 /****************************************************************************/
62
63 typedef struct _MSG_RAID_ACTION
64 {
65     U8                      Action;             /* 00h */
66     U8                      Reserved1;          /* 01h */
67     U8                      ChainOffset;        /* 02h */
68     U8                      Function;           /* 03h */
69     U8                      VolumeID;           /* 04h */
70     U8                      VolumeBus;          /* 05h */
71     U8                      PhysDiskNum;        /* 06h */
72     U8                      MsgFlags;           /* 07h */
73     U32                     MsgContext;         /* 08h */
74     U32                     Reserved2;          /* 0Ch */
75     U32                     ActionDataWord;     /* 10h */
76     SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */
77 } MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,
78   MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;
79
80
81 /* RAID Action request Action values */
82
83 #define MPI_RAID_ACTION_STATUS                      (0x00)
84 #define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)
85 #define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)
86 #define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)
87 #define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)
88 #define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)
89 #define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)
90 #define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)
91 #define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)
92 #define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)
93 #define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)
94 #define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)
95 #define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)
96 #define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)
97 #define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)
98 #define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)
99
100 /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
101 #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
102
103 /* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */
104 #define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)
105 #define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)
106
107
108 /* RAID Action reply message */
109
110 typedef struct _MSG_RAID_ACTION_REPLY
111 {
112     U8                      Action;             /* 00h */
113     U8                      Reserved;           /* 01h */
114     U8                      MsgLength;          /* 02h */
115     U8                      Function;           /* 03h */
116     U8                      VolumeID;           /* 04h */
117     U8                      VolumeBus;          /* 05h */
118     U8                      PhysDiskNum;        /* 06h */
119     U8                      MsgFlags;           /* 07h */
120     U32                     MsgContext;         /* 08h */
121     U16                     ActionStatus;       /* 0Ch */
122     U16                     IOCStatus;          /* 0Eh */
123     U32                     IOCLogInfo;         /* 10h */
124     U32                     VolumeStatus;       /* 14h */
125     U32                     ActionData;         /* 18h */
126 } MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,
127   MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;
128
129
130 /* RAID Volume reply ActionStatus values */
131
132 #define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)
133 #define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)
134 #define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)
135 #define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)
136
137
138 /* RAID Volume reply RAID Volume Indicator structure */
139
140 typedef struct _MPI_RAID_VOL_INDICATOR
141 {
142     U64                     TotalBlocks;        /* 00h */
143     U64                     BlocksRemaining;    /* 08h */
144 } MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,
145   MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;
146
147
148 /****************************************************************************/
149 /* SCSI IO RAID Passthrough Request                                         */
150 /****************************************************************************/
151
152 typedef struct _MSG_SCSI_IO_RAID_PT_REQUEST
153 {
154     U8                      PhysDiskNum;        /* 00h */
155     U8                      Reserved1;          /* 01h */
156     U8                      ChainOffset;        /* 02h */
157     U8                      Function;           /* 03h */
158     U8                      CDBLength;          /* 04h */
159     U8                      SenseBufferLength;  /* 05h */
160     U8                      Reserved2;          /* 06h */
161     U8                      MsgFlags;           /* 07h */
162     U32                     MsgContext;         /* 08h */
163     U8                      LUN[8];             /* 0Ch */
164     U32                     Control;            /* 14h */
165     U8                      CDB[16];            /* 18h */
166     U32                     DataLength;         /* 28h */
167     U32                     SenseBufferLowAddr; /* 2Ch */
168     SGE_IO_UNION            SGL;                /* 30h */
169 } MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,
170   SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;
171
172
173 /* SCSI IO RAID Passthrough reply structure */
174
175 typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
176 {
177     U8                      PhysDiskNum;        /* 00h */
178     U8                      Reserved1;          /* 01h */
179     U8                      MsgLength;          /* 02h */
180     U8                      Function;           /* 03h */
181     U8                      CDBLength;          /* 04h */
182     U8                      SenseBufferLength;  /* 05h */
183     U8                      Reserved2;          /* 06h */
184     U8                      MsgFlags;           /* 07h */
185     U32                     MsgContext;         /* 08h */
186     U8                      SCSIStatus;         /* 0Ch */
187     U8                      SCSIState;          /* 0Dh */
188     U16                     IOCStatus;          /* 0Eh */
189     U32                     IOCLogInfo;         /* 10h */
190     U32                     TransferCount;      /* 14h */
191     U32                     SenseCount;         /* 18h */
192     U32                     ResponseInfo;       /* 1Ch */
193 } MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,
194   SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;
195
196
197 #endif
198
199
200