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