Re: Putting PCI-class/vendor/deviceinfo into source of PCI-drivers

Keith Owens (kaos@ocs.com.au)
Sat, 04 Dec 1999 23:03:59 +1100


On Sat, 4 Dec 1999 11:54:39 +0100,
Martin Mares <mj@suse.cz> wrote:
> I'm preparing a very similar mechanism for my PCI hotplug code. It should
>work this way:
>
> o Each driver contains a list of supported vendor+device pairs (likely
> a more general ID's, so that they can be used for ISAPnP, PCMCIA and
> CardBus as well).
> o Depmod extracts these data and stores them in modules.dep.

modules.dep is not the right place for these. What we need is an auto
generated module alias file. Add these lines to /etc/modules.conf, or
better still make them the default for modprobe.

if -f /etc/modules.conf.auto
include /etc/modules.conf.auto
endif

The above syntax is a modutils 2.3 feature. /etc/modules.conf.auto is
program generated from the drivers and contains lines like this

alias pci-0200-115d-0003 tulip_cb
alias pci-0200-115d-1181 serial_cb

It does not matter if the driver is a module or builtin, the aliases
are built for all pci combinations. Building for modules is easy, for
built in drivers is harder.

> o If a new device gets inserted, the kernel looks up its ID in all currently
> loaded drivers and asks them if they want to handle the device.

Not sure that is a good idea. It requires extra table comparison code
in every driver and we already have the external mapping from pci codes
to module. It would be better to add an ioctl to every driver which
kmod or modprobe could call to say "you are registered for device c-v-d
and it just got inserted/deleted".

> o If no driver is found and kmod is enabled, modprobe gets called to find
> a driver corresponding to the device ID according to modules.dep and load
> the appropriate module.

Call modprobe for all insert or deletes. It will load the module if
not already loaded using the auto generated aliases then call the
"device inserted" ioctl. If already loaded or builtin (the latter is
the tricky bit), just call the ioctl.

Whatever happens, we need a consistent interface. It must work for
modules (easy) and builtin (how do we identify them?) drivers. And it
must be able to cope with two or more copies of the same module loaded
under different names (messy).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/