From owner-freebsd-bugs@FreeBSD.ORG Fri Jan 4 21:10:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B2DA5CF9 for ; Fri, 4 Jan 2013 21:10:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 973D893F for ; Fri, 4 Jan 2013 21:10:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id r04LA0Rg064764 for ; Fri, 4 Jan 2013 21:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id r04LA0cj064763; Fri, 4 Jan 2013 21:10:00 GMT (envelope-from gnats) Resent-Date: Fri, 4 Jan 2013 21:10:00 GMT Resent-Message-Id: <201301042110.r04LA0cj064763@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Monthadar Al Jaberi Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8DA87B3E for ; Fri, 4 Jan 2013 21:02:56 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 7CD9090A for ; Fri, 4 Jan 2013 21:02:56 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r04L2utC023180 for ; Fri, 4 Jan 2013 21:02:56 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id r04L2uj7023179; Fri, 4 Jan 2013 21:02:56 GMT (envelope-from nobody) Message-Id: <201301042102.r04L2uj7023179@red.freebsd.org> Date: Fri, 4 Jan 2013 21:02:56 GMT From: Monthadar Al Jaberi To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: kern/174978: Routerboard RB433AH has slot 18 and not 17 as base slot. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2013 21:10:00 -0000 >Number: 174978 >Category: kern >Synopsis: Routerboard RB433AH has slot 18 and not 17 as base slot. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 04 21:10:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Monthadar Al Jaberi >Release: Head r245006 >Organization: >Environment: FreeBSD rb433ah 10.0-CURRENT FreeBSD 10.0-CURRENT #179: Fri Jan 4 23:21:47 CET 2013 root@mechy:/usr/obj/mips.mips/usr/src/sys/RB433AH_MFS mips >Description: The Mikrotik Routerboard RB433AH have the PCI bus connections routed diffrently. This results in that the base slot for RB433AH is 18 and not the default value of 17. FreeBSD will fail to assign the corret IRQ number. And no interrupts will be received from the connected miniPCI peripheral. >How-To-Repeat: Connect a wifi device on slot marked 'J401' on the RB433AH PCB. Compile a simple kernel following Luiz instructions (http://loos.no-ip.org/routerboard/). Boot the board. Create a wlan0 device. The wlan0 device is unusable. Error messages like the following will print out when ever running (e.g.): # ifconfig wlan0 scan root@rb433ah:~ # ath0: device timeout ath0: ath_raw_xmit: sc_inreset_cnt > 0; bailing ath0: ath_raw_xmit: sc_inreset_cnt > 0; bailing ath0: ath_raw_xmit: sc_inreset_cnt > 0; bailing >Fix: Change the base slot value to 18 for the RB433AH board. This can be done by supplying a hint. If no hint is supplied the default value of 17 is used. An example patch is added. Patch attached with submission follows: diff --git a/sys/mips/atheros/ar71xx_pci.c b/sys/mips/atheros/ar71xx_pci.c index 126537c..9b88f60 100644 --- a/sys/mips/atheros/ar71xx_pci.c +++ b/sys/mips/atheros/ar71xx_pci.c @@ -81,6 +81,7 @@ struct ar71xx_pci_softc { device_t sc_dev; int sc_busno; + int sc_baseslot; struct rman sc_mem_rman; struct rman sc_irq_rman; @@ -395,6 +396,16 @@ ar71xx_pci_attach(device_t dev) AR71XX_PCI_IRQ_END) != 0) panic("ar71xx_pci_attach: failed to set up IRQ rman"); + /* + * Check if there is a base slot hint. Otherwise use default value. + */ + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "baseslot", &sc->sc_baseslot) != 0) { + device_printf(dev, + "%s: missing hint '%s', default to AR71XX_PCI_BASE_SLOT\n", + __func__, "baseslot"); + sc->sc_baseslot = AR71XX_PCI_BASE_SLOT; + } ATH_WRITE_REG(AR71XX_PCI_INTR_STATUS, 0); ATH_WRITE_REG(AR71XX_PCI_INTR_MASK, 0); @@ -648,11 +659,13 @@ ar71xx_pci_maxslots(device_t dev) static int ar71xx_pci_route_interrupt(device_t pcib, device_t device, int pin) { - if (pci_get_slot(device) < AR71XX_PCI_BASE_SLOT) + struct ar71xx_pci_softc *sc = device_get_softc(pcib); + + if (pci_get_slot(device) < sc->sc_baseslot) panic("%s: PCI slot %d is less then AR71XX_PCI_BASE_SLOT", __func__, pci_get_slot(device)); - return (pci_get_slot(device) - AR71XX_PCI_BASE_SLOT); + return (pci_get_slot(device) - sc->sc_baseslot); } static device_method_t ar71xx_pci_methods[] = { diff --git a/sys/mips/conf/RB433AH.hints b/sys/mips/conf/RB433AH.hints index c2c0c53..08961f9 100644 --- a/sys/mips/conf/RB433AH.hints +++ b/sys/mips/conf/RB433AH.hints @@ -24,6 +24,7 @@ hint.ehci.0.irq=1 # pci hint.pcib.0.at="nexus0" hint.pcib.0.irq=0 +hint.pcib.0.baseslot=18 hint.arge.0.at="nexus0" hint.arge.0.maddr=0x19000000 >Release-Note: >Audit-Trail: >Unformatted: