diff options
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 95e302790001..239aebcfc359 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -787,11 +787,12 @@ static void idefloppy_retry_pc (ide_drive_t *drive) | |||
787 | static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | 787 | static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) |
788 | { | 788 | { |
789 | idefloppy_floppy_t *floppy = drive->driver_data; | 789 | idefloppy_floppy_t *floppy = drive->driver_data; |
790 | atapi_bcount_t bcount; | 790 | ide_hwif_t *hwif = drive->hwif; |
791 | atapi_ireason_t ireason; | 791 | atapi_ireason_t ireason; |
792 | idefloppy_pc_t *pc = floppy->pc; | 792 | idefloppy_pc_t *pc = floppy->pc; |
793 | struct request *rq = pc->rq; | 793 | struct request *rq = pc->rq; |
794 | unsigned int temp; | 794 | unsigned int temp; |
795 | u16 bcount; | ||
795 | u8 stat; | 796 | u8 stat; |
796 | 797 | ||
797 | debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n", | 798 | debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n", |
@@ -848,8 +849,8 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
848 | } | 849 | } |
849 | 850 | ||
850 | /* Get the number of bytes to transfer */ | 851 | /* Get the number of bytes to transfer */ |
851 | bcount.b.high = HWIF(drive)->INB(IDE_BCOUNTH_REG); | 852 | bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | |
852 | bcount.b.low = HWIF(drive)->INB(IDE_BCOUNTL_REG); | 853 | hwif->INB(IDE_BCOUNTL_REG); |
853 | /* on this interrupt */ | 854 | /* on this interrupt */ |
854 | ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); | 855 | ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); |
855 | 856 | ||
@@ -867,13 +868,13 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
867 | } | 868 | } |
868 | if (!test_bit(PC_WRITING, &pc->flags)) { | 869 | if (!test_bit(PC_WRITING, &pc->flags)) { |
869 | /* Reading - Check that we have enough space */ | 870 | /* Reading - Check that we have enough space */ |
870 | temp = pc->actually_transferred + bcount.all; | 871 | temp = pc->actually_transferred + bcount; |
871 | if (temp > pc->request_transfer) { | 872 | if (temp > pc->request_transfer) { |
872 | if (temp > pc->buffer_size) { | 873 | if (temp > pc->buffer_size) { |
873 | printk(KERN_ERR "ide-floppy: The floppy wants " | 874 | printk(KERN_ERR "ide-floppy: The floppy wants " |
874 | "to send us more data than expected " | 875 | "to send us more data than expected " |
875 | "- discarding data\n"); | 876 | "- discarding data\n"); |
876 | idefloppy_discard_data(drive,bcount.all); | 877 | idefloppy_discard_data(drive, bcount); |
877 | BUG_ON(HWGROUP(drive)->handler != NULL); | 878 | BUG_ON(HWGROUP(drive)->handler != NULL); |
878 | ide_set_handler(drive, | 879 | ide_set_handler(drive, |
879 | &idefloppy_pc_intr, | 880 | &idefloppy_pc_intr, |
@@ -889,23 +890,21 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
889 | if (test_bit(PC_WRITING, &pc->flags)) { | 890 | if (test_bit(PC_WRITING, &pc->flags)) { |
890 | if (pc->buffer != NULL) | 891 | if (pc->buffer != NULL) |
891 | /* Write the current buffer */ | 892 | /* Write the current buffer */ |
892 | HWIF(drive)->atapi_output_bytes(drive, | 893 | hwif->atapi_output_bytes(drive, pc->current_position, |
893 | pc->current_position, | 894 | bcount); |
894 | bcount.all); | ||
895 | else | 895 | else |
896 | idefloppy_output_buffers(drive, pc, bcount.all); | 896 | idefloppy_output_buffers(drive, pc, bcount); |
897 | } else { | 897 | } else { |
898 | if (pc->buffer != NULL) | 898 | if (pc->buffer != NULL) |
899 | /* Read the current buffer */ | 899 | /* Read the current buffer */ |
900 | HWIF(drive)->atapi_input_bytes(drive, | 900 | hwif->atapi_input_bytes(drive, pc->current_position, |
901 | pc->current_position, | 901 | bcount); |
902 | bcount.all); | ||
903 | else | 902 | else |
904 | idefloppy_input_buffers(drive, pc, bcount.all); | 903 | idefloppy_input_buffers(drive, pc, bcount); |
905 | } | 904 | } |
906 | /* Update the current position */ | 905 | /* Update the current position */ |
907 | pc->actually_transferred += bcount.all; | 906 | pc->actually_transferred += bcount; |
908 | pc->current_position += bcount.all; | 907 | pc->current_position += bcount; |
909 | 908 | ||
910 | BUG_ON(HWGROUP(drive)->handler != NULL); | 909 | BUG_ON(HWGROUP(drive)->handler != NULL); |
911 | ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */ | 910 | ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */ |
@@ -1019,8 +1018,8 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p | |||
1019 | { | 1018 | { |
1020 | idefloppy_floppy_t *floppy = drive->driver_data; | 1019 | idefloppy_floppy_t *floppy = drive->driver_data; |
1021 | ide_hwif_t *hwif = drive->hwif; | 1020 | ide_hwif_t *hwif = drive->hwif; |
1022 | atapi_bcount_t bcount; | ||
1023 | ide_handler_t *pkt_xfer_routine; | 1021 | ide_handler_t *pkt_xfer_routine; |
1022 | u16 bcount; | ||
1024 | u8 dma; | 1023 | u8 dma; |
1025 | 1024 | ||
1026 | if (floppy->failed_pc == NULL && | 1025 | if (floppy->failed_pc == NULL && |
@@ -1059,7 +1058,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p | |||
1059 | /* We haven't transferred any data yet */ | 1058 | /* We haven't transferred any data yet */ |
1060 | pc->actually_transferred = 0; | 1059 | pc->actually_transferred = 0; |
1061 | pc->current_position = pc->buffer; | 1060 | pc->current_position = pc->buffer; |
1062 | bcount.all = min(pc->request_transfer, 63 * 1024); | 1061 | bcount = min(pc->request_transfer, 63 * 1024); |
1063 | 1062 | ||
1064 | if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) | 1063 | if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) |
1065 | ide_dma_off(drive); | 1064 | ide_dma_off(drive); |
@@ -1073,8 +1072,8 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p | |||
1073 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); | 1072 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); |
1074 | /* Use PIO/DMA */ | 1073 | /* Use PIO/DMA */ |
1075 | hwif->OUTB(dma, IDE_FEATURE_REG); | 1074 | hwif->OUTB(dma, IDE_FEATURE_REG); |
1076 | HWIF(drive)->OUTB(bcount.b.high, IDE_BCOUNTH_REG); | 1075 | hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG); |
1077 | HWIF(drive)->OUTB(bcount.b.low, IDE_BCOUNTL_REG); | 1076 | hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG); |
1078 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); | 1077 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); |
1079 | 1078 | ||
1080 | if (dma) { /* Begin DMA, if necessary */ | 1079 | if (dma) { /* Begin DMA, if necessary */ |