Subject: ncr_si driver
To: None <port-sparc@NetBSD.ORG>
From: Jason Thorpe <thorpej@SJ.Xenotropic.COM>
List: port-sparc
Date: 12/05/1995 03:20:08
Folks ...

I've put a "work-in-progress" source snapshot of where I'm at in porting 
David Jones' new 5380 driver to the Sun 4.

	ftp://ftp.SJ.Xenotropic.COM/pub/sparc/

basalt (thorpej) ~ftp/pub/sparc 292% ll
total 130
-rw-r--r--  1 thorpej  wheel    2446 Dec  5 03:13 README.5380
-rw-r--r--  1 thorpej  wheel    2623 Dec  5 02:46 sparc_5380.diffs
-rw-r--r--  1 thorpej  wheel  121522 Dec  5 02:49 sparc_5380.shar
basalt (thorpej) ~ftp/pub/sparc 293% 

Please be patient with the network link ... Attached below is the 
README.5380 file.

Enjoy.

------------------------------------------------------------------------------
Jason R. Thorpe                                         thorpej@Xenotropic.COM

           Just me and my collection of obsolete computer gear(s).

-----cut here-----
To try this out, extract the file sparc_5380.shar in arch/sparc/dev.
Then apply the patches in sparc_5380.diffs.  You'll have to patch
the following files:

	arch/sparc/vm_machdep.c:	Flush the write-back cache in
					dvma_mapin() to make sure that
					a buffer we want to do a DVMA
					write with is actually in main
					memory.

	arch/sparc/conf/files.sparc:	Goop to include the new 5380
					driver rather than the old.

	arch/sparc/conf/GENERIC:	Change the interrupt level of
					the "si" and "sw".  The "si" on
					my 4/260 is a level 3.

NOTES:
	The driver works (i.e. system runs, runs fast, doesn't panic,
	data is intact) with DVMA, DVMA interrupts, and reselect enabled
	on my 4/260.  There is only one device on the SCSI chain - a
	1.3gb Hitachi SCSI-II disk.

	Recently pulled some sun3-specific stuff out of the MI 5380
	code which kept it from compiling with DIAGNOSTIC defined.

	If a kernel is compiled with DIAGNOSTIC, my machine panic's
	early on.  It may or may not be related to the 5380 driver.
	I needed the machine up, so I didn't take the time to track
	it down.

	The 4/100 "sw" code is still a _wild_ guess.  It might work,
	but probably won't.  The register map in ncr_sireg.h is
	correct, though, and the DVMA stuff for the "sw" is based
	on it's apparent similarities to the "si" and suggestions
	of others.  Try it in PIO mode (flags 0x7; see below) first.

	I recently changed how the dma_handles are allocated.  They
	don't need to be allocated in DVMA space on the sun4, because
	the sun4 doesn't have a UDC.  This greatly reduced the number
	of "ie0: DMA underrun" errors I got, but I'm still getting them,
	and the frequency seems to have increased a little, though
	they're not nearly as bad as they were before I made this
	change.

	Rememeber, you can change the "options" (disable them,
	which is opposite the sun3 version, but I found this more
	useful) by using the "flags" directive in your kernel config
	file.  For example:

	si0 at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x4

	would configure si0 to not use reselects.  The bits are:

		0x1	Don't use DVMA.
		0x2	If using DVMA, poll for completion rather than
			using interrupts.
		0x4	Don't allow reselects.

	An extremely conservative person might use 0x7, which
	disables all the nifty features except for the "works MUCH
	better than the old one" feature.

GOOD LUCK!
		-- Jason R. Thorpe <thorpej@NetBSD.ORG>
		   December 5, 1995