From owner-freebsd-current@FreeBSD.ORG Fri Jun 6 11:13:36 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D3C2137B401 for ; Fri, 6 Jun 2003 11:13:35 -0700 (PDT) Received: from mail.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id 708BC43FAF for ; Fri, 6 Jun 2003 11:13:34 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 24801 invoked from network); 6 Jun 2003 18:13:33 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 6 Jun 2003 18:13:33 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.8/8.12.8) with ESMTP id h56IDUp0014325; Fri, 6 Jun 2003 14:13:30 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Date: Fri, 06 Jun 2003 14:13:31 -0400 (EDT) From: John Baldwin To: current@FreeBSD.org, imp@FreeBSD.org Subject: [PATCH] Tweak re-routing of PCI interrupts X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2003 18:13:37 -0000 I have a small tweak to the PCI code that re-routes PCI interrupts. Basically, it does two things, 1) make the comment less ia64-specific and 2) if the interrupt route returns an invalid IRQ (i.e. 255), then we don't change the intline. In other words, if we can't route the interrupt, we just assume that the firmware knows more than we do and go with the value it stuck in the register. 1) is a no-brainer, but I wonder what people think about 2). Patch below: Index: pci.c =================================================================== RCS file: /usr/cvs/src/sys/dev/pci/pci.c,v retrieving revision 1.216 diff -u -r1.216 pci.c --- pci.c 4 Jun 2003 21:10:15 -0000 1.216 +++ pci.c 6 Jun 2003 18:10:14 -0000 @@ -782,7 +782,7 @@ pcicfgregs *cfg = &dinfo->cfg; struct resource_list *rl = &dinfo->resources; struct pci_quirk *q; - int b, i, f, s; + int b, i, irq, f, s; b = cfg->bus; s = cfg->slot; @@ -800,14 +800,18 @@ if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) { #if defined(__ia64__) || (defined(__i386__) && !defined(SMP)) /* - * Re-route interrupts on ia64 so that we can get the - * I/O SAPIC interrupt numbers (the BIOS leaves legacy - * PIC interrupt numbers in the intline registers). + * Try to re-route interrupts. Sometimes the BIOS or + * firmware may leave bogus values in these registers. + * If the re-route fails, then just stick with what we + * have. */ - cfg->intline = PCIB_ROUTE_INTERRUPT(pcib, dev, cfg->intpin); + irq = PCIB_ROUTE_INTERRUPT(pcib, dev, cfg->intpin); + if (PCI_INTERRUPT_VALID(irq)) + cfg->intline = irq; + else #endif - resource_list_add(rl, SYS_RES_IRQ, 0, cfg->intline, - cfg->intline, 1); + irq = cfg->intline; + resource_list_add(rl, SYS_RES_IRQ, 0, irq, irq, 1); } } -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/