1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2000 to 2009, LSI Corporation.
  24  * All rights reserved.
  25  *
  26  * Redistribution and use in source and binary forms of all code within
  27  * this file that is exclusively owned by LSI, with or without
  28  * modification, is permitted provided that, in addition to the CDDL 1.0
  29  * License requirements, the following conditions are met:
  30  *
  31  *    Neither the name of the author nor the names of its contributors may be
  32  *    used to endorse or promote products derived from this software without
  33  *    specific prior written permission.
  34  *
  35  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  36  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  37  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  38  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  39  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  40  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  41  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  42  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  43  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  46  * DAMAGE.
  47  */
  48 
  49 /*
  50  *           Name:  mpi2_raid.h
  51  *          Title:  MPI Integrated RAID messages and structures
  52  *  Creation Date:  April 26, 2007
  53  *
  54  *    mpi2_raid.h Version:  02.00.04
  55  *
  56  *  Version History
  57  *  ---------------
  58  *
  59  *  Date      Version   Description
  60  *  --------  --------  ------------------------------------------------------
  61  *  04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
  62  *  08-31-07  02.00.01  Modifications to RAID Action request and reply,
  63  *                      including the Actions and ActionData.
  64  *  02-29-08  02.00.02  Added MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD.
  65  *  05-21-08  02.00.03  Added MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS so that
  66  *                      the PhysDisk array in MPI2_RAID_VOLUME_CREATION_STRUCT
  67  *                      can be sized by the build environment.
  68  *  07-30-09  02.00.04  Added proper define for the Use Default Settings bit of
  69  *                      VolumeCreationFlags and marked the old one as obsolete.
  70  *  --------------------------------------------------------------------------
  71  */
  72 
  73 #ifndef MPI2_RAID_H
  74 #define MPI2_RAID_H
  75 
  76 /*****************************************************************************
  77 *
  78 *               Integrated RAID Messages
  79 *
  80 *****************************************************************************/
  81 
  82 /****************************************************************************
  83 *  RAID Action messages
  84 ****************************************************************************/
  85 
  86 /* ActionDataWord defines for use with MPI2_RAID_ACTION_DELETE_VOLUME action */
  87 #define MPI2_RAID_ACTION_ADATA_KEEP_LBA0            (0x00000000)
  88 #define MPI2_RAID_ACTION_ADATA_ZERO_LBA0            (0x00000001)
  89 
  90 /* use MPI2_RAIDVOL0_SETTING_ defines from mpi2_cnfg.h for MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE action */
  91 
  92 /* ActionDataWord defines for use with MPI2_RAID_ACTION_DISABLE_ALL_VOLUMES action */
  93 #define MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD  (0x00000001)
  94 
  95 /* ActionDataWord for MPI2_RAID_ACTION_SET_RAID_FUNCTION_RATE Action */
  96 typedef struct _MPI2_RAID_ACTION_RATE_DATA
  97 {
  98     U8              RateToChange;               /* 0x00 */
  99     U8              RateOrMode;                 /* 0x01 */
 100     U16             DataScrubDuration;          /* 0x02 */
 101 } MPI2_RAID_ACTION_RATE_DATA, MPI2_POINTER PTR_MPI2_RAID_ACTION_RATE_DATA,
 102   Mpi2RaidActionRateData_t, MPI2_POINTER pMpi2RaidActionRateData_t;
 103 
 104 #define MPI2_RAID_ACTION_SET_RATE_RESYNC            (0x00)
 105 #define MPI2_RAID_ACTION_SET_RATE_DATA_SCRUB        (0x01)
 106 #define MPI2_RAID_ACTION_SET_RATE_POWERSAVE_MODE    (0x02)
 107 
 108 /* ActionDataWord for MPI2_RAID_ACTION_START_RAID_FUNCTION Action */
 109 typedef struct _MPI2_RAID_ACTION_START_RAID_FUNCTION
 110 {
 111     U8              RAIDFunction;                       /* 0x00 */
 112     U8              Flags;                              /* 0x01 */
 113     U16             Reserved1;                          /* 0x02 */
 114 } MPI2_RAID_ACTION_START_RAID_FUNCTION,
 115   MPI2_POINTER PTR_MPI2_RAID_ACTION_START_RAID_FUNCTION,
 116   Mpi2RaidActionStartRaidFunction_t,
 117   MPI2_POINTER pMpi2RaidActionStartRaidFunction_t;
 118 
 119 /* defines for the RAIDFunction field */
 120 #define MPI2_RAID_ACTION_START_BACKGROUND_INIT      (0x00)
 121 #define MPI2_RAID_ACTION_START_ONLINE_CAP_EXPANSION (0x01)
 122 #define MPI2_RAID_ACTION_START_CONSISTENCY_CHECK    (0x02)
 123 
 124 /* defines for the Flags field */
 125 #define MPI2_RAID_ACTION_START_NEW                  (0x00)
 126 #define MPI2_RAID_ACTION_START_RESUME               (0x01)
 127 
 128 /* ActionDataWord for MPI2_RAID_ACTION_STOP_RAID_FUNCTION Action */
 129 typedef struct _MPI2_RAID_ACTION_STOP_RAID_FUNCTION
 130 {
 131     U8              RAIDFunction;                       /* 0x00 */
 132     U8              Flags;                              /* 0x01 */
 133     U16             Reserved1;                          /* 0x02 */
 134 } MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
 135   MPI2_POINTER PTR_MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
 136   Mpi2RaidActionStopRaidFunction_t,
 137   MPI2_POINTER pMpi2RaidActionStopRaidFunction_t;
 138 
 139 /* defines for the RAIDFunction field */
 140 #define MPI2_RAID_ACTION_STOP_BACKGROUND_INIT       (0x00)
 141 #define MPI2_RAID_ACTION_STOP_ONLINE_CAP_EXPANSION  (0x01)
 142 #define MPI2_RAID_ACTION_STOP_CONSISTENCY_CHECK     (0x02)
 143 
 144 /* defines for the Flags field */
 145 #define MPI2_RAID_ACTION_STOP_ABORT                 (0x00)
 146 #define MPI2_RAID_ACTION_STOP_PAUSE                 (0x01)
 147 
 148 /* ActionDataWord for MPI2_RAID_ACTION_CREATE_HOT_SPARE Action */
 149 typedef struct _MPI2_RAID_ACTION_HOT_SPARE
 150 {
 151     U8              HotSparePool;               /* 0x00 */
 152     U8              Reserved1;                  /* 0x01 */
 153     U16             DevHandle;                  /* 0x02 */
 154 } MPI2_RAID_ACTION_HOT_SPARE, MPI2_POINTER PTR_MPI2_RAID_ACTION_HOT_SPARE,
 155   Mpi2RaidActionHotSpare_t, MPI2_POINTER pMpi2RaidActionHotSpare_t;
 156 
 157 /* ActionDataWord for MPI2_RAID_ACTION_DEVICE_FW_UPDATE_MODE Action */
 158 typedef struct _MPI2_RAID_ACTION_FW_UPDATE_MODE
 159 {
 160     U8              Flags;                              /* 0x00 */
 161     U8              DeviceFirmwareUpdateModeTimeout;    /* 0x01 */
 162     U16             Reserved1;                          /* 0x02 */
 163 } MPI2_RAID_ACTION_FW_UPDATE_MODE,
 164   MPI2_POINTER PTR_MPI2_RAID_ACTION_FW_UPDATE_MODE,
 165   Mpi2RaidActionFwUpdateMode_t, MPI2_POINTER pMpi2RaidActionFwUpdateMode_t;
 166 
 167 /* ActionDataWord defines for use with MPI2_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */
 168 #define MPI2_RAID_ACTION_ADATA_DISABLE_FW_UPDATE        (0x00)
 169 #define MPI2_RAID_ACTION_ADATA_ENABLE_FW_UPDATE         (0x01)
 170 
 171 typedef union _MPI2_RAID_ACTION_DATA
 172 {
 173     U32                                     Word;
 174     MPI2_RAID_ACTION_RATE_DATA              Rates;
 175     MPI2_RAID_ACTION_START_RAID_FUNCTION    StartRaidFunction;
 176     MPI2_RAID_ACTION_STOP_RAID_FUNCTION     StopRaidFunction;
 177     MPI2_RAID_ACTION_HOT_SPARE              HotSpare;
 178     MPI2_RAID_ACTION_FW_UPDATE_MODE         FwUpdateMode;
 179 } MPI2_RAID_ACTION_DATA, MPI2_POINTER PTR_MPI2_RAID_ACTION_DATA,
 180   Mpi2RaidActionData_t, MPI2_POINTER pMpi2RaidActionData_t;
 181 
 182 
 183 /* RAID Action Request Message */
 184 typedef struct _MPI2_RAID_ACTION_REQUEST
 185 {
 186     U8                      Action;                         /* 0x00 */
 187     U8                      Reserved1;                      /* 0x01 */
 188     U8                      ChainOffset;                    /* 0x02 */
 189     U8                      Function;                       /* 0x03 */
 190     U16                     VolDevHandle;                   /* 0x04 */
 191     U8                      PhysDiskNum;                    /* 0x06 */
 192     U8                      MsgFlags;                       /* 0x07 */
 193     U8                      VP_ID;                          /* 0x08 */
 194     U8                      VF_ID;                          /* 0x09 */
 195     U16                     Reserved2;                      /* 0x0A */
 196     U32                     Reserved3;                      /* 0x0C */
 197     MPI2_RAID_ACTION_DATA   ActionDataWord;                 /* 0x10 */
 198     MPI2_SGE_SIMPLE_UNION   ActionDataSGE;                  /* 0x14 */
 199 } MPI2_RAID_ACTION_REQUEST, MPI2_POINTER PTR_MPI2_RAID_ACTION_REQUEST,
 200   Mpi2RaidActionRequest_t, MPI2_POINTER pMpi2RaidActionRequest_t;
 201 
 202 /* RAID Action request Action values */
 203 
 204 #define MPI2_RAID_ACTION_INDICATOR_STRUCT           (0x01)
 205 #define MPI2_RAID_ACTION_CREATE_VOLUME              (0x02)
 206 #define MPI2_RAID_ACTION_DELETE_VOLUME              (0x03)
 207 #define MPI2_RAID_ACTION_DISABLE_ALL_VOLUMES        (0x04)
 208 #define MPI2_RAID_ACTION_ENABLE_ALL_VOLUMES         (0x05)
 209 #define MPI2_RAID_ACTION_PHYSDISK_OFFLINE           (0x0A)
 210 #define MPI2_RAID_ACTION_PHYSDISK_ONLINE            (0x0B)
 211 #define MPI2_RAID_ACTION_FAIL_PHYSDISK              (0x0F)
 212 #define MPI2_RAID_ACTION_ACTIVATE_VOLUME            (0x11)
 213 #define MPI2_RAID_ACTION_DEVICE_FW_UPDATE_MODE      (0x15)
 214 #define MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE     (0x17)
 215 #define MPI2_RAID_ACTION_SET_VOLUME_NAME            (0x18)
 216 #define MPI2_RAID_ACTION_SET_RAID_FUNCTION_RATE     (0x19)
 217 #define MPI2_RAID_ACTION_ENABLE_FAILED_VOLUME       (0x1C)
 218 #define MPI2_RAID_ACTION_CREATE_HOT_SPARE           (0x1D)
 219 #define MPI2_RAID_ACTION_DELETE_HOT_SPARE           (0x1E)
 220 #define MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED  (0x20)
 221 #define MPI2_RAID_ACTION_START_RAID_FUNCTION        (0x21)
 222 #define MPI2_RAID_ACTION_STOP_RAID_FUNCTION         (0x22)
 223 
 224 
 225 /* RAID Volume Creation Structure */
 226 
 227 /*
 228  * The following define can be customized for the targeted product.
 229  */
 230 #ifndef MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS
 231 #define MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS        (1)
 232 #endif
 233 
 234 typedef struct _MPI2_RAID_VOLUME_PHYSDISK
 235 {
 236     U8                      RAIDSetNum;                     /* 0x00 */
 237     U8                      PhysDiskMap;                    /* 0x01 */
 238     U16                     PhysDiskDevHandle;              /* 0x02 */
 239 } MPI2_RAID_VOLUME_PHYSDISK, MPI2_POINTER PTR_MPI2_RAID_VOLUME_PHYSDISK,
 240   Mpi2RaidVolumePhysDisk_t, MPI2_POINTER pMpi2RaidVolumePhysDisk_t;
 241 
 242 /* defines for the PhysDiskMap field */
 243 #define MPI2_RAIDACTION_PHYSDISK_PRIMARY            (0x01)
 244 #define MPI2_RAIDACTION_PHYSDISK_SECONDARY          (0x02)
 245 
 246 typedef struct _MPI2_RAID_VOLUME_CREATION_STRUCT
 247 {
 248     U8                          NumPhysDisks;               /* 0x00 */
 249     U8                          VolumeType;                 /* 0x01 */
 250     U16                         Reserved1;                  /* 0x02 */
 251     U32                         VolumeCreationFlags;        /* 0x04 */
 252     U32                         VolumeSettings;             /* 0x08 */
 253     U8                          Reserved2;                  /* 0x0C */
 254     U8                          ResyncRate;                 /* 0x0D */
 255     U16                         DataScrubDuration;          /* 0x0E */
 256     U64                         VolumeMaxLBA;               /* 0x10 */
 257     U32                         StripeSize;                 /* 0x18 */
 258     U8                          Name[16];                   /* 0x1C */
 259     MPI2_RAID_VOLUME_PHYSDISK   PhysDisk[MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS];/* 0x2C */
 260 } MPI2_RAID_VOLUME_CREATION_STRUCT,
 261   MPI2_POINTER PTR_MPI2_RAID_VOLUME_CREATION_STRUCT,
 262   Mpi2RaidVolumeCreationStruct_t, MPI2_POINTER pMpi2RaidVolumeCreationStruct_t;
 263 
 264 /* use MPI2_RAID_VOL_TYPE_ defines from mpi2_cnfg.h for VolumeType */
 265 
 266 /* defines for the VolumeCreationFlags field */
 267 #define MPI2_RAID_VOL_CREATION_DEFAULT_SETTINGS     (0x80000000)
 268 #define MPI2_RAID_VOL_CREATION_BACKGROUND_INIT      (0x00000004)
 269 #define MPI2_RAID_VOL_CREATION_LOW_LEVEL_INIT       (0x00000002)
 270 #define MPI2_RAID_VOL_CREATION_MIGRATE_DATA         (0x00000001)
 271 /* The following is an obsolete define.
 272  * It must be shifted left 24 bits in order to set the proper bit.
 273  */
 274 #define MPI2_RAID_VOL_CREATION_USE_DEFAULT_SETTINGS (0x80)
 275 
 276 
 277 /* RAID Online Capacity Expansion Structure */
 278 
 279 typedef struct _MPI2_RAID_ONLINE_CAPACITY_EXPANSION
 280 {
 281     U32                     Flags;                          /* 0x00 */
 282     U16                     DevHandle0;                     /* 0x04 */
 283     U16                     Reserved1;                      /* 0x06 */
 284     U16                     DevHandle1;                     /* 0x08 */
 285     U16                     Reserved2;                      /* 0x0A */
 286 } MPI2_RAID_ONLINE_CAPACITY_EXPANSION,
 287   MPI2_POINTER PTR_MPI2_RAID_ONLINE_CAPACITY_EXPANSION,
 288   Mpi2RaidOnlineCapacityExpansion_t,
 289   MPI2_POINTER pMpi2RaidOnlineCapacityExpansion_t;
 290 
 291 
 292 /* RAID Volume Indicator Structure */
 293 
 294 typedef struct _MPI2_RAID_VOL_INDICATOR
 295 {
 296     U64                     TotalBlocks;                    /* 0x00 */
 297     U64                     BlocksRemaining;                /* 0x08 */
 298     U32                     Flags;                          /* 0x10 */
 299 } MPI2_RAID_VOL_INDICATOR, MPI2_POINTER PTR_MPI2_RAID_VOL_INDICATOR,
 300   Mpi2RaidVolIndicator_t, MPI2_POINTER pMpi2RaidVolIndicator_t;
 301 
 302 /* defines for RAID Volume Indicator Flags field */
 303 #define MPI2_RAID_VOL_FLAGS_OP_MASK                 (0x0000000F)
 304 #define MPI2_RAID_VOL_FLAGS_OP_BACKGROUND_INIT      (0x00000000)
 305 #define MPI2_RAID_VOL_FLAGS_OP_ONLINE_CAP_EXPANSION (0x00000001)
 306 #define MPI2_RAID_VOL_FLAGS_OP_CONSISTENCY_CHECK    (0x00000002)
 307 #define MPI2_RAID_VOL_FLAGS_OP_RESYNC               (0x00000003)
 308 
 309 
 310 /* RAID Action Reply ActionData union */
 311 typedef union _MPI2_RAID_ACTION_REPLY_DATA
 312 {
 313     U32                     Word[5];
 314     MPI2_RAID_VOL_INDICATOR RaidVolumeIndicator;
 315     U16                     VolDevHandle;
 316     U8                      VolumeState;
 317     U8                      PhysDiskNum;
 318 } MPI2_RAID_ACTION_REPLY_DATA, MPI2_POINTER PTR_MPI2_RAID_ACTION_REPLY_DATA,
 319   Mpi2RaidActionReplyData_t, MPI2_POINTER pMpi2RaidActionReplyData_t;
 320 
 321 /* use MPI2_RAIDVOL0_SETTING_ defines from mpi2_cnfg.h for MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE action */
 322 
 323 
 324 /* RAID Action Reply Message */
 325 typedef struct _MPI2_RAID_ACTION_REPLY
 326 {
 327     U8                          Action;                     /* 0x00 */
 328     U8                          Reserved1;                  /* 0x01 */
 329     U8                          MsgLength;                  /* 0x02 */
 330     U8                          Function;                   /* 0x03 */
 331     U16                         VolDevHandle;               /* 0x04 */
 332     U8                          PhysDiskNum;                /* 0x06 */
 333     U8                          MsgFlags;                   /* 0x07 */
 334     U8                          VP_ID;                      /* 0x08 */
 335     U8                          VF_ID;                      /* 0x09 */
 336     U16                         Reserved2;                  /* 0x0A */
 337     U16                         Reserved3;                  /* 0x0C */
 338     U16                         IOCStatus;                  /* 0x0E */
 339     U32                         IOCLogInfo;                 /* 0x10 */
 340     MPI2_RAID_ACTION_REPLY_DATA ActionData;                 /* 0x14 */
 341 } MPI2_RAID_ACTION_REPLY, MPI2_POINTER PTR_MPI2_RAID_ACTION_REPLY,
 342   Mpi2RaidActionReply_t, MPI2_POINTER pMpi2RaidActionReply_t;
 343 
 344 
 345 #endif
 346