Subject: dev/scsipi/ch.c:chattach() fix ? (and approval for commit?)
To: None <tech-kern@netbsd.org>
From: Stoned Elipot <seb@ssr.univ-paris7.fr>
List: tech-kern
Date: 06/15/2004 16:48:24
--UugvWAfsgieZRqgk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,
When I updated the box to which my scsi changer is attached from 1.6.2_STABLE
to 2.0_BETA I've lost the pretty autoconf boot message about its 
characteristics.

With straight 2.0_BETA I have:
ch0 at scsibus1 target 4 lun 0: <QUALSTAR, RLS-4221, 0047> changer removable
ch0: 0 slots, 0 drives, 0 pickers, 0 portals

A first chio params after boot gives correct informations expect the current
picker is somewhat wrong:
# chio params 
/dev/ch0: 22 slots, 1 drive, 1 picker
/dev/ch0: current picker: -65000

After digging around I've found that the first call to ch_get_params() from
ch.c:chattach() gathers mostly zero values.

Reading the diffs of dev/scsipi/ between 1.6 branch and current I tried
to add a dummy scsipi_test_unit_ready() in chattach(). Such a call was
previously done in scsiconf.c:scsi_probe_device() and was removed in its
revision 1.216. That solved my autoconf information gathering problem
so then things like current picker right after boot is ok.

I now have:
ch0 at scsibus1 target 4 lun 0: <QUALSTAR, RLS-4221, 0047> changer removable
ch0: 22 slots, 1 drive, 1 picker, 0 portals

Attached is my diff. I'd like to have your comments on it.

Cheers, Stoned.

--UugvWAfsgieZRqgk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ch.c.diffs"

Index: ch.c
===================================================================
RCS file: /cvsroot/src/sys/dev/scsipi/ch.c,v
retrieving revision 1.59
diff -u -u -r1.59 ch.c
--- ch.c	23 Apr 2004 21:52:17 -0000	1.59
+++ ch.c	15 Jun 2004 12:53:53 -0000
@@ -225,6 +225,14 @@
 	}
 
 	/*
+	 * Do a dummy TEST UNIT READY to shake the changer, it helps
+	 * gathering information about the device for some model.
+	 */
+	(void)scsipi_test_unit_ready(sc->sc_periph, XS_CTL_DISCOVERY |
+	    XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_NOT_READY |
+	    XS_CTL_IGNORE_MEDIA_CHANGE);
+
+	/*
 	 * Get information about the device.  Note we can't use
 	 * interrupts yet.
 	 */

--UugvWAfsgieZRqgk--