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) {
- int mask = drive->queue->dma_alignment;
- unsigned long addr = (unsigned long) page_address(bio_page(rq->bio));
-
- info->cmd = rq_data_dir(rq);
+ 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;
-
- /*
- * check if dma is safe
- */
- if ((rq->data_len & mask) || (addr & mask))
- info->dma = 0;
+ info->cmd = rq_data_dir(rq);
}
/* Start sending the command to the drive. */
int nslots;
blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn);
- blk_queue_dma_alignment(drive->queue, 31);
+ blk_queue_dma_alignment(drive->queue, 3);
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
+ * set correct block size and read-only for non-ram media
*/
+ 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(file, bdev, cmd, arg);
+ int err = generic_ide_ioctl(bdev, cmd, arg);
if (err == -EINVAL) {
struct cdrom_info *info = drive->driver_data;
- err = cdrom_ioctl(file, &info->devinfo, inode, cmd, arg);
+ err = cdrom_ioctl(&info->devinfo, inode, cmd, arg);
}
return err;
}