Subject: sd(4) on atapibus
To: None <current-users@NetBSD.org>
From: Kouichirou Hiratsuka <hira@po6.nsk.ne.jp>
List: current-users
Date: 09/25/2003 00:26:54
Hello,

USB floppy drive does not work on -current (my PR kern/22875). It has not
worked since this commit.

http://mail-index.netbsd.org/source-changes/2003/09/18/0000.html

Now, sd_atapi.c and sd_scsi.c were merged into sd.c. According to sd_atapi.c,
on atapibus, third argument of scsipi_mode_sense_big() was constant value. On
atapibus, must it be ATAPI_FLEX_GEOMETRY_PAGE?

My USB floppy drive does work well with a following patch.

best regards.

-- 
 Kouichirou Hiratsuka
   hira@po6.nsk.ne.jp

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)) {