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