How do I pass configuration parameters to a FreeBSD Device Driver ?

View: New views
9 Messages — Rating Filter:   Alert me  

How do I pass configuration parameters to a FreeBSD Device Driver ?

by David Somayajulu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,
I would appreciate if you could let me know, how I can pass configuration parameters to a device driver, which can be processed during either probe() or attach() ? Is there a way to read them from a conf file of some sort ? Basically, I am interested in setting some tunable parameters during driver initialization, without needing to recompile the driver every time.

thanks
david Somayajulu

_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

Re: How do I pass configuration parameters to a FreeBSD Device Driver ?

by Larry Maloney :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Somayajulu wrote:

> Hi All,
> I would appreciate if you could let me know, how I can pass configuration parameters to a device driver, which can be processed during either probe() or attach() ? Is there a way to read them from a conf file of some sort ? Basically, I am interested in setting some tunable parameters during driver initialization, without needing to recompile the driver every time.
>
> thanks
> david Somayajulu
>
> _______________________________________________
> freebsd-drivers@... mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
> To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."
>
>  
Isn't that what the hints file is for?

Larry

--
==============================
Larry P. Maloney
CEO/CTO SoftNet Solutions

Phone: 650-961-2315
  Web: www.softnetsolution.com


_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

RE: How do I pass configuration parameters to a FreeBSD Device Driver ?

by David Somayajulu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Larry Maloney wrote:

> David Somayajulu wrote:
> > Hi All,
> > I would appreciate if you could let me know, how I can pass
> configuration parameters to a device driver, which can be processed
> during either probe() or attach() ? Is there a way to read them from a
> conf file of some sort ? Basically, I am interested in setting some
> tunable parameters during driver initialization, without needing to
> recompile the driver every time.
> >
> > thanks
> > david Somayajulu
> >
> > _______________________________________________
> > freebsd-drivers@... mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
> > To unsubscribe, send any mail to "freebsd-drivers-
> unsubscribe@..."
> >
> >
> Isn't that what the hints file is for?

Sorry, I am sort of new to FreeBSD. From what I understand /boot/device.hints gets read during boot time, the values cannot be changed by the user while the kernel is running - am I correct ?

I have a loadable driver module and would like to do the following:
1. Set some tunable parameters of the driver.
2. Load the driver. Run a few tests.
3. Unload the driver.
4. repeat steps 1 thru 3.

>
> Larry
>
> --
> ==============================
> Larry P. Maloney
> CEO/CTO SoftNet Solutions
>
> Phone: 650-961-2315
>   Web: www.softnetsolution.com

_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

Re: How do I pass configuration parameters to a FreeBSD Device Driver ?

by Sam Leffler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Somayajulu wrote:

> Larry Maloney wrote:
>  
>> David Somayajulu wrote:
>>    
>>> Hi All,
>>> I would appreciate if you could let me know, how I can pass
>>>      
>> configuration parameters to a device driver, which can be processed
>> during either probe() or attach() ? Is there a way to read them from a
>> conf file of some sort ? Basically, I am interested in setting some
>> tunable parameters during driver initialization, without needing to
>> recompile the driver every time.
>>    

loader(8) allows you to set tunable parameters before boot; this is
equivalent to linux-style module parameters (mostly).  Unfortunately I
don't see anything in the man pages that documents them; check
sys/sys/kernel.h for the details and/or loader(8).

    Sam

_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

Re: How do I pass configuration parameters to a FreeBSD Device Driver ?

by vwe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 06/04/09 03:48, David Somayajulu wrote:
> Hi All,
> I would appreciate if you could let me know, how I can pass configuration parameters to a device driver, which can be processed during either probe() or attach() ? Is there a way to read them from a conf file of some sort ? Basically, I am interested in setting some tunable parameters during driver initialization, without needing to recompile the driver every time.
>

David,

you may want to look up the kernel sources for TUNEABLE_XXX() macros.

Volker

_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

Re: How do I pass configuration parameters to a FreeBSD Device Driver ?

by Marc Loerner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Donnerstag 04 Juni 2009 04:27:25 schrieb David Somayajulu:

> Larry Maloney wrote:
> > David Somayajulu wrote:
> > > Hi All,
> > > I would appreciate if you could let me know, how I can pass
> >
> > configuration parameters to a device driver, which can be processed
> > during either probe() or attach() ? Is there a way to read them from a
> > conf file of some sort ? Basically, I am interested in setting some
> > tunable parameters during driver initialization, without needing to
> > recompile the driver every time.
> >
> > > thanks
> > > david Somayajulu
> > >
> > > _______________________________________________
> > > freebsd-drivers@... mailing list
> > > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
> > > To unsubscribe, send any mail to "freebsd-drivers-
> >
> > unsubscribe@..."
> >
> >
> > Isn't that what the hints file is for?
>
> Sorry, I am sort of new to FreeBSD. From what I understand
> /boot/device.hints gets read during boot time, the values cannot be changed
> by the user while the kernel is running - am I correct ?
>
> I have a loadable driver module and would like to do the following:
> 1. Set some tunable parameters of the driver.
> 2. Load the driver. Run a few tests.
> 3. Unload the driver.
> 4. repeat steps 1 thru 3.
>

I think exactly what you search is sysctls. There you have tunables to change
at runtime

Regards,
Marc

> > Larry
> >
> > --
> > ==============================
> > Larry P. Maloney
> > CEO/CTO SoftNet Solutions
> >
> > Phone: 650-961-2315
> >   Web: www.softnetsolution.com
>
> _______________________________________________
> freebsd-drivers@... mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
> To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

Re: How do I pass configuration parameters to a FreeBSD Device Driver ?

by M. Warner Losh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In message: <75E1A2A7D185F841A975979B0906BBA65A4D0C6595@...>
            David Somayajulu <david.somayajulu@...> writes:
:
:
: Larry Maloney wrote:
: > David Somayajulu wrote:
: > > Hi All,
: > > I would appreciate if you could let me know, how I can pass
: > configuration parameters to a device driver, which can be processed
: > during either probe() or attach() ? Is there a way to read them from a
: > conf file of some sort ? Basically, I am interested in setting some
: > tunable parameters during driver initialization, without needing to
: > recompile the driver every time.
: > >
: > > thanks
: > > david Somayajulu
: > >
: > > _______________________________________________
: > > freebsd-drivers@... mailing list
: > > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
: > > To unsubscribe, send any mail to "freebsd-drivers-
: > unsubscribe@..."
: > >
: > >
: > Isn't that what the hints file is for?
:
: Sorry, I am sort of new to FreeBSD. From what I understand /boot/device.hints gets read during boot time, the values cannot be changed by the user while the kernel is running - am I correct ?
:
: I have a loadable driver module and would like to do the following:
: 1. Set some tunable parameters of the driver.
: 2. Load the driver. Run a few tests.
: 3. Unload the driver.
: 4. repeat steps 1 thru 3.

kenv can set hints.

Hints are properly retrieved with things like resource_int_value.

        prefer_iomap = 0;
        resource_int_value(device_get_name(dev), device_get_unit(dev),
            "prefer_iomap", &prefer_iomap);

would look for the hint "hints.<driver>.<unit>.prefer_iomap" and
return the value if it finds it.

Warner
_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

Re: How do I pass configuration parameters to a FreeBSD Device Driver ?

by M. Warner Losh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In message: <200906040822.41153.marc.loerner@...>
            Marc Loerner <marc.loerner@...> writes:
: Am Donnerstag 04 Juni 2009 04:27:25 schrieb David Somayajulu:
: > Larry Maloney wrote:
: > > David Somayajulu wrote:
: > > > Hi All,
: > > > I would appreciate if you could let me know, how I can pass
: > >
: > > configuration parameters to a device driver, which can be processed
: > > during either probe() or attach() ? Is there a way to read them from a
: > > conf file of some sort ? Basically, I am interested in setting some
: > > tunable parameters during driver initialization, without needing to
: > > recompile the driver every time.
: > >
: > > > thanks
: > > > david Somayajulu
: > > >
: > > > _______________________________________________
: > > > freebsd-drivers@... mailing list
: > > > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
: > > > To unsubscribe, send any mail to "freebsd-drivers-
: > >
: > > unsubscribe@..."
: > >
: > >
: > > Isn't that what the hints file is for?
: >
: > Sorry, I am sort of new to FreeBSD. From what I understand
: > /boot/device.hints gets read during boot time, the values cannot be changed
: > by the user while the kernel is running - am I correct ?
: >
: > I have a loadable driver module and would like to do the following:
: > 1. Set some tunable parameters of the driver.
: > 2. Load the driver. Run a few tests.
: > 3. Unload the driver.
: > 4. repeat steps 1 thru 3.
: >
:
: I think exactly what you search is sysctls. There you have tunables to change
: at runtime

It depends a lot on how the sysctl/tunable is used/set.  If you are
using pure hints, then you need to use the kenv method I talked
about.  If you are using a more general tunable (eg
hw.DRIVERNAME.rx_buffers, say), then that can be set at runtime, and
there's hooks into the driver that allow it to react to the new
value.  This can be a better choice than hints, but is a little harder
to code up.  But the different isn't that huge...

Warner
_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."

RE: How do I pass configuration parameters to a FreeBSD Device Driver ?

by David Somayajulu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

M. Warner Losh wrote:
<clip>

> : I have a loadable driver module and would like to do the following:
> : 1. Set some tunable parameters of the driver.
> : 2. Load the driver. Run a few tests.
> : 3. Unload the driver.
> : 4. repeat steps 1 thru 3.
>
> kenv can set hints.
>
> Hints are properly retrieved with things like resource_int_value.
>
> prefer_iomap = 0;
> resource_int_value(device_get_name(dev), device_get_unit(dev),
>    "prefer_iomap", &prefer_iomap);
>
> would look for the hint "hints.<driver>.<unit>.prefer_iomap" and
> return the value if it finds it.
>
> Warner
Thanks a lot. This is exactly what I need. Appreciate everyone's responses.
thanks
david S.
_______________________________________________
freebsd-drivers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@..."