Module Name: src Committed By: snj Date: Sun May 3 17:58:41 UTC 2009
Modified Files: src/sys/dev/pci [netbsd-5]: if_wm.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #630): sys/dev/pci/if_wm.c: revision 1.170 Add workaround for 82543GC. We need to force speed and duplex on the MAC equal to what the PHY speed and duplex configuration is. Fixes PR#36430. To generate a diff of this commit: cvs rdiff -u -r1.162.4.6 -r1.162.4.7 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.162.4.6 src/sys/dev/pci/if_wm.c:1.162.4.7 --- src/sys/dev/pci/if_wm.c:1.162.4.6 Sun May 3 17:56:05 2009 +++ src/sys/dev/pci/if_wm.c Sun May 3 17:58:41 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.162.4.6 2009/05/03 17:56:05 snj Exp $ */ +/* $NetBSD: if_wm.c,v 1.162.4.7 2009/05/03 17:58:41 snj Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -79,7 +79,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.162.4.6 2009/05/03 17:56:05 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.162.4.7 2009/05/03 17:58:41 snj Exp $"); #include "bpfilter.h" #include "rnd.h" @@ -2769,6 +2769,44 @@ ("%s: LINK: LSC -> mii_tick\n", device_xname(sc->sc_dev))); mii_tick(&sc->sc_mii); + if (sc->sc_type == WM_T_82543) { + int miistatus, active; + + /* + * With 82543, we need to force speed and + * duplex on the MAC equal to what the PHY + * speed and duplex configuration is. + */ + miistatus = sc->sc_mii.mii_media_status; + + if (miistatus & IFM_ACTIVE) { + active = sc->sc_mii.mii_media_active; + sc->sc_ctrl &= ~(CTRL_SPEED_MASK + | CTRL_FD); + switch (IFM_SUBTYPE(active)) { + case IFM_10_T: + sc->sc_ctrl |= CTRL_SPEED_10; + break; + case IFM_100_TX: + sc->sc_ctrl |= CTRL_SPEED_100; + break; + case IFM_1000_T: + sc->sc_ctrl |= CTRL_SPEED_1000; + break; + default: + /* + * fiber? + * Shoud not enter here. + */ + printf("unknown media (%x)\n", + active); + break; + } + if (active & IFM_FDX) + sc->sc_ctrl |= CTRL_FD; + CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl); + } + } } else if (icr & ICR_RXSEQ) { DPRINTF(WM_DEBUG_LINK, ("%s: LINK Receive sequence error\n",