Subject: Re: looking for devices on PCI bus
To: None <eeh@netbsd.org>
From: Andrey Petrov <petrov@netbsd.org>
List: tech-kern
Date: 05/02/2001 17:56:08
On Thu, May 03, 2001 at 12:33:44AM -0000, eeh@netbsd.org wrote:
>
> > * One problem with drivers loaded from an LKM is if the device
> > can be managed by multiple drivers and you need to select the
> > most appropriate one. If another, less apropriate driver has
> > already attached to that device, things get complicated. Do
> > you unconfigure the device and then reprobe and reconfigure, or
> > just forget about the whole thing and use the old driver?
>
> I was hoping no one would bring this up. :-)
>
> Probably the best thing to do would be when we are scanning for existing
> devices which are matched by the new LKM to note if the device is attached
> or not. If it's not attached, things are easy. If it is matched, then
> either the LKM driver needs to ignore the device, or decide to get the
> existing driver to detach, and then have the new driver attach. Oh, and to
> be nice, it should probably gain as much state info before detach as
> possible.
>
> Oh, and the routine which adds match routines should be told if it should
> add the new routine to the front or the back, so that future scans will
> favor either the LKM or an in-kernel driver.
>
> Attachment decisions should be based on the value returned by the match
> routine. If you want to support replacing the driver you should:
>
> Detach the existing driver so any probes do not interfere with the device
> operation.
>
> Call all the device match routines again to get the match level.
>
> Select the driver with the best match, and attach it, possibly the same
> driver that was previously detached.
Any thoughts on user-level interface which disables/enables driver in
device tree to avoid guessing and force exact driver to probe.
Andrey