aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/scc_pata.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-04-08 08:13:01 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-08 08:13:01 -0400
commit60f85019c6c8c1aebf3485a313e0da094bc95d07 (patch)
tree5cbb0e1a733b59887308a50ce083613c4e7c0ede /drivers/ide/scc_pata.c
parent674f0ea111bc9bff1b4e4841d7da38933c5e3b59 (diff)
ide: replace IDE_TFLAG_* flags by IDE_VALID_*
Replace IDE_TFLAG_{IN|OUT}_* flags meaning to the taskfile register validity on input/output by the IDE_VALID_* flags and introduce 4 symmetric 8-bit register validity indicator subfields, 'valid.{input/output}.{tf|hob}', into the 'struct ide_cmd' instead of using the 'tf_flags' field for that purpose (this field can then be turned from 32-bit into 8-bit one). Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/scc_pata.c')
-rw-r--r--drivers/ide/scc_pata.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 55e48db7d1be..38a715e293d4 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -649,34 +649,37 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
649{ 649{
650 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 650 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
651 struct ide_taskfile *tf = &cmd->tf; 651 struct ide_taskfile *tf = &cmd->tf;
652 u8 valid = cmd->valid.out.hob;
652 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 653 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
653 654
654 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 655 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
655 HIHI = 0xFF; 656 HIHI = 0xFF;
656 657
657 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 658 if (valid & IDE_VALID_FEATURE)
658 scc_ide_outb(tf->hob_feature, io_ports->feature_addr); 659 scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
659 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 660 if (valid & IDE_VALID_NSECT)
660 scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr); 661 scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr);
661 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) 662 if (valid & IDE_VALID_LBAL)
662 scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr); 663 scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr);
663 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) 664 if (valid & IDE_VALID_LBAM)
664 scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr); 665 scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr);
665 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) 666 if (valid & IDE_VALID_LBAH)
666 scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr); 667 scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr);
667 668
668 if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) 669 valid = cmd->valid.out.tf;
670
671 if (valid & IDE_VALID_FEATURE)
669 scc_ide_outb(tf->feature, io_ports->feature_addr); 672 scc_ide_outb(tf->feature, io_ports->feature_addr);
670 if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) 673 if (valid & IDE_VALID_NSECT)
671 scc_ide_outb(tf->nsect, io_ports->nsect_addr); 674 scc_ide_outb(tf->nsect, io_ports->nsect_addr);
672 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) 675 if (valid & IDE_VALID_LBAL)
673 scc_ide_outb(tf->lbal, io_ports->lbal_addr); 676 scc_ide_outb(tf->lbal, io_ports->lbal_addr);
674 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) 677 if (valid & IDE_VALID_LBAM)
675 scc_ide_outb(tf->lbam, io_ports->lbam_addr); 678 scc_ide_outb(tf->lbam, io_ports->lbam_addr);
676 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) 679 if (valid & IDE_VALID_LBAH)
677 scc_ide_outb(tf->lbah, io_ports->lbah_addr); 680 scc_ide_outb(tf->lbah, io_ports->lbah_addr);
678 681
679 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) 682 if (valid & IDE_VALID_DEVICE)
680 scc_ide_outb((tf->device & HIHI) | drive->select, 683 scc_ide_outb((tf->device & HIHI) | drive->select,
681 io_ports->device_addr); 684 io_ports->device_addr);
682} 685}
@@ -685,35 +688,38 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
685{ 688{
686 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 689 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
687 struct ide_taskfile *tf = &cmd->tf; 690 struct ide_taskfile *tf = &cmd->tf;
691 u8 valid = cmd->valid.in.tf;
688 692
689 /* be sure we're looking at the low order bits */ 693 /* be sure we're looking at the low order bits */
690 scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 694 scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
691 695
692 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) 696 if (valid & IDE_VALID_ERROR)
693 tf->error = scc_ide_inb(io_ports->feature_addr); 697 tf->error = scc_ide_inb(io_ports->feature_addr);
694 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) 698 if (valid & IDE_VALID_NSECT)
695 tf->nsect = scc_ide_inb(io_ports->nsect_addr); 699 tf->nsect = scc_ide_inb(io_ports->nsect_addr);
696 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) 700 if (valid & IDE_VALID_LBAL)
697 tf->lbal = scc_ide_inb(io_ports->lbal_addr); 701 tf->lbal = scc_ide_inb(io_ports->lbal_addr);
698 if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) 702 if (valid & IDE_VALID_LBAM)
699 tf->lbam = scc_ide_inb(io_ports->lbam_addr); 703 tf->lbam = scc_ide_inb(io_ports->lbam_addr);
700 if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) 704 if (valid & IDE_VALID_LBAH)
701 tf->lbah = scc_ide_inb(io_ports->lbah_addr); 705 tf->lbah = scc_ide_inb(io_ports->lbah_addr);
702 if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) 706 if (valid & IDE_VALID_DEVICE)
703 tf->device = scc_ide_inb(io_ports->device_addr); 707 tf->device = scc_ide_inb(io_ports->device_addr);
704 708
705 if (cmd->tf_flags & IDE_TFLAG_LBA48) { 709 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
706 scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); 710 scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
707 711
708 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) 712 valid = cmd->valid.in.hob;
713
714 if (valid & IDE_VALID_ERROR)
709 tf->hob_error = scc_ide_inb(io_ports->feature_addr); 715 tf->hob_error = scc_ide_inb(io_ports->feature_addr);
710 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 716 if (valid & IDE_VALID_NSECT)
711 tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); 717 tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr);
712 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 718 if (valid & IDE_VALID_LBAL)
713 tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); 719 tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr);
714 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 720 if (valid & IDE_VALID_LBAM)
715 tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); 721 tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr);
716 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 722 if (valid & IDE_VALID_LBAH)
717 tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); 723 tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr);
718 } 724 }
719} 725}