Author: slm
Date: Mon May  9 16:21:14 2016
New Revision: 299267
URL: https://svnweb.freebsd.org/changeset/base/299267

Log:
  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

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mpr_user.c

Modified: head/sys/dev/mpr/mpr.c
==============================================================================
--- head/sys/dev/mpr/mpr.c      Mon May  9 16:19:13 2016        (r299266)
+++ head/sys/dev/mpr/mpr.c      Mon May  9 16:21:14 2016        (r299267)
@@ -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];

Modified: head/sys/dev/mpr/mpr_sas.c
==============================================================================
--- head/sys/dev/mpr/mpr_sas.c  Mon May  9 16:19:13 2016        (r299266)
+++ head/sys/dev/mpr/mpr_sas.c  Mon May  9 16:21:14 2016        (r299267)
@@ -372,15 +372,16 @@ mprsas_remove_volume(struct mpr_softc *s
                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 *s
         * 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 *s
                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 
         * 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;

Modified: head/sys/dev/mpr/mpr_user.c
==============================================================================
--- head/sys/dev/mpr/mpr_user.c Mon May  9 16:19:13 2016        (r299266)
+++ head/sys/dev/mpr/mpr_user.c Mon May  9 16:21:14 2016        (r299267)
@@ -1255,12 +1255,14 @@ mpr_post_fw_diag_buffer(struct mpr_softc
         * 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_so
         * 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;
        }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to