NetBSD Problem Report #14230

Received: (qmail 14821 invoked from network); 12 Oct 2001 11:10:01 -0000
Message-Id: <200110121109.f9CB9xv11724@cancel.kyoto.jepro.co.jp>
Date: Fri, 12 Oct 2001 20:09:59 +0900 (JST)
From: Takahiro Kambe <taca@kyoto.jepro.co.jp>
Reply-To: taca@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: Supporting SCSI drives reporting illegal sector size
X-Send-Pr-Version: 3.95

>Number:         14230
>Category:       kern
>Synopsis:       Supporting SCSI drives reporting illegal sector size
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 12 11:11:00 +0000 2001
>Closed-Date:    Fri Mar 23 10:06:44 +0000 2018
>Last-Modified:  Fri Mar 23 10:06:44 +0000 2018
>Originator:     Takahiro Kambe
>Release:        NetBSD 1.5.2
>Organization:
JEPRO Co., Ltd.
>Environment:

System: NetBSD cancel.kyoto.jepro.co.jp 1.5.2 NetBSD 1.5.2 (CANCEL) #30: Fri Sep 14 18:05:08 JST 2001 taca@cancel.kyoto.jepro.co.jp:/usr/src/sys/arch/i386/compile/CANCEL i386


>Description:
	Some vendor sells "External SCSI hard disk drive", which is
	eally constructed with IDE hard disk drive and IDE-SCSI
	converter.

	Some of those *cheap* products report illegal sector size
	as bellow:

sd0 at scsibus0 target 4 lun 0: <MELCO, DSU-GTH, 1.0H> SCSI3 0/direct fixed
sd0: 4810 MB, 12968 cyl, 6 head, 1028 sec, 63 bytes/sect x 80063424 sectors

	Of cource, this disk's real sector size isn't 63 bytes but
	512 bytes.  (I have opened the case and found an IDE disk
	drive in it.)  And ignoring reported sector size, those
	defective products may be used.

>How-To-Repeat:
	Boot NetBSD with cheap "External SCSI hard disk drive".
>Fix:
	Adding a new quirk bit.  But quirks in scsipi_link structure
	is u_int16 type and all bits are already defined.

	I assume in bellow patch that "ADEV_" and "SDEV_" bits would
	never used for the same device, and defined SDEV_NOSECSIZE
	same as ADEV_LITTLETOC.

	P.S.
	Once I met other type of problem with another product, which
	had broken SCSI disconnect command implementation.  If SCSI
	disconnect command could be disabled with SCSI inquiry
	information.

Index: scsiconf.c
===================================================================
RCS file: /usr/pkg/libdata/cvs/netbsd/sys/dev/scsipi/scsiconf.c,v
retrieving revision 1.1.1.6.2.2
diff -u -u -r1.1.1.6.2.2 scsiconf.c
--- scsiconf.c	2000/09/06 05:15:57	1.1.1.6.2.2
+++ scsiconf.c	2001/10/12 07:17:12
@@ -588,6 +588,8 @@
 	 "SEAGATE ", "ST34501FC       ", ""},     SDEV_NOMODESENSE},
 	{{T_DIRECT, T_FIXED,
 	 "TOSHIBA ", "MK538FB         ", "6027"}, SDEV_NOLUNS},
+	{{T_DIRECT, T_FIXED,
+	 "MELCO ", "DSU-GTH", ""}, 		  SDEV_NOSECSIZE},
 	{{T_DIRECT, T_REMOV,
 	 "iomega", "jaz 1GB", 		 ""},	  SDEV_NOMODESENSE},
 	{{T_DIRECT, T_REMOV,
Index: scsipiconf.h
===================================================================
RCS file: /usr/pkg/libdata/cvs/netbsd/sys/dev/scsipi/scsipiconf.h,v
retrieving revision 1.1.1.5
diff -u -u -r1.1.1.5 scsipiconf.h
--- scsipiconf.h	2000/06/15 00:01:21	1.1.1.5
+++ scsipiconf.h	2001/10/12 07:17:12
@@ -212,6 +212,7 @@
 #define ADEV_NODOORLOCK		0x2000	/* device can't lock door */
 #define ADEV_NOSENSE		0x4000	/* device can't handle request sense */
 #define SDEV_ONLYBIG		0x8000	/* only use SCSI_{READ,WRITE}_BIG */
+#define SDEV_NOSECSIZE		0x0400	/* device reports bad secotr size */

 	struct	scsipi_device *device;	/* device entry points etc. */
 	void	*device_softc;		/* needed for call to foo_start */
Index: sd_scsi.c
===================================================================
RCS file: /usr/pkg/libdata/cvs/netbsd/sys/dev/scsipi/sd_scsi.c,v
retrieving revision 1.1.1.3
diff -u -u -r1.1.1.3 sd_scsi.c
--- sd_scsi.c	2000/06/15 00:01:21	1.1.1.3
+++ sd_scsi.c	2001/10/12 07:17:12
@@ -293,7 +293,7 @@
 		if (dp->heads == 0 || dp->cyls == 0)
 			goto fake_it;

-		if (dp->blksize == 0)
+		if (dp->blksize == 0 || (link->quirks & SDEV_NOSECSIZE))
 			dp->blksize = 512;

 		sectors = scsipi_size(link, flags);
@@ -314,7 +314,7 @@
 		if (dp->disksize == 0)
 			goto fake_it;

-		if (dp->blksize == 0)
+		if (dp->blksize == 0 || (link->quirks & SDEV_NOSECSIZE))
 			dp->blksize = 512;

 		return (SDGP_RESULT_OK);

>Release-Note:
>Audit-Trail:

From: Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
To: Takahiro Kambe <taca@kyoto.jepro.co.jp>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/14230: Supporting SCSI drives reporting illegal sector size
Date: Fri, 12 Oct 2001 13:40:00 +0200

 Mutt made me believe that Takahiro Kambe wrote:
 > +#define SDEV_NOSECSIZE		0x0400	/* device reports bad secotr size */

 sector, not secotr

 Bye,
  Thomas
Responsible-Changed-From-To: kern-bug-people->bouyer 
Responsible-Changed-By: fair 
Responsible-Changed-When: Wed Jan 16 02:15:43 PST 2002 
Responsible-Changed-Why:  
Manuel should review this suggested quirk addition. 
State-Changed-From-To: open->feedback 
State-Changed-By: mycroft 
State-Changed-When: Tue Sep 9 03:46:07 UTC 2003 
State-Changed-Why:  
If possible, please retest this with -current (sd_scsi.c 1.34 or later), or 
send me the hardware for further testing.  Please send me the dmesg output 
if you try it. 
Responsible-Changed-From-To: bouyer->mycroft 
Responsible-Changed-By: mycroft 
Responsible-Changed-When: Tue Sep 9 04:48:03 UTC 2003 
Responsible-Changed-Why:  
. 

From: Takahiro Kambe <taca@back-street.net>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: Re: kern/14230: Supporting SCSI drives reporting illegal sector
 size
Date: Wed, 07 Jan 2004 11:02:11 +0900 (JST)

 In message <20040105051006.10918.qmail@mail.netbsd.org>
 	on 5 Jan 2004 05:10:06 -0000,
 	gnats@netbsd.org wrote:
 > This is an infrequent reminder that there is 1 Problem Report
 > (PR) of yours in the NetBSD GNATS database in "feedback" state.
 ...
 > kern/14230 - serious medium priority change-request
 > 	Supporting SCSI drives reporting illegal sector size
 > 	http://www.NetBSD.org/cgi-bin/query-pr-single.pl?number=14230
 I'm sorry that I can't test the disk drive any more since it was owned
 by my previous company.

 -- 
 Takahiro Kambe <taca@back-street.net>
State-Changed-From-To: feedback->suspended 
State-Changed-By: fair 
State-Changed-When: Sat Mar 27 07:56:38 UTC 2004 
State-Changed-Why:  

Feedback provided - no longer able to test proposed solution 
because quirky hardware is no longer available. 
Responsible-Changed-From-To: mycroft->kern-bug-people
Responsible-Changed-By: wiz@netbsd.org
Responsible-Changed-When: Sun, 03 Sep 2006 01:13:25 +0000
Responsible-Changed-Why:
Back to role account, mycroft doesn't have commit access any longer.


State-Changed-From-To: suspended->closed
State-Changed-By: maxv@NetBSD.org
State-Changed-When: Fri, 23 Mar 2018 10:06:44 +0000
State-Changed-Why:
Close this PR, the hardware was not available, the code has changed a
lot since, and it's irrelevant today.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.