aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:38 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:38 -0400
commitadb1af9803d167091c2cb4de14014185054bfe2c (patch)
treeaeac3bd825abfb344b1b1b43e282756fb8069f49 /drivers/ide
parent22aa4b32a19b1f231d4ce7e9af6354b577a22a35 (diff)
ide: pass command instead of request to ide_pio_datablock()
* Add IDE_TFLAG_FS taskfile flag and set it for REQ_TYPE_FS requests. * Convert ->{in,out}put_data methods to take command instead of request as an argument. Then convert pre_task_out_intr(), task_end_request(), task_error(), task_in_unexpected(), ide_pio_sector(), ide_pio_multi() and ide_pio_datablock() in similar way. * Rename task_end_request() to ide_finish_cmd(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/at91_ide.c4
-rw-r--r--drivers/ide/au1xxx-ide.c4
-rw-r--r--drivers/ide/falconide.c8
-rw-r--r--drivers/ide/ide-disk.c2
-rw-r--r--drivers/ide/ide-dma.c4
-rw-r--r--drivers/ide/ide-h8300.c4
-rw-r--r--drivers/ide/ide-io-std.c4
-rw-r--r--drivers/ide/ide-taskfile.c88
-rw-r--r--drivers/ide/q40ide.c8
-rw-r--r--drivers/ide/scc_pata.c4
-rw-r--r--drivers/ide/tx4938ide.c4
11 files changed, 67 insertions, 67 deletions
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
index 6be7d87382ab..27547121daff 100644
--- a/drivers/ide/at91_ide.c
+++ b/drivers/ide/at91_ide.c
@@ -143,7 +143,7 @@ static void apply_timings(const u8 chipselect, const u8 pio,
143 set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy); 143 set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy);
144} 144}
145 145
146static void at91_ide_input_data(ide_drive_t *drive, struct request *rq, 146static void at91_ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
147 void *buf, unsigned int len) 147 void *buf, unsigned int len)
148{ 148{
149 ide_hwif_t *hwif = drive->hwif; 149 ide_hwif_t *hwif = drive->hwif;
@@ -160,7 +160,7 @@ static void at91_ide_input_data(ide_drive_t *drive, struct request *rq,
160 leave_16bit(chipselect, mode); 160 leave_16bit(chipselect, mode);
161} 161}
162 162
163static void at91_ide_output_data(ide_drive_t *drive, struct request *rq, 163static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
164 void *buf, unsigned int len) 164 void *buf, unsigned int len)
165{ 165{
166 ide_hwif_t *hwif = drive->hwif; 166 ide_hwif_t *hwif = drive->hwif;
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c
index 3fc3ced8192c..72d7d615e1fc 100644
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -86,13 +86,13 @@ void auide_outsw(unsigned long port, void *addr, u32 count)
86 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); 86 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
87} 87}
88 88
89static void au1xxx_input_data(ide_drive_t *drive, struct request *rq, 89static void au1xxx_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
90 void *buf, unsigned int len) 90 void *buf, unsigned int len)
91{ 91{
92 auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 92 auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
93} 93}
94 94
95static void au1xxx_output_data(ide_drive_t *drive, struct request *rq, 95static void au1xxx_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
96 void *buf, unsigned int len) 96 void *buf, unsigned int len)
97{ 97{
98 auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 98 auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
index 6085feb1fae8..b368a5effc3a 100644
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -62,23 +62,23 @@ static void falconide_get_lock(irq_handler_t handler, void *data)
62 } 62 }
63} 63}
64 64
65static void falconide_input_data(ide_drive_t *drive, struct request *rq, 65static void falconide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
66 void *buf, unsigned int len) 66 void *buf, unsigned int len)
67{ 67{
68 unsigned long data_addr = drive->hwif->io_ports.data_addr; 68 unsigned long data_addr = drive->hwif->io_ports.data_addr;
69 69
70 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 70 if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS))
71 return insw(data_addr, buf, (len + 1) / 2); 71 return insw(data_addr, buf, (len + 1) / 2);
72 72
73 raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); 73 raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
74} 74}
75 75
76static void falconide_output_data(ide_drive_t *drive, struct request *rq, 76static void falconide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
77 void *buf, unsigned int len) 77 void *buf, unsigned int len)
78{ 78{
79 unsigned long data_addr = drive->hwif->io_ports.data_addr; 79 unsigned long data_addr = drive->hwif->io_ports.data_addr;
80 80
81 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 81 if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS))
82 return outsw(data_addr, buf, (len + 1) / 2); 82 return outsw(data_addr, buf, (len + 1) / 2);
83 83
84 raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); 84 raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 6647cb8bd910..f1555dd4e6a5 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -156,6 +156,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
156 tf->device = head; 156 tf->device = head;
157 } 157 }
158 158
159 cmd.tf_flags |= IDE_TFLAG_FS;
160
159 if (rq_data_dir(rq)) 161 if (rq_data_dir(rq))
160 cmd.tf_flags |= IDE_TFLAG_WRITE; 162 cmd.tf_flags |= IDE_TFLAG_WRITE;
161 163
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 12c11b71402e..54f17ae9225d 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -96,9 +96,9 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive)
96 96
97 if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) { 97 if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) {
98 if (!dma_stat) { 98 if (!dma_stat) {
99 struct request *rq = hwif->rq; 99 struct ide_cmd *cmd = &hwif->cmd;
100 100
101 task_end_request(drive, rq, stat); 101 ide_finish_cmd(drive, cmd, stat);
102 return ide_stopped; 102 return ide_stopped;
103 } 103 }
104 printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n", 104 printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n",
diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c
index c7883f23c66a..ff8339ed59ab 100644
--- a/drivers/ide/ide-h8300.c
+++ b/drivers/ide/ide-h8300.c
@@ -143,13 +143,13 @@ static void mm_insw(unsigned long addr, void *buf, u32 len)
143 *bp = bswap(*(volatile u16 *)addr); 143 *bp = bswap(*(volatile u16 *)addr);
144} 144}
145 145
146static void h8300_input_data(ide_drive_t *drive, struct request *rq, 146static void h8300_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
147 void *buf, unsigned int len) 147 void *buf, unsigned int len)
148{ 148{
149 mm_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 149 mm_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
150} 150}
151 151
152static void h8300_output_data(ide_drive_t *drive, struct request *rq, 152static void h8300_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
153 void *buf, unsigned int len) 153 void *buf, unsigned int len)
154{ 154{
155 mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 155 mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c
index 570c0cc4514d..2d9c6dc3f956 100644
--- a/drivers/ide/ide-io-std.c
+++ b/drivers/ide/ide-io-std.c
@@ -219,7 +219,7 @@ static void ata_vlb_sync(unsigned long port)
219 * so if an odd len is specified, be sure that there's at least one 219 * so if an odd len is specified, be sure that there's at least one
220 * extra byte allocated for the buffer. 220 * extra byte allocated for the buffer.
221 */ 221 */
222void ide_input_data(ide_drive_t *drive, struct request *rq, void *buf, 222void ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf,
223 unsigned int len) 223 unsigned int len)
224{ 224{
225 ide_hwif_t *hwif = drive->hwif; 225 ide_hwif_t *hwif = drive->hwif;
@@ -265,7 +265,7 @@ EXPORT_SYMBOL_GPL(ide_input_data);
265/* 265/*
266 * This is used for most PIO data transfers *to* the IDE interface 266 * This is used for most PIO data transfers *to* the IDE interface
267 */ 267 */
268void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf, 268void ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf,
269 unsigned int len) 269 unsigned int len)
270{ 270{
271 ide_hwif_t *hwif = drive->hwif; 271 ide_hwif_t *hwif = drive->hwif;
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 2b85c137764a..d3bd93afbf2b 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -54,19 +54,20 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
54} 54}
55 55
56static ide_startstop_t task_no_data_intr(ide_drive_t *); 56static ide_startstop_t task_no_data_intr(ide_drive_t *);
57static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *); 57static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct ide_cmd *);
58static ide_startstop_t task_in_intr(ide_drive_t *); 58static ide_startstop_t task_in_intr(ide_drive_t *);
59 59
60ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) 60ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
61{ 61{
62 ide_hwif_t *hwif = drive->hwif; 62 ide_hwif_t *hwif = drive->hwif;
63 struct ide_cmd *cmd = &hwif->cmd;
63 struct ide_taskfile *tf = &cmd->tf; 64 struct ide_taskfile *tf = &cmd->tf;
64 ide_handler_t *handler = NULL; 65 ide_handler_t *handler = NULL;
65 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 66 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
66 const struct ide_dma_ops *dma_ops = hwif->dma_ops; 67 const struct ide_dma_ops *dma_ops = hwif->dma_ops;
67 68
68 if (cmd->data_phase == TASKFILE_MULTI_IN || 69 if (orig_cmd->data_phase == TASKFILE_MULTI_IN ||
69 cmd->data_phase == TASKFILE_MULTI_OUT) { 70 orig_cmd->data_phase == TASKFILE_MULTI_OUT) {
70 if (!drive->mult_count) { 71 if (!drive->mult_count) {
71 printk(KERN_ERR "%s: multimode not set!\n", 72 printk(KERN_ERR "%s: multimode not set!\n",
72 drive->name); 73 drive->name);
@@ -74,10 +75,10 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
74 } 75 }
75 } 76 }
76 77
77 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 78 if (orig_cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
78 cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS; 79 orig_cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS;
79 80
80 memcpy(&hwif->cmd, cmd, sizeof(*cmd)); 81 memcpy(cmd, orig_cmd, sizeof(*cmd));
81 82
82 if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { 83 if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
83 ide_tf_dump(drive->name, tf); 84 ide_tf_dump(drive->name, tf);
@@ -91,7 +92,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
91 case TASKFILE_OUT: 92 case TASKFILE_OUT:
92 tp_ops->exec_command(hwif, tf->command); 93 tp_ops->exec_command(hwif, tf->command);
93 ndelay(400); /* FIXME */ 94 ndelay(400); /* FIXME */
94 return pre_task_out_intr(drive, cmd->rq); 95 return pre_task_out_intr(drive, cmd);
95 case TASKFILE_MULTI_IN: 96 case TASKFILE_MULTI_IN:
96 case TASKFILE_IN: 97 case TASKFILE_IN:
97 handler = task_in_intr; 98 handler = task_in_intr;
@@ -203,7 +204,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
203 return stat; 204 return stat;
204} 205}
205 206
206static void ide_pio_sector(ide_drive_t *drive, struct request *rq, 207static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd,
207 unsigned int write) 208 unsigned int write)
208{ 209{
209 ide_hwif_t *hwif = drive->hwif; 210 ide_hwif_t *hwif = drive->hwif;
@@ -244,9 +245,9 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq,
244 245
245 /* do the actual data transfer */ 246 /* do the actual data transfer */
246 if (write) 247 if (write)
247 hwif->tp_ops->output_data(drive, rq, buf, SECTOR_SIZE); 248 hwif->tp_ops->output_data(drive, cmd, buf, SECTOR_SIZE);
248 else 249 else
249 hwif->tp_ops->input_data(drive, rq, buf, SECTOR_SIZE); 250 hwif->tp_ops->input_data(drive, cmd, buf, SECTOR_SIZE);
250 251
251 kunmap_atomic(buf, KM_BIO_SRC_IRQ); 252 kunmap_atomic(buf, KM_BIO_SRC_IRQ);
252#ifdef CONFIG_HIGHMEM 253#ifdef CONFIG_HIGHMEM
@@ -254,24 +255,23 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq,
254#endif 255#endif
255} 256}
256 257
257static void ide_pio_multi(ide_drive_t *drive, struct request *rq, 258static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd,
258 unsigned int write) 259 unsigned int write)
259{ 260{
260 unsigned int nsect; 261 unsigned int nsect;
261 262
262 nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); 263 nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count);
263 while (nsect--) 264 while (nsect--)
264 ide_pio_sector(drive, rq, write); 265 ide_pio_sector(drive, cmd, write);
265} 266}
266 267
267static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, 268static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
268 unsigned int write) 269 unsigned int write)
269{ 270{
270 struct ide_cmd *cmd = &drive->hwif->cmd;
271 u8 saved_io_32bit = drive->io_32bit; 271 u8 saved_io_32bit = drive->io_32bit;
272 272
273 if (blk_fs_request(rq)) 273 if (cmd->tf_flags & IDE_TFLAG_FS)
274 rq->errors = 0; 274 cmd->rq->errors = 0;
275 275
276 if (cmd->tf_flags & IDE_TFLAG_IO_16BIT) 276 if (cmd->tf_flags & IDE_TFLAG_IO_16BIT)
277 drive->io_32bit = 0; 277 drive->io_32bit = 0;
@@ -281,22 +281,21 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq,
281 switch (cmd->data_phase) { 281 switch (cmd->data_phase) {
282 case TASKFILE_MULTI_IN: 282 case TASKFILE_MULTI_IN:
283 case TASKFILE_MULTI_OUT: 283 case TASKFILE_MULTI_OUT:
284 ide_pio_multi(drive, rq, write); 284 ide_pio_multi(drive, cmd, write);
285 break; 285 break;
286 default: 286 default:
287 ide_pio_sector(drive, rq, write); 287 ide_pio_sector(drive, cmd, write);
288 break; 288 break;
289 } 289 }
290 290
291 drive->io_32bit = saved_io_32bit; 291 drive->io_32bit = saved_io_32bit;
292} 292}
293 293
294static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, 294static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd,
295 const char *s, u8 stat) 295 const char *s, u8 stat)
296{ 296{
297 if (blk_fs_request(rq)) { 297 if (cmd->tf_flags & IDE_TFLAG_FS) {
298 ide_hwif_t *hwif = drive->hwif; 298 ide_hwif_t *hwif = drive->hwif;
299 struct ide_cmd *cmd = &hwif->cmd;
300 int sectors = hwif->nsect - hwif->nleft; 299 int sectors = hwif->nsect - hwif->nleft;
301 300
302 switch (cmd->data_phase) { 301 switch (cmd->data_phase) {
@@ -323,19 +322,17 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
323 return ide_error(drive, s, stat); 322 return ide_error(drive, s, stat);
324} 323}
325 324
326void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) 325void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat)
327{ 326{
328 if (blk_fs_request(rq) == 0) { 327 if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) {
329 struct ide_cmd *cmd = rq->special;
330 u8 err = ide_read_error(drive); 328 u8 err = ide_read_error(drive);
331 329
332 if (cmd) 330 ide_complete_cmd(drive, cmd, stat, err);
333 ide_complete_cmd(drive, cmd, stat, err);
334 ide_complete_rq(drive, err); 331 ide_complete_rq(drive, err);
335 return; 332 return;
336 } 333 }
337 334
338 ide_end_request(drive, 1, rq->nr_sectors); 335 ide_end_request(drive, 1, cmd->rq->nr_sectors);
339} 336}
340 337
341/* 338/*
@@ -344,11 +341,12 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
344 * It might be a spurious irq (shared irq), but it might be a 341 * It might be a spurious irq (shared irq), but it might be a
345 * command that had no output. 342 * command that had no output.
346 */ 343 */
347static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq, u8 stat) 344static ide_startstop_t task_in_unexpected(ide_drive_t *drive,
345 struct ide_cmd *cmd, u8 stat)
348{ 346{
349 /* Command all done? */ 347 /* Command all done? */
350 if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) { 348 if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) {
351 task_end_request(drive, rq, stat); 349 ide_finish_cmd(drive, cmd, stat);
352 return ide_stopped; 350 return ide_stopped;
353 } 351 }
354 352
@@ -363,25 +361,25 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq
363static ide_startstop_t task_in_intr(ide_drive_t *drive) 361static ide_startstop_t task_in_intr(ide_drive_t *drive)
364{ 362{
365 ide_hwif_t *hwif = drive->hwif; 363 ide_hwif_t *hwif = drive->hwif;
366 struct request *rq = hwif->rq; 364 struct ide_cmd *cmd = &drive->hwif->cmd;
367 u8 stat = hwif->tp_ops->read_status(hwif); 365 u8 stat = hwif->tp_ops->read_status(hwif);
368 366
369 /* Error? */ 367 /* Error? */
370 if (stat & ATA_ERR) 368 if (stat & ATA_ERR)
371 return task_error(drive, rq, __func__, stat); 369 return task_error(drive, cmd, __func__, stat);
372 370
373 /* Didn't want any data? Odd. */ 371 /* Didn't want any data? Odd. */
374 if ((stat & ATA_DRQ) == 0) 372 if ((stat & ATA_DRQ) == 0)
375 return task_in_unexpected(drive, rq, stat); 373 return task_in_unexpected(drive, cmd, stat);
376 374
377 ide_pio_datablock(drive, rq, 0); 375 ide_pio_datablock(drive, cmd, 0);
378 376
379 /* Are we done? Check status and finish transfer. */ 377 /* Are we done? Check status and finish transfer. */
380 if (!hwif->nleft) { 378 if (!hwif->nleft) {
381 stat = wait_drive_not_busy(drive); 379 stat = wait_drive_not_busy(drive);
382 if (!OK_STAT(stat, 0, BAD_STAT)) 380 if (!OK_STAT(stat, 0, BAD_STAT))
383 return task_error(drive, rq, __func__, stat); 381 return task_error(drive, cmd, __func__, stat);
384 task_end_request(drive, rq, stat); 382 ide_finish_cmd(drive, cmd, stat);
385 return ide_stopped; 383 return ide_stopped;
386 } 384 }
387 385
@@ -397,31 +395,31 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive)
397static ide_startstop_t task_out_intr (ide_drive_t *drive) 395static ide_startstop_t task_out_intr (ide_drive_t *drive)
398{ 396{
399 ide_hwif_t *hwif = drive->hwif; 397 ide_hwif_t *hwif = drive->hwif;
400 struct request *rq = hwif->rq; 398 struct ide_cmd *cmd = &drive->hwif->cmd;
401 u8 stat = hwif->tp_ops->read_status(hwif); 399 u8 stat = hwif->tp_ops->read_status(hwif);
402 400
403 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) 401 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
404 return task_error(drive, rq, __func__, stat); 402 return task_error(drive, cmd, __func__, stat);
405 403
406 /* Deal with unexpected ATA data phase. */ 404 /* Deal with unexpected ATA data phase. */
407 if (((stat & ATA_DRQ) == 0) ^ !hwif->nleft) 405 if (((stat & ATA_DRQ) == 0) ^ !hwif->nleft)
408 return task_error(drive, rq, __func__, stat); 406 return task_error(drive, cmd, __func__, stat);
409 407
410 if (!hwif->nleft) { 408 if (!hwif->nleft) {
411 task_end_request(drive, rq, stat); 409 ide_finish_cmd(drive, cmd, stat);
412 return ide_stopped; 410 return ide_stopped;
413 } 411 }
414 412
415 /* Still data left to transfer. */ 413 /* Still data left to transfer. */
416 ide_pio_datablock(drive, rq, 1); 414 ide_pio_datablock(drive, cmd, 1);
417 ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); 415 ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL);
418 416
419 return ide_started; 417 return ide_started;
420} 418}
421 419
422static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) 420static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,
421 struct ide_cmd *cmd)
423{ 422{
424 struct ide_cmd *cmd = &drive->hwif->cmd;
425 ide_startstop_t startstop; 423 ide_startstop_t startstop;
426 424
427 if (ide_wait_stat(&startstop, drive, ATA_DRQ, 425 if (ide_wait_stat(&startstop, drive, ATA_DRQ,
@@ -437,7 +435,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
437 local_irq_disable(); 435 local_irq_disable();
438 436
439 ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); 437 ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL);
440 ide_pio_datablock(drive, rq, 1); 438 ide_pio_datablock(drive, cmd, 1);
441 439
442 return ide_started; 440 return ide_started;
443} 441}
diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c
index 32f669d656a6..2a43a2f49633 100644
--- a/drivers/ide/q40ide.c
+++ b/drivers/ide/q40ide.c
@@ -72,23 +72,23 @@ static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base,
72 hw->chipset = ide_generic; 72 hw->chipset = ide_generic;
73} 73}
74 74
75static void q40ide_input_data(ide_drive_t *drive, struct request *rq, 75static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
76 void *buf, unsigned int len) 76 void *buf, unsigned int len)
77{ 77{
78 unsigned long data_addr = drive->hwif->io_ports.data_addr; 78 unsigned long data_addr = drive->hwif->io_ports.data_addr;
79 79
80 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 80 if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS))
81 return insw(data_addr, buf, (len + 1) / 2); 81 return insw(data_addr, buf, (len + 1) / 2);
82 82
83 raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); 83 raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
84} 84}
85 85
86static void q40ide_output_data(ide_drive_t *drive, struct request *rq, 86static void q40ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
87 void *buf, unsigned int len) 87 void *buf, unsigned int len)
88{ 88{
89 unsigned long data_addr = drive->hwif->io_ports.data_addr; 89 unsigned long data_addr = drive->hwif->io_ports.data_addr;
90 90
91 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 91 if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS))
92 return outsw(data_addr, buf, (len + 1) / 2); 92 return outsw(data_addr, buf, (len + 1) / 2);
93 93
94 raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); 94 raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index d6336753bd2c..ada866744622 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -750,7 +750,7 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
750 } 750 }
751} 751}
752 752
753static void scc_input_data(ide_drive_t *drive, struct request *rq, 753static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
754 void *buf, unsigned int len) 754 void *buf, unsigned int len)
755{ 755{
756 unsigned long data_addr = drive->hwif->io_ports.data_addr; 756 unsigned long data_addr = drive->hwif->io_ports.data_addr;
@@ -766,7 +766,7 @@ static void scc_input_data(ide_drive_t *drive, struct request *rq,
766 scc_ide_insw(data_addr, buf, len / 2); 766 scc_ide_insw(data_addr, buf, len / 2);
767} 767}
768 768
769static void scc_output_data(ide_drive_t *drive, struct request *rq, 769static void scc_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
770 void *buf, unsigned int len) 770 void *buf, unsigned int len)
771{ 771{
772 unsigned long data_addr = drive->hwif->io_ports.data_addr; 772 unsigned long data_addr = drive->hwif->io_ports.data_addr;
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index 947596d3620c..657a61890b1c 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -174,7 +174,7 @@ static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
174 } 174 }
175} 175}
176 176
177static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq, 177static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd,
178 void *buf, unsigned int len) 178 void *buf, unsigned int len)
179{ 179{
180 unsigned long port = drive->hwif->io_ports.data_addr; 180 unsigned long port = drive->hwif->io_ports.data_addr;
@@ -186,7 +186,7 @@ static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq,
186 __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); 186 __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2));
187} 187}
188 188
189static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq, 189static void tx4938ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd,
190 void *buf, unsigned int len) 190 void *buf, unsigned int len)
191{ 191{
192 unsigned long port = drive->hwif->io_ports.data_addr; 192 unsigned long port = drive->hwif->io_ports.data_addr;