Subject: Re: MI bus ops(Re: 16bit aligned NS16550 variant)
To: TAKEMURA Shin <takemura@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 11/09/2001 08:01:58
On Sun, Nov 04, 2001 at 11:24:41AM +0900, TAKEMURA Shin wrote:

 > In the last discussion, I found that function vector definition of
 > bus_space method should be michine independent.

Yes, agree here.

 > I've rewrote hpcmips bus.h and made new MI header, bus_ops.h
 > which contains function vector definitions. I recomend you to rewrite 
 > your port's bus.h with bus_ops.h, however, I don't force to rewrite all
 > ports' bus.h with bus_ops.h.
 > 
 > I'd like to put bus_ops.h into sys/dev. (I mean sys/dev/bus_ops.h)
 > 
 > How do you think?
 > If no one objecs, I will commit this header in a few days.

So, the bus_space_ops, while independent, don't actually contain enough
info for MI code to construct its own bus_space_tag_t's.  This is because
bus_space_tag_t's still have a machine-dependent definition.

I think what I'd really like to see here is for <machine/bus.h> to be
replaced by:

	<sys/bus.h>
		Included as <machine/bus.h> is now.  Defines the
		bus_space_tag_t, bus_dma_tag_t.  Each has the
		ops pointers and a void *cookie.  If <machine/bus_types.h>
		does not define __BUS_SPACE_MD_CALLS, then it defines
		the macros that actually call the bus_space methods.
		This allows MD code to simply use pointer derefs for
		certain types of space, if it wants to.

	<machine/bus_types.h>
		Included by <sys/bus.h>, defines various types that
		<sys/bus.h> needs.  Also optionally defines things
		like __BUS_SPACE_FAST_ABI (which might e.g. define
		a faster ABI to be used for bus space methods, such
		as regparm on the x86).

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>