Commit 1ca1e43e authored by Dave Jiang's avatar Dave Jiang Committed by James Bottomley

[SCSI] libsas: Add option for SATA soft reset

This allows a libsas driver to optionally provide a soft reset handler
for libata to drive.  The isci driver allows software to control the
assertion/deassertion of SRST.

[jejb: checkpatch.pl fixes]
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarJames Bottomley <jbottomley@parallels.com>
parent 3673f4bf
...@@ -295,6 +295,44 @@ static int sas_ata_hard_reset(struct ata_link *link, unsigned int *class, ...@@ -295,6 +295,44 @@ static int sas_ata_hard_reset(struct ata_link *link, unsigned int *class,
return ret; return ret;
} }
static int sas_ata_soft_reset(struct ata_link *link, unsigned int *class,
unsigned long deadline)
{
struct ata_port *ap = link->ap;
struct domain_device *dev = ap->private_data;
struct sas_internal *i =
to_sas_internal(dev->port->ha->core.shost->transportt);
int res = TMF_RESP_FUNC_FAILED;
int ret = 0;
if (i->dft->lldd_ata_soft_reset)
res = i->dft->lldd_ata_soft_reset(dev);
if (res != TMF_RESP_FUNC_COMPLETE) {
SAS_DPRINTK("%s: Unable to soft reset\n", __func__);
ret = -EAGAIN;
}
switch (dev->sata_dev.command_set) {
case ATA_COMMAND_SET:
SAS_DPRINTK("%s: Found ATA device.\n", __func__);
*class = ATA_DEV_ATA;
break;
case ATAPI_COMMAND_SET:
SAS_DPRINTK("%s: Found ATAPI device.\n", __func__);
*class = ATA_DEV_ATAPI;
break;
default:
SAS_DPRINTK("%s: Unknown SATA command set: %d.\n",
__func__, dev->sata_dev.command_set);
*class = ATA_DEV_UNKNOWN;
break;
}
ap->cbl = ATA_CBL_SATA;
return ret;
}
static void sas_ata_post_internal(struct ata_queued_cmd *qc) static void sas_ata_post_internal(struct ata_queued_cmd *qc)
{ {
if (qc->flags & ATA_QCFLAG_FAILED) if (qc->flags & ATA_QCFLAG_FAILED)
...@@ -325,7 +363,7 @@ static void sas_ata_post_internal(struct ata_queued_cmd *qc) ...@@ -325,7 +363,7 @@ static void sas_ata_post_internal(struct ata_queued_cmd *qc)
static struct ata_port_operations sas_sata_ops = { static struct ata_port_operations sas_sata_ops = {
.prereset = ata_std_prereset, .prereset = ata_std_prereset,
.softreset = NULL, .softreset = sas_ata_soft_reset,
.hardreset = sas_ata_hard_reset, .hardreset = sas_ata_hard_reset,
.postreset = ata_std_postreset, .postreset = ata_std_postreset,
.error_handler = ata_std_error_handler, .error_handler = ata_std_error_handler,
......
...@@ -604,6 +604,7 @@ struct sas_domain_function_template { ...@@ -604,6 +604,7 @@ struct sas_domain_function_template {
int (*lldd_clear_aca)(struct domain_device *, u8 *lun); int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
int (*lldd_I_T_nexus_reset)(struct domain_device *); int (*lldd_I_T_nexus_reset)(struct domain_device *);
int (*lldd_ata_soft_reset)(struct domain_device *);
int (*lldd_lu_reset)(struct domain_device *, u8 *lun); int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
int (*lldd_query_task)(struct sas_task *); int (*lldd_query_task)(struct sas_task *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment