From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 10 11:40:45 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B14A16A402 for ; Tue, 10 Apr 2007 11:40:45 +0000 (UTC) (envelope-from alan@fromorbit.com) Received: from thing1.auspcmarket.com.au (mail.fromorbit.com [203.31.169.65]) by mx1.freebsd.org (Postfix) with ESMTP id BA8AE13C459 for ; Tue, 10 Apr 2007 11:40:44 +0000 (UTC) (envelope-from alan@fromorbit.com) Received: from [192.168.1.99] (c220-239-255-86.rivrw3.nsw.optusnet.com.au [220.239.255.86]) by thing1.auspcmarket.com.au (Postfix) with ESMTP id D266E5C19 for ; Tue, 10 Apr 2007 21:40:41 +1000 (EST) From: Alan Garfield To: freebsd-hackers@freebsd.org 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> Content-Type: text/plain Date: Tue, 10 Apr 2007 21:40:40 +1000 Message-Id: <1176205240.4514.3.camel@hiro.auspc.com.au> Mime-Version: 1.0 X-Mailer: Evolution 2.8.3 (2.8.3-2.fc6) Content-Transfer-Encoding: 7bit Subject: Re: Finding an IRQ mapping in APIC X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Apr 2007 11:40:45 -0000 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.