git: 835db4182391 - stable/14 - mpi3mr: Add firmware version
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Jan 2024 17:17:39 UTC
The branch stable/14 has been updated by mav:
URL: https://cgit.FreeBSD.org/src/commit/?id=835db41823919e9b025e6867f52cc97b07c67fea
commit 835db41823919e9b025e6867f52cc97b07c67fea
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-11-29 01:50:10 +0000
Commit: Alexander Motin <mav@FreeBSD.org>
CommitDate: 2024-01-19 17:16:50 +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
(cherry picked from commit 28a274342ea0b0666b56704477d2d1c17564942e)
---
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 9bd6417d5345..b54a1844b173 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -1565,6 +1565,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)) {
@@ -1661,6 +1662,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,
@@ -1676,7 +1683,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);
@@ -2220,7 +2227,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:
@@ -2236,9 +2242,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=(");
@@ -2881,7 +2885,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 8d92f8f80e57..3a9612449c63 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -556,8 +556,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");