Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jan 2000 21:04:33 -0500 (EST)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        kato@ganko.eps.nagoya-u.ac.jp
Cc:        FreeBSD-current@FreeBSD.ORG, FreeBSD-hackers@FreeBSD.ORG, FreeBSD98-hackers@jp.freebsd.org, nyan@jp.freebsd.org
Subject:   Re: indirection in bus space
Message-ID:  <200001250204.VAA14309@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
> > Why have two files bus_at386.h and bus_pc98.h? I386_BUS_PIO_IND should be
> > able to live with I386_BUS_PIO and I386_BUS_MEMIO happily together.
> 
> Because they are different in the type of bus_space_tag_t from each
> other.  It is the u_long in PC/AT and the structure in PC-98.  For
> example, bus_space_read_1()s of them are:
> 
>   PC/AT:
> 	bus_space_read_1(...)
> 	{
> 		...
> 		return (inb(handle + offset));
> 		...
> 	}
> 
>   PC-98:
> 	bus_space_read_1(...)
> 	{
> 		...
> 		return (inb(bsh.bsh_iat[offset]));
> 		...
> 	}
> 
You could set the handle to point to the structure instead:
	bus_space_read_1(...)
	{
		if (tag == I386_BUS_PIO) {
			return (inb(handle + offset));
		} else if (tag == I386_BUS_PIO_IND) {
			struct bus_space_handle_pc98 *bsh = handle;
	 		return (inb(bsh->bsh_iat[offset]));
		} else if (tag == I386_BUS_MEMIO) {
			...
		}
	}

-lq


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001250204.VAA14309>