Subject: kern/13454: WangDAT DDS-1 tape-drive reporting wrong blocksize range
To: None <gnats-bugs@gnats.netbsd.org>
From: None <wojtek@wojtek.3miasto.net>
List: netbsd-bugs
Date: 07/13/2001 00:30:14
>Number:         13454
>Category:       kern
>Synopsis:       WangDAT DDS-1 tape-drive reporting wrong blocksize range
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 13 00:28:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.5.1
>Organization:
	
>Environment:
System: NetBSD wojtek.3miasto.net 1.5.1 NetBSD 1.5.1 (local) #1: Thu Jul 12 13:45:04 PDT 2001 root@wojtek.3miasto.net:/usr/src/sys/arch/i386/compile/local i386


>Description:
	WangDAT 3100 drive has seriously broken firmware. it responds it can
handle blocksize from 512 to 512 bytes, while can use variable blocksize
with block from 1 to 32768. using it's default 512 makes it really slow,
while with large blocks works perfect.
>How-To-Repeat:
	mt setblk 0
	tar -b64 -cvf /dev/rst0 <something>
	you got kernel error that block must be between 512 and 512
>Fix:

i've added another quirk "ST_Q_IGNORE_BLKLIM". when set kernel doesn't ask
drive for limits and assume 1 byte minimum and 32kbyte maximum.


--- /usr/src/sys/dev/scsipi/st.c.old	Thu Jul 12 05:47:03 2001
+++ /usr/src/sys/dev/scsipi/st.c	Thu Jul 12 13:44:49 2001
@@ -123,6 +123,8 @@
 #define	ST_Q_IGNORE_LOADS	0x0004
 #define	ST_Q_BLKSIZE		0x0008	/* variable-block media_blksize > 0 */
 #define	ST_Q_UNIMODAL		0x0010	/* unimode drive rejects mode select */
+#define ST_Q_IGNORE_BLKLIM	0x0020  /* ignore blkmin/max values from drive */
+					/* assume 1, 32768 */
 	u_int page_0_size;
 #define	MAX_PAGE_0_SIZE	64
 	struct modes modes[4];
@@ -240,6 +242,13 @@
 		{ST_Q_FORCE_BLKSIZE, 0, DDS}		/* minor 12-15 */
 	}}},
 	{{T_SEQUENTIAL, T_REMOV,
+	 "WangDAT ", "Model 3100      ", ""},     {ST_Q_IGNORE_BLKLIM, 0, {
+		{0, 0, 0},				/* minor 0-3 */
+		{ST_Q_FORCE_BLKSIZE, 512, DDS},		/* minor 4-7 */
+		{ST_Q_FORCE_BLKSIZE, 1024, DDS},	/* minor 8-11 */
+		{ST_Q_FORCE_BLKSIZE, 0, DDS}		/* minor 12-15 */
+	}}},
+	{{T_SEQUENTIAL, T_REMOV,
 	 "EXABYTE ", "EXB-8200        ", "263H"}, {0, 5, {
 		{0, 0, 0},				/* minor 0-3 */
 		{0, 0, 0},				/* minor 4-7 */
@@ -890,7 +899,10 @@
 	 * Load the physical device parameters
 	 * loads: blkmin, blkmax
 	 */
-	if ((error = st_read_block_limits(st, 0)) != 0)
+	if (st-> quirks & ST_Q_IGNORE_BLKLIM) {
+		st->blkmin = 1;
+		st->blkmax = 32768;
+	} else if ((error = st_read_block_limits(st, 0)) != 0)
 		return (error);
 	/*
 	 * Load the media dependent parameters
>Release-Note:
>Audit-Trail:
>Unformatted: