svn commit: r185538 - head/sys/dev/fxp

Pyun YongHyeon yongari at FreeBSD.org
Mon Dec 1 18:12:35 PST 2008


Author: yongari
Date: Tue Dec  2 02:12:34 2008
New Revision: 185538
URL: http://svn.freebsd.org/changeset/base/185538

Log:
  Make sure to clear PMDR register by writing back power management
  events. Just reading PMDR register was not enough to have fxp(4)
  immuninize against received magic packets during system boot.
  
  Tested by:	Alexey Shuvaev < shuvaev <> physik DOT uni-wuerzburg DOT de >

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==============================================================================
--- head/sys/dev/fxp/if_fxp.c	Tue Dec  2 00:51:56 2008	(r185537)
+++ head/sys/dev/fxp/if_fxp.c	Tue Dec  2 02:12:34 2008	(r185538)
@@ -857,7 +857,7 @@ fxp_attach(device_t dev)
 	if ((sc->flags & FXP_FLAG_WOLCAP) != 0) {
 		FXP_LOCK(sc);
 		/* Clear wakeup events. */
-		CSR_READ_1(sc, FXP_CSR_PMDR);
+		CSR_WRITE_1(sc, FXP_CSR_PMDR, CSR_READ_1(sc, FXP_CSR_PMDR));
 		fxp_init_body(sc);
 		fxp_stop(sc);
 		FXP_UNLOCK(sc);
@@ -1050,10 +1050,9 @@ fxp_resume(device_t dev)
 		/* Disable PME and clear PME status. */
 		pmstat &= ~PCIM_PSTAT_PMEENABLE;
 		pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
-		if ((sc->flags & FXP_FLAG_WOLCAP) != 0) {
-			/* Clear wakeup events. */
-			CSR_READ_1(sc, FXP_CSR_PMDR);
-		}
+		if ((sc->flags & FXP_FLAG_WOLCAP) != 0)
+			CSR_WRITE_1(sc, FXP_CSR_PMDR,
+			    CSR_READ_1(sc, FXP_CSR_PMDR));
 	}
 
 	CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET);


More information about the svn-src-all mailing list