do_end_request = 1;
} else if (sense_key == ILLEGAL_REQUEST ||
sense_key == DATA_PROTECT) {
- /*
- * check if this was a write protected media
- */
- if (rq_data_dir(rq) == WRITE) {
- printk("ide-cd: media marked write protected\n");
- set_disk_ro(drive->disk, 1);
- }
-
/* No point in retrying after an illegal
request or data protect error.*/
ide_dump_status (drive, "command error", stat);
* sg request
*/
if (rq->bio) {
- if (rq->data_len & 3) {
- printk("%s: block pc not aligned, len=%d\n", drive->name, rq->data_len);
- cdrom_end_request(drive, 0);
- return ide_stopped;
- }
- info->dma = drive->using_dma;
+ int mask = drive->queue->dma_alignment;
+ unsigned long addr = (unsigned long) page_address(bio_page(rq->bio));
+
info->cmd = rq_data_dir(rq);
+ info->dma = drive->using_dma;
+
+ /*
+ * check if dma is safe
+ */
+ if ((rq->data_len & mask) || (addr & mask))
+ info->dma = 0;
}
/* Start sending the command to the drive. */
return 0;
}
-
/*
* Close down the device. Invalidate all cached blocks.
*/
devinfo->mask |= CDC_CLOSE_TRAY;
if (!CDROM_CONFIG_FLAGS(drive)->mo_drive)
devinfo->mask |= CDC_MO_DRIVE;
- if (!CDROM_CONFIG_FLAGS(drive)->mrw)
- devinfo->mask |= CDC_MRW;
- if (!CDROM_CONFIG_FLAGS(drive)->mrw_w)
- devinfo->mask |= CDC_MRW_W;
- if (!CDROM_CONFIG_FLAGS(drive)->ram)
- devinfo->mask |= CDC_RAM;
devinfo->disk = drive->disk;
return register_cdrom(devinfo);
struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *cdi = &info->devinfo;
struct atapi_capabilities_page cap;
- int nslots = 1, mrw_write = 0, ram_write = 0;
+ int nslots = 1;
if (drive->media == ide_optical) {
CDROM_CONFIG_FLAGS(drive)->mo_drive = 1;
if (ide_cdrom_get_capabilities(drive, &cap))
return 0;
- if (!cdrom_is_mrw(cdi, &mrw_write)) {
- CDROM_CONFIG_FLAGS(drive)->mrw = 1;
- if (mrw_write) {
- CDROM_CONFIG_FLAGS(drive)->mrw_w = 1;
- CDROM_CONFIG_FLAGS(drive)->ram = 1;
- }
- }
- if (!cdrom_is_random_writable(cdi, &ram_write))
- if (ram_write)
- CDROM_CONFIG_FLAGS(drive)->ram = 1;
-
if (cap.lock == 0)
CDROM_CONFIG_FLAGS(drive)->no_doorlock = 1;
if (cap.eject)
(CDROM_CONFIG_FLAGS(drive)->cd_r)? "-R" : "",
(CDROM_CONFIG_FLAGS(drive)->cd_rw)? "/RW" : "");
- if (CDROM_CONFIG_FLAGS(drive)->mrw || CDROM_CONFIG_FLAGS(drive)->mrw_w)
- printk(" CD-MR%s", CDROM_CONFIG_FLAGS(drive)->mrw_w ? "W" : "");
-
if (CDROM_CONFIG_FLAGS(drive)->is_changer)
printk(" changer w/%d slots", nslots);
else
int nslots;
blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn);
- blk_queue_dma_alignment(drive->queue, 3);
+ blk_queue_dma_alignment(drive->queue, 31);
drive->queue->unplug_delay = (1 * HZ) / 1000;
if (!drive->queue->unplug_delay)
drive->queue->unplug_delay = 1;
nslots = ide_cdrom_probe_capabilities (drive);
/*
- * set correct block size and read-only for non-ram media
+ * set correct block size
*/
- set_disk_ro(drive->disk, !CDROM_CONFIG_FLAGS(drive)->ram);
blk_queue_hardsect_size(drive->queue, CD_FRAMESIZE);
#if 0
{
struct block_device *bdev = inode->i_bdev;
ide_drive_t *drive = bdev->bd_disk->private_data;
- int err = generic_ide_ioctl(bdev, cmd, arg);
+ int err = generic_ide_ioctl(file, bdev, cmd, arg);
if (err == -EINVAL) {
struct cdrom_info *info = drive->driver_data;
- err = cdrom_ioctl(&info->devinfo, inode, cmd, arg);
+ err = cdrom_ioctl(file, &info->devinfo, inode, cmd, arg);
}
return err;
}