Subject: Re: vme device configuration on sparc
To: Paul Kranenburg <pk@cs.few.eur.nl>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-sparc
Date: 06/07/1997 13:12:46
On Sat, 7 Jun 1997 21:45:57 +0200 (MET DST) 
 Paul Kranenburg <pk@cs.few.eur.nl> wrote:

 > The example above would end up looking like:
 > 
 >         cgtwo0  at vme0 addr 0x400000 level 4 vect 0xa8 aspace 24 dspace 16
 > 
 > 
 > This would iron out the "kitchen sink" code obio.c and also make support for
 > VME on sun4m machines look less contorted.
 > 
 > Comments?

YES!  This is exactly how it should be.  I made some attempt at something
like this when I wrote the VME support for the mvme68k port, although I
still used vmes and vmel ... I would much rather it be all at vme.

Something like this is totally necessary if we ever want to have MI VME
support.  The way bus.h would fit into this model would be to have
multiple bus_space_tag_t's for each of the possible space combinations
that VME supports:

/*
 * Aux argument passed to VME device probe and attach routines.
 */
struct vme_attach_args {
	bus_addr_t	va_addr;	/* VME address */
	int		va_intrlvl;	/* VME interrupt level */
	int		va_intrvec;	/* VME interrupt vector */
	int		va_aspace;	/* Address space indicator */
	int		va_dspace;	/* Data space indicator */

	/* Bus space tags for A16 space. */
	bus_space_tag_t	va_a16d16;
	bus_space_tag_t	va_a16d32;

	/* Bus space tags for A24 space. */
	bus_space_tag_t	va_a24d16;
	bus_space_tag_t	va_a24d32;

	/* Bus space tags for A32 space. */
	bus_space_tag_t	va_a32d16;
	bus_space_tag_t	va_a32d32;

	/* XXX What about 64-bit VME? */
};

Quite likely, the bus space read and write methods would be identical for
all of of the A* spaces, and read/write methods for D* spaces would be
selectively unimplemented (i.e. cause a panic if used) as appropriate
(i.e. no bus_space_read_4 in D16 space, for example).

But, the real difference would be in the bus_space_map() guts, which
would perform the address translation as appropriate for the given
A*D* combination.

The va_aspace and va_dspace "locators" (more like indicators) are used
to tell the driver which bus_space_tag it should use.  Alternatively,
the driver could Just Know, based on which spaces the hardware manual
for the device says it supports :-)

So, Paul, you have my complete support... I'd really like to make this
MI one day, and I know other people would, as well :-)

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939