diff options
-rw-r--r-- | drivers/ide/ide-atapi.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index d412bd2bd7fd..5fdcb953fc13 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #define debug_log(fmt, args...) do {} while (0) | 15 | #define debug_log(fmt, args...) do {} while (0) |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | #define ATAPI_MIN_CDB_BYTES 12 | ||
19 | |||
18 | static inline int dev_is_idecd(ide_drive_t *drive) | 20 | static inline int dev_is_idecd(ide_drive_t *drive) |
19 | { | 21 | { |
20 | return drive->media == ide_cdrom || drive->media == ide_optical; | 22 | return drive->media == ide_cdrom || drive->media == ide_optical; |
@@ -492,6 +494,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
492 | struct request *rq = hwif->hwgroup->rq; | 494 | struct request *rq = hwif->hwgroup->rq; |
493 | ide_expiry_t *expiry; | 495 | ide_expiry_t *expiry; |
494 | unsigned int timeout; | 496 | unsigned int timeout; |
497 | int cmd_len; | ||
495 | ide_startstop_t startstop; | 498 | ide_startstop_t startstop; |
496 | u8 ireason; | 499 | u8 ireason; |
497 | 500 | ||
@@ -513,9 +516,18 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
513 | if ((ireason & ATAPI_COD) == 0 || (ireason & ATAPI_IO)) { | 516 | if ((ireason & ATAPI_COD) == 0 || (ireason & ATAPI_IO)) { |
514 | printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing " | 517 | printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing " |
515 | "a packet command\n", drive->name); | 518 | "a packet command\n", drive->name); |
519 | |||
516 | return ide_do_reset(drive); | 520 | return ide_do_reset(drive); |
517 | } | 521 | } |
518 | 522 | ||
523 | if (dev_is_idecd(drive)) { | ||
524 | /* ATAPI commands get padded out to 12 bytes minimum */ | ||
525 | cmd_len = COMMAND_SIZE(rq->cmd[0]); | ||
526 | if (cmd_len < ATAPI_MIN_CDB_BYTES) | ||
527 | cmd_len = ATAPI_MIN_CDB_BYTES; | ||
528 | } else | ||
529 | cmd_len = ATAPI_MIN_CDB_BYTES; | ||
530 | |||
519 | /* | 531 | /* |
520 | * If necessary schedule the packet transfer to occur 'timeout' | 532 | * If necessary schedule the packet transfer to occur 'timeout' |
521 | * miliseconds later in ide_delayed_transfer_pc() after the device | 533 | * miliseconds later in ide_delayed_transfer_pc() after the device |
@@ -541,7 +553,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
541 | 553 | ||
542 | /* Send the actual packet */ | 554 | /* Send the actual packet */ |
543 | if ((drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) == 0) | 555 | if ((drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) == 0) |
544 | hwif->tp_ops->output_data(drive, NULL, rq->cmd, 12); | 556 | hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len); |
545 | 557 | ||
546 | return ide_started; | 558 | return ide_started; |
547 | } | 559 | } |