From owner-freebsd-drivers@FreeBSD.ORG Mon Mar 9 17:24:21 2015 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B625BB40 for ; Mon, 9 Mar 2015 17:24:21 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E9AAA90 for ; Mon, 9 Mar 2015 17:24:21 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7FA6EB953; Mon, 9 Mar 2015 13:24:20 -0400 (EDT) From: John Baldwin To: freebsd-drivers@freebsd.org Subject: Re: load a driver during autoconfiguration Date: Mon, 09 Mar 2015 12:01:43 -0400 Message-ID: <5070289.9Ox4kP5ZdP@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 09 Mar 2015 13:24:20 -0400 (EDT) Cc: =?ISO-8859-1?Q?Mat=EDas?= Perret Cantoni X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2015 17:24:21 -0000 On Friday, March 06, 2015 04:15:22 PM Mat=EDas Perret Cantoni wrote: > Hello! >=20 > I just wrote a simple newbus driver that works just fine when I load = it > manually with kldload(8). >=20 > Now I'd like the system to load it automatically at boot time. I've a= lready > added the corresponding node on the dts file. >=20 > So my questions are: >=20 > Can I just place the driver under some directory so that the system c= an > probe it during auto-configuration? >=20 > Or do I need to re-compile the whole kernel for this? In that case wh= ere > should I place my sources before compiling? One option is to always load the driver using an entry in loader.conf o= r in=20 the kld_list variable in /etc/rc.conf. Another option to do on-demand = loading=20 is to write a custom devd handler. You can find some examples in=20 /etc/devd/usb.conf (note that that file is auto-generated). I'm not su= re what=20 is output for a nomatch entry for an fdt bus. For devices that appear = at=20 runtime you can run 'cat /var/run/devd.pipe' in a window to see event d= etails=20 to use to write your match rule. However, for boot time events I think= you=20 will need to resort to looking at the code to decipher what variables a= re=20 passed that you want to match on. --=20 John Baldwin