Date: Tue, 28 Sep 1999 22:53:55 +0900 (JST) From: Takahashi Yoshihiro <nyan@FreeBSD.org> To: imp@village.org Cc: FreeBSD98-hackers@jp.freebsd.org Subject: Re: cvs commit: src/sys/conf files src/sys/i386/conf files.i386 Message-ID: <19990928225355G.nyan@dd.catv.ne.jp> In-Reply-To: <199909270628.AAA08033@harmony.village.org> References: <Pine.BSF.4.10.9909262335030.1659-100000@sasami.jurai.net> <199909270628.AAA08033@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990928225355G.nyan>