Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Apr 2007 21:40:40 +1000
From:      Alan Garfield <alan@fromorbit.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Finding an IRQ mapping in APIC
Message-ID:  <1176205240.4514.3.camel@hiro.auspc.com.au>
In-Reply-To: <1176183021.5525.4.camel@hiro.auspc.com.au>
References:  <1176096815.4064.6.camel@hiro.auspc.com.au> <1176171656.4276.8.camel@hiro.auspc.com.au> <1176183021.5525.4.camel@hiro.auspc.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1176205240.4514.3.camel>