From owner-freebsd-stable@FreeBSD.ORG Fri Aug 20 17:40:25 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B2021065672 for ; Fri, 20 Aug 2010 17:40:25 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 668E18FC21 for ; Fri, 20 Aug 2010 17:40:25 +0000 (UTC) Received: by pvg4 with SMTP id 4so1476848pvg.13 for ; Fri, 20 Aug 2010 10:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=kdSrWnXVairwgK7b0iczBf2sSqHD1GUV6mbEkrvlbI4=; b=t30nZVPmKjnop1r2TNauChoDmXm9yC9r69kjsl3pnR+eS+Bm5qByqqWAUPomdyBIvZ MeFBeJnsPJDFHxax0yby6Ww5e4Xw6WsvuFMQbostIb+GwYYKSeyFrzzOiWLNKwluwmHh TqwA5dduKQxNSOEUp0Uz9hmVaK0rnC+dtDlq0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=a5M5dSrORK7UiY6xI+QfHDtwudR0wYOxgtX9KzOeVPBPmnfeWrbXw2HrZm/7IexoZK QAGjC4opns2CYTnJjY2ChxsSQ/1A0iJ4cHKoDBICMrd+Ht3424xxOOYKWLwELogYZJQE ujCmwiElCQMhw/d/w6LQHdTgADHERAt11TsdY= Received: by 10.142.201.5 with SMTP id y5mr1376712wff.130.1282326024993; Fri, 20 Aug 2010 10:40:24 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id v38sm3516411wfh.0.2010.08.20.10.40.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 20 Aug 2010 10:40:22 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Fri, 20 Aug 2010 10:40:22 -0700 From: Pyun YongHyeon Date: Fri, 20 Aug 2010 10:40:22 -0700 To: Nikola Kalpazanov Message-ID: <20100820174022.GA21062@michelle.cdnetworks.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-stable@freebsd.org Subject: Re: P811B Quad Port NIC problem. X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2010 17:40:25 -0000 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 20, 2010 at 01:44:20PM +0200, Nikola Kalpazanov wrote: > Hi, > > First I want to start with the note that I know Realtek is no good, > yet I will appreciate any assistance that you may provide. > > here are details of the problem: > > P811B is 4 port Ethernet card with built-in mini-PCI slot where I have > attached Atheros 802.11a/b/g/n Wireless PCI Adapter (AR5416). > That also requires to disable 4th port from the jumpers on the card. > > I have installed FreeBSD 8.1-RELEASE i386 > > pciconf -vlb > > pcib6@pci0:5:0:0: class=0x060400 card=0x00000000 chip=0x814812d8 > rev=0x00 hdr=0x01 > vendor = 'Pericom Semiconductor' > class = bridge > subclass = PCI-PCI > rl0@pci0:6:8:0: class=0x020000 card=0x813910ec chip=0x813910ec rev=0x10 hdr=0x00 > vendor = 'Realtek Semiconductor' > device = 'Realtek RTL8139 Family PCI Fast Ethernet NIC > (RTL-8139/8139C/8139D)' > class = network > subclass = ethernet > bar [14] = type Memory, range 32, base 0xe0110200, size 256, enabled > rl1@pci0:6:9:0: class=0x020000 card=0x813910ec chip=0x813910ec rev=0x10 hdr=0x00 > vendor = 'Realtek Semiconductor' > device = 'Realtek RTL8139 Family PCI Fast Ethernet NIC > (RTL-8139/8139C/8139D)' > class = network > subclass = ethernet > bar [14] = type Memory, range 32, base 0xe0110100, size 256, enabled > rl2@pci0:6:10:0: class=0x020000 card=0x813910ec chip=0x813910ec > rev=0x10 hdr=0x00 > vendor = 'Realtek Semiconductor' > device = 'Realtek RTL8139 Family PCI Fast Ethernet NIC > (RTL-8139/8139C/8139D)' > class = network > subclass = ethernet > bar [10] = type I/O Port, range 32, base 0x1000, size 256, enabled > bar [14] = type Memory, range 32, base 0xe0110000, size 256, enabled > ath0@pci0:6:11:0: class=0x028000 card=0x2071168c chip=0x0023168c > rev=0x01 hdr=0x00 > vendor = 'Atheros Communications Inc.' > device = '802.11a/b/g/n Wireless PCI Adapter (AR5416)' > class = network > bar [10] = type Memory, range 32, base 0xe0100000, size 65536, enabled > > > > dmesg > > rl0: port 0x1200-0x12ff mem > 0xe0110200-0xe01102ff irq 21 at device 8.0 on pci6 > rl0: reset never completed! > rl0: unknown device ID: ffff assuming 8139 > rl0: MII without any phy! > device_attach: rl0 attach returned 6 > rl1: port 0x1100-0x11ff mem > 0xe0110100-0xe01101ff irq 22 at device 9.0 on pci6 > rl1: reset never completed! > rl1: unknown device ID: ffff assuming 8139 > rl1: MII without any phy! > device_attach: rl1 attach returned 6 > rl2: port 0x1000-0x10ff mem > 0xe0110000-0xe01100ff irq 23 at device 10.0 on pci6 > miibus1: on rl2 > rlphy0: PHY 0 on miibus1 > rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto > rl2: Ethernet address: 00:06:4f:67:08:f5 > rl2: [ITHREAD] > rl2: link state changed to DOWN > > > ath0 works fine > rl2 works fine > > rl0 and rl1 don't and of course as you may suspect they are missing > from ifconfig -a > > if I remove the miniPCI Atheros and enable 4th port it is the same > picture but this time 4th port rl3 works fine and rl0, rl1, and rl2 > don't in the same way. > > Any suggestions will be much appreciated. What makes me wonder is that both pci0:6:8:0 and pci0:6:9:0 has no I/O BAR. I never saw these kind of thing on rl(4) controllers. And I can't explain how rl(4) could successfully map the I/O with non-existing I/O BAR. Anyway would you try attached patch and let me know whether it makes any difference? Also add the following line to /boot/device.hints to have rl(4) use memory mapped mapping. hint.rl.0.prefer_iomap="0" --x+6KMIRAuhnl3hBn Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="rl.map.diff" Index: sys/pci/if_rl.c =================================================================== --- sys/pci/if_rl.c (revision 211528) +++ sys/pci/if_rl.c (working copy) @@ -225,14 +225,6 @@ static void rl_setwol(struct rl_softc *); static void rl_clrwol(struct rl_softc *); -#ifdef RL_USEIOSPACE -#define RL_RES SYS_RES_IOPORT -#define RL_RID RL_PCI_LOIO -#else -#define RL_RES SYS_RES_MEMORY -#define RL_RID RL_PCI_LOMEM -#endif - static device_method_t rl_methods[] = { /* Device interface */ DEVMETHOD(device_probe, rl_probe), @@ -806,7 +798,7 @@ struct sysctl_ctx_list *ctx; struct sysctl_oid_list *children; int error = 0, hwrev, i, pmc, rid; - int unit; + int prefer_iomap, unit; uint16_t rl_did = 0; char tn[32]; @@ -828,10 +820,31 @@ pci_enable_busmaster(dev); - /* Map control/status registers. */ - rid = RL_RID; - sc->rl_res = bus_alloc_resource_any(dev, RL_RES, &rid, RF_ACTIVE); + /* + * Map control/status registers. + * Default to using PIO access for this driver. On SMP systems, + * there appear to be problems with memory mapped mode: it looks + * like doing too many memory mapped access back to back in rapid + * succession can hang the bus. I'm inclined to blame this on + * crummy design/construction on the part of RealTek. Memory + * mapped mode does appear to work on uniprocessor systems though. + */ + prefer_iomap = 1; + resource_int_value(device_get_name(sc->rl_dev), + device_get_unit(sc->rl_dev), "prefer_iomap", &prefer_iomap); + if (prefer_iomap) { + sc->rl_res_id = PCIR_BAR(0); + sc->rl_res_type = SYS_RES_IOPORT; + sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, + &sc->rl_res_id, RF_ACTIVE); + } + if (prefer_iomap == 0 || sc->rl_res == NULL) { + sc->rl_res_id = PCIR_BAR(1); + sc->rl_res_type = SYS_RES_MEMORY; + sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, + &sc->rl_res_id, RF_ACTIVE); + } if (sc->rl_res == NULL) { device_printf(dev, "couldn't map ports/memory\n"); error = ENXIO; @@ -1029,7 +1042,8 @@ if (sc->rl_irq[0]) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->rl_irq[0]); if (sc->rl_res) - bus_release_resource(dev, RL_RES, RL_RID, sc->rl_res); + bus_release_resource(dev, sc->rl_res_type, sc->rl_res_id, + sc->rl_res); if (ifp) if_free(ifp); --x+6KMIRAuhnl3hBn--