Module Name:    src
Committed By:   msaitoh
Date:           Wed Oct 20 08:10:27 UTC 2021

Modified Files:
        src/sys/dev/pci: if_wm.c

Log Message:
Use wm_flush_desc_rings() more.

 - Use wm_flush_desc_rings() for newer than PCH_SPT, too. Same as other OSes.
   It seems that some devices has no this errata, but we don't know how to
   identify it. So just use >= PCH_SPT.
 - Use wm_flush_desc_rings() before chip reset in wm_resume(), too.


To generate a diff of this commit:
cvs rdiff -u -r1.714 -r1.715 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.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.714 src/sys/dev/pci/if_wm.c:1.715
--- src/sys/dev/pci/if_wm.c:1.714	Wed Oct 20 08:06:45 2021
+++ src/sys/dev/pci/if_wm.c	Wed Oct 20 08:10:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.714 2021/10/20 08:06:45 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.715 2021/10/20 08:10:26 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.714 2021/10/20 08:06:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.715 2021/10/20 08:10:26 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3293,6 +3293,10 @@ wm_resume(device_t self, const pmf_qual_
 	if (sc->sc_type >= WM_T_PCH2)
 		wm_resume_workarounds_pchlan(sc);
 	if ((ifp->if_flags & IFF_UP) == 0) {
+		/* >= PCH_SPT hardware workaround before reset. */
+		if (sc->sc_type >= WM_T_PCH_SPT)
+			wm_flush_desc_rings(sc);
+
 		wm_reset(sc);
 		/* Non-AMT based hardware can now take control from firmware */
 		if ((sc->sc_flags & WM_F_HAS_AMT) == 0)
@@ -6093,8 +6097,8 @@ wm_init_locked(struct ifnet *ifp)
 	if_statadd2(ifp, if_collisions, CSR_READ(sc, WMREG_COLC),
 	    if_ierrors, CSR_READ(sc, WMREG_RXERRC));
 
-	/* PCH_SPT hardware workaround */
-	if (sc->sc_type == WM_T_PCH_SPT)
+	/* >= PCH_SPT hardware workaround before reset. */
+	if (sc->sc_type >= WM_T_PCH_SPT)
 		wm_flush_desc_rings(sc);
 
 	/* Reset the chip to a known state. */

Reply via email to