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" |
Kashyap, Desai | aea20f9 | 2010-04-08 17:55:52 +0530 | [diff] [blame] | 72 | #define MPT2SAS_DRIVER_VERSION "05.100.00.02" |
Kashyap, Desai | 1a7d7ea | 2010-03-17 16:28:34 +0530 | [diff] [blame] | 73 | #define MPT2SAS_MAJOR_VERSION 05 |
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 |
Kashyap, Desai | aea20f9 | 2010-04-08 17:55:52 +0530 | [diff] [blame] | 76 | #define MPT2SAS_RELEASE_VERSION 02 |
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 | |
| 104 | #define MPT_MAX_CALLBACKS 16 |
| 105 | |
| 106 | #define CAN_SLEEP 1 |
| 107 | #define NO_SLEEP 0 |
| 108 | |
| 109 | #define INTERNAL_CMDS_COUNT 10 /* reserved cmds */ |
| 110 | |
| 111 | #define MPI2_HIM_MASK 0xFFFFFFFF /* mask every bit*/ |
| 112 | |
| 113 | #define MPT2SAS_INVALID_DEVICE_HANDLE 0xFFFF |
| 114 | |
| 115 | |
| 116 | /* |
| 117 | * reset phases |
| 118 | */ |
| 119 | #define MPT2_IOC_PRE_RESET 1 /* prior to host reset */ |
| 120 | #define MPT2_IOC_AFTER_RESET 2 /* just after host reset */ |
| 121 | #define MPT2_IOC_DONE_RESET 3 /* links re-initialized */ |
| 122 | |
| 123 | /* |
| 124 | * logging format |
| 125 | */ |
| 126 | #define MPT2SAS_FMT "%s: " |
| 127 | #define MPT2SAS_DEBUG_FMT KERN_DEBUG MPT2SAS_FMT |
| 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 | /* |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 158 | * per target private data |
| 159 | */ |
| 160 | #define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01 |
| 161 | #define MPT_TARGET_FLAGS_VOLUME 0x02 |
| 162 | #define MPT_TARGET_FLAGS_DELETED 0x04 |
| 163 | |
| 164 | /** |
| 165 | * struct MPT2SAS_TARGET - starget private hostdata |
| 166 | * @starget: starget object |
| 167 | * @sas_address: target sas address |
| 168 | * @handle: device handle |
| 169 | * @num_luns: number luns |
| 170 | * @flags: MPT_TARGET_FLAGS_XXX flags |
| 171 | * @deleted: target flaged for deletion |
| 172 | * @tm_busy: target is busy with TM request. |
| 173 | */ |
| 174 | struct MPT2SAS_TARGET { |
| 175 | struct scsi_target *starget; |
| 176 | u64 sas_address; |
| 177 | u16 handle; |
| 178 | int num_luns; |
| 179 | u32 flags; |
| 180 | u8 deleted; |
| 181 | u8 tm_busy; |
| 182 | }; |
| 183 | |
| 184 | /* |
| 185 | * per device private data |
| 186 | */ |
| 187 | #define MPT_DEVICE_FLAGS_INIT 0x01 |
| 188 | #define MPT_DEVICE_TLR_ON 0x02 |
| 189 | |
| 190 | /** |
| 191 | * struct MPT2SAS_DEVICE - sdev private hostdata |
| 192 | * @sas_target: starget private hostdata |
| 193 | * @lun: lun number |
| 194 | * @flags: MPT_DEVICE_XXX flags |
| 195 | * @configured_lun: lun is configured |
| 196 | * @block: device is in SDEV_BLOCK state |
| 197 | * @tlr_snoop_check: flag used in determining whether to disable TLR |
| 198 | */ |
Kashyap, Desai | ed79f12 | 2009-08-20 13:23:49 +0530 | [diff] [blame] | 199 | |
| 200 | /* OEM Identifiers */ |
| 201 | #define MFG10_OEM_ID_INVALID (0x00000000) |
| 202 | #define MFG10_OEM_ID_DELL (0x00000001) |
| 203 | #define MFG10_OEM_ID_FSC (0x00000002) |
| 204 | #define MFG10_OEM_ID_SUN (0x00000003) |
| 205 | #define MFG10_OEM_ID_IBM (0x00000004) |
| 206 | |
| 207 | /* GENERIC Flags 0*/ |
| 208 | #define MFG10_GF0_OCE_DISABLED (0x00000001) |
| 209 | #define MFG10_GF0_R1E_DRIVE_COUNT (0x00000002) |
| 210 | #define MFG10_GF0_R10_DISPLAY (0x00000004) |
| 211 | #define MFG10_GF0_SSD_DATA_SCRUB_DISABLE (0x00000008) |
| 212 | #define MFG10_GF0_SINGLE_DRIVE_R0 (0x00000010) |
| 213 | |
| 214 | /* OEM Specific Flags will come from OEM specific header files */ |
| 215 | typedef struct _MPI2_CONFIG_PAGE_MAN_10 { |
| 216 | MPI2_CONFIG_PAGE_HEADER Header; /* 00h */ |
| 217 | U8 OEMIdentifier; /* 04h */ |
| 218 | U8 Reserved1; /* 05h */ |
| 219 | U16 Reserved2; /* 08h */ |
| 220 | U32 Reserved3; /* 0Ch */ |
| 221 | U32 GenericFlags0; /* 10h */ |
| 222 | U32 GenericFlags1; /* 14h */ |
| 223 | U32 Reserved4; /* 18h */ |
| 224 | U32 OEMSpecificFlags0; /* 1Ch */ |
| 225 | U32 OEMSpecificFlags1; /* 20h */ |
| 226 | U32 Reserved5[18]; /* 24h-60h*/ |
| 227 | } MPI2_CONFIG_PAGE_MAN_10, |
| 228 | MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_10, |
| 229 | Mpi2ManufacturingPage10_t, MPI2_POINTER pMpi2ManufacturingPage10_t; |
| 230 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 231 | struct MPT2SAS_DEVICE { |
| 232 | struct MPT2SAS_TARGET *sas_target; |
| 233 | unsigned int lun; |
| 234 | u32 flags; |
| 235 | u8 configured_lun; |
| 236 | u8 block; |
| 237 | u8 tlr_snoop_check; |
| 238 | }; |
| 239 | |
| 240 | #define MPT2_CMD_NOT_USED 0x8000 /* free */ |
| 241 | #define MPT2_CMD_COMPLETE 0x0001 /* completed */ |
| 242 | #define MPT2_CMD_PENDING 0x0002 /* pending */ |
| 243 | #define MPT2_CMD_REPLY_VALID 0x0004 /* reply is valid */ |
| 244 | #define MPT2_CMD_RESET 0x0008 /* host reset dropped the command */ |
| 245 | |
| 246 | /** |
| 247 | * struct _internal_cmd - internal commands struct |
| 248 | * @mutex: mutex |
| 249 | * @done: completion |
| 250 | * @reply: reply message pointer |
| 251 | * @status: MPT2_CMD_XXX status |
| 252 | * @smid: system message id |
| 253 | */ |
| 254 | struct _internal_cmd { |
| 255 | struct mutex mutex; |
| 256 | struct completion done; |
| 257 | void *reply; |
| 258 | u16 status; |
| 259 | u16 smid; |
| 260 | }; |
| 261 | |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 262 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 263 | /** |
| 264 | * struct _sas_device - attached device information |
| 265 | * @list: sas device list |
| 266 | * @starget: starget object |
| 267 | * @sas_address: device sas address |
| 268 | * @device_name: retrieved from the SAS IDENTIFY frame. |
| 269 | * @handle: device handle |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 270 | * @sas_address_parent: sas address of parent expander or sas host |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 271 | * @enclosure_handle: enclosure handle |
| 272 | * @enclosure_logical_id: enclosure logical identifier |
| 273 | * @volume_handle: volume handle (valid when hidden raid member) |
| 274 | * @volume_wwid: volume unique identifier |
| 275 | * @device_info: bitfield provides detailed info about the device |
| 276 | * @id: target id |
| 277 | * @channel: target channel |
| 278 | * @slot: number number |
| 279 | * @hidden_raid_component: set to 1 when this is a raid member |
| 280 | * @responding: used in _scsih_sas_device_mark_responding |
| 281 | */ |
| 282 | struct _sas_device { |
| 283 | struct list_head list; |
| 284 | struct scsi_target *starget; |
| 285 | u64 sas_address; |
| 286 | u64 device_name; |
| 287 | u16 handle; |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 288 | u64 sas_address_parent; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 289 | u16 enclosure_handle; |
| 290 | u64 enclosure_logical_id; |
| 291 | u16 volume_handle; |
| 292 | u64 volume_wwid; |
| 293 | u32 device_info; |
| 294 | int id; |
| 295 | int channel; |
| 296 | u16 slot; |
| 297 | u8 hidden_raid_component; |
| 298 | u8 responding; |
| 299 | }; |
| 300 | |
| 301 | /** |
| 302 | * struct _raid_device - raid volume link list |
| 303 | * @list: sas device list |
| 304 | * @starget: starget object |
| 305 | * @sdev: scsi device struct (volumes are single lun) |
| 306 | * @wwid: unique identifier for the volume |
| 307 | * @handle: device handle |
| 308 | * @id: target id |
| 309 | * @channel: target channel |
| 310 | * @volume_type: the raid level |
| 311 | * @device_info: bitfield provides detailed info about the hidden components |
| 312 | * @num_pds: number of hidden raid components |
| 313 | * @responding: used in _scsih_raid_device_mark_responding |
Kashyap, Desai | f7c95ef | 2009-12-16 18:54:42 +0530 | [diff] [blame] | 314 | * @percent_complete: resync percent complete |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 315 | */ |
| 316 | struct _raid_device { |
| 317 | struct list_head list; |
| 318 | struct scsi_target *starget; |
| 319 | struct scsi_device *sdev; |
| 320 | u64 wwid; |
| 321 | u16 handle; |
| 322 | int id; |
| 323 | int channel; |
| 324 | u8 volume_type; |
| 325 | u32 device_info; |
| 326 | u8 num_pds; |
| 327 | u8 responding; |
Kashyap, Desai | f7c95ef | 2009-12-16 18:54:42 +0530 | [diff] [blame] | 328 | u8 percent_complete; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 329 | }; |
| 330 | |
| 331 | /** |
| 332 | * struct _boot_device - boot device info |
| 333 | * @is_raid: flag to indicate whether this is volume |
| 334 | * @device: holds pointer for either struct _sas_device or |
| 335 | * struct _raid_device |
| 336 | */ |
| 337 | struct _boot_device { |
| 338 | u8 is_raid; |
| 339 | void *device; |
| 340 | }; |
| 341 | |
| 342 | /** |
| 343 | * struct _sas_port - wide/narrow sas port information |
| 344 | * @port_list: list of ports belonging to expander |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 345 | * @num_phys: number of phys belonging to this port |
| 346 | * @remote_identify: attached device identification |
| 347 | * @rphy: sas transport rphy object |
| 348 | * @port: sas transport wide/narrow port object |
| 349 | * @phy_list: _sas_phy list objects belonging to this port |
| 350 | */ |
| 351 | struct _sas_port { |
| 352 | struct list_head port_list; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 353 | u8 num_phys; |
| 354 | struct sas_identify remote_identify; |
| 355 | struct sas_rphy *rphy; |
| 356 | struct sas_port *port; |
| 357 | struct list_head phy_list; |
| 358 | }; |
| 359 | |
| 360 | /** |
| 361 | * struct _sas_phy - phy information |
| 362 | * @port_siblings: list of phys belonging to a port |
| 363 | * @identify: phy identification |
| 364 | * @remote_identify: attached device identification |
| 365 | * @phy: sas transport phy object |
| 366 | * @phy_id: unique phy id |
| 367 | * @handle: device handle for this phy |
| 368 | * @attached_handle: device handle for attached device |
Kashyap, Desai | 38c2911 | 2010-04-05 14:18:34 +0530 | [diff] [blame] | 369 | * @phy_belongs_to_port: port has been created for this phy |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 370 | */ |
| 371 | struct _sas_phy { |
| 372 | struct list_head port_siblings; |
| 373 | struct sas_identify identify; |
| 374 | struct sas_identify remote_identify; |
| 375 | struct sas_phy *phy; |
| 376 | u8 phy_id; |
| 377 | u16 handle; |
| 378 | u16 attached_handle; |
Kashyap, Desai | 38c2911 | 2010-04-05 14:18:34 +0530 | [diff] [blame] | 379 | u8 phy_belongs_to_port; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 380 | }; |
| 381 | |
| 382 | /** |
| 383 | * struct _sas_node - sas_host/expander information |
| 384 | * @list: list of expanders |
| 385 | * @parent_dev: parent device class |
| 386 | * @num_phys: number phys belonging to this sas_host/expander |
| 387 | * @sas_address: sas address of this sas_host/expander |
| 388 | * @handle: handle for this sas_host/expander |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 389 | * @sas_address_parent: sas address of parent expander or sas host |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 390 | * @enclosure_handle: handle for this a member of an enclosure |
| 391 | * @device_info: bitwise defining capabilities of this sas_host/expander |
| 392 | * @responding: used in _scsih_expander_device_mark_responding |
| 393 | * @phy: a list of phys that make up this sas_host/expander |
| 394 | * @sas_port_list: list of ports attached to this sas_host/expander |
| 395 | */ |
| 396 | struct _sas_node { |
| 397 | struct list_head list; |
| 398 | struct device *parent_dev; |
| 399 | u8 num_phys; |
| 400 | u64 sas_address; |
| 401 | u16 handle; |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 402 | u64 sas_address_parent; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 403 | u16 enclosure_handle; |
| 404 | u64 enclosure_logical_id; |
| 405 | u8 responding; |
| 406 | struct _sas_phy *phy; |
| 407 | struct list_head sas_port_list; |
| 408 | }; |
| 409 | |
| 410 | /** |
| 411 | * enum reset_type - reset state |
| 412 | * @FORCE_BIG_HAMMER: issue diagnostic reset |
| 413 | * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer |
| 414 | */ |
| 415 | enum reset_type { |
| 416 | FORCE_BIG_HAMMER, |
| 417 | SOFT_RESET, |
| 418 | }; |
| 419 | |
| 420 | /** |
| 421 | * struct request_tracker - firmware request tracker |
| 422 | * @smid: system message id |
| 423 | * @scmd: scsi request pointer |
| 424 | * @cb_idx: callback index |
| 425 | * @chain_list: list of chains associated to this IO |
| 426 | * @tracker_list: list of free request (ioc->free_list) |
| 427 | */ |
| 428 | struct request_tracker { |
| 429 | u16 smid; |
| 430 | struct scsi_cmnd *scmd; |
| 431 | u8 cb_idx; |
| 432 | struct list_head tracker_list; |
| 433 | }; |
| 434 | |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 435 | /** |
| 436 | * struct _tr_list - target reset list |
| 437 | * @handle: device handle |
| 438 | * @state: state machine |
| 439 | */ |
| 440 | struct _tr_list { |
| 441 | struct list_head list; |
| 442 | u16 handle; |
| 443 | u16 state; |
| 444 | }; |
| 445 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 446 | typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr); |
| 447 | |
| 448 | /** |
| 449 | * struct MPT2SAS_ADAPTER - per adapter struct |
| 450 | * @list: ioc_list |
| 451 | * @shost: shost object |
| 452 | * @id: unique adapter id |
| 453 | * @pci_irq: irq number |
| 454 | * @name: generic ioc string |
| 455 | * @tmp_string: tmp string used for logging |
| 456 | * @pdev: pci pdev object |
| 457 | * @chip: memory mapped register space |
| 458 | * @chip_phys: physical addrss prior to mapping |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 459 | * @logging_level: see mpt2sas_debug.h |
Kashyap, Desai | fa7f316 | 2009-09-23 17:26:58 +0530 | [diff] [blame] | 460 | * @fwfault_debug: debuging FW timeouts |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 461 | * @ir_firmware: IR firmware present |
| 462 | * @bars: bitmask of BAR's that must be configured |
| 463 | * @mask_interrupts: ignore interrupt |
| 464 | * @fault_reset_work_q_name: fw fault work queue |
| 465 | * @fault_reset_work_q: "" |
| 466 | * @fault_reset_work: "" |
| 467 | * @firmware_event_name: fw event work queue |
| 468 | * @firmware_event_thread: "" |
| 469 | * @fw_events_off: flag to turn off fw event handling |
| 470 | * @fw_event_lock: |
| 471 | * @fw_event_list: list of fw events |
| 472 | * @aen_event_read_flag: event log was read |
| 473 | * @broadcast_aen_busy: broadcast aen waiting to be serviced |
Kashyap, Desai | 155dd4c | 2009-08-20 13:22:00 +0530 | [diff] [blame] | 474 | * @shost_recovery: host reset in progress |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 475 | * @ioc_reset_in_progress_lock: |
| 476 | * @ioc_link_reset_in_progress: phy/hard reset in progress |
| 477 | * @ignore_loginfos: ignore loginfos during task managment |
| 478 | * @remove_host: flag for when driver unloads, to avoid sending dev resets |
| 479 | * @wait_for_port_enable_to_complete: |
| 480 | * @msix_enable: flag indicating msix is enabled |
| 481 | * @msix_vector_count: number msix vectors |
| 482 | * @msix_table: virt address to the msix table |
| 483 | * @msix_table_backup: backup msix table |
| 484 | * @scsi_io_cb_idx: shost generated commands |
| 485 | * @tm_cb_idx: task management commands |
Kashyap, Desai | 744090d | 2009-10-05 15:56:56 +0530 | [diff] [blame] | 486 | * @scsih_cb_idx: scsih internal commands |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 487 | * @transport_cb_idx: transport internal commands |
| 488 | * @ctl_cb_idx: clt internal commands |
| 489 | * @base_cb_idx: base internal commands |
| 490 | * @config_cb_idx: base internal commands |
| 491 | * @base_cmds: |
| 492 | * @transport_cmds: |
Kashyap, Desai | 744090d | 2009-10-05 15:56:56 +0530 | [diff] [blame] | 493 | * @scsih_cmds: |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 494 | * @tm_cmds: |
| 495 | * @ctl_cmds: |
| 496 | * @config_cmds: |
| 497 | * @base_add_sg_single: handler for either 32/64 bit sgl's |
| 498 | * @event_type: bits indicating which events to log |
| 499 | * @event_context: unique id for each logged event |
| 500 | * @event_log: event log pointer |
| 501 | * @event_masks: events that are masked |
| 502 | * @facts: static facts data |
| 503 | * @pfacts: static port facts data |
| 504 | * @manu_pg0: static manufacturing page 0 |
Kashyap, Desai | ed79f12 | 2009-08-20 13:23:49 +0530 | [diff] [blame] | 505 | * @manu_pg10: static manufacturing page 10 |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 506 | * @bios_pg2: static bios page 2 |
| 507 | * @bios_pg3: static bios page 3 |
| 508 | * @ioc_pg8: static ioc page 8 |
| 509 | * @iounit_pg0: static iounit page 0 |
| 510 | * @iounit_pg1: static iounit page 1 |
| 511 | * @sas_hba: sas host object |
| 512 | * @sas_expander_list: expander object list |
| 513 | * @sas_node_lock: |
| 514 | * @sas_device_list: sas device object list |
| 515 | * @sas_device_init_list: sas device object list (used only at init time) |
| 516 | * @sas_device_lock: |
| 517 | * @io_missing_delay: time for IO completed by fw when PDR enabled |
| 518 | * @device_missing_delay: time for device missing by fw when PDR enabled |
| 519 | * @config_page_sz: config page size |
| 520 | * @config_page: reserve memory for config page payload |
| 521 | * @config_page_dma: |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 522 | * @hba_queue_depth: hba request queue depth |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 523 | * @sge_size: sg element size for either 32/64 bit |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 524 | * @scsiio_depth: SCSI_IO queue depth |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 525 | * @request_sz: per request frame size |
| 526 | * @request: pool of request frames |
| 527 | * @request_dma: |
| 528 | * @request_dma_sz: |
| 529 | * @scsi_lookup: firmware request tracker list |
| 530 | * @scsi_lookup_lock: |
| 531 | * @free_list: free list of request |
| 532 | * @chain: pool of chains |
| 533 | * @pending_io_count: |
| 534 | * @reset_wq: |
| 535 | * @chain_dma: |
| 536 | * @max_sges_in_main_message: number sg elements in main message |
| 537 | * @max_sges_in_chain_message: number sg elements per chain |
| 538 | * @chains_needed_per_io: max chains per io |
| 539 | * @chain_offset_value_for_main_message: location 1st sg in main |
| 540 | * @chain_depth: total chains allocated |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 541 | * @hi_priority_smid: |
| 542 | * @hi_priority: |
| 543 | * @hi_priority_dma: |
| 544 | * @hi_priority_depth: |
| 545 | * @hpr_lookup: |
| 546 | * @hpr_free_list: |
| 547 | * @internal_smid: |
| 548 | * @internal: |
| 549 | * @internal_dma: |
| 550 | * @internal_depth: |
| 551 | * @internal_lookup: |
| 552 | * @internal_free_list: |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 553 | * @sense: pool of sense |
| 554 | * @sense_dma: |
| 555 | * @sense_dma_pool: |
| 556 | * @reply_depth: hba reply queue depth: |
| 557 | * @reply_sz: per reply frame size: |
| 558 | * @reply: pool of replys: |
| 559 | * @reply_dma: |
| 560 | * @reply_dma_pool: |
| 561 | * @reply_free_queue_depth: reply free depth |
| 562 | * @reply_free: pool for reply free queue (32 bit addr) |
| 563 | * @reply_free_dma: |
| 564 | * @reply_free_dma_pool: |
| 565 | * @reply_free_host_index: tail index in pool to insert free replys |
| 566 | * @reply_post_queue_depth: reply post queue depth |
| 567 | * @reply_post_free: pool for reply post (64bit descriptor) |
| 568 | * @reply_post_free_dma: |
| 569 | * @reply_post_free_dma_pool: |
| 570 | * @reply_post_host_index: head index in the pool where FW completes IO |
| 571 | */ |
| 572 | struct MPT2SAS_ADAPTER { |
| 573 | struct list_head list; |
| 574 | struct Scsi_Host *shost; |
| 575 | u8 id; |
| 576 | u32 pci_irq; |
| 577 | char name[MPT_NAME_LENGTH]; |
| 578 | char tmp_string[MPT_STRING_LENGTH]; |
| 579 | struct pci_dev *pdev; |
| 580 | Mpi2SystemInterfaceRegs_t __iomem *chip; |
Kashyap, Desai | 6846e75 | 2009-12-16 18:51:45 +0530 | [diff] [blame] | 581 | resource_size_t chip_phys; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 582 | int logging_level; |
Kashyap, Desai | fa7f316 | 2009-09-23 17:26:58 +0530 | [diff] [blame] | 583 | int fwfault_debug; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 584 | u8 ir_firmware; |
| 585 | int bars; |
| 586 | u8 mask_interrupts; |
| 587 | |
| 588 | /* fw fault handler */ |
| 589 | char fault_reset_work_q_name[20]; |
| 590 | struct workqueue_struct *fault_reset_work_q; |
| 591 | struct delayed_work fault_reset_work; |
| 592 | |
| 593 | /* fw event handler */ |
| 594 | char firmware_event_name[20]; |
| 595 | struct workqueue_struct *firmware_event_thread; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 596 | spinlock_t fw_event_lock; |
| 597 | struct list_head fw_event_list; |
| 598 | |
| 599 | /* misc flags */ |
| 600 | int aen_event_read_flag; |
| 601 | u8 broadcast_aen_busy; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 602 | u8 shost_recovery; |
Kashyap, Desai | f1c35e6 | 2010-03-09 16:31:43 +0530 | [diff] [blame] | 603 | struct completion shost_recovery_done; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 604 | spinlock_t ioc_reset_in_progress_lock; |
| 605 | u8 ioc_link_reset_in_progress; |
| 606 | u8 ignore_loginfos; |
| 607 | u8 remove_host; |
| 608 | u8 wait_for_port_enable_to_complete; |
| 609 | |
| 610 | u8 msix_enable; |
| 611 | u16 msix_vector_count; |
| 612 | u32 *msix_table; |
| 613 | u32 *msix_table_backup; |
| 614 | |
| 615 | /* internal commands, callback index */ |
| 616 | u8 scsi_io_cb_idx; |
| 617 | u8 tm_cb_idx; |
| 618 | u8 transport_cb_idx; |
Kashyap, Desai | 744090d | 2009-10-05 15:56:56 +0530 | [diff] [blame] | 619 | u8 scsih_cb_idx; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 620 | u8 ctl_cb_idx; |
| 621 | u8 base_cb_idx; |
| 622 | u8 config_cb_idx; |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 623 | u8 tm_tr_cb_idx; |
| 624 | u8 tm_sas_control_cb_idx; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 625 | struct _internal_cmd base_cmds; |
| 626 | struct _internal_cmd transport_cmds; |
Kashyap, Desai | 744090d | 2009-10-05 15:56:56 +0530 | [diff] [blame] | 627 | struct _internal_cmd scsih_cmds; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 628 | struct _internal_cmd tm_cmds; |
| 629 | struct _internal_cmd ctl_cmds; |
| 630 | struct _internal_cmd config_cmds; |
| 631 | |
| 632 | MPT_ADD_SGE base_add_sg_single; |
| 633 | |
| 634 | /* event log */ |
| 635 | u32 event_type[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; |
| 636 | u32 event_context; |
| 637 | void *event_log; |
| 638 | u32 event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; |
| 639 | |
| 640 | /* static config pages */ |
| 641 | Mpi2IOCFactsReply_t facts; |
| 642 | Mpi2PortFactsReply_t *pfacts; |
| 643 | Mpi2ManufacturingPage0_t manu_pg0; |
| 644 | Mpi2BiosPage2_t bios_pg2; |
| 645 | Mpi2BiosPage3_t bios_pg3; |
| 646 | Mpi2IOCPage8_t ioc_pg8; |
| 647 | Mpi2IOUnitPage0_t iounit_pg0; |
| 648 | Mpi2IOUnitPage1_t iounit_pg1; |
| 649 | |
| 650 | struct _boot_device req_boot_device; |
| 651 | struct _boot_device req_alt_boot_device; |
| 652 | struct _boot_device current_boot_device; |
| 653 | |
| 654 | /* sas hba, expander, and device list */ |
| 655 | struct _sas_node sas_hba; |
| 656 | struct list_head sas_expander_list; |
| 657 | spinlock_t sas_node_lock; |
| 658 | struct list_head sas_device_list; |
| 659 | struct list_head sas_device_init_list; |
| 660 | spinlock_t sas_device_lock; |
| 661 | struct list_head raid_device_list; |
| 662 | spinlock_t raid_device_lock; |
| 663 | u8 io_missing_delay; |
| 664 | u16 device_missing_delay; |
| 665 | int sas_id; |
| 666 | |
| 667 | /* config page */ |
| 668 | u16 config_page_sz; |
| 669 | void *config_page; |
| 670 | dma_addr_t config_page_dma; |
| 671 | |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 672 | /* scsiio request */ |
| 673 | u16 hba_queue_depth; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 674 | u16 sge_size; |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 675 | u16 scsiio_depth; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 676 | u16 request_sz; |
| 677 | u8 *request; |
| 678 | dma_addr_t request_dma; |
| 679 | u32 request_dma_sz; |
| 680 | struct request_tracker *scsi_lookup; |
Kashyap, Desai | 89009fb | 2010-03-17 16:22:52 +0530 | [diff] [blame] | 681 | ulong scsi_lookup_pages; |
| 682 | spinlock_t scsi_lookup_lock; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 683 | struct list_head free_list; |
| 684 | int pending_io_count; |
| 685 | wait_queue_head_t reset_wq; |
| 686 | |
| 687 | /* chain */ |
| 688 | u8 *chain; |
| 689 | dma_addr_t chain_dma; |
| 690 | u16 max_sges_in_main_message; |
| 691 | u16 max_sges_in_chain_message; |
| 692 | u16 chains_needed_per_io; |
| 693 | u16 chain_offset_value_for_main_message; |
Kashyap, Desai | 89009fb | 2010-03-17 16:22:52 +0530 | [diff] [blame] | 694 | u32 chain_depth; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 695 | |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 696 | /* hi-priority queue */ |
| 697 | u16 hi_priority_smid; |
| 698 | u8 *hi_priority; |
| 699 | dma_addr_t hi_priority_dma; |
| 700 | u16 hi_priority_depth; |
| 701 | struct request_tracker *hpr_lookup; |
| 702 | struct list_head hpr_free_list; |
| 703 | |
| 704 | /* internal queue */ |
| 705 | u16 internal_smid; |
| 706 | u8 *internal; |
| 707 | dma_addr_t internal_dma; |
| 708 | u16 internal_depth; |
| 709 | struct request_tracker *internal_lookup; |
| 710 | struct list_head internal_free_list; |
| 711 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 712 | /* sense */ |
| 713 | u8 *sense; |
| 714 | dma_addr_t sense_dma; |
| 715 | struct dma_pool *sense_dma_pool; |
| 716 | |
| 717 | /* reply */ |
| 718 | u16 reply_sz; |
| 719 | u8 *reply; |
| 720 | dma_addr_t reply_dma; |
| 721 | struct dma_pool *reply_dma_pool; |
| 722 | |
| 723 | /* reply free queue */ |
| 724 | u16 reply_free_queue_depth; |
| 725 | u32 *reply_free; |
| 726 | dma_addr_t reply_free_dma; |
| 727 | struct dma_pool *reply_free_dma_pool; |
| 728 | u32 reply_free_host_index; |
| 729 | |
| 730 | /* reply post queue */ |
| 731 | u16 reply_post_queue_depth; |
| 732 | Mpi2ReplyDescriptorsUnion_t *reply_post_free; |
| 733 | dma_addr_t reply_post_free_dma; |
| 734 | struct dma_pool *reply_post_free_dma_pool; |
| 735 | u32 reply_post_host_index; |
| 736 | |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 737 | struct list_head delayed_tr_list; |
| 738 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 739 | /* diag buffer support */ |
| 740 | u8 *diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 741 | u32 diag_buffer_sz[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 742 | dma_addr_t diag_buffer_dma[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 743 | u8 diag_buffer_status[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 744 | u32 unique_id[MPI2_DIAG_BUF_TYPE_COUNT]; |
Kashyap, Desai | ed79f12 | 2009-08-20 13:23:49 +0530 | [diff] [blame] | 745 | Mpi2ManufacturingPage10_t manu_pg10; |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 746 | u32 product_specific[MPI2_DIAG_BUF_TYPE_COUNT][23]; |
| 747 | u32 diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT]; |
| 748 | }; |
| 749 | |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 750 | typedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
| 751 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 752 | |
| 753 | |
| 754 | /* base shared API */ |
Eric Moore | ba33fad | 2009-03-15 21:37:18 -0600 | [diff] [blame] | 755 | extern struct list_head mpt2sas_ioc_list; |
Kashyap, Desai | e4750c9 | 2009-08-07 19:37:59 +0530 | [diff] [blame] | 756 | void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc); |
| 757 | void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 758 | |
| 759 | int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc); |
| 760 | void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc); |
| 761 | int mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc); |
| 762 | void mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc); |
| 763 | int mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, |
| 764 | enum reset_type type); |
| 765 | |
| 766 | void *mpt2sas_base_get_msg_frame(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
| 767 | void *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
| 768 | 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] | 769 | __le32 mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc, |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 770 | u16 smid); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 771 | |
Kashyap, Desai | 595bb0b | 2009-09-14 11:02:48 +0530 | [diff] [blame] | 772 | /* hi-priority queue */ |
| 773 | u16 mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx); |
| 774 | u16 mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx, |
| 775 | struct scsi_cmnd *scmd); |
| 776 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 777 | u16 mpt2sas_base_get_smid(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx); |
| 778 | void mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 779 | 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] | 780 | u16 handle); |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 781 | 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] | 782 | 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] | 783 | u16 io_index); |
| 784 | void mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 785 | void mpt2sas_base_initialize_callback_handler(void); |
| 786 | u8 mpt2sas_base_register_callback_handler(MPT_CALLBACK cb_func); |
| 787 | void mpt2sas_base_release_callback_handler(u8 cb_idx); |
| 788 | |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 789 | 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] | 790 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 791 | void *mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr); |
| 792 | |
| 793 | u32 mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER *ioc, int cooked); |
| 794 | |
| 795 | void mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER *ioc , u16 fault_code); |
| 796 | int mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc, |
| 797 | Mpi2SasIoUnitControlReply_t *mpi_reply, Mpi2SasIoUnitControlRequest_t |
| 798 | *mpi_request); |
| 799 | int mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc, |
| 800 | Mpi2SepReply_t *mpi_reply, Mpi2SepRequest_t *mpi_request); |
| 801 | void mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_type); |
| 802 | |
Kashyap, Desai | fa7f316 | 2009-09-23 17:26:58 +0530 | [diff] [blame] | 803 | void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc); |
| 804 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 805 | /* scsih shared API */ |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 806 | u8 mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index, |
| 807 | u32 reply); |
Kashyap, Desai | 8ed9a03 | 2010-03-17 16:25:59 +0530 | [diff] [blame] | 808 | int mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, |
| 809 | uint channel, uint id, uint lun, u8 type, u16 smid_task, |
| 810 | ulong timeout, struct scsi_cmnd *scmd); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 811 | void mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle); |
| 812 | void mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle); |
| 813 | struct _sas_node *mpt2sas_scsih_expander_find_by_handle(struct MPT2SAS_ADAPTER *ioc, |
| 814 | u16 handle); |
| 815 | struct _sas_node *mpt2sas_scsih_expander_find_by_sas_address(struct MPT2SAS_ADAPTER |
| 816 | *ioc, u64 sas_address); |
| 817 | struct _sas_device *mpt2sas_scsih_sas_device_find_by_sas_address( |
| 818 | struct MPT2SAS_ADAPTER *ioc, u64 sas_address); |
| 819 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 820 | void mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase); |
| 821 | |
| 822 | /* config shared API */ |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 823 | 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] | 824 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 825 | int mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys); |
| 826 | int mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc, |
| 827 | Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage0_t *config_page); |
Kashyap, Desai | ed79f12 | 2009-08-20 13:23:49 +0530 | [diff] [blame] | 828 | int mpt2sas_config_get_manufacturing_pg10(struct MPT2SAS_ADAPTER *ioc, |
| 829 | Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage10_t *config_page); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 830 | int mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 831 | *mpi_reply, Mpi2BiosPage2_t *config_page); |
| 832 | int mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 833 | *mpi_reply, Mpi2BiosPage3_t *config_page); |
| 834 | int mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 835 | *mpi_reply, Mpi2IOUnitPage0_t *config_page); |
| 836 | int mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 837 | *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u32 handle); |
| 838 | int mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 839 | *mpi_reply, Mpi2SasDevicePage1_t *config_page, u32 form, u32 handle); |
| 840 | int mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 841 | *mpi_reply, Mpi2SasIOUnitPage0_t *config_page, u16 sz); |
| 842 | int mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 843 | *mpi_reply, Mpi2IOUnitPage1_t *config_page); |
| 844 | int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
Kashyap, Desai | 5b76858 | 2009-08-20 13:24:31 +0530 | [diff] [blame] | 845 | *mpi_reply, Mpi2IOUnitPage1_t *config_page); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 846 | int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 847 | *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz); |
Kashyap, Desai | 50d5c60 | 2009-12-16 18:55:26 +0530 | [diff] [blame] | 848 | int mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, |
| 849 | Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 850 | int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 851 | *mpi_reply, Mpi2IOCPage8_t *config_page); |
| 852 | int mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 853 | *mpi_reply, Mpi2ExpanderPage0_t *config_page, u32 form, u32 handle); |
| 854 | int mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 855 | *mpi_reply, Mpi2ExpanderPage1_t *config_page, u32 phy_number, u16 handle); |
| 856 | int mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 857 | *mpi_reply, Mpi2SasEnclosurePage0_t *config_page, u32 form, u32 handle); |
| 858 | int mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 859 | *mpi_reply, Mpi2SasPhyPage0_t *config_page, u32 phy_number); |
| 860 | int mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 861 | *mpi_reply, Mpi2SasPhyPage1_t *config_page, u32 phy_number); |
| 862 | int mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 863 | *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u32 handle); |
| 864 | int mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 *num_pds); |
| 865 | int mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 866 | *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 form, u32 handle, u16 sz); |
| 867 | int mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
| 868 | *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 form, |
| 869 | u32 form_specific); |
| 870 | int mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle, |
| 871 | u16 *volume_handle); |
| 872 | int mpt2sas_config_get_volume_wwid(struct MPT2SAS_ADAPTER *ioc, u16 volume_handle, |
| 873 | u64 *wwid); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 874 | /* ctl shared API */ |
| 875 | extern struct device_attribute *mpt2sas_host_attrs[]; |
| 876 | extern struct device_attribute *mpt2sas_dev_attrs[]; |
| 877 | void mpt2sas_ctl_init(void); |
| 878 | void mpt2sas_ctl_exit(void); |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 879 | 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] | 880 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 881 | void mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase); |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 882 | u8 mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index, |
Kashyap, Desai | 7b936b0 | 2009-09-25 11:44:41 +0530 | [diff] [blame] | 883 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 884 | void mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER *ioc, |
| 885 | Mpi2EventNotificationReply_t *mpi_reply); |
| 886 | |
Kashyap, Desai | 32e0eb5 | 2009-09-23 17:28:09 +0530 | [diff] [blame] | 887 | void mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER *ioc, |
| 888 | u8 bits_to_regsiter); |
| 889 | |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 890 | /* transport shared API */ |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 891 | u8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
| 892 | u32 reply); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 893 | struct _sas_port *mpt2sas_transport_port_add(struct MPT2SAS_ADAPTER *ioc, |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 894 | u16 handle, u64 sas_address); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 895 | void mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address, |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 896 | u64 sas_address_parent); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 897 | int mpt2sas_transport_add_host_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy |
| 898 | *mpt2sas_phy, Mpi2SasPhyPage0_t phy_pg0, struct device *parent_dev); |
| 899 | int mpt2sas_transport_add_expander_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy |
| 900 | *mpt2sas_phy, Mpi2ExpanderPage1_t expander_pg1, struct device *parent_dev); |
Kashyap, Desai | c5e039b | 2009-09-23 17:21:29 +0530 | [diff] [blame] | 901 | void mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc, |
| 902 | u64 sas_address, u16 handle, u8 phy_number, u8 link_rate); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 903 | extern struct sas_function_template mpt2sas_transport_functions; |
| 904 | extern struct scsi_transport_template *mpt2sas_transport_template; |
Kashyap, Desai | 34a03be | 2009-08-20 13:23:19 +0530 | [diff] [blame] | 905 | extern int scsi_internal_device_block(struct scsi_device *sdev); |
Kashyap, Desai | 77e63ed | 2009-09-14 11:04:23 +0530 | [diff] [blame] | 906 | extern u8 mpt2sas_stm_zero_smid_handler(struct MPT2SAS_ADAPTER *ioc, |
| 907 | u8 msix_index, u32 reply); |
Kashyap, Desai | 34a03be | 2009-08-20 13:23:19 +0530 | [diff] [blame] | 908 | extern int scsi_internal_device_unblock(struct scsi_device *sdev); |
Eric Moore | 635374e | 2009-03-09 01:21:12 -0600 | [diff] [blame] | 909 | |
| 910 | #endif /* MPT2SAS_BASE_H_INCLUDED */ |