aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2009-01-02 10:12:53 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-02 10:12:53 -0500
commit4cad085efbce8dcc5006b0d1034089758b4fc7ba (patch)
treef9aeb0e7eec115e56aada920eefa40b093aec434 /drivers/ide/ide-atapi.c
parent5f25843fa79b7c35097b0ffe8b2c5cc2428d6495 (diff)
ide-cd: move cdrom_timer_expiry to ide-atapi.c
- cdrom_timer_expiry -> ide_cd_expiry - remove expiry-arg to ide_issue_pc as it is redundant now - ide_debug_log -> debug_log Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c41
1 files changed, 38 insertions, 3 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);