Date: Tue, 19 Sep 2006 08:43:53 -0600 (MDT) From: Warner Losh <imp@bsdimp.com> To: freebsd-drivers@freebsd.org, gireesh.nagabhushana@neterion.com, olli@lurza.secnetix.de Subject: Re: Reading configuration file from driver during load Message-ID: <20060919.084353.41650344.imp@bsdimp.com> In-Reply-To: <200609191346.k8JDk9b3076219@lurza.secnetix.de> References: <6387977.post@talk.nabble.com> <200609191346.k8JDk9b3076219@lurza.secnetix.de>
next in thread | previous in thread | raw e-mail | index | archive | help
From: Oliver Fromme <olli@lurza.secnetix.de> Subject: Re: Reading configuration file from driver during load Date: Tue, 19 Sep 2006 15:46:09 +0200 (CEST) > Gireesh wrote: > > I have a driver which has some parameters hardcoded as of now. It requires > > values of these parameters to be available during load (during attach > > function). My requirement is to read these parameters from a configuration > > file so that we can load driver with different values to parameters without > > rebuilding driver. > > I think that sysctl or kenv variables are best suited for > that purpose. There are a lot of examples for that in > existing drivers. The 'kenv' variables are best wrapped in the tunable interfaces. For example: u_long cbb_start_16_io = CBB_START_16_IO; TUNABLE_ULONG("hw.cbb.start_16_io", &cbb_start_16_io); SYSCTL_ULONG(_hw_cbb, OID_AUTO, start_16_io, CTLFLAG_RW, &cbb_start_16_io, CBB_START_16_IO, "Starting ioport for 16-bit cards"); This is from the cbb driver. It is a hint/tunable that can also set the starting I/O port address range to use for 16-bit cards. Users can either place the following line in /boot/loader.conf or in /etc/sysctl.conf. hw.cbb.start_16_io=0x300 The former sets it at attach time, while the latter sets it early in the boot process, but after it has attached. You can also set it at run-time: sysctl hw.cbb.start_16_io=0x300 Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060919.084353.41650344.imp>