summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
commit6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch)
tree0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /drivers/scsi/sr.c
parentecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff)
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine status unknown.
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r--drivers/scsi/sr.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index dc6712247..e568c6d1b 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -25,6 +25,9 @@
*
* Modified by Richard Gooch <rgooch@atnf.csiro.au> to support devfs
*
+ * Modified by Jens Axboe <axboe@suse.de> - support DVD-RAM
+ * transparently and loose the GHOST hack
+ *
*/
#include <linux/module.h>
@@ -297,9 +300,10 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
else
printk("sr: can't switch blocksize: in interrupt\n");
}
- if (SCpnt->request.cmd == WRITE) {
+
+ if ((SCpnt->request.cmd == WRITE) && !scsi_CDs[dev].device->writeable)
return 0;
- }
+
if (scsi_CDs[dev].device->sector_size == 1024) {
if ((block & 1) || (SCpnt->request.nr_sectors & 1)) {
printk("sr.c:Bad 1K block number requested (%d %ld)",
@@ -322,9 +326,6 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
}
switch (SCpnt->request.cmd) {
case WRITE:
- if (!scsi_CDs[dev].device->writeable) {
- return 0;
- }
SCpnt->cmnd[0] = WRITE_10;
SCpnt->sc_data_direction = SCSI_DATA_WRITE;
break;
@@ -587,10 +588,11 @@ void get_capabilities(int i)
scsi_CDs[i].readcd_known = 1;
scsi_CDs[i].readcd_cdda = buffer[n + 5] & 0x01;
/* print some capability bits */
- printk("sr%i: scsi3-mmc drive: %dx/%dx %s%s%s%s%s\n", i,
+ printk("sr%i: scsi3-mmc drive: %dx/%dx %s%s%s%s%s%s\n", i,
((buffer[n + 14] << 8) + buffer[n + 15]) / 176,
scsi_CDs[i].cdi.speed,
buffer[n + 3] & 0x01 ? "writer " : "", /* CD Writer */
+ buffer[n + 3] & 0x20 ? "dvd-ram " : "",
buffer[n + 2] & 0x02 ? "cd/rw " : "", /* can read rewriteable */
buffer[n + 4] & 0x20 ? "xa/form2 " : "", /* can read xa/from2 */
buffer[n + 5] & 0x01 ? "cdda " : "", /* can read audio data */
@@ -601,9 +603,12 @@ void get_capabilities(int i)
if ((buffer[n + 2] & 0x8) == 0)
/* not a DVD drive */
scsi_CDs[i].cdi.mask |= CDC_DVD;
- if ((buffer[n + 3] & 0x20) == 0)
+ if ((buffer[n + 3] & 0x20) == 0) {
/* can't write DVD-RAM media */
scsi_CDs[i].cdi.mask |= CDC_DVD_RAM;
+ } else {
+ scsi_CDs[i].device->writeable = 1;
+ }
if ((buffer[n + 3] & 0x10) == 0)
/* can't write DVD-R media */
scsi_CDs[i].cdi.mask |= CDC_DVD_R;
@@ -627,7 +632,6 @@ void get_capabilities(int i)
/*else I don't think it can close its tray
scsi_CDs[i].cdi.mask |= CDC_CLOSE_TRAY; */
-
scsi_free(buffer, 512);
}