Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82123
b: refs/heads/master
c: 0d6f7e3
h: refs/heads/master
i:
  82121: 815aae6
  82119: f8bbe9a
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Feb 1, 2008
1 parent faf4c00 commit 2a4326f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 50 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: 0041e7c6ca9719309bef6a4754e4eb9566b37ae1
refs/heads/master: 0d6f7e3a1845165b81adab3fc5fd13916f22aa61
64 changes: 15 additions & 49 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,21 +683,25 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector,
* ok; nonzero if the request has been terminated.
*/
static
int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
int ide_cd_check_ireason(ide_drive_t *drive, int len, int ireason, int rw)
{
if (ireason == 2)
/*
* ireason == 0: the drive wants to receive data from us
* ireason == 2: the drive is expecting to transfer data to us
*/
if (ireason == (!rw << 1))
return 0;
else if (ireason == 0) {
else if (ireason == (rw << 1)) {
ide_hwif_t *hwif = drive->hwif;
xfer_func_t *xf;

/* Whoops... The drive is expecting to receive data from us! */
/* Whoops... */
printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
drive->name, __FUNCTION__);

/* Throw some data at the drive so it doesn't hang
and quit this request. */
ide_cd_pad_transfer(drive, hwif->atapi_output_bytes, len);
} else if (ireason == 1) {
xf = rw ? hwif->atapi_output_bytes : hwif->atapi_input_bytes;
ide_cd_pad_transfer(drive, xf, len);
} else if (rw == 0 && ireason == 1) {
/* Some drives (ASUS) seem to tell us that status
* info is available. just get it and ignore.
*/
Expand Down Expand Up @@ -984,35 +988,6 @@ int ide_cd_queue_pc(ide_drive_t *drive, struct request *rq)
return (rq->cmd_flags & REQ_FAILED) ? -EIO : 0;
}

/*
* Write handling
*/
static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
{
/* Two notes about IDE interrupt reason here - 0 means that
* the drive wants to receive data from us, 2 means that
* the drive is expecting to transfer data to us.
*/
if (ireason == 0)
return 0;
else if (ireason == 2) {
ide_hwif_t *hwif = drive->hwif;

/* Whoops... The drive wants to send data. */
printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
drive->name, __FUNCTION__);

ide_cd_pad_transfer(drive, hwif->atapi_input_bytes, len);
} else {
/* Drive wants a command packet, or invalid ireason... */
printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
drive->name, __FUNCTION__, ireason);
}

cdrom_end_request(drive, 0);
return 1;
}

/*
* Called from blk_end_request_callback() after the data of the request
* is completed and before the request is completed.
Expand Down Expand Up @@ -1108,20 +1083,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
/*
* check which way to transfer data
*/
if ((blk_fs_request(rq) || blk_pc_request(rq)) && write) {
/*
* write to drive
*/
if (cdrom_write_check_ireason(drive, len, ireason))
return ide_stopped;
} else if (blk_fs_request(rq) || blk_pc_request(rq)) {
/*
* read from drive
*/
if (cdrom_read_check_ireason(drive, len, ireason))
if (blk_fs_request(rq) || blk_pc_request(rq)) {
if (ide_cd_check_ireason(drive, len, ireason, write))
return ide_stopped;

if (blk_fs_request(rq)) {
if (blk_fs_request(rq) && write == 0) {
int nskip;

if (ide_cd_check_transfer_size(drive, len)) {
Expand Down

0 comments on commit 2a4326f

Please sign in to comment.