1101704Smjacob/* $FreeBSD$ */
2139749Simp/*-
3147883Sscottl * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
4147883Sscottl * All rights reserved.
5147883Sscottl *
6102599Smjacob * Redistribution and use in source and binary forms, with or without
7147883Sscottl * modification, are permitted provided that the following conditions are
8147883Sscottl * met:
9102599Smjacob * 1. Redistributions of source code must retain the above copyright
10147883Sscottl *    notice, this list of conditions and the following disclaimer.
11147883Sscottl * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12147883Sscottl *    substantially similar to the "NO WARRANTY" disclaimer below
13147883Sscottl *    ("Disclaimer") and any redistribution must be conditioned upon including
14147883Sscottl *    a substantially similar Disclaimer requirement for further binary
15147883Sscottl *    redistribution.
16147883Sscottl * 3. Neither the name of the LSI Logic Corporation nor the names of its
17147883Sscottl *    contributors may be used to endorse or promote products derived from
18147883Sscottl *    this software without specific prior written permission.
19147883Sscottl *
20147883Sscottl * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21147883Sscottl * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22102599Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23147883Sscottl * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24147883Sscottl * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25147883Sscottl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26147883Sscottl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27147883Sscottl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28147883Sscottl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29147883Sscottl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
30147883Sscottl * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31170251Sscottl *
32154603Smjacob *           Name:  mpi_raid.h
33101704Smjacob *          Title:  MPI RAID message and structures
34101704Smjacob *  Creation Date:  February 27, 2001
35101704Smjacob *
36233425Smarius *    mpi_raid.h Version:  01.05.05
37101704Smjacob *
38101704Smjacob *  Version History
39101704Smjacob *  ---------------
40101704Smjacob *
41101704Smjacob *  Date      Version   Description
42101704Smjacob *  --------  --------  ------------------------------------------------------
43101704Smjacob *  02-27-01  01.01.01  Original release for this file.
44101704Smjacob *  03-27-01  01.01.02  Added structure offset comments.
45101704Smjacob *  08-08-01  01.02.01  Original release for v1.2 work.
46101704Smjacob *  09-28-01  01.02.02  Major rework for MPI v1.2 Integrated RAID changes.
47101704Smjacob *  10-04-01  01.02.03  Added ActionData defines for
48101704Smjacob *                      MPI_RAID_ACTION_DELETE_VOLUME action.
49101704Smjacob *  11-01-01  01.02.04  Added define for MPI_RAID_ACTION_ADATA_DO_NOT_SYNC.
50115778Smjacob *  03-14-02  01.02.05  Added define for MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT.
51115778Smjacob *  05-07-02  01.02.06  Added define for MPI_RAID_ACTION_ACTIVATE_VOLUME,
52115778Smjacob *                      MPI_RAID_ACTION_INACTIVATE_VOLUME, and
53115778Smjacob *                      MPI_RAID_ACTION_ADATA_INACTIVATE_ALL.
54115778Smjacob *  07-12-02  01.02.07  Added structures for Mailbox request and reply.
55115778Smjacob *  11-15-02  01.02.08  Added missing MsgContext field to MSG_MAILBOX_REQUEST.
56115778Smjacob *  04-01-03  01.02.09  New action data option flag for
57115778Smjacob *                      MPI_RAID_ACTION_DELETE_VOLUME.
58154603Smjacob *  05-11-04  01.03.01  Original release for MPI v1.3.
59154603Smjacob *  08-19-04  01.05.01  Original release for MPI v1.5.
60154603Smjacob *  01-15-05  01.05.02  Added defines for the two new RAID Actions for
61154603Smjacob *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
62170251Sscottl *  02-28-07  01.05.03  Added new RAID Action, Device FW Update Mode, and
63170251Sscottl *                      associated defines.
64233425Smarius *  08-07-07  01.05.04  Added Disable Full Rebuild bit to the ActionDataWord
65233425Smarius *                      for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
66233425Smarius *  01-15-08  01.05.05  Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
67101704Smjacob *  --------------------------------------------------------------------------
68101704Smjacob */
69101704Smjacob
70101704Smjacob#ifndef MPI_RAID_H
71101704Smjacob#define MPI_RAID_H
72101704Smjacob
73101704Smjacob
74101704Smjacob/******************************************************************************
75101704Smjacob*
76101704Smjacob*        R A I D    M e s s a g e s
77101704Smjacob*
78101704Smjacob*******************************************************************************/
79101704Smjacob
80101704Smjacob
81101704Smjacob/****************************************************************************/
82154603Smjacob/* RAID Action Request                                                      */
83101704Smjacob/****************************************************************************/
84101704Smjacob
85101704Smjacobtypedef struct _MSG_RAID_ACTION
86101704Smjacob{
87101704Smjacob    U8                      Action;             /* 00h */
88101704Smjacob    U8                      Reserved1;          /* 01h */
89101704Smjacob    U8                      ChainOffset;        /* 02h */
90101704Smjacob    U8                      Function;           /* 03h */
91101704Smjacob    U8                      VolumeID;           /* 04h */
92101704Smjacob    U8                      VolumeBus;          /* 05h */
93101704Smjacob    U8                      PhysDiskNum;        /* 06h */
94101704Smjacob    U8                      MsgFlags;           /* 07h */
95101704Smjacob    U32                     MsgContext;         /* 08h */
96101704Smjacob    U32                     Reserved2;          /* 0Ch */
97101704Smjacob    U32                     ActionDataWord;     /* 10h */
98101704Smjacob    SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */
99101704Smjacob} MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,
100101704Smjacob  MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;
101101704Smjacob
102101704Smjacob
103101704Smjacob/* RAID Action request Action values */
104101704Smjacob
105101704Smjacob#define MPI_RAID_ACTION_STATUS                      (0x00)
106101704Smjacob#define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)
107101704Smjacob#define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)
108101704Smjacob#define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)
109101704Smjacob#define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)
110101704Smjacob#define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)
111101704Smjacob#define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)
112101704Smjacob#define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)
113101704Smjacob#define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)
114101704Smjacob#define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)
115101704Smjacob#define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)
116101704Smjacob#define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)
117101704Smjacob#define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)
118101704Smjacob#define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)
119101704Smjacob#define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)
120101704Smjacob#define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)
121115778Smjacob#define MPI_RAID_ACTION_ACTIVATE_VOLUME             (0x11)
122115778Smjacob#define MPI_RAID_ACTION_INACTIVATE_VOLUME           (0x12)
123147883Sscottl#define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
124147883Sscottl#define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
125170251Sscottl#define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)
126233425Smarius#define MPI_RAID_ACTION_SET_VOLUME_NAME             (0x16)
127101704Smjacob
128101704Smjacob/* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
129101704Smjacob#define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
130115778Smjacob#define MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT        (0x00000002)
131101704Smjacob
132101704Smjacob/* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */
133101704Smjacob#define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)
134101704Smjacob#define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)
135101704Smjacob
136115778Smjacob#define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
137115778Smjacob#define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
138101704Smjacob
139233425Smarius/* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
140233425Smarius#define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD  (0x00000001)
141233425Smarius
142115778Smjacob/* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
143115778Smjacob#define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
144115778Smjacob
145154603Smjacob/* ActionDataWord defines for use with MPI_RAID_ACTION_SET_RESYNC_RATE action */
146154603Smjacob#define MPI_RAID_ACTION_ADATA_RESYNC_RATE_MASK      (0x000000FF)
147115778Smjacob
148154603Smjacob/* ActionDataWord defines for use with MPI_RAID_ACTION_SET_DATA_SCRUB_RATE action */
149154603Smjacob#define MPI_RAID_ACTION_ADATA_DATA_SCRUB_RATE_MASK  (0x000000FF)
150154603Smjacob
151170251Sscottl/* ActionDataWord defines for use with MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */
152170251Sscottl#define MPI_RAID_ACTION_ADATA_ENABLE_FW_UPDATE          (0x00000001)
153170251Sscottl#define MPI_RAID_ACTION_ADATA_MASK_FW_UPDATE_TIMEOUT    (0x0000FF00)
154170251Sscottl#define MPI_RAID_ACTION_ADATA_SHIFT_FW_UPDATE_TIMEOUT   (8)
155154603Smjacob
156154603Smjacob
157101704Smjacob/* RAID Action reply message */
158101704Smjacob
159101704Smjacobtypedef struct _MSG_RAID_ACTION_REPLY
160101704Smjacob{
161101704Smjacob    U8                      Action;             /* 00h */
162101704Smjacob    U8                      Reserved;           /* 01h */
163101704Smjacob    U8                      MsgLength;          /* 02h */
164101704Smjacob    U8                      Function;           /* 03h */
165101704Smjacob    U8                      VolumeID;           /* 04h */
166101704Smjacob    U8                      VolumeBus;          /* 05h */
167101704Smjacob    U8                      PhysDiskNum;        /* 06h */
168101704Smjacob    U8                      MsgFlags;           /* 07h */
169101704Smjacob    U32                     MsgContext;         /* 08h */
170101704Smjacob    U16                     ActionStatus;       /* 0Ch */
171101704Smjacob    U16                     IOCStatus;          /* 0Eh */
172101704Smjacob    U32                     IOCLogInfo;         /* 10h */
173101704Smjacob    U32                     VolumeStatus;       /* 14h */
174101704Smjacob    U32                     ActionData;         /* 18h */
175101704Smjacob} MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,
176101704Smjacob  MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;
177101704Smjacob
178101704Smjacob
179101704Smjacob/* RAID Volume reply ActionStatus values */
180101704Smjacob
181101704Smjacob#define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)
182101704Smjacob#define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)
183101704Smjacob#define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)
184101704Smjacob#define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)
185101704Smjacob
186101704Smjacob
187101704Smjacob/* RAID Volume reply RAID Volume Indicator structure */
188101704Smjacob
189101704Smjacobtypedef struct _MPI_RAID_VOL_INDICATOR
190101704Smjacob{
191101704Smjacob    U64                     TotalBlocks;        /* 00h */
192101704Smjacob    U64                     BlocksRemaining;    /* 08h */
193101704Smjacob} MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,
194101704Smjacob  MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;
195101704Smjacob
196101704Smjacob
197101704Smjacob/****************************************************************************/
198101704Smjacob/* SCSI IO RAID Passthrough Request                                         */
199101704Smjacob/****************************************************************************/
200101704Smjacob
201101704Smjacobtypedef struct _MSG_SCSI_IO_RAID_PT_REQUEST
202101704Smjacob{
203101704Smjacob    U8                      PhysDiskNum;        /* 00h */
204101704Smjacob    U8                      Reserved1;          /* 01h */
205101704Smjacob    U8                      ChainOffset;        /* 02h */
206101704Smjacob    U8                      Function;           /* 03h */
207101704Smjacob    U8                      CDBLength;          /* 04h */
208101704Smjacob    U8                      SenseBufferLength;  /* 05h */
209101704Smjacob    U8                      Reserved2;          /* 06h */
210101704Smjacob    U8                      MsgFlags;           /* 07h */
211101704Smjacob    U32                     MsgContext;         /* 08h */
212101704Smjacob    U8                      LUN[8];             /* 0Ch */
213101704Smjacob    U32                     Control;            /* 14h */
214101704Smjacob    U8                      CDB[16];            /* 18h */
215101704Smjacob    U32                     DataLength;         /* 28h */
216101704Smjacob    U32                     SenseBufferLowAddr; /* 2Ch */
217101704Smjacob    SGE_IO_UNION            SGL;                /* 30h */
218101704Smjacob} MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,
219101704Smjacob  SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;
220101704Smjacob
221101704Smjacob
222101704Smjacob/* SCSI IO RAID Passthrough reply structure */
223101704Smjacob
224101704Smjacobtypedef struct _MSG_SCSI_IO_RAID_PT_REPLY
225101704Smjacob{
226101704Smjacob    U8                      PhysDiskNum;        /* 00h */
227101704Smjacob    U8                      Reserved1;          /* 01h */
228101704Smjacob    U8                      MsgLength;          /* 02h */
229101704Smjacob    U8                      Function;           /* 03h */
230101704Smjacob    U8                      CDBLength;          /* 04h */
231101704Smjacob    U8                      SenseBufferLength;  /* 05h */
232101704Smjacob    U8                      Reserved2;          /* 06h */
233101704Smjacob    U8                      MsgFlags;           /* 07h */
234101704Smjacob    U32                     MsgContext;         /* 08h */
235101704Smjacob    U8                      SCSIStatus;         /* 0Ch */
236101704Smjacob    U8                      SCSIState;          /* 0Dh */
237101704Smjacob    U16                     IOCStatus;          /* 0Eh */
238101704Smjacob    U32                     IOCLogInfo;         /* 10h */
239101704Smjacob    U32                     TransferCount;      /* 14h */
240101704Smjacob    U32                     SenseCount;         /* 18h */
241101704Smjacob    U32                     ResponseInfo;       /* 1Ch */
242101704Smjacob} MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,
243101704Smjacob  SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;
244101704Smjacob
245101704Smjacob
246115778Smjacob/****************************************************************************/
247115778Smjacob/* Mailbox reqeust structure */
248115778Smjacob/****************************************************************************/
249115778Smjacob
250115778Smjacobtypedef struct _MSG_MAILBOX_REQUEST
251115778Smjacob{
252115778Smjacob    U16                     Reserved1;
253115778Smjacob    U8                      ChainOffset;
254115778Smjacob    U8                      Function;
255115778Smjacob    U16                     Reserved2;
256115778Smjacob    U8                      Reserved3;
257115778Smjacob    U8                      MsgFlags;
258115778Smjacob    U32                     MsgContext;
259115778Smjacob    U8                      Command[10];
260115778Smjacob    U16                     Reserved4;
261115778Smjacob    SGE_IO_UNION            SGL;
262115778Smjacob} MSG_MAILBOX_REQUEST, MPI_POINTER PTR_MSG_MAILBOX_REQUEST,
263115778Smjacob  MailboxRequest_t, MPI_POINTER pMailboxRequest_t;
264115778Smjacob
265115778Smjacob
266115778Smjacob/* Mailbox reply structure */
267115778Smjacobtypedef struct _MSG_MAILBOX_REPLY
268115778Smjacob{
269115778Smjacob    U16                     Reserved1;          /* 00h */
270115778Smjacob    U8                      MsgLength;          /* 02h */
271115778Smjacob    U8                      Function;           /* 03h */
272115778Smjacob    U16                     Reserved2;          /* 04h */
273115778Smjacob    U8                      Reserved3;          /* 06h */
274115778Smjacob    U8                      MsgFlags;           /* 07h */
275115778Smjacob    U32                     MsgContext;         /* 08h */
276115778Smjacob    U16                     MailboxStatus;      /* 0Ch */
277115778Smjacob    U16                     IOCStatus;          /* 0Eh */
278115778Smjacob    U32                     IOCLogInfo;         /* 10h */
279115778Smjacob    U32                     Reserved4;          /* 14h */
280115778Smjacob} MSG_MAILBOX_REPLY, MPI_POINTER PTR_MSG_MAILBOX_REPLY,
281115778Smjacob  MailboxReply_t, MPI_POINTER pMailboxReply_t;
282115778Smjacob
283101704Smjacob#endif
284101704Smjacob
285101704Smjacob
286101704Smjacob
287