Subject: Re: SCSI tape?
To: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-sun3
Date: 08/01/1995 16:46:59
When I ported the `si' driver to the sparc, I noticed something similar 
to this whenever it tried to talk to the Emulex QIC-36 controller.  I 
sent Gordon the following patch, but he hasn't committed it yet.  Give 
this a shot, and see if it helps.

--------------------------------------------------------------------------
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939

-----cut here-----
Index: si.c
===================================================================
RCS file: /mastersrc/netbsd/src/sys/arch/sun3/dev/si.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 si.c
*** si.c	1995/06/02 19:06:28	1.1.1.2
--- si.c	1995/06/18 18:52:58
***************
*** 524,529 ****
--- 524,531 ----
  	register u_char	bid, icmd;
  	int		ret = SCSI_RET_RETRY;
  	int 	arb_retries, arb_wait;
+ 	int i;
+ 	volatile u_char vuc;
  
  	/* for our purposes.. */
  	myid = 1 << myid;
***************
*** 548,564 ****
  
  	icmd = regs->sci_icmd & ~(SCI_ICMD_DIFF|SCI_ICMD_TEST);
  
! 	if ((regs->sci_bus_csr & (SCI_BUS_BSY|SCI_BUS_SEL)) &&
! 	    (regs->sci_bus_csr & (SCI_BUS_BSY|SCI_BUS_SEL)) &&
! 	    (regs->sci_bus_csr & (SCI_BUS_BSY|SCI_BUS_SEL)))
! 	{
! 		/* Something is sitting on the SCSI bus... */
! #ifdef	DEBUG
! 		if (si_debug) {
! 			printf("si_select_target: still BSY+SEL; resetting...\n");
! 		}
  #endif
- 		/* Send bus device reset. */
  		ret = SCSI_RET_NEED_RESET;
  		goto nosel;
  	}
--- 550,568 ----
  
  	icmd = regs->sci_icmd & ~(SCI_ICMD_DIFF|SCI_ICMD_TEST);
  
! 	/* Picked this constant for convenience. --thorpej */
! 	for (i = 0; i < ARBITRATION_RETRIES; ++i) {
! 		vuc = (regs->sci_bus_csr & (SCI_BUS_BSY|SCI_BUS_SEL));
! 		if (vuc == 0)
! 			break;
! 		delay(10);
! 	}
! 	if (vuc != 0) {
! 		/* No sir, I don't like it.  Call for a reset. */
! #ifdef DEBUG
! 		if (si_debug)
! 			printf("si_select_target: still BSY+SEL; resetting\n");
  #endif
  		ret = SCSI_RET_NEED_RESET;
  		goto nosel;
  	}