@@ -54,30 +54,31 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
5454}
5555
5656static ide_startstop_t task_no_data_intr (ide_drive_t * );
57- static ide_startstop_t pre_task_out_intr (ide_drive_t * , struct request * );
57+ static ide_startstop_t pre_task_out_intr (ide_drive_t * , struct ide_cmd * );
5858static ide_startstop_t task_in_intr (ide_drive_t * );
5959
60- ide_startstop_t do_rw_taskfile (ide_drive_t * drive , struct ide_cmd * cmd )
60+ ide_startstop_t do_rw_taskfile (ide_drive_t * drive , struct ide_cmd * orig_cmd )
6161{
6262 ide_hwif_t * hwif = drive -> hwif ;
63+ struct ide_cmd * cmd = & hwif -> cmd ;
6364 struct ide_taskfile * tf = & cmd -> tf ;
6465 ide_handler_t * handler = NULL ;
6566 const struct ide_tp_ops * tp_ops = hwif -> tp_ops ;
6667 const struct ide_dma_ops * dma_ops = hwif -> dma_ops ;
6768
68- if (cmd -> data_phase == TASKFILE_MULTI_IN ||
69- cmd -> data_phase == TASKFILE_MULTI_OUT ) {
69+ if (orig_cmd -> data_phase == TASKFILE_MULTI_IN ||
70+ orig_cmd -> data_phase == TASKFILE_MULTI_OUT ) {
7071 if (!drive -> mult_count ) {
7172 printk (KERN_ERR "%s: multimode not set!\n" ,
7273 drive -> name );
7374 return ide_stopped ;
7475 }
7576 }
7677
77- if (cmd -> ftf_flags & IDE_FTFLAG_FLAGGED )
78- cmd -> ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS ;
78+ if (orig_cmd -> ftf_flags & IDE_FTFLAG_FLAGGED )
79+ orig_cmd -> ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS ;
7980
80- memcpy (& hwif -> cmd , cmd , sizeof (* cmd ));
81+ memcpy (cmd , orig_cmd , sizeof (* cmd ));
8182
8283 if ((cmd -> tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK ) == 0 ) {
8384 ide_tf_dump (drive -> name , tf );
@@ -91,7 +92,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
9192 case TASKFILE_OUT :
9293 tp_ops -> exec_command (hwif , tf -> command );
9394 ndelay (400 ); /* FIXME */
94- return pre_task_out_intr (drive , cmd -> rq );
95+ return pre_task_out_intr (drive , cmd );
9596 case TASKFILE_MULTI_IN :
9697 case TASKFILE_IN :
9798 handler = task_in_intr ;
@@ -203,7 +204,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
203204 return stat ;
204205}
205206
206- static void ide_pio_sector (ide_drive_t * drive , struct request * rq ,
207+ static void ide_pio_sector (ide_drive_t * drive , struct ide_cmd * cmd ,
207208 unsigned int write )
208209{
209210 ide_hwif_t * hwif = drive -> hwif ;
@@ -244,34 +245,33 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq,
244245
245246 /* do the actual data transfer */
246247 if (write )
247- hwif -> tp_ops -> output_data (drive , rq , buf , SECTOR_SIZE );
248+ hwif -> tp_ops -> output_data (drive , cmd , buf , SECTOR_SIZE );
248249 else
249- hwif -> tp_ops -> input_data (drive , rq , buf , SECTOR_SIZE );
250+ hwif -> tp_ops -> input_data (drive , cmd , buf , SECTOR_SIZE );
250251
251252 kunmap_atomic (buf , KM_BIO_SRC_IRQ );
252253#ifdef CONFIG_HIGHMEM
253254 local_irq_restore (flags );
254255#endif
255256}
256257
257- static void ide_pio_multi (ide_drive_t * drive , struct request * rq ,
258+ static void ide_pio_multi (ide_drive_t * drive , struct ide_cmd * cmd ,
258259 unsigned int write )
259260{
260261 unsigned int nsect ;
261262
262263 nsect = min_t (unsigned int , drive -> hwif -> nleft , drive -> mult_count );
263264 while (nsect -- )
264- ide_pio_sector (drive , rq , write );
265+ ide_pio_sector (drive , cmd , write );
265266}
266267
267- static void ide_pio_datablock (ide_drive_t * drive , struct request * rq ,
268- unsigned int write )
268+ static void ide_pio_datablock (ide_drive_t * drive , struct ide_cmd * cmd ,
269+ unsigned int write )
269270{
270- struct ide_cmd * cmd = & drive -> hwif -> cmd ;
271271 u8 saved_io_32bit = drive -> io_32bit ;
272272
273- if (blk_fs_request ( rq ) )
274- rq -> errors = 0 ;
273+ if (cmd -> tf_flags & IDE_TFLAG_FS )
274+ cmd -> rq -> errors = 0 ;
275275
276276 if (cmd -> tf_flags & IDE_TFLAG_IO_16BIT )
277277 drive -> io_32bit = 0 ;
@@ -281,22 +281,21 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq,
281281 switch (cmd -> data_phase ) {
282282 case TASKFILE_MULTI_IN :
283283 case TASKFILE_MULTI_OUT :
284- ide_pio_multi (drive , rq , write );
284+ ide_pio_multi (drive , cmd , write );
285285 break ;
286286 default :
287- ide_pio_sector (drive , rq , write );
287+ ide_pio_sector (drive , cmd , write );
288288 break ;
289289 }
290290
291291 drive -> io_32bit = saved_io_32bit ;
292292}
293293
294- static ide_startstop_t task_error (ide_drive_t * drive , struct request * rq ,
294+ static ide_startstop_t task_error (ide_drive_t * drive , struct ide_cmd * cmd ,
295295 const char * s , u8 stat )
296296{
297- if (blk_fs_request ( rq ) ) {
297+ if (cmd -> tf_flags & IDE_TFLAG_FS ) {
298298 ide_hwif_t * hwif = drive -> hwif ;
299- struct ide_cmd * cmd = & hwif -> cmd ;
300299 int sectors = hwif -> nsect - hwif -> nleft ;
301300
302301 switch (cmd -> data_phase ) {
@@ -323,19 +322,17 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
323322 return ide_error (drive , s , stat );
324323}
325324
326- void task_end_request (ide_drive_t * drive , struct request * rq , u8 stat )
325+ void ide_finish_cmd (ide_drive_t * drive , struct ide_cmd * cmd , u8 stat )
327326{
328- if (blk_fs_request (rq ) == 0 ) {
329- struct ide_cmd * cmd = rq -> special ;
327+ if ((cmd -> tf_flags & IDE_TFLAG_FS ) == 0 ) {
330328 u8 err = ide_read_error (drive );
331329
332- if (cmd )
333- ide_complete_cmd (drive , cmd , stat , err );
330+ ide_complete_cmd (drive , cmd , stat , err );
334331 ide_complete_rq (drive , err );
335332 return ;
336333 }
337334
338- ide_end_request (drive , 1 , rq -> nr_sectors );
335+ ide_end_request (drive , 1 , cmd -> rq -> nr_sectors );
339336}
340337
341338/*
@@ -344,11 +341,12 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
344341 * It might be a spurious irq (shared irq), but it might be a
345342 * command that had no output.
346343 */
347- static ide_startstop_t task_in_unexpected (ide_drive_t * drive , struct request * rq , u8 stat )
344+ static ide_startstop_t task_in_unexpected (ide_drive_t * drive ,
345+ struct ide_cmd * cmd , u8 stat )
348346{
349347 /* Command all done? */
350348 if (OK_STAT (stat , ATA_DRDY , ATA_BUSY )) {
351- task_end_request (drive , rq , stat );
349+ ide_finish_cmd (drive , cmd , stat );
352350 return ide_stopped ;
353351 }
354352
@@ -363,25 +361,25 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq
363361static ide_startstop_t task_in_intr (ide_drive_t * drive )
364362{
365363 ide_hwif_t * hwif = drive -> hwif ;
366- struct request * rq = hwif -> rq ;
364+ struct ide_cmd * cmd = & drive -> hwif -> cmd ;
367365 u8 stat = hwif -> tp_ops -> read_status (hwif );
368366
369367 /* Error? */
370368 if (stat & ATA_ERR )
371- return task_error (drive , rq , __func__ , stat );
369+ return task_error (drive , cmd , __func__ , stat );
372370
373371 /* Didn't want any data? Odd. */
374372 if ((stat & ATA_DRQ ) == 0 )
375- return task_in_unexpected (drive , rq , stat );
373+ return task_in_unexpected (drive , cmd , stat );
376374
377- ide_pio_datablock (drive , rq , 0 );
375+ ide_pio_datablock (drive , cmd , 0 );
378376
379377 /* Are we done? Check status and finish transfer. */
380378 if (!hwif -> nleft ) {
381379 stat = wait_drive_not_busy (drive );
382380 if (!OK_STAT (stat , 0 , BAD_STAT ))
383- return task_error (drive , rq , __func__ , stat );
384- task_end_request (drive , rq , stat );
381+ return task_error (drive , cmd , __func__ , stat );
382+ ide_finish_cmd (drive , cmd , stat );
385383 return ide_stopped ;
386384 }
387385
@@ -397,31 +395,31 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive)
397395static ide_startstop_t task_out_intr (ide_drive_t * drive )
398396{
399397 ide_hwif_t * hwif = drive -> hwif ;
400- struct request * rq = hwif -> rq ;
398+ struct ide_cmd * cmd = & drive -> hwif -> cmd ;
401399 u8 stat = hwif -> tp_ops -> read_status (hwif );
402400
403401 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 );
405403
406404 /* Deal with unexpected ATA data phase. */
407405 if (((stat & ATA_DRQ ) == 0 ) ^ !hwif -> nleft )
408- return task_error (drive , rq , __func__ , stat );
406+ return task_error (drive , cmd , __func__ , stat );
409407
410408 if (!hwif -> nleft ) {
411- task_end_request (drive , rq , stat );
409+ ide_finish_cmd (drive , cmd , stat );
412410 return ide_stopped ;
413411 }
414412
415413 /* Still data left to transfer. */
416- ide_pio_datablock (drive , rq , 1 );
414+ ide_pio_datablock (drive , cmd , 1 );
417415 ide_set_handler (drive , & task_out_intr , WAIT_WORSTCASE , NULL );
418416
419417 return ide_started ;
420418}
421419
422- static ide_startstop_t pre_task_out_intr (ide_drive_t * drive , struct request * rq )
420+ static ide_startstop_t pre_task_out_intr (ide_drive_t * drive ,
421+ struct ide_cmd * cmd )
423422{
424- struct ide_cmd * cmd = & drive -> hwif -> cmd ;
425423 ide_startstop_t startstop ;
426424
427425 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)
437435 local_irq_disable ();
438436
439437 ide_set_handler (drive , & task_out_intr , WAIT_WORSTCASE , NULL );
440- ide_pio_datablock (drive , rq , 1 );
438+ ide_pio_datablock (drive , cmd , 1 );
441439
442440 return ide_started ;
443441}
0 commit comments