Subject: Re: Patch for recent ncr.c lossage / not just ncr.c
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Erik Bertelsen <erik@mediator.uni-c.dk>
List: current-users
Date: 10/18/1999 17:39:25
On Sun, Oct 17, 1999 at 08:52:24AM -0700, Jason Thorpe wrote:
> 
> that's *it*?  Well, that's *very* odd.  the chip should be idle at this point
> and should call ncr53c9x_sched() to actually get the operation going.  Could
> you sprinkle some additional printfs() in ncr53c9x_scsi_cmd() to dump out
> the driver state, etc?

Well, maybe you'll be able to see something from the trace below, where
I've added a few printf's per the diff below:


...
esp0 at obio0 (quick): address 0x8b0000: NCR53C96, 16MHz, SCSI ID 7
[NCR_INIT(1)] <cmd:0x2><cmd:0x0><cmd:0x3>scsibus0 at esp0: 8 targets, 8 luns per target
...
   several lines about zsc0 and zstty0 and 1
...
nubus0 at mainbus0
fpu0 at mainbus0 (mc68040)
scsibus0: waiting for 2 seconds for devices to settle...
[ncr53c9x_scsi_cmd] [0x0, 6]->0 sc_state: 8.

and that's it -- here the machine hangs still.

Index: ncr53c9x.c
===================================================================
RCS file: /home/cvs-base/src/sys/dev/ic/ncr53c9x.c,v
retrieving revision 1.1.1.34
diff -c -r1.1.1.34 ncr53c9x.c
*** ncr53c9x.c	1999/10/01 23:34:32	1.1.1.34
--- ncr53c9x.c	1999/10/18 14:48:57
***************
*** 99,105 ****
  #include <dev/ic/ncr53c9xreg.h>
  #include <dev/ic/ncr53c9xvar.h>
  
! int ncr53c9x_debug = 0; /*NCR_SHOWPHASE|NCR_SHOWMISC|NCR_SHOWTRAC|NCR_SHOWCMDS;*/
  
  /*static*/ void	ncr53c9x_readregs	__P((struct ncr53c9x_softc *));
  /*static*/ void	ncr53c9x_select		__P((struct ncr53c9x_softc *,
--- 99,106 ----
  #include <dev/ic/ncr53c9xreg.h>
  #include <dev/ic/ncr53c9xvar.h>
  
! #define NCR53C9X_DEBUG 2
! int ncr53c9x_debug = 0x3ff;
  
  /*static*/ void	ncr53c9x_readregs	__P((struct ncr53c9x_softc *));
  /*static*/ void	ncr53c9x_select		__P((struct ncr53c9x_softc *,
***************
*** 325,330 ****
--- 326,332 ----
  	NCR_TRACE(("[NCR_INIT(%d)] ", doreset));
  
  	if (sc->sc_state == 0) {
+ 	  printf("init 1st time\n");
  		/* First time through; initialize. */
  		TAILQ_INIT(&sc->ready_list);
  		TAILQ_INIT(&sc->nexus_list);
***************
*** 338,343 ****
--- 340,346 ----
  		}
  		bzero(sc->sc_tinfo, sizeof(sc->sc_tinfo));
  	} else {
+ 	  printf("init next time\n");
  		/* Cancel any active commands. */
  		sc->sc_state = NCR_CLEANING;
  		if ((ecb = sc->sc_nexus) != NULL) {
***************
*** 654,659 ****
--- 657,663 ----
  	}
  	ecb->stat = 0;
  
+ 	printf("sc_state: %d.\n", sc->sc_state);
  	s = splbio();
  
  	TAILQ_INSERT_TAIL(&sc->ready_list, ecb, chain);
***************
*** 665,670 ****
--- 669,675 ----
  	if ((flags & XS_CTL_POLL) == 0)
  		return (SUCCESSFULLY_QUEUED);
  
+ 	printf("using polling instead...\n");
  	/* Not allowed to use interrupts, use polling instead */
  	if (ncr53c9x_poll(sc, xs, ecb->timeout)) {
  		ncr53c9x_timeout(ecb);


The scsi_cmd line comes ca. 2 secs after the "waiting ..." line (i've
verified this, also by trying to wait 20 secs instead of 2).


sc_state 8 is 
#define NCR_SBR         8       /* Expect a SCSI RST because we commanded it */

where the code tests for 

#define NCR_IDLE        1       /* waiting for something to do */

when deciding whether to call ncr53c9x_sched().

- Erik