diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c --- a/sys/dev/mpr/mpr.c +++ b/sys/dev/mpr/mpr.c @@ -1873,7 +1873,7 @@ SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "msg_version", CTLFLAG_RD, sc->msg_version, - strlen(sc->msg_version), "message interface version"); + strlen(sc->msg_version), "message interface version (deprecated)"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "io_cmds_active", CTLFLAG_RD, diff --git a/sys/dev/mpr/mpr_user.c b/sys/dev/mpr/mpr_user.c --- a/sys/dev/mpr/mpr_user.c +++ b/sys/dev/mpr/mpr_user.c @@ -856,7 +856,7 @@ rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; sz = rpl->MsgLength * 4; - if (sz > data->ReplySize) { + if (bootverbose && sz > data->ReplySize) { mpr_printf(sc, "%s: user reply buffer (%d) " "smaller than returned buffer (%d)\n", __func__, data->ReplySize, sz); @@ -1081,7 +1081,7 @@ rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; sz = rpl->MsgLength * 4; - if (sz > data->ReplySize) { + if (bootverbose && sz > data->ReplySize) { mpr_printf(sc, "%s: user reply buffer (%d) smaller " "than returned buffer (%d)\n", __func__, data->ReplySize, sz); diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c --- a/sys/dev/mps/mps.c +++ b/sys/dev/mps/mps.c @@ -1723,7 +1723,7 @@ SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "msg_version", CTLFLAG_RD, sc->msg_version, - strlen(sc->msg_version), "message interface version"); + strlen(sc->msg_version), "message interface version (deprecated)"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "io_cmds_active", CTLFLAG_RD, diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c --- a/sys/dev/mps/mps_user.c +++ b/sys/dev/mps/mps_user.c @@ -855,7 +855,7 @@ rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; sz = rpl->MsgLength * 4; - if (sz > data->ReplySize) { + if (bootverbose && sz > data->ReplySize) { mps_printf(sc, "%s: user reply buffer (%d) " "smaller than returned buffer (%d)\n", __func__, data->ReplySize, sz); @@ -1009,7 +1009,7 @@ rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; sz = rpl->MsgLength * 4; - if (sz > data->ReplySize) { + if (bootverbose && sz > data->ReplySize) { mps_printf(sc, "%s: user reply buffer (%d) smaller " "than returned buffer (%d)\n", __func__, data->ReplySize, sz); diff --git a/usr.sbin/mpsutil/mps_cmd.c b/usr.sbin/mpsutil/mps_cmd.c --- a/usr.sbin/mpsutil/mps_cmd.c +++ b/usr.sbin/mpsutil/mps_cmd.c @@ -723,25 +723,39 @@ return (0); } +/* Return the length in bytes of the device's MPI2_IOC_FACTS reply */ +static size_t +mps_get_ioc_factslen(int fd) +{ + MPI2_IOC_FACTS_REQUEST req; + const size_t factslen = 4; + char factsbuf[4] = {0}; + MPI2_IOC_FACTS_REPLY *facts = (MPI2_IOC_FACTS_REPLY*)factsbuf; + int error; + + bzero(&req, sizeof(req)); + req.Function = MPI2_FUNCTION_IOC_FACTS; + error = mps_pass_command(fd, &req, sizeof(MPI2_IOC_FACTS_REQUEST), + factsbuf, factslen, NULL, 0, NULL, 0, 10); + + if (error) + return (0); + + /* The card's response is measured in dwords */ + return (facts->MsgLength * 4); +} + MPI2_IOC_FACTS_REPLY * mps_get_iocfacts(int fd) { MPI2_IOC_FACTS_REPLY *facts; MPI2_IOC_FACTS_REQUEST req; - char msgver[8], sysctlname[128]; - size_t len, factslen; + size_t factslen; int error; - snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%d.msg_version", - is_mps ? "mps" : "mpr", mps_unit); - - factslen = sizeof(MPI2_IOC_FACTS_REPLY); - len = sizeof(msgver); - error = sysctlbyname(sysctlname, msgver, &len, NULL, 0); - if (error == 0) { - if (strncmp(msgver, "2.6", sizeof(msgver)) == 0) - factslen += 4; - } + factslen = mps_get_ioc_factslen(fd); + if (factslen == 0) + return (NULL); facts = malloc(factslen); if (facts == NULL) { @@ -749,7 +763,7 @@ return (NULL); } - bzero(&req, factslen); + bzero(&req, sizeof(req)); req.Function = MPI2_FUNCTION_IOC_FACTS; #if 1