aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_ata.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 22:01:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 22:01:32 -0400
commit3151367f8778a1789d6f6e6f6c642681b6cd6d64 (patch)
tree1869d5429a25abd994ae94079808b8db060ec6f3 /drivers/scsi/libsas/sas_ata.c
parent16642a2e7be23bbda013fc32d8f6c68982eab603 (diff)
parentfe709ed827d370e6b0c0a9f9456da1c22bdcd118 (diff)
Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull first round of SCSI updates from James Bottomley: "This is a large set of updates, mostly for drivers (qla2xxx [including support for new 83xx based card], qla4xxx, mpt2sas, bfa, zfcp, hpsa, be2iscsi, isci, lpfc, ipr, ibmvfc, ibmvscsi, megaraid_sas). There's also a rework for tape adding virtually unlimited numbers of tape drives plus a set of dif fixes for sd and a fix for a live lock on hot remove of SCSI devices. This round includes a signed tag pull of isci-for-3.6 Signed-off-by: James Bottomley <JBottomley@Parallels.com>" Fix up trivial conflict in drivers/scsi/qla2xxx/qla_nx.c due to new PCI helper function use in a function that was removed by this pull. * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (198 commits) [SCSI] st: remove st_mutex [SCSI] sd: Ensure we correctly disable devices with unknown protection type [SCSI] hpsa: gen8plus Smart Array IDs [SCSI] qla4xxx: Update driver version to 5.03.00-k1 [SCSI] qla4xxx: Disable generating pause frames for ISP83XX [SCSI] qla4xxx: Fix double clearing of risc_intr for ISP83XX [SCSI] qla4xxx: IDC implementation for Loopback [SCSI] qla4xxx: update copyrights in LICENSE.qla4xxx [SCSI] qla4xxx: Fix panic while rmmod [SCSI] qla4xxx: Fail probe_adapter if IRQ allocation fails [SCSI] qla4xxx: Prevent MSI/MSI-X falling back to INTx for ISP82XX [SCSI] qla4xxx: Update idc reg in case of PCI AER [SCSI] qla4xxx: Fix double IDC locking in qla4_8xxx_error_recovery [SCSI] qla4xxx: Clear interrupt while unloading driver for ISP83XX [SCSI] qla4xxx: Print correct IDC version [SCSI] qla4xxx: Added new mbox cmd to pass driver version to FW [SCSI] scsi_dh_alua: Enable STPG for unavailable ports [SCSI] scsi_remove_target: fix softlockup regression on hot remove [SCSI] ibmvscsi: Fix host config length field overflow [SCSI] ibmvscsi: Remove backend abstraction ...
Diffstat (limited to 'drivers/scsi/libsas/sas_ata.c')
-rw-r--r--drivers/scsi/libsas/sas_ata.c91
1 files changed, 87 insertions, 4 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index a59fcdc8fd63..bdb81cda8401 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -580,10 +580,7 @@ int sas_ata_init(struct domain_device *found_dev)
580 struct ata_port *ap; 580 struct ata_port *ap;
581 int rc; 581 int rc;
582 582
583 ata_host_init(&found_dev->sata_dev.ata_host, 583 ata_host_init(&found_dev->sata_dev.ata_host, ha->dev, &sas_sata_ops);
584 ha->dev,
585 sata_port_info.flags,
586 &sas_sata_ops);
587 ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host, 584 ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host,
588 &sata_port_info, 585 &sata_port_info,
589 shost); 586 shost);
@@ -700,6 +697,92 @@ void sas_probe_sata(struct asd_sas_port *port)
700 if (ata_dev_disabled(sas_to_ata_dev(dev))) 697 if (ata_dev_disabled(sas_to_ata_dev(dev)))
701 sas_fail_probe(dev, __func__, -ENODEV); 698 sas_fail_probe(dev, __func__, -ENODEV);
702 } 699 }
700
701}
702
703static bool sas_ata_flush_pm_eh(struct asd_sas_port *port, const char *func)
704{
705 struct domain_device *dev, *n;
706 bool retry = false;
707
708 list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) {
709 int rc;
710
711 if (!dev_is_sata(dev))
712 continue;
713
714 sas_ata_wait_eh(dev);
715 rc = dev->sata_dev.pm_result;
716 if (rc == -EAGAIN)
717 retry = true;
718 else if (rc) {
719 /* since we don't have a
720 * ->port_{suspend|resume} routine in our
721 * ata_port ops, and no entanglements with
722 * acpi, suspend should just be mechanical trip
723 * through eh, catch cases where these
724 * assumptions are invalidated
725 */
726 WARN_ONCE(1, "failed %s %s error: %d\n", func,
727 dev_name(&dev->rphy->dev), rc);
728 }
729
730 /* if libata failed to power manage the device, tear it down */
731 if (ata_dev_disabled(sas_to_ata_dev(dev)))
732 sas_fail_probe(dev, func, -ENODEV);
733 }
734
735 return retry;
736}
737
738void sas_suspend_sata(struct asd_sas_port *port)
739{
740 struct domain_device *dev;
741
742 retry:
743 mutex_lock(&port->ha->disco_mutex);
744 list_for_each_entry(dev, &port->dev_list, dev_list_node) {
745 struct sata_device *sata;
746
747 if (!dev_is_sata(dev))
748 continue;
749
750 sata = &dev->sata_dev;
751 if (sata->ap->pm_mesg.event == PM_EVENT_SUSPEND)
752 continue;
753
754 sata->pm_result = -EIO;
755 ata_sas_port_async_suspend(sata->ap, &sata->pm_result);
756 }
757 mutex_unlock(&port->ha->disco_mutex);
758
759 if (sas_ata_flush_pm_eh(port, __func__))
760 goto retry;
761}
762
763void sas_resume_sata(struct asd_sas_port *port)
764{
765 struct domain_device *dev;
766
767 retry:
768 mutex_lock(&port->ha->disco_mutex);
769 list_for_each_entry(dev, &port->dev_list, dev_list_node) {
770 struct sata_device *sata;
771
772 if (!dev_is_sata(dev))
773 continue;
774
775 sata = &dev->sata_dev;
776 if (sata->ap->pm_mesg.event == PM_EVENT_ON)
777 continue;
778
779 sata->pm_result = -EIO;
780 ata_sas_port_async_resume(sata->ap, &sata->pm_result);
781 }
782 mutex_unlock(&port->ha->disco_mutex);
783
784 if (sas_ata_flush_pm_eh(port, __func__))
785 goto retry;
703} 786}
704 787
705/** 788/**