Finding an IRQ mapping in APIC
Alan Garfield
alan at fromorbit.com
Tue Apr 10 11:40:45 UTC 2007
On Tue, 2007-04-10 at 15:30 +1000, Alan Garfield wrote:
> On Tue, 2007-04-10 at 12:20 +1000, Alan Garfield wrote:
> > Hello all!
> >
> > I'm wondering if someone can point me in the direction of a solution to
> > my little problem.
> >
> > I've been porting a Linux driver across to FreeBSD and I've come against
> > this lovely little hack in it's code.
> >
> > I've tried to bus_alloc_resource() the IOAPIC_DEFAULT_ADDR and
> > IOAPIC_WINDOW but I never seem get allocated. Plus to my
> > knowing-little-about-kernels eye this seems like a really horrid hack to
> > figure out the IRQ.
> >
> > Any suggestions?
Well I think I've found a much nicer way that the low-level irq bashing
the Linux driver suffered from.
-------
DRIVER_MODULE(jnet, acpi, jnet_driver, jnet_devclass, 0, 0);
/**
* jnet_probe()
*
* Probes for the JNet device
*/
static int
jnet_probe(device_t dev)
{
ACPI_HANDLE h;
char *handle_str;
// Only accept device types
if(acpi_get_type(dev) != ACPI_TYPE_DEVICE)
return(ENXIO);
// Get the acpi handle and the device name
h = acpi_get_handle(dev);
handle_str = acpi_name(h);
// Compare the name looking for JNET
if(strcmp(handle_str, JNET_ACPI_NAME) != 0)
return(ENXIO);
// Woo we found it, set the description so we know what we are.
device_set_desc(dev, JNET_NAME);
return (BUS_PROBE_DEFAULT);
}
-------
I found the device was in the acpi data. I now have the interrupt and
the io ports available without any hacks (I hope).
Does this look sane to anyone??
Thanks again,
Alan.
More information about the freebsd-hackers
mailing list