From owner-freebsd-drivers@FreeBSD.ORG Wed Apr 1 19:19:01 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 23214DD0; Wed, 1 Apr 2015 19:19:01 +0000 (UTC) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [IPv6:2a00:1450:400c:c00::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A73BCC9E; Wed, 1 Apr 2015 19:19:00 +0000 (UTC) Received: by wgra20 with SMTP id a20so63776195wgr.3; Wed, 01 Apr 2015 12:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3V1fTjJ5H9oJtVEWpOG9rZQYIg9b4MSgUD/1AKniSwU=; b=eqDMxcM/UmYOi0seagGVoLb1t4BZk0VqsIC1sTxW1X4AxyMNOuFpALXS0tck1+3D3f nuYEmYeboNnoewGVC4F7aoOJkxolYrYJxAy5aqW0H/MpbBRD4c0qXs/nQhYMLy7eq/RG Y8hVi/0uuxF0F/0AAmNsYWKqSmqhhjTdh5X8Dz4KX9OLjlmb989AcI5TKdMJPyLbDdTy 9jzddOV/1+xqpF1HVq1GbYgEy9EA5eFf9XAq75yaVGXfYS++Tn32NQl0iwNTPMXmjfAX SKglwc9o08efwUXOMvqmonUtxtRbxLS+xwSbWKIYi1D+I73/Yqyd73HhnCpyvC7q5xj5 N8yA== MIME-Version: 1.0 X-Received: by 10.180.104.35 with SMTP id gb3mr17905363wib.60.1427915938294; Wed, 01 Apr 2015 12:18:58 -0700 (PDT) Received: by 10.27.219.3 with HTTP; Wed, 1 Apr 2015 12:18:58 -0700 (PDT) In-Reply-To: <21B44158-07C3-47AE-8132-BE5F2B408697@bsdimp.com> References: <5070289.9Ox4kP5ZdP@ralph.baldwin.cx> <21B44158-07C3-47AE-8132-BE5F2B408697@bsdimp.com> Date: Wed, 1 Apr 2015 16:18:58 -0300 Message-ID: Subject: Re: load a driver during autoconfiguration From: =?UTF-8?Q?Mat=C3=ADas_Perret_Cantoni?= To: Warner Losh Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: freebsd-drivers@freebsd.org 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: Wed, 01 Apr 2015 19:19:01 -0000 2015-03-09 15:03 GMT-03:00 Warner Losh : > > > On Mar 9, 2015, at 10:01 AM, John Baldwin wrote: > > > (trimming a little) > > One option is to always load the driver using an entry in loader.conf o= r > in > > the kld_list variable in /etc/rc.conf. Another option to do on-demand > loading > > is to write a custom devd handler. You can find some examples in > > /etc/devd/usb.conf (note that that file is auto-generated). I'm not > sure what > > is output for a nomatch entry for an fdt bus. For devices that appear = at > > runtime you can run 'cat /var/run/devd.pipe' in a window to see event > details > > to use to write your match rule. However, for boot time events I think > you > > will need to resort to looking at the code to decipher what variables a= re > > passed that you want to match on. > > devinfo -v will tell you the pnp info, which is what you=E2=80=99ll need = to match > the > device. This will load the driver after boot. It=E2=80=99s almost always = easier, > however, > to just add the driver to your /boot/loader.conf file. > > Sometime before BSDcan this year, there will be the option to > automatically load > drivers based on PNP information from the parent bus coupled with the > tables > compiled into the .ko files, but that=E2=80=99s not possible today. Warner > > Hello. Thank you and sorry for the delay. I tried using the kld_list variable of /etc/rc.conf and it worked just fine: my driver gets loaded on boot time. On the other hand I couldn't get the loader.conf alternative to work: I created a loader.conf file in /boot (since there wasn't one) with only one line in it: myDriver_load=3D"YES" The driver is not loaded after boot and dmesg doesn't shows any message about my driver. I suspect that loader doesn't reads my file, because I also tried to change the autoboot delay of loader by overriding on my file, the autoboot_delay variable that's defined in /boot/defaults/loader.conf : # cat /boot/loader.conf loader_delay=3D"1" autoboot_delay=3D"1" myDriver_load=3D"YES" But loader still waits 10 seconds before booting: ... - /boot/kernel/kernel data=3D0x4b3fc8+0x2c038 syms=3D[0x4+0x78c40+0x4+0x4b17f= ] Hit [Enter] to boot immediately, or any other key for command prompt. Booting [/boot/kernel/kernel] in 9 seconds ... ... Do you think that loader is reading my file or not? If there is more information that I can provide, just tell me! Regards, Matias.-