Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Fix three bugs reported by enami@:



details:   https://anonhg.NetBSD.org/src/rev/d7955075aa19
branches:  trunk
changeset: 806232:d7955075aa19
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Feb 11 23:07:13 2015 +0000

description:
Fix three bugs reported by enami@:
 - bge_miibus_writereg(): Fix a bug that BCM5906 may leave an APE lock.
 - Fix hwcfg4 isn't printed correctly.
 - Fix a bug that BGE_PHY_TEST_CTRL_REG isn't set correctly on some PCIe devices.

diffstat:

 sys/dev/pci/if_bge.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r fa12f8f24391 -r d7955075aa19 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Wed Feb 11 23:00:41 2015 +0000
+++ b/sys/dev/pci/if_bge.c      Wed Feb 11 23:07:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.277 2014/08/10 16:44:36 tls Exp $ */
+/*     $NetBSD: if_bge.c,v 1.278 2015/02/11 23:07:13 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.277 2014/08/10 16:44:36 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.278 2015/02/11 23:07:13 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1397,13 +1397,13 @@
        uint32_t autopoll;
        int i;
 
-       if (bge_ape_lock(sc, sc->bge_phy_ape_lock) != 0)
-               return;
-
        if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906 &&
            (reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL))
                return;
 
+       if (bge_ape_lock(sc, sc->bge_phy_ape_lock) != 0)
+               return;
+
        /* Reading with autopolling on may trigger PCI errors */
        autopoll = CSR_READ_4(sc, BGE_MI_MODE);
        if (autopoll & BGE_MIMODE_AUTOPOLL) {
@@ -3742,7 +3742,7 @@
                        hwcfg2 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_2);
                if (sc->bge_flags & BGEF_PCIE)
                        hwcfg3 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_3);
-               if (BGE_ASICREV(sc->bge_chipid == BGE_ASICREV_BCM5785))
+               if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5785)
                        hwcfg4 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_4);
                if (BGE_IS_5717_PLUS(sc))
                        hwcfg5 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_5);
@@ -4170,7 +4170,7 @@
         * XXX: from FreeBSD/Linux; no documentation
         */
        if (sc->bge_flags & BGEF_PCIE) {
-               if (BGE_ASICREV(sc->bge_chipid != BGE_ASICREV_BCM5785) &&
+               if ((BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5785) &&
                    !BGE_IS_57765_PLUS(sc) &&
                    (CSR_READ_4(sc, BGE_PHY_TEST_CTRL_REG) ==
                        (BGE_PHY_PCIE_LTASS_MODE | BGE_PHY_PCIE_SCRAM_MODE))) {



Home | Main Index | Thread Index | Old Index