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