aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_scsih.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_scsih.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c143
1 files changed, 129 insertions, 14 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index c6bdc9267229..51004768d0f5 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -101,6 +101,10 @@ static 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 32767 default=32767"); 102MODULE_PARM_DESC(max_sectors, "max sectors, range 64 to 32767 default=32767");
103 103
104static int missing_delay[2] = {-1, -1};
105module_param_array(missing_delay, int, NULL, 0);
106MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay");
107
104/* scsi-mid layer global parmeter is max_report_luns, which is 511 */ 108/* scsi-mid layer global parmeter is max_report_luns, which is 511 */
105#define MPT2SAS_MAX_LUN (16895) 109#define MPT2SAS_MAX_LUN (16895)
106static int max_lun = MPT2SAS_MAX_LUN; 110static int max_lun = MPT2SAS_MAX_LUN;
@@ -3994,11 +3998,7 @@ _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
3994 else 3998 else
3995 mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ; 3999 mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
3996 } else 4000 } else
3997/* MPI Revision I (UNIT = 0xA) - removed MPI2_SCSIIO_CONTROL_UNTAGGED */ 4001 mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
3998/* mpi_control |= MPI2_SCSIIO_CONTROL_UNTAGGED;
3999 */
4000 mpi_control |= (0x500);
4001
4002 } else 4002 } else
4003 mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ; 4003 mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
4004 /* Make sure Device is not raid volume. 4004 /* Make sure Device is not raid volume.
@@ -5815,9 +5815,10 @@ _scsih_sas_broadcast_primitive_event(struct MPT2SAS_ADAPTER *ioc,
5815 u8 task_abort_retries; 5815 u8 task_abort_retries;
5816 5816
5817 mutex_lock(&ioc->tm_cmds.mutex); 5817 mutex_lock(&ioc->tm_cmds.mutex);
5818 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter: phy number(%d), " 5818 pr_info(MPT2SAS_FMT
5819 "width(%d)\n", ioc->name, __func__, event_data->PhyNum, 5819 "%s: enter: phy number(%d), width(%d)\n",
5820 event_data->PortWidth)); 5820 ioc->name, __func__, event_data->PhyNum,
5821 event_data->PortWidth);
5821 5822
5822 _scsih_block_io_all_device(ioc); 5823 _scsih_block_io_all_device(ioc);
5823 5824
@@ -7093,12 +7094,15 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7093 struct _sas_device *sas_device; 7094 struct _sas_device *sas_device;
7094 struct _sas_node *expander_device; 7095 struct _sas_node *expander_device;
7095 static struct _raid_device *raid_device; 7096 static struct _raid_device *raid_device;
7097 u8 retry_count;
7096 unsigned long flags; 7098 unsigned long flags;
7097 7099
7098 printk(MPT2SAS_INFO_FMT "scan devices: start\n", ioc->name); 7100 printk(MPT2SAS_INFO_FMT "scan devices: start\n", ioc->name);
7099 7101
7100 _scsih_sas_host_refresh(ioc); 7102 _scsih_sas_host_refresh(ioc);
7101 7103
7104 printk(MPT2SAS_INFO_FMT "\tscan devices: expanders start\n",
7105 ioc->name);
7102 /* expanders */ 7106 /* expanders */
7103 handle = 0xFFFF; 7107 handle = 0xFFFF;
7104 while (!(mpt2sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0, 7108 while (!(mpt2sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0,
@@ -7107,6 +7111,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7107 MPI2_IOCSTATUS_MASK; 7111 MPI2_IOCSTATUS_MASK;
7108 if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) 7112 if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
7109 break; 7113 break;
7114 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7115 printk(MPT2SAS_INFO_FMT "\tbreak from expander scan: "
7116 "ioc_status(0x%04x), loginfo(0x%08x)\n",
7117 ioc->name, ioc_status,
7118 le32_to_cpu(mpi_reply.IOCLogInfo));
7119 break;
7120 }
7110 handle = le16_to_cpu(expander_pg0.DevHandle); 7121 handle = le16_to_cpu(expander_pg0.DevHandle);
7111 spin_lock_irqsave(&ioc->sas_node_lock, flags); 7122 spin_lock_irqsave(&ioc->sas_node_lock, flags);
7112 expander_device = mpt2sas_scsih_expander_find_by_sas_address( 7123 expander_device = mpt2sas_scsih_expander_find_by_sas_address(
@@ -7115,13 +7126,26 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7115 if (expander_device) 7126 if (expander_device)
7116 _scsih_refresh_expander_links(ioc, expander_device, 7127 _scsih_refresh_expander_links(ioc, expander_device,
7117 handle); 7128 handle);
7118 else 7129 else {
7130 printk(MPT2SAS_INFO_FMT "\tBEFORE adding expander: "
7131 "handle (0x%04x), sas_addr(0x%016llx)\n",
7132 ioc->name, handle, (unsigned long long)
7133 le64_to_cpu(expander_pg0.SASAddress));
7119 _scsih_expander_add(ioc, handle); 7134 _scsih_expander_add(ioc, handle);
7135 printk(MPT2SAS_INFO_FMT "\tAFTER adding expander: "
7136 "handle (0x%04x), sas_addr(0x%016llx)\n",
7137 ioc->name, handle, (unsigned long long)
7138 le64_to_cpu(expander_pg0.SASAddress));
7139 }
7120 } 7140 }
7121 7141
7142 printk(MPT2SAS_INFO_FMT "\tscan devices: expanders complete\n",
7143 ioc->name);
7144
7122 if (!ioc->ir_firmware) 7145 if (!ioc->ir_firmware)
7123 goto skip_to_sas; 7146 goto skip_to_sas;
7124 7147
7148 printk(MPT2SAS_INFO_FMT "\tscan devices phys disk start\n", ioc->name);
7125 /* phys disk */ 7149 /* phys disk */
7126 phys_disk_num = 0xFF; 7150 phys_disk_num = 0xFF;
7127 while (!(mpt2sas_config_get_phys_disk_pg0(ioc, &mpi_reply, 7151 while (!(mpt2sas_config_get_phys_disk_pg0(ioc, &mpi_reply,
@@ -7131,6 +7155,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7131 MPI2_IOCSTATUS_MASK; 7155 MPI2_IOCSTATUS_MASK;
7132 if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) 7156 if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
7133 break; 7157 break;
7158 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7159 printk(MPT2SAS_INFO_FMT "\tbreak from phys disk scan:"
7160 "ioc_status(0x%04x), loginfo(0x%08x)\n",
7161 ioc->name, ioc_status,
7162 le32_to_cpu(mpi_reply.IOCLogInfo));
7163 break;
7164 }
7134 phys_disk_num = pd_pg0.PhysDiskNum; 7165 phys_disk_num = pd_pg0.PhysDiskNum;
7135 handle = le16_to_cpu(pd_pg0.DevHandle); 7166 handle = le16_to_cpu(pd_pg0.DevHandle);
7136 spin_lock_irqsave(&ioc->sas_device_lock, flags); 7167 spin_lock_irqsave(&ioc->sas_device_lock, flags);
@@ -7142,17 +7173,46 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7142 &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, 7173 &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
7143 handle) != 0) 7174 handle) != 0)
7144 continue; 7175 continue;
7176 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
7177 MPI2_IOCSTATUS_MASK;
7178 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7179 printk(MPT2SAS_INFO_FMT "\tbreak from phys disk scan "
7180 "ioc_status(0x%04x), loginfo(0x%08x)\n",
7181 ioc->name, ioc_status,
7182 le32_to_cpu(mpi_reply.IOCLogInfo));
7183 break;
7184 }
7145 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); 7185 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
7146 if (!_scsih_get_sas_address(ioc, parent_handle, 7186 if (!_scsih_get_sas_address(ioc, parent_handle,
7147 &sas_address)) { 7187 &sas_address)) {
7188 printk(MPT2SAS_INFO_FMT "\tBEFORE adding phys disk: "
7189 " handle (0x%04x), sas_addr(0x%016llx)\n",
7190 ioc->name, handle, (unsigned long long)
7191 le64_to_cpu(sas_device_pg0.SASAddress));
7148 mpt2sas_transport_update_links(ioc, sas_address, 7192 mpt2sas_transport_update_links(ioc, sas_address,
7149 handle, sas_device_pg0.PhyNum, 7193 handle, sas_device_pg0.PhyNum,
7150 MPI2_SAS_NEG_LINK_RATE_1_5); 7194 MPI2_SAS_NEG_LINK_RATE_1_5);
7151 set_bit(handle, ioc->pd_handles); 7195 set_bit(handle, ioc->pd_handles);
7152 _scsih_add_device(ioc, handle, 0, 1); 7196 retry_count = 0;
7197 /* This will retry adding the end device.
7198 * _scsih_add_device() will decide on retries and
7199 * return "1" when it should be retried
7200 */
7201 while (_scsih_add_device(ioc, handle, retry_count++,
7202 1)) {
7203 ssleep(1);
7204 }
7205 printk(MPT2SAS_INFO_FMT "\tAFTER adding phys disk: "
7206 " handle (0x%04x), sas_addr(0x%016llx)\n",
7207 ioc->name, handle, (unsigned long long)
7208 le64_to_cpu(sas_device_pg0.SASAddress));
7153 } 7209 }
7154 } 7210 }
7155 7211
7212 printk(MPT2SAS_INFO_FMT "\tscan devices: phys disk complete\n",
7213 ioc->name);
7214
7215 printk(MPT2SAS_INFO_FMT "\tscan devices: volumes start\n", ioc->name);
7156 /* volumes */ 7216 /* volumes */
7157 handle = 0xFFFF; 7217 handle = 0xFFFF;
7158 while (!(mpt2sas_config_get_raid_volume_pg1(ioc, &mpi_reply, 7218 while (!(mpt2sas_config_get_raid_volume_pg1(ioc, &mpi_reply,
@@ -7161,6 +7221,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7161 MPI2_IOCSTATUS_MASK; 7221 MPI2_IOCSTATUS_MASK;
7162 if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) 7222 if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
7163 break; 7223 break;
7224 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7225 printk(MPT2SAS_INFO_FMT "\tbreak from volume scan: "
7226 "ioc_status(0x%04x), loginfo(0x%08x)\n",
7227 ioc->name, ioc_status,
7228 le32_to_cpu(mpi_reply.IOCLogInfo));
7229 break;
7230 }
7164 handle = le16_to_cpu(volume_pg1.DevHandle); 7231 handle = le16_to_cpu(volume_pg1.DevHandle);
7165 spin_lock_irqsave(&ioc->raid_device_lock, flags); 7232 spin_lock_irqsave(&ioc->raid_device_lock, flags);
7166 raid_device = _scsih_raid_device_find_by_wwid(ioc, 7233 raid_device = _scsih_raid_device_find_by_wwid(ioc,
@@ -7172,18 +7239,38 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7172 &volume_pg0, MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle, 7239 &volume_pg0, MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,
7173 sizeof(Mpi2RaidVolPage0_t))) 7240 sizeof(Mpi2RaidVolPage0_t)))
7174 continue; 7241 continue;
7242 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
7243 MPI2_IOCSTATUS_MASK;
7244 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7245 printk(MPT2SAS_INFO_FMT "\tbreak from volume scan: "
7246 "ioc_status(0x%04x), loginfo(0x%08x)\n",
7247 ioc->name, ioc_status,
7248 le32_to_cpu(mpi_reply.IOCLogInfo));
7249 break;
7250 }
7175 if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL || 7251 if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL ||
7176 volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_ONLINE || 7252 volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_ONLINE ||
7177 volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_DEGRADED) { 7253 volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_DEGRADED) {
7178 memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t)); 7254 memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t));
7179 element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED; 7255 element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED;
7180 element.VolDevHandle = volume_pg1.DevHandle; 7256 element.VolDevHandle = volume_pg1.DevHandle;
7257 printk(MPT2SAS_INFO_FMT "\tBEFORE adding volume: "
7258 " handle (0x%04x)\n", ioc->name,
7259 volume_pg1.DevHandle);
7181 _scsih_sas_volume_add(ioc, &element); 7260 _scsih_sas_volume_add(ioc, &element);
7261 printk(MPT2SAS_INFO_FMT "\tAFTER adding volume: "
7262 " handle (0x%04x)\n", ioc->name,
7263 volume_pg1.DevHandle);
7182 } 7264 }
7183 } 7265 }
7184 7266
7267 printk(MPT2SAS_INFO_FMT "\tscan devices: volumes complete\n",
7268 ioc->name);
7269
7185 skip_to_sas: 7270 skip_to_sas:
7186 7271
7272 printk(MPT2SAS_INFO_FMT "\tscan devices: end devices start\n",
7273 ioc->name);
7187 /* sas devices */ 7274 /* sas devices */
7188 handle = 0xFFFF; 7275 handle = 0xFFFF;
7189 while (!(mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, 7276 while (!(mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply,
@@ -7193,6 +7280,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7193 MPI2_IOCSTATUS_MASK; 7280 MPI2_IOCSTATUS_MASK;
7194 if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) 7281 if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
7195 break; 7282 break;
7283 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7284 printk(MPT2SAS_INFO_FMT "\tbreak from end device scan:"
7285 " ioc_status(0x%04x), loginfo(0x%08x)\n",
7286 ioc->name, ioc_status,
7287 le32_to_cpu(mpi_reply.IOCLogInfo));
7288 break;
7289 }
7196 handle = le16_to_cpu(sas_device_pg0.DevHandle); 7290 handle = le16_to_cpu(sas_device_pg0.DevHandle);
7197 if (!(_scsih_is_end_device( 7291 if (!(_scsih_is_end_device(
7198 le32_to_cpu(sas_device_pg0.DeviceInfo)))) 7292 le32_to_cpu(sas_device_pg0.DeviceInfo))))
@@ -7205,12 +7299,31 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
7205 continue; 7299 continue;
7206 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); 7300 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
7207 if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) { 7301 if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) {
7302 printk(MPT2SAS_INFO_FMT "\tBEFORE adding end device: "
7303 "handle (0x%04x), sas_addr(0x%016llx)\n",
7304 ioc->name, handle, (unsigned long long)
7305 le64_to_cpu(sas_device_pg0.SASAddress));
7208 mpt2sas_transport_update_links(ioc, sas_address, handle, 7306 mpt2sas_transport_update_links(ioc, sas_address, handle,
7209 sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); 7307 sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
7210 _scsih_add_device(ioc, handle, 0, 0); 7308 retry_count = 0;
7309 /* This will retry adding the end device.
7310 * _scsih_add_device() will decide on retries and
7311 * return "1" when it should be retried
7312 */
7313 while (_scsih_add_device(ioc, handle, retry_count++,
7314 0)) {
7315 ssleep(1);
7316 }
7317 printk(MPT2SAS_INFO_FMT "\tAFTER adding end device: "
7318 "handle (0x%04x), sas_addr(0x%016llx)\n",
7319 ioc->name, handle, (unsigned long long)
7320 le64_to_cpu(sas_device_pg0.SASAddress));
7211 } 7321 }
7212 } 7322 }
7213 7323
7324 printk(MPT2SAS_INFO_FMT "\tscan devices: end devices complete\n",
7325 ioc->name);
7326
7214 printk(MPT2SAS_INFO_FMT "scan devices: complete\n", ioc->name); 7327 printk(MPT2SAS_INFO_FMT "scan devices: complete\n", ioc->name);
7215} 7328}
7216 7329
@@ -7303,7 +7416,9 @@ _firmware_event_work(struct work_struct *work)
7303 case MPT2SAS_PORT_ENABLE_COMPLETE: 7416 case MPT2SAS_PORT_ENABLE_COMPLETE:
7304 ioc->start_scan = 0; 7417 ioc->start_scan = 0;
7305 7418
7306 7419 if (missing_delay[0] != -1 && missing_delay[1] != -1)
7420 mpt2sas_base_update_missing_delay(ioc, missing_delay[0],
7421 missing_delay[1]);
7307 7422
7308 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "port enable: complete " 7423 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "port enable: complete "
7309 "from worker thread\n", ioc->name)); 7424 "from worker thread\n", ioc->name));
@@ -8070,8 +8185,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
8070 if (max_sectors != 0xFFFF) { 8185 if (max_sectors != 0xFFFF) {
8071 if (max_sectors < 64) { 8186 if (max_sectors < 64) {
8072 shost->max_sectors = 64; 8187 shost->max_sectors = 64;
8073 printk(MPT2SAS_WARN_FMT "Invalid value %d passed "\ 8188 printk(MPT2SAS_WARN_FMT "Invalid value %d passed "
8074 "for max_sectors, range is 64 to 32767. Assigning "\ 8189 "for max_sectors, range is 64 to 32767. Assigning "
8075 "value of 64.\n", ioc->name, max_sectors); 8190 "value of 64.\n", ioc->name, max_sectors);
8076 } else if (max_sectors > 32767) { 8191 } else if (max_sectors > 32767) {
8077 shost->max_sectors = 32767; 8192 shost->max_sectors = 32767;