From owner-cvs-all Tue Sep 28 10: 7:15 1999 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 3C002158D3; Tue, 28 Sep 1999 10:06:58 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from d214.syd2.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id DAA31974; Wed, 29 Sep 1999 03:07:40 +1000 Date: Wed, 29 Sep 1999 03:06:50 +1000 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Takahashi Yoshihiro 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 In-Reply-To: <19990928225355G.nyan@dd.catv.ne.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk On Tue, 28 Sep 1999, Takahashi Yoshihiro wrote: > In article <199909270628.AAA08033@harmony.village.org> > Warner Losh 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