diff options
-rw-r--r-- | drivers/ide/ide-disk.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 37 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 35 | ||||
-rw-r--r-- | drivers/scsi/ide-scsi.c | 40 | ||||
-rw-r--r-- | include/linux/ide.h | 20 |
5 files changed, 65 insertions, 79 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index ffff96e6ab3e..747dc6023346 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -137,14 +137,12 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
137 | { | 137 | { |
138 | ide_hwif_t *hwif = HWIF(drive); | 138 | ide_hwif_t *hwif = HWIF(drive); |
139 | unsigned int dma = drive->using_dma; | 139 | unsigned int dma = drive->using_dma; |
140 | u16 nsectors = (u16)rq->nr_sectors; | ||
140 | u8 lba48 = (drive->addressing == 1) ? 1 : 0; | 141 | u8 lba48 = (drive->addressing == 1) ? 1 : 0; |
141 | u8 command = WIN_NOP; | 142 | u8 command = WIN_NOP; |
142 | ata_nsector_t nsectors; | ||
143 | ide_task_t task; | 143 | ide_task_t task; |
144 | struct ide_taskfile *tf = &task.tf; | 144 | struct ide_taskfile *tf = &task.tf; |
145 | 145 | ||
146 | nsectors.all = (u16) rq->nr_sectors; | ||
147 | |||
148 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { | 146 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { |
149 | if (block + rq->nr_sectors > 1ULL << 28) | 147 | if (block + rq->nr_sectors > 1ULL << 28) |
150 | dma = 0; | 148 | dma = 0; |
@@ -166,14 +164,14 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
166 | pr_debug("%s: LBA=0x%012llx\n", drive->name, | 164 | pr_debug("%s: LBA=0x%012llx\n", drive->name, |
167 | (unsigned long long)block); | 165 | (unsigned long long)block); |
168 | 166 | ||
169 | tf->hob_nsect = nsectors.b.high; | 167 | tf->hob_nsect = (nsectors >> 8) & 0xff; |
170 | tf->hob_lbal = (u8)(block >> 24); | 168 | tf->hob_lbal = (u8)(block >> 24); |
171 | if (sizeof(block) != 4) { | 169 | if (sizeof(block) != 4) { |
172 | tf->hob_lbam = (u8)((u64)block >> 32); | 170 | tf->hob_lbam = (u8)((u64)block >> 32); |
173 | tf->hob_lbah = (u8)((u64)block >> 40); | 171 | tf->hob_lbah = (u8)((u64)block >> 40); |
174 | } | 172 | } |
175 | 173 | ||
176 | tf->nsect = nsectors.b.low; | 174 | tf->nsect = nsectors & 0xff; |
177 | tf->lbal = (u8) block; | 175 | tf->lbal = (u8) block; |
178 | tf->lbam = (u8)(block >> 8); | 176 | tf->lbam = (u8)(block >> 8); |
179 | tf->lbah = (u8)(block >> 16); | 177 | tf->lbah = (u8)(block >> 16); |
@@ -185,7 +183,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
185 | #endif | 183 | #endif |
186 | task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); | 184 | task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); |
187 | } else { | 185 | } else { |
188 | tf->nsect = nsectors.b.low; | 186 | tf->nsect = nsectors & 0xff; |
189 | tf->lbal = block; | 187 | tf->lbal = block; |
190 | tf->lbam = block >>= 8; | 188 | tf->lbam = block >>= 8; |
191 | tf->lbah = block >>= 8; | 189 | tf->lbah = block >>= 8; |
@@ -200,7 +198,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
200 | 198 | ||
201 | pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); | 199 | pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); |
202 | 200 | ||
203 | tf->nsect = nsectors.b.low; | 201 | tf->nsect = nsectors & 0xff; |
204 | tf->lbal = sect; | 202 | tf->lbal = sect; |
205 | tf->lbam = cyl; | 203 | tf->lbam = cyl; |
206 | tf->lbah = cyl >> 8; | 204 | tf->lbah = cyl >> 8; |
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 */ |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 2c03f469f06e..4c24e185ccbf 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1847,13 +1847,13 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) | |||
1847 | { | 1847 | { |
1848 | ide_hwif_t *hwif = drive->hwif; | 1848 | ide_hwif_t *hwif = drive->hwif; |
1849 | idetape_tape_t *tape = drive->driver_data; | 1849 | idetape_tape_t *tape = drive->driver_data; |
1850 | atapi_bcount_t bcount; | ||
1851 | atapi_ireason_t ireason; | 1850 | atapi_ireason_t ireason; |
1852 | idetape_pc_t *pc = tape->pc; | 1851 | idetape_pc_t *pc = tape->pc; |
1853 | unsigned int temp; | 1852 | unsigned int temp; |
1854 | #if SIMULATE_ERRORS | 1853 | #if SIMULATE_ERRORS |
1855 | static int error_sim_count = 0; | 1854 | static int error_sim_count = 0; |
1856 | #endif | 1855 | #endif |
1856 | u16 bcount; | ||
1857 | u8 stat; | 1857 | u8 stat; |
1858 | 1858 | ||
1859 | #if IDETAPE_DEBUG_LOG | 1859 | #if IDETAPE_DEBUG_LOG |
@@ -1962,8 +1962,8 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) | |||
1962 | return ide_do_reset(drive); | 1962 | return ide_do_reset(drive); |
1963 | } | 1963 | } |
1964 | /* Get the number of bytes to transfer on this interrupt. */ | 1964 | /* Get the number of bytes to transfer on this interrupt. */ |
1965 | bcount.b.high = hwif->INB(IDE_BCOUNTH_REG); | 1965 | bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | |
1966 | bcount.b.low = hwif->INB(IDE_BCOUNTL_REG); | 1966 | hwif->INB(IDE_BCOUNTL_REG); |
1967 | 1967 | ||
1968 | ireason.all = hwif->INB(IDE_IREASON_REG); | 1968 | ireason.all = hwif->INB(IDE_IREASON_REG); |
1969 | 1969 | ||
@@ -1981,11 +1981,11 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) | |||
1981 | } | 1981 | } |
1982 | if (!test_bit(PC_WRITING, &pc->flags)) { | 1982 | if (!test_bit(PC_WRITING, &pc->flags)) { |
1983 | /* Reading - Check that we have enough space */ | 1983 | /* Reading - Check that we have enough space */ |
1984 | temp = pc->actually_transferred + bcount.all; | 1984 | temp = pc->actually_transferred + bcount; |
1985 | if (temp > pc->request_transfer) { | 1985 | if (temp > pc->request_transfer) { |
1986 | if (temp > pc->buffer_size) { | 1986 | if (temp > pc->buffer_size) { |
1987 | printk(KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n"); | 1987 | printk(KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n"); |
1988 | idetape_discard_data(drive, bcount.all); | 1988 | idetape_discard_data(drive, bcount); |
1989 | ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); | 1989 | ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); |
1990 | return ide_started; | 1990 | return ide_started; |
1991 | } | 1991 | } |
@@ -1997,23 +1997,26 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) | |||
1997 | } | 1997 | } |
1998 | if (test_bit(PC_WRITING, &pc->flags)) { | 1998 | if (test_bit(PC_WRITING, &pc->flags)) { |
1999 | if (pc->bh != NULL) | 1999 | if (pc->bh != NULL) |
2000 | idetape_output_buffers(drive, pc, bcount.all); | 2000 | idetape_output_buffers(drive, pc, bcount); |
2001 | else | 2001 | else |
2002 | /* Write the current buffer */ | 2002 | /* Write the current buffer */ |
2003 | HWIF(drive)->atapi_output_bytes(drive, pc->current_position, bcount.all); | 2003 | hwif->atapi_output_bytes(drive, pc->current_position, |
2004 | bcount); | ||
2004 | } else { | 2005 | } else { |
2005 | if (pc->bh != NULL) | 2006 | if (pc->bh != NULL) |
2006 | idetape_input_buffers(drive, pc, bcount.all); | 2007 | idetape_input_buffers(drive, pc, bcount); |
2007 | else | 2008 | else |
2008 | /* Read the current buffer */ | 2009 | /* Read the current buffer */ |
2009 | HWIF(drive)->atapi_input_bytes(drive, pc->current_position, bcount.all); | 2010 | hwif->atapi_input_bytes(drive, pc->current_position, |
2011 | bcount); | ||
2010 | } | 2012 | } |
2011 | /* Update the current position */ | 2013 | /* Update the current position */ |
2012 | pc->actually_transferred += bcount.all; | 2014 | pc->actually_transferred += bcount; |
2013 | pc->current_position += bcount.all; | 2015 | pc->current_position += bcount; |
2014 | #if IDETAPE_DEBUG_LOG | 2016 | #if IDETAPE_DEBUG_LOG |
2015 | if (tape->debug_level >= 2) | 2017 | if (tape->debug_level >= 2) |
2016 | printk(KERN_INFO "ide-tape: [cmd %x] transferred %d bytes on that interrupt\n", pc->c[0], bcount.all); | 2018 | printk(KERN_INFO "ide-tape: [cmd %x] transferred %d bytes " |
2019 | "on that interrupt\n", pc->c[0], bcount); | ||
2017 | #endif | 2020 | #endif |
2018 | /* And set the interrupt handler again */ | 2021 | /* And set the interrupt handler again */ |
2019 | ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); | 2022 | ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); |
@@ -2109,8 +2112,8 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape | |||
2109 | { | 2112 | { |
2110 | ide_hwif_t *hwif = drive->hwif; | 2113 | ide_hwif_t *hwif = drive->hwif; |
2111 | idetape_tape_t *tape = drive->driver_data; | 2114 | idetape_tape_t *tape = drive->driver_data; |
2112 | atapi_bcount_t bcount; | ||
2113 | int dma_ok = 0; | 2115 | int dma_ok = 0; |
2116 | u16 bcount; | ||
2114 | 2117 | ||
2115 | #if IDETAPE_DEBUG_BUGS | 2118 | #if IDETAPE_DEBUG_BUGS |
2116 | if (tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD && | 2119 | if (tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD && |
@@ -2159,7 +2162,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape | |||
2159 | pc->actually_transferred = 0; | 2162 | pc->actually_transferred = 0; |
2160 | pc->current_position = pc->buffer; | 2163 | pc->current_position = pc->buffer; |
2161 | /* Request to transfer the entire buffer at once */ | 2164 | /* Request to transfer the entire buffer at once */ |
2162 | bcount.all = pc->request_transfer; | 2165 | bcount = pc->request_transfer; |
2163 | 2166 | ||
2164 | if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) { | 2167 | if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) { |
2165 | printk(KERN_WARNING "ide-tape: DMA disabled, " | 2168 | printk(KERN_WARNING "ide-tape: DMA disabled, " |
@@ -2172,8 +2175,8 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape | |||
2172 | if (IDE_CONTROL_REG) | 2175 | if (IDE_CONTROL_REG) |
2173 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); | 2176 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); |
2174 | hwif->OUTB(dma_ok ? 1 : 0, IDE_FEATURE_REG); /* Use PIO/DMA */ | 2177 | hwif->OUTB(dma_ok ? 1 : 0, IDE_FEATURE_REG); /* Use PIO/DMA */ |
2175 | hwif->OUTB(bcount.b.high, IDE_BCOUNTH_REG); | 2178 | hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG); |
2176 | hwif->OUTB(bcount.b.low, IDE_BCOUNTL_REG); | 2179 | hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG); |
2177 | hwif->OUTB(drive->select.all, IDE_SELECT_REG); | 2180 | hwif->OUTB(drive->select.all, IDE_SELECT_REG); |
2178 | if (dma_ok) /* Will begin DMA later */ | 2181 | if (dma_ok) /* Will begin DMA later */ |
2179 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); | 2182 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index c009f2351346..77e8a81228fc 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -395,11 +395,12 @@ static int idescsi_expiry(ide_drive_t *drive) | |||
395 | static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | 395 | static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) |
396 | { | 396 | { |
397 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 397 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
398 | idescsi_pc_t *pc=scsi->pc; | 398 | ide_hwif_t *hwif = drive->hwif; |
399 | idescsi_pc_t *pc = scsi->pc; | ||
399 | struct request *rq = pc->rq; | 400 | struct request *rq = pc->rq; |
400 | atapi_bcount_t bcount; | ||
401 | atapi_ireason_t ireason; | 401 | atapi_ireason_t ireason; |
402 | unsigned int temp; | 402 | unsigned int temp; |
403 | u16 bcount; | ||
403 | u8 stat; | 404 | u8 stat; |
404 | 405 | ||
405 | #if IDESCSI_DEBUG_LOG | 406 | #if IDESCSI_DEBUG_LOG |
@@ -436,8 +437,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
436 | idescsi_end_request (drive, 1, 0); | 437 | idescsi_end_request (drive, 1, 0); |
437 | return ide_stopped; | 438 | return ide_stopped; |
438 | } | 439 | } |
439 | bcount.b.low = HWIF(drive)->INB(IDE_BCOUNTL_REG); | 440 | bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | |
440 | bcount.b.high = HWIF(drive)->INB(IDE_BCOUNTH_REG); | 441 | hwif->INB(IDE_BCOUNTL_REG); |
441 | ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); | 442 | ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); |
442 | 443 | ||
443 | if (ireason.b.cod) { | 444 | if (ireason.b.cod) { |
@@ -445,7 +446,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
445 | return ide_do_reset (drive); | 446 | return ide_do_reset (drive); |
446 | } | 447 | } |
447 | if (ireason.b.io) { | 448 | if (ireason.b.io) { |
448 | temp = pc->actually_transferred + bcount.all; | 449 | temp = pc->actually_transferred + bcount; |
449 | if (temp > pc->request_transfer) { | 450 | if (temp > pc->request_transfer) { |
450 | if (temp > pc->buffer_size) { | 451 | if (temp > pc->buffer_size) { |
451 | printk(KERN_ERR "ide-scsi: The scsi wants to " | 452 | printk(KERN_ERR "ide-scsi: The scsi wants to " |
@@ -458,11 +459,13 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
458 | idescsi_input_buffers(drive, pc, temp); | 459 | idescsi_input_buffers(drive, pc, temp); |
459 | else | 460 | else |
460 | drive->hwif->atapi_input_bytes(drive, pc->current_position, temp); | 461 | drive->hwif->atapi_input_bytes(drive, pc->current_position, temp); |
461 | printk(KERN_ERR "ide-scsi: transferred %d of %d bytes\n", temp, bcount.all); | 462 | printk(KERN_ERR "ide-scsi: transferred" |
463 | " %d of %d bytes\n", | ||
464 | temp, bcount); | ||
462 | } | 465 | } |
463 | pc->actually_transferred += temp; | 466 | pc->actually_transferred += temp; |
464 | pc->current_position += temp; | 467 | pc->current_position += temp; |
465 | idescsi_discard_data(drive, bcount.all - temp); | 468 | idescsi_discard_data(drive, bcount - temp); |
466 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 469 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
467 | return ide_started; | 470 | return ide_started; |
468 | } | 471 | } |
@@ -474,19 +477,21 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
474 | if (ireason.b.io) { | 477 | if (ireason.b.io) { |
475 | clear_bit(PC_WRITING, &pc->flags); | 478 | clear_bit(PC_WRITING, &pc->flags); |
476 | if (pc->sg) | 479 | if (pc->sg) |
477 | idescsi_input_buffers(drive, pc, bcount.all); | 480 | idescsi_input_buffers(drive, pc, bcount); |
478 | else | 481 | else |
479 | HWIF(drive)->atapi_input_bytes(drive, pc->current_position, bcount.all); | 482 | hwif->atapi_input_bytes(drive, pc->current_position, |
483 | bcount); | ||
480 | } else { | 484 | } else { |
481 | set_bit(PC_WRITING, &pc->flags); | 485 | set_bit(PC_WRITING, &pc->flags); |
482 | if (pc->sg) | 486 | if (pc->sg) |
483 | idescsi_output_buffers (drive, pc, bcount.all); | 487 | idescsi_output_buffers(drive, pc, bcount); |
484 | else | 488 | else |
485 | HWIF(drive)->atapi_output_bytes(drive, pc->current_position, bcount.all); | 489 | hwif->atapi_output_bytes(drive, pc->current_position, |
490 | bcount); | ||
486 | } | 491 | } |
487 | /* Update the current position */ | 492 | /* Update the current position */ |
488 | pc->actually_transferred += bcount.all; | 493 | pc->actually_transferred += bcount; |
489 | pc->current_position += bcount.all; | 494 | pc->current_position += bcount; |
490 | 495 | ||
491 | /* And set the interrupt handler again */ | 496 | /* And set the interrupt handler again */ |
492 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 497 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
@@ -570,13 +575,14 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) | |||
570 | { | 575 | { |
571 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 576 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
572 | ide_hwif_t *hwif = drive->hwif; | 577 | ide_hwif_t *hwif = drive->hwif; |
573 | atapi_bcount_t bcount; | 578 | u16 bcount; |
574 | u8 dma = 0; | 579 | u8 dma = 0; |
575 | 580 | ||
576 | scsi->pc=pc; /* Set the current packet command */ | 581 | scsi->pc=pc; /* Set the current packet command */ |
577 | pc->actually_transferred=0; /* We haven't transferred any data yet */ | 582 | pc->actually_transferred=0; /* We haven't transferred any data yet */ |
578 | pc->current_position=pc->buffer; | 583 | pc->current_position=pc->buffer; |
579 | bcount.all = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */ | 584 | /* Request to transfer the entire buffer at once */ |
585 | bcount = min(pc->request_transfer, 63 * 1024); | ||
580 | 586 | ||
581 | if (drive->using_dma && !idescsi_map_sg(drive, pc)) { | 587 | if (drive->using_dma && !idescsi_map_sg(drive, pc)) { |
582 | hwif->sg_mapped = 1; | 588 | hwif->sg_mapped = 1; |
@@ -589,8 +595,8 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) | |||
589 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); | 595 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); |
590 | 596 | ||
591 | hwif->OUTB(dma, IDE_FEATURE_REG); | 597 | hwif->OUTB(dma, IDE_FEATURE_REG); |
592 | HWIF(drive)->OUTB(bcount.b.high, IDE_BCOUNTH_REG); | 598 | hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG); |
593 | HWIF(drive)->OUTB(bcount.b.low, IDE_BCOUNTL_REG); | 599 | hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG); |
594 | 600 | ||
595 | if (dma) | 601 | if (dma) |
596 | set_bit(PC_DMA_OK, &pc->flags); | 602 | set_bit(PC_DMA_OK, &pc->flags); |
diff --git a/include/linux/ide.h b/include/linux/ide.h index a638dde17e77..cf1a5aaebd9e 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -316,26 +316,6 @@ typedef union { | |||
316 | } special_t; | 316 | } special_t; |
317 | 317 | ||
318 | /* | 318 | /* |
319 | * ATA DATA Register Special. | ||
320 | * ATA NSECTOR Count Register(). | ||
321 | * ATAPI Byte Count Register. | ||
322 | */ | ||
323 | typedef union { | ||
324 | unsigned all :16; | ||
325 | struct { | ||
326 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
327 | unsigned low :8; /* LSB */ | ||
328 | unsigned high :8; /* MSB */ | ||
329 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
330 | unsigned high :8; /* MSB */ | ||
331 | unsigned low :8; /* LSB */ | ||
332 | #else | ||
333 | #error "Please fix <asm/byteorder.h>" | ||
334 | #endif | ||
335 | } b; | ||
336 | } ata_nsector_t, ata_data_t, atapi_bcount_t; | ||
337 | |||
338 | /* | ||
339 | * ATA-IDE Select Register, aka Device-Head | 319 | * ATA-IDE Select Register, aka Device-Head |
340 | * | 320 | * |
341 | * head : always zeros here | 321 | * head : always zeros here |