aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-atapi.c41
-rw-r--r--drivers/ide/ide-cd.c38
-rw-r--r--drivers/ide/ide-cd.h4
-rw-r--r--drivers/ide/ide-floppy.c2
-rw-r--r--drivers/ide/ide-tape.c2
5 files changed, 43 insertions, 44 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 8c5cf68fbd79..c110329ccb13 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -3,6 +3,7 @@
3 */ 3 */
4 4
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/cdrom.h>
6#include <linux/delay.h> 7#include <linux/delay.h>
7#include <linux/ide.h> 8#include <linux/ide.h>
8#include <scsi/scsi.h> 9#include <scsi/scsi.h>
@@ -252,6 +253,38 @@ int ide_scsi_expiry(ide_drive_t *drive)
252} 253}
253EXPORT_SYMBOL_GPL(ide_scsi_expiry); 254EXPORT_SYMBOL_GPL(ide_scsi_expiry);
254 255
256int ide_cd_expiry(ide_drive_t *drive)
257{
258 struct request *rq = HWGROUP(drive)->rq;
259 unsigned long wait = 0;
260
261 debug_log("%s: rq->cmd[0]: 0x%x\n", __func__, rq->cmd[0]);
262
263 /*
264 * Some commands are *slow* and normally take a long time to complete.
265 * Usually we can use the ATAPI "disconnect" to bypass this, but not all
266 * commands/drives support that. Let ide_timer_expiry keep polling us
267 * for these.
268 */
269 switch (rq->cmd[0]) {
270 case GPCMD_BLANK:
271 case GPCMD_FORMAT_UNIT:
272 case GPCMD_RESERVE_RZONE_TRACK:
273 case GPCMD_CLOSE_TRACK:
274 case GPCMD_FLUSH_CACHE:
275 wait = ATAPI_WAIT_PC;
276 break;
277 default:
278 if (!(rq->cmd_flags & REQ_QUIET))
279 printk(KERN_INFO "cmd 0x%x timed out\n",
280 rq->cmd[0]);
281 wait = 0;
282 break;
283 }
284 return wait;
285}
286EXPORT_SYMBOL_GPL(ide_cd_expiry);
287
255int ide_cd_get_xferlen(struct request *rq) 288int ide_cd_get_xferlen(struct request *rq)
256{ 289{
257 if (blk_fs_request(rq)) 290 if (blk_fs_request(rq))
@@ -562,11 +595,11 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)
562 return ide_started; 595 return ide_started;
563} 596}
564 597
565ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout, 598ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout)
566 ide_expiry_t *expiry)
567{ 599{
568 struct ide_atapi_pc *pc = drive->pc; 600 struct ide_atapi_pc *pc = drive->pc;
569 ide_hwif_t *hwif = drive->hwif; 601 ide_hwif_t *hwif = drive->hwif;
602 ide_expiry_t *expiry = NULL;
570 u32 tf_flags; 603 u32 tf_flags;
571 u16 bcount; 604 u16 bcount;
572 u8 scsi = !!(drive->dev_flags & IDE_DFLAG_SCSI); 605 u8 scsi = !!(drive->dev_flags & IDE_DFLAG_SCSI);
@@ -578,9 +611,11 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,
578 if (dev_is_idecd(drive)) { 611 if (dev_is_idecd(drive)) {
579 tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; 612 tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL;
580 bcount = ide_cd_get_xferlen(hwif->hwgroup->rq); 613 bcount = ide_cd_get_xferlen(hwif->hwgroup->rq);
614 expiry = ide_cd_expiry;
581 } else if (scsi) { 615 } else if (scsi) {
582 tf_flags = 0; 616 tf_flags = 0;
583 bcount = min(pc->req_xfer, 63 * 1024); 617 bcount = min(pc->req_xfer, 63 * 1024);
618 expiry = ide_scsi_expiry;
584 } else { 619 } else {
585 tf_flags = IDE_TFLAG_OUT_DEVICE; 620 tf_flags = IDE_TFLAG_OUT_DEVICE;
586 bcount = ((drive->media == ide_tape) ? 621 bcount = ((drive->media == ide_tape) ?
@@ -613,7 +648,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,
613 if (drive->dma) 648 if (drive->dma)
614 drive->waiting_for_dma = 0; 649 drive->waiting_for_dma = 0;
615 ide_execute_command(drive, ATA_CMD_PACKET, ide_transfer_pc, 650 ide_execute_command(drive, ATA_CMD_PACKET, ide_transfer_pc,
616 timeout, NULL); 651 timeout, expiry);
617 return ide_started; 652 return ide_started;
618 } else { 653 } else {
619 ide_execute_pkt_cmd(drive); 654 ide_execute_pkt_cmd(drive);
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 8d3c7714682e..105e4d855e6e 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -511,38 +511,6 @@ end_request:
511 return 1; 511 return 1;
512} 512}
513 513
514static int cdrom_timer_expiry(ide_drive_t *drive)
515{
516 struct request *rq = HWGROUP(drive)->rq;
517 unsigned long wait = 0;
518
519 ide_debug_log(IDE_DBG_RQ, "Call %s: rq->cmd[0]: 0x%x\n", __func__,
520 rq->cmd[0]);
521
522 /*
523 * Some commands are *slow* and normally take a long time to complete.
524 * Usually we can use the ATAPI "disconnect" to bypass this, but not all
525 * commands/drives support that. Let ide_timer_expiry keep polling us
526 * for these.
527 */
528 switch (rq->cmd[0]) {
529 case GPCMD_BLANK:
530 case GPCMD_FORMAT_UNIT:
531 case GPCMD_RESERVE_RZONE_TRACK:
532 case GPCMD_CLOSE_TRACK:
533 case GPCMD_FLUSH_CACHE:
534 wait = ATAPI_WAIT_PC;
535 break;
536 default:
537 if (!(rq->cmd_flags & REQ_QUIET))
538 printk(KERN_INFO PFX "cmd 0x%x timed out\n",
539 rq->cmd[0]);
540 wait = 0;
541 break;
542 }
543 return wait;
544}
545
546/* 514/*
547 * Set up the device registers for transferring a packet command on DEV, 515 * Set up the device registers for transferring a packet command on DEV,
548 * expecting to later transfer XFERLEN bytes. HANDLER is the routine 516 * expecting to later transfer XFERLEN bytes. HANDLER is the routine
@@ -574,7 +542,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
574 542
575 /* packet command */ 543 /* packet command */
576 ide_execute_command(drive, ATA_CMD_PACKET, handler, 544 ide_execute_command(drive, ATA_CMD_PACKET, handler,
577 ATAPI_WAIT_PC, cdrom_timer_expiry); 545 ATAPI_WAIT_PC, ide_cd_expiry);
578 return ide_started; 546 return ide_started;
579 } else { 547 } else {
580 ide_execute_pkt_cmd(drive); 548 ide_execute_pkt_cmd(drive);
@@ -621,7 +589,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
621 } 589 }
622 590
623 /* arm the interrupt handler */ 591 /* arm the interrupt handler */
624 ide_set_handler(drive, handler, rq->timeout, cdrom_timer_expiry); 592 ide_set_handler(drive, handler, rq->timeout, ide_cd_expiry);
625 593
626 /* ATAPI commands get padded out to 12 bytes minimum */ 594 /* ATAPI commands get padded out to 12 bytes minimum */
627 cmd_len = COMMAND_SIZE(rq->cmd[0]); 595 cmd_len = COMMAND_SIZE(rq->cmd[0]);
@@ -1088,7 +1056,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1088 } else { 1056 } else {
1089 timeout = ATAPI_WAIT_PC; 1057 timeout = ATAPI_WAIT_PC;
1090 if (!blk_fs_request(rq)) 1058 if (!blk_fs_request(rq))
1091 expiry = cdrom_timer_expiry; 1059 expiry = ide_cd_expiry;
1092 } 1060 }
1093 1061
1094 ide_set_handler(drive, cdrom_newpc_intr, timeout, expiry); 1062 ide_set_handler(drive, cdrom_newpc_intr, timeout, expiry);
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 389faa42eaa1..bf676b262181 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -16,10 +16,6 @@
16#define ide_debug_log(lvl, fmt, args...) do {} while (0) 16#define ide_debug_log(lvl, fmt, args...) do {} while (0)
17#endif 17#endif
18 18
19/*
20 * typical timeout for packet command
21 */
22#define ATAPI_WAIT_PC (60 * HZ)
23#define ATAPI_WAIT_WRITE_BUSY (10 * HZ) 19#define ATAPI_WAIT_WRITE_BUSY (10 * HZ)
24 20
25/************************************************************************/ 21/************************************************************************/
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 1f07f3818938..fdec729d0e49 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -197,7 +197,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
197 197
198 pc->retries++; 198 pc->retries++;
199 199
200 return ide_issue_pc(drive, WAIT_FLOPPY_CMD, NULL); 200 return ide_issue_pc(drive, WAIT_FLOPPY_CMD);
201} 201}
202 202
203void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) 203void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index a2d470eb2b55..ac9e29a4991f 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -694,7 +694,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
694 694
695 pc->retries++; 695 pc->retries++;
696 696
697 return ide_issue_pc(drive, WAIT_TAPE_CMD, NULL); 697 return ide_issue_pc(drive, WAIT_TAPE_CMD);
698} 698}
699 699
700/* A mode sense command is used to "sense" tape parameters. */ 700/* A mode sense command is used to "sense" tape parameters. */