Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Apr 2015 12:21:09 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        =?utf-8?Q?Mat=C3=ADas_Perret_Cantoni?= <perretcantonim@gmail.com>
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: load a driver during autoconfiguration
Message-ID:  <9E10CA7A-7216-45A1-87D3-DCFF52881298@bsdimp.com>
In-Reply-To: <CADLKG00AuNk5ky35j7Z%2BUxk%2BGyrRPsxRSf850QPH6tU68-U0Zw@mail.gmail.com>
References:  <CADLKG03WSkbPPWwDkxd3NPa1q0cVP8C0JvA0T=Jwy2=wGv_tiA@mail.gmail.com> <5070289.9Ox4kP5ZdP@ralph.baldwin.cx> <21B44158-07C3-47AE-8132-BE5F2B408697@bsdimp.com> <CADLKG00AuNk5ky35j7Z%2BUxk%2BGyrRPsxRSf850QPH6tU68-U0Zw@mail.gmail.com>

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

--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 =
<perretcantonim@gmail.com> wrote:
>=20
>=20
>=20
> 2015-03-09 15:03 GMT-03:00 Warner Losh <imp@bsdimp.com>:
>=20
> > On Mar 9, 2015, at 10:01 AM, John Baldwin <jhb@FreeBSD.org> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9E10CA7A-7216-45A1-87D3-DCFF52881298>