From owner-freebsd-arch@FreeBSD.ORG Sat Jan 21 12:03:01 2012 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6118106566C for ; Sat, 21 Jan 2012 12:03:01 +0000 (UTC) (envelope-from stb@lassitu.de) Received: from gilb.zs64.net (gilb.zs64.net [IPv6:2001:470:1f0b:105e::1ea]) by mx1.freebsd.org (Postfix) with ESMTP id 9004E8FC1A for ; Sat, 21 Jan 2012 12:03:01 +0000 (UTC) Received: by gilb.zs64.net (Postfix, from stb@lassitu.de) id 4AF0811DE2C; Sat, 21 Jan 2012 12:03:00 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: Stefan Bethke In-Reply-To: <8EF24110-C985-400F-ADDF-B1D63C4E304B@bsdimp.com> Date: Sat, 21 Jan 2012 13:02:59 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <0759FAC9-D4CD-444D-A7A4-545383709631@lassitu.de> 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> <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> To: Warner Losh X-Mailer: Apple Mail (2.1251.1) Cc: FreeBSD-arch Subject: Re: Extending sys/dev/mii X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2012 12:03:01 -0000 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 Fon +49 151 14070811