diff options
author | James Bottomley <James.Bottomley@steeleye.com> | 2006-10-15 21:24:35 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-07-18 12:14:16 -0400 |
commit | 27e92471b5d8b3e70646dfaf9369d96773972efd (patch) | |
tree | 735fb7bdf589fbc2b39e744b3cf9608eb4d62ae7 /drivers/scsi/libsas | |
parent | bdab4e877819cc8b682797901c8b37567fec3c5e (diff) |
[SCSI] aic94xx: add SATAPI support
It turns out this is fairly easy to plumb in by recognising the three
command types and copying the CDB. The protocol response path needs to
be amended to cope with SAS_PROTO_RESPONSE.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r-- | drivers/scsi/libsas/sas_scsi_host.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 274e7eb47f37..5ff14ed9baf6 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -735,7 +735,6 @@ static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts) | |||
735 | case SAM_CHECK_COND: | 735 | case SAM_CHECK_COND: |
736 | case SAS_OPEN_TO: | 736 | case SAS_OPEN_TO: |
737 | case SAS_OPEN_REJECT: | 737 | case SAS_OPEN_REJECT: |
738 | case SAS_PROTO_RESPONSE: | ||
739 | SAS_DPRINTK("%s: Saw error %d. What to do?\n", | 738 | SAS_DPRINTK("%s: Saw error %d. What to do?\n", |
740 | __FUNCTION__, ts->stat); | 739 | __FUNCTION__, ts->stat); |
741 | return AC_ERR_OTHER; | 740 | return AC_ERR_OTHER; |
@@ -743,6 +742,10 @@ static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts) | |||
743 | case SAS_ABORTED_TASK: | 742 | case SAS_ABORTED_TASK: |
744 | return AC_ERR_DEV; | 743 | return AC_ERR_DEV; |
745 | 744 | ||
745 | case SAS_PROTO_RESPONSE: | ||
746 | /* This means the ending_fis has the error | ||
747 | * value; return 0 here to collect it */ | ||
748 | return 0; | ||
746 | default: | 749 | default: |
747 | return 0; | 750 | return 0; |
748 | } | 751 | } |
@@ -756,23 +759,25 @@ static void sas_ata_task_done(struct sas_task *task) | |||
756 | struct ata_task_resp *resp = (struct ata_task_resp *)stat->buf; | 759 | struct ata_task_resp *resp = (struct ata_task_resp *)stat->buf; |
757 | enum ata_completion_errors ac; | 760 | enum ata_completion_errors ac; |
758 | 761 | ||
759 | ac = sas_to_ata_err(stat); | 762 | if (stat->stat == SAS_PROTO_RESPONSE) { |
760 | if (ac) { | 763 | ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf); |
761 | SAS_DPRINTK("%s: SAS error %x\n", __FUNCTION__, stat->stat); | 764 | qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command); |
762 | /* We saw a SAS error. Send a vague error. */ | 765 | dev->sata_dev.sstatus = resp->sstatus; |
763 | qc->err_mask = ac; | 766 | dev->sata_dev.serror = resp->serror; |
764 | dev->sata_dev.tf.feature = 0x04; /* status err */ | 767 | dev->sata_dev.scontrol = resp->scontrol; |
765 | dev->sata_dev.tf.command = ATA_ERR; | 768 | dev->sata_dev.ap->sactive = resp->sactive; |
766 | goto end; | 769 | } else if (stat->stat != SAM_STAT_GOOD) { |
770 | ac = sas_to_ata_err(stat); | ||
771 | if (ac) { | ||
772 | SAS_DPRINTK("%s: SAS error %x\n", __FUNCTION__, | ||
773 | stat->stat); | ||
774 | /* We saw a SAS error. Send a vague error. */ | ||
775 | qc->err_mask = ac; | ||
776 | dev->sata_dev.tf.feature = 0x04; /* status err */ | ||
777 | dev->sata_dev.tf.command = ATA_ERR; | ||
778 | } | ||
767 | } | 779 | } |
768 | 780 | ||
769 | ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf); | ||
770 | qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command); | ||
771 | dev->sata_dev.sstatus = resp->sstatus; | ||
772 | dev->sata_dev.serror = resp->serror; | ||
773 | dev->sata_dev.scontrol = resp->scontrol; | ||
774 | dev->sata_dev.ap->sactive = resp->sactive; | ||
775 | end: | ||
776 | ata_qc_complete(qc); | 781 | ata_qc_complete(qc); |
777 | list_del_init(&task->list); | 782 | list_del_init(&task->list); |
778 | sas_free_task(task); | 783 | sas_free_task(task); |
@@ -810,7 +815,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) | |||
810 | ata_tf_to_fis(&qc->tf, (u8*)&task->ata_task.fis, 0); | 815 | ata_tf_to_fis(&qc->tf, (u8*)&task->ata_task.fis, 0); |
811 | task->uldd_task = qc; | 816 | task->uldd_task = qc; |
812 | if (is_atapi_taskfile(&qc->tf)) { | 817 | if (is_atapi_taskfile(&qc->tf)) { |
813 | memcpy(task->ata_task.atapi_packet, qc->cdb, ATAPI_CDB_LEN); | 818 | memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); |
814 | task->total_xfer_len = qc->nbytes + qc->pad_len; | 819 | task->total_xfer_len = qc->nbytes + qc->pad_len; |
815 | task->num_scatter = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; | 820 | task->num_scatter = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; |
816 | } else { | 821 | } else { |
@@ -832,6 +837,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) | |||
832 | case ATA_PROT_NCQ: | 837 | case ATA_PROT_NCQ: |
833 | task->ata_task.use_ncq = 1; | 838 | task->ata_task.use_ncq = 1; |
834 | /* fall through */ | 839 | /* fall through */ |
840 | case ATA_PROT_ATAPI_DMA: | ||
835 | case ATA_PROT_DMA: | 841 | case ATA_PROT_DMA: |
836 | task->ata_task.dma_xfer = 1; | 842 | task->ata_task.dma_xfer = 1; |
837 | break; | 843 | break; |