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

Log:
  Several style changes and add copyrights for 2016.
  
  Reviewed by:    ken, scottl, ambrisko, asomers
  Approved by:  ken, scottl, ambrisko
  MFC after:      1 week
  Differential Revision: https://reviews.freebsd.org/D6103

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_config.c
  head/sys/dev/mpr/mpr_ioctl.h
  head/sys/dev/mpr/mpr_mapping.c
  head/sys/dev/mpr/mpr_mapping.h
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mpr_sas.h
  head/sys/dev/mpr/mpr_sas_lsi.c
  head/sys/dev/mpr/mpr_table.c
  head/sys/dev/mpr/mpr_user.c
  head/sys/dev/mpr/mprvar.h

Modified: head/sys/dev/mpr/mpr.c
==============================================================================
--- head/sys/dev/mpr/mpr.c      Mon May  9 16:15:52 2016        (r299264)
+++ head/sys/dev/mpr/mpr.c      Mon May  9 16:16:00 2016        (r299265)
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 2009 Yahoo! Inc.
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -92,14 +92,11 @@ static __inline void mpr_complete_comman
     struct mpr_command *cm);
 static void mpr_dispatch_event(struct mpr_softc *sc, uintptr_t data,
     MPI2_EVENT_NOTIFICATION_REPLY *reply);
-static void mpr_config_complete(struct mpr_softc *sc,
-    struct mpr_command *cm);
+static void mpr_config_complete(struct mpr_softc *sc, struct mpr_command *cm);
 static void mpr_periodic(void *);
 static int mpr_reregister_events(struct mpr_softc *sc);
-static void mpr_enqueue_request(struct mpr_softc *sc,
-    struct mpr_command *cm);
-static int mpr_get_iocfacts(struct mpr_softc *sc,
-    MPI2_IOC_FACTS_REPLY *facts);
+static void mpr_enqueue_request(struct mpr_softc *sc, struct mpr_command *cm);
+static int mpr_get_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts);
 static int mpr_wait_db_ack(struct mpr_softc *sc, int timeout, int sleep_flag);
 SYSCTL_NODE(_hw, OID_AUTO, mpr, CTLFLAG_RD, 0, "MPR Driver Parameters");
 
@@ -550,8 +547,8 @@ mpr_iocfacts_allocate(struct mpr_softc *
        error = mpr_transition_operational(sc);
        if (error != 0) {
                if (attaching) {
-                       mpr_printf(sc, "%s failed to transition to "
-                           "operational with error %d\n", __func__, error);
+                       mpr_printf(sc, "%s failed to transition to operational "
+                           "with error %d\n", __func__, error);
                        mpr_free(sc);
                        return (error);
                } else {
@@ -685,7 +682,7 @@ mpr_reinit(struct mpr_softc *sc)
 
        if (sc->mpr_flags & MPR_FLAGS_DIAGRESET) {
                mpr_dprint(sc, MPR_INIT, "%s reset already in progress\n",
-                          __func__);
+                   __func__);
                return 0;
        }
 
@@ -1712,9 +1709,9 @@ mpr_complete_command(struct mpr_softc *s
 
        if (cm->cm_complete != NULL) {
                mpr_dprint(sc, MPR_TRACE,
-                          "%s cm %p calling cm_complete %p data %p reply %p\n",
-                          __func__, cm, cm->cm_complete, cm->cm_complete_data,
-                          cm->cm_reply);
+                   "%s cm %p calling cm_complete %p data %p reply %p\n",
+                   __func__, cm, cm->cm_complete, cm->cm_complete_data,
+                   cm->cm_reply);
                cm->cm_complete(sc, cm);
        }
 
@@ -1772,9 +1769,8 @@ mpr_sas_log_info(struct mpr_softc *sc , 
        }
  
        mpr_dprint(sc, MPR_INFO, "log_info(0x%08x): originator(%s), "
-           "code(0x%02x), sub_code(0x%04x)\n", log_info,
-           originator_str, sas_loginfo.dw.code,
-           sas_loginfo.dw.subcode);
+           "code(0x%02x), sub_code(0x%04x)\n", log_info, originator_str,
+           sas_loginfo.dw.code, sas_loginfo.dw.subcode);
 }
 
 static void
@@ -2463,10 +2459,9 @@ mpr_data_cb(void *arg, bus_dma_segment_t
         * user they did the wrong thing.
         */
        if ((cm->cm_max_segs != 0) && (nsegs > cm->cm_max_segs)) {
-               mpr_dprint(sc, MPR_ERROR,
-                          "%s: warning: busdma returned %d segments, "
-                          "more than the %d allowed\n", __func__, nsegs,
-                          cm->cm_max_segs);
+               mpr_dprint(sc, MPR_ERROR, "%s: warning: busdma returned %d "
+                   "segments, more than the %d allowed\n", __func__, nsegs,
+                   cm->cm_max_segs);
        }
 
        /*
@@ -2663,8 +2658,8 @@ mpr_request_polled(struct mpr_softc *sc,
        if (error) {
                mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s\n", __func__);
                rc = mpr_reinit(sc);
-               mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ?
-                   "success" : "failed");
+               mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" :
+                   "failed");
        }
        return (error);
 }

Modified: head/sys/dev/mpr/mpr_config.c
==============================================================================
--- head/sys/dev/mpr/mpr_config.c       Mon May  9 16:15:52 2016        
(r299264)
+++ head/sys/dev/mpr/mpr_config.c       Mon May  9 16:16:00 2016        
(r299265)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/mpr/mpr_ioctl.h
==============================================================================
--- head/sys/dev/mpr/mpr_ioctl.h        Mon May  9 16:15:52 2016        
(r299264)
+++ head/sys/dev/mpr/mpr_ioctl.h        Mon May  9 16:16:00 2016        
(r299265)
@@ -33,7 +33,7 @@
  */
 /*-
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/mpr/mpr_mapping.c
==============================================================================
--- head/sys/dev/mpr/mpr_mapping.c      Mon May  9 16:15:52 2016        
(r299264)
+++ head/sys/dev/mpr/mpr_mapping.c      Mon May  9 16:16:00 2016        
(r299265)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/mpr/mpr_mapping.h
==============================================================================
--- head/sys/dev/mpr/mpr_mapping.h      Mon May  9 16:15:52 2016        
(r299264)
+++ head/sys/dev/mpr/mpr_mapping.h      Mon May  9 16:16:00 2016        
(r299265)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/mpr/mpr_sas.c
==============================================================================
--- head/sys/dev/mpr/mpr_sas.c  Mon May  9 16:15:52 2016        (r299264)
+++ head/sys/dev/mpr/mpr_sas.c  Mon May  9 16:16:00 2016        (r299265)
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 2009 Yahoo! Inc.
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -119,13 +119,11 @@ static void mprsas_remove_complete(struc
 static void mprsas_action(struct cam_sim *sim, union ccb *ccb);
 static void mprsas_poll(struct cam_sim *sim);
 static void mprsas_scsiio_timeout(void *data);
-static void mprsas_abort_complete(struct mpr_softc *sc,
-    struct mpr_command *cm);
+static void mprsas_abort_complete(struct mpr_softc *sc, struct mpr_command 
*cm);
 static void mprsas_action_scsiio(struct mprsas_softc *, union ccb *);
 static void mprsas_scsiio_complete(struct mpr_softc *, struct mpr_command *);
 static void mprsas_action_resetdev(struct mprsas_softc *, union ccb *);
-static void mprsas_resetdev_complete(struct mpr_softc *,
-    struct mpr_command *);
+static void mprsas_resetdev_complete(struct mpr_softc *, struct mpr_command *);
 static int mprsas_send_abort(struct mpr_softc *sc, struct mpr_command *tm,
     struct mpr_command *cm);
 static void mprsas_async(void *callback_arg, uint32_t code,
@@ -142,10 +140,9 @@ static void mprsas_portenable_complete(s
     struct mpr_command *cm);
 
 #if __FreeBSD_version >= 900026
-static void mprsas_smpio_complete(struct mpr_softc *sc,
-    struct mpr_command *cm);
-static void mprsas_send_smpcmd(struct mprsas_softc *sassc,
-    union ccb *ccb, uint64_t sasaddr);
+static void mprsas_smpio_complete(struct mpr_softc *sc, struct mpr_command 
*cm);
+static void mprsas_send_smpcmd(struct mprsas_softc *sassc, union ccb *ccb,
+    uint64_t sasaddr);
 static void mprsas_action_smpio(struct mprsas_softc *sassc, union ccb *ccb);
 #endif //FreeBSD_version >= 900026
 
@@ -1065,15 +1062,15 @@ mprsas_action(struct cam_sim *sim, union
                mprsas_set_ccbstatus(ccb, CAM_REQ_CMP);
                break;
        case XPT_RESET_DEV:
-               mpr_dprint(sassc->sc, MPR_XINFO,
-                   "mprsas_action XPT_RESET_DEV\n");
+               mpr_dprint(sassc->sc, MPR_XINFO, "mprsas_action "
+                   "XPT_RESET_DEV\n");
                mprsas_action_resetdev(sassc, ccb);
                return;
        case XPT_RESET_BUS:
        case XPT_ABORT:
        case XPT_TERM_IO:
-               mpr_dprint(sassc->sc, MPR_XINFO,
-                   "mprsas_action faking success for abort or reset\n");
+               mpr_dprint(sassc->sc, MPR_XINFO, "mprsas_action faking success "
+                   "for abort or reset\n");
                mprsas_set_ccbstatus(ccb, CAM_REQ_CMP);
                break;
        case XPT_SCSI_IO:
@@ -1134,8 +1131,8 @@ mprsas_complete_all_commands(struct mpr_
 
                if (cm->cm_complete != NULL) {
                        mprsas_log_command(cm, MPR_RECOVERY,
-                           "completing cm %p state %x ccb %p for diag "
-                           "reset\n", cm, cm->cm_state, cm->cm_ccb);
+                           "completing cm %p state %x ccb %p for diag reset\n",
+                           cm, cm->cm_state, cm->cm_ccb);
                        cm->cm_complete(sc, cm);
                        completed = 1;
                }
@@ -1216,14 +1213,13 @@ mprsas_tm_timeout(void *data)
 
        mtx_assert(&sc->mpr_mtx, MA_OWNED);
 
-       mprsas_log_command(tm, MPR_INFO|MPR_RECOVERY,
-           "task mgmt %p timed out\n", tm);
+       mprsas_log_command(tm, MPR_INFO|MPR_RECOVERY, "task mgmt %p timed "
+           "out\n", tm);
        mpr_reinit(sc);
 }
 
 static void
-mprsas_logical_unit_reset_complete(struct mpr_softc *sc,
-    struct mpr_command *tm)
+mprsas_logical_unit_reset_complete(struct mpr_softc *sc, struct mpr_command 
*tm)
 {
        MPI2_SCSI_TASK_MANAGE_REPLY *reply;
        MPI2_SCSI_TASK_MANAGE_REQUEST *req;
@@ -1250,8 +1246,8 @@ mprsas_logical_unit_reset_complete(struc
        }
 
        if (reply == NULL) {
-               mprsas_log_command(tm, MPR_RECOVERY,
-                   "NULL reset reply for tm %p\n", tm);
+               mprsas_log_command(tm, MPR_RECOVERY, "NULL reset reply for tm "
+                   "%p\n", tm);
                if ((sc->mpr_flags & MPR_FLAGS_DIAGRESET) != 0) {
                        /* this completion was due to a reset, just cleanup */
                        targ->tm = NULL;
@@ -1338,8 +1334,8 @@ mprsas_target_reset_complete(struct mpr_
        }
 
        if (reply == NULL) {
-               mprsas_log_command(tm, MPR_RECOVERY,
-                   "NULL reset reply for tm %p\n", tm);
+               mprsas_log_command(tm, MPR_RECOVERY, "NULL reset reply for tm "
+                   "%p\n", tm);
                if ((sc->mpr_flags & MPR_FLAGS_DIAGRESET) != 0) {
                        /* this completion was due to a reset, just cleanup */
                        targ->tm = NULL;
@@ -1626,9 +1622,8 @@ mprsas_scsiio_timeout(void *data)
        targ = cm->cm_targ;
        targ->timeouts++;
 
-       mprsas_log_command(cm, MPR_ERROR, "command timeout cm %p ccb %p "
-           "target %u, handle(0x%04x)\n", cm, cm->cm_ccb, targ->tid,
-           targ->handle);
+       mprsas_log_command(cm, MPR_ERROR, "command timeout cm %p ccb %p target "
+           "%u, handle(0x%04x)\n", cm, cm->cm_ccb, targ->tid, targ->handle);
        if (targ->encl_level_valid) {
                mpr_dprint(sc, MPR_ERROR, "At enclosure level %d, slot %d, "
                    "connector name (%4s)\n", targ->encl_level, targ->encl_slot,
@@ -1666,8 +1661,8 @@ mprsas_scsiio_timeout(void *data)
                 * more credits than disks in an enclosure, and limit
                 * ourselves to one TM per target for recovery.
                 */
-               mpr_dprint(sc, MPR_RECOVERY,
-                   "timedout cm %p failed to allocate a tm\n", cm);
+               mpr_dprint(sc, MPR_RECOVERY, "timedout cm %p failed to "
+                   "allocate a tm\n", cm);
        }
 }
 
@@ -2587,8 +2582,7 @@ bailout:
 }
 
 static void
-mprsas_send_smpcmd(struct mprsas_softc *sassc, union ccb *ccb,
-    uint64_t sasaddr)
+mprsas_send_smpcmd(struct mprsas_softc *sassc, union ccb *ccb, uint64_t 
sasaddr)
 {
        struct mpr_command *cm;
        uint8_t *request, *response;
@@ -2621,9 +2615,9 @@ mprsas_send_smpcmd(struct mprsas_softc *
                 */
                if ((ccb->smpio.smp_request_sglist_cnt > 1)
                    || (ccb->smpio.smp_response_sglist_cnt > 1)) {
-                       mpr_dprint(sc, MPR_ERROR,
-                           "%s: multiple request or response buffer segments "
-                           "not supported for SMP\n", __func__);
+                       mpr_dprint(sc, MPR_ERROR, "%s: multiple request or "
+                           "response buffer segments not supported for SMP\n",
+                           __func__);
                        mprsas_set_ccbstatus(ccb, CAM_REQ_INVALID);
                        xpt_done(ccb);
                        return;
@@ -2724,8 +2718,8 @@ mprsas_send_smpcmd(struct mprsas_softc *
 
        cm = mpr_alloc_command(sc);
        if (cm == NULL) {
-               mpr_dprint(sc, MPR_ERROR,
-                   "%s: cannot allocate command\n", __func__);
+               mpr_dprint(sc, MPR_ERROR, "%s: cannot allocate command\n",
+                   __func__);
                mprsas_set_ccbstatus(ccb, CAM_RESRC_UNAVAIL);
                xpt_done(ccb);
                return;
@@ -2958,14 +2952,13 @@ mprsas_action_resetdev(struct mprsas_sof
        MPR_FUNCTRACE(sassc->sc);
        mtx_assert(&sassc->sc->mpr_mtx, MA_OWNED);
 
-       KASSERT(ccb->ccb_h.target_id < sassc->maxtargets,
-           ("Target %d out of bounds in XPT_RESET_DEV\n",
-           ccb->ccb_h.target_id));
+       KASSERT(ccb->ccb_h.target_id < sassc->maxtargets, ("Target %d out of "
+           "bounds in XPT_RESET_DEV\n", ccb->ccb_h.target_id));
        sc = sassc->sc;
        tm = mpr_alloc_command(sc);
        if (tm == NULL) {
-               mpr_dprint(sc, MPR_ERROR,
-                   "command alloc failure in mprsas_action_resetdev\n");
+               mpr_dprint(sc, MPR_ERROR, "command alloc failure in "
+                   "mprsas_action_resetdev\n");
                mprsas_set_ccbstatus(ccb, CAM_RESRC_UNAVAIL);
                xpt_done(ccb);
                return;
@@ -3023,9 +3016,8 @@ mprsas_resetdev_complete(struct mpr_soft
                goto bailout;
        }
 
-       mpr_dprint(sc, MPR_XINFO,
-           "%s: IOCStatus = 0x%x ResponseCode = 0x%x\n", __func__,
-           le16toh(resp->IOCStatus), le32toh(resp->ResponseCode));
+       mpr_dprint(sc, MPR_XINFO, "%s: IOCStatus = 0x%x ResponseCode = 0x%x\n",
+           __func__, le16toh(resp->IOCStatus), le32toh(resp->ResponseCode));
 
        if (le32toh(resp->ResponseCode) == MPI2_SCSITASKMGMT_RSP_TM_COMPLETE) {
                mprsas_set_ccbstatus(ccb, CAM_REQ_CMP);
@@ -3214,8 +3206,8 @@ mprsas_check_eedp(struct mpr_softc *sc, 
        targetid = xpt_path_target_id(path);
        lunid = xpt_path_lun_id(path);
 
-       KASSERT(targetid < sassc->maxtargets,
-           ("Target %d out of bounds in mprsas_check_eedp\n", targetid));
+       KASSERT(targetid < sassc->maxtargets, ("Target %d out of bounds in "
+           "mprsas_check_eedp\n", targetid));
        target = &sassc->targets[targetid];
        if (target->handle == 0x0)
                return;
@@ -3225,7 +3217,7 @@ mprsas_check_eedp(struct mpr_softc *sc, 
         *
         * If this flag is set in the inquiry data, the device supports
         * protection information, and must support the 16 byte read capacity
-        * command, otherwise continue without sending read cap 16
+        * command, otherwise continue without sending read cap 16.
         */
        if ((cgd->inq_data.spc3_flags & SPC3_SID_PROTECT) == 0)
                return;
@@ -3241,10 +3233,10 @@ mprsas_check_eedp(struct mpr_softc *sc, 
                return;
        }
 
-       if (xpt_create_path(&local_path, xpt_periph, pathid, targetid, lunid)
-           != CAM_REQ_CMP) {
+       if (xpt_create_path(&local_path, xpt_periph, pathid, targetid, lunid) !=
+           CAM_REQ_CMP) {
                mpr_dprint(sc, MPR_ERROR, "Unable to create path for EEDP "
-                   "support\n");
+                   "support.\n");
                xpt_free_ccb(ccb);
                return;
        }
@@ -3346,9 +3338,8 @@ mprsas_read_cap_done(struct cam_periph *
         * target.
         */
        sassc = (struct mprsas_softc *)done_ccb->ccb_h.ppriv_ptr1;
-       KASSERT(done_ccb->ccb_h.target_id < sassc->maxtargets,
-           ("Target %d out of bounds in mprsas_read_cap_done\n",
-           done_ccb->ccb_h.target_id));
+       KASSERT(done_ccb->ccb_h.target_id < sassc->maxtargets, ("Target %d out "
+           "of bounds in mprsas_read_cap_done\n", done_ccb->ccb_h.target_id));
        target = &sassc->targets[done_ccb->ccb_h.target_id];
        SLIST_FOREACH(lun, &target->luns, lun_link) {
                if (lun->lun_id != done_ccb->ccb_h.target_lun)

Modified: head/sys/dev/mpr/mpr_sas.h
==============================================================================
--- head/sys/dev/mpr/mpr_sas.h  Mon May  9 16:15:52 2016        (r299264)
+++ head/sys/dev/mpr/mpr_sas.h  Mon May  9 16:16:00 2016        (r299265)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/mpr/mpr_sas_lsi.c
==============================================================================
--- head/sys/dev/mpr/mpr_sas_lsi.c      Mon May  9 16:15:52 2016        
(r299264)
+++ head/sys/dev/mpr/mpr_sas_lsi.c      Mon May  9 16:16:00 2016        
(r299265)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-/* Communications core for LSI MPT3 */
+/* Communications core for Avago Technologies (LSI) MPT3 */
 
 /* TODO Move headers to mprvar */
 #include <sys/types.h>
@@ -252,8 +252,7 @@ mprsas_fw_work(struct mpr_softc *sc, str
                data = (MPI2_EVENT_DATA_SAS_DISCOVERY *)fw_event->event_data;
 
                if (data->ReasonCode & MPI2_EVENT_SAS_DISC_RC_STARTED)
-                       mpr_dprint(sc, MPR_TRACE,"SAS discovery start "
-                           "event\n");
+                       mpr_dprint(sc, MPR_TRACE,"SAS discovery start event\n");
                if (data->ReasonCode & MPI2_EVENT_SAS_DISC_RC_COMPLETED) {
                        mpr_dprint(sc, MPR_TRACE,"SAS discovery stop event\n");
                        sassc->flags &= ~MPRSAS_IN_DISCOVERY;
@@ -839,8 +838,8 @@ mprsas_add_device(struct mpr_softc *sc, 
                                    MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET);
                        } else {
                                mpr_dprint(sc, MPR_ERROR, "Failed to allocate "
-                                   "tm for Target Reset after SATA ID "
-                                   "command timed out (cm %p)\n", cm);
+                                   "tm for Target Reset after SATA ID command "
+                                   "timed out (cm %p)\n", cm);
                        }
                        /*
                         * No need to check for more since the target is
@@ -901,9 +900,8 @@ mprsas_get_sas_address_for_sata_disk(str
                        }
                }
        } while (((rc && (rc != EWOULDBLOCK)) ||
-                (ioc_status &&
-                 (ioc_status != MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR))
-              || sas_status) && (try_count < 5));
+           (ioc_status && (ioc_status != MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR))
+           || sas_status) && (try_count < 5));
 
        if (rc == 0 && !ioc_status && !sas_status) {
                mpr_dprint(sc, MPR_MAPPING, "%s: got SATA identify "
@@ -1059,8 +1057,8 @@ mprsas_ata_id_timeout(void *data)
            __func__, cm, sc);
        if ((callout_pending(&cm->cm_callout)) ||
            (!callout_active(&cm->cm_callout))) {
-               mpr_dprint(sc, MPR_INFO, "%s ATA ID command almost timed "
-                   "out\n", __func__);
+               mpr_dprint(sc, MPR_INFO, "%s ATA ID command almost timed out\n",
+                   __func__);
                return;
        }
        callout_deactivate(&cm->cm_callout);
@@ -1072,21 +1070,21 @@ mprsas_ata_id_timeout(void *data)
         */
        mpr_intr_locked(sc);
        if (cm->cm_state == MPR_CM_STATE_FREE) {
-               mpr_dprint(sc, MPR_INFO, "%s ATA ID command almost timed "
-                   "out\n", __func__);
+               mpr_dprint(sc, MPR_INFO, "%s ATA ID command almost timed out\n",
+                   __func__);
                return;
        }
 
        mpr_dprint(sc, MPR_INFO, "ATA ID command timeout cm %p\n", cm);
 
        /*
-        * Send wakeup() to the sleeping thread that issued this ATA ID
-        * command. wakeup() will cause msleep to return a 0 (not EWOULDBLOCK),
-        * and this will keep reinit() from being called. This way, an Abort
-        * Task TM can be issued so that the timed out command can be cleared.
-        * The Abort Task cannot be sent from here because the driver has not
-        * completed setting up targets.  Instead, the command is flagged so
-        * that special handling will be used to send the abort.
+        * Send wakeup() to the sleeping thread that issued this ATA ID command.
+        * wakeup() will cause msleep to return a 0 (not EWOULDBLOCK), and this
+        * will keep reinit() from being called. This way, an Abort Task TM can
+        * be issued so that the timed out command can be cleared. The Abort
+        * Task cannot be sent from here because the driver has not completed
+        * setting up targets.  Instead, the command is flagged so that special
+        * handling will be used to send the abort.
         */
        cm->cm_flags |= MPR_CM_FLAGS_SATA_ID_TIMEOUT;
        wakeup(cm);

Modified: head/sys/dev/mpr/mpr_table.c
==============================================================================
--- head/sys/dev/mpr/mpr_table.c        Mon May  9 16:15:52 2016        
(r299264)
+++ head/sys/dev/mpr/mpr_table.c        Mon May  9 16:16:00 2016        
(r299265)
@@ -342,9 +342,8 @@ mpr_print_evt_sas(struct mpr_softc *sc, 
                            "PHY[%d].LinkRate: %s (0x%x)\n", phynum,
                            mpr_describe_table(mpr_linkrate_names,
                            (phy->LinkRate >> 4) & 0xf), phy->LinkRate);
-                       mpr_dprint_field(sc,MPR_EVENT,"PHY[%d].PhyStatus: "
-                           "%s\n", phynum,
-                           mpr_describe_table(mpr_phystatus_names,
+                       mpr_dprint_field(sc,MPR_EVENT,"PHY[%d].PhyStatus: %s\n",
+                           phynum, mpr_describe_table(mpr_phystatus_names,
                            phy->PhyStatus));
                }
                break;

Modified: head/sys/dev/mpr/mpr_user.c
==============================================================================
--- head/sys/dev/mpr/mpr_user.c Mon May  9 16:15:52 2016        (r299264)
+++ head/sys/dev/mpr/mpr_user.c Mon May  9 16:16:00 2016        (r299265)
@@ -31,7 +31,7 @@
  */
 /*-
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -130,24 +130,23 @@ static mpr_user_f mpi_pre_config;
 static mpr_user_f      mpi_pre_sas_io_unit_control;
 
 static int mpr_user_read_cfg_header(struct mpr_softc *,
-                                   struct mpr_cfg_page_req *);
+    struct mpr_cfg_page_req *);
 static int mpr_user_read_cfg_page(struct mpr_softc *,
-                                 struct mpr_cfg_page_req *, void *);
+    struct mpr_cfg_page_req *, void *);
 static int mpr_user_read_extcfg_header(struct mpr_softc *,
-                                    struct mpr_ext_cfg_page_req *);
+    struct mpr_ext_cfg_page_req *);
 static int mpr_user_read_extcfg_page(struct mpr_softc *,
-                                    struct mpr_ext_cfg_page_req *, void *);
+    struct mpr_ext_cfg_page_req *, void *);
 static int mpr_user_write_cfg_page(struct mpr_softc *,
-                                  struct mpr_cfg_page_req *, void *);
+    struct mpr_cfg_page_req *, void *);
 static int mpr_user_setup_request(struct mpr_command *,
-                                 struct mpr_usr_command *);
+    struct mpr_usr_command *);
 static int mpr_user_command(struct mpr_softc *, struct mpr_usr_command *);
 
 static int mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru_t *data);
 static void mpr_user_get_adapter_data(struct mpr_softc *sc,
     mpr_adapter_data_t *data);
-static void mpr_user_read_pci_info(struct mpr_softc *sc,
-    mpr_pci_info_t *data);
+static void mpr_user_read_pci_info(struct mpr_softc *sc, mpr_pci_info_t *data);
 static uint8_t mpr_get_fw_diag_buffer_number(struct mpr_softc *sc,
     uint32_t unique_id);
 static int mpr_post_fw_diag_buffer(struct mpr_softc *sc,
@@ -159,8 +158,8 @@ static int mpr_diag_register(struct mpr_
     mpr_fw_diag_register_t *diag_register, uint32_t *return_code);
 static int mpr_diag_unregister(struct mpr_softc *sc,
     mpr_fw_diag_unregister_t *diag_unregister, uint32_t *return_code);
-static int mpr_diag_query(struct mpr_softc *sc,
-    mpr_fw_diag_query_t *diag_query, uint32_t *return_code);
+static int mpr_diag_query(struct mpr_softc *sc, mpr_fw_diag_query_t 
*diag_query,
+    uint32_t *return_code);
 static int mpr_diag_read_buffer(struct mpr_softc *sc,
     mpr_diag_read_buffer_t *diag_read_buffer, uint8_t *ioctl_buf,
     uint32_t *return_code);
@@ -168,10 +167,8 @@ static int mpr_diag_release(struct mpr_s
     mpr_fw_diag_release_t *diag_release, uint32_t *return_code);
 static int mpr_do_diag_action(struct mpr_softc *sc, uint32_t action,
     uint8_t *diag_action, uint32_t length, uint32_t *return_code);
-static int mpr_user_diag_action(struct mpr_softc *sc,
-    mpr_diag_action_t *data);
-static void mpr_user_event_query(struct mpr_softc *sc,
-    mpr_event_query_t *data);
+static int mpr_user_diag_action(struct mpr_softc *sc, mpr_diag_action_t *data);
+static void mpr_user_event_query(struct mpr_softc *sc, mpr_event_query_t 
*data);
 static void mpr_user_event_enable(struct mpr_softc *sc,
     mpr_event_enable_t *data);
 static int mpr_user_event_report(struct mpr_softc *sc,
@@ -212,11 +209,12 @@ mpr_attach_user(struct mpr_softc *sc)
        int unit;
 
        unit = device_get_unit(sc->mpr_dev);
-       sc->mpr_cdev = make_dev(&mpr_cdevsw, unit, UID_ROOT, GID_OPERATOR,
-           0640, "mpr%d", unit);
-       if (sc->mpr_cdev == NULL) {
+       sc->mpr_cdev = make_dev(&mpr_cdevsw, unit, UID_ROOT, GID_OPERATOR, 0640,
+           "mpr%d", unit);
+
+       if (sc->mpr_cdev == NULL)
                return (ENOMEM);
-       }
+
        sc->mpr_cdev->si_drv1 = sc;
        return (0);
 }
@@ -284,8 +282,8 @@ mpr_user_read_cfg_header(struct mpr_soft
 }
 
 static int
-mpr_user_read_cfg_page(struct mpr_softc *sc,
-    struct mpr_cfg_page_req *page_req, void *buf)
+mpr_user_read_cfg_page(struct mpr_softc *sc, struct mpr_cfg_page_req *page_req,
+    void *buf)
 {
        MPI2_CONFIG_PAGE_HEADER *reqhdr, *hdr;
        struct mpr_config_params params;
@@ -1718,8 +1716,8 @@ mpr_diag_release(struct mpr_softc *sc, m
 }
 
 static int
-mpr_do_diag_action(struct mpr_softc *sc, uint32_t action,
-    uint8_t *diag_action, uint32_t length, uint32_t *return_code)
+mpr_do_diag_action(struct mpr_softc *sc, uint32_t action, uint8_t *diag_action,
+    uint32_t length, uint32_t *return_code)
 {
        mpr_fw_diag_register_t          diag_register;
        mpr_fw_diag_unregister_t        diag_unregister;

Modified: head/sys/dev/mpr/mprvar.h
==============================================================================
--- head/sys/dev/mpr/mprvar.h   Mon May  9 16:15:52 2016        (r299264)
+++ head/sys/dev/mpr/mprvar.h   Mon May  9 16:16:00 2016        (r299265)
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 2009 Yahoo! Inc.
  * Copyright (c) 2011-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -585,13 +585,13 @@ do {                                                      
\
 
 #define mpr_dprint(sc, level, msg, args...)            \
 do {                                                   \
-       if ((sc)->mpr_debug & level)                    \
+       if ((sc)->mpr_debug & (level))                  \
                device_printf((sc)->mpr_dev, msg, ##args);      \
 } while (0)
 
 #define mpr_dprint_field(sc, level, msg, args...)              \
 do {                                                           \
-       if ((sc)->mpr_debug & level)                            \
+       if ((sc)->mpr_debug & (level))                          \
                printf("\t" msg, ##args);                       \
 } while (0)
 
@@ -653,8 +653,7 @@ void mpr_intr_locked(void *);
 int mpr_register_events(struct mpr_softc *, uint8_t *, mpr_evt_callback_t *,
     void *, struct mpr_event_handle **);
 int mpr_restart(struct mpr_softc *);
-int mpr_update_events(struct mpr_softc *, struct mpr_event_handle *,
-    uint8_t *);
+int mpr_update_events(struct mpr_softc *, struct mpr_event_handle *, uint8_t 
*);
 int mpr_deregister_events(struct mpr_softc *, struct mpr_event_handle *);
 int mpr_push_sge(struct mpr_command *, MPI2_SGE_SIMPLE64 *, size_t, int);
 int mpr_push_ieee_sge(struct mpr_command *, void *, int);
@@ -671,8 +670,8 @@ void mprsas_record_event(struct mpr_soft
     MPI2_EVENT_NOTIFICATION_REPLY *event_reply);
 
 int mpr_map_command(struct mpr_softc *sc, struct mpr_command *cm);
-int mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm,
-    int timeout, int sleep_flag);
+int mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm, int timeout,
+    int sleep_flag);
 int mpr_request_polled(struct mpr_softc *sc, struct mpr_command *cm);
 
 int mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2ConfigReply_t
@@ -727,11 +726,10 @@ void mpr_mapping_ir_config_change_event(
 void mprsas_evt_handler(struct mpr_softc *sc, uintptr_t data,
     MPI2_EVENT_NOTIFICATION_REPLY *event);
 void mprsas_prepare_remove(struct mprsas_softc *sassc, uint16_t handle);
-void mprsas_prepare_volume_remove(struct mprsas_softc *sassc,
-    uint16_t handle);
+void mprsas_prepare_volume_remove(struct mprsas_softc *sassc, uint16_t handle);
 int mprsas_startup(struct mpr_softc *sc);
-struct mprsas_target * mprsas_find_target_by_handle(struct mprsas_softc *,
-    int, uint16_t);
+struct mprsas_target * mprsas_find_target_by_handle(struct mprsas_softc *, int,
+    uint16_t);
 void mprsas_realloc_targets(struct mpr_softc *sc, int maxtargets);
 struct mpr_command * mprsas_alloc_tm(struct mpr_softc *sc);
 void mprsas_free_tm(struct mpr_softc *sc, struct mpr_command *tm);
_______________________________________________
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