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.c90
1 files changed, 64 insertions, 26 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 918445e1e65f..22a95421e367 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -4258,12 +4258,6 @@ _scsih_sas_volume_add(struct MPT2SAS_ADAPTER *ioc,
4258 u16 handle = le16_to_cpu(element->VolDevHandle); 4258 u16 handle = le16_to_cpu(element->VolDevHandle);
4259 int rc; 4259 int rc;
4260 4260
4261#if 0 /* RAID_HACKS */
4262 if (le32_to_cpu(event_data->Flags) &
4263 MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG)
4264 return;
4265#endif
4266
4267 mpt2sas_config_get_volume_wwid(ioc, handle, &wwid); 4261 mpt2sas_config_get_volume_wwid(ioc, handle, &wwid);
4268 if (!wwid) { 4262 if (!wwid) {
4269 printk(MPT2SAS_ERR_FMT 4263 printk(MPT2SAS_ERR_FMT
@@ -4318,12 +4312,6 @@ _scsih_sas_volume_delete(struct MPT2SAS_ADAPTER *ioc,
4318 unsigned long flags; 4312 unsigned long flags;
4319 struct MPT2SAS_TARGET *sas_target_priv_data; 4313 struct MPT2SAS_TARGET *sas_target_priv_data;
4320 4314
4321#if 0 /* RAID_HACKS */
4322 if (le32_to_cpu(event_data->Flags) &
4323 MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG)
4324 return;
4325#endif
4326
4327 spin_lock_irqsave(&ioc->raid_device_lock, flags); 4315 spin_lock_irqsave(&ioc->raid_device_lock, flags);
4328 raid_device = _scsih_raid_device_find_by_handle(ioc, handle); 4316 raid_device = _scsih_raid_device_find_by_handle(ioc, handle);
4329 spin_unlock_irqrestore(&ioc->raid_device_lock, flags); 4317 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
@@ -4436,14 +4424,38 @@ _scsih_sas_pd_add(struct MPT2SAS_ADAPTER *ioc,
4436 struct _sas_device *sas_device; 4424 struct _sas_device *sas_device;
4437 unsigned long flags; 4425 unsigned long flags;
4438 u16 handle = le16_to_cpu(element->PhysDiskDevHandle); 4426 u16 handle = le16_to_cpu(element->PhysDiskDevHandle);
4427 Mpi2ConfigReply_t mpi_reply;
4428 Mpi2SasDevicePage0_t sas_device_pg0;
4429 u32 ioc_status;
4439 4430
4440 spin_lock_irqsave(&ioc->sas_device_lock, flags); 4431 spin_lock_irqsave(&ioc->sas_device_lock, flags);
4441 sas_device = _scsih_sas_device_find_by_handle(ioc, handle); 4432 sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
4442 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 4433 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
4443 if (sas_device) 4434 if (sas_device) {
4444 sas_device->hidden_raid_component = 1; 4435 sas_device->hidden_raid_component = 1;
4445 else 4436 return;
4446 _scsih_add_device(ioc, handle, 0, 1); 4437 }
4438
4439 if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
4440 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
4441 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
4442 ioc->name, __FILE__, __LINE__, __func__);
4443 return;
4444 }
4445
4446 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
4447 MPI2_IOCSTATUS_MASK;
4448 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
4449 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
4450 ioc->name, __FILE__, __LINE__, __func__);
4451 return;
4452 }
4453
4454 _scsih_link_change(ioc,
4455 le16_to_cpu(sas_device_pg0.ParentDevHandle),
4456 handle, sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
4457
4458 _scsih_add_device(ioc, handle, 0, 1);
4447} 4459}
4448 4460
4449#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4461#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
@@ -4543,12 +4555,15 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4543{ 4555{
4544 Mpi2EventIrConfigElement_t *element; 4556 Mpi2EventIrConfigElement_t *element;
4545 int i; 4557 int i;
4558 u8 foreign_config;
4546 4559
4547#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4560#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
4548 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) 4561 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
4549 _scsih_sas_ir_config_change_event_debug(ioc, event_data); 4562 _scsih_sas_ir_config_change_event_debug(ioc, event_data);
4550 4563
4551#endif 4564#endif
4565 foreign_config = (le32_to_cpu(event_data->Flags) &
4566 MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ? 1 : 0;
4552 4567
4553 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0]; 4568 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
4554 for (i = 0; i < event_data->NumElements; i++, element++) { 4569 for (i = 0; i < event_data->NumElements; i++, element++) {
@@ -4556,11 +4571,13 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4556 switch (element->ReasonCode) { 4571 switch (element->ReasonCode) {
4557 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED: 4572 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED:
4558 case MPI2_EVENT_IR_CHANGE_RC_ADDED: 4573 case MPI2_EVENT_IR_CHANGE_RC_ADDED:
4559 _scsih_sas_volume_add(ioc, element); 4574 if (!foreign_config)
4575 _scsih_sas_volume_add(ioc, element);
4560 break; 4576 break;
4561 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_DELETED: 4577 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_DELETED:
4562 case MPI2_EVENT_IR_CHANGE_RC_REMOVED: 4578 case MPI2_EVENT_IR_CHANGE_RC_REMOVED:
4563 _scsih_sas_volume_delete(ioc, element); 4579 if (!foreign_config)
4580 _scsih_sas_volume_delete(ioc, element);
4564 break; 4581 break;
4565 case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED: 4582 case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED:
4566 _scsih_sas_pd_hide(ioc, element); 4583 _scsih_sas_pd_hide(ioc, element);
@@ -4679,6 +4696,9 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4679 u32 state; 4696 u32 state;
4680 struct _sas_device *sas_device; 4697 struct _sas_device *sas_device;
4681 unsigned long flags; 4698 unsigned long flags;
4699 Mpi2ConfigReply_t mpi_reply;
4700 Mpi2SasDevicePage0_t sas_device_pg0;
4701 u32 ioc_status;
4682 4702
4683 if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED) 4703 if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED)
4684 return; 4704 return;
@@ -4695,22 +4715,40 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4695 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 4715 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
4696 4716
4697 switch (state) { 4717 switch (state) {
4698#if 0
4699 case MPI2_RAID_PD_STATE_OFFLINE:
4700 if (sas_device)
4701 _scsih_remove_device(ioc, handle);
4702 break;
4703#endif
4704 case MPI2_RAID_PD_STATE_ONLINE: 4718 case MPI2_RAID_PD_STATE_ONLINE:
4705 case MPI2_RAID_PD_STATE_DEGRADED: 4719 case MPI2_RAID_PD_STATE_DEGRADED:
4706 case MPI2_RAID_PD_STATE_REBUILDING: 4720 case MPI2_RAID_PD_STATE_REBUILDING:
4707 case MPI2_RAID_PD_STATE_OPTIMAL: 4721 case MPI2_RAID_PD_STATE_OPTIMAL:
4708 if (sas_device) 4722 if (sas_device) {
4709 sas_device->hidden_raid_component = 1; 4723 sas_device->hidden_raid_component = 1;
4710 else 4724 return;
4711 _scsih_add_device(ioc, handle, 0, 1); 4725 }
4726
4727 if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply,
4728 &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
4729 handle))) {
4730 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
4731 ioc->name, __FILE__, __LINE__, __func__);
4732 return;
4733 }
4734
4735 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
4736 MPI2_IOCSTATUS_MASK;
4737 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
4738 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
4739 ioc->name, __FILE__, __LINE__, __func__);
4740 return;
4741 }
4742
4743 _scsih_link_change(ioc,
4744 le16_to_cpu(sas_device_pg0.ParentDevHandle),
4745 handle, sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
4746
4747 _scsih_add_device(ioc, handle, 0, 1);
4748
4712 break; 4749 break;
4713 4750
4751 case MPI2_RAID_PD_STATE_OFFLINE:
4714 case MPI2_RAID_PD_STATE_NOT_CONFIGURED: 4752 case MPI2_RAID_PD_STATE_NOT_CONFIGURED:
4715 case MPI2_RAID_PD_STATE_NOT_COMPATIBLE: 4753 case MPI2_RAID_PD_STATE_NOT_COMPATIBLE:
4716 case MPI2_RAID_PD_STATE_HOT_SPARE: 4754 case MPI2_RAID_PD_STATE_HOT_SPARE: