diff options
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 64207df8da82..26a3688de467 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -176,7 +176,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
176 | if (!sense->valid) | 176 | if (!sense->valid) |
177 | break; | 177 | break; |
178 | if (failed_command == NULL || | 178 | if (failed_command == NULL || |
179 | !blk_fs_request(failed_command)) | 179 | failed_command->cmd_type != REQ_TYPE_FS) |
180 | break; | 180 | break; |
181 | sector = (sense->information[0] << 24) | | 181 | sector = (sense->information[0] << 24) | |
182 | (sense->information[1] << 16) | | 182 | (sense->information[1] << 16) | |
@@ -292,7 +292,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
292 | "stat 0x%x", | 292 | "stat 0x%x", |
293 | rq->cmd[0], rq->cmd_type, err, stat); | 293 | rq->cmd[0], rq->cmd_type, err, stat); |
294 | 294 | ||
295 | if (blk_sense_request(rq)) { | 295 | if (rq->cmd_type == REQ_TYPE_SENSE) { |
296 | /* | 296 | /* |
297 | * We got an error trying to get sense info from the drive | 297 | * We got an error trying to get sense info from the drive |
298 | * (probably while trying to recover from a former error). | 298 | * (probably while trying to recover from a former error). |
@@ -303,7 +303,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
303 | } | 303 | } |
304 | 304 | ||
305 | /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ | 305 | /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ |
306 | if (blk_pc_request(rq) && !rq->errors) | 306 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC && !rq->errors) |
307 | rq->errors = SAM_STAT_CHECK_CONDITION; | 307 | rq->errors = SAM_STAT_CHECK_CONDITION; |
308 | 308 | ||
309 | if (blk_noretry_request(rq)) | 309 | if (blk_noretry_request(rq)) |
@@ -311,13 +311,14 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
311 | 311 | ||
312 | switch (sense_key) { | 312 | switch (sense_key) { |
313 | case NOT_READY: | 313 | case NOT_READY: |
314 | if (blk_fs_request(rq) && rq_data_dir(rq) == WRITE) { | 314 | if (rq->cmd_type == REQ_TYPE_FS && rq_data_dir(rq) == WRITE) { |
315 | if (ide_cd_breathe(drive, rq)) | 315 | if (ide_cd_breathe(drive, rq)) |
316 | return 1; | 316 | return 1; |
317 | } else { | 317 | } else { |
318 | cdrom_saw_media_change(drive); | 318 | cdrom_saw_media_change(drive); |
319 | 319 | ||
320 | if (blk_fs_request(rq) && !blk_rq_quiet(rq)) | 320 | if (rq->cmd_type == REQ_TYPE_FS && |
321 | !(rq->cmd_flags & REQ_QUIET)) { | ||
321 | printk(KERN_ERR PFX "%s: tray open\n", | 322 | printk(KERN_ERR PFX "%s: tray open\n", |
322 | drive->name); | 323 | drive->name); |
323 | } | 324 | } |
@@ -326,7 +327,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
326 | case UNIT_ATTENTION: | 327 | case UNIT_ATTENTION: |
327 | cdrom_saw_media_change(drive); | 328 | cdrom_saw_media_change(drive); |
328 | 329 | ||
329 | if (blk_fs_request(rq) == 0) | 330 | if (rq->cmd_type != REQ_TYPE_FS) |
330 | return 0; | 331 | return 0; |
331 | 332 | ||
332 | /* | 333 | /* |
@@ -352,7 +353,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
352 | * No point in retrying after an illegal request or data | 353 | * No point in retrying after an illegal request or data |
353 | * protect error. | 354 | * protect error. |
354 | */ | 355 | */ |
355 | if (!blk_rq_quiet(rq)) | 356 | if (!(rq->cmd_flags & REQ_QUIET)) |
356 | ide_dump_status(drive, "command error", stat); | 357 | ide_dump_status(drive, "command error", stat); |
357 | do_end_request = 1; | 358 | do_end_request = 1; |
358 | break; | 359 | break; |
@@ -361,20 +362,20 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
361 | * No point in re-trying a zillion times on a bad sector. | 362 | * No point in re-trying a zillion times on a bad sector. |
362 | * If we got here the error is not correctable. | 363 | * If we got here the error is not correctable. |
363 | */ | 364 | */ |
364 | if (!blk_rq_quiet(rq)) | 365 | if (!(rq->cmd_flags & REQ_QUIET)) |
365 | ide_dump_status(drive, "media error " | 366 | ide_dump_status(drive, "media error " |
366 | "(bad sector)", stat); | 367 | "(bad sector)", stat); |
367 | do_end_request = 1; | 368 | do_end_request = 1; |
368 | break; | 369 | break; |
369 | case BLANK_CHECK: | 370 | case BLANK_CHECK: |
370 | /* disk appears blank? */ | 371 | /* disk appears blank? */ |
371 | if (!blk_rq_quiet(rq)) | 372 | if (!(rq->cmd_flags & REQ_QUIET)) |
372 | ide_dump_status(drive, "media error (blank)", | 373 | ide_dump_status(drive, "media error (blank)", |
373 | stat); | 374 | stat); |
374 | do_end_request = 1; | 375 | do_end_request = 1; |
375 | break; | 376 | break; |
376 | default: | 377 | default: |
377 | if (blk_fs_request(rq) == 0) | 378 | if (req->cmd_type != REQ_TYPE_FS) |
378 | break; | 379 | break; |
379 | if (err & ~ATA_ABORTED) { | 380 | if (err & ~ATA_ABORTED) { |
380 | /* go to the default handler for other errors */ | 381 | /* go to the default handler for other errors */ |
@@ -385,7 +386,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
385 | do_end_request = 1; | 386 | do_end_request = 1; |
386 | } | 387 | } |
387 | 388 | ||
388 | if (blk_fs_request(rq) == 0) { | 389 | if (rq->cmd_type != REQ_TYPE_FS) { |
389 | rq->cmd_flags |= REQ_FAILED; | 390 | rq->cmd_flags |= REQ_FAILED; |
390 | do_end_request = 1; | 391 | do_end_request = 1; |
391 | } | 392 | } |
@@ -525,7 +526,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
525 | ide_expiry_t *expiry = NULL; | 526 | ide_expiry_t *expiry = NULL; |
526 | int dma_error = 0, dma, thislen, uptodate = 0; | 527 | int dma_error = 0, dma, thislen, uptodate = 0; |
527 | int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; | 528 | int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; |
528 | int sense = blk_sense_request(rq); | 529 | int sense = (rq->cmd_type == REQ_TYPE_SENSE); |
529 | unsigned int timeout; | 530 | unsigned int timeout; |
530 | u16 len; | 531 | u16 len; |
531 | u8 ireason, stat; | 532 | u8 ireason, stat; |
@@ -568,7 +569,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
568 | 569 | ||
569 | ide_read_bcount_and_ireason(drive, &len, &ireason); | 570 | ide_read_bcount_and_ireason(drive, &len, &ireason); |
570 | 571 | ||
571 | thislen = blk_fs_request(rq) ? len : cmd->nleft; | 572 | thislen = (rq->cmd_type == REQ_TYPE_FS) ? len : cmd->nleft; |
572 | if (thislen > len) | 573 | if (thislen > len) |
573 | thislen = len; | 574 | thislen = len; |
574 | 575 | ||
@@ -577,7 +578,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
577 | 578 | ||
578 | /* If DRQ is clear, the command has completed. */ | 579 | /* If DRQ is clear, the command has completed. */ |
579 | if ((stat & ATA_DRQ) == 0) { | 580 | if ((stat & ATA_DRQ) == 0) { |
580 | if (blk_fs_request(rq)) { | 581 | if (rq->cmd_type == REQ_TYPE_FS) { |
581 | /* | 582 | /* |
582 | * If we're not done reading/writing, complain. | 583 | * If we're not done reading/writing, complain. |
583 | * Otherwise, complete the command normally. | 584 | * Otherwise, complete the command normally. |
@@ -591,7 +592,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
591 | rq->cmd_flags |= REQ_FAILED; | 592 | rq->cmd_flags |= REQ_FAILED; |
592 | uptodate = 0; | 593 | uptodate = 0; |
593 | } | 594 | } |
594 | } else if (!blk_pc_request(rq)) { | 595 | } else if (rq->cmd_type != REQ_TYPE_BLOCK_PC) { |
595 | ide_cd_request_sense_fixup(drive, cmd); | 596 | ide_cd_request_sense_fixup(drive, cmd); |
596 | 597 | ||
597 | uptodate = cmd->nleft ? 0 : 1; | 598 | uptodate = cmd->nleft ? 0 : 1; |
@@ -640,7 +641,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
640 | 641 | ||
641 | /* pad, if necessary */ | 642 | /* pad, if necessary */ |
642 | if (len > 0) { | 643 | if (len > 0) { |
643 | if (blk_fs_request(rq) == 0 || write == 0) | 644 | if (rq->cmd_type != REQ_TYPE_FS || write == 0) |
644 | ide_pad_transfer(drive, write, len); | 645 | ide_pad_transfer(drive, write, len); |
645 | else { | 646 | else { |
646 | printk(KERN_ERR PFX "%s: confused, missing data\n", | 647 | printk(KERN_ERR PFX "%s: confused, missing data\n", |
@@ -649,11 +650,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
649 | } | 650 | } |
650 | } | 651 | } |
651 | 652 | ||
652 | if (blk_pc_request(rq)) { | 653 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
653 | timeout = rq->timeout; | 654 | timeout = rq->timeout; |
654 | } else { | 655 | } else { |
655 | timeout = ATAPI_WAIT_PC; | 656 | timeout = ATAPI_WAIT_PC; |
656 | if (!blk_fs_request(rq)) | 657 | if (rq->cmd_type != REQ_TYPE_FS) |
657 | expiry = ide_cd_expiry; | 658 | expiry = ide_cd_expiry; |
658 | } | 659 | } |
659 | 660 | ||
@@ -662,7 +663,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
662 | return ide_started; | 663 | return ide_started; |
663 | 664 | ||
664 | out_end: | 665 | out_end: |
665 | if (blk_pc_request(rq) && rc == 0) { | 666 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC && rc == 0) { |
666 | rq->resid_len = 0; | 667 | rq->resid_len = 0; |
667 | blk_end_request_all(rq, 0); | 668 | blk_end_request_all(rq, 0); |
668 | hwif->rq = NULL; | 669 | hwif->rq = NULL; |
@@ -670,7 +671,7 @@ out_end: | |||
670 | if (sense && uptodate) | 671 | if (sense && uptodate) |
671 | ide_cd_complete_failed_rq(drive, rq); | 672 | ide_cd_complete_failed_rq(drive, rq); |
672 | 673 | ||
673 | if (blk_fs_request(rq)) { | 674 | if (rq->cmd_type == REQ_TYPE_FS) { |
674 | if (cmd->nleft == 0) | 675 | if (cmd->nleft == 0) |
675 | uptodate = 1; | 676 | uptodate = 1; |
676 | } else { | 677 | } else { |
@@ -682,7 +683,7 @@ out_end: | |||
682 | ide_cd_error_cmd(drive, cmd); | 683 | ide_cd_error_cmd(drive, cmd); |
683 | 684 | ||
684 | /* make sure it's fully ended */ | 685 | /* make sure it's fully ended */ |
685 | if (blk_fs_request(rq) == 0) { | 686 | if (rq->cmd_type != REQ_TYPE_FS) { |
686 | rq->resid_len -= cmd->nbytes - cmd->nleft; | 687 | rq->resid_len -= cmd->nbytes - cmd->nleft; |
687 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) | 688 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) |
688 | rq->resid_len += cmd->last_xfer_len; | 689 | rq->resid_len += cmd->last_xfer_len; |
@@ -742,7 +743,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
742 | ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", | 743 | ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", |
743 | rq->cmd[0], rq->cmd_type); | 744 | rq->cmd[0], rq->cmd_type); |
744 | 745 | ||
745 | if (blk_pc_request(rq)) | 746 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) |
746 | rq->cmd_flags |= REQ_QUIET; | 747 | rq->cmd_flags |= REQ_QUIET; |
747 | else | 748 | else |
748 | rq->cmd_flags &= ~REQ_FAILED; | 749 | rq->cmd_flags &= ~REQ_FAILED; |
@@ -783,21 +784,26 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
783 | if (drive->debug_mask & IDE_DBG_RQ) | 784 | if (drive->debug_mask & IDE_DBG_RQ) |
784 | blk_dump_rq_flags(rq, "ide_cd_do_request"); | 785 | blk_dump_rq_flags(rq, "ide_cd_do_request"); |
785 | 786 | ||
786 | if (blk_fs_request(rq)) { | 787 | switch (rq->cmd_type) { |
788 | case REQ_TYPE_FS: | ||
787 | if (cdrom_start_rw(drive, rq) == ide_stopped) | 789 | if (cdrom_start_rw(drive, rq) == ide_stopped) |
788 | goto out_end; | 790 | goto out_end; |
789 | } else if (blk_sense_request(rq) || blk_pc_request(rq) || | 791 | break; |
790 | rq->cmd_type == REQ_TYPE_ATA_PC) { | 792 | case REQ_TYPE_SENSE: |
793 | case REQ_TYPE_BLOCK_PC: | ||
794 | case REQ_TYPE_ATA_PC: | ||
791 | if (!rq->timeout) | 795 | if (!rq->timeout) |
792 | rq->timeout = ATAPI_WAIT_PC; | 796 | rq->timeout = ATAPI_WAIT_PC; |
793 | 797 | ||
794 | cdrom_do_block_pc(drive, rq); | 798 | cdrom_do_block_pc(drive, rq); |
795 | } else if (blk_special_request(rq)) { | 799 | break; |
800 | case REQ_TYPE_SPECIAL: | ||
796 | /* right now this can only be a reset... */ | 801 | /* right now this can only be a reset... */ |
797 | uptodate = 1; | 802 | uptodate = 1; |
798 | goto out_end; | 803 | goto out_end; |
799 | } else | 804 | default: |
800 | BUG(); | 805 | BUG(); |
806 | } | ||
801 | 807 | ||
802 | /* prepare sense request for this command */ | 808 | /* prepare sense request for this command */ |
803 | ide_prep_sense(drive, rq); | 809 | ide_prep_sense(drive, rq); |
@@ -809,7 +815,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
809 | 815 | ||
810 | cmd.rq = rq; | 816 | cmd.rq = rq; |
811 | 817 | ||
812 | if (blk_fs_request(rq) || blk_rq_bytes(rq)) { | 818 | if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) { |
813 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); | 819 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); |
814 | ide_map_sg(drive, &cmd); | 820 | ide_map_sg(drive, &cmd); |
815 | } | 821 | } |
@@ -1365,9 +1371,9 @@ static int ide_cdrom_prep_pc(struct request *rq) | |||
1365 | 1371 | ||
1366 | static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq) | 1372 | static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq) |
1367 | { | 1373 | { |
1368 | if (blk_fs_request(rq)) | 1374 | if (rq->cmd_type == REQ_TYPE_FS) |
1369 | return ide_cdrom_prep_fs(q, rq); | 1375 | return ide_cdrom_prep_fs(q, rq); |
1370 | else if (blk_pc_request(rq)) | 1376 | else if (rq->cmd_type == REQ_TYPE_BLOCK_PC) |
1371 | return ide_cdrom_prep_pc(rq); | 1377 | return ide_cdrom_prep_pc(rq); |
1372 | 1378 | ||
1373 | return 0; | 1379 | return 0; |