xref: /freebsd/sys/dev/mpt/mpilib/mpi_raid.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1098ca2bdSWarner Losh /*-
2*7282444bSPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*7282444bSPedro F. Giffuni  *
4b0a2fdeeSScott Long  * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
5b0a2fdeeSScott Long  * All rights reserved.
6d3ecac66SMatt Jacob  *
7d3ecac66SMatt Jacob  * Redistribution and use in source and binary forms, with or without
8b0a2fdeeSScott Long  * modification, are permitted provided that the following conditions are
9b0a2fdeeSScott Long  * met:
10d3ecac66SMatt Jacob  * 1. Redistributions of source code must retain the above copyright
11b0a2fdeeSScott Long  *    notice, this list of conditions and the following disclaimer.
12b0a2fdeeSScott Long  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
13b0a2fdeeSScott Long  *    substantially similar to the "NO WARRANTY" disclaimer below
14b0a2fdeeSScott Long  *    ("Disclaimer") and any redistribution must be conditioned upon including
15b0a2fdeeSScott Long  *    a substantially similar Disclaimer requirement for further binary
16b0a2fdeeSScott Long  *    redistribution.
17b0a2fdeeSScott Long  * 3. Neither the name of the LSI Logic Corporation nor the names of its
18b0a2fdeeSScott Long  *    contributors may be used to endorse or promote products derived from
19b0a2fdeeSScott Long  *    this software without specific prior written permission.
20d3ecac66SMatt Jacob  *
21b0a2fdeeSScott Long  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22b0a2fdeeSScott Long  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23d3ecac66SMatt Jacob  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24b0a2fdeeSScott Long  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25b0a2fdeeSScott Long  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26b0a2fdeeSScott Long  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27b0a2fdeeSScott Long  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28b0a2fdeeSScott Long  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29b0a2fdeeSScott Long  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30b0a2fdeeSScott Long  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
31b0a2fdeeSScott Long  * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
329b631363SMatt Jacob  *
339de3c85cSMatt Jacob  *           Name:  mpi_raid.h
349b631363SMatt Jacob  *          Title:  MPI RAID message and structures
359b631363SMatt Jacob  *  Creation Date:  February 27, 2001
369b631363SMatt Jacob  *
3712af29abSMarius Strobl  *    mpi_raid.h Version:  01.05.05
389b631363SMatt Jacob  *
399b631363SMatt Jacob  *  Version History
409b631363SMatt Jacob  *  ---------------
419b631363SMatt Jacob  *
429b631363SMatt Jacob  *  Date      Version   Description
439b631363SMatt Jacob  *  --------  --------  ------------------------------------------------------
449b631363SMatt Jacob  *  02-27-01  01.01.01  Original release for this file.
459b631363SMatt Jacob  *  03-27-01  01.01.02  Added structure offset comments.
469b631363SMatt Jacob  *  08-08-01  01.02.01  Original release for v1.2 work.
479b631363SMatt Jacob  *  09-28-01  01.02.02  Major rework for MPI v1.2 Integrated RAID changes.
489b631363SMatt Jacob  *  10-04-01  01.02.03  Added ActionData defines for
499b631363SMatt Jacob  *                      MPI_RAID_ACTION_DELETE_VOLUME action.
509b631363SMatt Jacob  *  11-01-01  01.02.04  Added define for MPI_RAID_ACTION_ADATA_DO_NOT_SYNC.
517fed69eeSMatt Jacob  *  03-14-02  01.02.05  Added define for MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT.
527fed69eeSMatt Jacob  *  05-07-02  01.02.06  Added define for MPI_RAID_ACTION_ACTIVATE_VOLUME,
537fed69eeSMatt Jacob  *                      MPI_RAID_ACTION_INACTIVATE_VOLUME, and
547fed69eeSMatt Jacob  *                      MPI_RAID_ACTION_ADATA_INACTIVATE_ALL.
557fed69eeSMatt Jacob  *  07-12-02  01.02.07  Added structures for Mailbox request and reply.
567fed69eeSMatt Jacob  *  11-15-02  01.02.08  Added missing MsgContext field to MSG_MAILBOX_REQUEST.
577fed69eeSMatt Jacob  *  04-01-03  01.02.09  New action data option flag for
587fed69eeSMatt Jacob  *                      MPI_RAID_ACTION_DELETE_VOLUME.
599de3c85cSMatt Jacob  *  05-11-04  01.03.01  Original release for MPI v1.3.
609de3c85cSMatt Jacob  *  08-19-04  01.05.01  Original release for MPI v1.5.
619de3c85cSMatt Jacob  *  01-15-05  01.05.02  Added defines for the two new RAID Actions for
629de3c85cSMatt Jacob  *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
6362ae194dSScott Long  *  02-28-07  01.05.03  Added new RAID Action, Device FW Update Mode, and
6462ae194dSScott Long  *                      associated defines.
6512af29abSMarius Strobl  *  08-07-07  01.05.04  Added Disable Full Rebuild bit to the ActionDataWord
6612af29abSMarius Strobl  *                      for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
6712af29abSMarius Strobl  *  01-15-08  01.05.05  Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
689b631363SMatt Jacob  *  --------------------------------------------------------------------------
699b631363SMatt Jacob  */
709b631363SMatt Jacob 
719b631363SMatt Jacob #ifndef MPI_RAID_H
729b631363SMatt Jacob #define MPI_RAID_H
739b631363SMatt Jacob 
749b631363SMatt Jacob /******************************************************************************
759b631363SMatt Jacob *
769b631363SMatt Jacob *        R A I D    M e s s a g e s
779b631363SMatt Jacob *
789b631363SMatt Jacob *******************************************************************************/
799b631363SMatt Jacob 
809b631363SMatt Jacob /****************************************************************************/
819de3c85cSMatt Jacob /* RAID Action Request                                                      */
829b631363SMatt Jacob /****************************************************************************/
839b631363SMatt Jacob 
849b631363SMatt Jacob typedef struct _MSG_RAID_ACTION
859b631363SMatt Jacob {
869b631363SMatt Jacob     U8                      Action;             /* 00h */
879b631363SMatt Jacob     U8                      Reserved1;          /* 01h */
889b631363SMatt Jacob     U8                      ChainOffset;        /* 02h */
899b631363SMatt Jacob     U8                      Function;           /* 03h */
909b631363SMatt Jacob     U8                      VolumeID;           /* 04h */
919b631363SMatt Jacob     U8                      VolumeBus;          /* 05h */
929b631363SMatt Jacob     U8                      PhysDiskNum;        /* 06h */
939b631363SMatt Jacob     U8                      MsgFlags;           /* 07h */
949b631363SMatt Jacob     U32                     MsgContext;         /* 08h */
959b631363SMatt Jacob     U32                     Reserved2;          /* 0Ch */
969b631363SMatt Jacob     U32                     ActionDataWord;     /* 10h */
979b631363SMatt Jacob     SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */
989b631363SMatt Jacob } MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,
999b631363SMatt Jacob   MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;
1009b631363SMatt Jacob 
1019b631363SMatt Jacob /* RAID Action request Action values */
1029b631363SMatt Jacob 
1039b631363SMatt Jacob #define MPI_RAID_ACTION_STATUS                      (0x00)
1049b631363SMatt Jacob #define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)
1059b631363SMatt Jacob #define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)
1069b631363SMatt Jacob #define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)
1079b631363SMatt Jacob #define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)
1089b631363SMatt Jacob #define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)
1099b631363SMatt Jacob #define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)
1109b631363SMatt Jacob #define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)
1119b631363SMatt Jacob #define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)
1129b631363SMatt Jacob #define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)
1139b631363SMatt Jacob #define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)
1149b631363SMatt Jacob #define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)
1159b631363SMatt Jacob #define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)
1169b631363SMatt Jacob #define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)
1179b631363SMatt Jacob #define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)
1189b631363SMatt Jacob #define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)
1197fed69eeSMatt Jacob #define MPI_RAID_ACTION_ACTIVATE_VOLUME             (0x11)
1207fed69eeSMatt Jacob #define MPI_RAID_ACTION_INACTIVATE_VOLUME           (0x12)
121b0a2fdeeSScott Long #define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
122b0a2fdeeSScott Long #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
12362ae194dSScott Long #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)
12412af29abSMarius Strobl #define MPI_RAID_ACTION_SET_VOLUME_NAME             (0x16)
1259b631363SMatt Jacob 
1269b631363SMatt Jacob /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
1279b631363SMatt Jacob #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
1287fed69eeSMatt Jacob #define MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT        (0x00000002)
1299b631363SMatt Jacob 
1309b631363SMatt Jacob /* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */
1319b631363SMatt Jacob #define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)
1329b631363SMatt Jacob #define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)
1339b631363SMatt Jacob 
1347fed69eeSMatt Jacob #define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
1357fed69eeSMatt Jacob #define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
1367fed69eeSMatt Jacob 
13712af29abSMarius Strobl /* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
13812af29abSMarius Strobl #define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD  (0x00000001)
13912af29abSMarius Strobl 
1407fed69eeSMatt Jacob /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
1417fed69eeSMatt Jacob #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
1427fed69eeSMatt Jacob 
1439de3c85cSMatt Jacob /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_RESYNC_RATE action */
1449de3c85cSMatt Jacob #define MPI_RAID_ACTION_ADATA_RESYNC_RATE_MASK      (0x000000FF)
1459de3c85cSMatt Jacob 
1469de3c85cSMatt Jacob /* ActionDataWord defines for use with MPI_RAID_ACTION_SET_DATA_SCRUB_RATE action */
1479de3c85cSMatt Jacob #define MPI_RAID_ACTION_ADATA_DATA_SCRUB_RATE_MASK  (0x000000FF)
1489de3c85cSMatt Jacob 
14962ae194dSScott Long /* ActionDataWord defines for use with MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */
15062ae194dSScott Long #define MPI_RAID_ACTION_ADATA_ENABLE_FW_UPDATE          (0x00000001)
15162ae194dSScott Long #define MPI_RAID_ACTION_ADATA_MASK_FW_UPDATE_TIMEOUT    (0x0000FF00)
15262ae194dSScott Long #define MPI_RAID_ACTION_ADATA_SHIFT_FW_UPDATE_TIMEOUT   (8)
1539de3c85cSMatt Jacob 
1549b631363SMatt Jacob /* RAID Action reply message */
1559b631363SMatt Jacob 
1569b631363SMatt Jacob typedef struct _MSG_RAID_ACTION_REPLY
1579b631363SMatt Jacob {
1589b631363SMatt Jacob     U8                      Action;             /* 00h */
1599b631363SMatt Jacob     U8                      Reserved;           /* 01h */
1609b631363SMatt Jacob     U8                      MsgLength;          /* 02h */
1619b631363SMatt Jacob     U8                      Function;           /* 03h */
1629b631363SMatt Jacob     U8                      VolumeID;           /* 04h */
1639b631363SMatt Jacob     U8                      VolumeBus;          /* 05h */
1649b631363SMatt Jacob     U8                      PhysDiskNum;        /* 06h */
1659b631363SMatt Jacob     U8                      MsgFlags;           /* 07h */
1669b631363SMatt Jacob     U32                     MsgContext;         /* 08h */
1679b631363SMatt Jacob     U16                     ActionStatus;       /* 0Ch */
1689b631363SMatt Jacob     U16                     IOCStatus;          /* 0Eh */
1699b631363SMatt Jacob     U32                     IOCLogInfo;         /* 10h */
1709b631363SMatt Jacob     U32                     VolumeStatus;       /* 14h */
1719b631363SMatt Jacob     U32                     ActionData;         /* 18h */
1729b631363SMatt Jacob } MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,
1739b631363SMatt Jacob   MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;
1749b631363SMatt Jacob 
1759b631363SMatt Jacob /* RAID Volume reply ActionStatus values */
1769b631363SMatt Jacob 
1779b631363SMatt Jacob #define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)
1789b631363SMatt Jacob #define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)
1799b631363SMatt Jacob #define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)
1809b631363SMatt Jacob #define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)
1819b631363SMatt Jacob 
1829b631363SMatt Jacob /* RAID Volume reply RAID Volume Indicator structure */
1839b631363SMatt Jacob 
1849b631363SMatt Jacob typedef struct _MPI_RAID_VOL_INDICATOR
1859b631363SMatt Jacob {
1869b631363SMatt Jacob     U64                     TotalBlocks;        /* 00h */
1879b631363SMatt Jacob     U64                     BlocksRemaining;    /* 08h */
1889b631363SMatt Jacob } MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,
1899b631363SMatt Jacob   MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;
1909b631363SMatt Jacob 
1919b631363SMatt Jacob /****************************************************************************/
1929b631363SMatt Jacob /* SCSI IO RAID Passthrough Request                                         */
1939b631363SMatt Jacob /****************************************************************************/
1949b631363SMatt Jacob 
1959b631363SMatt Jacob typedef struct _MSG_SCSI_IO_RAID_PT_REQUEST
1969b631363SMatt Jacob {
1979b631363SMatt Jacob     U8                      PhysDiskNum;        /* 00h */
1989b631363SMatt Jacob     U8                      Reserved1;          /* 01h */
1999b631363SMatt Jacob     U8                      ChainOffset;        /* 02h */
2009b631363SMatt Jacob     U8                      Function;           /* 03h */
2019b631363SMatt Jacob     U8                      CDBLength;          /* 04h */
2029b631363SMatt Jacob     U8                      SenseBufferLength;  /* 05h */
2039b631363SMatt Jacob     U8                      Reserved2;          /* 06h */
2049b631363SMatt Jacob     U8                      MsgFlags;           /* 07h */
2059b631363SMatt Jacob     U32                     MsgContext;         /* 08h */
2069b631363SMatt Jacob     U8                      LUN[8];             /* 0Ch */
2079b631363SMatt Jacob     U32                     Control;            /* 14h */
2089b631363SMatt Jacob     U8                      CDB[16];            /* 18h */
2099b631363SMatt Jacob     U32                     DataLength;         /* 28h */
2109b631363SMatt Jacob     U32                     SenseBufferLowAddr; /* 2Ch */
2119b631363SMatt Jacob     SGE_IO_UNION            SGL;                /* 30h */
2129b631363SMatt Jacob } MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,
2139b631363SMatt Jacob   SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;
2149b631363SMatt Jacob 
2159b631363SMatt Jacob /* SCSI IO RAID Passthrough reply structure */
2169b631363SMatt Jacob 
2179b631363SMatt Jacob typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
2189b631363SMatt Jacob {
2199b631363SMatt Jacob     U8                      PhysDiskNum;        /* 00h */
2209b631363SMatt Jacob     U8                      Reserved1;          /* 01h */
2219b631363SMatt Jacob     U8                      MsgLength;          /* 02h */
2229b631363SMatt Jacob     U8                      Function;           /* 03h */
2239b631363SMatt Jacob     U8                      CDBLength;          /* 04h */
2249b631363SMatt Jacob     U8                      SenseBufferLength;  /* 05h */
2259b631363SMatt Jacob     U8                      Reserved2;          /* 06h */
2269b631363SMatt Jacob     U8                      MsgFlags;           /* 07h */
2279b631363SMatt Jacob     U32                     MsgContext;         /* 08h */
2289b631363SMatt Jacob     U8                      SCSIStatus;         /* 0Ch */
2299b631363SMatt Jacob     U8                      SCSIState;          /* 0Dh */
2309b631363SMatt Jacob     U16                     IOCStatus;          /* 0Eh */
2319b631363SMatt Jacob     U32                     IOCLogInfo;         /* 10h */
2329b631363SMatt Jacob     U32                     TransferCount;      /* 14h */
2339b631363SMatt Jacob     U32                     SenseCount;         /* 18h */
2349b631363SMatt Jacob     U32                     ResponseInfo;       /* 1Ch */
2359b631363SMatt Jacob } MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,
2369b631363SMatt Jacob   SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;
2379b631363SMatt Jacob 
2387fed69eeSMatt Jacob /****************************************************************************/
2397fed69eeSMatt Jacob /* Mailbox reqeust structure */
2407fed69eeSMatt Jacob /****************************************************************************/
2417fed69eeSMatt Jacob 
2427fed69eeSMatt Jacob typedef struct _MSG_MAILBOX_REQUEST
2437fed69eeSMatt Jacob {
2447fed69eeSMatt Jacob     U16                     Reserved1;
2457fed69eeSMatt Jacob     U8                      ChainOffset;
2467fed69eeSMatt Jacob     U8                      Function;
2477fed69eeSMatt Jacob     U16                     Reserved2;
2487fed69eeSMatt Jacob     U8                      Reserved3;
2497fed69eeSMatt Jacob     U8                      MsgFlags;
2507fed69eeSMatt Jacob     U32                     MsgContext;
2517fed69eeSMatt Jacob     U8                      Command[10];
2527fed69eeSMatt Jacob     U16                     Reserved4;
2537fed69eeSMatt Jacob     SGE_IO_UNION            SGL;
2547fed69eeSMatt Jacob } MSG_MAILBOX_REQUEST, MPI_POINTER PTR_MSG_MAILBOX_REQUEST,
2557fed69eeSMatt Jacob   MailboxRequest_t, MPI_POINTER pMailboxRequest_t;
2567fed69eeSMatt Jacob 
2577fed69eeSMatt Jacob /* Mailbox reply structure */
2587fed69eeSMatt Jacob typedef struct _MSG_MAILBOX_REPLY
2597fed69eeSMatt Jacob {
2607fed69eeSMatt Jacob     U16                     Reserved1;          /* 00h */
2617fed69eeSMatt Jacob     U8                      MsgLength;          /* 02h */
2627fed69eeSMatt Jacob     U8                      Function;           /* 03h */
2637fed69eeSMatt Jacob     U16                     Reserved2;          /* 04h */
2647fed69eeSMatt Jacob     U8                      Reserved3;          /* 06h */
2657fed69eeSMatt Jacob     U8                      MsgFlags;           /* 07h */
2667fed69eeSMatt Jacob     U32                     MsgContext;         /* 08h */
2677fed69eeSMatt Jacob     U16                     MailboxStatus;      /* 0Ch */
2687fed69eeSMatt Jacob     U16                     IOCStatus;          /* 0Eh */
2697fed69eeSMatt Jacob     U32                     IOCLogInfo;         /* 10h */
2707fed69eeSMatt Jacob     U32                     Reserved4;          /* 14h */
2717fed69eeSMatt Jacob } MSG_MAILBOX_REPLY, MPI_POINTER PTR_MSG_MAILBOX_REPLY,
2727fed69eeSMatt Jacob   MailboxReply_t, MPI_POINTER pMailboxReply_t;
2737fed69eeSMatt Jacob 
2749b631363SMatt Jacob #endif
275