summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_init.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2012-01-11 13:13:44 -0800
committerJames Bottomley <JBottomley@Parallels.com>2012-02-29 15:25:32 -0600
commitab5266335ba1a43461443f9823276a2b44dd1ba7 (patch)
tree5ab3c7e21f27e0ecacb01117764d911c349b51c9 /drivers/scsi/libsas/sas_init.c
parentd230ce691c7712c4f56ba3378d6d2f44628a49f1 (diff)
[SCSI] libsas: route local link resets through ata-eh
Similar to the conversion of the transport-class reset we want bsg initiated resets to be managed by libata. Reported-by: Jacek Danecki <jacek.danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/libsas/sas_init.c')
-rw-r--r--drivers/scsi/libsas/sas_init.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index cf1b532b0e7..dc93e118146 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -196,6 +196,27 @@ static int sas_get_linkerrors(struct sas_phy *phy)
return sas_smp_get_phy_events(phy);
}
+int sas_try_ata_reset(struct asd_sas_phy *asd_phy)
+{
+ struct domain_device *dev = NULL;
+
+ /* try to route user requested link resets through libata */
+ if (asd_phy->port)
+ dev = asd_phy->port->port_dev;
+
+ /* validate that dev has been probed */
+ if (dev)
+ dev = sas_find_dev_by_rphy(dev->rphy);
+
+ if (dev && dev_is_sata(dev)) {
+ sas_ata_schedule_reset(dev);
+ sas_ata_wait_eh(dev);
+ return 0;
+ }
+
+ return -ENODEV;
+}
+
/**
* transport_sas_phy_reset - reset a phy and permit libata to manage the link
*
@@ -204,7 +225,6 @@ static int sas_get_linkerrors(struct sas_phy *phy)
*/
static int transport_sas_phy_reset(struct sas_phy *phy, int hard_reset)
{
- int ret;
enum phy_func reset_type;
if (hard_reset)
@@ -218,21 +238,10 @@ static int transport_sas_phy_reset(struct sas_phy *phy, int hard_reset)
struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
struct sas_internal *i =
to_sas_internal(sas_ha->core.shost->transportt);
- struct domain_device *dev = NULL;
-
- if (asd_phy->port)
- dev = asd_phy->port->port_dev;
-
- /* validate that dev has been probed */
- if (dev)
- dev = sas_find_dev_by_rphy(dev->rphy);
- if (dev && dev_is_sata(dev) && !hard_reset) {
- sas_ata_schedule_reset(dev);
- sas_ata_wait_eh(dev);
- ret = 0;
- } else
- ret = i->dft->lldd_control_phy(asd_phy, reset_type, NULL);
+ if (!hard_reset && sas_try_ata_reset(asd_phy) == 0)
+ return 0;
+ return i->dft->lldd_control_phy(asd_phy, reset_type, NULL);
} else {
struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
struct domain_device *ddev = sas_find_dev_by_rphy(rphy);
@@ -241,12 +250,10 @@ static int transport_sas_phy_reset(struct sas_phy *phy, int hard_reset)
if (ata_dev && !hard_reset) {
sas_ata_schedule_reset(ata_dev);
sas_ata_wait_eh(ata_dev);
- ret = 0;
+ return 0;
} else
- ret = sas_smp_phy_control(ddev, phy->number, reset_type, NULL);
+ return sas_smp_phy_control(ddev, phy->number, reset_type, NULL);
}
-
- return ret;
}
static int sas_phy_enable(struct sas_phy *phy, int enable)