aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_nv.c
diff options
context:
space:
mode:
authorRobert Hancock <hancockr@shaw.ca>2007-02-19 20:02:46 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-21 04:58:19 -0500
commitac3d6b869f1f2d8ee1bf7b0ba45cd7daed9b9513 (patch)
treea98eece94c628f725dbd079b35fdfec5604a5139 /drivers/ata/sata_nv.c
parent41949ed5c11a9d6e7af1afd62957d8d1988c803e (diff)
sata_nv: Cleanup taskfile setup
This edits the taskfile setup to more closely match the way that libata sends the taskfile for other controllers. This avoids putting taskfile writes into the CPB buffer that are not needed according to the taskfile flags. Signed-off-by: Robert Hancock <hancockr@shaw.ca> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_nv.c')
-rw-r--r--drivers/ata/sata_nv.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 067352da2c2d..57dace43b337 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -662,29 +662,30 @@ static unsigned int nv_adma_tf_to_cpb(struct ata_taskfile *tf, __le16 *cpb)
662{ 662{
663 unsigned int idx = 0; 663 unsigned int idx = 0;
664 664
665 cpb[idx++] = cpu_to_le16((ATA_REG_DEVICE << 8) | tf->device | WNB); 665 if(tf->flags & ATA_TFLAG_ISADDR) {
666 666 if (tf->flags & ATA_TFLAG_LBA48) {
667 if ((tf->flags & ATA_TFLAG_LBA48) == 0) { 667 cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->hob_feature | WNB);
668 cpb[idx++] = cpu_to_le16(IGN); 668 cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->hob_nsect);
669 cpb[idx++] = cpu_to_le16(IGN); 669 cpb[idx++] = cpu_to_le16((ATA_REG_LBAL << 8) | tf->hob_lbal);
670 cpb[idx++] = cpu_to_le16(IGN); 670 cpb[idx++] = cpu_to_le16((ATA_REG_LBAM << 8) | tf->hob_lbam);
671 cpb[idx++] = cpu_to_le16(IGN); 671 cpb[idx++] = cpu_to_le16((ATA_REG_LBAH << 8) | tf->hob_lbah);
672 cpb[idx++] = cpu_to_le16(IGN); 672 cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->feature);
673 } 673 } else
674 else { 674 cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->feature | WNB);
675 cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->hob_feature); 675
676 cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->hob_nsect); 676 cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->nsect);
677 cpb[idx++] = cpu_to_le16((ATA_REG_LBAL << 8) | tf->hob_lbal); 677 cpb[idx++] = cpu_to_le16((ATA_REG_LBAL << 8) | tf->lbal);
678 cpb[idx++] = cpu_to_le16((ATA_REG_LBAM << 8) | tf->hob_lbam); 678 cpb[idx++] = cpu_to_le16((ATA_REG_LBAM << 8) | tf->lbam);
679 cpb[idx++] = cpu_to_le16((ATA_REG_LBAH << 8) | tf->hob_lbah); 679 cpb[idx++] = cpu_to_le16((ATA_REG_LBAH << 8) | tf->lbah);
680 } 680 }
681 cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->feature); 681
682 cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->nsect); 682 if(tf->flags & ATA_TFLAG_DEVICE)
683 cpb[idx++] = cpu_to_le16((ATA_REG_LBAL << 8) | tf->lbal); 683 cpb[idx++] = cpu_to_le16((ATA_REG_DEVICE << 8) | tf->device);
684 cpb[idx++] = cpu_to_le16((ATA_REG_LBAM << 8) | tf->lbam);
685 cpb[idx++] = cpu_to_le16((ATA_REG_LBAH << 8) | tf->lbah);
686 684
687 cpb[idx++] = cpu_to_le16((ATA_REG_CMD << 8) | tf->command | CMDEND); 685 cpb[idx++] = cpu_to_le16((ATA_REG_CMD << 8) | tf->command | CMDEND);
686
687 while(idx < 12)
688 cpb[idx++] = cpu_to_le16(IGN);
688 689
689 return idx; 690 return idx;
690} 691}