Subject: SCSI driver doesn't wait enough for CD ROM to become ready
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: current-users
Date: 08/09/1994 22:28:14
Some CD-ROM drives (like mine) take a while to become ready after a bus
reset.  The CD driver ought to delay a bit to let them finish if they
aren't initially ready.  Here's a patch.

==John

===================================================================
RCS file: RCS/cd.c,v
retrieving revision 1.1
diff -c -r1.1 cd.c
*** 1.1	1994/08/10 01:41:15
--- cd.c	1994/08/10 02:20:32
***************
*** 141,146 ****
--- 141,147 ----
  	struct cd_data *cd = (void *)self;
  	struct cd_parms *dp = &cd->params;
  	struct scsi_link *sc_link = aux;
+ 	int error;
  
  	SC_DEBUG(sc_link, SDEV_DB2, ("cdattach: "));
  
***************
*** 172,178 ****
  	 * the drive. We cannot use interrupts yet, so the
  	 * request must specify this.
  	 */
! 	cd_get_parms(cd, SCSI_NOSLEEP | SCSI_NOMASK | SCSI_SILENT);
  	if (dp->disksize)
  		printf(": cd present, %d x %d byte records\n",
  		    cd->params.disksize, cd->params.blksize);
--- 173,184 ----
  	 * the drive. We cannot use interrupts yet, so the
  	 * request must specify this.
  	 */
! 	error = cd_get_parms(cd, SCSI_NOSLEEP | SCSI_NOMASK | SCSI_SILENT);
! 	if (error) {
! 	    /* The device may take time to settle after a SCSI bus reset. */
! 	    delay(/*TWO_SECS*/2000000);
! 	    error = cd_get_parms(cd, SCSI_NOSLEEP | SCSI_NOMASK | SCSI_SILENT);
! 	}
  	if (dp->disksize)
  		printf(": cd present, %d x %d byte records\n",
  		    cd->params.disksize, cd->params.blksize);

------------------------------------------------------------------------------