aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:12 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:12 -0500
commit790d1239898d4f893112280decd344d90f43ee96 (patch)
treea8ed2d8fedc4d62b28249d84db4c2904f738cbb3 /drivers/ide
parente5f9f5a89a01abc2b9c09747452aeb9218d6bffd (diff)
ide: remove ata_nsector_t, ata_data_t and atapi_bcount_t
Remove ata_nsector_t, ata_data_t (unused) and atapi_bcount_t. While at it: * replace 'HWIF(drive)' by 'hwif' Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-disk.c12
-rw-r--r--drivers/ide/ide-floppy.c37
-rw-r--r--drivers/ide/ide-tape.c35
3 files changed, 42 insertions, 42 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)
787static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) 787static 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);