Subject: kern/22938: fix sd(4) on atapibus (maybe it's temporary)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hira@po6.nsk.ne.jp>
List: netbsd-bugs
Date: 09/25/2003 04:30:42
>Number:         22938
>Category:       kern
>Synopsis:       fix sd(4) on atapibus (maybe it's temporary)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 24 19:31:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Kouichirou Hiratsuka
>Release:        NetBSD 1.6ZC
>Organization:
>Environment:
System: NetBSD firefly.localdomain 1.6ZC NetBSD 1.6ZC (FIREFLY) #153: Thu Sep 25 01:26:16 JST 2003 root@firefly.localdomain:/usr/src/sys/arch/i386/compile/FIREFLY i386
Architecture: i386
Machine: i386
>Description:
	On atapibus, sd(4) does not work on -current. On atapibus, must
	scsipi_mode_sense_big() be called with page = ATAPI_FLEX_GEOMETRY_PAGE?
	I have a patch that fix this problem. It seems to be good for a my USB
	floppy drives. But instead of using this patch, maybe some functions in
	sd.c (sd_get_parms() and sd_get_papacity() etc.) should be fixed for
	ATAPI drives.

>How-To-Repeat:

>Fix:
	This patch can close PR kern/22875 by myself.

Index: sd.c
===================================================================
RCS file: /cvs/cvsroot/src/sys/dev/scsipi/sd.c,v
retrieving revision 1.210
diff -u -r1.210 sd.c
--- sd.c	18 Sep 2003 06:55:53 -0000	1.210
+++ sd.c	24 Sep 2003 11:57:34 -0000
@@ -87,6 +87,7 @@
 #include <dev/scsipi/scsi_disk.h>
 #include <dev/scsipi/scsiconf.h>
 #include <dev/scsipi/sdvar.h>
+#include <dev/scsipi/atapi_disk.h>
 
 #define	SDUNIT(dev)			DISKUNIT(dev)
 #define	SDPART(dev)			DISKPART(dev)
@@ -1570,6 +1571,9 @@
 	int page, flags;
 	int *big;
 {
+	
+	if (scsipi_periph_bustype(sd->sc_periph) == SCSIPI_BUSTYPE_ATAPI)
+		page = ATAPI_FLEX_GEOMETRY_PAGE;
 
 	if ((sd->sc_periph->periph_quirks & PQUIRK_ONLYBIG) &&
 	    !(sd->sc_periph->periph_quirks & PQUIRK_NOBIGMODESENSE)) {

>Release-Note:
>Audit-Trail:
>Unformatted: