No log bit in IOCStatus and endian-safe changes.

Use MPI2_IOCSTATUS_MASK when checking IOCStatus to mask off the log bit, and
make a few more things endian-safe.

Reviewed by:    ken, scottl, ambrisko, asomers
Approved by:	ken, scottl, ambrisko
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D6097
This commit is contained in:
slm 2016-05-09 16:21:14 +00:00
parent 1f91a62e29
commit 24842df2a6
3 changed files with 22 additions and 14 deletions

View File

@ -1942,9 +1942,10 @@ mpr_intr_locked(void *data)
*/
rel_rep =
(MPI2_DIAG_RELEASE_REPLY *)reply;
if (le16toh(rel_rep->IOCStatus) ==
if ((le16toh(rel_rep->IOCStatus) &
MPI2_IOCSTATUS_MASK) ==
MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED)
{
{
pBuffer =
&sc->fw_diag_buffer_list[
rel_rep->BufferType];

View File

@ -372,15 +372,16 @@ mprsas_remove_volume(struct mpr_softc *sc, struct mpr_command *tm)
return;
}
if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) {
if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) !=
MPI2_IOCSTATUS_SUCCESS) {
mpr_dprint(sc, MPR_FAULT, "IOCStatus = 0x%x while resetting "
"device 0x%x\n", reply->IOCStatus, handle);
"device 0x%x\n", le16toh(reply->IOCStatus), handle);
mprsas_free_tm(sc, tm);
return;
}
mpr_dprint(sc, MPR_XINFO, "Reset aborted %u commands\n",
reply->TerminationCount);
le32toh(reply->TerminationCount));
mpr_free_reply(sc, tm->cm_reply_data);
tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */
@ -393,7 +394,8 @@ mprsas_remove_volume(struct mpr_softc *sc, struct mpr_command *tm)
* this target id if possible, and so we can assign the same target id
* to this device if it comes back in the future.
*/
if (reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) {
if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) ==
MPI2_IOCSTATUS_SUCCESS) {
targ = tm->cm_targ;
targ->handle = 0x0;
targ->encl_handle = 0x0;
@ -573,7 +575,8 @@ mprsas_remove_device(struct mpr_softc *sc, struct mpr_command *tm)
return;
}
if (le16toh(reply->IOCStatus) != MPI2_IOCSTATUS_SUCCESS) {
if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) !=
MPI2_IOCSTATUS_SUCCESS) {
mpr_dprint(sc, MPR_FAULT, "IOCStatus = 0x%x while resetting "
"device 0x%x\n", le16toh(reply->IOCStatus), handle);
mprsas_free_tm(sc, tm);
@ -658,7 +661,8 @@ mprsas_remove_complete(struct mpr_softc *sc, struct mpr_command *tm)
* this target id if possible, and so we can assign the same target id
* to this device if it comes back in the future.
*/
if (le16toh(reply->IOCStatus) == MPI2_IOCSTATUS_SUCCESS) {
if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) ==
MPI2_IOCSTATUS_SUCCESS) {
targ = tm->cm_targ;
targ->handle = 0x0;
targ->encl_handle = 0x0;

View File

@ -1255,12 +1255,14 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc,
* Process POST reply.
*/
reply = (MPI2_DIAG_BUFFER_POST_REPLY *)cm->cm_reply;
if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) {
if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) !=
MPI2_IOCSTATUS_SUCCESS) {
status = MPR_DIAG_FAILURE;
mpr_dprint(sc, MPR_FAULT, "%s: post of FW Diag Buffer failed "
"with IOCStatus = 0x%x, IOCLogInfo = 0x%x and "
"TransferLength = 0x%x\n", __func__, reply->IOCStatus,
reply->IOCLogInfo, reply->TransferLength);
"TransferLength = 0x%x\n", __func__,
le16toh(reply->IOCStatus), le32toh(reply->IOCLogInfo),
le32toh(reply->TransferLength));
goto done;
}
@ -1339,12 +1341,13 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc,
* Process RELEASE reply.
*/
reply = (MPI2_DIAG_RELEASE_REPLY *)cm->cm_reply;
if ((reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) ||
pBuffer->owned_by_firmware) {
if (((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) !=
MPI2_IOCSTATUS_SUCCESS) || pBuffer->owned_by_firmware) {
status = MPR_DIAG_FAILURE;
mpr_dprint(sc, MPR_FAULT, "%s: release of FW Diag Buffer "
"failed with IOCStatus = 0x%x and IOCLogInfo = 0x%x\n",
__func__, reply->IOCStatus, reply->IOCLogInfo);
__func__, le16toh(reply->IOCStatus),
le32toh(reply->IOCLogInfo));
goto done;
}