From owner-freebsd-scsi Wed Nov 26 14:00:07 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA23421 for freebsd-scsi-outgoing; Wed, 26 Nov 1997 14:00:07 -0800 (PST) (envelope-from owner-freebsd-scsi) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id OAA23391 for ; Wed, 26 Nov 1997 14:00:01 -0800 (PST) (envelope-from julian@whistle.com) Received: (from daemon@localhost) by alpo.whistle.com (8.8.5/8.8.5) id NAA25124; Wed, 26 Nov 1997 13:47:59 -0800 (PST) Received: from UNKNOWN(), claiming to be "current1.whistle.com" via SMTP by alpo.whistle.com, id smtpd025120; Wed Nov 26 13:47:51 1997 Date: Wed, 26 Nov 1997 13:45:39 -0800 (PST) From: Julian Elischer To: Wilko Bulte cc: FreeBSD SCSI hackers Subject: Re: hack for slow starting CD drives In-Reply-To: <199711262009.VAA00344@yedi.iaf.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-scsi@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The OPEN call is done from user context rather than interrupt context, so you can do a tsleep() in there. On Wed, 26 Nov 1997, Wilko Bulte wrote: > Below is a dirty hack that allows slow-starting SCSI cdroms to be accessed > after e.g. a disk swap without running into ENXIO/Device Not Configured > errors. > > I'm not happy with it, but it seems to help. Is there any way to put a > delay in the test_ready loop? It's not nice to bomb the drive with TUR > commands IMO. Diff is based on 2.2.1R source. > > Wilko > > > *** cd.c Wed Nov 26 21:02:56 1997 > --- cd.c.orig Wed Nov 26 20:18:54 1997 > *************** > *** 246,252 **** > errval errcode = 0; > u_int32_t unit, part; > struct scsi_data *cd; > - int start_unit_retry_counter = 0; > > unit = CDUNIT(dev); > part = PARTITION(dev); > --- 246,251 ---- > *************** > *** 286,314 **** > scsi_start_unit(sc_link, CD_START); > SC_DEBUG(sc_link, SDEV_DB3, ("'start' attempted ")); > sc_link->flags |= SDEV_OPEN; /* unit attn errors are now errors */ > - > - /* This is a hack, but Toshiba CDs tend to take ages to get > - * up to speed and report 'Not Ready' while doing so. > - * Attempts to e.g. mount during this period resulted in device not > - * configured / ENXIO. > - * There should be some sleep/delay in this loop, but how? > - * I silently assume that after 5000 tries it should be awake, or > - * it will never get ready :-) > - */ > - while ((scsi_test_unit_ready(sc_link, SCSI_SILENT) != 0) && > - (start_unit_retry_counter != 5000)) { > - > - start_unit_retry_counter++; > - } > - > - /* It really should be ready by now */ > - > if (scsi_test_unit_ready(sc_link, SCSI_SILENT) != 0) { > SC_DEBUG(sc_link, SDEV_DB3, ("not ready\n")); > errcode = ENXIO; > goto bad; > } > - > SC_DEBUG(sc_link, SDEV_DB3, ("Device present\n")); > scsi_prevent(sc_link, PR_PREVENT, SCSI_SILENT); > /* > --- 285,295 ---- > _ ______________________________________________________________________ > | / o / / _ Bulte email: wilko @ yedi.iaf.nl http://www.tcja.nl/~wilko > |/|/ / / /( (_) Arnhem, The Netherlands - Do, or do not. There is no 'try' > ---------------- Support your local daemons: run [Free,Net]BSD Unix ------ >