Date: Wed, 26 Nov 1997 13:45:39 -0800 (PST) From: Julian Elischer <julian@whistle.com> To: Wilko Bulte <wilko@yedi.iaf.nl> Cc: FreeBSD SCSI hackers <freebsd-scsi@FreeBSD.ORG> Subject: Re: hack for slow starting CD drives Message-ID: <Pine.BSF.3.95.971126134434.3379E-100000@current1.whistle.com> In-Reply-To: <199711262009.VAA00344@yedi.iaf.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
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 ------
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.971126134434.3379E-100000>
