Subject: Re: NetBSD-sparc si driver
To: None <ddean@CS.Princeton.EDU>
From: Chuck Cranor <chuck@dworkin.wustl.edu>
List: port-sparc
Date: 02/01/1995 16:59:29
hi drew-

   the sparc port doesn't have an obio.h or an isr.h (those are from
the sun3 port).   i just looked at those files and you don't really
need anything from those files.  what you need to do is look at a VME 
device driver that works on NetBSD/sparc.   the only one in the tree 
right now is the "ie" driver (dev/if_ie.c).   basically you are interested
in the match and attach routines.

match routine:
	the sun3 uses a bus_peek(bustype, paddr, size) to probe for
	the device.   bus_peek maps in paddr and probes it.   

	for the sparc you need to use probeget(vaddr, size).  in the
	sparc port the first page of the device is already mapped by
	obio.c in bus_tmp(), so probeget takes a virtual address.
	make sure you use the correct size when probing the VME bus
	(e.g. you can't do a 32 bit load in "vmes0" space).   


attach routine:
	here is where you need the struct confargs.   the structures
	are not that different.   some of the info you need is in the
	romaux structure.   the sun3 "bus_mapin(bustype, paddr, size)" is
	used to map the device in.   on the sparc you can use the
	"mapiodev(paddr, size, bustype)" function (returns vaddr of
	device).   

	to set up VME interrupts you need to replace the sun3's 
	isr_add_vectored() function.   you need to have a 
	"struct intrhand sc_ih" in the softc.   then you can do this:
	ncr5380->sc_ih.ih_fun = ncr_intr; /* intr function */
	ncr5380->sc_ih.ih_arg = ncr5380;  /* arg to intr function */
	
	last you call vmeintr_establish(vector, level, interhandp) like
	this:
	vmeintr_establish(ca->ca_ra.ra_intr[0].int_vec,
		ca->ca_ra.ra_intr[0].int_pri, &(ncr5380->sc_ih));

	note that "ca->ca_ra" is the romaux that has the vector and
	priority in it.


Hope that is helpful!!   good luck...

Chuck