Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This is the Fusion MPT base driver providing common API layer interface |
| 3 | * for access to MPT (Message Passing Technology) firmware. |
| 4 | * |
| 5 | * This code is based on drivers/scsi/mpt2sas/mpt2_base.h |
Kashyap, Desai | 31b7f2e | 2010-03-17 16:28:04 +0530 | [diff] [blame] | 6 | * Copyright (C) 2007-2010 LSI Corporation |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 7 | * (mailto:DL-MPTFusionLinux@lsi.com) |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License |
| 11 | * as published by the Free Software Foundation; either version 2 |
| 12 | * of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * NO WARRANTY |
| 20 | * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 21 | * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT |
| 22 | * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, |
| 23 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is |
| 24 | * solely responsible for determining the appropriateness of using and |
| 25 | * distributing the Program and assumes all risks associated with its |
| 26 | * exercise of rights under this Agreement, including but not limited to |
| 27 | * the risks and costs of program errors, damage to or loss of data, |
| 28 | * programs or equipment, and unavailability or interruption of operations. |
| 29 | |
| 30 | * DISCLAIMER OF LIABILITY |
| 31 | * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY |
| 32 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 33 | * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND |
| 34 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
| 35 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
| 36 | * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED |
| 37 | * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES |
| 38 | |
| 39 | * You should have received a copy of the GNU General Public License |
| 40 | * along with this program; if not, write to the Free Software |
| 41 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 42 | * USA. |
| 43 | */ |
| 44 | |
| 45 | #ifndef MPT2SAS_BASE_H_INCLUDED |
| 46 | #define MPT2SAS_BASE_H_INCLUDED |
| 47 | |
| 48 | #include "mpi/mpi2_type.h" |
| 49 | #include "mpi/mpi2.h" |
| 50 | #include "mpi/mpi2_ioc.h" |
| 51 | #include "mpi/mpi2_cnfg.h" |
| 52 | #include "mpi/mpi2_init.h" |
| 53 | #include "mpi/mpi2_raid.h" |
| 54 | #include "mpi/mpi2_tool.h" |
| 55 | #include "mpi/mpi2_sas.h" |
| 56 | |
| 57 | #include <scsi/scsi.h> |
| 58 | #include <scsi/scsi_cmnd.h> |
| 59 | #include <scsi/scsi_device.h> |
| 60 | #include <scsi/scsi_host.h> |
| 61 | #include <scsi/scsi_tcq.h> |
| 62 | #include <scsi/scsi_transport_sas.h> |
| 63 | #include <scsi/scsi_dbg.h> |
Eric Moore | 3c621b3 | 2009-05-18 12:59:41 -0600 | [diff] [blame] | 64 | #include <scsi/scsi_eh.h> |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 65 | |
| 66 | #include "mpt2sas_debug.h" |
| 67 | |
| 68 | /* driver versioning info */ |
| 69 | #define MPT2SAS_DRIVER_NAME "mpt2sas" |
| 70 | #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" |
| 71 | #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" |
nagalakshmi.nandigama@lsi.com | 0599f8f | 2011-09-08 07:13:35 +0530 | [diff] [blame] | 72 | #define MPT2SAS_DRIVER_VERSION "09.100.00.01" |
Kashyap, Desai | 2e00d24 | 2011-06-14 10:57:51 +0530 | [diff] [blame] | 73 | #define MPT2SAS_MAJOR_VERSION 09 |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 74 | #define MPT2SAS_MINOR_VERSION 100 |
Kashyap, Desai | 1a7d7ea | 2010-03-17 16:28:34 +0530 | [diff] [blame] | 75 | #define MPT2SAS_BUILD_VERSION 00 |
nagalakshmi.nandigama@lsi.com | 0599f8f | 2011-09-08 07:13:35 +0530 | [diff] [blame] | 76 | #define MPT2SAS_RELEASE_VERSION 01 |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 77 | |
| 78 | /* |
| 79 | * Set MPT2SAS_SG_DEPTH value based on user input. |
| 80 | */ |
| 81 | #ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE |
| 82 | #if CONFIG_SCSI_MPT2SAS_MAX_SGE < 16 |
| 83 | #define MPT2SAS_SG_DEPTH 16 |
| 84 | #elif CONFIG_SCSI_MPT2SAS_MAX_SGE > 128 |
| 85 | #define MPT2SAS_SG_DEPTH 128 |
| 86 | #else |
| 87 | #define MPT2SAS_SG_DEPTH CONFIG_SCSI_MPT2SAS_MAX_SGE |
| 88 | #endif |
| 89 | #else |
| 90 | #define MPT2SAS_SG_DEPTH 128 /* MAX_HW_SEGMENTS */ |
| 91 | #endif |
| 92 | |
| 93 | |
| 94 | /* |
| 95 | * Generic Defines |
| 96 | */ |
| 97 | #define MPT2SAS_SATA_QUEUE_DEPTH 32 |
| 98 | #define MPT2SAS_SAS_QUEUE_DEPTH 254 |
| 99 | #define MPT2SAS_RAID_QUEUE_DEPTH 128 |
| 100 | |
| 101 | #define MPT_NAME_LENGTH 32 /* generic length of strings */ |
| 102 | #define MPT_STRING_LENGTH 64 |
| 103 | |
Kashyap, Desai | d5bd3491c | 2011-01-04 11:39:20 +0530 | [diff] [blame] | 104 | #define MPT_MAX_CALLBACKS 16 |
| 105 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 106 | |
| 107 | #define CAN_SLEEP 1 |
| 108 | #define NO_SLEEP 0 |
| 109 | |
| 110 | #define INTERNAL_CMDS_COUNT 10 /* reserved cmds */ |
| 111 | |
| 112 | #define MPI2_HIM_MASK 0xFFFFFFFF /* mask every bit*/ |
| 113 | |
| 114 | #define MPT2SAS_INVALID_DEVICE_HANDLE 0xFFFF |
| 115 | |
| 116 | |
| 117 | /* |
| 118 | * reset phases |
| 119 | */ |
| 120 | #define MPT2_IOC_PRE_RESET 1 /* prior to host reset */ |
| 121 | #define MPT2_IOC_AFTER_RESET 2 /* just after host reset */ |
| 122 | #define MPT2_IOC_DONE_RESET 3 /* links re-initialized */ |
| 123 | |
| 124 | /* |
| 125 | * logging format |
| 126 | */ |
| 127 | #define MPT2SAS_FMT "%s: " |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 128 | #define MPT2SAS_INFO_FMT KERN_INFO MPT2SAS_FMT |
| 129 | #define MPT2SAS_NOTE_FMT KERN_NOTICE MPT2SAS_FMT |
| 130 | #define MPT2SAS_WARN_FMT KERN_WARNING MPT2SAS_FMT |
| 131 | #define MPT2SAS_ERR_FMT KERN_ERR MPT2SAS_FMT |
| 132 | |
| 133 | /* |
Eric Moore | f0f9cc1 | 2009-04-21 15:40:48 -0600 | [diff] [blame] | 134 | * Dell HBA branding |
| 135 | */ |
| 136 | #define MPT2SAS_DELL_BRANDING_SIZE 32 |
| 137 | |
| 138 | #define MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING "Dell 6Gbps SAS HBA" |
| 139 | #define MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING "Dell PERC H200 Adapter" |
| 140 | #define MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING "Dell PERC H200 Integrated" |
| 141 | #define MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING "Dell PERC H200 Modular" |
| 142 | #define MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING "Dell PERC H200 Embedded" |
| 143 | #define MPT2SAS_DELL_PERC_H200_BRANDING "Dell PERC H200" |
| 144 | #define MPT2SAS_DELL_6GBPS_SAS_BRANDING "Dell 6Gbps SAS" |
| 145 | |
| 146 | /* |
| 147 | * Dell HBA SSDIDs |
| 148 | */ |
| 149 | #define MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID 0x1F1C |
| 150 | #define MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID 0x1F1D |
| 151 | #define MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID 0x1F1E |
| 152 | #define MPT2SAS_DELL_PERC_H200_MODULAR_SSDID 0x1F1F |
| 153 | #define MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID 0x1F20 |
| 154 | #define MPT2SAS_DELL_PERC_H200_SSDID 0x1F21 |
| 155 | #define MPT2SAS_DELL_6GBPS_SAS_SSDID 0x1F22 |
| 156 | |
| 157 | /* |
Kashyap, Desai | fb396be | 2011-01-04 11:36:37 +0530 | [diff] [blame] | 158 | * Intel HBA branding |
| 159 | */ |
| 160 | #define MPT2SAS_INTEL_RMS2LL080_BRANDING \ |
| 161 | "Intel Integrated RAID Module RMS2LL080" |
| 162 | #define MPT2SAS_INTEL_RMS2LL040_BRANDING \ |
| 163 | "Intel Integrated RAID Module RMS2LL040" |
Kashyap, Desai | ab3e5f6 | 2011-06-14 10:57:31 +0530 | [diff] [blame] | 164 | #define MPT2SAS_INTEL_RS25GB008_BRANDING \ |
| 165 | "Intel(R) RAID Controller RS25GB008" |
Kashyap, Desai | fb396be | 2011-01-04 11:36:37 +0530 | [diff] [blame] | 166 | |
| 167 | /* |
| 168 | * Intel HBA SSDIDs |
| 169 | */ |
| 170 | #define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E |
| 171 | #define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F |
Kashyap, Desai | ab3e5f6 | 2011-06-14 10:57:31 +0530 | [diff] [blame] | 172 | #define MPT2SAS_INTEL_RS25GB008_SSDID 0x3000 |
Kashyap, Desai | fb396be | 2011-01-04 11:36:37 +0530 | [diff] [blame] | 173 | |
Kashyap, Desai | 0a2385c | 2011-03-15 20:04:26 +0530 | [diff] [blame] | 174 | |
| 175 | /* |
| 176 | * HP HBA branding |
| 177 | */ |
| 178 | #define MPT2SAS_HP_3PAR_SSVID 0x1590 |
| 179 | #define MPT2SAS_HP_2_4_INTERNAL_BRANDING "HP H220 Host Bus Adapter" |
| 180 | #define MPT2SAS_HP_2_4_EXTERNAL_BRANDING "HP H221 Host Bus Adapter" |
| 181 | #define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING "HP H222 Host Bus Adapter" |
| 182 | #define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING "HP H220i Host Bus Adapter" |
| 183 | #define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING "HP H210i Host Bus Adapter" |
| 184 | |
| 185 | /* |
| 186 | * HO HBA SSDIDs |
| 187 | */ |
| 188 | #define MPT2SAS_HP_2_4_INTERNAL_SSDID 0x0041 |
| 189 | #define MPT2SAS_HP_2_4_EXTERNAL_SSDID 0x0042 |
| 190 | #define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID 0x0043 |
| 191 | #define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID 0x0044 |
| 192 | #define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID 0x0046 |
| 193 | |
Kashyap, Desai | fb396be | 2011-01-04 11:36:37 +0530 | [diff] [blame] | 194 | /* |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 195 | * WarpDrive Specific Log codes |
| 196 | */ |
| 197 | |
| 198 | #define MPT2_WARPDRIVE_LOGENTRY (0x8002) |
| 199 | #define MPT2_WARPDRIVE_LC_SSDT (0x41) |
| 200 | #define MPT2_WARPDRIVE_LC_SSDLW (0x43) |
| 201 | #define MPT2_WARPDRIVE_LC_SSDLF (0x44) |
| 202 | #define MPT2_WARPDRIVE_LC_BRMF (0x4D) |
| 203 | |
| 204 | /* |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 205 | * per target private data |
| 206 | */ |
| 207 | #define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01 |
| 208 | #define MPT_TARGET_FLAGS_VOLUME 0x02 |
| 209 | #define MPT_TARGET_FLAGS_DELETED 0x04 |
| 210 | |
| 211 | /** |
| 212 | * struct MPT2SAS_TARGET - starget private hostdata |
| 213 | * @starget: starget object |
| 214 | * @sas_address: target sas address |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 215 | * @raid_device: raid_device pointer to access volume data |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 216 | * @handle: device handle |
| 217 | * @num_luns: number luns |
| 218 | * @flags: MPT_TARGET_FLAGS_XXX flags |
| 219 | * @deleted: target flaged for deletion |
| 220 | * @tm_busy: target is busy with TM request. |
| 221 | */ |
| 222 | struct MPT2SAS_TARGET { |
| 223 | struct scsi_target *starget; |
| 224 | u64 sas_address; |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 225 | struct _raid_device *raid_device; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 226 | u16 handle; |
| 227 | int num_luns; |
| 228 | u32 flags; |
| 229 | u8 deleted; |
| 230 | u8 tm_busy; |
| 231 | }; |
| 232 | |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 233 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 234 | /* |
| 235 | * per device private data |
| 236 | */ |
| 237 | #define MPT_DEVICE_FLAGS_INIT 0x01 |
| 238 | #define MPT_DEVICE_TLR_ON 0x02 |
| 239 | |
| 240 | /** |
| 241 | * struct MPT2SAS_DEVICE - sdev private hostdata |
| 242 | * @sas_target: starget private hostdata |
| 243 | * @lun: lun number |
| 244 | * @flags: MPT_DEVICE_XXX flags |
| 245 | * @configured_lun: lun is configured |
| 246 | * @block: device is in SDEV_BLOCK state |
| 247 | * @tlr_snoop_check: flag used in determining whether to disable TLR |
| 248 | */ |
Kashyap, Desai | ed79f12 | 2009-08-20 13:23:49 +0530 | [diff] [blame] | 249 | |
| 250 | /* OEM Identifiers */ |
| 251 | #define MFG10_OEM_ID_INVALID (0x00000000) |
| 252 | #define MFG10_OEM_ID_DELL (0x00000001) |
| 253 | #define MFG10_OEM_ID_FSC (0x00000002) |
| 254 | #define MFG10_OEM_ID_SUN (0x00000003) |
| 255 | #define MFG10_OEM_ID_IBM (0x00000004) |
| 256 | |
| 257 | /* GENERIC Flags 0*/ |
| 258 | #define MFG10_GF0_OCE_DISABLED (0x00000001) |
| 259 | #define MFG10_GF0_R1E_DRIVE_COUNT (0x00000002) |
| 260 | #define MFG10_GF0_R10_DISPLAY (0x00000004) |
| 261 | #define MFG10_GF0_SSD_DATA_SCRUB_DISABLE (0x00000008) |
| 262 | #define MFG10_GF0_SINGLE_DRIVE_R0 (0x00000010) |
| 263 | |
| 264 | /* OEM Specific Flags will come from OEM specific header files */ |
| 265 | typedef struct _MPI2_CONFIG_PAGE_MAN_10 { |
| 266 | MPI2_CONFIG_PAGE_HEADER Header; /* 00h */ |
| 267 | U8 OEMIdentifier; /* 04h */ |
| 268 | U8 Reserved1; /* 05h */ |
| 269 | U16 Reserved2; /* 08h */ |
| 270 | U32 Reserved3; /* 0Ch */ |
| 271 | U32 GenericFlags0; /* 10h */ |
| 272 | U32 GenericFlags1; /* 14h */ |
| 273 | U32 Reserved4; /* 18h */ |
| 274 | U32 OEMSpecificFlags0; /* 1Ch */ |
| 275 | U32 OEMSpecificFlags1; /* 20h */ |
| 276 | U32 Reserved5[18]; /* 24h-60h*/ |
| 277 | } MPI2_CONFIG_PAGE_MAN_10, |
| 278 | MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_10, |
| 279 | Mpi2ManufacturingPage10_t, MPI2_POINTER pMpi2ManufacturingPage10_t; |
| 280 | |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 281 | #define MFG_PAGE10_HIDE_SSDS_MASK (0x00000003) |
| 282 | #define MFG_PAGE10_HIDE_ALL_DISKS (0x00) |
| 283 | #define MFG_PAGE10_EXPOSE_ALL_DISKS (0x01) |
| 284 | #define MFG_PAGE10_HIDE_IF_VOL_PRESENT (0x02) |
| 285 | |
| 286 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 287 | struct MPT2SAS_DEVICE { |
| 288 | struct MPT2SAS_TARGET *sas_target; |
| 289 | unsigned int lun; |
| 290 | u32 flags; |
| 291 | u8 configured_lun; |
| 292 | u8 block; |
| 293 | u8 tlr_snoop_check; |
| 294 | }; |
| 295 | |
| 296 | #define MPT2_CMD_NOT_USED 0x8000 /* free */ |
| 297 | #define MPT2_CMD_COMPLETE 0x0001 /* completed */ |
| 298 | #define MPT2_CMD_PENDING 0x0002 /* pending */ |
| 299 | #define MPT2_CMD_REPLY_VALID 0x0004 /* reply is valid */ |
| 300 | #define MPT2_CMD_RESET 0x0008 /* host reset dropped the command */ |
| 301 | |
| 302 | /** |
| 303 | * struct _internal_cmd - internal commands struct |
| 304 | * @mutex: mutex |
| 305 | * @done: completion |
| 306 | * @reply: reply message pointer |
Kashyap, Desai | 769578f | 2010-06-17 13:49:28 +0530 | [diff] [blame] | 307 | * @sense: sense data |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 308 | * @status: MPT2_CMD_XXX status |
| 309 | * @smid: system message id |
| 310 | */ |
| 311 | struct _internal_cmd { |
| 312 | struct mutex mutex; |
| 313 | struct completion done; |
| 314 | void *reply; |
Kashyap, Desai | 769578f | 2010-06-17 13:49:28 +0530 | [diff] [blame] | 315 | void *sense; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 316 | u16 status; |
| 317 | u16 smid; |
| 318 | }; |
| 319 | |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 320 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 321 | /** |
| 322 | * struct _sas_device - attached device information |
| 323 | * @list: sas device list |
| 324 | * @starget: starget object |
| 325 | * @sas_address: device sas address |
| 326 | * @device_name: retrieved from the SAS IDENTIFY frame. |
| 327 | * @handle: device handle |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 328 | * @sas_address_parent: sas address of parent expander or sas host |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 329 | * @enclosure_handle: enclosure handle |
| 330 | * @enclosure_logical_id: enclosure logical identifier |
| 331 | * @volume_handle: volume handle (valid when hidden raid member) |
| 332 | * @volume_wwid: volume unique identifier |
| 333 | * @device_info: bitfield provides detailed info about the device |
| 334 | * @id: target id |
| 335 | * @channel: target channel |
| 336 | * @slot: number number |
Kashyap, Desai | 7fbae67 | 2010-06-17 13:45:17 +0530 | [diff] [blame] | 337 | * @phy: phy identifier provided in sas device page 0 |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 338 | * @responding: used in _scsih_sas_device_mark_responding |
| 339 | */ |
| 340 | struct _sas_device { |
| 341 | struct list_head list; |
| 342 | struct scsi_target *starget; |
| 343 | u64 sas_address; |
| 344 | u64 device_name; |
| 345 | u16 handle; |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 346 | u64 sas_address_parent; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 347 | u16 enclosure_handle; |
| 348 | u64 enclosure_logical_id; |
| 349 | u16 volume_handle; |
| 350 | u64 volume_wwid; |
| 351 | u32 device_info; |
| 352 | int id; |
| 353 | int channel; |
| 354 | u16 slot; |
Kashyap, Desai | 7fbae67 | 2010-06-17 13:45:17 +0530 | [diff] [blame] | 355 | u8 phy; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 356 | u8 responding; |
| 357 | }; |
| 358 | |
| 359 | /** |
| 360 | * struct _raid_device - raid volume link list |
| 361 | * @list: sas device list |
| 362 | * @starget: starget object |
| 363 | * @sdev: scsi device struct (volumes are single lun) |
| 364 | * @wwid: unique identifier for the volume |
| 365 | * @handle: device handle |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 366 | * @block_size: Block size of the volume |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 367 | * @id: target id |
| 368 | * @channel: target channel |
| 369 | * @volume_type: the raid level |
| 370 | * @device_info: bitfield provides detailed info about the hidden components |
| 371 | * @num_pds: number of hidden raid components |
| 372 | * @responding: used in _scsih_raid_device_mark_responding |
Kashyap, Desai | f7c95ef | 2009-12-16 18:54:42 +0530 | [diff] [blame] | 373 | * @percent_complete: resync percent complete |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 374 | * @direct_io_enabled: Whether direct io to PDs are allowed or not |
| 375 | * @stripe_exponent: X where 2powX is the stripe sz in blocks |
| 376 | * @max_lba: Maximum number of LBA in the volume |
| 377 | * @stripe_sz: Stripe Size of the volume |
| 378 | * @device_info: Device info of the volume member disk |
| 379 | * @pd_handle: Array of handles of the physical drives for direct I/O in le16 |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 380 | */ |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 381 | #define MPT_MAX_WARPDRIVE_PDS 8 |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 382 | struct _raid_device { |
| 383 | struct list_head list; |
| 384 | struct scsi_target *starget; |
| 385 | struct scsi_device *sdev; |
| 386 | u64 wwid; |
| 387 | u16 handle; |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 388 | u16 block_sz; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 389 | int id; |
| 390 | int channel; |
| 391 | u8 volume_type; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 392 | u8 num_pds; |
| 393 | u8 responding; |
Kashyap, Desai | f7c95ef | 2009-12-16 18:54:42 +0530 | [diff] [blame] | 394 | u8 percent_complete; |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 395 | u8 direct_io_enabled; |
| 396 | u8 stripe_exponent; |
| 397 | u64 max_lba; |
| 398 | u32 stripe_sz; |
| 399 | u32 device_info; |
| 400 | u16 pd_handle[MPT_MAX_WARPDRIVE_PDS]; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 401 | }; |
| 402 | |
| 403 | /** |
| 404 | * struct _boot_device - boot device info |
| 405 | * @is_raid: flag to indicate whether this is volume |
| 406 | * @device: holds pointer for either struct _sas_device or |
| 407 | * struct _raid_device |
| 408 | */ |
| 409 | struct _boot_device { |
| 410 | u8 is_raid; |
| 411 | void *device; |
| 412 | }; |
| 413 | |
| 414 | /** |
| 415 | * struct _sas_port - wide/narrow sas port information |
| 416 | * @port_list: list of ports belonging to expander |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 417 | * @num_phys: number of phys belonging to this port |
| 418 | * @remote_identify: attached device identification |
| 419 | * @rphy: sas transport rphy object |
| 420 | * @port: sas transport wide/narrow port object |
| 421 | * @phy_list: _sas_phy list objects belonging to this port |
| 422 | */ |
| 423 | struct _sas_port { |
| 424 | struct list_head port_list; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 425 | u8 num_phys; |
| 426 | struct sas_identify remote_identify; |
| 427 | struct sas_rphy *rphy; |
| 428 | struct sas_port *port; |
| 429 | struct list_head phy_list; |
| 430 | }; |
| 431 | |
| 432 | /** |
| 433 | * struct _sas_phy - phy information |
| 434 | * @port_siblings: list of phys belonging to a port |
| 435 | * @identify: phy identification |
| 436 | * @remote_identify: attached device identification |
| 437 | * @phy: sas transport phy object |
| 438 | * @phy_id: unique phy id |
| 439 | * @handle: device handle for this phy |
| 440 | * @attached_handle: device handle for attached device |
Kashyap, Desai | 38c2911 | 2010-04-05 14:18:34 +0530 | [diff] [blame] | 441 | * @phy_belongs_to_port: port has been created for this phy |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 442 | */ |
| 443 | struct _sas_phy { |
| 444 | struct list_head port_siblings; |
| 445 | struct sas_identify identify; |
| 446 | struct sas_identify remote_identify; |
| 447 | struct sas_phy *phy; |
| 448 | u8 phy_id; |
| 449 | u16 handle; |
| 450 | u16 attached_handle; |
Kashyap, Desai | 38c2911 | 2010-04-05 14:18:34 +0530 | [diff] [blame] | 451 | u8 phy_belongs_to_port; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 452 | }; |
| 453 | |
| 454 | /** |
| 455 | * struct _sas_node - sas_host/expander information |
| 456 | * @list: list of expanders |
| 457 | * @parent_dev: parent device class |
| 458 | * @num_phys: number phys belonging to this sas_host/expander |
| 459 | * @sas_address: sas address of this sas_host/expander |
| 460 | * @handle: handle for this sas_host/expander |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 461 | * @sas_address_parent: sas address of parent expander or sas host |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 462 | * @enclosure_handle: handle for this a member of an enclosure |
| 463 | * @device_info: bitwise defining capabilities of this sas_host/expander |
| 464 | * @responding: used in _scsih_expander_device_mark_responding |
| 465 | * @phy: a list of phys that make up this sas_host/expander |
| 466 | * @sas_port_list: list of ports attached to this sas_host/expander |
| 467 | */ |
| 468 | struct _sas_node { |
| 469 | struct list_head list; |
| 470 | struct device *parent_dev; |
| 471 | u8 num_phys; |
| 472 | u64 sas_address; |
| 473 | u16 handle; |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 474 | u64 sas_address_parent; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 475 | u16 enclosure_handle; |
| 476 | u64 enclosure_logical_id; |
| 477 | u8 responding; |
| 478 | struct _sas_phy *phy; |
| 479 | struct list_head sas_port_list; |
| 480 | }; |
| 481 | |
| 482 | /** |
| 483 | * enum reset_type - reset state |
| 484 | * @FORCE_BIG_HAMMER: issue diagnostic reset |
| 485 | * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer |
| 486 | */ |
| 487 | enum reset_type { |
| 488 | FORCE_BIG_HAMMER, |
| 489 | SOFT_RESET, |
| 490 | }; |
| 491 | |
| 492 | /** |
Kashyap, Desai | 35f805b | 2010-11-13 04:34:06 +0530 | [diff] [blame] | 493 | * struct chain_tracker - firmware chain tracker |
| 494 | * @chain_buffer: chain buffer |
| 495 | * @chain_buffer_dma: physical address |
| 496 | * @tracker_list: list of free request (ioc->free_chain_list) |
| 497 | */ |
| 498 | struct chain_tracker { |
| 499 | void *chain_buffer; |
| 500 | dma_addr_t chain_buffer_dma; |
| 501 | struct list_head tracker_list; |
| 502 | }; |
| 503 | |
| 504 | /** |
Kashyap, Desai | d5bd3491c | 2011-01-04 11:39:20 +0530 | [diff] [blame] | 505 | * struct scsiio_tracker - scsi mf request tracker |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 506 | * @smid: system message id |
| 507 | * @scmd: scsi request pointer |
| 508 | * @cb_idx: callback index |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 509 | * @direct_io: To indicate whether I/O is direct (WARPDRIVE) |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 510 | * @chain_list: list of chains associated to this IO |
| 511 | * @tracker_list: list of free request (ioc->free_list) |
| 512 | */ |
Kashyap, Desai | d5bd3491c | 2011-01-04 11:39:20 +0530 | [diff] [blame] | 513 | struct scsiio_tracker { |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 514 | u16 smid; |
| 515 | struct scsi_cmnd *scmd; |
| 516 | u8 cb_idx; |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 517 | u8 direct_io; |
Kashyap, Desai | 35f805b | 2010-11-13 04:34:06 +0530 | [diff] [blame] | 518 | struct list_head chain_list; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 519 | struct list_head tracker_list; |
| 520 | }; |
| 521 | |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 522 | /** |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 523 | * struct request_tracker - firmware request tracker |
Kashyap, Desai | d5bd3491c | 2011-01-04 11:39:20 +0530 | [diff] [blame] | 524 | * @smid: system message id |
Kashyap, Desai | d5bd3491c | 2011-01-04 11:39:20 +0530 | [diff] [blame] | 525 | * @cb_idx: callback index |
| 526 | * @tracker_list: list of free request (ioc->free_list) |
| 527 | */ |
| 528 | struct request_tracker { |
| 529 | u16 smid; |
| 530 | u8 cb_idx; |
| 531 | struct list_head tracker_list; |
| 532 | }; |
| 533 | |
| 534 | /** |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 535 | * struct _tr_list - target reset list |
| 536 | * @handle: device handle |
| 537 | * @state: state machine |
| 538 | */ |
| 539 | struct _tr_list { |
| 540 | struct list_head list; |
| 541 | u16 handle; |
| 542 | u16 state; |
| 543 | }; |
| 544 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 545 | typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr); |
| 546 | |
nagalakshmi.nandigama@lsi.com | 911ae94 | 2011-09-08 06:18:50 +0530 | [diff] [blame] | 547 | /** |
| 548 | * struct adapter_reply_queue - the reply queue struct |
| 549 | * @ioc: per adapter object |
| 550 | * @msix_index: msix index into vector table |
| 551 | * @vector: irq vector |
| 552 | * @reply_post_host_index: head index in the pool where FW completes IO |
| 553 | * @reply_post_free: reply post base virt address |
| 554 | * @name: the name registered to request_irq() |
| 555 | * @busy: isr is actively processing replies on another cpu |
| 556 | * @list: this list |
| 557 | */ |
| 558 | struct adapter_reply_queue { |
| 559 | struct MPT2SAS_ADAPTER *ioc; |
| 560 | u8 msix_index; |
| 561 | unsigned int vector; |
| 562 | u32 reply_post_host_index; |
| 563 | Mpi2ReplyDescriptorsUnion_t *reply_post_free; |
| 564 | char name[MPT_NAME_LENGTH]; |
| 565 | atomic_t busy; |
| 566 | struct list_head list; |
| 567 | }; |
| 568 | |
Kashyap, Desai | c97951e | 2011-06-14 10:54:56 +0530 | [diff] [blame] | 569 | /* IOC Facts and Port Facts converted from little endian to cpu */ |
| 570 | union mpi2_version_union { |
| 571 | MPI2_VERSION_STRUCT Struct; |
| 572 | u32 Word; |
| 573 | }; |
| 574 | |
| 575 | struct mpt2sas_facts { |
| 576 | u16 MsgVersion; |
| 577 | u16 HeaderVersion; |
| 578 | u8 IOCNumber; |
| 579 | u8 VP_ID; |
| 580 | u8 VF_ID; |
| 581 | u16 IOCExceptions; |
| 582 | u16 IOCStatus; |
| 583 | u32 IOCLogInfo; |
| 584 | u8 MaxChainDepth; |
| 585 | u8 WhoInit; |
| 586 | u8 NumberOfPorts; |
| 587 | u8 MaxMSIxVectors; |
| 588 | u16 RequestCredit; |
| 589 | u16 ProductID; |
| 590 | u32 IOCCapabilities; |
| 591 | union mpi2_version_union FWVersion; |
| 592 | u16 IOCRequestFrameSize; |
| 593 | u16 Reserved3; |
| 594 | u16 MaxInitiators; |
| 595 | u16 MaxTargets; |
| 596 | u16 MaxSasExpanders; |
| 597 | u16 MaxEnclosures; |
| 598 | u16 ProtocolFlags; |
| 599 | u16 HighPriorityCredit; |
| 600 | u16 MaxReplyDescriptorPostQueueDepth; |
| 601 | u8 ReplyFrameSize; |
| 602 | u8 MaxVolumes; |
| 603 | u16 MaxDevHandle; |
| 604 | u16 MaxPersistentEntries; |
| 605 | u16 MinDevHandle; |
| 606 | }; |
| 607 | |
| 608 | struct mpt2sas_port_facts { |
| 609 | u8 PortNumber; |
| 610 | u8 VP_ID; |
| 611 | u8 VF_ID; |
| 612 | u8 PortType; |
| 613 | u16 MaxPostedCmdBuffers; |
| 614 | }; |
| 615 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 616 | /** |
Kashyap, Desai | f93213d | 2011-06-14 10:56:43 +0530 | [diff] [blame] | 617 | * enum mutex_type - task management mutex type |
| 618 | * @TM_MUTEX_OFF: mutex is not required becuase calling function is acquiring it |
| 619 | * @TM_MUTEX_ON: mutex is required |
| 620 | */ |
| 621 | enum mutex_type { |
| 622 | TM_MUTEX_OFF = 0, |
| 623 | TM_MUTEX_ON = 1, |
| 624 | }; |
| 625 | |
| 626 | /** |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 627 | * struct MPT2SAS_ADAPTER - per adapter struct |
| 628 | * @list: ioc_list |
| 629 | * @shost: shost object |
| 630 | * @id: unique adapter id |
nagalakshmi.nandigama@lsi.com | 911ae94 | 2011-09-08 06:18:50 +0530 | [diff] [blame] | 631 | * @cpu_count: number online cpus |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 632 | * @name: generic ioc string |
| 633 | * @tmp_string: tmp string used for logging |
| 634 | * @pdev: pci pdev object |
| 635 | * @chip: memory mapped register space |
| 636 | * @chip_phys: physical addrss prior to mapping |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 637 | * @logging_level: see mpt2sas_debug.h |
Kashyap, Desai | fa7f316 | 2009-09-23 17:26:58 +0530 | [diff] [blame] | 638 | * @fwfault_debug: debuging FW timeouts |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 639 | * @ir_firmware: IR firmware present |
| 640 | * @bars: bitmask of BAR's that must be configured |
| 641 | * @mask_interrupts: ignore interrupt |
| 642 | * @fault_reset_work_q_name: fw fault work queue |
| 643 | * @fault_reset_work_q: "" |
| 644 | * @fault_reset_work: "" |
| 645 | * @firmware_event_name: fw event work queue |
| 646 | * @firmware_event_thread: "" |
| 647 | * @fw_events_off: flag to turn off fw event handling |
| 648 | * @fw_event_lock: |
| 649 | * @fw_event_list: list of fw events |
| 650 | * @aen_event_read_flag: event log was read |
| 651 | * @broadcast_aen_busy: broadcast aen waiting to be serviced |
Kashyap, Desai | 155dd4c | 2009-08-20 13:22:00 +0530 | [diff] [blame] | 652 | * @shost_recovery: host reset in progress |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 653 | * @ioc_reset_in_progress_lock: |
| 654 | * @ioc_link_reset_in_progress: phy/hard reset in progress |
Uwe Kleine-König | 65155b3 | 2010-06-11 12:17:01 +0200 | [diff] [blame] | 655 | * @ignore_loginfos: ignore loginfos during task management |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 656 | * @remove_host: flag for when driver unloads, to avoid sending dev resets |
Eric Moore | 3cb5469 | 2010-07-08 14:44:34 -0600 | [diff] [blame] | 657 | * @pci_error_recovery: flag to prevent ioc access until slot reset completes |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 658 | * @wait_for_port_enable_to_complete: |
| 659 | * @msix_enable: flag indicating msix is enabled |
| 660 | * @msix_vector_count: number msix vectors |
nagalakshmi.nandigama@lsi.com | 911ae94 | 2011-09-08 06:18:50 +0530 | [diff] [blame] | 661 | * @cpu_msix_table: table for mapping cpus to msix index |
| 662 | * @cpu_msix_table_sz: table size |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 663 | * @scsi_io_cb_idx: shost generated commands |
| 664 | * @tm_cb_idx: task management commands |
Kashyap, Desai | 744090d | 2009-10-05 15:56:56 +0530 | [diff] [blame] | 665 | * @scsih_cb_idx: scsih internal commands |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 666 | * @transport_cb_idx: transport internal commands |
| 667 | * @ctl_cb_idx: clt internal commands |
| 668 | * @base_cb_idx: base internal commands |
| 669 | * @config_cb_idx: base internal commands |
Kashyap, Desai | f3eedd6 | 2010-06-17 13:46:13 +0530 | [diff] [blame] | 670 | * @tm_tr_cb_idx : device removal target reset handshake |
| 671 | * @tm_tr_volume_cb_idx : volume removal target reset |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 672 | * @base_cmds: |
| 673 | * @transport_cmds: |
Kashyap, Desai | 744090d | 2009-10-05 15:56:56 +0530 | [diff] [blame] | 674 | * @scsih_cmds: |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 675 | * @tm_cmds: |
| 676 | * @ctl_cmds: |
| 677 | * @config_cmds: |
| 678 | * @base_add_sg_single: handler for either 32/64 bit sgl's |
| 679 | * @event_type: bits indicating which events to log |
| 680 | * @event_context: unique id for each logged event |
| 681 | * @event_log: event log pointer |
| 682 | * @event_masks: events that are masked |
| 683 | * @facts: static facts data |
| 684 | * @pfacts: static port facts data |
| 685 | * @manu_pg0: static manufacturing page 0 |
Kashyap, Desai | ed79f12 | 2009-08-20 13:23:49 +0530 | [diff] [blame] | 686 | * @manu_pg10: static manufacturing page 10 |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 687 | * @bios_pg2: static bios page 2 |
| 688 | * @bios_pg3: static bios page 3 |
| 689 | * @ioc_pg8: static ioc page 8 |
| 690 | * @iounit_pg0: static iounit page 0 |
| 691 | * @iounit_pg1: static iounit page 1 |
| 692 | * @sas_hba: sas host object |
| 693 | * @sas_expander_list: expander object list |
| 694 | * @sas_node_lock: |
| 695 | * @sas_device_list: sas device object list |
| 696 | * @sas_device_init_list: sas device object list (used only at init time) |
| 697 | * @sas_device_lock: |
| 698 | * @io_missing_delay: time for IO completed by fw when PDR enabled |
| 699 | * @device_missing_delay: time for device missing by fw when PDR enabled |
Kashyap, Desai | f3eedd6 | 2010-06-17 13:46:13 +0530 | [diff] [blame] | 700 | * @sas_id : used for setting volume target IDs |
| 701 | * @pd_handles : bitmask for PD handles |
| 702 | * @pd_handles_sz : size of pd_handle bitmask |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 703 | * @config_page_sz: config page size |
| 704 | * @config_page: reserve memory for config page payload |
| 705 | * @config_page_dma: |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 706 | * @hba_queue_depth: hba request queue depth |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 707 | * @sge_size: sg element size for either 32/64 bit |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 708 | * @scsiio_depth: SCSI_IO queue depth |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 709 | * @request_sz: per request frame size |
| 710 | * @request: pool of request frames |
| 711 | * @request_dma: |
| 712 | * @request_dma_sz: |
| 713 | * @scsi_lookup: firmware request tracker list |
| 714 | * @scsi_lookup_lock: |
| 715 | * @free_list: free list of request |
| 716 | * @chain: pool of chains |
| 717 | * @pending_io_count: |
| 718 | * @reset_wq: |
| 719 | * @chain_dma: |
| 720 | * @max_sges_in_main_message: number sg elements in main message |
| 721 | * @max_sges_in_chain_message: number sg elements per chain |
| 722 | * @chains_needed_per_io: max chains per io |
| 723 | * @chain_offset_value_for_main_message: location 1st sg in main |
| 724 | * @chain_depth: total chains allocated |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 725 | * @hi_priority_smid: |
| 726 | * @hi_priority: |
| 727 | * @hi_priority_dma: |
| 728 | * @hi_priority_depth: |
| 729 | * @hpr_lookup: |
| 730 | * @hpr_free_list: |
| 731 | * @internal_smid: |
| 732 | * @internal: |
| 733 | * @internal_dma: |
| 734 | * @internal_depth: |
| 735 | * @internal_lookup: |
| 736 | * @internal_free_list: |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 737 | * @sense: pool of sense |
| 738 | * @sense_dma: |
| 739 | * @sense_dma_pool: |
| 740 | * @reply_depth: hba reply queue depth: |
| 741 | * @reply_sz: per reply frame size: |
| 742 | * @reply: pool of replys: |
| 743 | * @reply_dma: |
| 744 | * @reply_dma_pool: |
| 745 | * @reply_free_queue_depth: reply free depth |
| 746 | * @reply_free: pool for reply free queue (32 bit addr) |
| 747 | * @reply_free_dma: |
| 748 | * @reply_free_dma_pool: |
| 749 | * @reply_free_host_index: tail index in pool to insert free replys |
| 750 | * @reply_post_queue_depth: reply post queue depth |
| 751 | * @reply_post_free: pool for reply post (64bit descriptor) |
| 752 | * @reply_post_free_dma: |
nagalakshmi.nandigama@lsi.com | 911ae94 | 2011-09-08 06:18:50 +0530 | [diff] [blame] | 753 | * @reply_queue_count: number of reply queue's |
| 754 | * @reply_queue_list: link list contaning the reply queue info |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 755 | * @reply_post_host_index: head index in the pool where FW completes IO |
Kashyap, Desai | f3eedd6 | 2010-06-17 13:46:13 +0530 | [diff] [blame] | 756 | * @delayed_tr_list: target reset link list |
| 757 | * @delayed_tr_volume_list: volume target reset link list |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 758 | */ |
| 759 | struct MPT2SAS_ADAPTER { |
| 760 | struct list_head list; |
| 761 | struct Scsi_Host *shost; |
| 762 | u8 id; |
nagalakshmi.nandigama@lsi.com | 911ae94 | 2011-09-08 06:18:50 +0530 | [diff] [blame] | 763 | int cpu_count; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 764 | char name[MPT_NAME_LENGTH]; |
| 765 | char tmp_string[MPT_STRING_LENGTH]; |
| 766 | struct pci_dev *pdev; |
| 767 | Mpi2SystemInterfaceRegs_t __iomem *chip; |
Kashyap, Desai | 6846e75 | 2009-12-16 18:51:45 +0530 | [diff] [blame] | 768 | resource_size_t chip_phys; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 769 | int logging_level; |
Kashyap, Desai | fa7f316 | 2009-09-23 17:26:58 +0530 | [diff] [blame] | 770 | int fwfault_debug; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 771 | u8 ir_firmware; |
| 772 | int bars; |
| 773 | u8 mask_interrupts; |
| 774 | |
| 775 | /* fw fault handler */ |
| 776 | char fault_reset_work_q_name[20]; |
| 777 | struct workqueue_struct *fault_reset_work_q; |
| 778 | struct delayed_work fault_reset_work; |
| 779 | |
| 780 | /* fw event handler */ |
| 781 | char firmware_event_name[20]; |
| 782 | struct workqueue_struct *firmware_event_thread; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 783 | spinlock_t fw_event_lock; |
| 784 | struct list_head fw_event_list; |
| 785 | |
| 786 | /* misc flags */ |
| 787 | int aen_event_read_flag; |
| 788 | u8 broadcast_aen_busy; |
Kashyap, Desai | f93213d | 2011-06-14 10:56:43 +0530 | [diff] [blame] | 789 | u16 broadcast_aen_pending; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 790 | u8 shost_recovery; |
Kashyap, Desai | d274213 | 2010-06-17 13:28:55 +0530 | [diff] [blame] | 791 | |
| 792 | struct mutex reset_in_progress_mutex; |
Kashyap, Desai | f1c35e6 | 2010-03-09 16:31:43 +0530 | [diff] [blame] | 793 | struct completion shost_recovery_done; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 794 | spinlock_t ioc_reset_in_progress_lock; |
| 795 | u8 ioc_link_reset_in_progress; |
Kashyap, Desai | d274213 | 2010-06-17 13:28:55 +0530 | [diff] [blame] | 796 | int ioc_reset_in_progress_status; |
| 797 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 798 | u8 ignore_loginfos; |
| 799 | u8 remove_host; |
Eric Moore | 3cb5469 | 2010-07-08 14:44:34 -0600 | [diff] [blame] | 800 | u8 pci_error_recovery; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 801 | u8 wait_for_port_enable_to_complete; |
| 802 | |
| 803 | u8 msix_enable; |
| 804 | u16 msix_vector_count; |
nagalakshmi.nandigama@lsi.com | 911ae94 | 2011-09-08 06:18:50 +0530 | [diff] [blame] | 805 | u8 *cpu_msix_table; |
| 806 | resource_size_t **reply_post_host_index; |
| 807 | u16 cpu_msix_table_sz; |
Kashyap, Desai | d32a8c1 | 2010-06-17 13:36:53 +0530 | [diff] [blame] | 808 | u32 ioc_reset_count; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 809 | |
| 810 | /* internal commands, callback index */ |
| 811 | u8 scsi_io_cb_idx; |
| 812 | u8 tm_cb_idx; |
| 813 | u8 transport_cb_idx; |
Kashyap, Desai | 744090d | 2009-10-05 15:56:56 +0530 | [diff] [blame] | 814 | u8 scsih_cb_idx; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 815 | u8 ctl_cb_idx; |
| 816 | u8 base_cb_idx; |
| 817 | u8 config_cb_idx; |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 818 | u8 tm_tr_cb_idx; |
Kashyap, Desai | f3eedd6 | 2010-06-17 13:46:13 +0530 | [diff] [blame] | 819 | u8 tm_tr_volume_cb_idx; |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 820 | u8 tm_sas_control_cb_idx; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 821 | struct _internal_cmd base_cmds; |
| 822 | struct _internal_cmd transport_cmds; |
Kashyap, Desai | 744090d | 2009-10-05 15:56:56 +0530 | [diff] [blame] | 823 | struct _internal_cmd scsih_cmds; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 824 | struct _internal_cmd tm_cmds; |
| 825 | struct _internal_cmd ctl_cmds; |
| 826 | struct _internal_cmd config_cmds; |
| 827 | |
| 828 | MPT_ADD_SGE base_add_sg_single; |
| 829 | |
| 830 | /* event log */ |
| 831 | u32 event_type[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; |
| 832 | u32 event_context; |
| 833 | void *event_log; |
| 834 | u32 event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; |
| 835 | |
| 836 | /* static config pages */ |
Kashyap, Desai | c97951e | 2011-06-14 10:54:56 +0530 | [diff] [blame] | 837 | struct mpt2sas_facts facts; |
| 838 | struct mpt2sas_port_facts *pfacts; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 839 | Mpi2ManufacturingPage0_t manu_pg0; |
| 840 | Mpi2BiosPage2_t bios_pg2; |
| 841 | Mpi2BiosPage3_t bios_pg3; |
| 842 | Mpi2IOCPage8_t ioc_pg8; |
| 843 | Mpi2IOUnitPage0_t iounit_pg0; |
| 844 | Mpi2IOUnitPage1_t iounit_pg1; |
| 845 | |
| 846 | struct _boot_device req_boot_device; |
| 847 | struct _boot_device req_alt_boot_device; |
| 848 | struct _boot_device current_boot_device; |
| 849 | |
| 850 | /* sas hba, expander, and device list */ |
| 851 | struct _sas_node sas_hba; |
| 852 | struct list_head sas_expander_list; |
| 853 | spinlock_t sas_node_lock; |
| 854 | struct list_head sas_device_list; |
| 855 | struct list_head sas_device_init_list; |
| 856 | spinlock_t sas_device_lock; |
| 857 | struct list_head raid_device_list; |
| 858 | spinlock_t raid_device_lock; |
| 859 | u8 io_missing_delay; |
| 860 | u16 device_missing_delay; |
| 861 | int sas_id; |
| 862 | |
Kashyap, Desai | f3eedd6 | 2010-06-17 13:46:13 +0530 | [diff] [blame] | 863 | void *pd_handles; |
| 864 | u16 pd_handles_sz; |
| 865 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 866 | /* config page */ |
| 867 | u16 config_page_sz; |
| 868 | void *config_page; |
| 869 | dma_addr_t config_page_dma; |
| 870 | |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 871 | /* scsiio request */ |
| 872 | u16 hba_queue_depth; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 873 | u16 sge_size; |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 874 | u16 scsiio_depth; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 875 | u16 request_sz; |
| 876 | u8 *request; |
| 877 | dma_addr_t request_dma; |
| 878 | u32 request_dma_sz; |
Kashyap, Desai | d5bd3491c | 2011-01-04 11:39:20 +0530 | [diff] [blame] | 879 | struct scsiio_tracker *scsi_lookup; |
Kashyap, Desai | 89009fb | 2010-03-17 16:22:52 +0530 | [diff] [blame] | 880 | ulong scsi_lookup_pages; |
| 881 | spinlock_t scsi_lookup_lock; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 882 | struct list_head free_list; |
| 883 | int pending_io_count; |
| 884 | wait_queue_head_t reset_wq; |
| 885 | |
| 886 | /* chain */ |
Kashyap, Desai | 35f805b | 2010-11-13 04:34:06 +0530 | [diff] [blame] | 887 | struct chain_tracker *chain_lookup; |
| 888 | struct list_head free_chain_list; |
| 889 | struct dma_pool *chain_dma_pool; |
| 890 | ulong chain_pages; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 891 | u16 max_sges_in_main_message; |
| 892 | u16 max_sges_in_chain_message; |
| 893 | u16 chains_needed_per_io; |
| 894 | u16 chain_offset_value_for_main_message; |
Kashyap, Desai | 89009fb | 2010-03-17 16:22:52 +0530 | [diff] [blame] | 895 | u32 chain_depth; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 896 | |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 897 | /* hi-priority queue */ |
| 898 | u16 hi_priority_smid; |
| 899 | u8 *hi_priority; |
| 900 | dma_addr_t hi_priority_dma; |
| 901 | u16 hi_priority_depth; |
| 902 | struct request_tracker *hpr_lookup; |
| 903 | struct list_head hpr_free_list; |
| 904 | |
| 905 | /* internal queue */ |
| 906 | u16 internal_smid; |
| 907 | u8 *internal; |
| 908 | dma_addr_t internal_dma; |
| 909 | u16 internal_depth; |
| 910 | struct request_tracker *internal_lookup; |
| 911 | struct list_head internal_free_list; |
| 912 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 913 | /* sense */ |
| 914 | u8 *sense; |
| 915 | dma_addr_t sense_dma; |
| 916 | struct dma_pool *sense_dma_pool; |
| 917 | |
| 918 | /* reply */ |
| 919 | u16 reply_sz; |
| 920 | u8 *reply; |
| 921 | dma_addr_t reply_dma; |
Kashyap, Desai | dd3741d | 2010-11-13 04:31:14 +0530 | [diff] [blame] | 922 | u32 reply_dma_max_address; |
| 923 | u32 reply_dma_min_address; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 924 | struct dma_pool *reply_dma_pool; |
| 925 | |
| 926 | /* reply free queue */ |
| 927 | u16 reply_free_queue_depth; |
Kashyap, Desai | c97951e | 2011-06-14 10:54:56 +0530 | [diff] [blame] | 928 | __le32 *reply_free; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 929 | dma_addr_t reply_free_dma; |
| 930 | struct dma_pool *reply_free_dma_pool; |
| 931 | u32 reply_free_host_index; |
| 932 | |
| 933 | /* reply post queue */ |
| 934 | u16 reply_post_queue_depth; |
| 935 | Mpi2ReplyDescriptorsUnion_t *reply_post_free; |
| 936 | dma_addr_t reply_post_free_dma; |
| 937 | struct dma_pool *reply_post_free_dma_pool; |
nagalakshmi.nandigama@lsi.com | 911ae94 | 2011-09-08 06:18:50 +0530 | [diff] [blame] | 938 | u8 reply_queue_count; |
| 939 | struct list_head reply_queue_list; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 940 | |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 941 | struct list_head delayed_tr_list; |
Kashyap, Desai | f3eedd6 | 2010-06-17 13:46:13 +0530 | [diff] [blame] | 942 | struct list_head delayed_tr_volume_list; |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 943 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 944 | /* diag buffer support */ |
| 945 | u8 *diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 946 | u32 diag_buffer_sz[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 947 | dma_addr_t diag_buffer_dma[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 948 | u8 diag_buffer_status[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 949 | u32 unique_id[MPI2_DIAG_BUF_TYPE_COUNT]; |
Kashyap, Desai | ed79f12 | 2009-08-20 13:23:49 +0530 | [diff] [blame] | 950 | Mpi2ManufacturingPage10_t manu_pg10; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 951 | u32 product_specific[MPI2_DIAG_BUF_TYPE_COUNT][23]; |
| 952 | u32 diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT]; |
Kashyap, Desai | 570c67a | 2010-06-17 13:43:17 +0530 | [diff] [blame] | 953 | u32 ring_buffer_offset; |
| 954 | u32 ring_buffer_sz; |
Kashyap, Desai | 0bdccdb | 2011-04-07 12:32:49 +0530 | [diff] [blame] | 955 | u8 is_warpdrive; |
| 956 | u8 hide_ir_msg; |
| 957 | u8 mfg_pg10_hide_flag; |
| 958 | u8 hide_drives; |
| 959 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 960 | }; |
| 961 | |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 962 | typedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
| 963 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 964 | |
| 965 | |
| 966 | /* base shared API */ |
Eric Moore | ba33fad | 2009-03-15 21:37:18 -0600 | [diff] [blame] | 967 | extern struct list_head mpt2sas_ioc_list; |
Kashyap, Desai | e4750c9 | 2009-08-07 19:37:59 +0530 | [diff] [blame] | 968 | void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc); |
| 969 | void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 970 | |
| 971 | int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc); |
| 972 | void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc); |
| 973 | int mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc); |
| 974 | void mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc); |
| 975 | int mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, |
| 976 | enum reset_type type); |
| 977 | |
| 978 | void *mpt2sas_base_get_msg_frame(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
| 979 | void *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
| 980 | void mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER *ioc, void *paddr); |
Kashyap, Desai | ec9472c | 2009-09-23 17:34:13 +0530 | [diff] [blame] | 981 | __le32 mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc, |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 982 | u16 smid); |
nagalakshmi.nandigama@lsi.com | 911ae94 | 2011-09-08 06:18:50 +0530 | [diff] [blame] | 983 | void mpt2sas_base_flush_reply_queues(struct MPT2SAS_ADAPTER *ioc); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 984 | |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 985 | /* hi-priority queue */ |
| 986 | u16 mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx); |
| 987 | u16 mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx, |
| 988 | struct scsi_cmnd *scmd); |
| 989 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 990 | u16 mpt2sas_base_get_smid(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx); |
| 991 | void mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 992 | void mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid, |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 993 | u16 handle); |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 994 | void mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 995 | void mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid, |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 996 | u16 io_index); |
| 997 | void mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 998 | void mpt2sas_base_initialize_callback_handler(void); |
| 999 | u8 mpt2sas_base_register_callback_handler(MPT_CALLBACK cb_func); |
| 1000 | void mpt2sas_base_release_callback_handler(u8 cb_idx); |
| 1001 | |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 1002 | u8 mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 1003 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1004 | void *mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr); |
| 1005 | |
| 1006 | u32 mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER *ioc, int cooked); |
| 1007 | |
| 1008 | void mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER *ioc , u16 fault_code); |
| 1009 | int mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc, |
| 1010 | Mpi2SasIoUnitControlReply_t *mpi_reply, Mpi2SasIoUnitControlRequest_t |
| 1011 | *mpi_request); |
| 1012 | int mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc, |
| 1013 | Mpi2SepReply_t *mpi_reply, Mpi2SepRequest_t *mpi_request); |
| 1014 | void mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_type); |
| 1015 | |
Kashyap, Desai | fa7f316 | 2009-09-23 17:26:58 +0530 | [diff] [blame] | 1016 | void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc); |
| 1017 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1018 | /* scsih shared API */ |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 1019 | u8 mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index, |
| 1020 | u32 reply); |
Kashyap, Desai | 8ed9a03 | 2010-03-17 16:25:59 +0530 | [diff] [blame] | 1021 | int mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, |
Kashyap, Desai | f93213d | 2011-06-14 10:56:43 +0530 | [diff] [blame] | 1022 | uint channel, uint id, uint lun, u8 type, u16 smid_task, |
| 1023 | ulong timeout, unsigned long serial_number, enum mutex_type m_type); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1024 | void mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle); |
| 1025 | void mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle); |
Kashyap, Desai | 7f6f794 | 2010-11-13 04:35:30 +0530 | [diff] [blame] | 1026 | void mpt2sas_expander_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address); |
| 1027 | void mpt2sas_device_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1028 | struct _sas_node *mpt2sas_scsih_expander_find_by_handle(struct MPT2SAS_ADAPTER *ioc, |
| 1029 | u16 handle); |
| 1030 | struct _sas_node *mpt2sas_scsih_expander_find_by_sas_address(struct MPT2SAS_ADAPTER |
| 1031 | *ioc, u64 sas_address); |
| 1032 | struct _sas_device *mpt2sas_scsih_sas_device_find_by_sas_address( |
| 1033 | struct MPT2SAS_ADAPTER *ioc, u64 sas_address); |
| 1034 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1035 | void mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase); |
| 1036 | |
| 1037 | /* config shared API */ |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 1038 | u8 mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 1039 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1040 | int mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys); |
| 1041 | int mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc, |
| 1042 | Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage0_t *config_page); |
Kashyap, Desai | ed79f12 | 2009-08-20 13:23:49 +0530 | [diff] [blame] | 1043 | int mpt2sas_config_get_manufacturing_pg10(struct MPT2SAS_ADAPTER *ioc, |
| 1044 | Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage10_t *config_page); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1045 | int mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1046 | *mpi_reply, Mpi2BiosPage2_t *config_page); |
| 1047 | int mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1048 | *mpi_reply, Mpi2BiosPage3_t *config_page); |
| 1049 | int mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1050 | *mpi_reply, Mpi2IOUnitPage0_t *config_page); |
| 1051 | int mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1052 | *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u32 handle); |
| 1053 | int mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1054 | *mpi_reply, Mpi2SasDevicePage1_t *config_page, u32 form, u32 handle); |
| 1055 | int mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1056 | *mpi_reply, Mpi2SasIOUnitPage0_t *config_page, u16 sz); |
| 1057 | int mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1058 | *mpi_reply, Mpi2IOUnitPage1_t *config_page); |
| 1059 | int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
Kashyap, Desai | 5b76858 | 2009-08-20 13:24:31 +0530 | [diff] [blame] | 1060 | *mpi_reply, Mpi2IOUnitPage1_t *config_page); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1061 | int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1062 | *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz); |
Kashyap, Desai | 50d5c60 | 2009-12-16 18:55:26 +0530 | [diff] [blame] | 1063 | int mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, |
| 1064 | Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1065 | int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1066 | *mpi_reply, Mpi2IOCPage8_t *config_page); |
| 1067 | int mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1068 | *mpi_reply, Mpi2ExpanderPage0_t *config_page, u32 form, u32 handle); |
| 1069 | int mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1070 | *mpi_reply, Mpi2ExpanderPage1_t *config_page, u32 phy_number, u16 handle); |
| 1071 | int mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1072 | *mpi_reply, Mpi2SasEnclosurePage0_t *config_page, u32 form, u32 handle); |
| 1073 | int mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1074 | *mpi_reply, Mpi2SasPhyPage0_t *config_page, u32 phy_number); |
| 1075 | int mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1076 | *mpi_reply, Mpi2SasPhyPage1_t *config_page, u32 phy_number); |
| 1077 | int mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1078 | *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u32 handle); |
| 1079 | int mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 *num_pds); |
| 1080 | int mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1081 | *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 form, u32 handle, u16 sz); |
| 1082 | int mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 1083 | *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 form, |
| 1084 | u32 form_specific); |
| 1085 | int mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle, |
| 1086 | u16 *volume_handle); |
| 1087 | int mpt2sas_config_get_volume_wwid(struct MPT2SAS_ADAPTER *ioc, u16 volume_handle, |
| 1088 | u64 *wwid); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1089 | /* ctl shared API */ |
| 1090 | extern struct device_attribute *mpt2sas_host_attrs[]; |
| 1091 | extern struct device_attribute *mpt2sas_dev_attrs[]; |
| 1092 | void mpt2sas_ctl_init(void); |
| 1093 | void mpt2sas_ctl_exit(void); |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 1094 | u8 mpt2sas_ctl_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 1095 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1096 | void mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase); |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 1097 | u8 mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index, |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 1098 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1099 | void mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER *ioc, |
| 1100 | Mpi2EventNotificationReply_t *mpi_reply); |
| 1101 | |
Kashyap, Desai | 32e0eb5 | 2009-09-23 17:28:09 +0530 | [diff] [blame] | 1102 | void mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER *ioc, |
| 1103 | u8 bits_to_regsiter); |
| 1104 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1105 | /* transport shared API */ |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 1106 | u8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
| 1107 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1108 | struct _sas_port *mpt2sas_transport_port_add(struct MPT2SAS_ADAPTER *ioc, |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 1109 | u16 handle, u64 sas_address); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1110 | void mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address, |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 1111 | u64 sas_address_parent); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1112 | int mpt2sas_transport_add_host_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy |
| 1113 | *mpt2sas_phy, Mpi2SasPhyPage0_t phy_pg0, struct device *parent_dev); |
| 1114 | int mpt2sas_transport_add_expander_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy |
| 1115 | *mpt2sas_phy, Mpi2ExpanderPage1_t expander_pg1, struct device *parent_dev); |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 1116 | void mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc, |
| 1117 | u64 sas_address, u16 handle, u8 phy_number, u8 link_rate); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1118 | extern struct sas_function_template mpt2sas_transport_functions; |
| 1119 | extern struct scsi_transport_template *mpt2sas_transport_template; |
Kashyap, Desai | 34a03be | 2009-08-20 13:23:19 +0530 | [diff] [blame] | 1120 | extern int scsi_internal_device_block(struct scsi_device *sdev); |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 1121 | extern u8 mpt2sas_stm_zero_smid_handler(struct MPT2SAS_ADAPTER *ioc, |
| 1122 | u8 msix_index, u32 reply); |
Kashyap, Desai | 34a03be | 2009-08-20 13:23:19 +0530 | [diff] [blame] | 1123 | extern int scsi_internal_device_unblock(struct scsi_device *sdev); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 1124 | |
| 1125 | #endif /* MPT2SAS_BASE_H_INCLUDED */ |