Commit 9567b349f7e7dd7e2483db99ee8e4a6fe0caca38

Authored by Bartlomiej Zolnierkiewicz
1 parent 92d3ab27e8

ide: merge ->atapi_*put_bytes and ->ata_*put_data methods

* Merge ->atapi_{in,out}put_bytes and ->ata_{in,out}put_data methods
  into new ->{in,out}put_data methods which take number of bytes to
  transfer as an argument and always do padding.

While at it:

* Use 'hwif' or 'drive->hwif' instead of 'HWIF(drive)'.

There should be no functional changes caused by this patch (all users
of ->ata_{in,out}put_data methods were using multiply-of-4 word counts).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Showing 12 changed files with 113 additions and 172 deletions Side-by-side Diff

drivers/ide/cris/ide-cris.c
... ... @@ -673,12 +673,8 @@
673 673 return (unsigned char)cris_ide_inw(reg);
674 674 }
675 675  
676   -static void cris_ide_input_data(ide_drive_t *, struct request *,
677   - void *, unsigned int);
678   -static void cris_ide_output_data(ide_drive_t *, struct request *,
679   - void *, unsigned int);
680   -static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
681   -static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
  676 +static void cris_input_data(ide_drive_t *, struct request *, void *, unsigned);
  677 +static void cris_output_data(ide_drive_t *, struct request *, void *, unsigned);
682 678  
683 679 static void cris_dma_host_set(ide_drive_t *drive, int on)
684 680 {
... ... @@ -816,10 +812,9 @@
816 812 ide_init_port_data(hwif, hwif->index);
817 813 ide_init_port_hw(hwif, &hw);
818 814  
819   - hwif->ata_input_data = &cris_ide_input_data;
820   - hwif->ata_output_data = &cris_ide_output_data;
821   - hwif->atapi_input_bytes = &cris_atapi_input_bytes;
822   - hwif->atapi_output_bytes = &cris_atapi_output_bytes;
  815 + hwif->input_data = cris_input_data;
  816 + hwif->output_data = cris_output_data;
  817 +
823 818 hwif->OUTB = &cris_ide_outb;
824 819 hwif->OUTW = &cris_ide_outw;
825 820 hwif->OUTBSYNC = &cris_ide_outbsync;
826 821  
827 822  
... ... @@ -849,17 +844,16 @@
849 844 static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16)));
850 845  
851 846 /*
852   - * The following routines are mainly used by the ATAPI drivers.
  847 + * This is used for most PIO data transfers *from* the IDE interface
853 848 *
854 849 * These routines will round up any request for an odd number of bytes,
855 850 * so if an odd bytecount is specified, be sure that there's at least one
856 851 * extra byte allocated for the buffer.
857 852 */
858   -static void
859   -cris_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
  853 +static void cris_input_data(ide_drive_t *drive, struct request *rq,
  854 + void *buffer, unsigned int bytecount)
860 855 {
861   - D(printk("atapi_input_bytes, buffer 0x%x, count %d\n",
862   - buffer, bytecount));
  856 + D(printk("input_data, buffer 0x%x, count %d\n", buffer, bytecount));
863 857  
864 858 if(bytecount & 1) {
865 859 printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount);
866 860  
... ... @@ -877,11 +871,13 @@
877 871 LED_DISK_READ(0);
878 872 }
879 873  
880   -static void
881   -cris_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
  874 +/*
  875 + * This is used for most PIO data transfers *to* the IDE interface
  876 + */
  877 +static void cris_output_data(ide_drive_t *drive, struct request *rq,
  878 + void *buffer, unsigned int bytecount)
882 879 {
883   - D(printk("atapi_output_bytes, buffer 0x%x, count %d\n",
884   - buffer, bytecount));
  880 + D(printk("output_data, buffer 0x%x, count %d\n", buffer, bytecount));
885 881  
886 882 if(bytecount & 1) {
887 883 printk("odd bytecount %d in atapi_out_bytes!\n", bytecount);
... ... @@ -897,24 +893,6 @@
897 893 LED_DISK_READ(1);
898 894 cris_ide_wait_dma(0);
899 895 LED_DISK_WRITE(0);
900   -}
901   -
902   -/*
903   - * This is used for most PIO data transfers *from* the IDE interface
904   - */
905   -static void cris_ide_input_data(ide_drive_t *drive, struct request *rq,
906   - void *buffer, unsigned int wcount)
907   -{
908   - cris_atapi_input_bytes(drive, buffer, wcount << 2);
909   -}
910   -
911   -/*
912   - * This is used for most PIO data transfers *to* the IDE interface
913   - */
914   -static void cris_ide_output_data(ide_drive_t *drive, struct request *,
915   - void *buffer, unsigned int wcount)
916   -{
917   - cris_atapi_output_bytes(drive, buffer, wcount << 2);
918 896 }
919 897  
920 898 /* we only have one DMA channel on the chip for ATA, so we can keep these statically */
drivers/ide/ide-cd.c
... ... @@ -613,7 +613,7 @@
613 613 cmd_len = ATAPI_MIN_CDB_BYTES;
614 614  
615 615 /* send the command to the device */
616   - HWIF(drive)->atapi_output_bytes(drive, rq->cmd, cmd_len);
  616 + hwif->output_data(drive, NULL, rq->cmd, cmd_len);
617 617  
618 618 /* start the DMA if need be */
619 619 if (info->dma)
... ... @@ -629,7 +629,7 @@
629 629 {
630 630 while (len > 0) {
631 631 int dum = 0;
632   - xf(drive, &dum, sizeof(dum));
  632 + xf(drive, NULL, &dum, sizeof(dum));
633 633 len -= sizeof(dum);
634 634 }
635 635 }
... ... @@ -639,7 +639,7 @@
639 639 while (nsects > 0) {
640 640 static char dum[SECTOR_SIZE];
641 641  
642   - drive->hwif->atapi_input_bytes(drive, dum, sizeof(dum));
  642 + drive->hwif->input_data(drive, NULL, dum, sizeof(dum));
643 643 nsects--;
644 644 }
645 645 }
... ... @@ -666,7 +666,7 @@
666 666 printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
667 667 drive->name, __func__);
668 668  
669   - xf = rw ? hwif->atapi_output_bytes : hwif->atapi_input_bytes;
  669 + xf = rw ? hwif->output_data : hwif->input_data;
670 670 ide_cd_pad_transfer(drive, xf, len);
671 671 } else if (rw == 0 && ireason == 1) {
672 672 /*
673 673  
... ... @@ -1019,10 +1019,10 @@
1019 1019  
1020 1020 if (ireason == 0) {
1021 1021 write = 1;
1022   - xferfunc = HWIF(drive)->atapi_output_bytes;
  1022 + xferfunc = hwif->output_data;
1023 1023 } else {
1024 1024 write = 0;
1025   - xferfunc = HWIF(drive)->atapi_input_bytes;
  1025 + xferfunc = hwif->input_data;
1026 1026 }
1027 1027  
1028 1028 /* transfer data */
... ... @@ -1061,7 +1061,7 @@
1061 1061 if (blen > thislen)
1062 1062 blen = thislen;
1063 1063  
1064   - xferfunc(drive, ptr, blen);
  1064 + xferfunc(drive, NULL, ptr, blen);
1065 1065  
1066 1066 thislen -= blen;
1067 1067 len -= blen;
drivers/ide/ide-floppy.c
... ... @@ -231,6 +231,7 @@
231 231 static void ide_floppy_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
232 232 unsigned int bcount, int direction)
233 233 {
  234 + ide_hwif_t *hwif = drive->hwif;
234 235 struct request *rq = pc->rq;
235 236 struct req_iterator iter;
236 237 struct bio_vec *bvec;
237 238  
... ... @@ -246,9 +247,9 @@
246 247  
247 248 data = bvec_kmap_irq(bvec, &flags);
248 249 if (direction)
249   - drive->hwif->atapi_output_bytes(drive, data, count);
  250 + hwif->output_data(drive, NULL, data, count);
250 251 else
251   - drive->hwif->atapi_input_bytes(drive, data, count);
  252 + hwif->input_data(drive, NULL, data, count);
252 253 bvec_kunmap_irq(data, &flags);
253 254  
254 255 bcount -= count;
255 256  
256 257  
... ... @@ -503,12 +504,12 @@
503 504 }
504 505 }
505 506 if (pc->flags & PC_FLAG_WRITING)
506   - xferfunc = hwif->atapi_output_bytes;
  507 + xferfunc = hwif->output_data;
507 508 else
508   - xferfunc = hwif->atapi_input_bytes;
  509 + xferfunc = hwif->input_data;
509 510  
510 511 if (pc->buf)
511   - xferfunc(drive, pc->cur_pos, bcount);
  512 + xferfunc(drive, NULL, pc->cur_pos, bcount);
512 513 else
513 514 ide_floppy_io_buffers(drive, pc, bcount,
514 515 !!(pc->flags & PC_FLAG_WRITING));
515 516  
... ... @@ -548,8 +549,10 @@
548 549  
549 550 /* Set the interrupt routine */
550 551 ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
  552 +
551 553 /* Send the actual packet */
552   - HWIF(drive)->atapi_output_bytes(drive, floppy->pc->c, 12);
  554 + hwif->output_data(drive, NULL, floppy->pc->c, 12);
  555 +
553 556 return ide_started;
554 557 }
555 558  
... ... @@ -569,7 +572,8 @@
569 572 idefloppy_floppy_t *floppy = drive->driver_data;
570 573  
571 574 /* Send the actual packet */
572   - HWIF(drive)->atapi_output_bytes(drive, floppy->pc->c, 12);
  575 + drive->hwif->output_data(drive, NULL, floppy->pc->c, 12);
  576 +
573 577 /* Timeout for the packet command */
574 578 return IDEFLOPPY_WAIT_CMD;
575 579 }
drivers/ide/ide-io.c
... ... @@ -422,7 +422,7 @@
422 422 u32 wcount = (i > 16) ? 16 : i;
423 423  
424 424 i -= wcount;
425   - drive->hwif->ata_input_data(drive, NULL, buffer, wcount);
  425 + drive->hwif->input_data(drive, NULL, buffer, wcount * 4);
426 426 }
427 427 }
428 428  
drivers/ide/ide-iops.c
... ... @@ -191,36 +191,47 @@
191 191  
192 192 /*
193 193 * This is used for most PIO data transfers *from* the IDE interface
  194 + *
  195 + * These routines will round up any request for an odd number of bytes,
  196 + * so if an odd len is specified, be sure that there's at least one
  197 + * extra byte allocated for the buffer.
194 198 */
195 199 static void ata_input_data(ide_drive_t *drive, struct request *rq,
196   - void *buffer, u32 wcount)
  200 + void *buf, unsigned int len)
197 201 {
198 202 ide_hwif_t *hwif = drive->hwif;
199 203 struct ide_io_ports *io_ports = &hwif->io_ports;
  204 + unsigned long data_addr = io_ports->data_addr;
200 205 u8 io_32bit = drive->io_32bit;
201 206  
  207 + len++;
  208 +
202 209 if (io_32bit) {
203 210 if (io_32bit & 2) {
204 211 unsigned long flags;
205 212  
206 213 local_irq_save(flags);
207 214 ata_vlb_sync(drive, io_ports->nsect_addr);
208   - hwif->INSL(io_ports->data_addr, buffer, wcount);
  215 + hwif->INSL(data_addr, buf, len / 4);
209 216 local_irq_restore(flags);
210 217 } else
211   - hwif->INSL(io_ports->data_addr, buffer, wcount);
  218 + hwif->INSL(data_addr, buf, len / 4);
  219 +
  220 + if ((len & 3) >= 2)
  221 + hwif->INSW(data_addr, (u8 *)buf + (len & ~3), 1);
212 222 } else
213   - hwif->INSW(io_ports->data_addr, buffer, wcount << 1);
  223 + hwif->INSW(data_addr, buf, len / 2);
214 224 }
215 225  
216 226 /*
217 227 * This is used for most PIO data transfers *to* the IDE interface
218 228 */
219 229 static void ata_output_data(ide_drive_t *drive, struct request *rq,
220   - void *buffer, u32 wcount)
  230 + void *buf, unsigned int len)
221 231 {
222 232 ide_hwif_t *hwif = drive->hwif;
223 233 struct ide_io_ports *io_ports = &hwif->io_ports;
  234 + unsigned long data_addr = io_ports->data_addr;
224 235 u8 io_32bit = drive->io_32bit;
225 236  
226 237 if (io_32bit) {
227 238  
228 239  
229 240  
230 241  
... ... @@ -229,50 +240,21 @@
229 240  
230 241 local_irq_save(flags);
231 242 ata_vlb_sync(drive, io_ports->nsect_addr);
232   - hwif->OUTSL(io_ports->data_addr, buffer, wcount);
  243 + hwif->OUTSL(data_addr, buf, len / 4);
233 244 local_irq_restore(flags);
234 245 } else
235   - hwif->OUTSL(io_ports->data_addr, buffer, wcount);
  246 + hwif->OUTSL(data_addr, buf, len / 4);
  247 +
  248 + if ((len & 3) >= 2)
  249 + hwif->OUTSW(data_addr, (u8 *)buf + (len & ~3), 1);
236 250 } else
237   - hwif->OUTSW(io_ports->data_addr, buffer, wcount << 1);
  251 + hwif->OUTSW(data_addr, buf, len / 2);
238 252 }
239 253  
240   -/*
241   - * The following routines are mainly used by the ATAPI drivers.
242   - *
243   - * These routines will round up any request for an odd number of bytes,
244   - * so if an odd bytecount is specified, be sure that there's at least one
245   - * extra byte allocated for the buffer.
246   - */
247   -
248   -static void atapi_input_bytes(ide_drive_t *drive, void *buffer, u32 bytecount)
249   -{
250   - ide_hwif_t *hwif = HWIF(drive);
251   -
252   - ++bytecount;
253   - hwif->ata_input_data(drive, NULL, buffer, bytecount / 4);
254   - if ((bytecount & 0x03) >= 2)
255   - hwif->INSW(hwif->io_ports.data_addr,
256   - (u8 *)buffer + (bytecount & ~0x03), 1);
257   -}
258   -
259   -static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount)
260   -{
261   - ide_hwif_t *hwif = HWIF(drive);
262   -
263   - ++bytecount;
264   - hwif->ata_output_data(drive, NULL, buffer, bytecount / 4);
265   - if ((bytecount & 0x03) >= 2)
266   - hwif->OUTSW(hwif->io_ports.data_addr,
267   - (u8 *)buffer + (bytecount & ~0x03), 1);
268   -}
269   -
270 254 void default_hwif_transport(ide_hwif_t *hwif)
271 255 {
272   - hwif->ata_input_data = ata_input_data;
273   - hwif->ata_output_data = ata_output_data;
274   - hwif->atapi_input_bytes = atapi_input_bytes;
275   - hwif->atapi_output_bytes = atapi_output_bytes;
  256 + hwif->input_data = ata_input_data;
  257 + hwif->output_data = ata_output_data;
276 258 }
277 259  
278 260 void ide_fix_driveid (struct hd_driveid *id)
... ... @@ -656,7 +638,7 @@
656 638 local_irq_restore(flags);
657 639 return 0;
658 640 }
659   - hwif->ata_input_data(drive, NULL, id, SECTOR_WORDS);
  641 + hwif->input_data(drive, NULL, id, SECTOR_SIZE);
660 642 (void)ide_read_status(drive); /* clear drive IRQ */
661 643 local_irq_enable();
662 644 local_irq_restore(flags);
drivers/ide/ide-probe.c
... ... @@ -124,7 +124,7 @@
124 124  
125 125 id = drive->id;
126 126 /* read 512 bytes of id info */
127   - hwif->ata_input_data(drive, NULL, id, SECTOR_WORDS);
  127 + hwif->input_data(drive, NULL, id, SECTOR_SIZE);
128 128  
129 129 drive->id_read = 1;
130 130 local_irq_enable();
drivers/ide/ide-tape.c
... ... @@ -401,7 +401,7 @@
401 401 count = min(
402 402 (unsigned int)(bh->b_size - atomic_read(&bh->b_count)),
403 403 bcount);
404   - HWIF(drive)->atapi_input_bytes(drive, bh->b_data +
  404 + drive->hwif->input_data(drive, NULL, bh->b_data +
405 405 atomic_read(&bh->b_count), count);
406 406 bcount -= count;
407 407 atomic_add(count, &bh->b_count);
... ... @@ -427,7 +427,7 @@
427 427 return;
428 428 }
429 429 count = min((unsigned int)pc->b_count, (unsigned int)bcount);
430   - HWIF(drive)->atapi_output_bytes(drive, pc->b_data, count);
  430 + drive->hwif->output_data(drive, NULL, pc->b_data, count);
431 431 bcount -= count;
432 432 pc->b_data += count;
433 433 pc->b_count -= count;
434 434  
435 435  
... ... @@ -880,16 +880,16 @@
880 880 "data than expected - allowing transfer\n");
881 881 }
882 882 iobuf = &idetape_input_buffers;
883   - xferfunc = hwif->atapi_input_bytes;
  883 + xferfunc = hwif->input_data;
884 884 } else {
885 885 iobuf = &idetape_output_buffers;
886   - xferfunc = hwif->atapi_output_bytes;
  886 + xferfunc = hwif->output_data;
887 887 }
888 888  
889 889 if (pc->bh)
890 890 iobuf(drive, pc, bcount);
891 891 else
892   - xferfunc(drive, pc->cur_pos, bcount);
  892 + xferfunc(drive, NULL, pc->cur_pos, bcount);
893 893  
894 894 /* Update the current position */
895 895 pc->xferred += bcount;
... ... @@ -979,7 +979,8 @@
979 979 hwif->dma_ops->dma_start(drive);
980 980 #endif
981 981 /* Send the actual packet */
982   - HWIF(drive)->atapi_output_bytes(drive, pc->c, 12);
  982 + hwif->output_data(drive, NULL, pc->c, 12);
  983 +
983 984 return ide_started;
984 985 }
985 986  
drivers/ide/ide-taskfile.c
... ... @@ -324,9 +324,9 @@
324 324  
325 325 /* do the actual data transfer */
326 326 if (write)
327   - hwif->ata_output_data(drive, rq, buf, SECTOR_WORDS);
  327 + hwif->output_data(drive, rq, buf, SECTOR_SIZE);
328 328 else
329   - hwif->ata_input_data(drive, rq, buf, SECTOR_WORDS);
  329 + hwif->input_data(drive, rq, buf, SECTOR_SIZE);
330 330  
331 331 kunmap_atomic(buf, KM_BIO_SRC_IRQ);
332 332 #ifdef CONFIG_HIGHMEM
drivers/ide/legacy/falconide.c
... ... @@ -44,34 +44,26 @@
44 44 int falconide_intr_lock;
45 45 EXPORT_SYMBOL(falconide_intr_lock);
46 46  
47   -static void falconide_atapi_input_bytes(ide_drive_t *drive, void *buf,
48   - unsigned int len)
  47 +static void falconide_input_data(ide_drive_t *drive, struct request *rq,
  48 + void *buf, unsigned int len)
49 49 {
50   - insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
51   -}
  50 + unsigned long data_addr = drive->hwif->io_ports.data_addr;
52 51  
53   -static void falconide_atapi_output_bytes(ide_drive_t *drive, void *buf,
54   - unsigned int len)
55   -{
56   - outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
57   -}
58   -
59   -static void falconide_ata_input_data(ide_drive_t *drive, struct request *rq,
60   - void *buf, unsigned int wcount)
61   -{
62 52 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
63   - return insw(drive->hwif->io_ports.data_addr, buf, wcount * 2);
  53 + return insw(data_addr, buf, (len + 1) / 2);
64 54  
65   - falconide_atapi_input_bytes(drive, buf, wcount * 4);
  55 + insw_swapw(data_addr, buf, (len + 1) / 2);
66 56 }
67 57  
68   -static void falconide_ata_output_data(ide_drive_t *drive, struct request *rq,
69   - void *buf, unsigned int wcount)
  58 +static void falconide_output_data(ide_drive_t *drive, struct request *rq,
  59 + void *buf, unsigned int len)
70 60 {
  61 + unsigned long data_addr = drive->hwif->io_ports.data_addr;
  62 +
71 63 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
72   - return outsw(drive->hwif->io_ports.data_addr, buf, wcount * 2);
  64 + return outsw(data_adr, buf, (len + 1) / 2);
73 65  
74   - falconide_atapi_output_bytes(drive, buf, wcount * 4);
  66 + outsw_swapw(data_addr, buf, (len + 1) / 2);
75 67 }
76 68  
77 69 static void __init falconide_setup_ports(hw_regs_t *hw)
... ... @@ -121,10 +113,8 @@
121 113 ide_init_port_hw(hwif, &hw);
122 114  
123 115 /* Atari has a byte-swapped IDE interface */
124   - hwif->atapi_input_bytes = falconide_atapi_input_bytes;
125   - hwif->atapi_output_bytes = falconide_atapi_output_bytes;
126   - hwif->ata_input_data = falconide_ata_input_data;
127   - hwif->ata_output_data = falconide_ata_output_data;
  116 + hwif->input_data = falconide_input_data;
  117 + hwif->output_data = falconide_output_data;
128 118  
129 119 ide_get_lock(NULL, NULL);
130 120 ide_device_add(idx, NULL);
drivers/ide/legacy/q40ide.c
... ... @@ -72,34 +72,26 @@
72 72 hw->ack_intr = ack_intr;
73 73 }
74 74  
75   -static void q40ide_atapi_input_bytes(ide_drive_t *drive, void *buf,
76   - unsigned int len)
  75 +static void q40ide_input_data(ide_drive_t *drive, struct request *rq,
  76 + void *buf, unsigned int len)
77 77 {
78   - insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
79   -}
  78 + unsigned long data_addr = drive->hwif->io_ports.data_addr;
80 79  
81   -static void q40ide_atapi_output_bytes(ide_drive_t *drive, void *buf,
82   - unsigned int len)
83   -{
84   - outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
85   -}
86   -
87   -static void q40ide_ata_input_data(ide_drive_t *drive, struct request *rq,
88   - void *buf, unsigned int wcount)
89   -{
90 80 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
91   - return insw(drive->hwif->io_ports.data_addr, buf, wcount * 2);
  81 + return insw(data_addr, buf, (len + 1) / 2);
92 82  
93   - q40ide_atapi_input_bytes(drive, buf, wcount * 4);
  83 + insw_swapw(data_addr, buf, (len + 1) / 2);
94 84 }
95 85  
96   -static void q40ide_ata_output_data(ide_drive_t *drive, struct request *rq,
97   - void *buf, unsigned int wcount)
  86 +static void q40ide_output_data(ide_drive_t *drive, struct request *rq,
  87 + void *buf, unsigned int len)
98 88 {
  89 + unsigned long data_addr = drive->hwif->io_ports.data_addr;
  90 +
99 91 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
100   - return outsw(drive->hwif->io_ports.data_addr, buf, wcount * 2);
  92 + return outsw(data_addr, buf, (len + 1) / 2);
101 93  
102   - q40ide_atapi_output_bytes(drive, buf, wcount * 4);
  94 + outsw_swapw(data_addr, buf, (len + 1) / 2);
103 95 }
104 96  
105 97 /*
... ... @@ -152,10 +144,8 @@
152 144 ide_init_port_hw(hwif, &hw);
153 145  
154 146 /* Q40 has a byte-swapped IDE interface */
155   - hwif->atapi_input_bytes = q40ide_atapi_input_bytes;
156   - hwif->atapi_output_bytes = q40ide_atapi_output_bytes;
157   - hwif->ata_input_data = q40ide_ata_input_data;
158   - hwif->ata_output_data = q40ide_ata_output_data;
  147 + hwif->input_data = q40ide_input_data;
  148 + hwif->output_data = q40ide_output_data;
159 149  
160 150 idx[i] = hwif->index;
161 151 }
drivers/scsi/ide-scsi.c
... ... @@ -134,6 +134,7 @@
134 134 static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
135 135 unsigned int bcount)
136 136 {
  137 + ide_hwif_t *hwif = drive->hwif;
137 138 int count;
138 139 char *buf;
139 140  
140 141  
... ... @@ -145,14 +146,12 @@
145 146 local_irq_save(flags);
146 147 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
147 148 pc->sg->offset;
148   - drive->hwif->atapi_input_bytes(drive,
149   - buf + pc->b_count, count);
  149 + hwif->input_data(drive, NULL, buf + pc->b_count, count);
150 150 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
151 151 local_irq_restore(flags);
152 152 } else {
153 153 buf = sg_virt(pc->sg);
154   - drive->hwif->atapi_input_bytes(drive,
155   - buf + pc->b_count, count);
  154 + hwif->input_data(drive, NULL, buf + pc->b_count, count);
156 155 }
157 156 bcount -= count; pc->b_count += count;
158 157 if (pc->b_count == pc->sg->length) {
... ... @@ -172,6 +171,7 @@
172 171 static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
173 172 unsigned int bcount)
174 173 {
  174 + ide_hwif_t *hwif = drive->hwif;
175 175 int count;
176 176 char *buf;
177 177  
178 178  
... ... @@ -183,14 +183,12 @@
183 183 local_irq_save(flags);
184 184 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
185 185 pc->sg->offset;
186   - drive->hwif->atapi_output_bytes(drive,
187   - buf + pc->b_count, count);
  186 + hwif->output_data(drive, NULL, buf + pc->b_count, count);
188 187 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
189 188 local_irq_restore(flags);
190 189 } else {
191 190 buf = sg_virt(pc->sg);
192   - drive->hwif->atapi_output_bytes(drive,
193   - buf + pc->b_count, count);
  191 + hwif->output_data(drive, NULL, buf + pc->b_count, count);
194 192 }
195 193 bcount -= count; pc->b_count += count;
196 194 if (pc->b_count == pc->sg->length) {
... ... @@ -431,7 +429,8 @@
431 429 idescsi_input_buffers(drive, pc,
432 430 temp);
433 431 else
434   - drive->hwif->atapi_input_bytes(drive, pc->cur_pos, temp);
  432 + hwif->input_data(drive, NULL,
  433 + pc->cur_pos, temp);
435 434 printk(KERN_ERR "ide-scsi: transferred"
436 435 " %d of %d bytes\n",
437 436 temp, bcount);
438 437  
... ... @@ -452,15 +451,13 @@
452 451 if (pc->sg)
453 452 idescsi_input_buffers(drive, pc, bcount);
454 453 else
455   - hwif->atapi_input_bytes(drive, pc->cur_pos,
456   - bcount);
  454 + hwif->input_data(drive, NULL, pc->cur_pos, bcount);
457 455 } else {
458 456 pc->flags |= PC_FLAG_WRITING;
459 457 if (pc->sg)
460 458 idescsi_output_buffers(drive, pc, bcount);
461 459 else
462   - hwif->atapi_output_bytes(drive, pc->cur_pos,
463   - bcount);
  460 + hwif->output_data(drive, NULL, pc->cur_pos, bcount);
464 461 }
465 462 /* Update the current position */
466 463 pc->xferred += bcount;
467 464  
... ... @@ -493,8 +490,10 @@
493 490 BUG_ON(HWGROUP(drive)->handler != NULL);
494 491 /* Set the interrupt routine */
495 492 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
  493 +
496 494 /* Send the actual packet */
497   - drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12);
  495 + hwif->output_data(drive, NULL, scsi->pc->c, 12);
  496 +
498 497 if (pc->flags & PC_FLAG_DMA_OK) {
499 498 pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
500 499 hwif->dma_ops->dma_start(drive);
... ... @@ -467,12 +467,9 @@
467 467 const struct ide_port_ops *port_ops;
468 468 const struct ide_dma_ops *dma_ops;
469 469  
470   - void (*ata_input_data)(ide_drive_t *, struct request *, void *, u32);
471   - void (*ata_output_data)(ide_drive_t *, struct request *, void *, u32);
  470 + void (*input_data)(ide_drive_t *, struct request *, void *, unsigned);
  471 + void (*output_data)(ide_drive_t *, struct request *, void *, unsigned);
472 472  
473   - void (*atapi_input_bytes)(ide_drive_t *, void *, u32);
474   - void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
475   -
476 473 void (*ide_dma_clear_irq)(ide_drive_t *drive);
477 474  
478 475 void (*OUTB)(u8 addr, unsigned long port);
... ... @@ -547,7 +544,7 @@
547 544 typedef int (ide_expiry_t)(ide_drive_t *);
548 545  
549 546 /* used by ide-cd, ide-floppy, etc. */
550   -typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
  547 +typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned);
551 548  
552 549 typedef struct hwgroup_s {
553 550 /* irq handler, if active */
... ... @@ -1369,7 +1366,7 @@
1369 1366 {
1370 1367 ide_hwif_t *hwif = drive->hwif;
1371 1368  
1372   - /* FIXME: use ->atapi_input_bytes */
  1369 + /* FIXME: use ->input_data */
1373 1370 while (bcount--)
1374 1371 (void)hwif->INB(hwif->io_ports.data_addr);
1375 1372 }
... ... @@ -1378,7 +1375,7 @@
1378 1375 {
1379 1376 ide_hwif_t *hwif = drive->hwif;
1380 1377  
1381   - /* FIXME: use ->atapi_output_bytes */
  1378 + /* FIXME: use ->output_data */
1382 1379 while (bcount--)
1383 1380 hwif->OUTB(0, hwif->io_ports.data_addr);
1384 1381 }