aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c68
1 files changed, 13 insertions, 55 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index f5bf405c36aa..7a04509bf962 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -240,19 +240,6 @@ void ide_retry_pc(ide_drive_t *drive, struct gendisk *disk)
240} 240}
241EXPORT_SYMBOL_GPL(ide_retry_pc); 241EXPORT_SYMBOL_GPL(ide_retry_pc);
242 242
243int ide_scsi_expiry(ide_drive_t *drive)
244{
245 struct ide_atapi_pc *pc = drive->pc;
246
247 debug_log("%s called for %lu at %lu\n", __func__,
248 pc->scsi_cmd->serial_number, jiffies);
249
250 pc->flags |= PC_FLAG_TIMEDOUT;
251
252 return 0; /* we do not want the IDE subsystem to retry */
253}
254EXPORT_SYMBOL_GPL(ide_scsi_expiry);
255
256int ide_cd_expiry(ide_drive_t *drive) 243int ide_cd_expiry(ide_drive_t *drive)
257{ 244{
258 struct request *rq = HWGROUP(drive)->rq; 245 struct request *rq = HWGROUP(drive)->rq;
@@ -309,21 +296,14 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
309 struct request *rq = hwif->hwgroup->rq; 296 struct request *rq = hwif->hwgroup->rq;
310 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 297 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
311 xfer_func_t *xferfunc; 298 xfer_func_t *xferfunc;
312 ide_expiry_t *expiry;
313 unsigned int timeout, temp; 299 unsigned int timeout, temp;
314 u16 bcount; 300 u16 bcount;
315 u8 stat, ireason, scsi = !!(drive->dev_flags & IDE_DFLAG_SCSI), dsc = 0; 301 u8 stat, ireason, dsc = 0;
316 302
317 debug_log("Enter %s - interrupt handler\n", __func__); 303 debug_log("Enter %s - interrupt handler\n", __func__);
318 304
319 if (scsi) { 305 timeout = (drive->media == ide_floppy) ? WAIT_FLOPPY_CMD
320 timeout = ide_scsi_get_timeout(pc); 306 : WAIT_TAPE_CMD;
321 expiry = ide_scsi_expiry;
322 } else {
323 timeout = (drive->media == ide_floppy) ? WAIT_FLOPPY_CMD
324 : WAIT_TAPE_CMD;
325 expiry = NULL;
326 }
327 307
328 if (pc->flags & PC_FLAG_TIMEDOUT) { 308 if (pc->flags & PC_FLAG_TIMEDOUT) {
329 drive->pc_callback(drive, 0); 309 drive->pc_callback(drive, 0);
@@ -335,8 +315,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
335 315
336 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { 316 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
337 if (hwif->dma_ops->dma_end(drive) || 317 if (hwif->dma_ops->dma_end(drive) ||
338 (drive->media == ide_tape && !scsi && (stat & ATA_ERR))) { 318 (drive->media == ide_tape && (stat & ATA_ERR))) {
339 if (drive->media == ide_floppy && !scsi) 319 if (drive->media == ide_floppy)
340 printk(KERN_ERR "%s: DMA %s error\n", 320 printk(KERN_ERR "%s: DMA %s error\n",
341 drive->name, rq_data_dir(pc->rq) 321 drive->name, rq_data_dir(pc->rq)
342 ? "write" : "read"); 322 ? "write" : "read");
@@ -358,7 +338,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
358 338
359 local_irq_enable_in_hardirq(); 339 local_irq_enable_in_hardirq();
360 340
361 if (drive->media == ide_tape && !scsi && 341 if (drive->media == ide_tape &&
362 (stat & ATA_ERR) && rq->cmd[0] == REQUEST_SENSE) 342 (stat & ATA_ERR) && rq->cmd[0] == REQUEST_SENSE)
363 stat &= ~ATA_ERR; 343 stat &= ~ATA_ERR;
364 344
@@ -366,11 +346,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
366 /* Error detected */ 346 /* Error detected */
367 debug_log("%s: I/O error\n", drive->name); 347 debug_log("%s: I/O error\n", drive->name);
368 348
369 if (drive->media != ide_tape || scsi) { 349 if (drive->media != ide_tape)
370 pc->rq->errors++; 350 pc->rq->errors++;
371 if (scsi)
372 goto cmd_finished;
373 }
374 351
375 if (rq->cmd[0] == REQUEST_SENSE) { 352 if (rq->cmd[0] == REQUEST_SENSE) {
376 printk(KERN_ERR "%s: I/O error in request sense" 353 printk(KERN_ERR "%s: I/O error in request sense"
@@ -386,7 +363,6 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
386 /* queued, but not started */ 363 /* queued, but not started */
387 return ide_stopped; 364 return ide_stopped;
388 } 365 }
389cmd_finished:
390 pc->error = 0; 366 pc->error = 0;
391 367
392 if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) && (stat & ATA_DSC) == 0) 368 if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) && (stat & ATA_DSC) == 0)
@@ -433,25 +409,8 @@ cmd_finished:
433 "us more data than expected - " 409 "us more data than expected - "
434 "discarding data\n", 410 "discarding data\n",
435 drive->name); 411 drive->name);
436 if (scsi) 412
437 temp = pc->buf_size - pc->xferred; 413 ide_pad_transfer(drive, 0, bcount);
438 else
439 temp = 0;
440 if (temp) {
441 if (pc->sg)
442 drive->pc_io_buffers(drive, pc,
443 temp, 0);
444 else
445 tp_ops->input_data(drive, NULL,
446 pc->cur_pos, temp);
447 printk(KERN_ERR "%s: transferred %d of "
448 "%d bytes\n",
449 drive->name,
450 temp, bcount);
451 }
452 pc->xferred += temp;
453 pc->cur_pos += temp;
454 ide_pad_transfer(drive, 0, bcount - temp);
455 goto next_irq; 414 goto next_irq;
456 } 415 }
457 debug_log("The device wants to send us more data than " 416 debug_log("The device wants to send us more data than "
@@ -461,14 +420,13 @@ cmd_finished:
461 } else 420 } else
462 xferfunc = tp_ops->output_data; 421 xferfunc = tp_ops->output_data;
463 422
464 if ((drive->media == ide_floppy && !scsi && !pc->buf) || 423 if ((drive->media == ide_floppy && !pc->buf) ||
465 (drive->media == ide_tape && !scsi && pc->bh) || 424 (drive->media == ide_tape && pc->bh)) {
466 (scsi && pc->sg)) {
467 int done = drive->pc_io_buffers(drive, pc, bcount, 425 int done = drive->pc_io_buffers(drive, pc, bcount,
468 !!(pc->flags & PC_FLAG_WRITING)); 426 !!(pc->flags & PC_FLAG_WRITING));
469 427
470 /* FIXME: don't do partial completions */ 428 /* FIXME: don't do partial completions */
471 if (drive->media == ide_floppy && !scsi) 429 if (drive->media == ide_floppy)
472 ide_end_request(drive, 1, done >> 9); 430 ide_end_request(drive, 1, done >> 9);
473 } else 431 } else
474 xferfunc(drive, NULL, pc->cur_pos, bcount); 432 xferfunc(drive, NULL, pc->cur_pos, bcount);
@@ -481,7 +439,7 @@ cmd_finished:
481 rq->cmd[0], bcount); 439 rq->cmd[0], bcount);
482next_irq: 440next_irq:
483 /* And set the interrupt handler again */ 441 /* And set the interrupt handler again */
484 ide_set_handler(drive, ide_pc_intr, timeout, expiry); 442 ide_set_handler(drive, ide_pc_intr, timeout, NULL);
485 return ide_started; 443 return ide_started;
486} 444}
487 445