From owner-freebsd-drivers@FreeBSD.ORG Wed Apr 1 19:21:15 2015 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 754B5F07 for ; Wed, 1 Apr 2015 19:21:15 +0000 (UTC) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) (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 3E327D50 for ; Wed, 1 Apr 2015 19:21:14 +0000 (UTC) Received: by pddn5 with SMTP id n5so64293744pdd.2 for ; Wed, 01 Apr 2015 12:21:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=obSZU0VE1BIy+ZnJqvvLzCfeAU/Bwy/Uz5XQOdOG9h8=; b=jpFW/J//L71ABRnuxaa6NfdTh4xhTHtAKURAnQcy5/5tyEJJI+uXf/SJdxW1/Qq/aJ XSaQH1yI/+KBk2FBijHhK6yY7lx8eSeIGwX2q2ty+QhG+0Uu+icmRH5Es0CV30Tn4Q1u 9QxMiVhFEHSV5ThNqkguA1T0EqiXpTVmKn+ea4RUBC4Iw1cYUN4UzJbItKnzb7ZmB9WW /MKUhElaNHKLywyOSP2Lay1uSipKdxfN+GKOKfgx3byNKxUR7fzRSyGhYqVGx/tx/3v4 4PAFbUfCZN0Ch/aFyOZAjsmWfhblEv6NXV65G11xjlSR9DNEBdj8z//JAFS9JIPYs6u4 fW8Q== X-Gm-Message-State: ALoCoQmha45YYoKSkMP0tCtRGc9L846EQQcufE/7HRiEAK0CL3uIc2ud/sLAnISZYJiC82GFkwI5 X-Received: by 10.66.216.67 with SMTP id oo3mr78522691pac.133.1427916074193; Wed, 01 Apr 2015 12:21:14 -0700 (PDT) Received: from [10.64.24.18] ([69.53.236.236]) by mx.google.com with ESMTPSA id z4sm2892161pdo.84.2015.04.01.12.21.12 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Apr 2015 12:21:13 -0700 (PDT) Sender: Warner Losh Subject: Re: load a driver during autoconfiguration Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: multipart/signed; boundary="Apple-Mail=_39351C87-653F-4C4F-A5DD-4AA931285414"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b6 From: Warner Losh In-Reply-To: Date: Wed, 1 Apr 2015 12:21:09 -0700 Message-Id: <9E10CA7A-7216-45A1-87D3-DCFF52881298@bsdimp.com> References: <5070289.9Ox4kP5ZdP@ralph.baldwin.cx> <21B44158-07C3-47AE-8132-BE5F2B408697@bsdimp.com> To: =?utf-8?Q?Mat=C3=ADas_Perret_Cantoni?= X-Mailer: Apple Mail (2.2070.6) 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:21:15 -0000 --Apple-Mail=_39351C87-653F-4C4F-A5DD-4AA931285414 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 1, 2015, at 12:18 PM, Mat=C3=ADas Perret Cantoni = wrote: >=20 >=20 >=20 > 2015-03-09 15:03 GMT-03:00 Warner Losh : >=20 > > 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 or 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 are > > passed that you want to match on. >=20 > 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. >=20 > 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 >=20 > Hello. Thank you and sorry for the delay. >=20 > I tried using the kld_list variable of /etc/rc.conf and it worked just = fine: my driver gets loaded on boot time. >=20 > 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: >=20 > myDriver_load=3D"YES" >=20 > The driver is not loaded after boot and dmesg doesn't shows any = message about my driver. Is there a myDriver.ko in your load path? > 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 : >=20 > # cat /boot/loader.conf > loader_delay=3D"1" > autoboot_delay=3D"1" > myDriver_load=3D"YES" >=20 > 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 ... > ... >=20 >=20 > Do you think that loader is reading my file or not? If there is more = information that I can provide, just tell me! I think that you=E2=80=99re not doing the interface quite right. Warner --Apple-Mail=_39351C87-653F-4C4F-A5DD-4AA931285414 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVHEUlAAoJEGwc0Sh9sBEAq7cP/jUfmbm6G4W4Ne/7d+FVpNRb yvqYAuEk7SQVlNaOb4HtAJTKqXzCTDHNyQUOxX35euv0BlR2oIF3Iv45V/cv4kY9 TqtK3AFiH4c8FugudJTOZHC8PKWQHIJ8jKjHYesuzGdInzUSrdr5pNvJuZn74YEy Ki8FOTqh6YNkbEK1ZD6zqHBqHLhw4GWZTIVSbGcjY2PfQ+8nmXCMit6DV850b5VI FwrfzILty7RyAiMMse7Qd+OpiaX4rtI4NI5jcWpLjUvT4+k+hByBV35ufE7AEi5n BzTssCV1b5UU0ult3VnHVpND77220xl6xc0WssipDIvvL1qznYn3MEwncw66MNTI ri85ak+Vd8zvR40+9XHR2/tMzNsQkDRHCiPypsZqtbhrNnammiQMVAxXxRMm/58Q 6Fk+G7bPUqL8AfRn3TFwaJTIgbfkCC6CT//e/WhW5NBDde67Q/sousIOlFg6UGW2 XBvbvQELvPQrJi/PfTkDv9ZpeD0N0uQFRdmFlAQTlELFfNlpyj9Ha1uut39YCrTZ l0u2YPWI1BKjLWORXLCQ1bnn4CrgNQPrbTvs9JpLxovNUlhfoz/036aoEkvkMQGz PhS53ApJU36+JbxJXrz+ez3NvROn/BAskoYMrP9aEOrHyYHTQzMZL+AXDivdrJnp mZ951gXIAUKJQDq+YKIB =Gdln -----END PGP SIGNATURE----- --Apple-Mail=_39351C87-653F-4C4F-A5DD-4AA931285414--