Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 1997 21:09:11 +0100 (MET)
From:      Wilko Bulte <wilko@yedi.iaf.nl>
To:        freebsd-scsi@freebsd.org (FreeBSD SCSI hackers)
Subject:   hack for slow starting CD drives
Message-ID:  <199711262009.VAA00344@yedi.iaf.nl>

next in thread | raw e-mail | index | archive | help
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?199711262009.VAA00344>