Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jan 2012 13:02:59 +0100
From:      Stefan Bethke <stb@lassitu.de>
To:        Warner Losh <imp@bsdimp.com>
Cc:        FreeBSD-arch <freebsd-arch@FreeBSD.org>
Subject:   Re: Extending sys/dev/mii
Message-ID:  <0759FAC9-D4CD-444D-A7A4-545383709631@lassitu.de>
In-Reply-To: <8EF24110-C985-400F-ADDF-B1D63C4E304B@bsdimp.com>
References:  <8D025847-4BE4-4B2C-87D7-97E72CC9D325@lassitu.de> <20120104215930.GM90831@alchemy.franken.de> <47ABA638-7E08-4350-A03C-3D4A23BF2D7E@lassitu.de> <1763C3FF-1EA0-4DC0-891D-63816EBF4A04@lassitu.de> <20120106182756.GA88161@alchemy.franken.de> <95372FB3-406F-46C2-8684-4FDB672D9FCF@lassitu.de> <20120106214741.GB88161@alchemy.franken.de> <F60B2B70-049F-4497-BBA8-3C421088C1EA@lassitu.de> <20120108130039.GG88161@alchemy.franken.de> <23477898-8D85-498C-8E30-192810BD68A8@lassitu.de> <20120111193738.GB44286@alchemy.franken.de> <66DDA0A2-F878-43FF-8824-54868F493B18@lassitu.de> <8EF24110-C985-400F-ADDF-B1D63C4E304B@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Am 21.01.2012 um 02:43 schrieb Warner Losh:

>=20
> On Jan 20, 2012, at 5:08 PM, Stefan Bethke wrote:
>> The second problem is that there's currently no way to express a =
dependency between two devices other than a parent-child relationship.   =
I would be interested to learn why this appears to be so uncommon that I =
could not find any discussion of such a feature.  Has it really never =
before come up?
>=20
> Sure there is: you can do it by name.  I wrote a driver that attached =
to the ISA bus, but also needed to talk to the ppbus that was attached =
to the printer.  My solution was to have a post-attach name-lookup so =
that it could then call methods on the other driver's device_t.  I =
wonder why we can't do that here?


That was my first approach, but the attachment sequence foiled it: arge0 =
is probed and attached before the device that provides the MDIO bus =
arge0 needs to attach the miibus and phy.  As far as I can tell, there =
is no way to express (via code or hints or otherwise) that a device =
should be attached only after some other device has been attached.

The solution for me was to write miiproxy which contains code that waits =
for both devices to attach, and then calls a callback on arge0 to =
complete the interface attachment (attaches miibus, makes the interface =
available).

=46rom a driver writers point of view, it would be desirable to be able =
to say "attach this only after 'foo0' has been attached", so the attach =
method can still be a single, linear piece of code.


Stefan

--=20
Stefan Bethke <stb@lassitu.de>   Fon +49 151 14070811






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0759FAC9-D4CD-444D-A7A4-545383709631>