git: 28a274342ea0 - main - mpi3mr: Add firmware version
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Nov 2023 01:55:40 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=28a274342ea0b0666b56704477d2d1c17564942e
commit 28a274342ea0b0666b56704477d2d1c17564942e
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-11-29 01:50:10 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-11-29 01:50:10 +0000
mpi3mr: Add firmware version
Publish the firmware version on the card like we do for mps/mpr.
Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D42588
---
sys/dev/mpi3mr/mpi3mr.c | 15 +++++++++------
sys/dev/mpi3mr/mpi3mr.h | 3 +--
sys/dev/mpi3mr/mpi3mr_pci.c | 4 ++++
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 35baa82fe487..5109b970b3bc 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -1564,6 +1564,7 @@ static int mpi3mr_process_factsdata(struct mpi3mr_softc *sc,
{
int retval = 0;
U32 ioc_config, req_sz, facts_flags;
+ struct mpi3mr_compimg_ver *fwver;
if (le16toh(facts_data->IOCFactsDataLength) !=
(sizeof(*facts_data) / 4)) {
@@ -1660,6 +1661,12 @@ static int mpi3mr_process_factsdata(struct mpi3mr_softc *sc,
sc->io_throttle_high = (sc->facts.io_throttle_high * 2 * 1024);
sc->io_throttle_low = (sc->facts.io_throttle_low * 2 * 1024);
+ fwver = &sc->facts.fw_ver;
+ snprintf(sc->fw_version, sizeof(sc->fw_version),
+ "%d.%d.%d.%d.%05d-%05d",
+ fwver->gen_major, fwver->gen_minor, fwver->ph_major,
+ fwver->ph_minor, fwver->cust_id, fwver->build_num);
+
mpi3mr_dprint(sc, MPI3MR_INFO, "ioc_num(%d), maxopQ(%d), maxopRepQ(%d), maxdh(%d),"
"maxreqs(%d), mindh(%d) maxPDs(%d) maxvectors(%d) maxperids(%d)\n",
sc->facts.ioc_num, sc->facts.max_op_req_q,
@@ -1675,7 +1682,7 @@ static int mpi3mr_process_factsdata(struct mpi3mr_softc *sc,
sc->facts.max_dev_per_tg, sc->facts.max_io_throttle_group,
sc->facts.io_throttle_data_length * 4,
sc->facts.io_throttle_high, sc->facts.io_throttle_low);
-
+
sc->max_host_ios = sc->facts.max_reqs -
(MPI3MR_INTERNALCMDS_RESVD + 1);
@@ -2219,7 +2226,6 @@ mpi3mr_display_ioc_info(struct mpi3mr_softc *sc)
{
int i = 0;
char personality[16];
- struct mpi3mr_compimg_ver *fwver = &sc->facts.fw_ver;
switch (sc->facts.personality) {
case MPI3_IOCFACTS_FLAGS_PERSONALITY_EHBA:
@@ -2235,9 +2241,7 @@ mpi3mr_display_ioc_info(struct mpi3mr_softc *sc)
mpi3mr_dprint(sc, MPI3MR_INFO, "Current Personality: %s\n", personality);
- mpi3mr_dprint(sc, MPI3MR_INFO, "FW Version: %d.%d.%d.%d.%05d-%05d\n",
- fwver->gen_major, fwver->gen_minor, fwver->ph_major,
- fwver->ph_minor, fwver->cust_id, fwver->build_num);
+ mpi3mr_dprint(sc, MPI3MR_INFO, "%s\n", sc->fw_version);
mpi3mr_dprint(sc, MPI3MR_INFO, "Protocol=(");
@@ -2880,7 +2884,6 @@ int mpi3mr_initialize_ioc(struct mpi3mr_softc *sc, U8 init_type)
sc->reply_sz = sc->facts.reply_sz;
}
-
mpi3mr_display_ioc_info(sc);
retval = mpi3mr_reply_alloc(sc);
diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h
index 7df31cb15e3f..2af94123c090 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -555,8 +555,7 @@ struct mpi3mr_softc {
uint32_t chain_frame_size;
struct sysctl_ctx_list sysctl_ctx;
struct sysctl_oid *sysctl_tree;
- char fw_version[16];
- char msg_version[8];
+ char fw_version[32];
struct mpi3mr_chain *chains;
struct callout periodic;
struct callout device_check_callout;
diff --git a/sys/dev/mpi3mr/mpi3mr_pci.c b/sys/dev/mpi3mr/mpi3mr_pci.c
index 8a2c101e06c2..d07463366943 100644
--- a/sys/dev/mpi3mr/mpi3mr_pci.c
+++ b/sys/dev/mpi3mr/mpi3mr_pci.c
@@ -145,6 +145,10 @@ mpi3mr_setup_sysctl(struct mpi3mr_softc *sc)
OID_AUTO, "io_cmds_highwater", CTLFLAG_RD,
&sc->io_cmds_highwater, 0, "Max FW outstanding commands");
+ SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
+ OID_AUTO, "firmware_version", CTLFLAG_RD, sc->fw_version,
+ strlen(sc->fw_version), "firmware version");
+
SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
OID_AUTO, "mpi3mr_debug", CTLFLAG_RW, &sc->mpi3mr_debug, 0,
"Driver debug level");