[49] in linux-scsi channel archive
Fix for Toshiba 3301
daemon@ATHENA.MIT.EDU (Leonard N. Zubkoff)
Tue Jan 31 00:50:57 1995
To: linux-scsi@vger.rutgers.edu
Date: Wed, 25 Jan 1995 19:29:15 -0800
From: "Leonard N. Zubkoff" <lnz@dandelion.com>
I've tracked down the problem with recent kernels not working properly with the
Toshiba 3301 CD-ROM drive. When this drive powers up, it apparently has a
sector size of 512 bytes. By itself, this works fine. However, the sr_photocd
code uses the set_density SCSI command which then leaves the drive using 2048
byte sectors, but unfortunately the get_capacity has already been done. The
patch below for this is quite simple (against 1.1.83, the last stable kernel).
A remaining question is whether "dd if=/dev/sr0 | wc" should terminate with an
I/O error and a kernel message about too high a Block Address being used in a
CD-ROM SCSI call. Comments?
Leonard
--- linux.old/drivers/scsi/sr.c Tue Jan 17 23:38:36 1995
+++ linux/drivers/scsi/sr.c Wed Jan 25 17:49:25 1995
@@ -406,6 +406,8 @@
break; }
scsi_CDs[MINOR(inode->i_rdev)].mpcd_sector = sector;
+ /* The code above may have changed the sector size or capacity. */
+ scsi_CDs[MINOR(inode->i_rdev)].needs_sector_size = 1;
return;
}
@@ -424,6 +426,10 @@
if (scsi_CDs[MINOR(inode->i_rdev)].device->host->hostt->usage_count)
(*scsi_CDs[MINOR(inode->i_rdev)].device->host->hostt->usage_count)++;
+#if 1 /* don't use for now - it doesn't seem to work for everybody */
+ sr_photocd(inode);
+#endif
+
/* If this device did not have media in the drive at boot time, then
we would have been unable to get the sector size. Check to see if
this is the case, and try again.
@@ -432,10 +438,6 @@
if(scsi_CDs[MINOR(inode->i_rdev)].needs_sector_size)
get_sectorsize(MINOR(inode->i_rdev));
-#if 1 /* don't use for now - it doesn't seem to work for everybody */
- sr_photocd(inode);
-#endif
-
return 0;
}
@@ -691,7 +693,7 @@
}; /* if need DMA fixup */
}; /* for loop to fill list */
#ifdef DEBUG
- printk("SG: %d %d %d %d %d *** ",SCpnt->use_sg, SCpnt->request.sector,
+ printk("SR: %d %d %d %d %d *** ",SCpnt->use_sg, SCpnt->request.sector,
this_count,
SCpnt->request.current_nr_sectors,
SCpnt->request.nr_sectors);
@@ -916,6 +918,7 @@
if(scsi_CDs[i].sector_size == 2048)
scsi_CDs[i].capacity *= 4;
scsi_CDs[i].needs_sector_size = 0;
+ sr_sizes[i] = scsi_CDs[i].capacity;
};
scsi_free(buffer, 512);
}