Subject: Re: vme device configuration on sparc
To: Paul Kranenburg <pk@cs.few.eur.nl>
From: Matthias Drochner <drochner@zelux6.zel.kfa-juelich.de>
List: port-sparc
Date: 06/18/1997 13:47:13
Excerpts from netbsd: 18-Jun-97 Re: vme device configuratio.. Paul
Kranenburg@cs.few.e (1108*)

[machine dependant state information]

I don't know what's necessary for the sparc, but I've
put all the state information into the softc of the vme
interfave driver, ie the parent of the vme bus. Don't
know if this makes sense in your case.

> > #define VME_NUMCFRANGES 3
> > 
> > struct vme_range {
> > 	vme_addr_t offset;
> > 	vme_size_t size;
> > 	vme_am_t am;
> > };
> 
> What do you propose the actual VME device configuration lines will look like?

I've allowed for 3 address ranges for now because
2 are necessary for many devices and I wanted to
be on the save side. (atari/vme gives a good example
otherwise, but I consider one "mem" range and one
"io" a bit too special.)
In "files.vme" I have:
device vme {addr0 = -1, [len0 = -1], [am0 = -1], [addr1 = -1], [len1 =
-1], [am1 = -1], [addr2 = -1], [len2 = -1], [am2 = -1], [irq = -1],
[vect = -1]}
attach vme at vmebus
file dev/vme/vme.c vme

vmesubmatch() in vme.c starts with:
	struct vme_attach_args v;
	int i;

	for(i = 0; i < VME_NUMCFRANGES; i++) {
		v.r[i].offset = (vme_addr_t)(dev->cf_loc[3 * i + 0]);
		v.r[i].size = (vme_size_t)(dev->cf_loc[3 * i + 1]);
		v.r[i].am = dev->cf_loc[3 * i + 2];
	}
	v.ilevel = dev->cf_loc[3 * VME_NUMCFRANGES];
	v.ivector = dev->cf_loc[3 * VME_NUMCFRANGES + 1];


As I wrote in a previous mail, I don't like to deal with bus widths here,
the driver of the VME device should know what the device can handle.
(One could imagine a nicer syntax for "config" - kind of variable
lenghts locator fields - but I personally can live without this luxory.)

best regards
Matthias