From owner-cvs-all Tue Sep 28 6:54:34 1999 Delivered-To: cvs-all@freebsd.org Received: from cs0.catv.ne.jp (cs0.catv.ne.jp [202.232.171.20]) by hub.freebsd.org (Postfix) with ESMTP id 20AD1154AE; Tue, 28 Sep 1999 06:54:23 -0700 (PDT) (envelope-from nyan@dd.catv.ne.jp) Received: from localhost by cs0.catv.ne.jp (8.9.1/3.7W) id WAA15925; Tue, 28 Sep 1999 22:53:28 +0900 (JST) To: imp@village.org Cc: winter@jurai.net, kato@FreeBSD.org, nyan@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Cc: FreeBSD98-hackers@jp.freebsd.org Subject: Re: cvs commit: src/sys/conf files src/sys/i386/conf files.i386 In-Reply-To: <199909270628.AAA08033@harmony.village.org> References: <199909270628.AAA08033@harmony.village.org> From: Takahashi Yoshihiro X-Mailer: Mew version 1.93 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA) Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <19990928225355G.nyan@dd.catv.ne.jp> Date: Tue, 28 Sep 1999 22:53:55 +0900 (JST) X-Dispatcher: imput version 980905(IM100) Lines: 55 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk 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 > would look like the following. In a nutshel, its bsh is a pointer to > an array of I/O ports, and the offset is an index into that array. So > you'd effectively replace bsh+offset with bsh[offset]. The driver > would be responsible for managing the bsh array for the _INDIRECT > case. I agree this method. 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; and, for example, bus_space_write_1 is the following: static __inline void bus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int8_t value) { #if defined(_I386_BUS_PIO_H_) #if defined(_I386_BUS_MEMIO_H_) || defined(_I386_BUS_PIOI_H_) if (tag == I386_BUS_SPACE_IO) #endif outb(bsh.bsh_base + offset, value); #endif #if defined(_I386_BUS_MEMIO_H_) #if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIOI_H_) else if (tag == I386_BUS_SPACE_MEM) #endif *(volatile u_int8_t *)(bsh.bsh_base + offset) = value; #endif #if defined(_I386_BUS_PIOI_H_) #if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_) else if (tag == I386_BUS_SPACE_IO_INDIRECT) #endif outb(bsh.bsh_iat[offset], value); #endif } It is unnecessary to do the ugly casts by changing like this. I think that there is no problem with this method. --- Takahashi Yoshihiro / nyan@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message