From owner-freebsd-scsi Wed Nov 26 12:13:30 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id MAA15687 for freebsd-scsi-outgoing; Wed, 26 Nov 1997 12:13:30 -0800 (PST) (envelope-from owner-freebsd-scsi) Received: from iafnl.es.iaf.nl (uucp@iafnl.es.iaf.nl [195.108.17.20]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id MAA15668 for ; Wed, 26 Nov 1997 12:13:26 -0800 (PST) (envelope-from wilko@yedi.iaf.nl) Received: by iafnl.es.iaf.nl with UUCP id AA01999 (5.67b/IDA-1.5 for freebsd-scsi@freebsd.org); Wed, 26 Nov 1997 21:13:45 +0100 Received: (from wilko@localhost) by yedi.iaf.nl (8.8.5/8.6.12) id VAA00344 for freebsd-scsi@freebsd.org; Wed, 26 Nov 1997 21:09:11 +0100 (MET) From: Wilko Bulte Message-Id: <199711262009.VAA00344@yedi.iaf.nl> Subject: hack for slow starting CD drives To: freebsd-scsi@freebsd.org (FreeBSD SCSI hackers) Date: Wed, 26 Nov 1997 21:09:11 +0100 (MET) X-Organisation: Private FreeBSD site - Arnhem, The Netherlands X-Pgp-Info: PGP public key at 'finger wilko@freefall.freebsd.org' X-Mailer: ELM [version 2.4 PL24 ME8a] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-scsi@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 ------