Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 1999 03:06:50 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Takahashi Yoshihiro <nyan@FreeBSD.org>
Cc:        imp@village.org, winter@jurai.net, kato@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, FreeBSD98-hackers@jp.freebsd.org
Subject:   Re: cvs commit: src/sys/conf files src/sys/i386/conf files.i386 
Message-ID:  <Pine.BSF.4.10.9909290231150.7599-100000@alphplex.bde.org>
In-Reply-To: <19990928225355G.nyan@dd.catv.ne.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 28 Sep 1999, Takahashi Yoshihiro wrote:

> In article <199909270628.AAA08033@harmony.village.org>
> Warner Losh <imp@village.org> writes:
> 
> > I'd also like to get some feedback on a related issue.  I'd like to
> > know what people think of adding a third space to the I386 port.  The
> > third I/O space would be I386_BUS_SPACE_IO_INDIRECT.  The code for it

> I agree this method.

I don't agree with it.  It's better for drivers to do the necessary
indirections directly (and use indirection for for all bus types that they
support) except in very special circumstances (1) && ((2) || (3)):

1) Only one bus type supported, and the tag for that is a compile-time
   constant.  Otherwise, there will be an extra branch in the bus space
   routines for getting to the inirect case.  This branch will cost
   more than indirection on most machines.
2) i386-style PIO access with the port address in a register, and offset
   0.  If the port address is in a softc, then there must be an indirection
   to load it, and the load should load the final address
   (sc->sc_bshtable[offset]).  If the offset is nonzero, then on i386's
   there must be an instruction to add it, and this will take the same
   time as an indirection in many cases even if the base address is in
   a register.
3) MEMIO access with the port in a register, and the offset constant or in
   a register, and a machine that does suitable (base + index) addressing
   at no cost.

> But, your code requires some ugly casts.
> I suggest the following way to fix this problem.
> 
> bus_space_handle_t is the union instead of u_int.
> 
> 	union bus_space_handle {
> 		bus_addr_t bsh_base;
> 		bus_addr_t *bsh_iat;
> 	};
> 	typedef union bus_space_handle bus_space_handle_t;

Doesn't this require changing all drivers that currently use the
bus space functions to be changed to initialise their sc->sc_bsh.base
instead of their sc->sc_bsh?  This is uglier than casting.

Bruce



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9909290231150.7599-100000>