Subject: Re: lkm for pci device
To: Nathan J. Williams <nathanw@wasabisystems.com>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-kern
Date: 07/04/2004 14:23:18
nathanw@wasabisystems.com said:
> It seems like what you want for direct-config buses is:
>  - the bus to track what subdevices have what drivers attached, and
>    which subdevices have nothing attached. 

A pointer to "what driver" is useful only if there is a mechanism
which tells the bus framework that the device in a particular slot
is gone. Plain PCI doesn't have this, that's why I suggested just
a bitmap.
There are (at least) 2 "hot-plug-PCI" standards; maybe we'll support
some once a working piece of hardware hits a NetBSD user... So it
might make sense to keep a pointer from the beginning.

> - a call into the bus to re-run the probe/attach for unattached
>   devices (or a particular device identifier?)

For unattached devices. The device identifiers are checked in the
driver's xxxmatch() function - there is no need to duplicate this.
It should also obey the autoconf "locators", so that can load a
driver module which attaches to a specific slot only. This should
happen more or less automatically is the existing framework is used.

> - a call to cause a driver at a particular device to be detached (for
>   unloading and trying again).

Here we have 2 possibilities: Tell the device to detach; it would
have to call back to the bus to free its slot related ressources.
Or tell the bus to do it and call the driver's detach function
implicitely.
The former seems to be more general to me -- Telling "detach foo0"
is possible without knowing bus internals, opposed to "detach the thing
in slot x function y".

best regards
Matthias