From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 10 05:30:25 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 BA5C916A402 for ; Tue, 10 Apr 2007 05:30:25 +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 82A9013C44B for ; Tue, 10 Apr 2007 05:30:25 +0000 (UTC) (envelope-from alan@fromorbit.com) Received: from [192.168.1.99] (unknown [192.168.1.99]) by thing1.auspcmarket.com.au (Postfix) with ESMTP id F0A855CDC for ; Tue, 10 Apr 2007 15:30:21 +1000 (EST) From: Alan Garfield To: freebsd-hackers@freebsd.org In-Reply-To: <1176171656.4276.8.camel@hiro.auspc.com.au> References: <1176096815.4064.6.camel@hiro.auspc.com.au> <1176171656.4276.8.camel@hiro.auspc.com.au> Content-Type: text/plain Date: Tue, 10 Apr 2007 15:30:21 +1000 Message-Id: <1176183021.5525.4.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 05:30:25 -0000 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? Further to this I've done the following :- --------------------------- static void jnet_identify(driver_t *driver, device_t parent) { uint32_t pci_intline; device_t dev; dev = pci_find_bsf(PCI_BUS, PCI_DEV, PCI_FUN); if(dev == NULL) { return; } device_printf(parent, "Looking for IRQ....\n"); pci_intline = pci_read_config(dev, PCIR_INTLINE, 1); printf("%x\n", pci_intline); return; } --------------------------- which just output the IRQ for the given bus,device,function. I can locate the IRQ's for all devices I care to throw at it, but the 0:7:3 device is found, but the PCIR_INTLINE is always 0xFF. Looking at the linux code I should get back 0x19. Am I totally missing something? Thanks in advance, Alan.