Commit ee7fb331 authored by Vinayak Kale's avatar Vinayak Kale Committed by Tejun Heo

libata: add support for NCQ commands for SG interface

This patch is needed to make NCQ commands with FPDMA protocol value
(eg READ/WRITE FPDMA) work over SCSI Generic (SG) interface.
Signed-off-by: default avatarVinayak Kale <vinayak.kale@seagate.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent eb351031
...@@ -2912,12 +2912,14 @@ ata_scsi_map_proto(u8 byte1) ...@@ -2912,12 +2912,14 @@ ata_scsi_map_proto(u8 byte1)
case 5: /* PIO Data-out */ case 5: /* PIO Data-out */
return ATA_PROT_PIO; return ATA_PROT_PIO;
case 12: /* FPDMA */
return ATA_PROT_NCQ;
case 0: /* Hard Reset */ case 0: /* Hard Reset */
case 1: /* SRST */ case 1: /* SRST */
case 8: /* Device Diagnostic */ case 8: /* Device Diagnostic */
case 9: /* Device Reset */ case 9: /* Device Reset */
case 7: /* DMA Queued */ case 7: /* DMA Queued */
case 12: /* FPDMA */
case 15: /* Return Response Info */ case 15: /* Return Response Info */
default: /* Reserved */ default: /* Reserved */
break; break;
...@@ -2990,6 +2992,10 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) ...@@ -2990,6 +2992,10 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
tf->command = cdb[9]; tf->command = cdb[9];
} }
/* For NCQ commands with FPDMA protocol, copy the tag value */
if (tf->protocol == ATA_PROT_NCQ)
tf->nsect = qc->tag << 3;
/* enforce correct master/slave bit */ /* enforce correct master/slave bit */
tf->device = dev->devno ? tf->device = dev->devno ?
tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1; tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
......
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