Thanks for the help everyone. This is my first NetBSD driver so there
are a lot of gaps in my knowledge. Please excuse my ignorance.
I am using an "indirect-config" bus - Xilinx's OBP bus, driver written
by Wasabi for the Virtex II Pro. (NetBSD/evbppc)
> Failing
> that, the user has to find out correct values of base address/intr/whatever
> and supply them as locators in the kernel config file (these values
> will then appear in abovementioned "hint" structure).
>
> This scheme is independent of whether you work with an LKM or a compiled-in
> driver -- provided that the bus in question has a function to locate device
> on the bus (such as pci_find_device(9)).
Do you mean the locators remain in the kernel config file even when
using the driver as an LKM? Do you avoid the driver from being
statically compiled-in by just not including the source in the
*.files?
I don't believe the bus does have such a function. There is a
v2opb_search but that just seems to be part of the standard autoconf
stuff. It fills in the OBP-specific attach args struct and then calls
config_match/attach.
I'm not too interested in doing this correctly; I just want an LKM for
development. I'd be more than happy with the hack that Allen mentioned
- hardcoding the base address and irq number - I just don't know how
to do it.
I guess I eventually need to call config_attach. I can fake out most
of the information but I still need things like pointers to the parent
bus.
I've been looking at this LKM tutorial and it seems to be similar to
what I want to do, but was written for NetBSD 1.6 and things have
changed a bit, as far as I can tell.
http://etudiant.epita.fr/~jaquem_o/NetBSD_LKM_Driver/
Can someone point me in the right direction?
Thanks in advance,
Jeremy
On Thu, 20 Jan 2005 02:02:05 +0100, Jachym Holecek <freza@liberouter.org> wrote:
> > I'm wondering if it's possible to have a device driver that uses
> > interrupts to be loadable as a kernel module.
>
> Yes.
>
> > I need the address and irq number to be passed in to the LKM somehow.
> >
> > I've been unable to find any examples of this in the kernel source or
> > on the web.
>
> As of now, there is no way to pass "arguments" to LKM drivers, AFAIK.
> Generally, the drivers for "indirect-config" buses such as ISA [*] do
> their best find the device at standard locations (or places hinted by
> the structure passed as an argument to driver's match() method). Failing
> that, the user has to find out correct values of base address/intr/whatever
> and supply them as locators in the kernel config file (these values
> will then appear in abovementioned "hint" structure).
>
> This scheme is independent of whether you work with an LKM or a compiled-in
> driver -- provided that the bus in question has a function to locate device
> on the bus (such as pci_find_device(9)).
>
> In -current, there is some initial code to force rescan of buses that
> support it (inluding locator passing) and perform other device driver
> manipulation (detach driver from the device etc.). Look for drvctl(8)
> and ${sys}/kern/kern_drvctl.c. This, again, should be independent of
> whether your code is LKM vs. static.
>
> To sum up, I think your best bet for the time being is a traditional
> compiled-in driver...
>
> Hope this helps,
> -- Jachym Holecek
>
> [*] I suppose you're dealing with this kind of bus, "direct-config" ones
> should be able to find and identify devices automatically.
>