[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"aic" device on i386



Greetings:

A friend recently purchased a Zip Zoom controller, which is a 6360-based
card;  I was unable to get a kernel to work, however.  The kernel would
get as far as

	aic0 at isa0 port 0x340-0x35f irq 11
	scsibus0 at aic0: 8 targets

and the machine would spontaneously reboot (even with DDB installed,
AIC_DEBUG enabled, and aic_debug set to 0x7f [all debug flags]).

I found a few key differences between the aic driver in openbsd and the
one in netbsd.  After patching them in (patches included below) I found
it worked perfectly.

Does my train of thought seem to be correct?  Should the patches below
be integrated?  They are against less-than-a-day-old sources.

Cheers,
Phil
---
*** aic6360.c.old	Mon Jan 20 23:20:15 1997
--- aic6360.c	Mon Jan 20 23:27:54 1997
***************
*** 73,79 ****
  #define AIC_USE_DWORDS		0
  
  /* Synchronous data transfers? */
! #define AIC_USE_SYNCHRONOUS	1
  #define AIC_SYNC_REQ_ACK_OFS 	8
  
  /* Wide data transfers? */
--- 73,79 ----
  #define AIC_USE_DWORDS		0
  
  /* Synchronous data transfers? */
! #define AIC_USE_SYNCHRONOUS	0
  #define AIC_SYNC_REQ_ACK_OFS 	8
  
  /* Wide data transfers? */
***************
*** 582,588 ****
  
  int	aicprobe	__P((struct device *, void *, void *));
  void	aicattach	__P((struct device *, struct device *, void *));
- int	aicprint	__P((void *, const char *));
  void	aic_minphys	__P((struct buf *));
  int	aicintr		__P((void *));
  void 	aic_init	__P((struct aic_softc *));
--- 582,587 ----
***************
*** 753,768 ****
  	return 0;
  }
  
- int
- aicprint(aux, name)
- 	void *aux;
- 	const char *name;
- {
- 	if (name != NULL)
- 		printf("%s: scsibus ", name);
- 	return UNCONF;
- }
- 
  /*
   * Attach the AIC6360, fill out some high and low level data structures
   */
--- 752,757 ----
***************
*** 795,801 ****
  	sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
  	    IPL_BIO, aicintr, sc, sc->sc_dev.dv_xname);
  
! 	config_found(self, &sc->sc_link, aicprint);
  }
  
  
--- 784,790 ----
  	sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
  	    IPL_BIO, aicintr, sc, sc->sc_dev.dv_xname);
  
! 	config_found(self, &sc->sc_link, scsiprint);
  }
  
  
***************
*** 1867,1874 ****
  	/* Clear host FIFO and counter. */
  	outb(iobase + DMACNTRL0, RSTFIFO | WRITE);
  	/* Enable FIFOs. */
- 	outb(iobase + SXFRCTL0, SCSIEN | DMAEN | CHEN);
  	outb(iobase + DMACNTRL0, ENDMA | DWORDPIO | WRITE);
  
  	/* Turn off ENREQINIT for now. */
  	outb(iobase + SIMODE1,
--- 1856,1863 ----
  	/* Clear host FIFO and counter. */
  	outb(iobase + DMACNTRL0, RSTFIFO | WRITE);
  	/* Enable FIFOs. */
  	outb(iobase + DMACNTRL0, ENDMA | DWORDPIO | WRITE);
+ 	outb(iobase + SXFRCTL0, SCSIEN | DMAEN | CHEN);
  
  	/* Turn off ENREQINIT for now. */
  	outb(iobase + SIMODE1,
***************
*** 1952,1962 ****
  	}
  
  phasechange:
- 	/* Stop the FIFO data path. */
- 	outb(iobase + SXFRCTL0, CHEN);
- 	while ((inb(iobase + SXFRCTL0) & SCSIEN) != 0)
- 		;
- 
  	if ((dmastat & INTSTAT) != 0) {
  		/* Some sort of phase change. */
  		int amount;
--- 1941,1946 ----
***************
*** 1965,1971 ****
  		amount = inb(iobase + FIFOSTAT) + (inb(iobase + SSTAT2) & 15);
  		if (amount > 0) {
  			out -= amount;
! 			outb(iobase + SXFRCTL0, CHEN | CLRSTCNT | CLRCH);
  			AIC_MISC(("+%d ", amount));
  		}
  	}
--- 1949,1956 ----
  		amount = inb(iobase + FIFOSTAT) + (inb(iobase + SSTAT2) & 15);
  		if (amount > 0) {
  			out -= amount;
! 			outb(iobase + DMACNTRL0, RSTFIFO | WRITE);
! 			outb(iobase + SXFRCTL0, CHEN | CLRCH);
  			AIC_MISC(("+%d ", amount));
  		}
  	}
***************
*** 1974,1979 ****
--- 1959,1968 ----
  	outb(iobase + SIMODE1,
  	    ENSCSIRST | ENSCSIPERR | ENBUSFREE | ENREQINIT | ENPHASECHG);
  
+ 	/* Stop the FIFO data path. */
+ 	outb(iobase + SXFRCTL0, CHEN);
+ 	outb(iobase + DMACNTRL0, 0);
+ 
  	return out;
  }
  
***************
*** 1998,2005 ****
  	/* Clear host FIFO and counter. */
  	outb(iobase + DMACNTRL0, RSTFIFO);
  	/* Enable FIFOs. */
- 	outb(iobase + SXFRCTL0, SCSIEN | DMAEN | CHEN);
  	outb(iobase + DMACNTRL0, ENDMA | DWORDPIO);
  
  	/* Turn off ENREQINIT for now. */
  	outb(iobase + SIMODE1,
--- 1987,1994 ----
  	/* Clear host FIFO and counter. */
  	outb(iobase + DMACNTRL0, RSTFIFO);
  	/* Enable FIFOs. */
  	outb(iobase + DMACNTRL0, ENDMA | DWORDPIO);
+ 	outb(iobase + SXFRCTL0, SCSIEN | DMAEN | CHEN);
  
  	/* Turn off ENREQINIT for now. */
  	outb(iobase + SIMODE1,
***************
*** 2080,2094 ****
  	}
  
  phasechange:
- 	/* Stop the FIFO data path. */
- 	outb(iobase + SXFRCTL0, CHEN);
- 	while ((inb(iobase + SXFRCTL0) & SCSIEN) != 0)
- 		;
- 
  	/* Turn on ENREQINIT again. */
  	outb(iobase + SIMODE1,
  	    ENSCSIRST | ENSCSIPERR | ENBUSFREE | ENREQINIT | ENPHASECHG);
  
  	return in;
  }
  
--- 2069,2082 ----
  	}
  
  phasechange:
  	/* Turn on ENREQINIT again. */
  	outb(iobase + SIMODE1,
  	    ENSCSIRST | ENSCSIPERR | ENBUSFREE | ENREQINIT | ENPHASECHG);
  
+ 	/* Stop the FIFO data path. */
+ 	outb(iobase + SXFRCTL0, CHEN);
+ 	outb(iobase + DMACNTRL0, 0);
+ 
  	return in;
  }
  
***************
*** 2343,2348 ****
--- 2331,2340 ----
  		case AIC_DISCONNECT:
  			AIC_ASSERT(sc->sc_nexus != NULL);
  			acb = sc->sc_nexus;
+ #if 1 /* XXXX */
+ 			acb->data_addr = sc->sc_dp;
+ 			acb->data_length = sc->sc_dleft;
+ #endif
  			TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
  			sc->sc_nexus = NULL;
  			goto sched;
***************
*** 2424,2437 ****
  			break;
  		AIC_ASSERT(sc->sc_nexus != NULL);
  		acb = sc->sc_nexus;
- 		/* XXXX Don't clear FIFO.  Wait for byte to come in. */
  		outb(iobase + SXFRCTL0, CHEN | SPIOEN);
- 		outb(iobase + DMACNTRL0, RSTFIFO);
  		acb->target_stat = inb(iobase + SCSIDAT);
  		outb(iobase + SXFRCTL0, CHEN);
- 		outb(iobase + DMACNTRL0, RSTFIFO);
- 		while ((inb(iobase + SXFRCTL0) & SCSIEN) != 0)
- 			;
  		AIC_MISC(("target_stat=0x%02x  ", acb->target_stat));
  		sc->sc_prevphase = PH_STAT;
  		goto loop;
--- 2416,2424 ----

--
Phillip F Knaack
Systems Administrator, Information Development for Extension Audiences (IDEA)
Iowa State University Extension


Visit your host, monkey.org