summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/if_em.c
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2010-08-08 12:53:16 +0000
committerkettenis <kettenis@openbsd.org>2010-08-08 12:53:16 +0000
commit4a2c59f8211499fff279a8b3625895c59bd13c9d (patch)
treed4dd470e12dcb79a18370cf52643d448ff6252b2 /sys/dev/pci/if_em.c
parentcpu -> CPU; (diff)
downloadwireguard-openbsd-4a2c59f8211499fff279a8b3625895c59bd13c9d.tar.xz
wireguard-openbsd-4a2c59f8211499fff279a8b3625895c59bd13c9d.zip
Make sure hw.revision_id gets initialized before it's used by em_set_mac_type()
and move it back to the location where it was before rev. 1.239, while keeping the horrible override for em_pchlan. From Holger Mikolon. ok jsg@, deraadt@
Diffstat (limited to 'sys/dev/pci/if_em.c')
-rw-r--r--sys/dev/pci/if_em.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index 5e58cef0277..eb14257cd78 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_em.c,v 1.243 2010/08/04 17:10:34 jsg Exp $ */
+/* $OpenBSD: if_em.c,v 1.244 2010/08/08 12:53:16 kettenis Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -1535,6 +1535,9 @@ em_identify_hardware(struct em_softc *sc)
sc->hw.vendor_id = PCI_VENDOR(pa->pa_id);
sc->hw.device_id = PCI_PRODUCT(pa->pa_id);
+ reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_CLASS_REG);
+ sc->hw.revision_id = PCI_REVISION(reg);
+
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
sc->hw.subsystem_vendor_id = PCI_VENDOR(reg);
sc->hw.subsystem_id = PCI_PRODUCT(reg);
@@ -1545,10 +1548,6 @@ em_identify_hardware(struct em_softc *sc)
if (sc->hw.mac_type == em_pchlan)
sc->hw.revision_id = PCI_PRODUCT(pa->pa_id) & 0x0f;
- else {
- reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_CLASS_REG);
- sc->hw.revision_id = PCI_REVISION(reg);
- }
if (sc->hw.mac_type == em_82541 ||
sc->hw.mac_type == em_82541_rev_2 ||