Subject: Re: DVD-RAM: geometry & hangs
To: None <tech-kern@netbsd.org>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: tech-kern
Date: 11/18/1999 19:00:28
Hi,

Using the (ugly, admitted) patches below, I got far enough to 
 - get the DVD-RAM attached as sd1, not cd1
 - use 2048 byte sectors instead of 512 byte ones
 - get the system to treat it as a "direct" device, not a "cdrom"

I can label, newfs and mount, but not access the mountpoint:

yui# newfs /dev/sd1a
yui# mount /dev/sd1a /mnt
yui# ls -la /mnt
ls: /mnt: Bad file descriptor
yui# cd /mnt
/mnt: Not a directory.

If I write data to /dev/sd1a and read it back, it appears to be corrupt
(different md5) for files >2048 bytes.


 - Hubert

-- 
NetBSD - Better for your uptime than Viagra


Index: sd_scsi.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/sd_scsi.c,v
retrieving revision 1.8
diff -u -r1.8 sd_scsi.c
--- sd_scsi.c	1998/10/08 20:21:13	1.8
+++ sd_scsi.c	1999/11/18 17:49:17
@@ -87,6 +87,8 @@
 	 "",         "",                 ""},
 	{T_OPTICAL, T_REMOV,
 	 "",         "",                 ""},
+	{T_CDROM, T_REMOV,				/*HF*/
+	 "MATSHITA",  "PD-2 LF-D100",    "A113"},	/*HF*/
 };
 
 struct sd_scsibus_mode_sense_data {
@@ -324,7 +326,11 @@
 	dp->heads = 64;
 	dp->sectors = 32;
 	dp->cyls = sectors / (64 * 32);
+#if 0
 	dp->blksize = 512;
+#else
+	dp->blksize = 2048;		/*HF*/
+#endif
 	dp->disksize = sectors;
 	return (SDGP_RESULT_OK);
 }
Index: scsiconf.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/scsiconf.c,v
retrieving revision 1.122.2.1
diff -u -r1.122.2.1 scsiconf.c
--- scsiconf.c	1999/11/10 18:30:21	1.122.2.1
+++ scsiconf.c	1999/11/18 17:49:20
@@ -659,6 +659,22 @@
 	    sizeof(scsi_quirk_patterns)/sizeof(scsi_quirk_patterns[0]),
 	    sizeof(scsi_quirk_patterns[0]), &priority);
 
+#if 1 /* solved differently in sd_scsi.c::sd_scsibus_patterns */
+	/*
+	 * hack attack - get Panasonic LF-D100 DVD-RAM going.
+	 * it claims to be a cdrom, but can be accessed like a
+	 * disk, see http://www.panasonic.com/industrial_oem/computer/storage/dvd-ram/images/drivers/panasonic-dvd.diff.gz
+	 */
+	printf("HFHFHF type=%d, removable=%d\n",
+		sa.sa_inqbuf.type, sa.sa_inqbuf.removable);
+	if (!bcmp(sa.sa_inqbuf.vendor,  "MATSHITA", 8) &&
+	    !bcmp(sa.sa_inqbuf.product, "PD-2 LF-D100", 12) &&
+	    sa.sa_inqbuf.type != 127 /* what is 127? */) {
+		printf("HFHFHF Mathshita found!\n");
+		sa.sa_inqbuf.type=0; /* cdrom -> direct */
+	}
+#endif
+
 	/*
 	 * Based upon the inquiry flags we got back, and if we're
 	 * at SCSI-2 or better, set some limiting quirks.