adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Linux MegaRAID driver for SAS based RAID controllers |
| 3 | * |
Sumit.Saxena@avagotech.com | e399065 | 2014-11-17 15:24:03 +0530 | [diff] [blame] | 4 | * Copyright (c) 2009-2013 LSI Corporation |
| 5 | * Copyright (c) 2013-2014 Avago Technologies |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * as published by the Free Software Foundation; either version 2 |
| 10 | * of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
Sumit.Saxena@avagotech.com | e399065 | 2014-11-17 15:24:03 +0530 | [diff] [blame] | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 19 | * |
| 20 | * FILE: megaraid_sas_fusion.h |
| 21 | * |
Sumit.Saxena@avagotech.com | e399065 | 2014-11-17 15:24:03 +0530 | [diff] [blame] | 22 | * Authors: Avago Technologies |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 23 | * Manoj Jose |
| 24 | * Sumant Patro |
Sumit.Saxena@avagotech.com | e399065 | 2014-11-17 15:24:03 +0530 | [diff] [blame] | 25 | * Kashyap Desai <kashyap.desai@avagotech.com> |
| 26 | * Sumit Saxena <sumit.saxena@avagotech.com> |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 27 | * |
Sumit.Saxena@avagotech.com | e399065 | 2014-11-17 15:24:03 +0530 | [diff] [blame] | 28 | * Send feedback to: megaraidlinux.pdl@avagotech.com |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 29 | * |
Sumit.Saxena@avagotech.com | e399065 | 2014-11-17 15:24:03 +0530 | [diff] [blame] | 30 | * Mail to: Avago Technologies, 350 West Trimble Road, Building 90, |
| 31 | * San Jose, California 95131 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 32 | */ |
| 33 | |
| 34 | #ifndef _MEGARAID_SAS_FUSION_H_ |
| 35 | #define _MEGARAID_SAS_FUSION_H_ |
| 36 | |
| 37 | /* Fusion defines */ |
sumit.saxena@avagotech.com | bd5f948 | 2015-08-31 17:23:31 +0530 | [diff] [blame] | 38 | #define MEGASAS_CHAIN_FRAME_SZ_MIN 1024 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 39 | #define MFI_FUSION_ENABLE_INTERRUPT_MASK (0x00000009) |
sumit.saxena@avagotech.com | bd5f948 | 2015-08-31 17:23:31 +0530 | [diff] [blame] | 40 | #define MEGASAS_MAX_CHAIN_SHIFT 5 |
| 41 | #define MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK 0x400000 |
| 42 | #define MEGASAS_MAX_CHAIN_SIZE_MASK 0x3E0 |
| 43 | #define MEGASAS_256K_IO 128 |
| 44 | #define MEGASAS_1MB_IO (MEGASAS_256K_IO * 4) |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 45 | #define MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE 256 |
| 46 | #define MEGASAS_MPI2_FUNCTION_PASSTHRU_IO_REQUEST 0xF0 |
| 47 | #define MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST 0xF1 |
| 48 | #define MEGASAS_LOAD_BALANCE_FLAG 0x1 |
| 49 | #define MEGASAS_DCMD_MBOX_PEND_FLAG 0x1 |
| 50 | #define HOST_DIAG_WRITE_ENABLE 0x80 |
| 51 | #define HOST_DIAG_RESET_ADAPTER 0x4 |
| 52 | #define MEGASAS_FUSION_MAX_RESET_TRIES 3 |
Sumit.Saxena@lsi.com | d46a3ad | 2013-05-22 12:34:14 +0530 | [diff] [blame] | 53 | #define MAX_MSIX_QUEUES_FUSION 128 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 54 | |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 55 | /* Invader defines */ |
| 56 | #define MPI2_TYPE_CUDA 0x2 |
| 57 | #define MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH 0x4000 |
| 58 | #define MR_RL_FLAGS_GRANT_DESTINATION_CPU0 0x00 |
| 59 | #define MR_RL_FLAGS_GRANT_DESTINATION_CPU1 0x10 |
| 60 | #define MR_RL_FLAGS_GRANT_DESTINATION_CUDA 0x80 |
| 61 | #define MR_RL_FLAGS_SEQ_NUM_ENABLE 0x8 |
| 62 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 63 | /* T10 PI defines */ |
| 64 | #define MR_PROT_INFO_TYPE_CONTROLLER 0x8 |
| 65 | #define MEGASAS_SCSI_VARIABLE_LENGTH_CMD 0x7f |
| 66 | #define MEGASAS_SCSI_SERVICE_ACTION_READ32 0x9 |
| 67 | #define MEGASAS_SCSI_SERVICE_ACTION_WRITE32 0xB |
| 68 | #define MEGASAS_SCSI_ADDL_CDB_LEN 0x18 |
| 69 | #define MEGASAS_RD_WR_PROTECT_CHECK_ALL 0x20 |
| 70 | #define MEGASAS_RD_WR_PROTECT_CHECK_NONE 0x60 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 71 | |
Sumit.Saxena@lsi.com | d46a3ad | 2013-05-22 12:34:14 +0530 | [diff] [blame] | 72 | #define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C) |
| 73 | #define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) |
| 74 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 75 | /* |
| 76 | * Raid context flags |
| 77 | */ |
| 78 | |
| 79 | #define MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT 0x4 |
| 80 | #define MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_MASK 0x30 |
| 81 | enum MR_RAID_FLAGS_IO_SUB_TYPE { |
| 82 | MR_RAID_FLAGS_IO_SUB_TYPE_NONE = 0, |
| 83 | MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD = 1, |
| 84 | }; |
| 85 | |
| 86 | /* |
| 87 | * Request descriptor types |
| 88 | */ |
| 89 | #define MEGASAS_REQ_DESCRIPT_FLAGS_LD_IO 0x7 |
| 90 | #define MEGASAS_REQ_DESCRIPT_FLAGS_MFA 0x1 |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 91 | #define MEGASAS_REQ_DESCRIPT_FLAGS_NO_LOCK 0x2 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 92 | #define MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT 1 |
| 93 | |
| 94 | #define MEGASAS_FP_CMD_LEN 16 |
| 95 | #define MEGASAS_FUSION_IN_RESET 0 |
Sumit.Saxena@avagotech.com | db4fc86 | 2014-09-12 18:57:23 +0530 | [diff] [blame] | 96 | #define THRESHOLD_REPLY_COUNT 50 |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 97 | #define JBOD_MAPS_COUNT 2 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 98 | |
sumit.saxena@avagotech.com | 5a8cb85 | 2015-10-15 13:39:34 +0530 | [diff] [blame] | 99 | enum MR_FUSION_ADAPTER_TYPE { |
| 100 | THUNDERBOLT_SERIES = 0, |
| 101 | INVADER_SERIES = 1, |
| 102 | }; |
| 103 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 104 | /* |
Matthias Schid | 3948ff8 | 2013-06-26 16:25:53 +0200 | [diff] [blame] | 105 | * Raid Context structure which describes MegaRAID specific IO Parameters |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 106 | * This resides at offset 0x60 where the SGL normally starts in MPT IO Frames |
| 107 | */ |
| 108 | |
| 109 | struct RAID_CONTEXT { |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 110 | #if defined(__BIG_ENDIAN_BITFIELD) |
| 111 | u8 nseg:4; |
| 112 | u8 Type:4; |
| 113 | #else |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 114 | u8 Type:4; |
| 115 | u8 nseg:4; |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 116 | #endif |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 117 | u8 resvd0; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 118 | __le16 timeoutValue; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 119 | u8 regLockFlags; |
| 120 | u8 resvd1; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 121 | __le16 VirtualDiskTgtId; |
| 122 | __le64 regLockRowLBA; |
| 123 | __le32 regLockLength; |
| 124 | __le16 nextLMId; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 125 | u8 exStatus; |
| 126 | u8 status; |
| 127 | u8 RAIDFlags; |
| 128 | u8 numSGE; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 129 | __le16 configSeqNum; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 130 | u8 spanArm; |
sumit.saxena@avagotech.com | 0be3f4c | 2015-08-31 17:22:51 +0530 | [diff] [blame] | 131 | u8 priority; |
sumit.saxena@avagotech.com | bd5f948 | 2015-08-31 17:23:31 +0530 | [diff] [blame] | 132 | u8 numSGEExt; |
| 133 | u8 resvd2; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 134 | }; |
| 135 | |
| 136 | #define RAID_CTX_SPANARM_ARM_SHIFT (0) |
| 137 | #define RAID_CTX_SPANARM_ARM_MASK (0x1f) |
| 138 | |
| 139 | #define RAID_CTX_SPANARM_SPAN_SHIFT (5) |
| 140 | #define RAID_CTX_SPANARM_SPAN_MASK (0xE0) |
| 141 | |
| 142 | /* |
| 143 | * define region lock types |
| 144 | */ |
| 145 | enum REGION_TYPE { |
| 146 | REGION_TYPE_UNUSED = 0, |
| 147 | REGION_TYPE_SHARED_READ = 1, |
| 148 | REGION_TYPE_SHARED_WRITE = 2, |
| 149 | REGION_TYPE_EXCLUSIVE = 3, |
| 150 | }; |
| 151 | |
| 152 | /* MPI2 defines */ |
| 153 | #define MPI2_FUNCTION_IOC_INIT (0x02) /* IOC Init */ |
| 154 | #define MPI2_WHOINIT_HOST_DRIVER (0x04) |
| 155 | #define MPI2_VERSION_MAJOR (0x02) |
| 156 | #define MPI2_VERSION_MINOR (0x00) |
| 157 | #define MPI2_VERSION_MAJOR_MASK (0xFF00) |
| 158 | #define MPI2_VERSION_MAJOR_SHIFT (8) |
| 159 | #define MPI2_VERSION_MINOR_MASK (0x00FF) |
| 160 | #define MPI2_VERSION_MINOR_SHIFT (0) |
| 161 | #define MPI2_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \ |
| 162 | MPI2_VERSION_MINOR) |
| 163 | #define MPI2_HEADER_VERSION_UNIT (0x10) |
| 164 | #define MPI2_HEADER_VERSION_DEV (0x00) |
| 165 | #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) |
| 166 | #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) |
| 167 | #define MPI2_HEADER_VERSION_DEV_MASK (0x00FF) |
| 168 | #define MPI2_HEADER_VERSION_DEV_SHIFT (0) |
| 169 | #define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | \ |
| 170 | MPI2_HEADER_VERSION_DEV) |
| 171 | #define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) |
| 172 | #define MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG (0x8000) |
| 173 | #define MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG (0x0400) |
| 174 | #define MPI2_SCSIIO_EEDPFLAGS_CHECK_REMOVE_OP (0x0003) |
| 175 | #define MPI2_SCSIIO_EEDPFLAGS_CHECK_APPTAG (0x0200) |
| 176 | #define MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD (0x0100) |
| 177 | #define MPI2_SCSIIO_EEDPFLAGS_INSERT_OP (0x0004) |
| 178 | #define MPI2_FUNCTION_SCSI_IO_REQUEST (0x00) /* SCSI IO */ |
Sumit Saxena | 2c04835 | 2016-01-28 21:04:24 +0530 | [diff] [blame^] | 179 | #define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY (0x03) |
| 180 | #define MPI2_REQ_DESCRIPT_FLAGS_FP_IO (0x06) |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 181 | #define MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO (0x00) |
| 182 | #define MPI2_SGE_FLAGS_64_BIT_ADDRESSING (0x02) |
| 183 | #define MPI2_SCSIIO_CONTROL_WRITE (0x01000000) |
| 184 | #define MPI2_SCSIIO_CONTROL_READ (0x02000000) |
| 185 | #define MPI2_REQ_DESCRIPT_FLAGS_TYPE_MASK (0x0E) |
| 186 | #define MPI2_RPY_DESCRIPT_FLAGS_UNUSED (0x0F) |
| 187 | #define MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS (0x00) |
| 188 | #define MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK (0x0F) |
| 189 | #define MPI2_WRSEQ_FLUSH_KEY_VALUE (0x0) |
| 190 | #define MPI2_WRITE_SEQUENCE_OFFSET (0x00000004) |
| 191 | #define MPI2_WRSEQ_1ST_KEY_VALUE (0xF) |
| 192 | #define MPI2_WRSEQ_2ND_KEY_VALUE (0x4) |
| 193 | #define MPI2_WRSEQ_3RD_KEY_VALUE (0xB) |
| 194 | #define MPI2_WRSEQ_4TH_KEY_VALUE (0x2) |
| 195 | #define MPI2_WRSEQ_5TH_KEY_VALUE (0x7) |
| 196 | #define MPI2_WRSEQ_6TH_KEY_VALUE (0xD) |
| 197 | |
| 198 | struct MPI25_IEEE_SGE_CHAIN64 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 199 | __le64 Address; |
| 200 | __le32 Length; |
| 201 | __le16 Reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 202 | u8 NextChainOffset; |
| 203 | u8 Flags; |
| 204 | }; |
| 205 | |
| 206 | struct MPI2_SGE_SIMPLE_UNION { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 207 | __le32 FlagsLength; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 208 | union { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 209 | __le32 Address32; |
| 210 | __le64 Address64; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 211 | } u; |
| 212 | }; |
| 213 | |
| 214 | struct MPI2_SCSI_IO_CDB_EEDP32 { |
| 215 | u8 CDB[20]; /* 0x00 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 216 | __be32 PrimaryReferenceTag; /* 0x14 */ |
| 217 | __be16 PrimaryApplicationTag; /* 0x18 */ |
| 218 | __be16 PrimaryApplicationTagMask; /* 0x1A */ |
| 219 | __le32 TransferLength; /* 0x1C */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | struct MPI2_SGE_CHAIN_UNION { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 223 | __le16 Length; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 224 | u8 NextChainOffset; |
| 225 | u8 Flags; |
| 226 | union { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 227 | __le32 Address32; |
| 228 | __le64 Address64; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 229 | } u; |
| 230 | }; |
| 231 | |
| 232 | struct MPI2_IEEE_SGE_SIMPLE32 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 233 | __le32 Address; |
| 234 | __le32 FlagsLength; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 235 | }; |
| 236 | |
| 237 | struct MPI2_IEEE_SGE_CHAIN32 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 238 | __le32 Address; |
| 239 | __le32 FlagsLength; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 240 | }; |
| 241 | |
| 242 | struct MPI2_IEEE_SGE_SIMPLE64 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 243 | __le64 Address; |
| 244 | __le32 Length; |
| 245 | __le16 Reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 246 | u8 Reserved2; |
| 247 | u8 Flags; |
| 248 | }; |
| 249 | |
| 250 | struct MPI2_IEEE_SGE_CHAIN64 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 251 | __le64 Address; |
| 252 | __le32 Length; |
| 253 | __le16 Reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 254 | u8 Reserved2; |
| 255 | u8 Flags; |
| 256 | }; |
| 257 | |
| 258 | union MPI2_IEEE_SGE_SIMPLE_UNION { |
| 259 | struct MPI2_IEEE_SGE_SIMPLE32 Simple32; |
| 260 | struct MPI2_IEEE_SGE_SIMPLE64 Simple64; |
| 261 | }; |
| 262 | |
| 263 | union MPI2_IEEE_SGE_CHAIN_UNION { |
| 264 | struct MPI2_IEEE_SGE_CHAIN32 Chain32; |
| 265 | struct MPI2_IEEE_SGE_CHAIN64 Chain64; |
| 266 | }; |
| 267 | |
| 268 | union MPI2_SGE_IO_UNION { |
| 269 | struct MPI2_SGE_SIMPLE_UNION MpiSimple; |
| 270 | struct MPI2_SGE_CHAIN_UNION MpiChain; |
| 271 | union MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; |
| 272 | union MPI2_IEEE_SGE_CHAIN_UNION IeeeChain; |
| 273 | }; |
| 274 | |
| 275 | union MPI2_SCSI_IO_CDB_UNION { |
| 276 | u8 CDB32[32]; |
| 277 | struct MPI2_SCSI_IO_CDB_EEDP32 EEDP32; |
| 278 | struct MPI2_SGE_SIMPLE_UNION SGE; |
| 279 | }; |
| 280 | |
| 281 | /* |
| 282 | * RAID SCSI IO Request Message |
| 283 | * Total SGE count will be one less than _MPI2_SCSI_IO_REQUEST |
| 284 | */ |
| 285 | struct MPI2_RAID_SCSI_IO_REQUEST { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 286 | __le16 DevHandle; /* 0x00 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 287 | u8 ChainOffset; /* 0x02 */ |
| 288 | u8 Function; /* 0x03 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 289 | __le16 Reserved1; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 290 | u8 Reserved2; /* 0x06 */ |
| 291 | u8 MsgFlags; /* 0x07 */ |
| 292 | u8 VP_ID; /* 0x08 */ |
| 293 | u8 VF_ID; /* 0x09 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 294 | __le16 Reserved3; /* 0x0A */ |
| 295 | __le32 SenseBufferLowAddress; /* 0x0C */ |
| 296 | __le16 SGLFlags; /* 0x10 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 297 | u8 SenseBufferLength; /* 0x12 */ |
| 298 | u8 Reserved4; /* 0x13 */ |
| 299 | u8 SGLOffset0; /* 0x14 */ |
| 300 | u8 SGLOffset1; /* 0x15 */ |
| 301 | u8 SGLOffset2; /* 0x16 */ |
| 302 | u8 SGLOffset3; /* 0x17 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 303 | __le32 SkipCount; /* 0x18 */ |
| 304 | __le32 DataLength; /* 0x1C */ |
| 305 | __le32 BidirectionalDataLength; /* 0x20 */ |
| 306 | __le16 IoFlags; /* 0x24 */ |
| 307 | __le16 EEDPFlags; /* 0x26 */ |
| 308 | __le32 EEDPBlockSize; /* 0x28 */ |
| 309 | __le32 SecondaryReferenceTag; /* 0x2C */ |
| 310 | __le16 SecondaryApplicationTag; /* 0x30 */ |
| 311 | __le16 ApplicationTagTranslationMask; /* 0x32 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 312 | u8 LUN[8]; /* 0x34 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 313 | __le32 Control; /* 0x3C */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 314 | union MPI2_SCSI_IO_CDB_UNION CDB; /* 0x40 */ |
| 315 | struct RAID_CONTEXT RaidContext; /* 0x60 */ |
| 316 | union MPI2_SGE_IO_UNION SGL; /* 0x80 */ |
| 317 | }; |
| 318 | |
| 319 | /* |
| 320 | * MPT RAID MFA IO Descriptor. |
| 321 | */ |
| 322 | struct MEGASAS_RAID_MFA_IO_REQUEST_DESCRIPTOR { |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 323 | u32 RequestFlags:8; |
Sumit.Saxena@avagotech.com | 200aed5 | 2015-01-05 20:05:58 +0530 | [diff] [blame] | 324 | u32 MessageAddress1:24; |
| 325 | u32 MessageAddress2; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 326 | }; |
| 327 | |
| 328 | /* Default Request Descriptor */ |
| 329 | struct MPI2_DEFAULT_REQUEST_DESCRIPTOR { |
| 330 | u8 RequestFlags; /* 0x00 */ |
| 331 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 332 | __le16 SMID; /* 0x02 */ |
| 333 | __le16 LMID; /* 0x04 */ |
| 334 | __le16 DescriptorTypeDependent; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 335 | }; |
| 336 | |
| 337 | /* High Priority Request Descriptor */ |
| 338 | struct MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR { |
| 339 | u8 RequestFlags; /* 0x00 */ |
| 340 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 341 | __le16 SMID; /* 0x02 */ |
| 342 | __le16 LMID; /* 0x04 */ |
| 343 | __le16 Reserved1; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 344 | }; |
| 345 | |
| 346 | /* SCSI IO Request Descriptor */ |
| 347 | struct MPI2_SCSI_IO_REQUEST_DESCRIPTOR { |
| 348 | u8 RequestFlags; /* 0x00 */ |
| 349 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 350 | __le16 SMID; /* 0x02 */ |
| 351 | __le16 LMID; /* 0x04 */ |
| 352 | __le16 DevHandle; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 353 | }; |
| 354 | |
| 355 | /* SCSI Target Request Descriptor */ |
| 356 | struct MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR { |
| 357 | u8 RequestFlags; /* 0x00 */ |
| 358 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 359 | __le16 SMID; /* 0x02 */ |
| 360 | __le16 LMID; /* 0x04 */ |
| 361 | __le16 IoIndex; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 362 | }; |
| 363 | |
| 364 | /* RAID Accelerator Request Descriptor */ |
| 365 | struct MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR { |
| 366 | u8 RequestFlags; /* 0x00 */ |
| 367 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 368 | __le16 SMID; /* 0x02 */ |
| 369 | __le16 LMID; /* 0x04 */ |
| 370 | __le16 Reserved; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 371 | }; |
| 372 | |
| 373 | /* union of Request Descriptors */ |
| 374 | union MEGASAS_REQUEST_DESCRIPTOR_UNION { |
| 375 | struct MPI2_DEFAULT_REQUEST_DESCRIPTOR Default; |
| 376 | struct MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR HighPriority; |
| 377 | struct MPI2_SCSI_IO_REQUEST_DESCRIPTOR SCSIIO; |
| 378 | struct MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR SCSITarget; |
| 379 | struct MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR RAIDAccelerator; |
| 380 | struct MEGASAS_RAID_MFA_IO_REQUEST_DESCRIPTOR MFAIo; |
| 381 | union { |
| 382 | struct { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 383 | __le32 low; |
| 384 | __le32 high; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 385 | } u; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 386 | __le64 Words; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 387 | }; |
| 388 | }; |
| 389 | |
| 390 | /* Default Reply Descriptor */ |
| 391 | struct MPI2_DEFAULT_REPLY_DESCRIPTOR { |
| 392 | u8 ReplyFlags; /* 0x00 */ |
| 393 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 394 | __le16 DescriptorTypeDependent1; /* 0x02 */ |
| 395 | __le32 DescriptorTypeDependent2; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 396 | }; |
| 397 | |
| 398 | /* Address Reply Descriptor */ |
| 399 | struct MPI2_ADDRESS_REPLY_DESCRIPTOR { |
| 400 | u8 ReplyFlags; /* 0x00 */ |
| 401 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 402 | __le16 SMID; /* 0x02 */ |
| 403 | __le32 ReplyFrameAddress; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 404 | }; |
| 405 | |
| 406 | /* SCSI IO Success Reply Descriptor */ |
| 407 | struct MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR { |
| 408 | u8 ReplyFlags; /* 0x00 */ |
| 409 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 410 | __le16 SMID; /* 0x02 */ |
| 411 | __le16 TaskTag; /* 0x04 */ |
| 412 | __le16 Reserved1; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 413 | }; |
| 414 | |
| 415 | /* TargetAssist Success Reply Descriptor */ |
| 416 | struct MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR { |
| 417 | u8 ReplyFlags; /* 0x00 */ |
| 418 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 419 | __le16 SMID; /* 0x02 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 420 | u8 SequenceNumber; /* 0x04 */ |
| 421 | u8 Reserved1; /* 0x05 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 422 | __le16 IoIndex; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 423 | }; |
| 424 | |
| 425 | /* Target Command Buffer Reply Descriptor */ |
| 426 | struct MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR { |
| 427 | u8 ReplyFlags; /* 0x00 */ |
| 428 | u8 MSIxIndex; /* 0x01 */ |
| 429 | u8 VP_ID; /* 0x02 */ |
| 430 | u8 Flags; /* 0x03 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 431 | __le16 InitiatorDevHandle; /* 0x04 */ |
| 432 | __le16 IoIndex; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 433 | }; |
| 434 | |
| 435 | /* RAID Accelerator Success Reply Descriptor */ |
| 436 | struct MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR { |
| 437 | u8 ReplyFlags; /* 0x00 */ |
| 438 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 439 | __le16 SMID; /* 0x02 */ |
| 440 | __le32 Reserved; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 441 | }; |
| 442 | |
| 443 | /* union of Reply Descriptors */ |
| 444 | union MPI2_REPLY_DESCRIPTORS_UNION { |
| 445 | struct MPI2_DEFAULT_REPLY_DESCRIPTOR Default; |
| 446 | struct MPI2_ADDRESS_REPLY_DESCRIPTOR AddressReply; |
| 447 | struct MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR SCSIIOSuccess; |
| 448 | struct MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR TargetAssistSuccess; |
| 449 | struct MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR TargetCommandBuffer; |
| 450 | struct MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR |
| 451 | RAIDAcceleratorSuccess; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 452 | __le64 Words; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 453 | }; |
| 454 | |
| 455 | /* IOCInit Request message */ |
| 456 | struct MPI2_IOC_INIT_REQUEST { |
| 457 | u8 WhoInit; /* 0x00 */ |
| 458 | u8 Reserved1; /* 0x01 */ |
| 459 | u8 ChainOffset; /* 0x02 */ |
| 460 | u8 Function; /* 0x03 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 461 | __le16 Reserved2; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 462 | u8 Reserved3; /* 0x06 */ |
| 463 | u8 MsgFlags; /* 0x07 */ |
| 464 | u8 VP_ID; /* 0x08 */ |
| 465 | u8 VF_ID; /* 0x09 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 466 | __le16 Reserved4; /* 0x0A */ |
| 467 | __le16 MsgVersion; /* 0x0C */ |
| 468 | __le16 HeaderVersion; /* 0x0E */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 469 | u32 Reserved5; /* 0x10 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 470 | __le16 Reserved6; /* 0x14 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 471 | u8 Reserved7; /* 0x16 */ |
| 472 | u8 HostMSIxVectors; /* 0x17 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 473 | __le16 Reserved8; /* 0x18 */ |
| 474 | __le16 SystemRequestFrameSize; /* 0x1A */ |
| 475 | __le16 ReplyDescriptorPostQueueDepth; /* 0x1C */ |
| 476 | __le16 ReplyFreeQueueDepth; /* 0x1E */ |
| 477 | __le32 SenseBufferAddressHigh; /* 0x20 */ |
| 478 | __le32 SystemReplyAddressHigh; /* 0x24 */ |
| 479 | __le64 SystemRequestFrameBaseAddress; /* 0x28 */ |
| 480 | __le64 ReplyDescriptorPostQueueAddress;/* 0x30 */ |
| 481 | __le64 ReplyFreeQueueAddress; /* 0x38 */ |
| 482 | __le64 TimeStamp; /* 0x40 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 483 | }; |
| 484 | |
| 485 | /* mrpriv defines */ |
| 486 | #define MR_PD_INVALID 0xFFFF |
| 487 | #define MAX_SPAN_DEPTH 8 |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 488 | #define MAX_QUAD_DEPTH MAX_SPAN_DEPTH |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 489 | #define MAX_RAIDMAP_SPAN_DEPTH (MAX_SPAN_DEPTH) |
| 490 | #define MAX_ROW_SIZE 32 |
| 491 | #define MAX_RAIDMAP_ROW_SIZE (MAX_ROW_SIZE) |
| 492 | #define MAX_LOGICAL_DRIVES 64 |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 493 | #define MAX_LOGICAL_DRIVES_EXT 256 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 494 | #define MAX_RAIDMAP_LOGICAL_DRIVES (MAX_LOGICAL_DRIVES) |
| 495 | #define MAX_RAIDMAP_VIEWS (MAX_LOGICAL_DRIVES) |
| 496 | #define MAX_ARRAYS 128 |
| 497 | #define MAX_RAIDMAP_ARRAYS (MAX_ARRAYS) |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 498 | #define MAX_ARRAYS_EXT 256 |
| 499 | #define MAX_API_ARRAYS_EXT (MAX_ARRAYS_EXT) |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 500 | #define MAX_PHYSICAL_DEVICES 256 |
| 501 | #define MAX_RAIDMAP_PHYSICAL_DEVICES (MAX_PHYSICAL_DEVICES) |
| 502 | #define MR_DCMD_LD_MAP_GET_INFO 0x0300e101 |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 503 | #define MR_DCMD_SYSTEM_PD_MAP_GET_INFO 0x0200e102 |
adam radford | 229fe47 | 2014-03-10 02:51:56 -0700 | [diff] [blame] | 504 | #define MR_DCMD_CTRL_SHARED_HOST_MEM_ALLOC 0x010e8485 /* SR-IOV HB alloc*/ |
| 505 | #define MR_DCMD_LD_VF_MAP_GET_ALL_LDS_111 0x03200200 |
| 506 | #define MR_DCMD_LD_VF_MAP_GET_ALL_LDS 0x03150200 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 507 | |
| 508 | struct MR_DEV_HANDLE_INFO { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 509 | __le16 curDevHdl; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 510 | u8 validHandles; |
| 511 | u8 reserved; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 512 | __le16 devHandle[2]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 513 | }; |
| 514 | |
| 515 | struct MR_ARRAY_INFO { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 516 | __le16 pd[MAX_RAIDMAP_ROW_SIZE]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 517 | }; |
| 518 | |
| 519 | struct MR_QUAD_ELEMENT { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 520 | __le64 logStart; |
| 521 | __le64 logEnd; |
| 522 | __le64 offsetInSpan; |
| 523 | __le32 diff; |
| 524 | __le32 reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 525 | }; |
| 526 | |
| 527 | struct MR_SPAN_INFO { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 528 | __le32 noElements; |
| 529 | __le32 reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 530 | struct MR_QUAD_ELEMENT quad[MAX_RAIDMAP_SPAN_DEPTH]; |
| 531 | }; |
| 532 | |
| 533 | struct MR_LD_SPAN { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 534 | __le64 startBlk; |
| 535 | __le64 numBlks; |
| 536 | __le16 arrayRef; |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 537 | u8 spanRowSize; |
| 538 | u8 spanRowDataSize; |
| 539 | u8 reserved[4]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 540 | }; |
| 541 | |
| 542 | struct MR_SPAN_BLOCK_INFO { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 543 | __le64 num_rows; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 544 | struct MR_LD_SPAN span; |
| 545 | struct MR_SPAN_INFO block_span_info; |
| 546 | }; |
| 547 | |
| 548 | struct MR_LD_RAID { |
| 549 | struct { |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 550 | #if defined(__BIG_ENDIAN_BITFIELD) |
| 551 | u32 reserved4:7; |
| 552 | u32 fpNonRWCapable:1; |
| 553 | u32 fpReadAcrossStripe:1; |
| 554 | u32 fpWriteAcrossStripe:1; |
| 555 | u32 fpReadCapable:1; |
| 556 | u32 fpWriteCapable:1; |
| 557 | u32 encryptionType:8; |
| 558 | u32 pdPiMode:4; |
| 559 | u32 ldPiMode:4; |
| 560 | u32 reserved5:3; |
| 561 | u32 fpCapable:1; |
| 562 | #else |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 563 | u32 fpCapable:1; |
| 564 | u32 reserved5:3; |
| 565 | u32 ldPiMode:4; |
| 566 | u32 pdPiMode:4; |
| 567 | u32 encryptionType:8; |
| 568 | u32 fpWriteCapable:1; |
| 569 | u32 fpReadCapable:1; |
| 570 | u32 fpWriteAcrossStripe:1; |
| 571 | u32 fpReadAcrossStripe:1; |
adam radford | 21c9e16 | 2013-09-06 15:27:14 -0700 | [diff] [blame] | 572 | u32 fpNonRWCapable:1; |
| 573 | u32 reserved4:7; |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 574 | #endif |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 575 | } capability; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 576 | __le32 reserved6; |
| 577 | __le64 size; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 578 | u8 spanDepth; |
| 579 | u8 level; |
| 580 | u8 stripeShift; |
| 581 | u8 rowSize; |
| 582 | u8 rowDataSize; |
| 583 | u8 writeMode; |
| 584 | u8 PRL; |
| 585 | u8 SRL; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 586 | __le16 targetId; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 587 | u8 ldState; |
| 588 | u8 regTypeReqOnWrite; |
| 589 | u8 modFactor; |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 590 | u8 regTypeReqOnRead; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 591 | __le16 seqNum; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 592 | |
| 593 | struct { |
| 594 | u32 ldSyncRequired:1; |
| 595 | u32 reserved:31; |
| 596 | } flags; |
| 597 | |
adam radford | 21c9e16 | 2013-09-06 15:27:14 -0700 | [diff] [blame] | 598 | u8 LUN[8]; /* 0x24 8 byte LUN field used for SCSI IO's */ |
| 599 | u8 fpIoTimeoutForLd;/*0x2C timeout value used by driver in FP IO*/ |
| 600 | u8 reserved3[0x80-0x2D]; /* 0x2D */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 601 | }; |
| 602 | |
| 603 | struct MR_LD_SPAN_MAP { |
| 604 | struct MR_LD_RAID ldRaid; |
| 605 | u8 dataArmMap[MAX_RAIDMAP_ROW_SIZE]; |
| 606 | struct MR_SPAN_BLOCK_INFO spanBlock[MAX_RAIDMAP_SPAN_DEPTH]; |
| 607 | }; |
| 608 | |
| 609 | struct MR_FW_RAID_MAP { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 610 | __le32 totalSize; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 611 | union { |
| 612 | struct { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 613 | __le32 maxLd; |
| 614 | __le32 maxSpanDepth; |
| 615 | __le32 maxRowSize; |
| 616 | __le32 maxPdCount; |
| 617 | __le32 maxArrays; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 618 | } validationInfo; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 619 | __le32 version[5]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 620 | }; |
| 621 | |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 622 | __le32 ldCount; |
| 623 | __le32 Reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 624 | u8 ldTgtIdToLd[MAX_RAIDMAP_LOGICAL_DRIVES+ |
| 625 | MAX_RAIDMAP_VIEWS]; |
| 626 | u8 fpPdIoTimeoutSec; |
| 627 | u8 reserved2[7]; |
| 628 | struct MR_ARRAY_INFO arMapInfo[MAX_RAIDMAP_ARRAYS]; |
| 629 | struct MR_DEV_HANDLE_INFO devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES]; |
| 630 | struct MR_LD_SPAN_MAP ldSpanMap[1]; |
| 631 | }; |
| 632 | |
| 633 | struct IO_REQUEST_INFO { |
| 634 | u64 ldStartBlock; |
| 635 | u32 numBlocks; |
| 636 | u16 ldTgtId; |
| 637 | u8 isRead; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 638 | __le16 devHandle; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 639 | u64 pdBlock; |
| 640 | u8 fpOkForIo; |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 641 | u8 IoforUnevenSpan; |
| 642 | u8 start_span; |
| 643 | u8 reserved; |
| 644 | u64 start_row; |
Sumit.Saxena@avagotech.com | d2552eb | 2014-09-12 18:57:53 +0530 | [diff] [blame] | 645 | u8 span_arm; /* span[7:5], arm[4:0] */ |
| 646 | u8 pd_after_lb; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 647 | }; |
| 648 | |
| 649 | struct MR_LD_TARGET_SYNC { |
| 650 | u8 targetId; |
| 651 | u8 reserved; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 652 | __le16 seqNum; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 653 | }; |
| 654 | |
| 655 | #define IEEE_SGE_FLAGS_ADDR_MASK (0x03) |
| 656 | #define IEEE_SGE_FLAGS_SYSTEM_ADDR (0x00) |
| 657 | #define IEEE_SGE_FLAGS_IOCDDR_ADDR (0x01) |
| 658 | #define IEEE_SGE_FLAGS_IOCPLB_ADDR (0x02) |
| 659 | #define IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) |
| 660 | #define IEEE_SGE_FLAGS_CHAIN_ELEMENT (0x80) |
| 661 | #define IEEE_SGE_FLAGS_END_OF_LIST (0x40) |
| 662 | |
| 663 | struct megasas_register_set; |
| 664 | struct megasas_instance; |
| 665 | |
| 666 | union desc_word { |
| 667 | u64 word; |
| 668 | struct { |
| 669 | u32 low; |
| 670 | u32 high; |
| 671 | } u; |
| 672 | }; |
| 673 | |
| 674 | struct megasas_cmd_fusion { |
| 675 | struct MPI2_RAID_SCSI_IO_REQUEST *io_request; |
| 676 | dma_addr_t io_request_phys_addr; |
| 677 | |
| 678 | union MPI2_SGE_IO_UNION *sg_frame; |
| 679 | dma_addr_t sg_frame_phys_addr; |
| 680 | |
| 681 | u8 *sense; |
| 682 | dma_addr_t sense_phys_addr; |
| 683 | |
| 684 | struct list_head list; |
| 685 | struct scsi_cmnd *scmd; |
| 686 | struct megasas_instance *instance; |
| 687 | |
| 688 | u8 retry_for_fw_reset; |
| 689 | union MEGASAS_REQUEST_DESCRIPTOR_UNION *request_desc; |
| 690 | |
| 691 | /* |
| 692 | * Context for a MFI frame. |
| 693 | * Used to get the mfi cmd from list when a MFI cmd is completed |
| 694 | */ |
| 695 | u32 sync_cmd_idx; |
| 696 | u32 index; |
Sumit.Saxena@avagotech.com | d2552eb | 2014-09-12 18:57:53 +0530 | [diff] [blame] | 697 | u8 pd_r1_lb; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 698 | }; |
| 699 | |
| 700 | struct LD_LOAD_BALANCE_INFO { |
| 701 | u8 loadBalanceFlag; |
| 702 | u8 reserved1; |
Sumit.Saxena@avagotech.com | d2552eb | 2014-09-12 18:57:53 +0530 | [diff] [blame] | 703 | atomic_t scsi_pending_cmds[MAX_PHYSICAL_DEVICES]; |
| 704 | u64 last_accessed_block[MAX_PHYSICAL_DEVICES]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 705 | }; |
| 706 | |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 707 | /* SPAN_SET is info caclulated from span info from Raid map per LD */ |
| 708 | typedef struct _LD_SPAN_SET { |
| 709 | u64 log_start_lba; |
| 710 | u64 log_end_lba; |
| 711 | u64 span_row_start; |
| 712 | u64 span_row_end; |
| 713 | u64 data_strip_start; |
| 714 | u64 data_strip_end; |
| 715 | u64 data_row_start; |
| 716 | u64 data_row_end; |
| 717 | u8 strip_offset[MAX_SPAN_DEPTH]; |
| 718 | u32 span_row_data_width; |
| 719 | u32 diff; |
| 720 | u32 reserved[2]; |
| 721 | } LD_SPAN_SET, *PLD_SPAN_SET; |
| 722 | |
| 723 | typedef struct LOG_BLOCK_SPAN_INFO { |
| 724 | LD_SPAN_SET span_set[MAX_SPAN_DEPTH]; |
| 725 | } LD_SPAN_INFO, *PLD_SPAN_INFO; |
| 726 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 727 | struct MR_FW_RAID_MAP_ALL { |
| 728 | struct MR_FW_RAID_MAP raidMap; |
| 729 | struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES - 1]; |
| 730 | } __attribute__ ((packed)); |
| 731 | |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 732 | struct MR_DRV_RAID_MAP { |
| 733 | /* total size of this structure, including this field. |
| 734 | * This feild will be manupulated by driver for ext raid map, |
| 735 | * else pick the value from firmware raid map. |
| 736 | */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 737 | __le32 totalSize; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 738 | |
| 739 | union { |
| 740 | struct { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 741 | __le32 maxLd; |
| 742 | __le32 maxSpanDepth; |
| 743 | __le32 maxRowSize; |
| 744 | __le32 maxPdCount; |
| 745 | __le32 maxArrays; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 746 | } validationInfo; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 747 | __le32 version[5]; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 748 | }; |
| 749 | |
| 750 | /* timeout value used by driver in FP IOs*/ |
| 751 | u8 fpPdIoTimeoutSec; |
| 752 | u8 reserved2[7]; |
| 753 | |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 754 | __le16 ldCount; |
| 755 | __le16 arCount; |
| 756 | __le16 spanCount; |
| 757 | __le16 reserve3; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 758 | |
| 759 | struct MR_DEV_HANDLE_INFO devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES]; |
| 760 | u8 ldTgtIdToLd[MAX_LOGICAL_DRIVES_EXT]; |
| 761 | struct MR_ARRAY_INFO arMapInfo[MAX_API_ARRAYS_EXT]; |
| 762 | struct MR_LD_SPAN_MAP ldSpanMap[1]; |
| 763 | |
| 764 | }; |
| 765 | |
| 766 | /* Driver raid map size is same as raid map ext |
| 767 | * MR_DRV_RAID_MAP_ALL is created to sync with old raid. |
| 768 | * And it is mainly for code re-use purpose. |
| 769 | */ |
| 770 | struct MR_DRV_RAID_MAP_ALL { |
| 771 | |
| 772 | struct MR_DRV_RAID_MAP raidMap; |
| 773 | struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_EXT - 1]; |
| 774 | } __packed; |
| 775 | |
| 776 | |
| 777 | |
| 778 | struct MR_FW_RAID_MAP_EXT { |
| 779 | /* Not usred in new map */ |
| 780 | u32 reserved; |
| 781 | |
| 782 | union { |
| 783 | struct { |
| 784 | u32 maxLd; |
| 785 | u32 maxSpanDepth; |
| 786 | u32 maxRowSize; |
| 787 | u32 maxPdCount; |
| 788 | u32 maxArrays; |
| 789 | } validationInfo; |
| 790 | u32 version[5]; |
| 791 | }; |
| 792 | |
| 793 | u8 fpPdIoTimeoutSec; |
| 794 | u8 reserved2[7]; |
| 795 | |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 796 | __le16 ldCount; |
| 797 | __le16 arCount; |
| 798 | __le16 spanCount; |
| 799 | __le16 reserve3; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 800 | |
| 801 | struct MR_DEV_HANDLE_INFO devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES]; |
| 802 | u8 ldTgtIdToLd[MAX_LOGICAL_DRIVES_EXT]; |
| 803 | struct MR_ARRAY_INFO arMapInfo[MAX_API_ARRAYS_EXT]; |
| 804 | struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_EXT]; |
| 805 | }; |
| 806 | |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 807 | /* |
| 808 | * * define MR_PD_CFG_SEQ structure for system PDs |
| 809 | * */ |
| 810 | struct MR_PD_CFG_SEQ { |
| 811 | __le16 seqNum; |
| 812 | __le16 devHandle; |
| 813 | u8 reserved[4]; |
| 814 | } __packed; |
| 815 | |
| 816 | struct MR_PD_CFG_SEQ_NUM_SYNC { |
| 817 | __le32 size; |
| 818 | __le32 count; |
| 819 | struct MR_PD_CFG_SEQ seq[1]; |
| 820 | } __packed; |
| 821 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 822 | struct fusion_context { |
| 823 | struct megasas_cmd_fusion **cmd_list; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 824 | dma_addr_t req_frames_desc_phys; |
| 825 | u8 *req_frames_desc; |
| 826 | |
| 827 | struct dma_pool *io_request_frames_pool; |
| 828 | dma_addr_t io_request_frames_phys; |
| 829 | u8 *io_request_frames; |
| 830 | |
| 831 | struct dma_pool *sg_dma_pool; |
| 832 | struct dma_pool *sense_dma_pool; |
| 833 | |
| 834 | dma_addr_t reply_frames_desc_phys; |
| 835 | union MPI2_REPLY_DESCRIPTORS_UNION *reply_frames_desc; |
| 836 | struct dma_pool *reply_frames_desc_pool; |
| 837 | |
adam radford | c8e858f | 2011-10-08 18:15:13 -0700 | [diff] [blame] | 838 | u16 last_reply_idx[MAX_MSIX_QUEUES_FUSION]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 839 | |
| 840 | u32 reply_q_depth; |
| 841 | u32 request_alloc_sz; |
| 842 | u32 reply_alloc_sz; |
| 843 | u32 io_frames_alloc_sz; |
| 844 | |
| 845 | u16 max_sge_in_main_msg; |
| 846 | u16 max_sge_in_chain; |
| 847 | |
| 848 | u8 chain_offset_io_request; |
| 849 | u8 chain_offset_mfi_pthru; |
| 850 | |
| 851 | struct MR_FW_RAID_MAP_ALL *ld_map[2]; |
| 852 | dma_addr_t ld_map_phys[2]; |
| 853 | |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 854 | /*Non dma-able memory. Driver local copy.*/ |
| 855 | struct MR_DRV_RAID_MAP_ALL *ld_drv_map[2]; |
| 856 | |
| 857 | u32 max_map_sz; |
| 858 | u32 current_map_sz; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 859 | u32 drv_map_sz; |
| 860 | u32 drv_map_pages; |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 861 | struct MR_PD_CFG_SEQ_NUM_SYNC *pd_seq_sync[JBOD_MAPS_COUNT]; |
| 862 | dma_addr_t pd_seq_phys[JBOD_MAPS_COUNT]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 863 | u8 fast_path_io; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 864 | struct LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES_EXT]; |
| 865 | LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES_EXT]; |
sumit.saxena@avagotech.com | 5a8cb85 | 2015-10-15 13:39:34 +0530 | [diff] [blame] | 866 | u8 adapter_type; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 867 | }; |
| 868 | |
| 869 | union desc_value { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 870 | __le64 word; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 871 | struct { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 872 | __le32 low; |
| 873 | __le32 high; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 874 | } u; |
| 875 | }; |
| 876 | |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 877 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 878 | #endif /* _MEGARAID_SAS_FUSION_H_ */ |