Subject: Re: lkm for pci device
To: Bill Studenmund <email@example.com>
From: Quentin Garnier <cube@NetBSD.org>
Date: 07/02/2004 16:16:45
On Thu, 1 Jul 2004 10:12:04 -0700
Bill Studenmund <firstname.lastname@example.org> wrote:
> On Thu, Jul 01, 2004 at 05:42:35PM +0200, Daniel Brewer wrote:
> > Hi
> > I'm trying to convert a kernel space driver to an lkm driver for a
> > PCI device. I've got the lkm framework working, but I'm having
> > trouble with the autoconf stuff (finding the devices on the PCI bus,
> > calling the match() and attach() functions). Am I missing something
> > obvious?
> I've forgotten who wrote it, but there's a PCI lkm framework floating
I've finally committed it in src/sys/lkm/dev/pcilkm, along with two
examples of its use. It's not built by default, you have to go there
and compile it yourself.
> The problem is that the autoconfig code isn't set up to rescan the PCI
> bus, thus there's no easy way to notice your new driver. Also, I'm not
> sure if there's an easy way to punch your driver into the PCI
> discovery code.
Well, there is pci_find_device() for that purpose. The drawback is that
you have to be very careful not to attach to just anything, as you can't
know if someone has already mapped regions or interrupts before you.