|
@@ -176,7 +176,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
|
|
if (!sense->valid)
|
|
if (!sense->valid)
|
|
break;
|
|
break;
|
|
if (failed_command == NULL ||
|
|
if (failed_command == NULL ||
|
|
- !blk_fs_request(failed_command))
|
|
|
|
|
|
+ failed_command->cmd_type != REQ_TYPE_FS)
|
|
break;
|
|
break;
|
|
sector = (sense->information[0] << 24) |
|
|
sector = (sense->information[0] << 24) |
|
|
(sense->information[1] << 16) |
|
|
(sense->information[1] << 16) |
|
|
@@ -292,7 +292,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
|
|
"stat 0x%x",
|
|
"stat 0x%x",
|
|
rq->cmd[0], rq->cmd_type, err, stat);
|
|
rq->cmd[0], rq->cmd_type, err, stat);
|
|
|
|
|
|
- if (blk_sense_request(rq)) {
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_SENSE) {
|
|
/*
|
|
/*
|
|
* We got an error trying to get sense info from the drive
|
|
* We got an error trying to get sense info from the drive
|
|
* (probably while trying to recover from a former error).
|
|
* (probably while trying to recover from a former error).
|
|
@@ -303,7 +303,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
|
|
}
|
|
}
|
|
|
|
|
|
/* if we have an error, pass CHECK_CONDITION as the SCSI status byte */
|
|
/* if we have an error, pass CHECK_CONDITION as the SCSI status byte */
|
|
- if (blk_pc_request(rq) && !rq->errors)
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_BLOCK_PC && !rq->errors)
|
|
rq->errors = SAM_STAT_CHECK_CONDITION;
|
|
rq->errors = SAM_STAT_CHECK_CONDITION;
|
|
|
|
|
|
if (blk_noretry_request(rq))
|
|
if (blk_noretry_request(rq))
|
|
@@ -311,13 +311,14 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
|
|
|
|
|
|
switch (sense_key) {
|
|
switch (sense_key) {
|
|
case NOT_READY:
|
|
case NOT_READY:
|
|
- if (blk_fs_request(rq) && rq_data_dir(rq) == WRITE) {
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_FS && rq_data_dir(rq) == WRITE) {
|
|
if (ide_cd_breathe(drive, rq))
|
|
if (ide_cd_breathe(drive, rq))
|
|
return 1;
|
|
return 1;
|
|
} else {
|
|
} else {
|
|
cdrom_saw_media_change(drive);
|
|
cdrom_saw_media_change(drive);
|
|
|
|
|
|
- if (blk_fs_request(rq) && !blk_rq_quiet(rq))
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_FS &&
|
|
|
|
+ !(rq->cmd_flags & REQ_QUIET)) {
|
|
printk(KERN_ERR PFX "%s: tray open\n",
|
|
printk(KERN_ERR PFX "%s: tray open\n",
|
|
drive->name);
|
|
drive->name);
|
|
}
|
|
}
|
|
@@ -326,7 +327,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
|
|
case UNIT_ATTENTION:
|
|
case UNIT_ATTENTION:
|
|
cdrom_saw_media_change(drive);
|
|
cdrom_saw_media_change(drive);
|
|
|
|
|
|
- if (blk_fs_request(rq) == 0)
|
|
|
|
|
|
+ if (rq->cmd_type != REQ_TYPE_FS)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -352,7 +353,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
|
|
* No point in retrying after an illegal request or data
|
|
* No point in retrying after an illegal request or data
|
|
* protect error.
|
|
* protect error.
|
|
*/
|
|
*/
|
|
- if (!blk_rq_quiet(rq))
|
|
|
|
|
|
+ if (!(rq->cmd_flags & REQ_QUIET))
|
|
ide_dump_status(drive, "command error", stat);
|
|
ide_dump_status(drive, "command error", stat);
|
|
do_end_request = 1;
|
|
do_end_request = 1;
|
|
break;
|
|
break;
|
|
@@ -361,20 +362,20 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
|
|
* No point in re-trying a zillion times on a bad sector.
|
|
* No point in re-trying a zillion times on a bad sector.
|
|
* If we got here the error is not correctable.
|
|
* If we got here the error is not correctable.
|
|
*/
|
|
*/
|
|
- if (!blk_rq_quiet(rq))
|
|
|
|
|
|
+ if (!(rq->cmd_flags & REQ_QUIET))
|
|
ide_dump_status(drive, "media error "
|
|
ide_dump_status(drive, "media error "
|
|
"(bad sector)", stat);
|
|
"(bad sector)", stat);
|
|
do_end_request = 1;
|
|
do_end_request = 1;
|
|
break;
|
|
break;
|
|
case BLANK_CHECK:
|
|
case BLANK_CHECK:
|
|
/* disk appears blank? */
|
|
/* disk appears blank? */
|
|
- if (!blk_rq_quiet(rq))
|
|
|
|
|
|
+ if (!(rq->cmd_flags & REQ_QUIET))
|
|
ide_dump_status(drive, "media error (blank)",
|
|
ide_dump_status(drive, "media error (blank)",
|
|
stat);
|
|
stat);
|
|
do_end_request = 1;
|
|
do_end_request = 1;
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
- if (blk_fs_request(rq) == 0)
|
|
|
|
|
|
+ if (req->cmd_type != REQ_TYPE_FS)
|
|
break;
|
|
break;
|
|
if (err & ~ATA_ABORTED) {
|
|
if (err & ~ATA_ABORTED) {
|
|
/* go to the default handler for other errors */
|
|
/* go to the default handler for other errors */
|
|
@@ -385,7 +386,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
|
|
do_end_request = 1;
|
|
do_end_request = 1;
|
|
}
|
|
}
|
|
|
|
|
|
- if (blk_fs_request(rq) == 0) {
|
|
|
|
|
|
+ if (rq->cmd_type != REQ_TYPE_FS) {
|
|
rq->cmd_flags |= REQ_FAILED;
|
|
rq->cmd_flags |= REQ_FAILED;
|
|
do_end_request = 1;
|
|
do_end_request = 1;
|
|
}
|
|
}
|
|
@@ -525,7 +526,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
|
ide_expiry_t *expiry = NULL;
|
|
ide_expiry_t *expiry = NULL;
|
|
int dma_error = 0, dma, thislen, uptodate = 0;
|
|
int dma_error = 0, dma, thislen, uptodate = 0;
|
|
int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
|
|
int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
|
|
- int sense = blk_sense_request(rq);
|
|
|
|
|
|
+ int sense = (rq->cmd_type == REQ_TYPE_SENSE);
|
|
unsigned int timeout;
|
|
unsigned int timeout;
|
|
u16 len;
|
|
u16 len;
|
|
u8 ireason, stat;
|
|
u8 ireason, stat;
|
|
@@ -568,7 +569,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
|
|
|
|
|
ide_read_bcount_and_ireason(drive, &len, &ireason);
|
|
ide_read_bcount_and_ireason(drive, &len, &ireason);
|
|
|
|
|
|
- thislen = blk_fs_request(rq) ? len : cmd->nleft;
|
|
|
|
|
|
+ thislen = (rq->cmd_type == REQ_TYPE_FS) ? len : cmd->nleft;
|
|
if (thislen > len)
|
|
if (thislen > len)
|
|
thislen = len;
|
|
thislen = len;
|
|
|
|
|
|
@@ -577,7 +578,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
|
|
|
|
|
/* If DRQ is clear, the command has completed. */
|
|
/* If DRQ is clear, the command has completed. */
|
|
if ((stat & ATA_DRQ) == 0) {
|
|
if ((stat & ATA_DRQ) == 0) {
|
|
- if (blk_fs_request(rq)) {
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_FS) {
|
|
/*
|
|
/*
|
|
* If we're not done reading/writing, complain.
|
|
* If we're not done reading/writing, complain.
|
|
* Otherwise, complete the command normally.
|
|
* Otherwise, complete the command normally.
|
|
@@ -591,7 +592,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
|
rq->cmd_flags |= REQ_FAILED;
|
|
rq->cmd_flags |= REQ_FAILED;
|
|
uptodate = 0;
|
|
uptodate = 0;
|
|
}
|
|
}
|
|
- } else if (!blk_pc_request(rq)) {
|
|
|
|
|
|
+ } else if (rq->cmd_type != REQ_TYPE_BLOCK_PC) {
|
|
ide_cd_request_sense_fixup(drive, cmd);
|
|
ide_cd_request_sense_fixup(drive, cmd);
|
|
|
|
|
|
uptodate = cmd->nleft ? 0 : 1;
|
|
uptodate = cmd->nleft ? 0 : 1;
|
|
@@ -640,7 +641,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
|
|
|
|
|
/* pad, if necessary */
|
|
/* pad, if necessary */
|
|
if (len > 0) {
|
|
if (len > 0) {
|
|
- if (blk_fs_request(rq) == 0 || write == 0)
|
|
|
|
|
|
+ if (rq->cmd_type != REQ_TYPE_FS || write == 0)
|
|
ide_pad_transfer(drive, write, len);
|
|
ide_pad_transfer(drive, write, len);
|
|
else {
|
|
else {
|
|
printk(KERN_ERR PFX "%s: confused, missing data\n",
|
|
printk(KERN_ERR PFX "%s: confused, missing data\n",
|
|
@@ -649,11 +650,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (blk_pc_request(rq)) {
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
|
|
timeout = rq->timeout;
|
|
timeout = rq->timeout;
|
|
} else {
|
|
} else {
|
|
timeout = ATAPI_WAIT_PC;
|
|
timeout = ATAPI_WAIT_PC;
|
|
- if (!blk_fs_request(rq))
|
|
|
|
|
|
+ if (rq->cmd_type != REQ_TYPE_FS)
|
|
expiry = ide_cd_expiry;
|
|
expiry = ide_cd_expiry;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -662,7 +663,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
|
return ide_started;
|
|
return ide_started;
|
|
|
|
|
|
out_end:
|
|
out_end:
|
|
- if (blk_pc_request(rq) && rc == 0) {
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_BLOCK_PC && rc == 0) {
|
|
rq->resid_len = 0;
|
|
rq->resid_len = 0;
|
|
blk_end_request_all(rq, 0);
|
|
blk_end_request_all(rq, 0);
|
|
hwif->rq = NULL;
|
|
hwif->rq = NULL;
|
|
@@ -670,7 +671,7 @@ out_end:
|
|
if (sense && uptodate)
|
|
if (sense && uptodate)
|
|
ide_cd_complete_failed_rq(drive, rq);
|
|
ide_cd_complete_failed_rq(drive, rq);
|
|
|
|
|
|
- if (blk_fs_request(rq)) {
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_FS) {
|
|
if (cmd->nleft == 0)
|
|
if (cmd->nleft == 0)
|
|
uptodate = 1;
|
|
uptodate = 1;
|
|
} else {
|
|
} else {
|
|
@@ -682,7 +683,7 @@ out_end:
|
|
ide_cd_error_cmd(drive, cmd);
|
|
ide_cd_error_cmd(drive, cmd);
|
|
|
|
|
|
/* make sure it's fully ended */
|
|
/* make sure it's fully ended */
|
|
- if (blk_fs_request(rq) == 0) {
|
|
|
|
|
|
+ if (rq->cmd_type != REQ_TYPE_FS) {
|
|
rq->resid_len -= cmd->nbytes - cmd->nleft;
|
|
rq->resid_len -= cmd->nbytes - cmd->nleft;
|
|
if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
|
|
if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
|
|
rq->resid_len += cmd->last_xfer_len;
|
|
rq->resid_len += cmd->last_xfer_len;
|
|
@@ -742,7 +743,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
|
|
ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x",
|
|
ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x",
|
|
rq->cmd[0], rq->cmd_type);
|
|
rq->cmd[0], rq->cmd_type);
|
|
|
|
|
|
- if (blk_pc_request(rq))
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
|
|
rq->cmd_flags |= REQ_QUIET;
|
|
rq->cmd_flags |= REQ_QUIET;
|
|
else
|
|
else
|
|
rq->cmd_flags &= ~REQ_FAILED;
|
|
rq->cmd_flags &= ~REQ_FAILED;
|
|
@@ -783,21 +784,26 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
|
|
if (drive->debug_mask & IDE_DBG_RQ)
|
|
if (drive->debug_mask & IDE_DBG_RQ)
|
|
blk_dump_rq_flags(rq, "ide_cd_do_request");
|
|
blk_dump_rq_flags(rq, "ide_cd_do_request");
|
|
|
|
|
|
- if (blk_fs_request(rq)) {
|
|
|
|
|
|
+ switch (rq->cmd_type) {
|
|
|
|
+ case REQ_TYPE_FS:
|
|
if (cdrom_start_rw(drive, rq) == ide_stopped)
|
|
if (cdrom_start_rw(drive, rq) == ide_stopped)
|
|
goto out_end;
|
|
goto out_end;
|
|
- } else if (blk_sense_request(rq) || blk_pc_request(rq) ||
|
|
|
|
- rq->cmd_type == REQ_TYPE_ATA_PC) {
|
|
|
|
|
|
+ break;
|
|
|
|
+ case REQ_TYPE_SENSE:
|
|
|
|
+ case REQ_TYPE_BLOCK_PC:
|
|
|
|
+ case REQ_TYPE_ATA_PC:
|
|
if (!rq->timeout)
|
|
if (!rq->timeout)
|
|
rq->timeout = ATAPI_WAIT_PC;
|
|
rq->timeout = ATAPI_WAIT_PC;
|
|
|
|
|
|
cdrom_do_block_pc(drive, rq);
|
|
cdrom_do_block_pc(drive, rq);
|
|
- } else if (blk_special_request(rq)) {
|
|
|
|
|
|
+ break;
|
|
|
|
+ case REQ_TYPE_SPECIAL:
|
|
/* right now this can only be a reset... */
|
|
/* right now this can only be a reset... */
|
|
uptodate = 1;
|
|
uptodate = 1;
|
|
goto out_end;
|
|
goto out_end;
|
|
- } else
|
|
|
|
|
|
+ default:
|
|
BUG();
|
|
BUG();
|
|
|
|
+ }
|
|
|
|
|
|
/* prepare sense request for this command */
|
|
/* prepare sense request for this command */
|
|
ide_prep_sense(drive, rq);
|
|
ide_prep_sense(drive, rq);
|
|
@@ -809,7 +815,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
|
|
|
|
|
|
cmd.rq = rq;
|
|
cmd.rq = rq;
|
|
|
|
|
|
- if (blk_fs_request(rq) || blk_rq_bytes(rq)) {
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) {
|
|
ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
|
|
ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
|
|
ide_map_sg(drive, &cmd);
|
|
ide_map_sg(drive, &cmd);
|
|
}
|
|
}
|
|
@@ -1365,9 +1371,9 @@ static int ide_cdrom_prep_pc(struct request *rq)
|
|
|
|
|
|
static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq)
|
|
static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq)
|
|
{
|
|
{
|
|
- if (blk_fs_request(rq))
|
|
|
|
|
|
+ if (rq->cmd_type == REQ_TYPE_FS)
|
|
return ide_cdrom_prep_fs(q, rq);
|
|
return ide_cdrom_prep_fs(q, rq);
|
|
- else if (blk_pc_request(rq))
|
|
|
|
|
|
+ else if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
|
|
return ide_cdrom_prep_pc(rq);
|
|
return ide_cdrom_prep_pc(rq);
|
|
|
|
|
|
return 0;
|
|
return 0;
|