Subject: RE: lkm for pci device
To: , <cube@cubidou.net>
From: Gordon Waidhofer <gww@traakan.com>
List: tech-kern
Date: 07/03/2004 11:49:02
Just some thought food......

While thinking about how LKMs and autoconf
get along, it might be worth throwing hotswap
into the frey.

USB stuff can be added/plugged/unplugged.
SATA, IDE, SCSI, FibreChannel, iSCSI, etc, etc,
can support hotswap. It is possible to
add a drive while online. It's not the same
thing as a drive with removable media. I'd
bet PCMCIA adds some good wrinkles, too.

	-gww

> -----Original Message-----
> From: tech-kern-owner@NetBSD.org [mailto:tech-kern-owner@NetBSD.org]On
> Behalf Of Matthias Drochner
> Sent: Saturday, July 03, 2004 5:55 AM
> To: cube@cubidou.net
> Cc: matthew green; Daniel Brewer; tech-kern@NetBSD.org; Bill Studenmund
> Subject: Re: lkm for pci device 
> 
> 
> 
> cube@cubidou.net said:
> > I guess the idea behind pci_find_device() was "does such a device
> > exist?". 
> 
> If you ask me, pci_find_device() should die completely. It doesn't
> fit into the autoconf framework.
> There is almost everything there to have driver LKMs plug in smoothly.
> In the PCI case, it is just that the bus enumeration code should
> keep track which devices are already handled by drivers (a simple
> bitmask per bus would do it), and that pci_enumerate_bus() could
> be a bit friendlier to LKMs.
> I'll append a proof-of-concept driver skeleton which hooks a PCI
> driver into the autoconf framework and causes a rescan of the bus.
> There are still some hacks in it:
> -It doesn't probe for any specific hardware, this would be done
>  in mist_match() like in every real driver.
> -For that reason, mistpcimatch() has this static variable to match
>  only once. A real driver would match multiple times of course.
>  (This can be controlled by locators like for static drivers.)
> -That static "currentparent" is a hack which is needed because
>  pci_enumerate_bus() doesn't pass this informations to callbacks.
>  Can be easily fixed.
> 
> best regards
> Matthias
> 
> 
>