summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2006-11-28 23:00:13 +0000
committerbrad <brad@openbsd.org>2006-11-28 23:00:13 +0000
commitcc0190c3f5eaaaaa2301deb6e1086edc2aa3c65c (patch)
treeaa00116a5f8bd3f323a91a51ec8e47c4a0f3299a
parentbad space; (diff)
downloadwireguard-openbsd-cc0190c3f5eaaaaa2301deb6e1086edc2aa3c65c.tar.xz
wireguard-openbsd-cc0190c3f5eaaaaa2301deb6e1086edc2aa3c65c.zip
identify the chipset.
-rw-r--r--sys/dev/ic/re.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index 847249d25c4..bf106eb7d5e 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.55 2006/11/28 20:04:02 brad Exp $ */
+/* $OpenBSD: re.c,v 1.56 2006/11/28 23:00:13 brad Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -202,6 +202,27 @@ struct cfdriver re_cd = {
CSR_WRITE_1(sc, RL_EECMD, \
CSR_READ_1(sc, RL_EECMD) & ~x)
+static const struct re_revision {
+ u_int32_t re_chipid;
+ const char *re_name;
+} re_revisions[] = {
+ { RL_HWREV_8169, "RTL8169" },
+ { RL_HWREV_8110S, "RTL8110S" },
+ { RL_HWREV_8169S, "RTL8169S" },
+ { RL_HWREV_8169_8110SB, "RTL8169/8110SB" },
+ { RL_HWREV_8169_8110SC, "RTL8169/8110SC" },
+ { RL_HWREV_8168_SPIN1, "RTL8168 1" },
+ { RL_HWREV_8100E, "RTL8100E" },
+ { RL_HWREV_8101E, "RTL8101E" },
+ { RL_HWREV_8168_SPIN2, "RTL8168 2" },
+ { RL_HWREV_8139CPLUS, "RTL8139C+" },
+ { RL_HWREV_8101, "RTL8101" },
+ { RL_HWREV_8100, "RTL8100" },
+
+ { 0, NULL }
+};
+
+
/*
* Send a read command and address to the EEPROM, check for ACK.
*/
@@ -767,6 +788,9 @@ re_attach(struct rl_softc *sc, const char *intrstr)
struct ifnet *ifp;
u_int16_t re_did = 0;
int error = 0, i;
+ u_int32_t hwrev;
+ const struct re_revision *rr;
+ const char *re_name = NULL;
/* Reset the adapter. */
re_reset(sc);
@@ -820,6 +844,17 @@ re_attach(struct rl_softc *sc, const char *intrstr)
bcopy(eaddr, (char *)&sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN);
+ hwrev = CSR_READ_4(sc, RL_TXCFG) & RL_TXCFG_HWREV;
+ for (rr = re_revisions; rr->re_name != NULL; rr++) {
+ if (rr->re_chipid == hwrev)
+ re_name = rr->re_name;
+ }
+
+ if (re_name == NULL)
+ printf(", unknown ASIC (0x%04x)", hwrev >> 16);
+ else
+ printf(", %s (0x%04x)", re_name, hwrev >> 16);
+
printf(": %s, address %s\n", intrstr,
ether_sprintf(sc->sc_arpcom.ac_enaddr));