Re: Unknown driver gobbles resources??

2000-08-13 Thread Gary T. Corcoran


Devin Butterfield wrote:
 
 Hi all,
 
 In the process of learning device driver writing, I have written a
 simple skeleton driver for an isa PnP card I have.
 
 Although this driver works (successfully probes, attaches, and gets it's
 needed io resources) when compiled into the kernel, if I compile it as a
 loadable module it fails to get it's io resources when loaded, and if I
 try to then unload it, the kernel panics (as the driver trys to release
 resources that were never allocated).

I can't help you with *why* you aren't getting the resources you need, but...

If your module is not able to get all the resources you need, you should
be failing the loading of the module.  When failing the loading, you
should free up any resources you *did* successfully grab before returning.
Then you won't be causing a panic when trying to free resources during unload,
since you'll never have finished loading in the first place.  That is, unload
won't be called unless you were successfully loaded.

Gary


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Unknown driver gobbles resources??

2000-08-13 Thread Warner Losh

In message [EMAIL PROTECTED] Devin Butterfield writes:
: So my question is this: Do I need to do anything special to recover the
: resources from the unknown driver so that during loading *my* module can
: get the resources it needs?? Do I need to add something to my identify,
: probe, or attach routines to make this work right?

With modern enough versions of -current, you shouldn't have to do
anything at all to make this work.  It should just happen.  And you'll 
likely not need an identify routine.  The Unknown device just sucks up 
the plug and play resources.  Therefore, there's already a device node 
in the tree addociated with that plug and play hardware, so your probe 
routine will just be called.

However, this is fairly recent (like on the order of the first part of 
July, 2000).  Before that you did ineed have to jump though many many
hoops to make this work.

Warner


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Unknown driver gobbles resources??

2000-08-13 Thread Devin Butterfield

Warner Losh wrote:
 
 In message [EMAIL PROTECTED] Devin Butterfield writes:
 : So my question is this: Do I need to do anything special to recover the
 : resources from the unknown driver so that during loading *my* module can
 : get the resources it needs?? Do I need to add something to my identify,
 : probe, or attach routines to make this work right?
 
 With modern enough versions of -current, you shouldn't have to do
 anything at all to make this work.  It should just happen.  And you'll
 likely not need an identify routine.  The Unknown device just sucks up
 the plug and play resources.  Therefore, there's already a device node
 in the tree addociated with that plug and play hardware, so your probe
 routine will just be called.
 
 However, this is fairly recent (like on the order of the first part of
 July, 2000).  Before that you did ineed have to jump though many many
 hoops to make this work.

Hare there any plans to "back-port" this to -STABLE? Or do we
have to wait for 5.0?
--
Regards, Devin.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Unknown driver gobbles resources??

2000-08-13 Thread Warner Losh

In message [EMAIL PROTECTED] Devin Butterfield writes:
: Hare there any plans to "back-port" this to -STABLE? Or do we
: have to wait for 5.0?

I don't know.  I don't have PnP drivers that I'm working on at the
moment, so I've not kept up.  You'd have to ask dfr (Doug Rabson).

Warner


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message