NetBSD Problem Report #49789
From www@NetBSD.org Thu Mar 26 08:29:34 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id C8AD8A567D
for <gnats-bugs@gnats.NetBSD.org>; Thu, 26 Mar 2015 08:29:34 +0000 (UTC)
Message-Id: <20150326082933.50437A6567@mollari.NetBSD.org>
Date: Thu, 26 Mar 2015 08:29:33 +0000 (UTC)
From: bernard.merindol@telnowedge.com
Reply-To: bernard.merindol@telnowedge.com
To: gnats-bugs@NetBSD.org
Subject: wm driver, Bug in sgmii i2c write function
X-Send-Pr-Version: www-1.0
>Number: 49789
>Category: kern
>Synopsis: wm driver, Bug in sgmii i2c write function
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: msaitoh
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 26 08:30:00 +0000 2015
>Closed-Date: Mon Sep 21 09:03:34 +0000 2015
>Last-Modified: Mon Sep 21 09:03:34 +0000 2015
>Originator: Bernard Mérindol
>Release: Netbsd 7 Beta
>Organization:
TelNowEdge
>Environment:
NetBSD tne 7.0_BETA NetBSD 7.0_BETA (BME) #21: Tue Mar 24 02:36:24 UTC 2015 root@test:/usr/src/sys/arch/i386/compile/BME i386
>Description:
When use Intel i210 chips (wm driver) with SFP SGMII connection, only works at
10 Mbit/s Half-Dupex.
After patch (send in Fix to the problem if known)
All works fine.
>How-To-Repeat:
>Fix:
The problem is in :
wm_sgmii_writereg(device_t self, int phy, int reg, int val) in /usr/src/sys/dev/pci/if_wm.c
In this function val is not used, the val is not write in I2C bus for SFP.
Old Code:
wm_sgmii_writereg(device_t self, int phy, int reg, int val)
{
struct wm_softc *sc = device_private(self);
uint32_t i2ccmd;
int i;
if (wm_get_swfw_semaphore(sc, swfwphysem[sc->sc_funcid])) {
aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
__func__);
return;
}
i2ccmd = (reg << I2CCMD_REG_ADDR_SHIFT)
| (phy << I2CCMD_PHY_ADDR_SHIFT)
| I2CCMD_OPCODE_WRITE;
CSR_WRITE(sc, WMREG_I2CCMD, i2ccmd);
New Code:
wm_sgmii_writereg(device_t self, int phy, int reg, int val)
{
struct wm_softc *sc = device_private(self);
uint32_t i2ccmd;
int i;
int val_swapped;
if (wm_get_swfw_semaphore(sc, swfwphysem[sc->sc_funcid])) {
aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
__func__);
return;
}
/* Swap the data bytes for the I2C interface */
val_swapped = ((val >> 8) & 0x00FF) | ((val << 8) & 0xFF00);
i2ccmd = ((reg << I2CCMD_REG_ADDR_SHIFT)
| (phy << I2CCMD_PHY_ADDR_SHIFT)
| I2CCMD_OPCODE_WRITE| val_swapped);
CSR_WRITE(sc, WMREG_I2CCMD, i2ccmd);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->msaitoh
Responsible-Changed-By: msaitoh@NetBSD.org
Responsible-Changed-When: Thu, 26 Mar 2015 08:54:57 +0000
Responsible-Changed-Why:
Mine!!!
From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49789 CVS commit: src/sys/dev/pci
Date: Sat, 28 Mar 2015 17:35:59 +0000
Module Name: src
Committed By: msaitoh
Date: Sat Mar 28 17:35:59 UTC 2015
Modified Files:
src/sys/dev/pci: if_wm.c
Log Message:
Fix a but that wm_sgmii_writereg() function doesn't pass the "val" argument
to the I2CCMD register. Reported by Bernard Merindol in PR#49789.
To generate a diff of this commit:
cvs rdiff -u -r1.313 -r1.314 src/sys/dev/pci/if_wm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: msaitoh@NetBSD.org
State-Changed-When: Sun, 29 Mar 2015 06:35:22 +0000
State-Changed-Why:
Committed. Could you test the latest -current?
From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49789 CVS commit: [netbsd-7] src/sys/dev/pci
Date: Thu, 16 Apr 2015 06:10:43 +0000
Module Name: src
Committed By: snj
Date: Thu Apr 16 06:10:43 UTC 2015
Modified Files:
src/sys/dev/pci [netbsd-7]: if_wm.c
Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #694):
sys/dev/pci/if_wm.c: revision 1.314
Fix a bug that wm_sgmii_writereg() function doesn't pass the "val" argument
to the I2CCMD register. Reported by Bernard Merindol in PR#49789.
To generate a diff of this commit:
cvs rdiff -u -r1.289.2.4 -r1.289.2.5 src/sys/dev/pci/if_wm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49789 CVS commit: [netbsd-6] src/sys/dev/pci
Date: Sun, 19 Apr 2015 17:01:50 +0000
Module Name: src
Committed By: riz
Date: Sun Apr 19 17:01:50 UTC 2015
Modified Files:
src/sys/dev/pci [netbsd-6]: if_wm.c
Log Message:
Apply patch (requested by msaitoh in ticket #1292):
sys/dev/pci/if_wm.c 1.313-1.314 and 1.316 via patch
Fix a bug that the first access to NVM is failed on 8254[17] which use
SPI EEPROM. Observed on Dell PowerEdge [12]850.
Thanks Tom Ivar Helbekkmo for debugging.
Fix a bug that wm_sgmii_writereg() function doesn't pass the "val"
argument to the I2CCMD register. Reported by Bernard Merindol
in PR#49789.
Fix a bug that newer revision of I218-{LM,V} use wrong PHY access
functions. The problem only occured on devices that the PCI device ID
was 0x15a[0123].
[msaitoh, ticket #1292]
To generate a diff of this commit:
cvs rdiff -u -r1.227.2.16 -r1.227.2.17 src/sys/dev/pci/if_wm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49789 CVS commit: [netbsd-5] src/sys/dev/pci
Date: Thu, 30 Apr 2015 20:00:27 +0000
Module Name: src
Committed By: snj
Date: Thu Apr 30 20:00:27 UTC 2015
Modified Files:
src/sys/dev/pci [netbsd-5]: if_wm.c if_wmreg.h if_wmvar.h pcidevs
Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1962):
sys/dev/pci/if_wm.c: revisions 1.259-1.266, 1.269, 1.271, 1.273-1.274, 1.277-1.278, 1.282, 1.284-1.285, 1.287, 1.290, 1.294, 1.297-1.298, 1.300-1.301, 1.304-1.307, 1.310, 1.312-1.314, 1.316 via patch
sys/dev/pci/if_wmreg.c: revisions 1.54-1.57, 1.59-1.60, 1.62, 1.64-1.66 via patch
sys/dev/pci/if_wmvar.c: revisions 1.17, 1.20-1.21 via patch
sys/dev/pci/pcidevs: revisions 1.1172, 1.1195, 1.1201 via patch
- Fix "MDIC write error" bug for 82574 and 82583. For those chips, the
semaphore must be released after chip reset. Found and tested by
Mark Davies.
- Fix BMC related bugs.
- Fix yet another NVM bank detect problem in wm(4). Use bank 0 if the detect
function failed. It's the same as FreeBSD. Observed and tested with
Asus P8P67 Deluxe motherboard and tested by jnemeth.
- Add support for I354 DH89xxCC and some new I218 devices.
- Fix definition of CTRL_GIO_M_DIS bit.
- Insert completion barrier between register write and delay().
- Bump max TX DMA size to avoid pathological condition with TSO. From dyoung.
- Fix semaphore related bugs.
- Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.
- Fix fiber link problem (PR#44776 and PR#30880).
- WM_T_82545 is not 1000base-SX but 1000base-LX. Same as FreeBSD.
- Set the WM_F_ATTACHED flag if wm_attach() finished succesfully and check
the flag in wm_detach(). It will avoid to panic in wm_detach().
Fixes PR#49102.
- It's not required to print "failed to detect NVM bank" with
aprint_error_dev(). Use DPRINTF(). Same as {Free,Open}BSD.
- Fix a bug that the offset of alt MAC address is wrongly calculated to 0
when alt MAC address function is really used. This bug does not appear
as real bug if the same MAC address is written in the default location
and alt MAC address's location.
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
Some of them are workaround code. From other *BSDs, Linux and documents.
- Fix a bug that wm_sgmii_writereg() function doesn't pass the "val" argument
to the I2CCMD register. Reported by Bernard Merindol in PR#49789.
- Delete 82580ER related code. It was from FreeBSD and was removed
in r203049.
- Remove extra debug message.
- Remove unused variable.
- Remove a duplicated error message.
- Cleanup comments.
- Fix debug message.
To generate a diff of this commit:
cvs rdiff -u -r1.162.4.20 -r1.162.4.21 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.24.20.8 -r1.24.20.9 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.2.46.6 -r1.2.46.7 src/sys/dev/pci/if_wmvar.h
cvs rdiff -u -r1.962.4.19 -r1.962.4.20 src/sys/dev/pci/pcidevs
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "=?utf-8?Q?M=C3=A9rindol_Bernard?=" <bernard.merindol@telnowedge.com>
To: gnats-bugs@gnats.netbsd.org
Cc:
Subject: RE: kern/49789
Date: Mon, 21 Sep 2015 08:52:41 +0200
The correction of problem is good for me. Sorry for the delay for my answer.
Best regards
_______________________________________________
Directeur Technique TelNowEdge, Mobile:+33.6.08.75.03.52
State-Changed-From-To: feedback->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 21 Sep 2015 09:03:34 +0000
State-Changed-Why:
Confirmed fixed, thanks!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.