Thomas Gleixner | 1ccea77 | 2019-05-19 15:51:43 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 2 | /* |
| 3 | * Linux MegaRAID driver for SAS based RAID controllers |
| 4 | * |
Sumit.Saxena@avagotech.com | e399065 | 2014-11-17 15:24:03 +0530 | [diff] [blame] | 5 | * Copyright (c) 2009-2013 LSI Corporation |
Shivasharan S | 365597c | 2018-10-16 23:37:43 -0700 | [diff] [blame] | 6 | * Copyright (c) 2013-2016 Avago Technologies |
| 7 | * Copyright (c) 2016-2018 Broadcom Inc. |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 8 | * |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 9 | * FILE: megaraid_sas_fusion.h |
| 10 | * |
Shivasharan S | 365597c | 2018-10-16 23:37:43 -0700 | [diff] [blame] | 11 | * Authors: Broadcom Inc. |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 12 | * Manoj Jose |
| 13 | * Sumant Patro |
Shivasharan S | 365597c | 2018-10-16 23:37:43 -0700 | [diff] [blame] | 14 | * Kashyap Desai <kashyap.desai@broadcom.com> |
| 15 | * Sumit Saxena <sumit.saxena@broadcom.com> |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 16 | * |
Shivasharan S | 365597c | 2018-10-16 23:37:43 -0700 | [diff] [blame] | 17 | * Send feedback to: megaraidlinux.pdl@broadcom.com |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #ifndef _MEGARAID_SAS_FUSION_H_ |
| 21 | #define _MEGARAID_SAS_FUSION_H_ |
| 22 | |
| 23 | /* Fusion defines */ |
sumit.saxena@avagotech.com | bd5f948 | 2015-08-31 17:23:31 +0530 | [diff] [blame] | 24 | #define MEGASAS_CHAIN_FRAME_SZ_MIN 1024 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 25 | #define MFI_FUSION_ENABLE_INTERRUPT_MASK (0x00000009) |
sumit.saxena@avagotech.com | bd5f948 | 2015-08-31 17:23:31 +0530 | [diff] [blame] | 26 | #define MEGASAS_MAX_CHAIN_SHIFT 5 |
| 27 | #define MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK 0x400000 |
| 28 | #define MEGASAS_MAX_CHAIN_SIZE_MASK 0x3E0 |
| 29 | #define MEGASAS_256K_IO 128 |
| 30 | #define MEGASAS_1MB_IO (MEGASAS_256K_IO * 4) |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 31 | #define MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE 256 |
| 32 | #define MEGASAS_MPI2_FUNCTION_PASSTHRU_IO_REQUEST 0xF0 |
| 33 | #define MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST 0xF1 |
| 34 | #define MEGASAS_LOAD_BALANCE_FLAG 0x1 |
| 35 | #define MEGASAS_DCMD_MBOX_PEND_FLAG 0x1 |
| 36 | #define HOST_DIAG_WRITE_ENABLE 0x80 |
| 37 | #define HOST_DIAG_RESET_ADAPTER 0x4 |
| 38 | #define MEGASAS_FUSION_MAX_RESET_TRIES 3 |
Sumit.Saxena@lsi.com | d46a3ad | 2013-05-22 12:34:14 +0530 | [diff] [blame] | 39 | #define MAX_MSIX_QUEUES_FUSION 128 |
Shivasharan S | 107a60d | 2017-10-19 02:49:05 -0700 | [diff] [blame] | 40 | #define RDPQ_MAX_INDEX_IN_ONE_CHUNK 16 |
| 41 | #define RDPQ_MAX_CHUNK_COUNT (MAX_MSIX_QUEUES_FUSION / RDPQ_MAX_INDEX_IN_ONE_CHUNK) |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 42 | |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 43 | /* Invader defines */ |
| 44 | #define MPI2_TYPE_CUDA 0x2 |
| 45 | #define MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH 0x4000 |
| 46 | #define MR_RL_FLAGS_GRANT_DESTINATION_CPU0 0x00 |
| 47 | #define MR_RL_FLAGS_GRANT_DESTINATION_CPU1 0x10 |
| 48 | #define MR_RL_FLAGS_GRANT_DESTINATION_CUDA 0x80 |
| 49 | #define MR_RL_FLAGS_SEQ_NUM_ENABLE 0x8 |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 50 | #define MR_RL_WRITE_THROUGH_MODE 0x00 |
| 51 | #define MR_RL_WRITE_BACK_MODE 0x01 |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 52 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 53 | /* T10 PI defines */ |
| 54 | #define MR_PROT_INFO_TYPE_CONTROLLER 0x8 |
| 55 | #define MEGASAS_SCSI_VARIABLE_LENGTH_CMD 0x7f |
| 56 | #define MEGASAS_SCSI_SERVICE_ACTION_READ32 0x9 |
| 57 | #define MEGASAS_SCSI_SERVICE_ACTION_WRITE32 0xB |
| 58 | #define MEGASAS_SCSI_ADDL_CDB_LEN 0x18 |
| 59 | #define MEGASAS_RD_WR_PROTECT_CHECK_ALL 0x20 |
| 60 | #define MEGASAS_RD_WR_PROTECT_CHECK_NONE 0x60 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 61 | |
Sumit.Saxena@lsi.com | d46a3ad | 2013-05-22 12:34:14 +0530 | [diff] [blame] | 62 | #define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C) |
| 63 | #define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) |
| 64 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 65 | /* |
| 66 | * Raid context flags |
| 67 | */ |
| 68 | |
| 69 | #define MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT 0x4 |
| 70 | #define MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_MASK 0x30 |
| 71 | enum MR_RAID_FLAGS_IO_SUB_TYPE { |
| 72 | MR_RAID_FLAGS_IO_SUB_TYPE_NONE = 0, |
| 73 | MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD = 1, |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 74 | MR_RAID_FLAGS_IO_SUB_TYPE_RMW_DATA = 2, |
| 75 | MR_RAID_FLAGS_IO_SUB_TYPE_RMW_P = 3, |
| 76 | MR_RAID_FLAGS_IO_SUB_TYPE_RMW_Q = 4, |
| 77 | MR_RAID_FLAGS_IO_SUB_TYPE_CACHE_BYPASS = 6, |
Chandrakanth Patil | 7fc5570 | 2019-06-25 16:34:29 +0530 | [diff] [blame] | 78 | MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT = 7, |
| 79 | MR_RAID_FLAGS_IO_SUB_TYPE_R56_DIV_OFFLOAD = 8 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | /* |
| 83 | * Request descriptor types |
| 84 | */ |
| 85 | #define MEGASAS_REQ_DESCRIPT_FLAGS_LD_IO 0x7 |
| 86 | #define MEGASAS_REQ_DESCRIPT_FLAGS_MFA 0x1 |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 87 | #define MEGASAS_REQ_DESCRIPT_FLAGS_NO_LOCK 0x2 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 88 | #define MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT 1 |
| 89 | |
| 90 | #define MEGASAS_FP_CMD_LEN 16 |
| 91 | #define MEGASAS_FUSION_IN_RESET 0 |
Shivasharan S | a73b0a4 | 2017-02-10 00:59:38 -0800 | [diff] [blame] | 92 | #define RAID_1_PEER_CMDS 2 |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 93 | #define JBOD_MAPS_COUNT 2 |
Shivasharan S | e97e673 | 2017-10-19 02:49:03 -0700 | [diff] [blame] | 94 | #define MEGASAS_REDUCE_QD_COUNT 64 |
Shivasharan S | b9637d1 | 2017-10-19 02:49:01 -0700 | [diff] [blame] | 95 | #define IOC_INIT_FRAME_SIZE 4096 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 96 | |
| 97 | /* |
Matthias Schid | 3948ff8 | 2013-06-26 16:25:53 +0200 | [diff] [blame] | 98 | * Raid Context structure which describes MegaRAID specific IO Parameters |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 99 | * This resides at offset 0x60 where the SGL normally starts in MPT IO Frames |
| 100 | */ |
| 101 | |
| 102 | struct RAID_CONTEXT { |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 103 | #if defined(__BIG_ENDIAN_BITFIELD) |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 104 | u8 nseg:4; |
| 105 | u8 type:4; |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 106 | #else |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 107 | u8 type:4; |
| 108 | u8 nseg:4; |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 109 | #endif |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 110 | u8 resvd0; |
| 111 | __le16 timeout_value; |
| 112 | u8 reg_lock_flags; |
| 113 | u8 resvd1; |
| 114 | __le16 virtual_disk_tgt_id; |
| 115 | __le64 reg_lock_row_lba; |
| 116 | __le32 reg_lock_length; |
| 117 | __le16 next_lmid; |
| 118 | u8 ex_status; |
| 119 | u8 status; |
| 120 | u8 raid_flags; |
| 121 | u8 num_sge; |
| 122 | __le16 config_seq_num; |
| 123 | u8 span_arm; |
| 124 | u8 priority; |
| 125 | u8 num_sge_ext; |
| 126 | u8 resvd2; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 127 | }; |
| 128 | |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 129 | /* |
| 130 | * Raid Context structure which describes ventura MegaRAID specific |
| 131 | * IO Paramenters ,This resides at offset 0x60 where the SGL normally |
| 132 | * starts in MPT IO Frames |
| 133 | */ |
| 134 | struct RAID_CONTEXT_G35 { |
Shivasharan S | a174118b | 2017-02-10 00:59:21 -0800 | [diff] [blame] | 135 | #define RAID_CONTEXT_NSEG_MASK 0x00F0 |
| 136 | #define RAID_CONTEXT_NSEG_SHIFT 4 |
| 137 | #define RAID_CONTEXT_TYPE_MASK 0x000F |
| 138 | #define RAID_CONTEXT_TYPE_SHIFT 0 |
| 139 | u16 nseg_type; |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 140 | u16 timeout_value; /* 0x02 -0x03 */ |
Shivasharan S | a174118b | 2017-02-10 00:59:21 -0800 | [diff] [blame] | 141 | u16 routing_flags; // 0x04 -0x05 routing flags |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 142 | u16 virtual_disk_tgt_id; /* 0x06 -0x07 */ |
Chandrakanth Patil | 7fc5570 | 2019-06-25 16:34:29 +0530 | [diff] [blame] | 143 | __le64 reg_lock_row_lba; /* 0x08 - 0x0F */ |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 144 | u32 reg_lock_length; /* 0x10 - 0x13 */ |
Chandrakanth Patil | 7fc5570 | 2019-06-25 16:34:29 +0530 | [diff] [blame] | 145 | union { // flow specific |
| 146 | u16 rmw_op_index; /* 0x14 - 0x15, R5/6 RMW: rmw operation index*/ |
| 147 | u16 peer_smid; /* 0x14 - 0x15, R1 Write: peer smid*/ |
| 148 | u16 r56_arm_map; /* 0x14 - 0x15, Unused [15], LogArm[14:10], P-Arm[9:5], Q-Arm[4:0] */ |
| 149 | |
| 150 | } flow_specific; |
| 151 | |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 152 | u8 ex_status; /* 0x16 : OUT */ |
| 153 | u8 status; /* 0x17 status */ |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 154 | u8 raid_flags; /* 0x18 resvd[7:6], ioSubType[5:4], |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 155 | * resvd[3:1], preferredCpu[0] |
| 156 | */ |
| 157 | u8 span_arm; /* 0x1C span[7:5], arm[4:0] */ |
| 158 | u16 config_seq_num; /* 0x1A -0x1B */ |
Shivasharan S | a174118b | 2017-02-10 00:59:21 -0800 | [diff] [blame] | 159 | union { |
| 160 | /* |
| 161 | * Bit format: |
| 162 | * --------------------------------- |
| 163 | * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
| 164 | * --------------------------------- |
| 165 | * Byte0 | numSGE[7]- numSGE[0] | |
| 166 | * --------------------------------- |
| 167 | * Byte1 |SD | resvd | numSGE 8-11 | |
| 168 | * -------------------------------- |
| 169 | */ |
| 170 | #define NUM_SGE_MASK_LOWER 0xFF |
| 171 | #define NUM_SGE_MASK_UPPER 0x0F |
| 172 | #define NUM_SGE_SHIFT_UPPER 8 |
| 173 | #define STREAM_DETECT_SHIFT 7 |
| 174 | #define STREAM_DETECT_MASK 0x80 |
| 175 | struct { |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 176 | #if defined(__BIG_ENDIAN_BITFIELD) /* 0x1C - 0x1D */ |
Shivasharan S | a174118b | 2017-02-10 00:59:21 -0800 | [diff] [blame] | 177 | u16 stream_detected:1; |
| 178 | u16 reserved:3; |
| 179 | u16 num_sge:12; |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 180 | #else |
Shivasharan S | a174118b | 2017-02-10 00:59:21 -0800 | [diff] [blame] | 181 | u16 num_sge:12; |
| 182 | u16 reserved:3; |
| 183 | u16 stream_detected:1; |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 184 | #endif |
Shivasharan S | a174118b | 2017-02-10 00:59:21 -0800 | [diff] [blame] | 185 | } bits; |
| 186 | u8 bytes[2]; |
| 187 | } u; |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 188 | u8 resvd2[2]; /* 0x1E-0x1F */ |
| 189 | }; |
| 190 | |
Shivasharan S | a174118b | 2017-02-10 00:59:21 -0800 | [diff] [blame] | 191 | #define MR_RAID_CTX_ROUTINGFLAGS_SLD_SHIFT 1 |
| 192 | #define MR_RAID_CTX_ROUTINGFLAGS_C2D_SHIFT 2 |
| 193 | #define MR_RAID_CTX_ROUTINGFLAGS_FWD_SHIFT 3 |
| 194 | #define MR_RAID_CTX_ROUTINGFLAGS_SQN_SHIFT 4 |
| 195 | #define MR_RAID_CTX_ROUTINGFLAGS_SBS_SHIFT 5 |
| 196 | #define MR_RAID_CTX_ROUTINGFLAGS_RW_SHIFT 6 |
| 197 | #define MR_RAID_CTX_ROUTINGFLAGS_LOG_SHIFT 7 |
| 198 | #define MR_RAID_CTX_ROUTINGFLAGS_CPUSEL_SHIFT 8 |
| 199 | #define MR_RAID_CTX_ROUTINGFLAGS_CPUSEL_MASK 0x0F00 |
| 200 | #define MR_RAID_CTX_ROUTINGFLAGS_SETDIVERT_SHIFT 12 |
| 201 | #define MR_RAID_CTX_ROUTINGFLAGS_SETDIVERT_MASK 0xF000 |
| 202 | |
| 203 | static inline void set_num_sge(struct RAID_CONTEXT_G35 *rctx_g35, |
| 204 | u16 sge_count) |
| 205 | { |
| 206 | rctx_g35->u.bytes[0] = (u8)(sge_count & NUM_SGE_MASK_LOWER); |
| 207 | rctx_g35->u.bytes[1] |= (u8)((sge_count >> NUM_SGE_SHIFT_UPPER) |
| 208 | & NUM_SGE_MASK_UPPER); |
| 209 | } |
| 210 | |
| 211 | static inline u16 get_num_sge(struct RAID_CONTEXT_G35 *rctx_g35) |
| 212 | { |
| 213 | u16 sge_count; |
| 214 | |
| 215 | sge_count = (u16)(((rctx_g35->u.bytes[1] & NUM_SGE_MASK_UPPER) |
| 216 | << NUM_SGE_SHIFT_UPPER) | (rctx_g35->u.bytes[0])); |
| 217 | return sge_count; |
| 218 | } |
| 219 | |
| 220 | #define SET_STREAM_DETECTED(rctx_g35) \ |
| 221 | (rctx_g35.u.bytes[1] |= STREAM_DETECT_MASK) |
| 222 | |
| 223 | #define CLEAR_STREAM_DETECTED(rctx_g35) \ |
| 224 | (rctx_g35.u.bytes[1] &= ~(STREAM_DETECT_MASK)) |
| 225 | |
| 226 | static inline bool is_stream_detected(struct RAID_CONTEXT_G35 *rctx_g35) |
| 227 | { |
| 228 | return ((rctx_g35->u.bytes[1] & STREAM_DETECT_MASK)); |
| 229 | } |
| 230 | |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 231 | union RAID_CONTEXT_UNION { |
| 232 | struct RAID_CONTEXT raid_context; |
| 233 | struct RAID_CONTEXT_G35 raid_context_g35; |
| 234 | }; |
| 235 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 236 | #define RAID_CTX_SPANARM_ARM_SHIFT (0) |
| 237 | #define RAID_CTX_SPANARM_ARM_MASK (0x1f) |
| 238 | |
| 239 | #define RAID_CTX_SPANARM_SPAN_SHIFT (5) |
| 240 | #define RAID_CTX_SPANARM_SPAN_MASK (0xE0) |
| 241 | |
Chandrakanth Patil | 7fc5570 | 2019-06-25 16:34:29 +0530 | [diff] [blame] | 242 | /* LogArm[14:10], P-Arm[9:5], Q-Arm[4:0] */ |
| 243 | #define RAID_CTX_R56_Q_ARM_MASK (0x1F) |
| 244 | #define RAID_CTX_R56_P_ARM_SHIFT (5) |
| 245 | #define RAID_CTX_R56_P_ARM_MASK (0x3E0) |
| 246 | #define RAID_CTX_R56_LOG_ARM_SHIFT (10) |
| 247 | #define RAID_CTX_R56_LOG_ARM_MASK (0x7C00) |
| 248 | |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 249 | /* number of bits per index in U32 TrackStream */ |
| 250 | #define BITS_PER_INDEX_STREAM 4 |
| 251 | #define INVALID_STREAM_NUM 16 |
| 252 | #define MR_STREAM_BITMAP 0x76543210 |
| 253 | #define STREAM_MASK ((1 << BITS_PER_INDEX_STREAM) - 1) |
| 254 | #define ZERO_LAST_STREAM 0x0fffffff |
| 255 | #define MAX_STREAMS_TRACKED 8 |
| 256 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 257 | /* |
| 258 | * define region lock types |
| 259 | */ |
| 260 | enum REGION_TYPE { |
| 261 | REGION_TYPE_UNUSED = 0, |
| 262 | REGION_TYPE_SHARED_READ = 1, |
| 263 | REGION_TYPE_SHARED_WRITE = 2, |
| 264 | REGION_TYPE_EXCLUSIVE = 3, |
| 265 | }; |
| 266 | |
| 267 | /* MPI2 defines */ |
| 268 | #define MPI2_FUNCTION_IOC_INIT (0x02) /* IOC Init */ |
| 269 | #define MPI2_WHOINIT_HOST_DRIVER (0x04) |
| 270 | #define MPI2_VERSION_MAJOR (0x02) |
| 271 | #define MPI2_VERSION_MINOR (0x00) |
| 272 | #define MPI2_VERSION_MAJOR_MASK (0xFF00) |
| 273 | #define MPI2_VERSION_MAJOR_SHIFT (8) |
| 274 | #define MPI2_VERSION_MINOR_MASK (0x00FF) |
| 275 | #define MPI2_VERSION_MINOR_SHIFT (0) |
| 276 | #define MPI2_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \ |
| 277 | MPI2_VERSION_MINOR) |
| 278 | #define MPI2_HEADER_VERSION_UNIT (0x10) |
| 279 | #define MPI2_HEADER_VERSION_DEV (0x00) |
| 280 | #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) |
| 281 | #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) |
| 282 | #define MPI2_HEADER_VERSION_DEV_MASK (0x00FF) |
| 283 | #define MPI2_HEADER_VERSION_DEV_SHIFT (0) |
| 284 | #define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | \ |
| 285 | MPI2_HEADER_VERSION_DEV) |
| 286 | #define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) |
| 287 | #define MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG (0x8000) |
| 288 | #define MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG (0x0400) |
| 289 | #define MPI2_SCSIIO_EEDPFLAGS_CHECK_REMOVE_OP (0x0003) |
| 290 | #define MPI2_SCSIIO_EEDPFLAGS_CHECK_APPTAG (0x0200) |
| 291 | #define MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD (0x0100) |
| 292 | #define MPI2_SCSIIO_EEDPFLAGS_INSERT_OP (0x0004) |
Sasikumar Chandrasekaran | 45d4460 | 2017-01-10 18:20:45 -0500 | [diff] [blame] | 293 | /* EEDP escape mode */ |
| 294 | #define MPI25_SCSIIO_EEDPFLAGS_DO_NOT_DISABLE_MODE (0x0040) |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 295 | #define MPI2_FUNCTION_SCSI_IO_REQUEST (0x00) /* SCSI IO */ |
Sumit Saxena | 18365b1 | 2016-01-28 21:04:25 +0530 | [diff] [blame] | 296 | #define MPI2_FUNCTION_SCSI_TASK_MGMT (0x01) |
Sumit Saxena | 2c04835 | 2016-01-28 21:04:24 +0530 | [diff] [blame] | 297 | #define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY (0x03) |
| 298 | #define MPI2_REQ_DESCRIPT_FLAGS_FP_IO (0x06) |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 299 | #define MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO (0x00) |
| 300 | #define MPI2_SGE_FLAGS_64_BIT_ADDRESSING (0x02) |
| 301 | #define MPI2_SCSIIO_CONTROL_WRITE (0x01000000) |
| 302 | #define MPI2_SCSIIO_CONTROL_READ (0x02000000) |
| 303 | #define MPI2_REQ_DESCRIPT_FLAGS_TYPE_MASK (0x0E) |
| 304 | #define MPI2_RPY_DESCRIPT_FLAGS_UNUSED (0x0F) |
| 305 | #define MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS (0x00) |
| 306 | #define MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK (0x0F) |
| 307 | #define MPI2_WRSEQ_FLUSH_KEY_VALUE (0x0) |
| 308 | #define MPI2_WRITE_SEQUENCE_OFFSET (0x00000004) |
| 309 | #define MPI2_WRSEQ_1ST_KEY_VALUE (0xF) |
| 310 | #define MPI2_WRSEQ_2ND_KEY_VALUE (0x4) |
| 311 | #define MPI2_WRSEQ_3RD_KEY_VALUE (0xB) |
| 312 | #define MPI2_WRSEQ_4TH_KEY_VALUE (0x2) |
| 313 | #define MPI2_WRSEQ_5TH_KEY_VALUE (0x7) |
| 314 | #define MPI2_WRSEQ_6TH_KEY_VALUE (0xD) |
| 315 | |
| 316 | struct MPI25_IEEE_SGE_CHAIN64 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 317 | __le64 Address; |
| 318 | __le32 Length; |
| 319 | __le16 Reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 320 | u8 NextChainOffset; |
| 321 | u8 Flags; |
| 322 | }; |
| 323 | |
| 324 | struct MPI2_SGE_SIMPLE_UNION { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 325 | __le32 FlagsLength; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 326 | union { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 327 | __le32 Address32; |
| 328 | __le64 Address64; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 329 | } u; |
| 330 | }; |
| 331 | |
| 332 | struct MPI2_SCSI_IO_CDB_EEDP32 { |
| 333 | u8 CDB[20]; /* 0x00 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 334 | __be32 PrimaryReferenceTag; /* 0x14 */ |
| 335 | __be16 PrimaryApplicationTag; /* 0x18 */ |
| 336 | __be16 PrimaryApplicationTagMask; /* 0x1A */ |
| 337 | __le32 TransferLength; /* 0x1C */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 338 | }; |
| 339 | |
| 340 | struct MPI2_SGE_CHAIN_UNION { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 341 | __le16 Length; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 342 | u8 NextChainOffset; |
| 343 | u8 Flags; |
| 344 | union { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 345 | __le32 Address32; |
| 346 | __le64 Address64; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 347 | } u; |
| 348 | }; |
| 349 | |
| 350 | struct MPI2_IEEE_SGE_SIMPLE32 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 351 | __le32 Address; |
| 352 | __le32 FlagsLength; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 353 | }; |
| 354 | |
| 355 | struct MPI2_IEEE_SGE_CHAIN32 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 356 | __le32 Address; |
| 357 | __le32 FlagsLength; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 358 | }; |
| 359 | |
| 360 | struct MPI2_IEEE_SGE_SIMPLE64 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 361 | __le64 Address; |
| 362 | __le32 Length; |
| 363 | __le16 Reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 364 | u8 Reserved2; |
| 365 | u8 Flags; |
| 366 | }; |
| 367 | |
| 368 | struct MPI2_IEEE_SGE_CHAIN64 { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 369 | __le64 Address; |
| 370 | __le32 Length; |
| 371 | __le16 Reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 372 | u8 Reserved2; |
| 373 | u8 Flags; |
| 374 | }; |
| 375 | |
| 376 | union MPI2_IEEE_SGE_SIMPLE_UNION { |
| 377 | struct MPI2_IEEE_SGE_SIMPLE32 Simple32; |
| 378 | struct MPI2_IEEE_SGE_SIMPLE64 Simple64; |
| 379 | }; |
| 380 | |
| 381 | union MPI2_IEEE_SGE_CHAIN_UNION { |
| 382 | struct MPI2_IEEE_SGE_CHAIN32 Chain32; |
| 383 | struct MPI2_IEEE_SGE_CHAIN64 Chain64; |
| 384 | }; |
| 385 | |
| 386 | union MPI2_SGE_IO_UNION { |
| 387 | struct MPI2_SGE_SIMPLE_UNION MpiSimple; |
| 388 | struct MPI2_SGE_CHAIN_UNION MpiChain; |
| 389 | union MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; |
| 390 | union MPI2_IEEE_SGE_CHAIN_UNION IeeeChain; |
| 391 | }; |
| 392 | |
| 393 | union MPI2_SCSI_IO_CDB_UNION { |
| 394 | u8 CDB32[32]; |
| 395 | struct MPI2_SCSI_IO_CDB_EEDP32 EEDP32; |
| 396 | struct MPI2_SGE_SIMPLE_UNION SGE; |
| 397 | }; |
| 398 | |
Sumit Saxena | 18365b1 | 2016-01-28 21:04:25 +0530 | [diff] [blame] | 399 | /**************************************************************************** |
| 400 | * SCSI Task Management messages |
| 401 | ****************************************************************************/ |
| 402 | |
| 403 | /*SCSI Task Management Request Message */ |
| 404 | struct MPI2_SCSI_TASK_MANAGE_REQUEST { |
| 405 | u16 DevHandle; /*0x00 */ |
| 406 | u8 ChainOffset; /*0x02 */ |
| 407 | u8 Function; /*0x03 */ |
| 408 | u8 Reserved1; /*0x04 */ |
| 409 | u8 TaskType; /*0x05 */ |
| 410 | u8 Reserved2; /*0x06 */ |
| 411 | u8 MsgFlags; /*0x07 */ |
| 412 | u8 VP_ID; /*0x08 */ |
| 413 | u8 VF_ID; /*0x09 */ |
| 414 | u16 Reserved3; /*0x0A */ |
| 415 | u8 LUN[8]; /*0x0C */ |
| 416 | u32 Reserved4[7]; /*0x14 */ |
| 417 | u16 TaskMID; /*0x30 */ |
| 418 | u16 Reserved5; /*0x32 */ |
| 419 | }; |
| 420 | |
| 421 | |
| 422 | /*SCSI Task Management Reply Message */ |
| 423 | struct MPI2_SCSI_TASK_MANAGE_REPLY { |
| 424 | u16 DevHandle; /*0x00 */ |
| 425 | u8 MsgLength; /*0x02 */ |
| 426 | u8 Function; /*0x03 */ |
| 427 | u8 ResponseCode; /*0x04 */ |
| 428 | u8 TaskType; /*0x05 */ |
| 429 | u8 Reserved1; /*0x06 */ |
| 430 | u8 MsgFlags; /*0x07 */ |
| 431 | u8 VP_ID; /*0x08 */ |
| 432 | u8 VF_ID; /*0x09 */ |
| 433 | u16 Reserved2; /*0x0A */ |
| 434 | u16 Reserved3; /*0x0C */ |
| 435 | u16 IOCStatus; /*0x0E */ |
| 436 | u32 IOCLogInfo; /*0x10 */ |
| 437 | u32 TerminationCount; /*0x14 */ |
| 438 | u32 ResponseInfo; /*0x18 */ |
| 439 | }; |
| 440 | |
| 441 | struct MR_TM_REQUEST { |
| 442 | char request[128]; |
| 443 | }; |
| 444 | |
| 445 | struct MR_TM_REPLY { |
| 446 | char reply[128]; |
| 447 | }; |
| 448 | |
| 449 | /* SCSI Task Management Request Message */ |
| 450 | struct MR_TASK_MANAGE_REQUEST { |
| 451 | /*To be type casted to struct MPI2_SCSI_TASK_MANAGE_REQUEST */ |
| 452 | struct MR_TM_REQUEST TmRequest; |
| 453 | union { |
| 454 | struct { |
| 455 | #if defined(__BIG_ENDIAN_BITFIELD) |
| 456 | u32 reserved1:30; |
| 457 | u32 isTMForPD:1; |
| 458 | u32 isTMForLD:1; |
| 459 | #else |
| 460 | u32 isTMForLD:1; |
| 461 | u32 isTMForPD:1; |
| 462 | u32 reserved1:30; |
| 463 | #endif |
| 464 | u32 reserved2; |
| 465 | } tmReqFlags; |
| 466 | struct MR_TM_REPLY TMReply; |
| 467 | }; |
| 468 | }; |
| 469 | |
| 470 | /* TaskType values */ |
| 471 | |
| 472 | #define MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK (0x01) |
| 473 | #define MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET (0x02) |
| 474 | #define MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET (0x03) |
| 475 | #define MPI2_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05) |
| 476 | #define MPI2_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET (0x06) |
| 477 | #define MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK (0x07) |
| 478 | #define MPI2_SCSITASKMGMT_TASKTYPE_CLR_ACA (0x08) |
| 479 | #define MPI2_SCSITASKMGMT_TASKTYPE_QRY_TASK_SET (0x09) |
| 480 | #define MPI2_SCSITASKMGMT_TASKTYPE_QRY_ASYNC_EVENT (0x0A) |
| 481 | |
| 482 | /* ResponseCode values */ |
| 483 | |
| 484 | #define MPI2_SCSITASKMGMT_RSP_TM_COMPLETE (0x00) |
| 485 | #define MPI2_SCSITASKMGMT_RSP_INVALID_FRAME (0x02) |
| 486 | #define MPI2_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED (0x04) |
| 487 | #define MPI2_SCSITASKMGMT_RSP_TM_FAILED (0x05) |
| 488 | #define MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED (0x08) |
| 489 | #define MPI2_SCSITASKMGMT_RSP_TM_INVALID_LUN (0x09) |
| 490 | #define MPI2_SCSITASKMGMT_RSP_TM_OVERLAPPED_TAG (0x0A) |
| 491 | #define MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC (0x80) |
| 492 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 493 | /* |
| 494 | * RAID SCSI IO Request Message |
| 495 | * Total SGE count will be one less than _MPI2_SCSI_IO_REQUEST |
| 496 | */ |
| 497 | struct MPI2_RAID_SCSI_IO_REQUEST { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 498 | __le16 DevHandle; /* 0x00 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 499 | u8 ChainOffset; /* 0x02 */ |
| 500 | u8 Function; /* 0x03 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 501 | __le16 Reserved1; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 502 | u8 Reserved2; /* 0x06 */ |
| 503 | u8 MsgFlags; /* 0x07 */ |
| 504 | u8 VP_ID; /* 0x08 */ |
| 505 | u8 VF_ID; /* 0x09 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 506 | __le16 Reserved3; /* 0x0A */ |
| 507 | __le32 SenseBufferLowAddress; /* 0x0C */ |
| 508 | __le16 SGLFlags; /* 0x10 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 509 | u8 SenseBufferLength; /* 0x12 */ |
| 510 | u8 Reserved4; /* 0x13 */ |
| 511 | u8 SGLOffset0; /* 0x14 */ |
| 512 | u8 SGLOffset1; /* 0x15 */ |
| 513 | u8 SGLOffset2; /* 0x16 */ |
| 514 | u8 SGLOffset3; /* 0x17 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 515 | __le32 SkipCount; /* 0x18 */ |
| 516 | __le32 DataLength; /* 0x1C */ |
| 517 | __le32 BidirectionalDataLength; /* 0x20 */ |
| 518 | __le16 IoFlags; /* 0x24 */ |
| 519 | __le16 EEDPFlags; /* 0x26 */ |
| 520 | __le32 EEDPBlockSize; /* 0x28 */ |
| 521 | __le32 SecondaryReferenceTag; /* 0x2C */ |
| 522 | __le16 SecondaryApplicationTag; /* 0x30 */ |
| 523 | __le16 ApplicationTagTranslationMask; /* 0x32 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 524 | u8 LUN[8]; /* 0x34 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 525 | __le32 Control; /* 0x3C */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 526 | union MPI2_SCSI_IO_CDB_UNION CDB; /* 0x40 */ |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 527 | union RAID_CONTEXT_UNION RaidContext; /* 0x60 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 528 | union MPI2_SGE_IO_UNION SGL; /* 0x80 */ |
| 529 | }; |
| 530 | |
| 531 | /* |
| 532 | * MPT RAID MFA IO Descriptor. |
| 533 | */ |
| 534 | struct MEGASAS_RAID_MFA_IO_REQUEST_DESCRIPTOR { |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 535 | u32 RequestFlags:8; |
Sumit.Saxena@avagotech.com | 200aed5 | 2015-01-05 20:05:58 +0530 | [diff] [blame] | 536 | u32 MessageAddress1:24; |
| 537 | u32 MessageAddress2; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 538 | }; |
| 539 | |
| 540 | /* Default Request Descriptor */ |
| 541 | struct MPI2_DEFAULT_REQUEST_DESCRIPTOR { |
| 542 | u8 RequestFlags; /* 0x00 */ |
| 543 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 544 | __le16 SMID; /* 0x02 */ |
| 545 | __le16 LMID; /* 0x04 */ |
| 546 | __le16 DescriptorTypeDependent; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 547 | }; |
| 548 | |
| 549 | /* High Priority Request Descriptor */ |
| 550 | struct MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR { |
| 551 | u8 RequestFlags; /* 0x00 */ |
| 552 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 553 | __le16 SMID; /* 0x02 */ |
| 554 | __le16 LMID; /* 0x04 */ |
| 555 | __le16 Reserved1; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 556 | }; |
| 557 | |
| 558 | /* SCSI IO Request Descriptor */ |
| 559 | struct MPI2_SCSI_IO_REQUEST_DESCRIPTOR { |
| 560 | u8 RequestFlags; /* 0x00 */ |
| 561 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 562 | __le16 SMID; /* 0x02 */ |
| 563 | __le16 LMID; /* 0x04 */ |
| 564 | __le16 DevHandle; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 565 | }; |
| 566 | |
| 567 | /* SCSI Target Request Descriptor */ |
| 568 | struct MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR { |
| 569 | u8 RequestFlags; /* 0x00 */ |
| 570 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 571 | __le16 SMID; /* 0x02 */ |
| 572 | __le16 LMID; /* 0x04 */ |
| 573 | __le16 IoIndex; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 574 | }; |
| 575 | |
| 576 | /* RAID Accelerator Request Descriptor */ |
| 577 | struct MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR { |
| 578 | u8 RequestFlags; /* 0x00 */ |
| 579 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 580 | __le16 SMID; /* 0x02 */ |
| 581 | __le16 LMID; /* 0x04 */ |
| 582 | __le16 Reserved; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 583 | }; |
| 584 | |
| 585 | /* union of Request Descriptors */ |
| 586 | union MEGASAS_REQUEST_DESCRIPTOR_UNION { |
| 587 | struct MPI2_DEFAULT_REQUEST_DESCRIPTOR Default; |
| 588 | struct MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR HighPriority; |
| 589 | struct MPI2_SCSI_IO_REQUEST_DESCRIPTOR SCSIIO; |
| 590 | struct MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR SCSITarget; |
| 591 | struct MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR RAIDAccelerator; |
| 592 | struct MEGASAS_RAID_MFA_IO_REQUEST_DESCRIPTOR MFAIo; |
| 593 | union { |
| 594 | struct { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 595 | __le32 low; |
| 596 | __le32 high; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 597 | } u; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 598 | __le64 Words; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 599 | }; |
| 600 | }; |
| 601 | |
| 602 | /* Default Reply Descriptor */ |
| 603 | struct MPI2_DEFAULT_REPLY_DESCRIPTOR { |
| 604 | u8 ReplyFlags; /* 0x00 */ |
| 605 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 606 | __le16 DescriptorTypeDependent1; /* 0x02 */ |
| 607 | __le32 DescriptorTypeDependent2; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 608 | }; |
| 609 | |
| 610 | /* Address Reply Descriptor */ |
| 611 | struct MPI2_ADDRESS_REPLY_DESCRIPTOR { |
| 612 | u8 ReplyFlags; /* 0x00 */ |
| 613 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 614 | __le16 SMID; /* 0x02 */ |
| 615 | __le32 ReplyFrameAddress; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 616 | }; |
| 617 | |
| 618 | /* SCSI IO Success Reply Descriptor */ |
| 619 | struct MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR { |
| 620 | u8 ReplyFlags; /* 0x00 */ |
| 621 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 622 | __le16 SMID; /* 0x02 */ |
| 623 | __le16 TaskTag; /* 0x04 */ |
| 624 | __le16 Reserved1; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 625 | }; |
| 626 | |
| 627 | /* TargetAssist Success Reply Descriptor */ |
| 628 | struct MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR { |
| 629 | u8 ReplyFlags; /* 0x00 */ |
| 630 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 631 | __le16 SMID; /* 0x02 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 632 | u8 SequenceNumber; /* 0x04 */ |
| 633 | u8 Reserved1; /* 0x05 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 634 | __le16 IoIndex; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 635 | }; |
| 636 | |
| 637 | /* Target Command Buffer Reply Descriptor */ |
| 638 | struct MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR { |
| 639 | u8 ReplyFlags; /* 0x00 */ |
| 640 | u8 MSIxIndex; /* 0x01 */ |
| 641 | u8 VP_ID; /* 0x02 */ |
| 642 | u8 Flags; /* 0x03 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 643 | __le16 InitiatorDevHandle; /* 0x04 */ |
| 644 | __le16 IoIndex; /* 0x06 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 645 | }; |
| 646 | |
| 647 | /* RAID Accelerator Success Reply Descriptor */ |
| 648 | struct MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR { |
| 649 | u8 ReplyFlags; /* 0x00 */ |
| 650 | u8 MSIxIndex; /* 0x01 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 651 | __le16 SMID; /* 0x02 */ |
| 652 | __le32 Reserved; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 653 | }; |
| 654 | |
| 655 | /* union of Reply Descriptors */ |
| 656 | union MPI2_REPLY_DESCRIPTORS_UNION { |
| 657 | struct MPI2_DEFAULT_REPLY_DESCRIPTOR Default; |
| 658 | struct MPI2_ADDRESS_REPLY_DESCRIPTOR AddressReply; |
| 659 | struct MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR SCSIIOSuccess; |
| 660 | struct MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR TargetAssistSuccess; |
| 661 | struct MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR TargetCommandBuffer; |
| 662 | struct MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR |
| 663 | RAIDAcceleratorSuccess; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 664 | __le64 Words; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 665 | }; |
| 666 | |
| 667 | /* IOCInit Request message */ |
| 668 | struct MPI2_IOC_INIT_REQUEST { |
| 669 | u8 WhoInit; /* 0x00 */ |
| 670 | u8 Reserved1; /* 0x01 */ |
| 671 | u8 ChainOffset; /* 0x02 */ |
| 672 | u8 Function; /* 0x03 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 673 | __le16 Reserved2; /* 0x04 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 674 | u8 Reserved3; /* 0x06 */ |
| 675 | u8 MsgFlags; /* 0x07 */ |
| 676 | u8 VP_ID; /* 0x08 */ |
| 677 | u8 VF_ID; /* 0x09 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 678 | __le16 Reserved4; /* 0x0A */ |
| 679 | __le16 MsgVersion; /* 0x0C */ |
| 680 | __le16 HeaderVersion; /* 0x0E */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 681 | u32 Reserved5; /* 0x10 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 682 | __le16 Reserved6; /* 0x14 */ |
Shivasharan S | 15dd038 | 2017-02-10 00:59:10 -0800 | [diff] [blame] | 683 | u8 HostPageSize; /* 0x16 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 684 | u8 HostMSIxVectors; /* 0x17 */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 685 | __le16 Reserved8; /* 0x18 */ |
| 686 | __le16 SystemRequestFrameSize; /* 0x1A */ |
| 687 | __le16 ReplyDescriptorPostQueueDepth; /* 0x1C */ |
| 688 | __le16 ReplyFreeQueueDepth; /* 0x1E */ |
| 689 | __le32 SenseBufferAddressHigh; /* 0x20 */ |
| 690 | __le32 SystemReplyAddressHigh; /* 0x24 */ |
| 691 | __le64 SystemRequestFrameBaseAddress; /* 0x28 */ |
| 692 | __le64 ReplyDescriptorPostQueueAddress;/* 0x30 */ |
| 693 | __le64 ReplyFreeQueueAddress; /* 0x38 */ |
| 694 | __le64 TimeStamp; /* 0x40 */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 695 | }; |
| 696 | |
| 697 | /* mrpriv defines */ |
| 698 | #define MR_PD_INVALID 0xFFFF |
Shivasharan S | 8bf7c65 | 2017-02-10 00:59:03 -0800 | [diff] [blame] | 699 | #define MR_DEVHANDLE_INVALID 0xFFFF |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 700 | #define MAX_SPAN_DEPTH 8 |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 701 | #define MAX_QUAD_DEPTH MAX_SPAN_DEPTH |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 702 | #define MAX_RAIDMAP_SPAN_DEPTH (MAX_SPAN_DEPTH) |
| 703 | #define MAX_ROW_SIZE 32 |
| 704 | #define MAX_RAIDMAP_ROW_SIZE (MAX_ROW_SIZE) |
| 705 | #define MAX_LOGICAL_DRIVES 64 |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 706 | #define MAX_LOGICAL_DRIVES_EXT 256 |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 707 | #define MAX_LOGICAL_DRIVES_DYN 512 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 708 | #define MAX_RAIDMAP_LOGICAL_DRIVES (MAX_LOGICAL_DRIVES) |
| 709 | #define MAX_RAIDMAP_VIEWS (MAX_LOGICAL_DRIVES) |
| 710 | #define MAX_ARRAYS 128 |
| 711 | #define MAX_RAIDMAP_ARRAYS (MAX_ARRAYS) |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 712 | #define MAX_ARRAYS_EXT 256 |
| 713 | #define MAX_API_ARRAYS_EXT (MAX_ARRAYS_EXT) |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 714 | #define MAX_API_ARRAYS_DYN 512 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 715 | #define MAX_PHYSICAL_DEVICES 256 |
| 716 | #define MAX_RAIDMAP_PHYSICAL_DEVICES (MAX_PHYSICAL_DEVICES) |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 717 | #define MAX_RAIDMAP_PHYSICAL_DEVICES_DYN 512 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 718 | #define MR_DCMD_LD_MAP_GET_INFO 0x0300e101 |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 719 | #define MR_DCMD_SYSTEM_PD_MAP_GET_INFO 0x0200e102 |
Shivasharan S | 96188a8 | 2017-02-10 00:59:11 -0800 | [diff] [blame] | 720 | #define MR_DCMD_DRV_GET_TARGET_PROP 0x0200e103 |
adam radford | 229fe47 | 2014-03-10 02:51:56 -0700 | [diff] [blame] | 721 | #define MR_DCMD_CTRL_SHARED_HOST_MEM_ALLOC 0x010e8485 /* SR-IOV HB alloc*/ |
| 722 | #define MR_DCMD_LD_VF_MAP_GET_ALL_LDS_111 0x03200200 |
| 723 | #define MR_DCMD_LD_VF_MAP_GET_ALL_LDS 0x03150200 |
Shivasharan S | f0c21df | 2018-10-16 23:37:40 -0700 | [diff] [blame] | 724 | #define MR_DCMD_CTRL_SNAPDUMP_GET_PROPERTIES 0x01200100 |
Shivasharan S | f6fe573 | 2019-01-29 01:38:14 -0800 | [diff] [blame] | 725 | #define MR_DCMD_CTRL_DEVICE_LIST_GET 0x01190600 |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 726 | |
| 727 | struct MR_DEV_HANDLE_INFO { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 728 | __le16 curDevHdl; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 729 | u8 validHandles; |
Shivasharan S | 33203bc | 2017-02-10 00:59:12 -0800 | [diff] [blame] | 730 | u8 interfaceType; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 731 | __le16 devHandle[2]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 732 | }; |
| 733 | |
| 734 | struct MR_ARRAY_INFO { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 735 | __le16 pd[MAX_RAIDMAP_ROW_SIZE]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 736 | }; |
| 737 | |
| 738 | struct MR_QUAD_ELEMENT { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 739 | __le64 logStart; |
| 740 | __le64 logEnd; |
| 741 | __le64 offsetInSpan; |
| 742 | __le32 diff; |
| 743 | __le32 reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 744 | }; |
| 745 | |
| 746 | struct MR_SPAN_INFO { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 747 | __le32 noElements; |
| 748 | __le32 reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 749 | struct MR_QUAD_ELEMENT quad[MAX_RAIDMAP_SPAN_DEPTH]; |
| 750 | }; |
| 751 | |
| 752 | struct MR_LD_SPAN { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 753 | __le64 startBlk; |
| 754 | __le64 numBlks; |
| 755 | __le16 arrayRef; |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 756 | u8 spanRowSize; |
| 757 | u8 spanRowDataSize; |
| 758 | u8 reserved[4]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 759 | }; |
| 760 | |
| 761 | struct MR_SPAN_BLOCK_INFO { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 762 | __le64 num_rows; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 763 | struct MR_LD_SPAN span; |
| 764 | struct MR_SPAN_INFO block_span_info; |
| 765 | }; |
| 766 | |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 767 | #define MR_RAID_CTX_CPUSEL_0 0 |
| 768 | #define MR_RAID_CTX_CPUSEL_1 1 |
| 769 | #define MR_RAID_CTX_CPUSEL_2 2 |
| 770 | #define MR_RAID_CTX_CPUSEL_3 3 |
| 771 | #define MR_RAID_CTX_CPUSEL_FCFS 0xF |
| 772 | |
| 773 | struct MR_CPU_AFFINITY_MASK { |
| 774 | union { |
| 775 | struct { |
| 776 | #ifndef MFI_BIG_ENDIAN |
| 777 | u8 hw_path:1; |
| 778 | u8 cpu0:1; |
| 779 | u8 cpu1:1; |
| 780 | u8 cpu2:1; |
| 781 | u8 cpu3:1; |
| 782 | u8 reserved:3; |
| 783 | #else |
| 784 | u8 reserved:3; |
| 785 | u8 cpu3:1; |
| 786 | u8 cpu2:1; |
| 787 | u8 cpu1:1; |
| 788 | u8 cpu0:1; |
| 789 | u8 hw_path:1; |
| 790 | #endif |
| 791 | }; |
| 792 | u8 core_mask; |
| 793 | }; |
| 794 | }; |
| 795 | |
| 796 | struct MR_IO_AFFINITY { |
| 797 | union { |
| 798 | struct { |
| 799 | struct MR_CPU_AFFINITY_MASK pdRead; |
| 800 | struct MR_CPU_AFFINITY_MASK pdWrite; |
| 801 | struct MR_CPU_AFFINITY_MASK ldRead; |
| 802 | struct MR_CPU_AFFINITY_MASK ldWrite; |
| 803 | }; |
| 804 | u32 word; |
| 805 | }; |
| 806 | u8 maxCores; /* Total cores + HW Path in ROC */ |
| 807 | u8 reserved[3]; |
| 808 | }; |
| 809 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 810 | struct MR_LD_RAID { |
| 811 | struct { |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 812 | #if defined(__BIG_ENDIAN_BITFIELD) |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 813 | u32 reserved4:2; |
| 814 | u32 fp_cache_bypass_capable:1; |
| 815 | u32 fp_rmw_capable:1; |
| 816 | u32 disable_coalescing:1; |
Sumit Saxena | 8f05024 | 2016-01-28 21:04:27 +0530 | [diff] [blame] | 817 | u32 fpBypassRegionLock:1; |
Sumit Saxena | 18365b1 | 2016-01-28 21:04:25 +0530 | [diff] [blame] | 818 | u32 tmCapable:1; |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 819 | u32 fpNonRWCapable:1; |
| 820 | u32 fpReadAcrossStripe:1; |
| 821 | u32 fpWriteAcrossStripe:1; |
| 822 | u32 fpReadCapable:1; |
| 823 | u32 fpWriteCapable:1; |
| 824 | u32 encryptionType:8; |
| 825 | u32 pdPiMode:4; |
| 826 | u32 ldPiMode:4; |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 827 | u32 reserved5:2; |
| 828 | u32 ra_capable:1; |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 829 | u32 fpCapable:1; |
| 830 | #else |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 831 | u32 fpCapable:1; |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 832 | u32 ra_capable:1; |
| 833 | u32 reserved5:2; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 834 | u32 ldPiMode:4; |
| 835 | u32 pdPiMode:4; |
| 836 | u32 encryptionType:8; |
| 837 | u32 fpWriteCapable:1; |
| 838 | u32 fpReadCapable:1; |
| 839 | u32 fpWriteAcrossStripe:1; |
| 840 | u32 fpReadAcrossStripe:1; |
adam radford | 21c9e16 | 2013-09-06 15:27:14 -0700 | [diff] [blame] | 841 | u32 fpNonRWCapable:1; |
Sumit Saxena | 18365b1 | 2016-01-28 21:04:25 +0530 | [diff] [blame] | 842 | u32 tmCapable:1; |
Sumit Saxena | 8f05024 | 2016-01-28 21:04:27 +0530 | [diff] [blame] | 843 | u32 fpBypassRegionLock:1; |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 844 | u32 disable_coalescing:1; |
| 845 | u32 fp_rmw_capable:1; |
| 846 | u32 fp_cache_bypass_capable:1; |
| 847 | u32 reserved4:2; |
Sumit.Saxena@lsi.com | 94cd65d | 2013-09-06 15:50:52 +0530 | [diff] [blame] | 848 | #endif |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 849 | } capability; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 850 | __le32 reserved6; |
| 851 | __le64 size; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 852 | u8 spanDepth; |
| 853 | u8 level; |
| 854 | u8 stripeShift; |
| 855 | u8 rowSize; |
| 856 | u8 rowDataSize; |
| 857 | u8 writeMode; |
| 858 | u8 PRL; |
| 859 | u8 SRL; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 860 | __le16 targetId; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 861 | u8 ldState; |
| 862 | u8 regTypeReqOnWrite; |
| 863 | u8 modFactor; |
adam radford | 36807e6 | 2011-10-08 18:15:06 -0700 | [diff] [blame] | 864 | u8 regTypeReqOnRead; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 865 | __le16 seqNum; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 866 | |
Anand Lodnoor | a7faf81 | 2020-01-14 16:51:13 +0530 | [diff] [blame] | 867 | struct { |
| 868 | #ifndef MFI_BIG_ENDIAN |
| 869 | u32 ldSyncRequired:1; |
| 870 | u32 regTypeReqOnReadIsValid:1; |
| 871 | u32 isEPD:1; |
| 872 | u32 enableSLDOnAllRWIOs:1; |
| 873 | u32 reserved:28; |
| 874 | #else |
| 875 | u32 reserved:28; |
| 876 | u32 enableSLDOnAllRWIOs:1; |
| 877 | u32 isEPD:1; |
| 878 | u32 regTypeReqOnReadIsValid:1; |
| 879 | u32 ldSyncRequired:1; |
| 880 | #endif |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 881 | } flags; |
| 882 | |
adam radford | 21c9e16 | 2013-09-06 15:27:14 -0700 | [diff] [blame] | 883 | u8 LUN[8]; /* 0x24 8 byte LUN field used for SCSI IO's */ |
| 884 | u8 fpIoTimeoutForLd;/*0x2C timeout value used by driver in FP IO*/ |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 885 | /* Ox2D This LD accept priority boost of this type */ |
| 886 | u8 ld_accept_priority_type; |
| 887 | u8 reserved2[2]; /* 0x2E - 0x2F */ |
| 888 | /* 0x30 - 0x33, Logical block size for the LD */ |
| 889 | u32 logical_block_length; |
| 890 | struct { |
| 891 | #ifndef MFI_BIG_ENDIAN |
| 892 | /* 0x34, P_I_EXPONENT from READ CAPACITY 16 */ |
| 893 | u32 ld_pi_exp:4; |
| 894 | /* 0x34, LOGICAL BLOCKS PER PHYSICAL |
| 895 | * BLOCK EXPONENT from READ CAPACITY 16 |
| 896 | */ |
| 897 | u32 ld_logical_block_exp:4; |
| 898 | u32 reserved1:24; /* 0x34 */ |
| 899 | #else |
| 900 | u32 reserved1:24; /* 0x34 */ |
| 901 | /* 0x34, LOGICAL BLOCKS PER PHYSICAL |
| 902 | * BLOCK EXPONENT from READ CAPACITY 16 |
| 903 | */ |
| 904 | u32 ld_logical_block_exp:4; |
| 905 | /* 0x34, P_I_EXPONENT from READ CAPACITY 16 */ |
| 906 | u32 ld_pi_exp:4; |
| 907 | #endif |
| 908 | }; /* 0x34 - 0x37 */ |
| 909 | /* 0x38 - 0x3f, This will determine which |
| 910 | * core will process LD IO and PD IO. |
| 911 | */ |
| 912 | struct MR_IO_AFFINITY cpuAffinity; |
| 913 | /* Bit definiations are specified by MR_IO_AFFINITY */ |
Shivasharan S | 41064f1 | 2017-02-10 00:59:37 -0800 | [diff] [blame] | 914 | u8 reserved3[0x80 - 0x40]; /* 0x40 - 0x7f */ |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 915 | }; |
| 916 | |
| 917 | struct MR_LD_SPAN_MAP { |
| 918 | struct MR_LD_RAID ldRaid; |
| 919 | u8 dataArmMap[MAX_RAIDMAP_ROW_SIZE]; |
| 920 | struct MR_SPAN_BLOCK_INFO spanBlock[MAX_RAIDMAP_SPAN_DEPTH]; |
| 921 | }; |
| 922 | |
| 923 | struct MR_FW_RAID_MAP { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 924 | __le32 totalSize; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 925 | union { |
| 926 | struct { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 927 | __le32 maxLd; |
| 928 | __le32 maxSpanDepth; |
| 929 | __le32 maxRowSize; |
| 930 | __le32 maxPdCount; |
| 931 | __le32 maxArrays; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 932 | } validationInfo; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 933 | __le32 version[5]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 934 | }; |
| 935 | |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 936 | __le32 ldCount; |
| 937 | __le32 Reserved1; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 938 | u8 ldTgtIdToLd[MAX_RAIDMAP_LOGICAL_DRIVES+ |
| 939 | MAX_RAIDMAP_VIEWS]; |
| 940 | u8 fpPdIoTimeoutSec; |
| 941 | u8 reserved2[7]; |
| 942 | struct MR_ARRAY_INFO arMapInfo[MAX_RAIDMAP_ARRAYS]; |
| 943 | struct MR_DEV_HANDLE_INFO devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES]; |
| 944 | struct MR_LD_SPAN_MAP ldSpanMap[1]; |
| 945 | }; |
| 946 | |
| 947 | struct IO_REQUEST_INFO { |
| 948 | u64 ldStartBlock; |
| 949 | u32 numBlocks; |
| 950 | u16 ldTgtId; |
| 951 | u8 isRead; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 952 | __le16 devHandle; |
Shivasharan S | 33203bc | 2017-02-10 00:59:12 -0800 | [diff] [blame] | 953 | u8 pd_interface; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 954 | u64 pdBlock; |
| 955 | u8 fpOkForIo; |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 956 | u8 IoforUnevenSpan; |
| 957 | u8 start_span; |
Sumit Saxena | 8f05024 | 2016-01-28 21:04:27 +0530 | [diff] [blame] | 958 | u8 do_fp_rlbypass; |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 959 | u64 start_row; |
Sumit.Saxena@avagotech.com | d2552eb | 2014-09-12 18:57:53 +0530 | [diff] [blame] | 960 | u8 span_arm; /* span[7:5], arm[4:0] */ |
| 961 | u8 pd_after_lb; |
Sasikumar Chandrasekaran | 69c337c | 2017-01-10 18:20:47 -0500 | [diff] [blame] | 962 | u16 r1_alt_dev_handle; /* raid 1/10 only */ |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 963 | bool ra_capable; |
Chandrakanth Patil | f39e5e5 | 2019-06-25 16:34:34 +0530 | [diff] [blame] | 964 | u8 data_arms; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 965 | }; |
| 966 | |
| 967 | struct MR_LD_TARGET_SYNC { |
| 968 | u8 targetId; |
| 969 | u8 reserved; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 970 | __le16 seqNum; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 971 | }; |
| 972 | |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 973 | /* |
| 974 | * RAID Map descriptor Types. |
| 975 | * Each element should uniquely idetify one data structure in the RAID map |
| 976 | */ |
| 977 | enum MR_RAID_MAP_DESC_TYPE { |
| 978 | /* MR_DEV_HANDLE_INFO data */ |
| 979 | RAID_MAP_DESC_TYPE_DEVHDL_INFO = 0x0, |
| 980 | /* target to Ld num Index map */ |
| 981 | RAID_MAP_DESC_TYPE_TGTID_INFO = 0x1, |
| 982 | /* MR_ARRAY_INFO data */ |
| 983 | RAID_MAP_DESC_TYPE_ARRAY_INFO = 0x2, |
| 984 | /* MR_LD_SPAN_MAP data */ |
| 985 | RAID_MAP_DESC_TYPE_SPAN_INFO = 0x3, |
| 986 | RAID_MAP_DESC_TYPE_COUNT, |
| 987 | }; |
| 988 | |
| 989 | /* |
| 990 | * This table defines the offset, size and num elements of each descriptor |
| 991 | * type in the RAID Map buffer |
| 992 | */ |
| 993 | struct MR_RAID_MAP_DESC_TABLE { |
| 994 | /* Raid map descriptor type */ |
| 995 | u32 raid_map_desc_type; |
| 996 | /* Offset into the RAID map buffer where |
| 997 | * descriptor data is saved |
| 998 | */ |
| 999 | u32 raid_map_desc_offset; |
| 1000 | /* total size of the |
| 1001 | * descriptor buffer |
| 1002 | */ |
| 1003 | u32 raid_map_desc_buffer_size; |
| 1004 | /* Number of elements contained in the |
| 1005 | * descriptor buffer |
| 1006 | */ |
| 1007 | u32 raid_map_desc_elements; |
| 1008 | }; |
| 1009 | |
| 1010 | /* |
| 1011 | * Dynamic Raid Map Structure. |
| 1012 | */ |
| 1013 | struct MR_FW_RAID_MAP_DYNAMIC { |
| 1014 | u32 raid_map_size; /* total size of RAID Map structure */ |
| 1015 | u32 desc_table_offset;/* Offset of desc table into RAID map*/ |
| 1016 | u32 desc_table_size; /* Total Size of desc table */ |
| 1017 | /* Total Number of elements in the desc table */ |
| 1018 | u32 desc_table_num_elements; |
Shivasharan S | 18bbcab | 2017-02-10 00:59:01 -0800 | [diff] [blame] | 1019 | u64 reserved1; |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 1020 | u32 reserved2[3]; /*future use */ |
| 1021 | /* timeout value used by driver in FP IOs */ |
| 1022 | u8 fp_pd_io_timeout_sec; |
| 1023 | u8 reserved3[3]; |
| 1024 | /* when this seqNum increments, driver needs to |
| 1025 | * release RMW buffers asap |
| 1026 | */ |
| 1027 | u32 rmw_fp_seq_num; |
| 1028 | u16 ld_count; /* count of lds. */ |
| 1029 | u16 ar_count; /* count of arrays */ |
| 1030 | u16 span_count; /* count of spans */ |
| 1031 | u16 reserved4[3]; |
| 1032 | /* |
| 1033 | * The below structure of pointers is only to be used by the driver. |
| 1034 | * This is added in the ,API to reduce the amount of code changes |
| 1035 | * needed in the driver to support dynamic RAID map Firmware should |
| 1036 | * not update these pointers while preparing the raid map |
| 1037 | */ |
| 1038 | union { |
| 1039 | struct { |
| 1040 | struct MR_DEV_HANDLE_INFO *dev_hndl_info; |
| 1041 | u16 *ld_tgt_id_to_ld; |
| 1042 | struct MR_ARRAY_INFO *ar_map_info; |
| 1043 | struct MR_LD_SPAN_MAP *ld_span_map; |
| 1044 | }; |
| 1045 | u64 ptr_structure_size[RAID_MAP_DESC_TYPE_COUNT]; |
| 1046 | }; |
| 1047 | /* |
| 1048 | * RAID Map descriptor table defines the layout of data in the RAID Map. |
| 1049 | * The size of the descriptor table itself could change. |
| 1050 | */ |
| 1051 | /* Variable Size descriptor Table. */ |
| 1052 | struct MR_RAID_MAP_DESC_TABLE |
| 1053 | raid_map_desc_table[RAID_MAP_DESC_TYPE_COUNT]; |
| 1054 | /* Variable Size buffer containing all data */ |
| 1055 | u32 raid_map_desc_data[1]; |
| 1056 | }; /* Dynamicaly sized RAID MAp structure */ |
| 1057 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1058 | #define IEEE_SGE_FLAGS_ADDR_MASK (0x03) |
| 1059 | #define IEEE_SGE_FLAGS_SYSTEM_ADDR (0x00) |
| 1060 | #define IEEE_SGE_FLAGS_IOCDDR_ADDR (0x01) |
| 1061 | #define IEEE_SGE_FLAGS_IOCPLB_ADDR (0x02) |
| 1062 | #define IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) |
| 1063 | #define IEEE_SGE_FLAGS_CHAIN_ELEMENT (0x80) |
| 1064 | #define IEEE_SGE_FLAGS_END_OF_LIST (0x40) |
| 1065 | |
Shivasharan S | 33203bc | 2017-02-10 00:59:12 -0800 | [diff] [blame] | 1066 | #define MPI2_SGE_FLAGS_SHIFT (0x02) |
| 1067 | #define IEEE_SGE_FLAGS_FORMAT_MASK (0xC0) |
| 1068 | #define IEEE_SGE_FLAGS_FORMAT_IEEE (0x00) |
| 1069 | #define IEEE_SGE_FLAGS_FORMAT_NVME (0x02) |
| 1070 | |
| 1071 | #define MPI26_IEEE_SGE_FLAGS_NSF_MASK (0x1C) |
| 1072 | #define MPI26_IEEE_SGE_FLAGS_NSF_MPI_IEEE (0x00) |
| 1073 | #define MPI26_IEEE_SGE_FLAGS_NSF_NVME_PRP (0x08) |
| 1074 | #define MPI26_IEEE_SGE_FLAGS_NSF_NVME_SGL (0x10) |
| 1075 | |
Shivasharan S | f0c21df | 2018-10-16 23:37:40 -0700 | [diff] [blame] | 1076 | #define MEGASAS_DEFAULT_SNAP_DUMP_WAIT_TIME 15 |
| 1077 | #define MEGASAS_MAX_SNAP_DUMP_WAIT_TIME 60 |
| 1078 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1079 | struct megasas_register_set; |
| 1080 | struct megasas_instance; |
| 1081 | |
| 1082 | union desc_word { |
| 1083 | u64 word; |
| 1084 | struct { |
| 1085 | u32 low; |
| 1086 | u32 high; |
| 1087 | } u; |
| 1088 | }; |
| 1089 | |
| 1090 | struct megasas_cmd_fusion { |
| 1091 | struct MPI2_RAID_SCSI_IO_REQUEST *io_request; |
| 1092 | dma_addr_t io_request_phys_addr; |
| 1093 | |
| 1094 | union MPI2_SGE_IO_UNION *sg_frame; |
| 1095 | dma_addr_t sg_frame_phys_addr; |
| 1096 | |
| 1097 | u8 *sense; |
| 1098 | dma_addr_t sense_phys_addr; |
| 1099 | |
| 1100 | struct list_head list; |
| 1101 | struct scsi_cmnd *scmd; |
| 1102 | struct megasas_instance *instance; |
| 1103 | |
| 1104 | u8 retry_for_fw_reset; |
| 1105 | union MEGASAS_REQUEST_DESCRIPTOR_UNION *request_desc; |
| 1106 | |
| 1107 | /* |
| 1108 | * Context for a MFI frame. |
| 1109 | * Used to get the mfi cmd from list when a MFI cmd is completed |
| 1110 | */ |
| 1111 | u32 sync_cmd_idx; |
| 1112 | u32 index; |
Sumit.Saxena@avagotech.com | d2552eb | 2014-09-12 18:57:53 +0530 | [diff] [blame] | 1113 | u8 pd_r1_lb; |
Sumit Saxena | 18365b1 | 2016-01-28 21:04:25 +0530 | [diff] [blame] | 1114 | struct completion done; |
Shivasharan S | 33203bc | 2017-02-10 00:59:12 -0800 | [diff] [blame] | 1115 | u8 pd_interface; |
Sasikumar Chandrasekaran | 69c337c | 2017-01-10 18:20:47 -0500 | [diff] [blame] | 1116 | u16 r1_alt_dev_handle; /* raid 1/10 only*/ |
| 1117 | bool cmd_completed; /* raid 1/10 fp writes status holder */ |
| 1118 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1119 | }; |
| 1120 | |
| 1121 | struct LD_LOAD_BALANCE_INFO { |
| 1122 | u8 loadBalanceFlag; |
| 1123 | u8 reserved1; |
Sumit.Saxena@avagotech.com | d2552eb | 2014-09-12 18:57:53 +0530 | [diff] [blame] | 1124 | atomic_t scsi_pending_cmds[MAX_PHYSICAL_DEVICES]; |
| 1125 | u64 last_accessed_block[MAX_PHYSICAL_DEVICES]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1126 | }; |
| 1127 | |
Sumit.Saxena@lsi.com | bc93d42 | 2013-05-22 12:35:04 +0530 | [diff] [blame] | 1128 | /* SPAN_SET is info caclulated from span info from Raid map per LD */ |
| 1129 | typedef struct _LD_SPAN_SET { |
| 1130 | u64 log_start_lba; |
| 1131 | u64 log_end_lba; |
| 1132 | u64 span_row_start; |
| 1133 | u64 span_row_end; |
| 1134 | u64 data_strip_start; |
| 1135 | u64 data_strip_end; |
| 1136 | u64 data_row_start; |
| 1137 | u64 data_row_end; |
| 1138 | u8 strip_offset[MAX_SPAN_DEPTH]; |
| 1139 | u32 span_row_data_width; |
| 1140 | u32 diff; |
| 1141 | u32 reserved[2]; |
| 1142 | } LD_SPAN_SET, *PLD_SPAN_SET; |
| 1143 | |
| 1144 | typedef struct LOG_BLOCK_SPAN_INFO { |
| 1145 | LD_SPAN_SET span_set[MAX_SPAN_DEPTH]; |
| 1146 | } LD_SPAN_INFO, *PLD_SPAN_INFO; |
| 1147 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1148 | struct MR_FW_RAID_MAP_ALL { |
| 1149 | struct MR_FW_RAID_MAP raidMap; |
| 1150 | struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES - 1]; |
| 1151 | } __attribute__ ((packed)); |
| 1152 | |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1153 | struct MR_DRV_RAID_MAP { |
| 1154 | /* total size of this structure, including this field. |
| 1155 | * This feild will be manupulated by driver for ext raid map, |
| 1156 | * else pick the value from firmware raid map. |
| 1157 | */ |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 1158 | __le32 totalSize; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1159 | |
| 1160 | union { |
| 1161 | struct { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 1162 | __le32 maxLd; |
| 1163 | __le32 maxSpanDepth; |
| 1164 | __le32 maxRowSize; |
| 1165 | __le32 maxPdCount; |
| 1166 | __le32 maxArrays; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1167 | } validationInfo; |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 1168 | __le32 version[5]; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1169 | }; |
| 1170 | |
| 1171 | /* timeout value used by driver in FP IOs*/ |
| 1172 | u8 fpPdIoTimeoutSec; |
| 1173 | u8 reserved2[7]; |
| 1174 | |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 1175 | __le16 ldCount; |
| 1176 | __le16 arCount; |
| 1177 | __le16 spanCount; |
| 1178 | __le16 reserve3; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1179 | |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 1180 | struct MR_DEV_HANDLE_INFO |
| 1181 | devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES_DYN]; |
| 1182 | u16 ldTgtIdToLd[MAX_LOGICAL_DRIVES_DYN]; |
| 1183 | struct MR_ARRAY_INFO arMapInfo[MAX_API_ARRAYS_DYN]; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1184 | struct MR_LD_SPAN_MAP ldSpanMap[1]; |
| 1185 | |
| 1186 | }; |
| 1187 | |
| 1188 | /* Driver raid map size is same as raid map ext |
| 1189 | * MR_DRV_RAID_MAP_ALL is created to sync with old raid. |
| 1190 | * And it is mainly for code re-use purpose. |
| 1191 | */ |
| 1192 | struct MR_DRV_RAID_MAP_ALL { |
| 1193 | |
| 1194 | struct MR_DRV_RAID_MAP raidMap; |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 1195 | struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_DYN - 1]; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1196 | } __packed; |
| 1197 | |
| 1198 | |
| 1199 | |
| 1200 | struct MR_FW_RAID_MAP_EXT { |
| 1201 | /* Not usred in new map */ |
| 1202 | u32 reserved; |
| 1203 | |
| 1204 | union { |
| 1205 | struct { |
| 1206 | u32 maxLd; |
| 1207 | u32 maxSpanDepth; |
| 1208 | u32 maxRowSize; |
| 1209 | u32 maxPdCount; |
| 1210 | u32 maxArrays; |
| 1211 | } validationInfo; |
| 1212 | u32 version[5]; |
| 1213 | }; |
| 1214 | |
| 1215 | u8 fpPdIoTimeoutSec; |
| 1216 | u8 reserved2[7]; |
| 1217 | |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 1218 | __le16 ldCount; |
| 1219 | __le16 arCount; |
| 1220 | __le16 spanCount; |
| 1221 | __le16 reserve3; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1222 | |
| 1223 | struct MR_DEV_HANDLE_INFO devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES]; |
| 1224 | u8 ldTgtIdToLd[MAX_LOGICAL_DRIVES_EXT]; |
| 1225 | struct MR_ARRAY_INFO arMapInfo[MAX_API_ARRAYS_EXT]; |
| 1226 | struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_EXT]; |
| 1227 | }; |
| 1228 | |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 1229 | /* |
| 1230 | * * define MR_PD_CFG_SEQ structure for system PDs |
| 1231 | * */ |
| 1232 | struct MR_PD_CFG_SEQ { |
Sumit Saxena | 18365b1 | 2016-01-28 21:04:25 +0530 | [diff] [blame] | 1233 | u16 seqNum; |
| 1234 | u16 devHandle; |
| 1235 | struct { |
| 1236 | #if defined(__BIG_ENDIAN_BITFIELD) |
| 1237 | u8 reserved:7; |
| 1238 | u8 tmCapable:1; |
| 1239 | #else |
| 1240 | u8 tmCapable:1; |
| 1241 | u8 reserved:7; |
| 1242 | #endif |
| 1243 | } capability; |
Sasikumar Chandrasekaran | ede7c3c | 2017-01-10 18:20:52 -0500 | [diff] [blame] | 1244 | u8 reserved; |
| 1245 | u16 pd_target_id; |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 1246 | } __packed; |
| 1247 | |
| 1248 | struct MR_PD_CFG_SEQ_NUM_SYNC { |
| 1249 | __le32 size; |
| 1250 | __le32 count; |
| 1251 | struct MR_PD_CFG_SEQ seq[1]; |
| 1252 | } __packed; |
| 1253 | |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 1254 | /* stream detection */ |
| 1255 | struct STREAM_DETECT { |
| 1256 | u64 next_seq_lba; /* next LBA to match sequential access */ |
| 1257 | struct megasas_cmd_fusion *first_cmd_fusion; /* first cmd in group */ |
| 1258 | struct megasas_cmd_fusion *last_cmd_fusion; /* last cmd in group */ |
| 1259 | u32 count_cmds_in_stream; /* count of host commands in this stream */ |
| 1260 | u16 num_sges_in_group; /* total number of SGEs in grouped IOs */ |
| 1261 | u8 is_read; /* SCSI OpCode for this stream */ |
| 1262 | u8 group_depth; /* total number of host commands in group */ |
| 1263 | /* TRUE if cannot add any more commands to this group */ |
| 1264 | bool group_flush; |
| 1265 | u8 reserved[7]; /* pad to 64-bit alignment */ |
| 1266 | }; |
| 1267 | |
| 1268 | struct LD_STREAM_DETECT { |
| 1269 | bool write_back; /* TRUE if WB, FALSE if WT */ |
| 1270 | bool fp_write_enabled; |
| 1271 | bool members_ssds; |
| 1272 | bool fp_cache_bypass_capable; |
| 1273 | u32 mru_bit_map; /* bitmap used to track MRU and LRU stream indicies */ |
| 1274 | /* this is the array of stream detect structures (one per stream) */ |
| 1275 | struct STREAM_DETECT stream_track[MAX_STREAMS_TRACKED]; |
| 1276 | }; |
| 1277 | |
Sumit Saxena | 179ac14 | 2016-01-28 21:04:28 +0530 | [diff] [blame] | 1278 | struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY { |
| 1279 | u64 RDPQBaseAddress; |
| 1280 | u32 Reserved1; |
| 1281 | u32 Reserved2; |
| 1282 | }; |
| 1283 | |
Shivasharan S | 107a60d | 2017-10-19 02:49:05 -0700 | [diff] [blame] | 1284 | struct rdpq_alloc_detail { |
| 1285 | struct dma_pool *dma_pool_ptr; |
| 1286 | dma_addr_t pool_entry_phys; |
| 1287 | union MPI2_REPLY_DESCRIPTORS_UNION *pool_entry_virt; |
| 1288 | }; |
| 1289 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1290 | struct fusion_context { |
| 1291 | struct megasas_cmd_fusion **cmd_list; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1292 | dma_addr_t req_frames_desc_phys; |
| 1293 | u8 *req_frames_desc; |
| 1294 | |
| 1295 | struct dma_pool *io_request_frames_pool; |
| 1296 | dma_addr_t io_request_frames_phys; |
| 1297 | u8 *io_request_frames; |
| 1298 | |
| 1299 | struct dma_pool *sg_dma_pool; |
| 1300 | struct dma_pool *sense_dma_pool; |
| 1301 | |
Shivasharan S | 107a60d | 2017-10-19 02:49:05 -0700 | [diff] [blame] | 1302 | u8 *sense; |
| 1303 | dma_addr_t sense_phys_addr; |
| 1304 | |
Sumit Saxena | 179ac14 | 2016-01-28 21:04:28 +0530 | [diff] [blame] | 1305 | dma_addr_t reply_frames_desc_phys[MAX_MSIX_QUEUES_FUSION]; |
| 1306 | union MPI2_REPLY_DESCRIPTORS_UNION *reply_frames_desc[MAX_MSIX_QUEUES_FUSION]; |
Shivasharan S | 107a60d | 2017-10-19 02:49:05 -0700 | [diff] [blame] | 1307 | struct rdpq_alloc_detail rdpq_tracker[RDPQ_MAX_CHUNK_COUNT]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1308 | struct dma_pool *reply_frames_desc_pool; |
Shivasharan S | 107a60d | 2017-10-19 02:49:05 -0700 | [diff] [blame] | 1309 | struct dma_pool *reply_frames_desc_pool_align; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1310 | |
adam radford | c8e858f | 2011-10-08 18:15:13 -0700 | [diff] [blame] | 1311 | u16 last_reply_idx[MAX_MSIX_QUEUES_FUSION]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1312 | |
| 1313 | u32 reply_q_depth; |
| 1314 | u32 request_alloc_sz; |
| 1315 | u32 reply_alloc_sz; |
| 1316 | u32 io_frames_alloc_sz; |
| 1317 | |
Sumit Saxena | 179ac14 | 2016-01-28 21:04:28 +0530 | [diff] [blame] | 1318 | struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY *rdpq_virt; |
| 1319 | dma_addr_t rdpq_phys; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1320 | u16 max_sge_in_main_msg; |
| 1321 | u16 max_sge_in_chain; |
| 1322 | |
| 1323 | u8 chain_offset_io_request; |
| 1324 | u8 chain_offset_mfi_pthru; |
| 1325 | |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 1326 | struct MR_FW_RAID_MAP_DYNAMIC *ld_map[2]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1327 | dma_addr_t ld_map_phys[2]; |
| 1328 | |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1329 | /*Non dma-able memory. Driver local copy.*/ |
| 1330 | struct MR_DRV_RAID_MAP_ALL *ld_drv_map[2]; |
| 1331 | |
| 1332 | u32 max_map_sz; |
| 1333 | u32 current_map_sz; |
Sasikumar Chandrasekaran | d889344 | 2017-01-10 18:20:48 -0500 | [diff] [blame] | 1334 | u32 old_map_sz; |
| 1335 | u32 new_map_sz; |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1336 | u32 drv_map_sz; |
| 1337 | u32 drv_map_pages; |
sumit.saxena@avagotech.com | 3761cb4 | 2015-08-31 17:23:11 +0530 | [diff] [blame] | 1338 | struct MR_PD_CFG_SEQ_NUM_SYNC *pd_seq_sync[JBOD_MAPS_COUNT]; |
| 1339 | dma_addr_t pd_seq_phys[JBOD_MAPS_COUNT]; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1340 | u8 fast_path_io; |
Shivasharan S | 5fc499b | 2017-02-10 00:59:17 -0800 | [diff] [blame] | 1341 | struct LD_LOAD_BALANCE_INFO *load_balance_info; |
| 1342 | u32 load_balance_info_pages; |
Shivasharan S | 2dd689c | 2017-10-19 02:48:53 -0700 | [diff] [blame] | 1343 | LD_SPAN_INFO *log_to_span; |
| 1344 | u32 log_to_span_pages; |
Sasikumar Chandrasekaran | fdd84e2 | 2017-01-10 18:20:46 -0500 | [diff] [blame] | 1345 | struct LD_STREAM_DETECT **stream_detect_by_ld; |
Shivasharan S | 9b3d028 | 2017-10-19 02:48:56 -0700 | [diff] [blame] | 1346 | dma_addr_t ioc_init_request_phys; |
| 1347 | struct MPI2_IOC_INIT_REQUEST *ioc_init_request; |
Shivasharan S | b9637d1 | 2017-10-19 02:49:01 -0700 | [diff] [blame] | 1348 | struct megasas_cmd *ioc_init_cmd; |
Chandrakanth Patil | 49f2bf1 | 2019-06-25 16:34:28 +0530 | [diff] [blame] | 1349 | bool pcie_bw_limitation; |
Chandrakanth Patil | 7fc5570 | 2019-06-25 16:34:29 +0530 | [diff] [blame] | 1350 | bool r56_div_offload; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1351 | }; |
| 1352 | |
| 1353 | union desc_value { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 1354 | __le64 word; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1355 | struct { |
Christoph Hellwig | 9ab9ed38 | 2015-04-23 16:32:54 +0530 | [diff] [blame] | 1356 | __le32 low; |
| 1357 | __le32 high; |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1358 | } u; |
| 1359 | }; |
| 1360 | |
Shivasharan S | 54b2804 | 2018-01-05 05:27:47 -0800 | [diff] [blame] | 1361 | enum CMD_RET_VALUES { |
| 1362 | REFIRE_CMD = 1, |
| 1363 | COMPLETE_CMD = 2, |
| 1364 | RETURN_CMD = 3, |
| 1365 | }; |
| 1366 | |
Shivasharan S | f0c21df | 2018-10-16 23:37:40 -0700 | [diff] [blame] | 1367 | struct MR_SNAPDUMP_PROPERTIES { |
| 1368 | u8 offload_num; |
| 1369 | u8 max_num_supported; |
| 1370 | u8 cur_num_supported; |
| 1371 | u8 trigger_min_num_sec_before_ocr; |
| 1372 | u8 reserved[12]; |
| 1373 | }; |
| 1374 | |
Shivasharan S | ba53572 | 2019-05-07 10:05:49 -0700 | [diff] [blame] | 1375 | struct megasas_debugfs_buffer { |
| 1376 | void *buf; |
| 1377 | u32 len; |
| 1378 | }; |
| 1379 | |
Baoyou Xie | 2f3e7732 | 2016-09-18 20:07:59 +0800 | [diff] [blame] | 1380 | void megasas_free_cmds_fusion(struct megasas_instance *instance); |
| 1381 | int megasas_ioc_init_fusion(struct megasas_instance *instance); |
| 1382 | u8 megasas_get_map_info(struct megasas_instance *instance); |
| 1383 | int megasas_sync_map_info(struct megasas_instance *instance); |
| 1384 | void megasas_release_fusion(struct megasas_instance *instance); |
| 1385 | void megasas_reset_reply_desc(struct megasas_instance *instance); |
| 1386 | int megasas_check_mpio_paths(struct megasas_instance *instance, |
| 1387 | struct scsi_cmnd *scmd); |
| 1388 | void megasas_fusion_ocr_wq(struct work_struct *work); |
Sumit.Saxena@avagotech.com | 51087a8 | 2014-09-12 18:57:33 +0530 | [diff] [blame] | 1389 | |
adam radford | 9c915a8 | 2010-12-21 13:34:31 -0800 | [diff] [blame] | 1390 | #endif /* _MEGARAID_SAS_FUSION_H_ */ |