]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] libsas: fixup NCQ for SATA disks
authorJames Bottomley <James.Bottomley@steeleye.com>
Mon, 16 Oct 2006 18:25:30 +0000 (13:25 -0500)
committerJames Bottomley <jejb@mulgrave.localdomain>
Wed, 18 Jul 2007 16:14:33 +0000 (11:14 -0500)
We actually had two problems: the one with the tag (which is fixed by
zeroing the tag before sending the taskfile to the sequencer) but the
other with the fact that we sent our first NCQ command to the device
before the sequencer had been informed of the NCQ tagging
capabilities.  I fixed the latter by moving the rphy_add() to the
correct point in the code after the NCQ capabilities are set up.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/aic94xx/aic94xx_task.c
drivers/scsi/libsas/sas_discover.c
drivers/scsi/libsas/sas_scsi_host.c

index e2ad5bed94035c0dd594c237e0c59a8dba3dd1c1..9b65abec2f6effbfd5fb26ab27c4214d6cec62f6 100644 (file)
@@ -391,7 +391,6 @@ static int asd_build_ata_ascb(struct asd_ascb *ascb, struct sas_task *task,
 
        scb->ata_task.total_xfer_len = cpu_to_le32(task->total_xfer_len);
        scb->ata_task.fis = task->ata_task.fis;
-       scb->ata_task.fis.fis_type = 0x27;
        if (likely(!task->ata_task.device_control_reg_update))
                scb->ata_task.fis.flags |= 0x80; /* C=1: update ATA cmd reg */
        scb->ata_task.fis.flags &= 0xF0; /* PM_PORT field shall be 0 */
index 5252143b6297800873afb40876c95c79a843aae0..a18c0f6d66682aa612e4357736503cdd92b96f56 100644 (file)
@@ -371,6 +371,7 @@ static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
 
        task->dev = dev;
 
+       task->ata_task.fis.fis_type = 0x27;
        task->ata_task.fis.command = command;
        task->ata_task.fis.features = features;
        task->ata_task.fis.device = d2h_fis->device;
@@ -483,11 +484,7 @@ cont1:
 
        sas_fill_in_rphy(dev, dev->rphy);
 
-       res = sas_rphy_add(dev->rphy);
-       if (res)
-               goto out_err;
-
-       return res;
+       return 0;
 out_err:
        dev->sata_dev.identify_packet_device = NULL;
        dev->sata_dev.identify_device = NULL;
@@ -555,7 +552,7 @@ int sas_discover_sata(struct domain_device *dev)
 
        res = sas_notify_lldd_dev_found(dev);
        if (res)
-               goto out_err2;
+               return res;
 
        switch (dev->dev_type) {
        case SATA_DEV:
@@ -567,23 +564,12 @@ int sas_discover_sata(struct domain_device *dev)
        default:
                break;
        }
-       if (res)
-               goto out_err;
-
        sas_notify_lldd_dev_gone(dev);
-       res = sas_notify_lldd_dev_found(dev);
-       if (res)
-               goto out_err2;
-
-       res = sas_rphy_add(dev->rphy);
-       if (res)
-               goto out_err;
-
-       return res;
+       if (!res) {
+               sas_notify_lldd_dev_found(dev);
+               res = sas_rphy_add(dev->rphy);
+       }
 
-out_err:
-       sas_notify_lldd_dev_gone(dev);
-out_err2:
        return res;
 }
 
index 5ff14ed9baf6d62ab699f01b2a5d3b6b76b667c0..0dc7c02b38374f0f2d23096b5338794dbcdcd135 100644 (file)
@@ -812,6 +812,12 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
        task->task_proto = SAS_PROTOCOL_STP;
        task->task_done = sas_ata_task_done;
 
+       if (qc->tf.command == ATA_CMD_FPDMA_WRITE ||
+           qc->tf.command == ATA_CMD_FPDMA_READ) {
+               /* Need to zero out the tag libata assigned us */
+               qc->tf.nsect = 0;
+       }
+
        ata_tf_to_fis(&qc->tf, (u8*)&task->ata_task.fis, 0);
        task->uldd_task = qc;
        if (is_atapi_taskfile(&qc->tf)) {