Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - Set CTRL_ILOS(Invert loss of signal) bit corre...



details:   https://anonhg.NetBSD.org/src/rev/a027e088e5e0
branches:  trunk
changeset: 466078:a027e088e5e0
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Dec 11 09:48:16 2019 +0000

description:
- Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580 port 1, 2, 3 and
  newer chips. This change fixes a bug that some fiber, serdes or SFP devices
  don't detect the link status correctly.
  XXX We should check for other NVM reads if they have the same problem. One of
  the solution to avoid this type of bug is to check the register layout
  in wm_nvm_read().
- Use __BIT()
- Add comment

diffstat:

 sys/dev/pci/if_wm.c    |  13 +++++++------
 sys/dev/pci/if_wmreg.h |   9 +++++----
 2 files changed, 12 insertions(+), 10 deletions(-)

diffs (57 lines):

diff -r 21c4a3aad577 -r a027e088e5e0 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed Dec 11 09:27:46 2019 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Dec 11 09:48:16 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.653 2019/12/11 09:27:46 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.654 2019/12/11 09:48:16 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.653 2019/12/11 09:27:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.654 2019/12/11 09:48:16 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2656,10 +2656,11 @@
                }
        }
 
-       /* XXX For other than 82580? */
-       if (sc->sc_type == WM_T_82580) {
-               wm_nvm_read(sc, NVM_OFF_CFG3_PORTA, 1, &nvmword);
-               if (nvmword & __BIT(13))
+       if ((sc->sc_type >= WM_T_82580) && (sc->sc_type <= WM_T_I211)) {
+               wm_nvm_read(sc,
+                   NVM_OFF_LAN_FUNC_82580(sc->sc_funcid) + NVM_OFF_CFG3_PORTA,
+                   1, &nvmword);
+               if (nvmword & NVM_CFG3_ILOS)
                        sc->sc_ctrl |= CTRL_ILOS;
        }
 
diff -r 21c4a3aad577 -r a027e088e5e0 sys/dev/pci/if_wmreg.h
--- a/sys/dev/pci/if_wmreg.h    Wed Dec 11 09:27:46 2019 +0000
+++ b/sys/dev/pci/if_wmreg.h    Wed Dec 11 09:48:16 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wmreg.h,v 1.116 2019/12/11 09:12:29 msaitoh Exp $   */
+/*     $NetBSD: if_wmreg.h,v 1.117 2019/12/11 09:48:16 msaitoh Exp $   */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -1487,9 +1487,10 @@
 
 #define NVM_3GIO_3_ASPM_MASK   (0x3 << 2)      /* Active State PM Support */
 
-#define NVM_CFG3_APME          (1U << 10)      
-#define NVM_CFG3_PORTA_EXT_MDIO        (1U << 2)       /* External MDIO Interface */
-#define NVM_CFG3_PORTA_COM_MDIO        (1U << 3)       /* MDIO Interface is shared */
+#define NVM_CFG3_PORTA_EXT_MDIO        __BIT(2)        /* External MDIO Interface */
+#define NVM_CFG3_PORTA_COM_MDIO        __BIT(3)        /* MDIO Interface is shared */
+#define NVM_CFG3_APME          __BIT(10)       /* APM Enable */
+#define NVM_CFG3_ILOS          __BIT(13)       /* Invert loss of signal */
 
 #define        NVM_OFF_MACADDR_82571(x)        (3 * (x))
 



Home | Main Index | Thread Index | Old Index