[SCSI] libsas: fix ATAPI check condition termination
authorJames Bottomley <James.Bottomley@suse.de>
Sun, 23 Jan 2011 14:16:24 +0000 (08:16 -0600)
committerJames Bottomley <James.Bottomley@suse.de>
Mon, 24 Jan 2011 18:05:22 +0000 (12:05 -0600)
ATAPI check condition needs to be treated the same as a success or
protocol return.  The register returns from the PACKET command are all
correctly positioned in the device to host register FIS and so we
should collect them properly.  Right at the moment this doesn't matter
because libata sends a request sense always for ATAPI errors, but if
it ever checked the registers, we should have the correct contents
just in case.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/libsas/sas_ata.c

index e1a395b438eeddfef4e266aedfce0aa3edbe9c5b..4a6e203861d2eae8c04b5ec5487399675a59c91e 100644 (file)
@@ -71,13 +71,13 @@ static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts)
                case SAS_SG_ERR:
                        return AC_ERR_INVALID;
 
-               case SAM_STAT_CHECK_CONDITION:
                case SAS_OPEN_TO:
                case SAS_OPEN_REJECT:
                        SAS_DPRINTK("%s: Saw error %d.  What to do?\n",
                                    __func__, ts->stat);
                        return AC_ERR_OTHER;
 
+               case SAM_STAT_CHECK_CONDITION:
                case SAS_ABORTED_TASK:
                        return AC_ERR_DEV;
 
@@ -107,13 +107,15 @@ static void sas_ata_task_done(struct sas_task *task)
        sas_ha = dev->port->ha;
 
        spin_lock_irqsave(dev->sata_dev.ap->lock, flags);
-       if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD) {
+       if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD ||
+           ((stat->stat == SAM_STAT_CHECK_CONDITION &&
+             dev->sata_dev.command_set == ATAPI_COMMAND_SET))) {
                ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf);
                qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command);
                dev->sata_dev.sstatus = resp->sstatus;
                dev->sata_dev.serror = resp->serror;
                dev->sata_dev.scontrol = resp->scontrol;
-       } else if (stat->stat != SAM_STAT_GOOD) {
+       } else {
                ac = sas_to_ata_err(stat);
                if (ac) {
                        SAS_DPRINTK("%s: SAS error %x\n", __func__,