Subject: Re: Howto: Configure device that needs access to multiple busses
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Quentin Garnier <email@example.com>
Date: 06/30/2006 00:48:53
Content-Type: text/plain; charset=us-ascii
On Thu, Jun 29, 2006 at 05:07:37PM -0400, der Mouse wrote:
> > I'm writing a device driver for a device that has i/o on both the ISA
> > bus and on a GPIO pin. Obviously I need to map handles for both
> > busses so I can do I/O for the device, but I don't know how to write
> > the CONFIG file entry for the device.
> There may be some better way to represent it, but what I'd probably do
> is to make it two devices from the point of view of config. Those two
> device's drivers would then have some private form of communication
> between themselves. I'd probably make both drivers just thin glue
> layers in front of a single shared file that contained all the real
> guts for both (the latter being compiled based on a attribute attached
> to each of the other devices, and with care taken to make sure it does
> something sensible if only one of the devices is configured in), but
> there are doubtless other ways to do it.
> You might want to look at the way wscons is put together; that has
> cases where things that appear in disparate parts of the autoconfig
> tree - keyboards and displays - need to be stuck together.
See also the interactions between attimer(4) and pcppi(4). For that I
used config_defer, which is enough because both devices are expected to
have a common parent. Using config_defer works as long as you can
locate a common ancestor (not only know it, but get the associated
struct device). Otherwise you can you config_interrupts, which will
enable the devices to talk to each other at a point where you're certain
both have attaches, even though the 'interrupts' part makes it a bit
Quentin Garnier - firstname.lastname@example.org - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (NetBSD)
-----END PGP SIGNATURE-----