aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpi/mpi2.h10
-rw-r--r--drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h28
-rw-r--r--drivers/scsi/mpt2sas/mpi/mpi2_ioc.h49
-rw-r--r--drivers/scsi/mpt2sas/mpi/mpi2_raid.h67
-rw-r--r--drivers/scsi/mpt2sas/mpi/mpi2_tool.h9
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c205
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.h26
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.c8
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c168
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_transport.c9
10 files changed, 374 insertions, 205 deletions
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2.h b/drivers/scsi/mpt2sas/mpi/mpi2.h
index 8dc1b32918dd..a01f0aa66f20 100644
--- a/drivers/scsi/mpt2sas/mpi/mpi2.h
+++ b/drivers/scsi/mpt2sas/mpi/mpi2.h
@@ -8,7 +8,7 @@
8 * scatter/gather formats. 8 * scatter/gather formats.
9 * Creation Date: June 21, 2006 9 * Creation Date: June 21, 2006
10 * 10 *
11 * mpi2.h Version: 02.00.20 11 * mpi2.h Version: 02.00.22
12 * 12 *
13 * Version History 13 * Version History
14 * --------------- 14 * ---------------
@@ -69,6 +69,8 @@
69 * 02-23-11 02.00.19 Bumped MPI2_HEADER_VERSION_UNIT. 69 * 02-23-11 02.00.19 Bumped MPI2_HEADER_VERSION_UNIT.
70 * Added MPI2_FUNCTION_SEND_HOST_MESSAGE. 70 * Added MPI2_FUNCTION_SEND_HOST_MESSAGE.
71 * 03-09-11 02.00.20 Bumped MPI2_HEADER_VERSION_UNIT. 71 * 03-09-11 02.00.20 Bumped MPI2_HEADER_VERSION_UNIT.
72 * 05-25-11 02.00.21 Bumped MPI2_HEADER_VERSION_UNIT.
73 * 08-24-11 02.00.22 Bumped MPI2_HEADER_VERSION_UNIT.
72 * -------------------------------------------------------------------------- 74 * --------------------------------------------------------------------------
73 */ 75 */
74 76
@@ -94,7 +96,7 @@
94#define MPI2_VERSION_02_00 (0x0200) 96#define MPI2_VERSION_02_00 (0x0200)
95 97
96/* versioning for this MPI header set */ 98/* versioning for this MPI header set */
97#define MPI2_HEADER_VERSION_UNIT (0x14) 99#define MPI2_HEADER_VERSION_UNIT (0x16)
98#define MPI2_HEADER_VERSION_DEV (0x00) 100#define MPI2_HEADER_VERSION_DEV (0x00)
99#define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) 101#define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00)
100#define MPI2_HEADER_VERSION_UNIT_SHIFT (8) 102#define MPI2_HEADER_VERSION_UNIT_SHIFT (8)
@@ -1073,8 +1075,10 @@ typedef struct _MPI2_IEEE_SGE_UNION
1073#define MPI2_IEEE_SGE_FLAGS_IOCPLB_ADDR (0x02) 1075#define MPI2_IEEE_SGE_FLAGS_IOCPLB_ADDR (0x02)
1074#define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) 1076#define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03)
1075 /* IEEE Simple Element only */ 1077 /* IEEE Simple Element only */
1076#define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR (0x03) 1078#define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBPCI_ADDR (0x03)
1077 /* IEEE Chain Element only */ 1079 /* IEEE Chain Element only */
1080#define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR \
1081 (MPI2_IEEE_SGE_FLAGS_SYSTEMPLBPCI_ADDR) /* typo in name */
1078 1082
1079/**************************************************************************** 1083/****************************************************************************
1080* IEEE SGE operation Macros 1084* IEEE SGE operation Macros
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h
index cfd95b4e3004..3a023dad77a1 100644
--- a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h
+++ b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h
@@ -6,7 +6,7 @@
6 * Title: MPI Configuration messages and pages 6 * Title: MPI Configuration messages and pages
7 * Creation Date: November 10, 2006 7 * Creation Date: November 10, 2006
8 * 8 *
9 * mpi2_cnfg.h Version: 02.00.19 9 * mpi2_cnfg.h Version: 02.00.21
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -140,6 +140,13 @@
140 * Added SASNotifyPrimitiveMasks field to 140 * Added SASNotifyPrimitiveMasks field to
141 * MPI2_CONFIG_PAGE_IOC_7. 141 * MPI2_CONFIG_PAGE_IOC_7.
142 * 03-09-11 02.00.19 Fixed IO Unit Page 10 (to match the spec). 142 * 03-09-11 02.00.19 Fixed IO Unit Page 10 (to match the spec).
143 * 05-25-11 02.00.20 Cleaned up a few comments.
144 * 08-24-11 02.00.21 Marked the IO Unit Page 7 PowerManagementCapabilities
145 * for PCIe link as obsolete.
146 * Added SpinupFlags field containing a Disable Spin-up
147 * bit to the MPI2_SAS_IOUNIT4_SPINUP_GROUP fields of
148 * SAS IO Unit Page 4.
149
143 * -------------------------------------------------------------------------- 150 * --------------------------------------------------------------------------
144 */ 151 */
145 152
@@ -904,8 +911,8 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_7 {
904#define MPI2_IOUNITPAGE7_PMCAP_12_5_PCT_IOCSPEED (0x00000400) 911#define MPI2_IOUNITPAGE7_PMCAP_12_5_PCT_IOCSPEED (0x00000400)
905#define MPI2_IOUNITPAGE7_PMCAP_25_0_PCT_IOCSPEED (0x00000200) 912#define MPI2_IOUNITPAGE7_PMCAP_25_0_PCT_IOCSPEED (0x00000200)
906#define MPI2_IOUNITPAGE7_PMCAP_50_0_PCT_IOCSPEED (0x00000100) 913#define MPI2_IOUNITPAGE7_PMCAP_50_0_PCT_IOCSPEED (0x00000100)
907#define MPI2_IOUNITPAGE7_PMCAP_PCIE_WIDTH_CHANGE (0x00000008) 914#define MPI2_IOUNITPAGE7_PMCAP_PCIE_WIDTH_CHANGE (0x00000008) /* obsolete */
908#define MPI2_IOUNITPAGE7_PMCAP_PCIE_SPEED_CHANGE (0x00000004) 915#define MPI2_IOUNITPAGE7_PMCAP_PCIE_SPEED_CHANGE (0x00000004) /* obsolete */
909 916
910/* defines for IO Unit Page 7 IOCTemperatureUnits field */ 917/* defines for IO Unit Page 7 IOCTemperatureUnits field */
911#define MPI2_IOUNITPAGE7_IOC_TEMP_NOT_PRESENT (0x00) 918#define MPI2_IOUNITPAGE7_IOC_TEMP_NOT_PRESENT (0x00)
@@ -1970,10 +1977,14 @@ typedef struct _MPI2_SAS_IOUNIT4_SPINUP_GROUP
1970{ 1977{
1971 U8 MaxTargetSpinup; /* 0x00 */ 1978 U8 MaxTargetSpinup; /* 0x00 */
1972 U8 SpinupDelay; /* 0x01 */ 1979 U8 SpinupDelay; /* 0x01 */
1973 U16 Reserved1; /* 0x02 */ 1980 U8 SpinupFlags; /* 0x02 */
1981 U8 Reserved1; /* 0x03 */
1974} MPI2_SAS_IOUNIT4_SPINUP_GROUP, MPI2_POINTER PTR_MPI2_SAS_IOUNIT4_SPINUP_GROUP, 1982} MPI2_SAS_IOUNIT4_SPINUP_GROUP, MPI2_POINTER PTR_MPI2_SAS_IOUNIT4_SPINUP_GROUP,
1975 Mpi2SasIOUnit4SpinupGroup_t, MPI2_POINTER pMpi2SasIOUnit4SpinupGroup_t; 1983 Mpi2SasIOUnit4SpinupGroup_t, MPI2_POINTER pMpi2SasIOUnit4SpinupGroup_t;
1976 1984
1985/* defines for SAS IO Unit Page 4 SpinupFlags */
1986#define MPI2_SASIOUNIT4_SPINUP_DISABLE_FLAG (0x01)
1987
1977/* 1988/*
1978 * Host code (drivers, BIOS, utilities, etc.) should leave this define set to 1989 * Host code (drivers, BIOS, utilities, etc.) should leave this define set to
1979 * one and check the value returned for NumPhys at runtime. 1990 * one and check the value returned for NumPhys at runtime.
@@ -2321,13 +2332,12 @@ typedef struct _MPI2_CONFIG_PAGE_EXPANDER_1
2321 2332
2322/* use MPI2_SAS_NEG_LINK_RATE_ defines for the NegotiatedLinkRate field */ 2333/* use MPI2_SAS_NEG_LINK_RATE_ defines for the NegotiatedLinkRate field */
2323 2334
2324/* use MPI2_SAS_APHYINFO_ defines for AttachedPhyInfo field */
2325
2326/* values for SAS Expander Page 1 DiscoveryInfo field */ 2335/* values for SAS Expander Page 1 DiscoveryInfo field */
2327#define MPI2_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED (0x04) 2336#define MPI2_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED (0x04)
2328#define MPI2_SAS_EXPANDER1_DISCINFO_LINK_STATUS_CHANGE (0x02) 2337#define MPI2_SAS_EXPANDER1_DISCINFO_LINK_STATUS_CHANGE (0x02)
2329#define MPI2_SAS_EXPANDER1_DISCINFO_NO_ROUTING_ENTRIES (0x01) 2338#define MPI2_SAS_EXPANDER1_DISCINFO_NO_ROUTING_ENTRIES (0x01)
2330 2339
2340/* use MPI2_SAS_APHYINFO_ defines for AttachedPhyInfo field */
2331 2341
2332/**************************************************************************** 2342/****************************************************************************
2333* SAS Device Config Pages 2343* SAS Device Config Pages
@@ -2447,6 +2457,8 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_PHY_0
2447 2457
2448#define MPI2_SASPHY0_PAGEVERSION (0x03) 2458#define MPI2_SASPHY0_PAGEVERSION (0x03)
2449 2459
2460/* use MPI2_SAS_APHYINFO_ defines for AttachedPhyInfo field */
2461
2450/* use MPI2_SAS_PRATE_ defines for the ProgrammedLinkRate field */ 2462/* use MPI2_SAS_PRATE_ defines for the ProgrammedLinkRate field */
2451 2463
2452/* use MPI2_SAS_HWRATE_ defines for the HwLinkRate field */ 2464/* use MPI2_SAS_HWRATE_ defines for the HwLinkRate field */
@@ -2454,12 +2466,10 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_PHY_0
2454/* values for SAS PHY Page 0 Flags field */ 2466/* values for SAS PHY Page 0 Flags field */
2455#define MPI2_SAS_PHY0_FLAGS_SGPIO_DIRECT_ATTACH_ENC (0x01) 2467#define MPI2_SAS_PHY0_FLAGS_SGPIO_DIRECT_ATTACH_ENC (0x01)
2456 2468
2457/* use MPI2_SAS_APHYINFO_ defines for AttachedPhyInfo field */ 2469/* use MPI2_SAS_PHYINFO_ for the PhyInfo field */
2458 2470
2459/* use MPI2_SAS_NEG_LINK_RATE_ defines for the NegotiatedLinkRate field */ 2471/* use MPI2_SAS_NEG_LINK_RATE_ defines for the NegotiatedLinkRate field */
2460 2472
2461/* use MPI2_SAS_PHYINFO_ for the PhyInfo field */
2462
2463 2473
2464/* SAS PHY Page 1 */ 2474/* SAS PHY Page 1 */
2465 2475
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h b/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h
index 93d9b6956d05..9a925c07a9ec 100644
--- a/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h
+++ b/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h
@@ -6,7 +6,7 @@
6 * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages 6 * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages
7 * Creation Date: October 11, 2006 7 * Creation Date: October 11, 2006
8 * 8 *
9 * mpi2_ioc.h Version: 02.00.17 9 * mpi2_ioc.h Version: 02.00.19
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -110,6 +110,13 @@
110 * Added Temperature Threshold Event. 110 * Added Temperature Threshold Event.
111 * Added Host Message Event. 111 * Added Host Message Event.
112 * Added Send Host Message request and reply. 112 * Added Send Host Message request and reply.
113 * 05-25-11 02.00.18 For Extended Image Header, added
114 * MPI2_EXT_IMAGE_TYPE_MIN_PRODUCT_SPECIFIC and
115 * MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC defines.
116 * Deprecated MPI2_EXT_IMAGE_TYPE_MAX define.
117 * 08-24-11 02.00.19 Added PhysicalPort field to
118 * MPI2_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE structure.
119 * Marked MPI2_PM_CONTROL_FEATURE_PCIE_LINK as obsolete.
113 * -------------------------------------------------------------------------- 120 * --------------------------------------------------------------------------
114 */ 121 */
115 122
@@ -578,7 +585,7 @@ typedef struct _MPI2_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE
578{ 585{
579 U16 TaskTag; /* 0x00 */ 586 U16 TaskTag; /* 0x00 */
580 U8 ReasonCode; /* 0x02 */ 587 U8 ReasonCode; /* 0x02 */
581 U8 Reserved1; /* 0x03 */ 588 U8 PhysicalPort; /* 0x03 */
582 U8 ASC; /* 0x04 */ 589 U8 ASC; /* 0x04 */
583 U8 ASCQ; /* 0x05 */ 590 U8 ASCQ; /* 0x05 */
584 U16 DevHandle; /* 0x06 */ 591 U16 DevHandle; /* 0x06 */
@@ -1366,16 +1373,18 @@ typedef struct _MPI2_EXT_IMAGE_HEADER
1366#define MPI2_EXT_IMAGE_HEADER_SIZE (0x40) 1373#define MPI2_EXT_IMAGE_HEADER_SIZE (0x40)
1367 1374
1368/* defines for the ImageType field */ 1375/* defines for the ImageType field */
1369#define MPI2_EXT_IMAGE_TYPE_UNSPECIFIED (0x00) 1376#define MPI2_EXT_IMAGE_TYPE_UNSPECIFIED (0x00)
1370#define MPI2_EXT_IMAGE_TYPE_FW (0x01) 1377#define MPI2_EXT_IMAGE_TYPE_FW (0x01)
1371#define MPI2_EXT_IMAGE_TYPE_NVDATA (0x03) 1378#define MPI2_EXT_IMAGE_TYPE_NVDATA (0x03)
1372#define MPI2_EXT_IMAGE_TYPE_BOOTLOADER (0x04) 1379#define MPI2_EXT_IMAGE_TYPE_BOOTLOADER (0x04)
1373#define MPI2_EXT_IMAGE_TYPE_INITIALIZATION (0x05) 1380#define MPI2_EXT_IMAGE_TYPE_INITIALIZATION (0x05)
1374#define MPI2_EXT_IMAGE_TYPE_FLASH_LAYOUT (0x06) 1381#define MPI2_EXT_IMAGE_TYPE_FLASH_LAYOUT (0x06)
1375#define MPI2_EXT_IMAGE_TYPE_SUPPORTED_DEVICES (0x07) 1382#define MPI2_EXT_IMAGE_TYPE_SUPPORTED_DEVICES (0x07)
1376#define MPI2_EXT_IMAGE_TYPE_MEGARAID (0x08) 1383#define MPI2_EXT_IMAGE_TYPE_MEGARAID (0x08)
1377 1384#define MPI2_EXT_IMAGE_TYPE_MIN_PRODUCT_SPECIFIC (0x80)
1378#define MPI2_EXT_IMAGE_TYPE_MAX (MPI2_EXT_IMAGE_TYPE_MEGARAID) 1385#define MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC (0xFF)
1386#define MPI2_EXT_IMAGE_TYPE_MAX \
1387 (MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC) /* deprecated */
1379 1388
1380 1389
1381 1390
@@ -1568,7 +1577,7 @@ typedef struct _MPI2_PWR_MGMT_CONTROL_REQUEST {
1568/* defines for the Feature field */ 1577/* defines for the Feature field */
1569#define MPI2_PM_CONTROL_FEATURE_DA_PHY_POWER_COND (0x01) 1578#define MPI2_PM_CONTROL_FEATURE_DA_PHY_POWER_COND (0x01)
1570#define MPI2_PM_CONTROL_FEATURE_PORT_WIDTH_MODULATION (0x02) 1579#define MPI2_PM_CONTROL_FEATURE_PORT_WIDTH_MODULATION (0x02)
1571#define MPI2_PM_CONTROL_FEATURE_PCIE_LINK (0x03) 1580#define MPI2_PM_CONTROL_FEATURE_PCIE_LINK (0x03) /* obsolete */
1572#define MPI2_PM_CONTROL_FEATURE_IOC_SPEED (0x04) 1581#define MPI2_PM_CONTROL_FEATURE_IOC_SPEED (0x04)
1573#define MPI2_PM_CONTROL_FEATURE_MIN_PRODUCT_SPECIFIC (0x80) 1582#define MPI2_PM_CONTROL_FEATURE_MIN_PRODUCT_SPECIFIC (0x80)
1574#define MPI2_PM_CONTROL_FEATURE_MAX_PRODUCT_SPECIFIC (0xFF) 1583#define MPI2_PM_CONTROL_FEATURE_MAX_PRODUCT_SPECIFIC (0xFF)
@@ -1597,14 +1606,14 @@ typedef struct _MPI2_PWR_MGMT_CONTROL_REQUEST {
1597 1606
1598/* parameter usage for the MPI2_PM_CONTROL_FEATURE_PCIE_LINK Feature */ 1607/* parameter usage for the MPI2_PM_CONTROL_FEATURE_PCIE_LINK Feature */
1599/* Parameter1 indicates desired PCIe link speed using these defines */ 1608/* Parameter1 indicates desired PCIe link speed using these defines */
1600#define MPI2_PM_CONTROL_PARAM1_PCIE_2_5_GBPS (0x00) 1609#define MPI2_PM_CONTROL_PARAM1_PCIE_2_5_GBPS (0x00) /* obsolete */
1601#define MPI2_PM_CONTROL_PARAM1_PCIE_5_0_GBPS (0x01) 1610#define MPI2_PM_CONTROL_PARAM1_PCIE_5_0_GBPS (0x01) /* obsolete */
1602#define MPI2_PM_CONTROL_PARAM1_PCIE_8_0_GBPS (0x02) 1611#define MPI2_PM_CONTROL_PARAM1_PCIE_8_0_GBPS (0x02) /* obsolete */
1603/* Parameter2 indicates desired PCIe link width using these defines */ 1612/* Parameter2 indicates desired PCIe link width using these defines */
1604#define MPI2_PM_CONTROL_PARAM2_WIDTH_X1 (0x01) 1613#define MPI2_PM_CONTROL_PARAM2_WIDTH_X1 (0x01) /* obsolete */
1605#define MPI2_PM_CONTROL_PARAM2_WIDTH_X2 (0x02) 1614#define MPI2_PM_CONTROL_PARAM2_WIDTH_X2 (0x02) /* obsolete */
1606#define MPI2_PM_CONTROL_PARAM2_WIDTH_X4 (0x04) 1615#define MPI2_PM_CONTROL_PARAM2_WIDTH_X4 (0x04) /* obsolete */
1607#define MPI2_PM_CONTROL_PARAM2_WIDTH_X8 (0x08) 1616#define MPI2_PM_CONTROL_PARAM2_WIDTH_X8 (0x08) /* obsolete */
1608/* Parameter3 and Parameter4 are reserved */ 1617/* Parameter3 and Parameter4 are reserved */
1609 1618
1610/* parameter usage for the MPI2_PM_CONTROL_FEATURE_IOC_SPEED Feature */ 1619/* parameter usage for the MPI2_PM_CONTROL_FEATURE_IOC_SPEED Feature */
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_raid.h b/drivers/scsi/mpt2sas/mpi/mpi2_raid.h
index bd61a7b60a2b..0601612b875a 100644
--- a/drivers/scsi/mpt2sas/mpi/mpi2_raid.h
+++ b/drivers/scsi/mpt2sas/mpi/mpi2_raid.h
@@ -6,7 +6,7 @@
6 * Title: MPI Integrated RAID messages and structures 6 * Title: MPI Integrated RAID messages and structures
7 * Creation Date: April 26, 2007 7 * Creation Date: April 26, 2007
8 * 8 *
9 * mpi2_raid.h Version: 02.00.05 9 * mpi2_raid.h Version: 02.00.06
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -23,6 +23,10 @@
23 * 07-30-09 02.00.04 Added proper define for the Use Default Settings bit of 23 * 07-30-09 02.00.04 Added proper define for the Use Default Settings bit of
24 * VolumeCreationFlags and marked the old one as obsolete. 24 * VolumeCreationFlags and marked the old one as obsolete.
25 * 05-12-10 02.00.05 Added MPI2_RAID_VOL_FLAGS_OP_MDC define. 25 * 05-12-10 02.00.05 Added MPI2_RAID_VOL_FLAGS_OP_MDC define.
26 * 08-24-10 02.00.06 Added MPI2_RAID_ACTION_COMPATIBILITY_CHECK along with
27 * related structures and defines.
28 * Added product-specific range to RAID Action values.
29
26 * -------------------------------------------------------------------------- 30 * --------------------------------------------------------------------------
27 */ 31 */
28 32
@@ -176,7 +180,9 @@ typedef struct _MPI2_RAID_ACTION_REQUEST
176#define MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED (0x20) 180#define MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED (0x20)
177#define MPI2_RAID_ACTION_START_RAID_FUNCTION (0x21) 181#define MPI2_RAID_ACTION_START_RAID_FUNCTION (0x21)
178#define MPI2_RAID_ACTION_STOP_RAID_FUNCTION (0x22) 182#define MPI2_RAID_ACTION_STOP_RAID_FUNCTION (0x22)
179 183#define MPI2_RAID_ACTION_COMPATIBILITY_CHECK (0x23)
184#define MPI2_RAID_ACTION_MIN_PRODUCT_SPECIFIC (0x80)
185#define MPI2_RAID_ACTION_MAX_PRODUCT_SPECIFIC (0xFF)
180 186
181/* RAID Volume Creation Structure */ 187/* RAID Volume Creation Structure */
182 188
@@ -244,6 +250,23 @@ typedef struct _MPI2_RAID_ONLINE_CAPACITY_EXPANSION
244 Mpi2RaidOnlineCapacityExpansion_t, 250 Mpi2RaidOnlineCapacityExpansion_t,
245 MPI2_POINTER pMpi2RaidOnlineCapacityExpansion_t; 251 MPI2_POINTER pMpi2RaidOnlineCapacityExpansion_t;
246 252
253/* RAID Compatibility Input Structure */
254
255typedef struct _MPI2_RAID_COMPATIBILITY_INPUT_STRUCT {
256 U16 SourceDevHandle; /* 0x00 */
257 U16 CandidateDevHandle; /* 0x02 */
258 U32 Flags; /* 0x04 */
259 U32 Reserved1; /* 0x08 */
260 U32 Reserved2; /* 0x0C */
261} MPI2_RAID_COMPATIBILITY_INPUT_STRUCT,
262MPI2_POINTER PTR_MPI2_RAID_COMPATIBILITY_INPUT_STRUCT,
263Mpi2RaidCompatibilityInputStruct_t,
264MPI2_POINTER pMpi2RaidCompatibilityInputStruct_t;
265
266/* defines for RAID Compatibility Structure Flags field */
267#define MPI2_RAID_COMPAT_SOURCE_IS_VOLUME_FLAG (0x00000002)
268#define MPI2_RAID_COMPAT_REPORT_SOURCE_INFO_FLAG (0x00000001)
269
247 270
248/* RAID Volume Indicator Structure */ 271/* RAID Volume Indicator Structure */
249 272
@@ -263,15 +286,45 @@ typedef struct _MPI2_RAID_VOL_INDICATOR
263#define MPI2_RAID_VOL_FLAGS_OP_RESYNC (0x00000003) 286#define MPI2_RAID_VOL_FLAGS_OP_RESYNC (0x00000003)
264#define MPI2_RAID_VOL_FLAGS_OP_MDC (0x00000004) 287#define MPI2_RAID_VOL_FLAGS_OP_MDC (0x00000004)
265 288
289/* RAID Compatibility Result Structure */
290
291typedef struct _MPI2_RAID_COMPATIBILITY_RESULT_STRUCT {
292 U8 State; /* 0x00 */
293 U8 Reserved1; /* 0x01 */
294 U16 Reserved2; /* 0x02 */
295 U32 GenericAttributes; /* 0x04 */
296 U32 OEMSpecificAttributes; /* 0x08 */
297 U32 Reserved3; /* 0x0C */
298 U32 Reserved4; /* 0x10 */
299} MPI2_RAID_COMPATIBILITY_RESULT_STRUCT,
300MPI2_POINTER PTR_MPI2_RAID_COMPATIBILITY_RESULT_STRUCT,
301Mpi2RaidCompatibilityResultStruct_t,
302MPI2_POINTER pMpi2RaidCompatibilityResultStruct_t;
303
304/* defines for RAID Compatibility Result Structure State field */
305#define MPI2_RAID_COMPAT_STATE_COMPATIBLE (0x00)
306#define MPI2_RAID_COMPAT_STATE_NOT_COMPATIBLE (0x01)
307
308/* defines for RAID Compatibility Result Structure GenericAttributes field */
309#define MPI2_RAID_COMPAT_GENATTRIB_4K_SECTOR (0x00000010)
310
311#define MPI2_RAID_COMPAT_GENATTRIB_MEDIA_MASK (0x0000000C)
312#define MPI2_RAID_COMPAT_GENATTRIB_SOLID_STATE_DRIVE (0x00000008)
313#define MPI2_RAID_COMPAT_GENATTRIB_HARD_DISK_DRIVE (0x00000004)
314
315#define MPI2_RAID_COMPAT_GENATTRIB_PROTOCOL_MASK (0x00000003)
316#define MPI2_RAID_COMPAT_GENATTRIB_SAS_PROTOCOL (0x00000002)
317#define MPI2_RAID_COMPAT_GENATTRIB_SATA_PROTOCOL (0x00000001)
266 318
267/* RAID Action Reply ActionData union */ 319/* RAID Action Reply ActionData union */
268typedef union _MPI2_RAID_ACTION_REPLY_DATA 320typedef union _MPI2_RAID_ACTION_REPLY_DATA
269{ 321{
270 U32 Word[5]; 322 U32 Word[5];
271 MPI2_RAID_VOL_INDICATOR RaidVolumeIndicator; 323 MPI2_RAID_VOL_INDICATOR RaidVolumeIndicator;
272 U16 VolDevHandle; 324 U16 VolDevHandle;
273 U8 VolumeState; 325 U8 VolumeState;
274 U8 PhysDiskNum; 326 U8 PhysDiskNum;
327 MPI2_RAID_COMPATIBILITY_RESULT_STRUCT RaidCompatibilityResult;
275} MPI2_RAID_ACTION_REPLY_DATA, MPI2_POINTER PTR_MPI2_RAID_ACTION_REPLY_DATA, 328} MPI2_RAID_ACTION_REPLY_DATA, MPI2_POINTER PTR_MPI2_RAID_ACTION_REPLY_DATA,
276 Mpi2RaidActionReplyData_t, MPI2_POINTER pMpi2RaidActionReplyData_t; 329 Mpi2RaidActionReplyData_t, MPI2_POINTER pMpi2RaidActionReplyData_t;
277 330
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_tool.h b/drivers/scsi/mpt2sas/mpi/mpi2_tool.h
index 2a4bceda364b..3cbe677c6886 100644
--- a/drivers/scsi/mpt2sas/mpi/mpi2_tool.h
+++ b/drivers/scsi/mpt2sas/mpi/mpi2_tool.h
@@ -6,7 +6,7 @@
6 * Title: MPI diagnostic tool structures and definitions 6 * Title: MPI diagnostic tool structures and definitions
7 * Creation Date: March 26, 2007 7 * Creation Date: March 26, 2007
8 * 8 *
9 * mpi2_tool.h Version: 02.00.06 9 * mpi2_tool.h Version: 02.00.07
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -25,6 +25,8 @@
25 * 05-12-10 02.00.05 Added Diagnostic Data Upload tool. 25 * 05-12-10 02.00.05 Added Diagnostic Data Upload tool.
26 * 08-11-10 02.00.06 Added defines that were missing for Diagnostic Buffer 26 * 08-11-10 02.00.06 Added defines that were missing for Diagnostic Buffer
27 * Post Request. 27 * Post Request.
28 * 05-25-11 02.00.07 Added Flags field and related defines to
29 * MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST.
28 * -------------------------------------------------------------------------- 30 * --------------------------------------------------------------------------
29 */ 31 */
30 32
@@ -181,7 +183,7 @@ typedef struct _MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST {
181 U8 DevIndex; /* 0x14 */ 183 U8 DevIndex; /* 0x14 */
182 U8 Action; /* 0x15 */ 184 U8 Action; /* 0x15 */
183 U8 SGLFlags; /* 0x16 */ 185 U8 SGLFlags; /* 0x16 */
184 U8 Reserved7; /* 0x17 */ 186 U8 Flags; /* 0x17 */
185 U16 TxDataLength; /* 0x18 */ 187 U16 TxDataLength; /* 0x18 */
186 U16 RxDataLength; /* 0x1A */ 188 U16 RxDataLength; /* 0x1A */
187 U32 Reserved8; /* 0x1C */ 189 U32 Reserved8; /* 0x1C */
@@ -205,6 +207,9 @@ typedef struct _MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST {
205 207
206/* use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */ 208/* use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */
207 209
210/* values for the Flags field */
211#define MPI2_TOOL_ISTWI_FLAG_AUTO_RESERVE_RELEASE (0x80)
212#define MPI2_TOOL_ISTWI_FLAG_PAGE_ADDR_MASK (0x07)
208 213
209/* Toolbox ISTWI Read Write Tool reply message */ 214/* Toolbox ISTWI Read Write Tool reply message */
210typedef struct _MPI2_TOOLBOX_ISTWI_REPLY { 215typedef struct _MPI2_TOOLBOX_ISTWI_REPLY {
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index beda04a8404b..0b2c95583660 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -57,6 +57,7 @@
57#include <linux/sort.h> 57#include <linux/sort.h>
58#include <linux/io.h> 58#include <linux/io.h>
59#include <linux/time.h> 59#include <linux/time.h>
60#include <linux/kthread.h>
60#include <linux/aer.h> 61#include <linux/aer.h>
61 62
62#include "mpt2sas_base.h" 63#include "mpt2sas_base.h"
@@ -65,6 +66,8 @@ static MPT_CALLBACK mpt_callbacks[MPT_MAX_CALLBACKS];
65 66
66#define FAULT_POLLING_INTERVAL 1000 /* in milliseconds */ 67#define FAULT_POLLING_INTERVAL 1000 /* in milliseconds */
67 68
69#define MAX_HBA_QUEUE_DEPTH 30000
70#define MAX_CHAIN_DEPTH 100000
68static int max_queue_depth = -1; 71static int max_queue_depth = -1;
69module_param(max_queue_depth, int, 0); 72module_param(max_queue_depth, int, 0);
70MODULE_PARM_DESC(max_queue_depth, " max controller queue depth "); 73MODULE_PARM_DESC(max_queue_depth, " max controller queue depth ");
@@ -89,19 +92,6 @@ static int disable_discovery = -1;
89module_param(disable_discovery, int, 0); 92module_param(disable_discovery, int, 0);
90MODULE_PARM_DESC(disable_discovery, " disable discovery "); 93MODULE_PARM_DESC(disable_discovery, " disable discovery ");
91 94
92
93/* diag_buffer_enable is bitwise
94 * bit 0 set = TRACE
95 * bit 1 set = SNAPSHOT
96 * bit 2 set = EXTENDED
97 *
98 * Either bit can be set, or both
99 */
100static int diag_buffer_enable;
101module_param(diag_buffer_enable, int, 0);
102MODULE_PARM_DESC(diag_buffer_enable, " post diag buffers "
103 "(TRACE=1/SNAPSHOT=2/EXTENDED=4/default=0)");
104
105/** 95/**
106 * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. 96 * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug.
107 * 97 *
@@ -120,10 +110,34 @@ _scsih_set_fwfault_debug(const char *val, struct kernel_param *kp)
120 ioc->fwfault_debug = mpt2sas_fwfault_debug; 110 ioc->fwfault_debug = mpt2sas_fwfault_debug;
121 return 0; 111 return 0;
122} 112}
113
123module_param_call(mpt2sas_fwfault_debug, _scsih_set_fwfault_debug, 114module_param_call(mpt2sas_fwfault_debug, _scsih_set_fwfault_debug,
124 param_get_int, &mpt2sas_fwfault_debug, 0644); 115 param_get_int, &mpt2sas_fwfault_debug, 0644);
125 116
126/** 117/**
118 * mpt2sas_remove_dead_ioc_func - kthread context to remove dead ioc
119 * @arg: input argument, used to derive ioc
120 *
121 * Return 0 if controller is removed from pci subsystem.
122 * Return -1 for other case.
123 */
124static int mpt2sas_remove_dead_ioc_func(void *arg)
125{
126 struct MPT2SAS_ADAPTER *ioc = (struct MPT2SAS_ADAPTER *)arg;
127 struct pci_dev *pdev;
128
129 if ((ioc == NULL))
130 return -1;
131
132 pdev = ioc->pdev;
133 if ((pdev == NULL))
134 return -1;
135 pci_remove_bus_device(pdev);
136 return 0;
137}
138
139
140/**
127 * _base_fault_reset_work - workq handling ioc fault conditions 141 * _base_fault_reset_work - workq handling ioc fault conditions
128 * @work: input argument, used to derive ioc 142 * @work: input argument, used to derive ioc
129 * Context: sleep. 143 * Context: sleep.
@@ -138,6 +152,7 @@ _base_fault_reset_work(struct work_struct *work)
138 unsigned long flags; 152 unsigned long flags;
139 u32 doorbell; 153 u32 doorbell;
140 int rc; 154 int rc;
155 struct task_struct *p;
141 156
142 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); 157 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
143 if (ioc->shost_recovery) 158 if (ioc->shost_recovery)
@@ -145,6 +160,39 @@ _base_fault_reset_work(struct work_struct *work)
145 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); 160 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
146 161
147 doorbell = mpt2sas_base_get_iocstate(ioc, 0); 162 doorbell = mpt2sas_base_get_iocstate(ioc, 0);
163 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_MASK) {
164 printk(MPT2SAS_INFO_FMT "%s : SAS host is non-operational !!!!\n",
165 ioc->name, __func__);
166
167 /*
168 * Call _scsih_flush_pending_cmds callback so that we flush all
169 * pending commands back to OS. This call is required to aovid
170 * deadlock at block layer. Dead IOC will fail to do diag reset,
171 * and this call is safe since dead ioc will never return any
172 * command back from HW.
173 */
174 ioc->schedule_dead_ioc_flush_running_cmds(ioc);
175 /*
176 * Set remove_host flag early since kernel thread will
177 * take some time to execute.
178 */
179 ioc->remove_host = 1;
180 /*Remove the Dead Host */
181 p = kthread_run(mpt2sas_remove_dead_ioc_func, ioc,
182 "mpt2sas_dead_ioc_%d", ioc->id);
183 if (IS_ERR(p)) {
184 printk(MPT2SAS_ERR_FMT
185 "%s: Running mpt2sas_dead_ioc thread failed !!!!\n",
186 ioc->name, __func__);
187 } else {
188 printk(MPT2SAS_ERR_FMT
189 "%s: Running mpt2sas_dead_ioc thread success !!!!\n",
190 ioc->name, __func__);
191 }
192
193 return; /* don't rearm timer */
194 }
195
148 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT) { 196 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT) {
149 rc = mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, 197 rc = mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP,
150 FORCE_BIG_HAMMER); 198 FORCE_BIG_HAMMER);
@@ -1346,7 +1394,7 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
1346 if (_base_check_enable_msix(ioc) != 0) 1394 if (_base_check_enable_msix(ioc) != 0)
1347 goto try_ioapic; 1395 goto try_ioapic;
1348 1396
1349 ioc->reply_queue_count = min_t(u8, ioc->cpu_count, 1397 ioc->reply_queue_count = min_t(int, ioc->cpu_count,
1350 ioc->msix_vector_count); 1398 ioc->msix_vector_count);
1351 1399
1352 entries = kcalloc(ioc->reply_queue_count, sizeof(struct msix_entry), 1400 entries = kcalloc(ioc->reply_queue_count, sizeof(struct msix_entry),
@@ -1916,6 +1964,10 @@ _base_display_intel_branding(struct MPT2SAS_ADAPTER *ioc)
1916 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, 1964 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1917 MPT2SAS_INTEL_RMS2LL040_BRANDING); 1965 MPT2SAS_INTEL_RMS2LL040_BRANDING);
1918 break; 1966 break;
1967 case MPT2SAS_INTEL_RAMSDALE_SSDID:
1968 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1969 MPT2SAS_INTEL_RAMSDALE_BRANDING);
1970 break;
1919 default: 1971 default:
1920 break; 1972 break;
1921 } 1973 }
@@ -1925,6 +1977,22 @@ _base_display_intel_branding(struct MPT2SAS_ADAPTER *ioc)
1925 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, 1977 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1926 MPT2SAS_INTEL_RS25GB008_BRANDING); 1978 MPT2SAS_INTEL_RS25GB008_BRANDING);
1927 break; 1979 break;
1980 case MPT2SAS_INTEL_RMS25JB080_SSDID:
1981 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1982 MPT2SAS_INTEL_RMS25JB080_BRANDING);
1983 break;
1984 case MPT2SAS_INTEL_RMS25JB040_SSDID:
1985 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1986 MPT2SAS_INTEL_RMS25JB040_BRANDING);
1987 break;
1988 case MPT2SAS_INTEL_RMS25KB080_SSDID:
1989 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1990 MPT2SAS_INTEL_RMS25KB080_BRANDING);
1991 break;
1992 case MPT2SAS_INTEL_RMS25KB040_SSDID:
1993 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1994 MPT2SAS_INTEL_RMS25KB040_BRANDING);
1995 break;
1928 default: 1996 default:
1929 break; 1997 break;
1930 } 1998 }
@@ -2311,8 +2379,6 @@ _base_release_memory_pools(struct MPT2SAS_ADAPTER *ioc)
2311 } 2379 }
2312 if (ioc->chain_dma_pool) 2380 if (ioc->chain_dma_pool)
2313 pci_pool_destroy(ioc->chain_dma_pool); 2381 pci_pool_destroy(ioc->chain_dma_pool);
2314 }
2315 if (ioc->chain_lookup) {
2316 free_pages((ulong)ioc->chain_lookup, ioc->chain_pages); 2382 free_pages((ulong)ioc->chain_lookup, ioc->chain_pages);
2317 ioc->chain_lookup = NULL; 2383 ioc->chain_lookup = NULL;
2318 } 2384 }
@@ -2330,9 +2396,7 @@ static int
2330_base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) 2396_base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2331{ 2397{
2332 struct mpt2sas_facts *facts; 2398 struct mpt2sas_facts *facts;
2333 u32 queue_size, queue_diff;
2334 u16 max_sge_elements; 2399 u16 max_sge_elements;
2335 u16 num_of_reply_frames;
2336 u16 chains_needed_per_io; 2400 u16 chains_needed_per_io;
2337 u32 sz, total_sz, reply_post_free_sz; 2401 u32 sz, total_sz, reply_post_free_sz;
2338 u32 retry_sz; 2402 u32 retry_sz;
@@ -2359,7 +2423,8 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2359 max_request_credit = (max_queue_depth < facts->RequestCredit) 2423 max_request_credit = (max_queue_depth < facts->RequestCredit)
2360 ? max_queue_depth : facts->RequestCredit; 2424 ? max_queue_depth : facts->RequestCredit;
2361 else 2425 else
2362 max_request_credit = facts->RequestCredit; 2426 max_request_credit = min_t(u16, facts->RequestCredit,
2427 MAX_HBA_QUEUE_DEPTH);
2363 2428
2364 ioc->hba_queue_depth = max_request_credit; 2429 ioc->hba_queue_depth = max_request_credit;
2365 ioc->hi_priority_depth = facts->HighPriorityCredit; 2430 ioc->hi_priority_depth = facts->HighPriorityCredit;
@@ -2400,50 +2465,25 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2400 } 2465 }
2401 ioc->chains_needed_per_io = chains_needed_per_io; 2466 ioc->chains_needed_per_io = chains_needed_per_io;
2402 2467
2403 /* reply free queue sizing - taking into account for events */ 2468 /* reply free queue sizing - taking into account for 64 FW events */
2404 num_of_reply_frames = ioc->hba_queue_depth + 32; 2469 ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;
2405
2406 /* number of replies frames can't be a multiple of 16 */
2407 /* decrease number of reply frames by 1 */
2408 if (!(num_of_reply_frames % 16))
2409 num_of_reply_frames--;
2410
2411 /* calculate number of reply free queue entries
2412 * (must be multiple of 16)
2413 */
2414
2415 /* (we know reply_free_queue_depth is not a multiple of 16) */
2416 queue_size = num_of_reply_frames;
2417 queue_size += 16 - (queue_size % 16);
2418 ioc->reply_free_queue_depth = queue_size;
2419
2420 /* reply descriptor post queue sizing */
2421 /* this size should be the number of request frames + number of reply
2422 * frames
2423 */
2424
2425 queue_size = ioc->hba_queue_depth + num_of_reply_frames + 1;
2426 /* round up to 16 byte boundary */
2427 if (queue_size % 16)
2428 queue_size += 16 - (queue_size % 16);
2429
2430 /* check against IOC maximum reply post queue depth */
2431 if (queue_size > facts->MaxReplyDescriptorPostQueueDepth) {
2432 queue_diff = queue_size -
2433 facts->MaxReplyDescriptorPostQueueDepth;
2434 2470
2435 /* round queue_diff up to multiple of 16 */ 2471 /* align the reply post queue on the next 16 count boundary */
2436 if (queue_diff % 16) 2472 if (!ioc->reply_free_queue_depth % 16)
2437 queue_diff += 16 - (queue_diff % 16); 2473 ioc->reply_post_queue_depth = ioc->reply_free_queue_depth + 16;
2438 2474 else
2439 /* adjust hba_queue_depth, reply_free_queue_depth, 2475 ioc->reply_post_queue_depth = ioc->reply_free_queue_depth +
2440 * and queue_size 2476 32 - (ioc->reply_free_queue_depth % 16);
2441 */ 2477 if (ioc->reply_post_queue_depth >
2442 ioc->hba_queue_depth -= (queue_diff / 2); 2478 facts->MaxReplyDescriptorPostQueueDepth) {
2443 ioc->reply_free_queue_depth -= (queue_diff / 2); 2479 ioc->reply_post_queue_depth = min_t(u16,
2444 queue_size = facts->MaxReplyDescriptorPostQueueDepth; 2480 (facts->MaxReplyDescriptorPostQueueDepth -
2481 (facts->MaxReplyDescriptorPostQueueDepth % 16)),
2482 (ioc->hba_queue_depth - (ioc->hba_queue_depth % 16)));
2483 ioc->reply_free_queue_depth = ioc->reply_post_queue_depth - 16;
2484 ioc->hba_queue_depth = ioc->reply_free_queue_depth - 64;
2445 } 2485 }
2446 ioc->reply_post_queue_depth = queue_size; 2486
2447 2487
2448 dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "scatter gather: " 2488 dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "scatter gather: "
2449 "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), " 2489 "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), "
@@ -2529,15 +2569,12 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2529 "depth(%d)\n", ioc->name, ioc->request, 2569 "depth(%d)\n", ioc->name, ioc->request,
2530 ioc->scsiio_depth)); 2570 ioc->scsiio_depth));
2531 2571
2532 /* loop till the allocation succeeds */ 2572 ioc->chain_depth = min_t(u32, ioc->chain_depth, MAX_CHAIN_DEPTH);
2533 do { 2573 sz = ioc->chain_depth * sizeof(struct chain_tracker);
2534 sz = ioc->chain_depth * sizeof(struct chain_tracker); 2574 ioc->chain_pages = get_order(sz);
2535 ioc->chain_pages = get_order(sz); 2575
2536 ioc->chain_lookup = (struct chain_tracker *)__get_free_pages( 2576 ioc->chain_lookup = (struct chain_tracker *)__get_free_pages(
2537 GFP_KERNEL, ioc->chain_pages); 2577 GFP_KERNEL, ioc->chain_pages);
2538 if (ioc->chain_lookup == NULL)
2539 ioc->chain_depth -= 100;
2540 } while (ioc->chain_lookup == NULL);
2541 ioc->chain_dma_pool = pci_pool_create("chain pool", ioc->pdev, 2578 ioc->chain_dma_pool = pci_pool_create("chain pool", ioc->pdev,
2542 ioc->request_sz, 16, 0); 2579 ioc->request_sz, 16, 0);
2543 if (!ioc->chain_dma_pool) { 2580 if (!ioc->chain_dma_pool) {
@@ -3136,8 +3173,8 @@ mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc,
3136 if (mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || 3173 if (mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET ||
3137 mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET) 3174 mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET)
3138 ioc->ioc_link_reset_in_progress = 1; 3175 ioc->ioc_link_reset_in_progress = 1;
3139 mpt2sas_base_put_smid_default(ioc, smid);
3140 init_completion(&ioc->base_cmds.done); 3176 init_completion(&ioc->base_cmds.done);
3177 mpt2sas_base_put_smid_default(ioc, smid);
3141 timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 3178 timeleft = wait_for_completion_timeout(&ioc->base_cmds.done,
3142 msecs_to_jiffies(10000)); 3179 msecs_to_jiffies(10000));
3143 if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || 3180 if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET ||
@@ -3238,8 +3275,8 @@ mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc,
3238 request = mpt2sas_base_get_msg_frame(ioc, smid); 3275 request = mpt2sas_base_get_msg_frame(ioc, smid);
3239 ioc->base_cmds.smid = smid; 3276 ioc->base_cmds.smid = smid;
3240 memcpy(request, mpi_request, sizeof(Mpi2SepReply_t)); 3277 memcpy(request, mpi_request, sizeof(Mpi2SepReply_t));
3241 mpt2sas_base_put_smid_default(ioc, smid);
3242 init_completion(&ioc->base_cmds.done); 3278 init_completion(&ioc->base_cmds.done);
3279 mpt2sas_base_put_smid_default(ioc, smid);
3243 timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 3280 timeleft = wait_for_completion_timeout(&ioc->base_cmds.done,
3244 msecs_to_jiffies(10000)); 3281 msecs_to_jiffies(10000));
3245 if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { 3282 if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) {
@@ -3746,8 +3783,8 @@ _base_event_notification(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
3746 for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) 3783 for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++)
3747 mpi_request->EventMasks[i] = 3784 mpi_request->EventMasks[i] =
3748 cpu_to_le32(ioc->event_masks[i]); 3785 cpu_to_le32(ioc->event_masks[i]);
3749 mpt2sas_base_put_smid_default(ioc, smid);
3750 init_completion(&ioc->base_cmds.done); 3786 init_completion(&ioc->base_cmds.done);
3787 mpt2sas_base_put_smid_default(ioc, smid);
3751 timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); 3788 timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ);
3752 if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { 3789 if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) {
3753 printk(MPT2SAS_ERR_FMT "%s: timeout\n", 3790 printk(MPT2SAS_ERR_FMT "%s: timeout\n",
@@ -4062,7 +4099,8 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
4062 ioc->reply_free[i] = cpu_to_le32(reply_address); 4099 ioc->reply_free[i] = cpu_to_le32(reply_address);
4063 4100
4064 /* initialize reply queues */ 4101 /* initialize reply queues */
4065 _base_assign_reply_queues(ioc); 4102 if (ioc->is_driver_loading)
4103 _base_assign_reply_queues(ioc);
4066 4104
4067 /* initialize Reply Post Free Queue */ 4105 /* initialize Reply Post Free Queue */
4068 reply_post_free = (long)ioc->reply_post_free; 4106 reply_post_free = (long)ioc->reply_post_free;
@@ -4110,24 +4148,17 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
4110 4148
4111 4149
4112 if (ioc->is_driver_loading) { 4150 if (ioc->is_driver_loading) {
4113 4151 if (ioc->is_warpdrive && ioc->manu_pg10.OEMIdentifier
4114 4152 == 0x80) {
4115
4116 ioc->wait_for_discovery_to_complete =
4117 _base_determine_wait_on_discovery(ioc);
4118 return r; /* scan_start and scan_finished support */
4119 }
4120
4121
4122 if (ioc->wait_for_discovery_to_complete && ioc->is_warpdrive) {
4123 if (ioc->manu_pg10.OEMIdentifier == 0x80) {
4124 hide_flag = (u8) (ioc->manu_pg10.OEMSpecificFlags0 & 4153 hide_flag = (u8) (ioc->manu_pg10.OEMSpecificFlags0 &
4125 MFG_PAGE10_HIDE_SSDS_MASK); 4154 MFG_PAGE10_HIDE_SSDS_MASK);
4126 if (hide_flag != MFG_PAGE10_HIDE_SSDS_MASK) 4155 if (hide_flag != MFG_PAGE10_HIDE_SSDS_MASK)
4127 ioc->mfg_pg10_hide_flag = hide_flag; 4156 ioc->mfg_pg10_hide_flag = hide_flag;
4128 } 4157 }
4158 ioc->wait_for_discovery_to_complete =
4159 _base_determine_wait_on_discovery(ioc);
4160 return r; /* scan_start and scan_finished support */
4129 } 4161 }
4130
4131 r = _base_send_port_enable(ioc, sleep_flag); 4162 r = _base_send_port_enable(ioc, sleep_flag);
4132 if (r) 4163 if (r)
4133 return r; 4164 return r;
@@ -4206,7 +4237,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
4206 4237
4207 r = mpt2sas_base_map_resources(ioc); 4238 r = mpt2sas_base_map_resources(ioc);
4208 if (r) 4239 if (r)
4209 return r; 4240 goto out_free_resources;
4210 4241
4211 if (ioc->is_warpdrive) { 4242 if (ioc->is_warpdrive) {
4212 ioc->reply_post_host_index[0] = 4243 ioc->reply_post_host_index[0] =
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 3c3babc7d260..c7459fdc06cc 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -69,8 +69,8 @@
69#define MPT2SAS_DRIVER_NAME "mpt2sas" 69#define MPT2SAS_DRIVER_NAME "mpt2sas"
70#define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" 70#define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>"
71#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" 71#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
72#define MPT2SAS_DRIVER_VERSION "10.100.00.00" 72#define MPT2SAS_DRIVER_VERSION "12.100.00.00"
73#define MPT2SAS_MAJOR_VERSION 10 73#define MPT2SAS_MAJOR_VERSION 12
74#define MPT2SAS_MINOR_VERSION 100 74#define MPT2SAS_MINOR_VERSION 100
75#define MPT2SAS_BUILD_VERSION 00 75#define MPT2SAS_BUILD_VERSION 00
76#define MPT2SAS_RELEASE_VERSION 00 76#define MPT2SAS_RELEASE_VERSION 00
@@ -157,20 +157,33 @@
157/* 157/*
158 * Intel HBA branding 158 * Intel HBA branding
159 */ 159 */
160#define MPT2SAS_INTEL_RMS25JB080_BRANDING \
161 "Intel(R) Integrated RAID Module RMS25JB080"
162#define MPT2SAS_INTEL_RMS25JB040_BRANDING \
163 "Intel(R) Integrated RAID Module RMS25JB040"
164#define MPT2SAS_INTEL_RMS25KB080_BRANDING \
165 "Intel(R) Integrated RAID Module RMS25KB080"
166#define MPT2SAS_INTEL_RMS25KB040_BRANDING \
167 "Intel(R) Integrated RAID Module RMS25KB040"
160#define MPT2SAS_INTEL_RMS2LL080_BRANDING \ 168#define MPT2SAS_INTEL_RMS2LL080_BRANDING \
161 "Intel Integrated RAID Module RMS2LL080" 169 "Intel Integrated RAID Module RMS2LL080"
162#define MPT2SAS_INTEL_RMS2LL040_BRANDING \ 170#define MPT2SAS_INTEL_RMS2LL040_BRANDING \
163 "Intel Integrated RAID Module RMS2LL040" 171 "Intel Integrated RAID Module RMS2LL040"
164#define MPT2SAS_INTEL_RS25GB008_BRANDING \ 172#define MPT2SAS_INTEL_RS25GB008_BRANDING \
165 "Intel(R) RAID Controller RS25GB008" 173 "Intel(R) RAID Controller RS25GB008"
166 174#define MPT2SAS_INTEL_RAMSDALE_BRANDING \
175 "Intel 720 Series SSD"
167/* 176/*
168 * Intel HBA SSDIDs 177 * Intel HBA SSDIDs
169 */ 178 */
179#define MPT2SAS_INTEL_RMS25JB080_SSDID 0x3516
180#define MPT2SAS_INTEL_RMS25JB040_SSDID 0x3517
181#define MPT2SAS_INTEL_RMS25KB080_SSDID 0x3518
182#define MPT2SAS_INTEL_RMS25KB040_SSDID 0x3519
170#define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E 183#define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E
171#define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F 184#define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F
172#define MPT2SAS_INTEL_RS25GB008_SSDID 0x3000 185#define MPT2SAS_INTEL_RS25GB008_SSDID 0x3000
173 186#define MPT2SAS_INTEL_RAMSDALE_SSDID 0x3700
174 187
175/* 188/*
176 * HP HBA branding 189 * HP HBA branding
@@ -373,6 +386,7 @@ struct _sas_device {
373 * @percent_complete: resync percent complete 386 * @percent_complete: resync percent complete
374 * @direct_io_enabled: Whether direct io to PDs are allowed or not 387 * @direct_io_enabled: Whether direct io to PDs are allowed or not
375 * @stripe_exponent: X where 2powX is the stripe sz in blocks 388 * @stripe_exponent: X where 2powX is the stripe sz in blocks
389 * @block_exponent: X where 2powX is the block sz in bytes
376 * @max_lba: Maximum number of LBA in the volume 390 * @max_lba: Maximum number of LBA in the volume
377 * @stripe_sz: Stripe Size of the volume 391 * @stripe_sz: Stripe Size of the volume
378 * @device_info: Device info of the volume member disk 392 * @device_info: Device info of the volume member disk
@@ -394,6 +408,7 @@ struct _raid_device {
394 u8 percent_complete; 408 u8 percent_complete;
395 u8 direct_io_enabled; 409 u8 direct_io_enabled;
396 u8 stripe_exponent; 410 u8 stripe_exponent;
411 u8 block_exponent;
397 u64 max_lba; 412 u64 max_lba;
398 u32 stripe_sz; 413 u32 stripe_sz;
399 u32 device_info; 414 u32 device_info;
@@ -623,6 +638,7 @@ enum mutex_type {
623 TM_MUTEX_ON = 1, 638 TM_MUTEX_ON = 1,
624}; 639};
625 640
641typedef void (*MPT2SAS_FLUSH_RUNNING_CMDS)(struct MPT2SAS_ADAPTER *ioc);
626/** 642/**
627 * struct MPT2SAS_ADAPTER - per adapter struct 643 * struct MPT2SAS_ADAPTER - per adapter struct
628 * @list: ioc_list 644 * @list: ioc_list
@@ -665,6 +681,7 @@ enum mutex_type {
665 * @msix_vector_count: number msix vectors 681 * @msix_vector_count: number msix vectors
666 * @cpu_msix_table: table for mapping cpus to msix index 682 * @cpu_msix_table: table for mapping cpus to msix index
667 * @cpu_msix_table_sz: table size 683 * @cpu_msix_table_sz: table size
684 * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands
668 * @scsi_io_cb_idx: shost generated commands 685 * @scsi_io_cb_idx: shost generated commands
669 * @tm_cb_idx: task management commands 686 * @tm_cb_idx: task management commands
670 * @scsih_cb_idx: scsih internal commands 687 * @scsih_cb_idx: scsih internal commands
@@ -816,6 +833,7 @@ struct MPT2SAS_ADAPTER {
816 resource_size_t **reply_post_host_index; 833 resource_size_t **reply_post_host_index;
817 u16 cpu_msix_table_sz; 834 u16 cpu_msix_table_sz;
818 u32 ioc_reset_count; 835 u32 ioc_reset_count;
836 MPT2SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds;
819 837
820 /* internal commands, callback index */ 838 /* internal commands, callback index */
821 u8 scsi_io_cb_idx; 839 u8 scsi_io_cb_idx;
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
index aabcb911706e..7fceb899029e 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
@@ -818,6 +818,7 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
818 _ctl_display_some_debug(ioc, smid, "ctl_request", NULL); 818 _ctl_display_some_debug(ioc, smid, "ctl_request", NULL);
819#endif 819#endif
820 820
821 init_completion(&ioc->ctl_cmds.done);
821 switch (mpi_request->Function) { 822 switch (mpi_request->Function) {
822 case MPI2_FUNCTION_SCSI_IO_REQUEST: 823 case MPI2_FUNCTION_SCSI_IO_REQUEST:
823 case MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH: 824 case MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH:
@@ -903,7 +904,6 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
903 timeout = MPT2_IOCTL_DEFAULT_TIMEOUT; 904 timeout = MPT2_IOCTL_DEFAULT_TIMEOUT;
904 else 905 else
905 timeout = karg.timeout; 906 timeout = karg.timeout;
906 init_completion(&ioc->ctl_cmds.done);
907 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, 907 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done,
908 timeout*HZ); 908 timeout*HZ);
909 if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) { 909 if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) {
@@ -1477,8 +1477,8 @@ _ctl_diag_register_2(struct MPT2SAS_ADAPTER *ioc,
1477 mpi_request->ProductSpecific[i] = 1477 mpi_request->ProductSpecific[i] =
1478 cpu_to_le32(ioc->product_specific[buffer_type][i]); 1478 cpu_to_le32(ioc->product_specific[buffer_type][i]);
1479 1479
1480 mpt2sas_base_put_smid_default(ioc, smid);
1481 init_completion(&ioc->ctl_cmds.done); 1480 init_completion(&ioc->ctl_cmds.done);
1481 mpt2sas_base_put_smid_default(ioc, smid);
1482 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, 1482 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done,
1483 MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); 1483 MPT2_IOCTL_DEFAULT_TIMEOUT*HZ);
1484 1484
@@ -1821,8 +1821,8 @@ _ctl_send_release(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type, u8 *issue_reset)
1821 mpi_request->VF_ID = 0; /* TODO */ 1821 mpi_request->VF_ID = 0; /* TODO */
1822 mpi_request->VP_ID = 0; 1822 mpi_request->VP_ID = 0;
1823 1823
1824 mpt2sas_base_put_smid_default(ioc, smid);
1825 init_completion(&ioc->ctl_cmds.done); 1824 init_completion(&ioc->ctl_cmds.done);
1825 mpt2sas_base_put_smid_default(ioc, smid);
1826 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, 1826 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done,
1827 MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); 1827 MPT2_IOCTL_DEFAULT_TIMEOUT*HZ);
1828 1828
@@ -2095,8 +2095,8 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)
2095 mpi_request->VF_ID = 0; /* TODO */ 2095 mpi_request->VF_ID = 0; /* TODO */
2096 mpi_request->VP_ID = 0; 2096 mpi_request->VP_ID = 0;
2097 2097
2098 mpt2sas_base_put_smid_default(ioc, smid);
2099 init_completion(&ioc->ctl_cmds.done); 2098 init_completion(&ioc->ctl_cmds.done);
2099 mpt2sas_base_put_smid_default(ioc, smid);
2100 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, 2100 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done,
2101 MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); 2101 MPT2_IOCTL_DEFAULT_TIMEOUT*HZ);
2102 2102
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index d570573b7963..193e33e28e49 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -99,7 +99,7 @@ MODULE_PARM_DESC(logging_level, " bits for enabling additional logging info "
99 99
100static ushort max_sectors = 0xFFFF; 100static ushort max_sectors = 0xFFFF;
101module_param(max_sectors, ushort, 0); 101module_param(max_sectors, ushort, 0);
102MODULE_PARM_DESC(max_sectors, "max sectors, range 64 to 8192 default=8192"); 102MODULE_PARM_DESC(max_sectors, "max sectors, range 64 to 32767 default=32767");
103 103
104/* scsi-mid layer global parmeter is max_report_luns, which is 511 */ 104/* scsi-mid layer global parmeter is max_report_luns, which is 511 */
105#define MPT2SAS_MAX_LUN (16895) 105#define MPT2SAS_MAX_LUN (16895)
@@ -612,13 +612,17 @@ _scsih_sas_device_add(struct MPT2SAS_ADAPTER *ioc,
612 if (!mpt2sas_transport_port_add(ioc, sas_device->handle, 612 if (!mpt2sas_transport_port_add(ioc, sas_device->handle,
613 sas_device->sas_address_parent)) { 613 sas_device->sas_address_parent)) {
614 _scsih_sas_device_remove(ioc, sas_device); 614 _scsih_sas_device_remove(ioc, sas_device);
615 } else if (!sas_device->starget) { 615 } else if (!sas_device->starget) {
616 if (!ioc->is_driver_loading) 616 /* When asyn scanning is enabled, its not possible to remove
617 mpt2sas_transport_port_remove(ioc, 617 * devices while scanning is turned on due to an oops in
618 sas_device->sas_address, 618 * scsi_sysfs_add_sdev()->add_device()->sysfs_addrm_start()
619 sas_device->sas_address_parent); 619 */
620 _scsih_sas_device_remove(ioc, sas_device); 620 if (!ioc->is_driver_loading)
621 } 621 mpt2sas_transport_port_remove(ioc,
622 sas_device->sas_address,
623 sas_device->sas_address_parent);
624 _scsih_sas_device_remove(ioc, sas_device);
625 }
622} 626}
623 627
624/** 628/**
@@ -1007,8 +1011,8 @@ _scsih_get_chain_buffer_tracker(struct MPT2SAS_ADAPTER *ioc, u16 smid)
1007 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); 1011 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
1008 if (list_empty(&ioc->free_chain_list)) { 1012 if (list_empty(&ioc->free_chain_list)) {
1009 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); 1013 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
1010 printk(MPT2SAS_WARN_FMT "chain buffers not available\n", 1014 dfailprintk(ioc, printk(MPT2SAS_WARN_FMT "chain buffers not "
1011 ioc->name); 1015 "available\n", ioc->name));
1012 return NULL; 1016 return NULL;
1013 } 1017 }
1014 chain_req = list_entry(ioc->free_chain_list.next, 1018 chain_req = list_entry(ioc->free_chain_list.next,
@@ -1449,7 +1453,7 @@ _scsih_slave_destroy(struct scsi_device *sdev)
1449 spin_lock_irqsave(&ioc->sas_device_lock, flags); 1453 spin_lock_irqsave(&ioc->sas_device_lock, flags);
1450 sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, 1454 sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc,
1451 sas_target_priv_data->sas_address); 1455 sas_target_priv_data->sas_address);
1452 if (sas_device) 1456 if (sas_device && !sas_target_priv_data->num_luns)
1453 sas_device->starget = NULL; 1457 sas_device->starget = NULL;
1454 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 1458 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
1455 } 1459 }
@@ -1776,11 +1780,9 @@ _scsih_init_warpdrive_properties(struct MPT2SAS_ADAPTER *ioc,
1776 Mpi2ConfigReply_t mpi_reply; 1780 Mpi2ConfigReply_t mpi_reply;
1777 u16 sz; 1781 u16 sz;
1778 u8 num_pds, count; 1782 u8 num_pds, count;
1779 u64 mb = 1024 * 1024; 1783 unsigned long stripe_sz, block_sz;
1780 u64 tb_2 = 2 * mb * mb; 1784 u8 stripe_exp, block_exp;
1781 u64 capacity; 1785 u64 dev_max_lba;
1782 u32 stripe_sz;
1783 u8 i, stripe_exp;
1784 1786
1785 if (!ioc->is_warpdrive) 1787 if (!ioc->is_warpdrive)
1786 return; 1788 return;
@@ -1844,51 +1846,57 @@ _scsih_init_warpdrive_properties(struct MPT2SAS_ADAPTER *ioc,
1844 vol_pg0->PhysDisk[count].PhysDiskNum); 1846 vol_pg0->PhysDisk[count].PhysDiskNum);
1845 goto out_error; 1847 goto out_error;
1846 } 1848 }
1849 /* Disable direct I/O if member drive lba exceeds 4 bytes */
1850 dev_max_lba = le64_to_cpu(pd_pg0.DeviceMaxLBA);
1851 if (dev_max_lba >> 32) {
1852 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is "
1853 "disabled for the drive with handle(0x%04x) member"
1854 "handle (0x%04x) unsupported max lba 0x%016llx\n",
1855 ioc->name, raid_device->handle,
1856 le16_to_cpu(pd_pg0.DevHandle),
1857 (unsigned long long)dev_max_lba);
1858 goto out_error;
1859 }
1860
1847 raid_device->pd_handle[count] = le16_to_cpu(pd_pg0.DevHandle); 1861 raid_device->pd_handle[count] = le16_to_cpu(pd_pg0.DevHandle);
1848 } 1862 }
1849 1863
1850 /* 1864 /*
1851 * Assumption for WD: Direct I/O is not supported if the volume is 1865 * Assumption for WD: Direct I/O is not supported if the volume is
1852 * not RAID0, if the stripe size is not 64KB, if the block size is 1866 * not RAID0
1853 * not 512 and if the volume size is >2TB
1854 */ 1867 */
1855 if (raid_device->volume_type != MPI2_RAID_VOL_TYPE_RAID0 || 1868 if (raid_device->volume_type != MPI2_RAID_VOL_TYPE_RAID0) {
1856 le16_to_cpu(vol_pg0->BlockSize) != 512) {
1857 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is disabled " 1869 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is disabled "
1858 "for the drive with handle(0x%04x): type=%d, " 1870 "for the drive with handle(0x%04x): type=%d, "
1859 "s_sz=%uK, blk_size=%u\n", ioc->name, 1871 "s_sz=%uK, blk_size=%u\n", ioc->name,
1860 raid_device->handle, raid_device->volume_type, 1872 raid_device->handle, raid_device->volume_type,
1861 le32_to_cpu(vol_pg0->StripeSize)/2, 1873 (le32_to_cpu(vol_pg0->StripeSize) *
1874 le16_to_cpu(vol_pg0->BlockSize)) / 1024,
1862 le16_to_cpu(vol_pg0->BlockSize)); 1875 le16_to_cpu(vol_pg0->BlockSize));
1863 goto out_error; 1876 goto out_error;
1864 } 1877 }
1865 1878
1866 capacity = (u64) le16_to_cpu(vol_pg0->BlockSize) * 1879 stripe_sz = le32_to_cpu(vol_pg0->StripeSize);
1867 (le64_to_cpu(vol_pg0->MaxLBA) + 1); 1880 stripe_exp = find_first_bit(&stripe_sz, 32);
1868 1881 if (stripe_exp == 32) {
1869 if (capacity > tb_2) {
1870 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is disabled " 1882 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is disabled "
1871 "for the drive with handle(0x%04x) since drive sz > 2TB\n", 1883 "for the drive with handle(0x%04x) invalid stripe sz %uK\n",
1872 ioc->name, raid_device->handle); 1884 ioc->name, raid_device->handle,
1885 (le32_to_cpu(vol_pg0->StripeSize) *
1886 le16_to_cpu(vol_pg0->BlockSize)) / 1024);
1873 goto out_error; 1887 goto out_error;
1874 } 1888 }
1875 1889 raid_device->stripe_exponent = stripe_exp;
1876 stripe_sz = le32_to_cpu(vol_pg0->StripeSize); 1890 block_sz = le16_to_cpu(vol_pg0->BlockSize);
1877 stripe_exp = 0; 1891 block_exp = find_first_bit(&block_sz, 16);
1878 for (i = 0; i < 32; i++) { 1892 if (block_exp == 16) {
1879 if (stripe_sz & 1)
1880 break;
1881 stripe_exp++;
1882 stripe_sz >>= 1;
1883 }
1884 if (i == 32) {
1885 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is disabled " 1893 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is disabled "
1886 "for the drive with handle(0x%04x) invalid stripe sz %uK\n", 1894 "for the drive with handle(0x%04x) invalid block sz %u\n",
1887 ioc->name, raid_device->handle, 1895 ioc->name, raid_device->handle,
1888 le32_to_cpu(vol_pg0->StripeSize)/2); 1896 le16_to_cpu(vol_pg0->BlockSize));
1889 goto out_error; 1897 goto out_error;
1890 } 1898 }
1891 raid_device->stripe_exponent = stripe_exp; 1899 raid_device->block_exponent = block_exp;
1892 raid_device->direct_io_enabled = 1; 1900 raid_device->direct_io_enabled = 1;
1893 1901
1894 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is Enabled for the drive" 1902 printk(MPT2SAS_INFO_FMT "WarpDrive : Direct IO is Enabled for the drive"
@@ -3804,8 +3812,9 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
3804{ 3812{
3805 u32 v_lba, p_lba, stripe_off, stripe_unit, column, io_size; 3813 u32 v_lba, p_lba, stripe_off, stripe_unit, column, io_size;
3806 u32 stripe_sz, stripe_exp; 3814 u32 stripe_sz, stripe_exp;
3807 u8 num_pds, *cdb_ptr, *tmp_ptr, *lba_ptr1, *lba_ptr2; 3815 u8 num_pds, *cdb_ptr, i;
3808 u8 cdb0 = scmd->cmnd[0]; 3816 u8 cdb0 = scmd->cmnd[0];
3817 u64 v_llba;
3809 3818
3810 /* 3819 /*
3811 * Try Direct I/O to RAID memeber disks 3820 * Try Direct I/O to RAID memeber disks
@@ -3816,15 +3825,11 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
3816 3825
3817 if ((cdb0 < READ_16) || !(cdb_ptr[2] | cdb_ptr[3] | cdb_ptr[4] 3826 if ((cdb0 < READ_16) || !(cdb_ptr[2] | cdb_ptr[3] | cdb_ptr[4]
3818 | cdb_ptr[5])) { 3827 | cdb_ptr[5])) {
3819 io_size = scsi_bufflen(scmd) >> 9; 3828 io_size = scsi_bufflen(scmd) >>
3829 raid_device->block_exponent;
3830 i = (cdb0 < READ_16) ? 2 : 6;
3820 /* get virtual lba */ 3831 /* get virtual lba */
3821 lba_ptr1 = lba_ptr2 = (cdb0 < READ_16) ? &cdb_ptr[2] : 3832 v_lba = be32_to_cpu(*(__be32 *)(&cdb_ptr[i]));
3822 &cdb_ptr[6];
3823 tmp_ptr = (u8 *)&v_lba + 3;
3824 *tmp_ptr-- = *lba_ptr1++;
3825 *tmp_ptr-- = *lba_ptr1++;
3826 *tmp_ptr-- = *lba_ptr1++;
3827 *tmp_ptr = *lba_ptr1;
3828 3833
3829 if (((u64)v_lba + (u64)io_size - 1) <= 3834 if (((u64)v_lba + (u64)io_size - 1) <=
3830 (u32)raid_device->max_lba) { 3835 (u32)raid_device->max_lba) {
@@ -3843,11 +3848,39 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
3843 mpi_request->DevHandle = 3848 mpi_request->DevHandle =
3844 cpu_to_le16(raid_device-> 3849 cpu_to_le16(raid_device->
3845 pd_handle[column]); 3850 pd_handle[column]);
3846 tmp_ptr = (u8 *)&p_lba + 3; 3851 (*(__be32 *)(&cdb_ptr[i])) =
3847 *lba_ptr2++ = *tmp_ptr--; 3852 cpu_to_be32(p_lba);
3848 *lba_ptr2++ = *tmp_ptr--; 3853 /*
3849 *lba_ptr2++ = *tmp_ptr--; 3854 * WD: To indicate this I/O is directI/O
3850 *lba_ptr2 = *tmp_ptr; 3855 */
3856 _scsih_scsi_direct_io_set(ioc, smid, 1);
3857 }
3858 }
3859 } else {
3860 io_size = scsi_bufflen(scmd) >>
3861 raid_device->block_exponent;
3862 /* get virtual lba */
3863 v_llba = be64_to_cpu(*(__be64 *)(&cdb_ptr[2]));
3864
3865 if ((v_llba + (u64)io_size - 1) <=
3866 raid_device->max_lba) {
3867 stripe_sz = raid_device->stripe_sz;
3868 stripe_exp = raid_device->stripe_exponent;
3869 stripe_off = (u32) (v_llba & (stripe_sz - 1));
3870
3871 /* Check whether IO falls within a stripe */
3872 if ((stripe_off + io_size) <= stripe_sz) {
3873 num_pds = raid_device->num_pds;
3874 p_lba = (u32)(v_llba >> stripe_exp);
3875 stripe_unit = p_lba / num_pds;
3876 column = p_lba % num_pds;
3877 p_lba = (stripe_unit << stripe_exp) +
3878 stripe_off;
3879 mpi_request->DevHandle =
3880 cpu_to_le16(raid_device->
3881 pd_handle[column]);
3882 (*(__be64 *)(&cdb_ptr[2])) =
3883 cpu_to_be64((u64)p_lba);
3851 /* 3884 /*
3852 * WD: To indicate this I/O is directI/O 3885 * WD: To indicate this I/O is directI/O
3853 */ 3886 */
@@ -4403,11 +4436,14 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
4403 scmd->result = DID_NO_CONNECT << 16; 4436 scmd->result = DID_NO_CONNECT << 16;
4404 goto out; 4437 goto out;
4405 } 4438 }
4439 ioc_status = le16_to_cpu(mpi_reply->IOCStatus);
4406 /* 4440 /*
4407 * WARPDRIVE: If direct_io is set then it is directIO, 4441 * WARPDRIVE: If direct_io is set then it is directIO,
4408 * the failed direct I/O should be redirected to volume 4442 * the failed direct I/O should be redirected to volume
4409 */ 4443 */
4410 if (_scsih_scsi_direct_io_get(ioc, smid)) { 4444 if (_scsih_scsi_direct_io_get(ioc, smid) &&
4445 ((ioc_status & MPI2_IOCSTATUS_MASK)
4446 != MPI2_IOCSTATUS_SCSI_TASK_TERMINATED)) {
4411 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); 4447 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
4412 ioc->scsi_lookup[smid - 1].scmd = scmd; 4448 ioc->scsi_lookup[smid - 1].scmd = scmd;
4413 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); 4449 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
@@ -4441,7 +4477,6 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
4441 4477
4442 xfer_cnt = le32_to_cpu(mpi_reply->TransferCount); 4478 xfer_cnt = le32_to_cpu(mpi_reply->TransferCount);
4443 scsi_set_resid(scmd, scsi_bufflen(scmd) - xfer_cnt); 4479 scsi_set_resid(scmd, scsi_bufflen(scmd) - xfer_cnt);
4444 ioc_status = le16_to_cpu(mpi_reply->IOCStatus);
4445 if (ioc_status & MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) 4480 if (ioc_status & MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE)
4446 log_info = le32_to_cpu(mpi_reply->IOCLogInfo); 4481 log_info = le32_to_cpu(mpi_reply->IOCLogInfo);
4447 else 4482 else
@@ -4485,6 +4520,8 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
4485 scmd->result = DID_TRANSPORT_DISRUPTED << 16; 4520 scmd->result = DID_TRANSPORT_DISRUPTED << 16;
4486 goto out; 4521 goto out;
4487 } 4522 }
4523 scmd->result = DID_SOFT_ERROR << 16;
4524 break;
4488 case MPI2_IOCSTATUS_SCSI_TASK_TERMINATED: 4525 case MPI2_IOCSTATUS_SCSI_TASK_TERMINATED:
4489 case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED: 4526 case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED:
4490 scmd->result = DID_RESET << 16; 4527 scmd->result = DID_RESET << 16;
@@ -6714,6 +6751,7 @@ _scsih_mark_responding_raid_device(struct MPT2SAS_ADAPTER *ioc, u64 wwid,
6714 } else 6751 } else
6715 sas_target_priv_data = NULL; 6752 sas_target_priv_data = NULL;
6716 raid_device->responding = 1; 6753 raid_device->responding = 1;
6754 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
6717 starget_printk(KERN_INFO, raid_device->starget, 6755 starget_printk(KERN_INFO, raid_device->starget,
6718 "handle(0x%04x), wwid(0x%016llx)\n", handle, 6756 "handle(0x%04x), wwid(0x%016llx)\n", handle,
6719 (unsigned long long)raid_device->wwid); 6757 (unsigned long long)raid_device->wwid);
@@ -6724,16 +6762,16 @@ _scsih_mark_responding_raid_device(struct MPT2SAS_ADAPTER *ioc, u64 wwid,
6724 */ 6762 */
6725 _scsih_init_warpdrive_properties(ioc, raid_device); 6763 _scsih_init_warpdrive_properties(ioc, raid_device);
6726 if (raid_device->handle == handle) 6764 if (raid_device->handle == handle)
6727 goto out; 6765 return;
6728 printk(KERN_INFO "\thandle changed from(0x%04x)!!!\n", 6766 printk(KERN_INFO "\thandle changed from(0x%04x)!!!\n",
6729 raid_device->handle); 6767 raid_device->handle);
6730 raid_device->handle = handle; 6768 raid_device->handle = handle;
6731 if (sas_target_priv_data) 6769 if (sas_target_priv_data)
6732 sas_target_priv_data->handle = handle; 6770 sas_target_priv_data->handle = handle;
6733 goto out; 6771 return;
6734 } 6772 }
6735 } 6773 }
6736 out: 6774
6737 spin_unlock_irqrestore(&ioc->raid_device_lock, flags); 6775 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
6738} 6776}
6739 6777
@@ -7418,7 +7456,7 @@ static struct scsi_host_template scsih_driver_template = {
7418 .can_queue = 1, 7456 .can_queue = 1,
7419 .this_id = -1, 7457 .this_id = -1,
7420 .sg_tablesize = MPT2SAS_SG_DEPTH, 7458 .sg_tablesize = MPT2SAS_SG_DEPTH,
7421 .max_sectors = 8192, 7459 .max_sectors = 32767,
7422 .cmd_per_lun = 7, 7460 .cmd_per_lun = 7,
7423 .use_clustering = ENABLE_CLUSTERING, 7461 .use_clustering = ENABLE_CLUSTERING,
7424 .shost_attrs = mpt2sas_host_attrs, 7462 .shost_attrs = mpt2sas_host_attrs,
@@ -7928,6 +7966,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
7928 ioc->tm_tr_volume_cb_idx = tm_tr_volume_cb_idx; 7966 ioc->tm_tr_volume_cb_idx = tm_tr_volume_cb_idx;
7929 ioc->tm_sas_control_cb_idx = tm_sas_control_cb_idx; 7967 ioc->tm_sas_control_cb_idx = tm_sas_control_cb_idx;
7930 ioc->logging_level = logging_level; 7968 ioc->logging_level = logging_level;
7969 ioc->schedule_dead_ioc_flush_running_cmds = &_scsih_flush_running_cmds;
7931 /* misc semaphores and spin locks */ 7970 /* misc semaphores and spin locks */
7932 mutex_init(&ioc->reset_in_progress_mutex); 7971 mutex_init(&ioc->reset_in_progress_mutex);
7933 spin_lock_init(&ioc->ioc_reset_in_progress_lock); 7972 spin_lock_init(&ioc->ioc_reset_in_progress_lock);
@@ -7958,11 +7997,11 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
7958 printk(MPT2SAS_WARN_FMT "Invalid value %d passed " 7997 printk(MPT2SAS_WARN_FMT "Invalid value %d passed "
7959 "for max_sectors, range is 64 to 8192. Assigning " 7998 "for max_sectors, range is 64 to 8192. Assigning "
7960 "value of 64.\n", ioc->name, max_sectors); 7999 "value of 64.\n", ioc->name, max_sectors);
7961 } else if (max_sectors > 8192) { 8000 } else if (max_sectors > 32767) {
7962 shost->max_sectors = 8192; 8001 shost->max_sectors = 32767;
7963 printk(MPT2SAS_WARN_FMT "Invalid value %d passed " 8002 printk(MPT2SAS_WARN_FMT "Invalid value %d passed "
7964 "for max_sectors, range is 64 to 8192. Assigning " 8003 "for max_sectors, range is 64 to 8192. Assigning "
7965 "default value of 8192.\n", ioc->name, 8004 "default value of 32767.\n", ioc->name,
7966 max_sectors); 8005 max_sectors);
7967 } else { 8006 } else {
7968 shost->max_sectors = max_sectors & 0xFFFE; 8007 shost->max_sectors = max_sectors & 0xFFFE;
@@ -8000,7 +8039,6 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
8000 goto out_attach_fail; 8039 goto out_attach_fail;
8001 } 8040 }
8002 8041
8003 scsi_scan_host(shost);
8004 if (ioc->is_warpdrive) { 8042 if (ioc->is_warpdrive) {
8005 if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) 8043 if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS)
8006 ioc->hide_drives = 0; 8044 ioc->hide_drives = 0;
@@ -8014,8 +8052,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
8014 } 8052 }
8015 } else 8053 } else
8016 ioc->hide_drives = 0; 8054 ioc->hide_drives = 0;
8055 scsi_scan_host(shost);
8017 8056
8018 _scsih_probe_devices(ioc);
8019 return 0; 8057 return 0;
8020 8058
8021 out_attach_fail: 8059 out_attach_fail:
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c
index 230732241aa2..831047466a5a 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_transport.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c
@@ -398,8 +398,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc,
398 dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "report_manufacture - " 398 dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "report_manufacture - "
399 "send to sas_addr(0x%016llx)\n", ioc->name, 399 "send to sas_addr(0x%016llx)\n", ioc->name,
400 (unsigned long long)sas_address)); 400 (unsigned long long)sas_address));
401 mpt2sas_base_put_smid_default(ioc, smid);
402 init_completion(&ioc->transport_cmds.done); 401 init_completion(&ioc->transport_cmds.done);
402 mpt2sas_base_put_smid_default(ioc, smid);
403 timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, 403 timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done,
404 10*HZ); 404 10*HZ);
405 405
@@ -1184,8 +1184,8 @@ _transport_get_expander_phy_error_log(struct MPT2SAS_ADAPTER *ioc,
1184 dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "phy_error_log - " 1184 dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "phy_error_log - "
1185 "send to sas_addr(0x%016llx), phy(%d)\n", ioc->name, 1185 "send to sas_addr(0x%016llx), phy(%d)\n", ioc->name,
1186 (unsigned long long)phy->identify.sas_address, phy->number)); 1186 (unsigned long long)phy->identify.sas_address, phy->number));
1187 mpt2sas_base_put_smid_default(ioc, smid);
1188 init_completion(&ioc->transport_cmds.done); 1187 init_completion(&ioc->transport_cmds.done);
1188 mpt2sas_base_put_smid_default(ioc, smid);
1189 timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, 1189 timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done,
1190 10*HZ); 1190 10*HZ);
1191 1191
@@ -1509,8 +1509,9 @@ _transport_expander_phy_control(struct MPT2SAS_ADAPTER *ioc,
1509 "send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", ioc->name, 1509 "send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", ioc->name,
1510 (unsigned long long)phy->identify.sas_address, phy->number, 1510 (unsigned long long)phy->identify.sas_address, phy->number,
1511 phy_operation)); 1511 phy_operation));
1512 mpt2sas_base_put_smid_default(ioc, smid); 1512
1513 init_completion(&ioc->transport_cmds.done); 1513 init_completion(&ioc->transport_cmds.done);
1514 mpt2sas_base_put_smid_default(ioc, smid);
1514 timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, 1515 timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done,
1515 10*HZ); 1516 10*HZ);
1516 1517
@@ -1949,8 +1950,8 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1949 dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "%s - " 1950 dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "%s - "
1950 "sending smp request\n", ioc->name, __func__)); 1951 "sending smp request\n", ioc->name, __func__));
1951 1952
1952 mpt2sas_base_put_smid_default(ioc, smid);
1953 init_completion(&ioc->transport_cmds.done); 1953 init_completion(&ioc->transport_cmds.done);
1954 mpt2sas_base_put_smid_default(ioc, smid);
1954 timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, 1955 timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done,
1955 10*HZ); 1956 10*HZ);
1956 1957