aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}