From owner-freebsd-hardware@FreeBSD.ORG Fri Jun 1 04:09:52 2012 Return-Path: Delivered-To: freebsd-hardware@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 364B3106564A; Fri, 1 Jun 2012 04:09:52 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id EDDFE8FC08; Fri, 1 Jun 2012 04:09:51 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so2555756pbb.13 for ; Thu, 31 May 2012 21:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=eP3kdDw9j3jJnxjXoPrIPEju9WYsYVjR1/iiV0WQjo4=; b=JJmJiBbGKV+yW9QgjLmLuRUdXQ9Fg+LyJsgfMM1evVpjdyDLF02GKt91SK9ygDqQPy oCb1vZGt+kXs0+Hy13nRvCbPNXTi+X+gVG3oyqtbPAuVO4OoYA6x2ef1VAELOFrnRxpN 7lyaXnVm8EpGaEHmc9QKaxenGlJg8dFqlIm7eFTChXaSnb7atIn93y/EODj9HgPfoSpc d2uZQKgrRfLAS4fOoz6DOgUCQ/84EN9NQYfBTz1S8CKj6JYPYhqH0egeWoX/6ADq+BM+ T21E0g7BUJfhnQ0+P2SmS3rq6PvwFQAnioZHkagijNU6c0RoVdBlA3o/XYyVVbgCVzjI rcSg== Received: by 10.68.234.101 with SMTP id ud5mr2272053pbc.41.1338523791555; Thu, 31 May 2012 21:09:51 -0700 (PDT) Received: from pyunyh@gmail.com ([114.111.62.249]) by mx.google.com with ESMTPS id go10sm1312865pbc.54.2012.05.31.21.09.48 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 31 May 2012 21:09:50 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Fri, 01 Jun 2012 13:09:42 -0700 From: YongHyeon PYUN Date: Fri, 1 Jun 2012 13:09:42 -0700 To: Mike Tancsa Message-ID: <20120601200942.GD10661@michelle.cdnetworks.com> References: <4FC03C83.4030109@sentex.net> <201205301126.40105.jhb@freebsd.org> <20120531161418.GF1467@michelle.cdnetworks.com> <201205311057.05234.jhb@freebsd.org> <4FC7AD6F.60004@sentex.net> <4FC7B301.30109@sentex.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline In-Reply-To: <4FC7B301.30109@sentex.net> User-Agent: Mutt/1.4.2.3i Cc: freebsd-hardware@freebsd.org Subject: Re: pcie realtek issue (re driver) X-BeenThere: freebsd-hardware@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: General discussion of FreeBSD hardware List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2012 04:09:52 -0000 --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, May 31, 2012 at 02:05:53PM -0400, Mike Tancsa wrote: > On 5/31/2012 1:42 PM, Mike Tancsa wrote: > > On 5/31/2012 10:57 AM, John Baldwin wrote: > >>> > >>> Right, but what if it is not(from the pciconf output)? > >>> I'm pretty sure re(4) used RF_ACTIVE with bus_alloc_resource_any(9). > >> > >> Hmm, is this pciconf output when the driver is attached? > > > > Hi, > > Here are some of the variations attached in a txt file. Could this > > just be a broken card ? I will try and boot up another OS on the box > > and see if it works. > > Oh, and doing a load post reboot, > > 0{intel-i3}# kldload if_re > pci0: driver added > found-> vendor=0x8086, dev=0x1c3a, revid=0x04 > domain=0, bus=0, slot=22, func=0 > class=07-80-00, hdrtype=0x00, mfdev=1 > cmdreg=0x0006, statreg=0x0010, cachelnsz=0 (dwords) > lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) > intpin=a, irq=16 > powerspec 3 supports D0 D3 current D0 > MSI supports 1 message, 64 bit > pci0:0:22:0: reprobing on driver added > found-> vendor=0x8086, dev=0x1c22, revid=0x05 > domain=0, bus=0, slot=31, func=3 > class=0c-05-00, hdrtype=0x00, mfdev=0 > cmdreg=0x0003, statreg=0x0280, cachelnsz=0 (dwords) > lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) > intpin=c, irq=18 > pci0:0:31:3: reprobing on driver added > pci1: driver added > pci2: driver added > pci3: driver added > pci4: driver added > found-> vendor=0x10ec, dev=0x8168, revid=0x03 > domain=0, bus=4, slot=0, func=0 > class=02-00-00, hdrtype=0x00, mfdev=0 > cmdreg=0x0000, statreg=0x0010, cachelnsz=0 (dwords) > lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) > intpin=a, irq=255 > powerspec 3 supports D0 D1 D2 D3 current D0 > MSI supports 1 message, 64 bit > MSI-X supports 4 messages in map 0x20 > pci0:4:0:0: reprobing on driver added > re0: at device > 0.0 on pci4 > pci4: child re0 requested type 3 for rid 0x18, but the BAR says it is an > ioport > pcib4: allocated I/O port range (0xd000-0xd0ff) for rid 10 of re0 > re0: Lazy allocation of 0x100 bytes rid 0x10 type 4 at 0xd000 This is the first time I saw BAR2 is I/O space on RealTek PCI express device. re(4) switched to use BAR0 with I/O space after failing to use BAR2. Could you try attached patch? > re0: MSI count : 1 > re0: MSI-X count : 4 > pcib4: allocated prefetch range (0xf0000000-0xf0003fff) for rid 20 of re0 > re0: Lazy allocation of 0x4000 bytes rid 0x20 type 3 at 0xf0000000 > re0: attempting to allocate 1 MSI-X vectors (4 supported) > msi: routing MSI-X IRQ 270 to local APIC 1 vector 52 > re0: using IRQ 270 for MSI-X > re0: Using 1 MSI-X message > re0: Chip rev. 0x28000000 > re0: MAC rev. 0x00000000 > miibus0: on re0 > rgephy0: PHY 1 on miibus0 > rgephy0: OUI 0x00e04c, model 0x0011, rev. 2 > rgephy0: none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, > 100baseTX-FDX, 100baseTX-FDX-flow, 100baseT4, 1000baseSX, > 1000baseSX-FDX, 1000baseSX-FDX-flow, 1000baseT, 1000baseT-master, > 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, > 1000baseT-FDX-flow-master, auto, auto-flow > re0: PHY write failed > re0: PHY write failed > re0: bpf attached > re0: Ethernet address: 00:0a:cd:1c:ba:89 > pci5: driver added > pci6: driver added > 0{intel-i3}# > 0{intel-i3}# ifconfig re0 up > re0: reset never completed! > re0: PHY write failed > re0: PHY write failed > re0: PHY write failed > re0: PHY write failed > re0: PHY write failed > re0: PHY write failed > re0: PHY write failed > 0{intel-i3}# --+HP7ph2BbKc20aGI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="re.map.diff" Index: sys/dev/re/if_re.c =================================================================== --- sys/dev/re/if_re.c (revision 236345) +++ sys/dev/re/if_re.c (working copy) @@ -1191,7 +1191,7 @@ const struct rl_hwrev *hw_rev; u_int32_t cap, ctl; int hwrev; - u_int16_t devid, re_did = 0; + u_int16_t cmd, devid, re_did = 0; int error = 0, i, phy, rid; int msic, msixc, reg; uint8_t cfg; @@ -1220,8 +1220,12 @@ sc->rl_res_id = PCIR_BAR(1); sc->rl_res_type = SYS_RES_MEMORY; /* RTL8168/8101E seems to use different BARs. */ - if (devid == RT_DEVICEID_8168 || devid == RT_DEVICEID_8101E) + if (devid == RT_DEVICEID_8168 || devid == RT_DEVICEID_8101E) { sc->rl_res_id = PCIR_BAR(2); + cmd = pci_read_config(dev, PCIR_BAR(2), 2); + if (PCI_BAR_IO(cmd)) + sc->rl_res_type = SYS_RES_IOPORT; + } } else { sc->rl_res_id = PCIR_BAR(0); sc->rl_res_type = SYS_RES_IOPORT; @@ -3317,6 +3321,10 @@ mii = device_get_softc(sc->rl_miibus); RL_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + RL_UNLOCK(sc); + return; + } mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; --+HP7ph2BbKc20aGI--