Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci It's useless to not to set PCI_PMCSR_PME_STS bit...



details:   https://anonhg.NetBSD.org/src/rev/fdea55324ed1
branches:  trunk
changeset: 969366:fdea55324ed1
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Feb 18 04:07:14 2020 +0000

description:
It's useless to not to set PCI_PMCSR_PME_STS bit when writing because
the bit is W1C. Instead, always write PCI_PMCSR_PME_STS bit to clear in
case it's already set.

diffstat:

 sys/dev/pci/if_wm.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 78159ffcdbbe -r fdea55324ed1 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Tue Feb 18 03:48:22 2020 +0000
+++ b/sys/dev/pci/if_wm.c       Tue Feb 18 04:07:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.667 2020/02/18 03:48:22 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.668 2020/02/18 04:07:14 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.667 2020/02/18 03:48:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.668 2020/02/18 04:07:14 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -15355,12 +15355,13 @@
 pme:
        /* Request PME */
        pmode = pci_conf_read(sc->sc_pc, sc->sc_pcitag, pmreg + PCI_PMCSR);
+       pmode |= PCI_PMCSR_PME_STS; /* in case it's already set (W1C) */
        if ((rv == 0) && (sc->sc_flags & WM_F_WOL) != 0) {
                /* For WOL */
-               pmode |= PCI_PMCSR_PME_STS | PCI_PMCSR_PME_EN;
+               pmode |= PCI_PMCSR_PME_EN;
        } else {
                /* Disable WOL */
-               pmode &= ~(PCI_PMCSR_PME_STS | PCI_PMCSR_PME_EN);
+               pmode &= ~PCI_PMCSR_PME_EN;
        }
        pci_conf_write(sc->sc_pc, sc->sc_pcitag, pmreg + PCI_PMCSR, pmode);
 }



Home | Main Index | Thread Index | Old Index