diff options
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r-- | drivers/ide/ide-iops.c | 109 |
1 files changed, 16 insertions, 93 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 16b1f6e12781..a95178f5e1bb 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -163,8 +163,6 @@ void SELECT_DRIVE (ide_drive_t *drive) | |||
163 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); | 163 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); |
164 | } | 164 | } |
165 | 165 | ||
166 | EXPORT_SYMBOL(SELECT_DRIVE); | ||
167 | |||
168 | void SELECT_MASK (ide_drive_t *drive, int mask) | 166 | void SELECT_MASK (ide_drive_t *drive, int mask) |
169 | { | 167 | { |
170 | if (HWIF(drive)->maskproc) | 168 | if (HWIF(drive)->maskproc) |
@@ -614,66 +612,6 @@ no_80w: | |||
614 | return 0; | 612 | return 0; |
615 | } | 613 | } |
616 | 614 | ||
617 | int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) | ||
618 | { | ||
619 | if (args->tf.command == WIN_SETFEATURES && | ||
620 | args->tf.nsect > XFER_UDMA_2 && | ||
621 | args->tf.feature == SETFEATURES_XFER) { | ||
622 | if (eighty_ninty_three(drive) == 0) { | ||
623 | printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " | ||
624 | "be set\n", drive->name); | ||
625 | return 1; | ||
626 | } | ||
627 | } | ||
628 | |||
629 | return 0; | ||
630 | } | ||
631 | |||
632 | /* | ||
633 | * Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER. | ||
634 | * 1 : Safe to update drive->id DMA registers. | ||
635 | * 0 : OOPs not allowed. | ||
636 | */ | ||
637 | int set_transfer (ide_drive_t *drive, ide_task_t *args) | ||
638 | { | ||
639 | if (args->tf.command == WIN_SETFEATURES && | ||
640 | args->tf.nsect >= XFER_SW_DMA_0 && | ||
641 | args->tf.feature == SETFEATURES_XFER && | ||
642 | (drive->id->dma_ultra || | ||
643 | drive->id->dma_mword || | ||
644 | drive->id->dma_1word)) | ||
645 | return 1; | ||
646 | |||
647 | return 0; | ||
648 | } | ||
649 | |||
650 | #ifdef CONFIG_BLK_DEV_IDEDMA | ||
651 | static u8 ide_auto_reduce_xfer (ide_drive_t *drive) | ||
652 | { | ||
653 | if (!drive->crc_count) | ||
654 | return drive->current_speed; | ||
655 | drive->crc_count = 0; | ||
656 | |||
657 | switch(drive->current_speed) { | ||
658 | case XFER_UDMA_7: return XFER_UDMA_6; | ||
659 | case XFER_UDMA_6: return XFER_UDMA_5; | ||
660 | case XFER_UDMA_5: return XFER_UDMA_4; | ||
661 | case XFER_UDMA_4: return XFER_UDMA_3; | ||
662 | case XFER_UDMA_3: return XFER_UDMA_2; | ||
663 | case XFER_UDMA_2: return XFER_UDMA_1; | ||
664 | case XFER_UDMA_1: return XFER_UDMA_0; | ||
665 | /* | ||
666 | * OOPS we do not goto non Ultra DMA modes | ||
667 | * without iCRC's available we force | ||
668 | * the system to PIO and make the user | ||
669 | * invoke the ATA-1 ATA-2 DMA modes. | ||
670 | */ | ||
671 | case XFER_UDMA_0: | ||
672 | default: return XFER_PIO_4; | ||
673 | } | ||
674 | } | ||
675 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | ||
676 | |||
677 | int ide_driveid_update(ide_drive_t *drive) | 615 | int ide_driveid_update(ide_drive_t *drive) |
678 | { | 616 | { |
679 | ide_hwif_t *hwif = drive->hwif; | 617 | ide_hwif_t *hwif = drive->hwif; |
@@ -882,22 +820,17 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
882 | unsigned long flags; | 820 | unsigned long flags; |
883 | ide_hwgroup_t *hwgroup = HWGROUP(drive); | 821 | ide_hwgroup_t *hwgroup = HWGROUP(drive); |
884 | ide_hwif_t *hwif = HWIF(drive); | 822 | ide_hwif_t *hwif = HWIF(drive); |
885 | 823 | ||
886 | spin_lock_irqsave(&ide_lock, flags); | 824 | spin_lock_irqsave(&ide_lock, flags); |
887 | |||
888 | BUG_ON(hwgroup->handler); | 825 | BUG_ON(hwgroup->handler); |
889 | hwgroup->handler = handler; | 826 | __ide_set_handler(drive, handler, timeout, expiry); |
890 | hwgroup->expiry = expiry; | ||
891 | hwgroup->timer.expires = jiffies + timeout; | ||
892 | hwgroup->req_gen_timer = hwgroup->req_gen; | ||
893 | add_timer(&hwgroup->timer); | ||
894 | hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); | 827 | hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); |
895 | /* Drive takes 400nS to respond, we must avoid the IRQ being | 828 | /* |
896 | serviced before that. | 829 | * Drive takes 400nS to respond, we must avoid the IRQ being |
897 | 830 | * serviced before that. | |
898 | FIXME: we could skip this delay with care on non shared | 831 | * |
899 | devices | 832 | * FIXME: we could skip this delay with care on non shared devices |
900 | */ | 833 | */ |
901 | ndelay(400); | 834 | ndelay(400); |
902 | spin_unlock_irqrestore(&ide_lock, flags); | 835 | spin_unlock_irqrestore(&ide_lock, flags); |
903 | } | 836 | } |
@@ -1005,19 +938,6 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) | |||
1005 | return ide_stopped; | 938 | return ide_stopped; |
1006 | } | 939 | } |
1007 | 940 | ||
1008 | static void check_dma_crc(ide_drive_t *drive) | ||
1009 | { | ||
1010 | #ifdef CONFIG_BLK_DEV_IDEDMA | ||
1011 | if (drive->crc_count) { | ||
1012 | ide_dma_off_quietly(drive); | ||
1013 | ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive)); | ||
1014 | if (drive->current_speed >= XFER_SW_DMA_0) | ||
1015 | ide_dma_on(drive); | ||
1016 | } else | ||
1017 | ide_dma_off(drive); | ||
1018 | #endif | ||
1019 | } | ||
1020 | |||
1021 | static void ide_disk_pre_reset(ide_drive_t *drive) | 941 | static void ide_disk_pre_reset(ide_drive_t *drive) |
1022 | { | 942 | { |
1023 | int legacy = (drive->id->cfs_enable_2 & 0x0400) ? 0 : 1; | 943 | int legacy = (drive->id->cfs_enable_2 & 0x0400) ? 0 : 1; |
@@ -1039,17 +959,20 @@ static void pre_reset(ide_drive_t *drive) | |||
1039 | else | 959 | else |
1040 | drive->post_reset = 1; | 960 | drive->post_reset = 1; |
1041 | 961 | ||
962 | if (drive->using_dma) { | ||
963 | if (drive->crc_count) | ||
964 | ide_check_dma_crc(drive); | ||
965 | else | ||
966 | ide_dma_off(drive); | ||
967 | } | ||
968 | |||
1042 | if (!drive->keep_settings) { | 969 | if (!drive->keep_settings) { |
1043 | if (drive->using_dma) { | 970 | if (!drive->using_dma) { |
1044 | check_dma_crc(drive); | ||
1045 | } else { | ||
1046 | drive->unmask = 0; | 971 | drive->unmask = 0; |
1047 | drive->io_32bit = 0; | 972 | drive->io_32bit = 0; |
1048 | } | 973 | } |
1049 | return; | 974 | return; |
1050 | } | 975 | } |
1051 | if (drive->using_dma) | ||
1052 | check_dma_crc(drive); | ||
1053 | 976 | ||
1054 | if (HWIF(drive)->pre_reset != NULL) | 977 | if (HWIF(drive)->pre_reset != NULL) |
1055 | HWIF(drive)->pre_reset(drive); | 978 | HWIF(drive)->pre_reset(drive); |