aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2006-10-16 14:25:30 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-18 12:14:33 -0400
commit0281e02c5671f50701924465744edd3e2feb5d6f (patch)
treebd4f8ceeb0d9d3c47a227d495f2d4ac918a24d6e
parent528fd55200ec135548e71aee43650bca92a041aa (diff)
[SCSI] libsas: fixup NCQ for SATA disks
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>
-rw-r--r--drivers/scsi/aic94xx/aic94xx_task.c1
-rw-r--r--drivers/scsi/libsas/sas_discover.c28
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c6
3 files changed, 13 insertions, 22 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index e2ad5bed9403..9b65abec2f6e 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -391,7 +391,6 @@ static int asd_build_ata_ascb(struct asd_ascb *ascb, struct sas_task *task,
391 391
392 scb->ata_task.total_xfer_len = cpu_to_le32(task->total_xfer_len); 392 scb->ata_task.total_xfer_len = cpu_to_le32(task->total_xfer_len);
393 scb->ata_task.fis = task->ata_task.fis; 393 scb->ata_task.fis = task->ata_task.fis;
394 scb->ata_task.fis.fis_type = 0x27;
395 if (likely(!task->ata_task.device_control_reg_update)) 394 if (likely(!task->ata_task.device_control_reg_update))
396 scb->ata_task.fis.flags |= 0x80; /* C=1: update ATA cmd reg */ 395 scb->ata_task.fis.flags |= 0x80; /* C=1: update ATA cmd reg */
397 scb->ata_task.fis.flags &= 0xF0; /* PM_PORT field shall be 0 */ 396 scb->ata_task.fis.flags &= 0xF0; /* PM_PORT field shall be 0 */
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index 5252143b6297..a18c0f6d6668 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -371,6 +371,7 @@ static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
371 371
372 task->dev = dev; 372 task->dev = dev;
373 373
374 task->ata_task.fis.fis_type = 0x27;
374 task->ata_task.fis.command = command; 375 task->ata_task.fis.command = command;
375 task->ata_task.fis.features = features; 376 task->ata_task.fis.features = features;
376 task->ata_task.fis.device = d2h_fis->device; 377 task->ata_task.fis.device = d2h_fis->device;
@@ -483,11 +484,7 @@ cont1:
483 484
484 sas_fill_in_rphy(dev, dev->rphy); 485 sas_fill_in_rphy(dev, dev->rphy);
485 486
486 res = sas_rphy_add(dev->rphy); 487 return 0;
487 if (res)
488 goto out_err;
489
490 return res;
491out_err: 488out_err:
492 dev->sata_dev.identify_packet_device = NULL; 489 dev->sata_dev.identify_packet_device = NULL;
493 dev->sata_dev.identify_device = NULL; 490 dev->sata_dev.identify_device = NULL;
@@ -555,7 +552,7 @@ int sas_discover_sata(struct domain_device *dev)
555 552
556 res = sas_notify_lldd_dev_found(dev); 553 res = sas_notify_lldd_dev_found(dev);
557 if (res) 554 if (res)
558 goto out_err2; 555 return res;
559 556
560 switch (dev->dev_type) { 557 switch (dev->dev_type) {
561 case SATA_DEV: 558 case SATA_DEV:
@@ -567,23 +564,12 @@ int sas_discover_sata(struct domain_device *dev)
567 default: 564 default:
568 break; 565 break;
569 } 566 }
570 if (res)
571 goto out_err;
572
573 sas_notify_lldd_dev_gone(dev); 567 sas_notify_lldd_dev_gone(dev);
574 res = sas_notify_lldd_dev_found(dev); 568 if (!res) {
575 if (res) 569 sas_notify_lldd_dev_found(dev);
576 goto out_err2; 570 res = sas_rphy_add(dev->rphy);
577 571 }
578 res = sas_rphy_add(dev->rphy);
579 if (res)
580 goto out_err;
581
582 return res;
583 572
584out_err:
585 sas_notify_lldd_dev_gone(dev);
586out_err2:
587 return res; 573 return res;
588} 574}
589 575
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 5ff14ed9baf6..0dc7c02b3837 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -812,6 +812,12 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
812 task->task_proto = SAS_PROTOCOL_STP; 812 task->task_proto = SAS_PROTOCOL_STP;
813 task->task_done = sas_ata_task_done; 813 task->task_done = sas_ata_task_done;
814 814
815 if (qc->tf.command == ATA_CMD_FPDMA_WRITE ||
816 qc->tf.command == ATA_CMD_FPDMA_READ) {
817 /* Need to zero out the tag libata assigned us */
818 qc->tf.nsect = 0;
819 }
820
815 ata_tf_to_fis(&qc->tf, (u8*)&task->ata_task.fis, 0); 821 ata_tf_to_fis(&qc->tf, (u8*)&task->ata_task.fis, 0);
816 task->uldd_task = qc; 822 task->uldd_task = qc;
817 if (is_atapi_taskfile(&qc->tf)) { 823 if (is_atapi_taskfile(&qc->tf)) {