Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125160
b: refs/heads/master
c: 8c66285
h: refs/heads/master
v: v3
  • Loading branch information
Borislav Petkov authored and Bartlomiej Zolnierkiewicz committed Jan 2, 2009
1 parent 4efc65c commit dcd8028
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5317464dccd0c03026d60f1e9968de4f9cd23f69
refs/heads/master: 8c662852d1aa35ed370942ef2740759cd334d2d5
14 changes: 13 additions & 1 deletion trunk/drivers/ide/ide-atapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#define debug_log(fmt, args...) do {} while (0)
#endif

#define ATAPI_MIN_CDB_BYTES 12

static inline int dev_is_idecd(ide_drive_t *drive)
{
return drive->media == ide_cdrom || drive->media == ide_optical;
Expand Down Expand Up @@ -492,6 +494,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)
struct request *rq = hwif->hwgroup->rq;
ide_expiry_t *expiry;
unsigned int timeout;
int cmd_len;
ide_startstop_t startstop;
u8 ireason;

Expand All @@ -513,9 +516,18 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)
if ((ireason & ATAPI_COD) == 0 || (ireason & ATAPI_IO)) {
printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
"a packet command\n", drive->name);

return ide_do_reset(drive);
}

if (dev_is_idecd(drive)) {
/* ATAPI commands get padded out to 12 bytes minimum */
cmd_len = COMMAND_SIZE(rq->cmd[0]);
if (cmd_len < ATAPI_MIN_CDB_BYTES)
cmd_len = ATAPI_MIN_CDB_BYTES;
} else
cmd_len = ATAPI_MIN_CDB_BYTES;

/*
* If necessary schedule the packet transfer to occur 'timeout'
* miliseconds later in ide_delayed_transfer_pc() after the device
Expand All @@ -541,7 +553,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)

/* Send the actual packet */
if ((drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) == 0)
hwif->tp_ops->output_data(drive, NULL, rq->cmd, 12);
hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len);

return ide_started;
}
Expand Down

0 comments on commit dcd8028

Please sign in to comment.