diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:09 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:09 -0500 |
commit | 6dd87233bccc6416dac3b78ac912fd017918efe6 (patch) | |
tree | 6d36a6288c863afb3ba34fc8c62ee6a3a3086954 | |
parent | 46f26c362d5109459f04f99e93fc0413d88516c8 (diff) |
ide: fix registers loading order for IDE_NSECTOR_REG in execute_drive_cmd()
Move loading of IDE_NSECTOR_REG from ide_cmd() to execute_drive_cmd()
(load the IDE_NSECTOR_REG just after IDE_FEATURE_REG).
This also allows us to drop 'nsect' argument from ide_cmd() and simplify
execute_drive_cmd() code for REQ_TYPE_ATA_CMD case a bit.
It shouldn't affect anything (just a usual paranoia to separate changes
which change the way in which hardware is accessed from code cleanups).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-io.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c616c9fb4832..c5d81df02007 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -624,21 +624,18 @@ ide_startstop_t ide_abort(ide_drive_t *drive, const char *msg) | |||
624 | * ide_cmd - issue a simple drive command | 624 | * ide_cmd - issue a simple drive command |
625 | * @drive: drive the command is for | 625 | * @drive: drive the command is for |
626 | * @cmd: command byte | 626 | * @cmd: command byte |
627 | * @nsect: sector byte | ||
628 | * @handler: handler for the command completion | 627 | * @handler: handler for the command completion |
629 | * | 628 | * |
630 | * Issue a simple drive command with interrupts. | 629 | * Issue a simple drive command with interrupts. |
631 | * The drive must be selected beforehand. | 630 | * The drive must be selected beforehand. |
632 | */ | 631 | */ |
633 | 632 | ||
634 | static void ide_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, | 633 | static void ide_cmd(ide_drive_t *drive, u8 cmd, ide_handler_t *handler) |
635 | ide_handler_t *handler) | ||
636 | { | 634 | { |
637 | ide_hwif_t *hwif = HWIF(drive); | 635 | ide_hwif_t *hwif = HWIF(drive); |
638 | if (IDE_CONTROL_REG) | 636 | if (IDE_CONTROL_REG) |
639 | hwif->OUTB(drive->ctl,IDE_CONTROL_REG); /* clear nIEN */ | 637 | hwif->OUTB(drive->ctl,IDE_CONTROL_REG); /* clear nIEN */ |
640 | SELECT_MASK(drive,0); | 638 | SELECT_MASK(drive,0); |
641 | hwif->OUTB(nsect,IDE_NSECTOR_REG); | ||
642 | ide_execute_command(drive, cmd, handler, WAIT_CMD, NULL); | 639 | ide_execute_command(drive, cmd, handler, WAIT_CMD, NULL); |
643 | } | 640 | } |
644 | 641 | ||
@@ -913,11 +910,12 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
913 | printk("sel=0x%02x\n", args[6]); | 910 | printk("sel=0x%02x\n", args[6]); |
914 | #endif | 911 | #endif |
915 | hwif->OUTB(args[1], IDE_FEATURE_REG); | 912 | hwif->OUTB(args[1], IDE_FEATURE_REG); |
913 | hwif->OUTB(args[2], IDE_NSECTOR_REG); | ||
916 | hwif->OUTB(args[3], IDE_SECTOR_REG); | 914 | hwif->OUTB(args[3], IDE_SECTOR_REG); |
917 | hwif->OUTB(args[4], IDE_LCYL_REG); | 915 | hwif->OUTB(args[4], IDE_LCYL_REG); |
918 | hwif->OUTB(args[5], IDE_HCYL_REG); | 916 | hwif->OUTB(args[5], IDE_HCYL_REG); |
919 | hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG); | 917 | hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG); |
920 | ide_cmd(drive, args[0], args[2], &drive_cmd_intr); | 918 | ide_cmd(drive, args[0], &drive_cmd_intr); |
921 | return ide_started; | 919 | return ide_started; |
922 | } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) { | 920 | } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) { |
923 | u8 *args = rq->buffer; | 921 | u8 *args = rq->buffer; |
@@ -931,16 +929,15 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
931 | printk("fr=0x%02x ", args[2]); | 929 | printk("fr=0x%02x ", args[2]); |
932 | printk("xx=0x%02x\n", args[3]); | 930 | printk("xx=0x%02x\n", args[3]); |
933 | #endif | 931 | #endif |
932 | hwif->OUTB(args[2], IDE_FEATURE_REG); | ||
934 | if (args[0] == WIN_SMART) { | 933 | if (args[0] == WIN_SMART) { |
935 | hwif->OUTB(args[2],IDE_FEATURE_REG); | 934 | hwif->OUTB(args[3],IDE_NSECTOR_REG); |
936 | hwif->OUTB(args[1],IDE_SECTOR_REG); | 935 | hwif->OUTB(args[1],IDE_SECTOR_REG); |
937 | hwif->OUTB(0x4f, IDE_LCYL_REG); | 936 | hwif->OUTB(0x4f, IDE_LCYL_REG); |
938 | hwif->OUTB(0xc2, IDE_HCYL_REG); | 937 | hwif->OUTB(0xc2, IDE_HCYL_REG); |
939 | ide_cmd(drive, args[0], args[3], &drive_cmd_intr); | 938 | } else |
940 | return ide_started; | 939 | hwif->OUTB(args[1], IDE_NSECTOR_REG); |
941 | } | 940 | ide_cmd(drive, args[0], &drive_cmd_intr); |
942 | hwif->OUTB(args[2],IDE_FEATURE_REG); | ||
943 | ide_cmd(drive, args[0], args[1], &drive_cmd_intr); | ||
944 | return ide_started; | 941 | return ide_started; |
945 | } | 942 | } |
946 | 943 | ||