summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-04-28 17:23:38 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-04-28 17:23:38 +0000
commitee4871152e83b3f080a803a3254075226b9ea6fe (patch)
tree75878023fb8504642efe43c3bdb70b16219eb62e /sys/dev/pci
parent59860fd49c1010ef5cbf75d78b95fe033e4a6aa3 (diff)
validate the firmware version, this driver requires 3.4.xx (3.4.31).
this code is not enabled yet because i need to bootstrap the chipset first.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_nx.c34
-rw-r--r--sys/dev/pci/if_nxreg.h14
2 files changed, 44 insertions, 4 deletions
diff --git a/sys/dev/pci/if_nx.c b/sys/dev/pci/if_nx.c
index f8457947130..fcf17d2718c 100644
--- a/sys/dev/pci/if_nx.c
+++ b/sys/dev/pci/if_nx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nx.c,v 1.18 2007/04/28 16:07:27 reyk Exp $ */
+/* $OpenBSD: if_nx.c,v 1.19 2007/04/28 17:23:36 reyk Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -109,6 +109,9 @@ struct nxb_softc {
int sc_window;
struct nxb_info sc_nxbinfo;
+ u_int32_t sc_fwmajor;
+ u_int32_t sc_fwminor;
+ u_int32_t sc_fwbuild;
u_int32_t sc_nrxbuf;
u_int32_t sc_ntxbuf;
@@ -393,7 +396,8 @@ nxb_query(struct nxb_softc *sc)
for (i = 0; i < len; i++) {
if (nxb_read_rom(sc, addr, data) != 0) {
printf(": failed to get user info from flash\n");
- goto done;
+ free(nu, M_TEMP);
+ return (-1);
}
addr += sizeof(u_int32_t);
data++;
@@ -430,8 +434,32 @@ nxb_query(struct nxb_softc *sc)
#undef _NXBUSER
#endif
- done:
free(nu, M_TEMP);
+
+#ifdef notyet
+ /*
+ * Get and validate the loaded firmware version
+ */
+ sc->sc_fwmajor = nxb_read(sc, NXSW_FW_VERSION_MAJOR);
+ sc->sc_fwminor = nxb_read(sc, NXSW_FW_VERSION_MINOR);
+ sc->sc_fwbuild = nxb_read(sc, NXSW_FW_VERSION_BUILD);
+ printf(", fw%u.%u.%u",
+ sc->sc_fwmajor, sc->sc_fwminor, sc->sc_fwbuild);
+ if (sc->sc_fwmajor != NX_FIRMWARE_MAJOR ||
+ sc->sc_fwminor != NX_FIRMWARE_MINOR) {
+ /*
+ * XXX The driver should load an alternative firmware image
+ * XXX from disk if the firmware image in the flash is not
+ * XXX supported by the driver.
+ */
+ printf(": requires fw%u.%u.xx (%u.%u.%u)\n",
+ NX_FIRMWARE_MAJOR, NX_FIRMWARE_MINOR,
+ NX_FIRMWARE_MAJOR, NX_FIRMWARE_MINOR,
+ NX_FIRMWARE_BUILD);
+ return (-1);
+ }
+#endif
+
return (0);
}
diff --git a/sys/dev/pci/if_nxreg.h b/sys/dev/pci/if_nxreg.h
index 63d78c22c20..a46eb060e4c 100644
--- a/sys/dev/pci/if_nxreg.h
+++ b/sys/dev/pci/if_nxreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nxreg.h,v 1.8 2007/04/28 15:59:05 reyk Exp $ */
+/* $OpenBSD: if_nxreg.h,v 1.9 2007/04/28 17:23:37 reyk Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -34,6 +34,11 @@
#define NX_MAX_MTU ETHER_MTU
#define NX_JUMBO_MTU 8000 /* less than 9k */
+/* This driver supported the 3.4.31 (3.4.xx) NIC firmware */
+#define NX_FIRMWARE_MAJOR 3
+#define NX_FIRMWARE_MINOR 4
+#define NX_FIRMWARE_BUILD 31
+
/*
* Hardware descriptors
*/
@@ -261,11 +266,18 @@ struct nx_statusdesc {
* Software defined registers (used by the firmware or the driver)
*/
+/* Lock ID registers */
#define NXSW_ROM_LOCK_ID NXSW(0x2100) /* Used for locking the ROM */
#define NXSW_ROM_LOCK_DRV 0x0d417340 /* Driver ROM lock ID */
#define NXSW_PHY_LOCK_ID NXSW(0x2120) /* Used for locking the PHY */
#define NXSW_PHY_LOCK_DRV 0x44524956 /* Driver PHY lock ID */
+/* Version registers of the loaded firmware */
+#define NXSW_FW_VERSION_MAJOR NXSW(0x2150) /* Major f/w version */
+#define NXSW_FW_VERSION_MINOR NXSW(0x2154) /* Minor f/w version */
+#define NXSW_FW_VERSION_BUILD NXSW(0x2158) /* Build/Sub f/w version */
+
+/* Misc SW registers */
#define NXSW_CMD_PRODUCER_OFF NXSW(0x2208) /* Producer CMD ring index */
#define NXSW_CMD_CONSUMER_OFF NXSW(0x220c) /* Consumer CMD ring index */
#define NXSW_RCV_PRODUCER_OFF NXSW(0x2218) /* Producer Rx ring index */