Module Name: src Committed By: martin Date: Thu Aug 9 08:00:55 UTC 2012
Modified Files: src/sys/dev/pci [netbsd-6]: if_wm.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #471): sys/dev/pci/if_wm.c: revision 1.230 sys/dev/pci/if_wm.c: revision 1.231 Add workaround for QEMU and the variants that fail on EEPROM access. This problem was discovered a few years ago, but some variants and cloud services still have the bug. This problem is not NetBSD's bug but qemus's bug. For NetBSD users, existence of buggy virtual machines s sad thing, so we add a workaroud. Fix the check of the device type in last commit. Reported by Thomas Klausner. To generate a diff of this commit: cvs rdiff -u -r1.227.2.1 -r1.227.2.2 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.227.2.1 src/sys/dev/pci/if_wm.c:1.227.2.2 --- src/sys/dev/pci/if_wm.c:1.227.2.1 Thu Jun 28 16:06:36 2012 +++ src/sys/dev/pci/if_wm.c Thu Aug 9 08:00:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.227.2.1 2012/06/28 16:06:36 riz Exp $ */ +/* $NetBSD: if_wm.c,v 1.227.2.2 2012/08/09 08:00:55 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227.2.1 2012/06/28 16:06:36 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227.2.2 2012/08/09 08:00:55 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -4628,6 +4628,22 @@ wm_read_eeprom_uwire(struct wm_softc *sc reg = CSR_READ(sc, WMREG_EECD) & ~(EECD_SK | EECD_DI); CSR_WRITE(sc, WMREG_EECD, reg); + /* + * XXX: workaround for a bug in qemu-0.12.x and prior + * and Xen. + * + * We use this workaround only for 82540 because qemu's + * e1000 act as 82540. + */ + if (sc->sc_type == WM_T_82540) { + reg |= EECD_SK; + CSR_WRITE(sc, WMREG_EECD, reg); + reg &= ~EECD_SK; + CSR_WRITE(sc, WMREG_EECD, reg); + delay(2); + } + /* XXX: end of workaround */ + /* Set CHIP SELECT. */ reg |= EECD_CS; CSR_WRITE(sc, WMREG_EECD, reg);