cxgbe(4): Add sysctls to display the TP microcode version and the

expansion rom version (if there's one).

trantor:~# sysctl dev.t4nex dev.t5nex | grep _version
dev.t4nex.0.firmware_version: 1.15.28.0
dev.t4nex.0.tp_version: 0.1.9.4
dev.t5nex.0.firmware_version: 1.15.28.0
dev.t5nex.0.exprom_version: 1.0.0.68
dev.t5nex.0.tp_version: 0.1.4.9
This commit is contained in:
Navdeep Parhar 2016-03-11 03:15:17 +00:00
parent 5849e3bbcd
commit 9945ceb857
3 changed files with 29 additions and 1 deletions

View File

@ -803,7 +803,9 @@ struct adapter {
int tracer_valid; /* bitmap of valid tracers */
int tracer_enabled; /* bitmap of enabled tracers */
char fw_version[32];
char fw_version[16];
char tp_version[16];
char exprom_version[16];
char cfg_file[32];
u_int cfcsum;
struct adapter_params params;

View File

@ -290,6 +290,7 @@ struct adapter_params {
unsigned int fw_vers;
unsigned int tp_vers;
unsigned int exprom_vers;
unsigned short mtus[NMTUS];
unsigned short a_wnd[NCCTRL_WIN];

View File

@ -2826,7 +2826,24 @@ prep_firmware(struct adapter *sc)
G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers),
G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers),
G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers));
t4_get_tp_version(sc, &sc->params.tp_vers);
snprintf(sc->tp_version, sizeof(sc->tp_version), "%u.%u.%u.%u",
G_FW_HDR_FW_VER_MAJOR(sc->params.tp_vers),
G_FW_HDR_FW_VER_MINOR(sc->params.tp_vers),
G_FW_HDR_FW_VER_MICRO(sc->params.tp_vers),
G_FW_HDR_FW_VER_BUILD(sc->params.tp_vers));
if (t4_get_exprom_version(sc, &sc->params.exprom_vers) != 0)
sc->params.exprom_vers = 0;
else {
snprintf(sc->exprom_version, sizeof(sc->exprom_version),
"%u.%u.%u.%u",
G_FW_HDR_FW_VER_MAJOR(sc->params.exprom_vers),
G_FW_HDR_FW_VER_MINOR(sc->params.exprom_vers),
G_FW_HDR_FW_VER_MICRO(sc->params.exprom_vers),
G_FW_HDR_FW_VER_BUILD(sc->params.exprom_vers));
}
/* Reset device */
if (need_fw_reset &&
@ -4594,6 +4611,14 @@ t4_sysctls(struct adapter *sc)
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "hw_revision", CTLFLAG_RD,
NULL, chip_rev(sc), "chip hardware revision");
SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "tp_version",
CTLFLAG_RD, sc->tp_version, 0, "TP microcode version");
if (sc->params.exprom_vers != 0) {
SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "exprom_version",
CTLFLAG_RD, sc->exprom_version, 0, "expansion ROM version");
}
SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "firmware_version",
CTLFLAG_RD, sc->fw_version, 0, "firmware version");