summaryrefslogtreecommitdiffstats
path: root/sys/dev/mps/mps_sas.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mps/mps_sas.c')
-rw-r--r--sys/dev/mps/mps_sas.c390
1 files changed, 218 insertions, 172 deletions
diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
index 0d0dbd0..80a0f52 100644
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -175,14 +175,16 @@ mpssas_find_target_by_handle(struct mpssas_softc *sassc, int start, uint16_t han
void
mpssas_startup_increment(struct mpssas_softc *sassc)
{
+ MPS_FUNCTRACE(sassc->sc);
+
if ((sassc->flags & MPSSAS_IN_STARTUP) != 0) {
if (sassc->startup_refcount++ == 0) {
/* just starting, freeze the simq */
- mps_dprint(sassc->sc, MPS_INFO,
+ mps_dprint(sassc->sc, MPS_INIT,
"%s freezing simq\n", __func__);
xpt_freeze_simq(sassc->sim, 1);
}
- mps_dprint(sassc->sc, MPS_TRACE, "%s refcount %u\n", __func__,
+ mps_dprint(sassc->sc, MPS_INIT, "%s refcount %u\n", __func__,
sassc->startup_refcount);
}
}
@@ -190,18 +192,20 @@ mpssas_startup_increment(struct mpssas_softc *sassc)
void
mpssas_startup_decrement(struct mpssas_softc *sassc)
{
+ MPS_FUNCTRACE(sassc->sc);
+
if ((sassc->flags & MPSSAS_IN_STARTUP) != 0) {
if (--sassc->startup_refcount == 0) {
/* finished all discovery-related actions, release
* the simq and rescan for the latest topology.
*/
- mps_dprint(sassc->sc, MPS_INFO,
+ mps_dprint(sassc->sc, MPS_INIT,
"%s releasing simq\n", __func__);
sassc->flags &= ~MPSSAS_IN_STARTUP;
xpt_release_simq(sassc->sim, 1);
mpssas_rescan_target(sassc->sc, NULL);
}
- mps_dprint(sassc->sc, MPS_TRACE, "%s refcount %u\n", __func__,
+ mps_dprint(sassc->sc, MPS_INIT, "%s refcount %u\n", __func__,
sassc->startup_refcount);
}
}
@@ -215,13 +219,15 @@ mpssas_alloc_tm(struct mps_softc *sc)
{
struct mps_command *tm;
+ MPS_FUNCTRACE(sc);
tm = mps_alloc_high_priority_command(sc);
if (tm != NULL) {
if (sc->sassc->tm_count++ == 0) {
- mps_printf(sc, "%s freezing simq\n", __func__);
+ mps_dprint(sc, MPS_RECOVERY,
+ "%s freezing simq\n", __func__);
xpt_freeze_simq(sc->sassc->sim, 1);
}
- mps_dprint(sc, MPS_TRACE, "%s tm_count %u\n", __func__,
+ mps_dprint(sc, MPS_RECOVERY, "%s tm_count %u\n", __func__,
sc->sassc->tm_count);
}
return tm;
@@ -230,6 +236,7 @@ mpssas_alloc_tm(struct mps_softc *sc)
void
mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm)
{
+ mps_dprint(sc, MPS_TRACE, "%s", __func__);
if (tm == NULL)
return;
@@ -238,10 +245,10 @@ mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm)
* release the simq.
*/
if (--sc->sassc->tm_count == 0) {
- mps_printf(sc, "%s releasing simq\n", __func__);
+ mps_dprint(sc, MPS_RECOVERY, "%s releasing simq\n", __func__);
xpt_release_simq(sc->sassc->sim, 1);
}
- mps_dprint(sc, MPS_TRACE, "%s tm_count %u\n", __func__,
+ mps_dprint(sc, MPS_RECOVERY, "%s tm_count %u\n", __func__,
sc->sassc->tm_count);
mps_free_high_priority_command(sc, tm);
@@ -256,6 +263,7 @@ mpssas_rescan_target(struct mps_softc *sc, struct mpssas_target *targ)
target_id_t targetid;
union ccb *ccb;
+ MPS_FUNCTRACE(sc);
pathid = cam_sim_path(sassc->sim);
if (targ == NULL)
targetid = CAM_TARGET_WILDCARD;
@@ -267,13 +275,13 @@ mpssas_rescan_target(struct mps_softc *sc, struct mpssas_target *targ)
*/
ccb = xpt_alloc_ccb_nowait();
if (ccb == NULL) {
- mps_dprint(sc, MPS_FAULT, "unable to alloc CCB for rescan\n");
+ mps_dprint(sc, MPS_ERROR, "unable to alloc CCB for rescan\n");
return;
}
if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid,
targetid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
- mps_dprint(sc, MPS_FAULT, "unable to create path for rescan\n");
+ mps_dprint(sc, MPS_ERROR, "unable to create path for rescan\n");
xpt_free_ccb(ccb);
return;
}
@@ -288,7 +296,7 @@ mpssas_rescan_target(struct mps_softc *sc, struct mpssas_target *targ)
}
static void
-mpssas_log_command(struct mps_command *cm, const char *fmt, ...)
+mpssas_log_command(struct mps_command *cm, u_int level, const char *fmt, ...)
{
struct sbuf sb;
va_list ap;
@@ -324,7 +332,7 @@ mpssas_log_command(struct mps_command *cm, const char *fmt, ...)
sbuf_printf(&sb, "SMID %u ", cm->cm_desc.Default.SMID);
sbuf_vprintf(&sb, fmt, ap);
sbuf_finish(&sb);
- printf("%s", sbuf_data(&sb));
+ mps_dprint_field(cm->cm_sc, level, "%s", sbuf_data(&sb));
va_end(ap);
}
@@ -337,7 +345,7 @@ mpssas_remove_volume(struct mps_softc *sc, struct mps_command *tm)
struct mpssas_target *targ;
uint16_t handle;
- mps_dprint(sc, MPS_INFO, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
@@ -345,24 +353,27 @@ mpssas_remove_volume(struct mps_softc *sc, struct mps_command *tm)
if (reply == NULL) {
/* XXX retry the remove after the diag reset completes? */
- mps_printf(sc, "%s NULL reply reseting device 0x%04x\n",
- __func__, handle);
+ mps_dprint(sc, MPS_FAULT,
+ "%s NULL reply reseting device 0x%04x\n", __func__, handle);
mpssas_free_tm(sc, tm);
return;
}
if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) {
- mps_printf(sc, "IOCStatus = 0x%x while resetting device 0x%x\n",
+ mps_dprint(sc, MPS_FAULT,
+ "IOCStatus = 0x%x while resetting device 0x%x\n",
reply->IOCStatus, handle);
mpssas_free_tm(sc, tm);
return;
}
- mps_printf(sc, "Reset aborted %u commands\n", reply->TerminationCount);
+ mps_dprint(sc, MPS_XINFO,
+ "Reset aborted %u commands\n", reply->TerminationCount);
mps_free_reply(sc, tm->cm_reply_data);
tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */
- mps_printf(sc, "clearing target %u handle 0x%04x\n", targ->tid, handle);
+ mps_dprint(sc, MPS_XINFO,
+ "clearing target %u handle 0x%04x\n", targ->tid, handle);
/*
* Don't clear target if remove fails because things will get confusing.
@@ -398,7 +409,7 @@ mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle)
struct mps_command *cm;
struct mpssas_target *targ = NULL;
- mps_dprint(sassc->sc, MPS_INFO, "%s\n", __func__);
+ MPS_FUNCTRACE(sassc->sc);
sc = sassc->sc;
#ifdef WD_SUPPORT
@@ -417,7 +428,8 @@ mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle)
if (targ == NULL) {
/* FIXME: what is the action? */
/* We don't know about this device? */
- printf("%s %d : invalid handle 0x%x \n", __func__,__LINE__, handle);
+ mps_dprint(sc, MPS_ERROR,
+ "%s %d : invalid handle 0x%x \n", __func__,__LINE__, handle);
return;
}
@@ -425,7 +437,8 @@ mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle)
cm = mpssas_alloc_tm(sc);
if (cm == NULL) {
- mps_printf(sc, "%s: command alloc failure\n", __func__);
+ mps_dprint(sc, MPS_ERROR,
+ "%s: command alloc failure\n", __func__);
return;
}
@@ -465,7 +478,7 @@ mpssas_prepare_remove(struct mpssas_softc *sassc, uint16_t handle)
struct mps_command *cm;
struct mpssas_target *targ = NULL;
- mps_dprint(sassc->sc, MPS_INFO, "%s\n", __func__);
+ MPS_FUNCTRACE(sassc->sc);
sc = sassc->sc;
@@ -473,7 +486,8 @@ mpssas_prepare_remove(struct mpssas_softc *sassc, uint16_t handle)
if (targ == NULL) {
/* FIXME: what is the action? */
/* We don't know about this device? */
- printf("%s %d : invalid handle 0x%x \n", __func__,__LINE__, handle);
+ mps_dprint(sc, MPS_ERROR,
+ "%s : invalid handle 0x%x \n", __func__, handle);
return;
}
@@ -481,7 +495,8 @@ mpssas_prepare_remove(struct mpssas_softc *sassc, uint16_t handle)
cm = mpssas_alloc_tm(sc);
if (cm == NULL) {
- mps_printf(sc, "%s: command alloc failure\n", __func__);
+ mps_dprint(sc, MPS_ERROR,
+ "%s: command alloc failure\n", __func__);
return;
}
@@ -513,7 +528,7 @@ mpssas_remove_device(struct mps_softc *sc, struct mps_command *tm)
struct mps_command *next_cm;
uint16_t handle;
- mps_dprint(sc, MPS_INFO, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
@@ -525,29 +540,31 @@ mpssas_remove_device(struct mps_softc *sc, struct mps_command *tm)
* task management commands don't have S/G lists.
*/
if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
- mps_printf(sc, "%s: cm_flags = %#x for remove of handle %#04x! "
- "This should not happen!\n", __func__, tm->cm_flags,
- handle);
+ mps_dprint(sc, MPS_ERROR,
+ "%s: cm_flags = %#x for remove of handle %#04x! "
+ "This should not happen!\n", __func__, tm->cm_flags,
+ handle);
mpssas_free_tm(sc, tm);
return;
}
if (reply == NULL) {
/* XXX retry the remove after the diag reset completes? */
- mps_printf(sc, "%s NULL reply reseting device 0x%04x\n",
- __func__, handle);
+ mps_dprint(sc, MPS_FAULT,
+ "%s NULL reply reseting device 0x%04x\n", __func__, handle);
mpssas_free_tm(sc, tm);
return;
}
if (le16toh(reply->IOCStatus) != MPI2_IOCSTATUS_SUCCESS) {
- mps_printf(sc, "IOCStatus = 0x%x while resetting device 0x%x\n",
+ mps_dprint(sc, MPS_FAULT,
+ "IOCStatus = 0x%x while resetting device 0x%x\n",
le16toh(reply->IOCStatus), handle);
mpssas_free_tm(sc, tm);
return;
}
- mps_dprint(sc, MPS_INFO, "Reset aborted %u commands\n",
+ mps_dprint(sc, MPS_XINFO, "Reset aborted %u commands\n",
le32toh(reply->TerminationCount));
mps_free_reply(sc, tm->cm_reply_data);
tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */
@@ -565,12 +582,12 @@ mpssas_remove_device(struct mps_softc *sc, struct mps_command *tm)
mps_map_command(sc, tm);
- mps_dprint(sc, MPS_INFO, "clearing target %u handle 0x%04x\n",
+ mps_dprint(sc, MPS_XINFO, "clearing target %u handle 0x%04x\n",
targ->tid, handle);
TAILQ_FOREACH_SAFE(tm, &targ->commands, cm_link, next_cm) {
union ccb *ccb;
- mps_dprint(sc, MPS_INFO, "Completing missed command %p\n", tm);
+ mps_dprint(sc, MPS_XINFO, "Completing missed command %p\n", tm);
ccb = tm->cm_complete_data;
ccb->ccb_h.status = CAM_DEV_NOT_THERE;
mpssas_scsiio_complete(sc, tm);
@@ -585,7 +602,7 @@ mpssas_remove_complete(struct mps_softc *sc, struct mps_command *tm)
struct mpssas_target *targ;
struct mpssas_lun *lun;
- mps_dprint(sc, MPS_INFO, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
reply = (MPI2_SAS_IOUNIT_CONTROL_REPLY *)tm->cm_reply;
handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
@@ -596,7 +613,8 @@ mpssas_remove_complete(struct mps_softc *sc, struct mps_command *tm)
* task management commands don't have S/G lists.
*/
if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
- mps_printf(sc, "%s: cm_flags = %#x for remove of handle %#04x! "
+ mps_dprint(sc, MPS_XINFO,
+ "%s: cm_flags = %#x for remove of handle %#04x! "
"This should not happen!\n", __func__, tm->cm_flags,
handle);
mpssas_free_tm(sc, tm);
@@ -605,13 +623,14 @@ mpssas_remove_complete(struct mps_softc *sc, struct mps_command *tm)
if (reply == NULL) {
/* most likely a chip reset */
- mps_printf(sc, "%s NULL reply removing device 0x%04x\n",
- __func__, handle);
+ mps_dprint(sc, MPS_FAULT,
+ "%s NULL reply removing device 0x%04x\n", __func__, handle);
mpssas_free_tm(sc, tm);
return;
}
- mps_printf(sc, "%s on handle 0x%04x, IOCStatus= 0x%x\n", __func__,
+ mps_dprint(sc, MPS_XINFO,
+ "%s on handle 0x%04x, IOCStatus= 0x%x\n", __func__,
handle, le16toh(reply->IOCStatus));
/*
@@ -676,7 +695,7 @@ mps_attach_sas(struct mps_softc *sc)
#endif
int unit, error = 0;
- mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
sassc = malloc(sizeof(struct mpssas_softc), M_MPT2, M_WAITOK|M_ZERO);
if(!sassc) {
@@ -696,7 +715,7 @@ mps_attach_sas(struct mps_softc *sc)
sassc->sc = sc;
if ((sassc->devq = cam_simq_alloc(sc->num_reqs)) == NULL) {
- mps_dprint(sc, MPS_FAULT, "Cannot allocate SIMQ\n");
+ mps_dprint(sc, MPS_ERROR, "Cannot allocate SIMQ\n");
error = ENOMEM;
goto out;
}
@@ -705,7 +724,7 @@ mps_attach_sas(struct mps_softc *sc)
sassc->sim = cam_sim_alloc(mpssas_action, mpssas_poll, "mps", sassc,
unit, &sc->mps_mtx, sc->num_reqs, sc->num_reqs, sassc->devq);
if (sassc->sim == NULL) {
- mps_dprint(sc, MPS_FAULT, "Cannot allocate SIM\n");
+ mps_dprint(sc, MPS_ERROR, "Cannot allocate SIM\n");
error = EINVAL;
goto out;
}
@@ -738,7 +757,7 @@ mps_attach_sas(struct mps_softc *sc)
* everything is just a target on a single bus.
*/
if ((error = xpt_bus_register(sassc->sim, sc->mps_dev, 0)) != 0) {
- mps_dprint(sc, MPS_FAULT, "Error %d registering SCSI bus\n",
+ mps_dprint(sc, MPS_ERROR, "Error %d registering SCSI bus\n",
error);
mps_unlock(sc);
goto out;
@@ -761,8 +780,9 @@ mps_attach_sas(struct mps_softc *sc)
#if __FreeBSD_version >= 1000006
status = xpt_register_async(AC_ADVINFO_CHANGED, mpssas_async, sc, NULL);
if (status != CAM_REQ_CMP) {
- mps_printf(sc, "Error %#x registering async handler for "
- "AC_ADVINFO_CHANGED events\n", status);
+ mps_dprint(sc, MPS_ERROR,
+ "Error %#x registering async handler for "
+ "AC_ADVINFO_CHANGED events\n", status);
}
#endif
@@ -783,7 +803,7 @@ mps_detach_sas(struct mps_softc *sc)
struct mpssas_target *targ;
int i;
- mps_dprint(sc, MPS_INFO, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
if (sc->sassc == NULL)
return (0);
@@ -826,7 +846,6 @@ mps_detach_sas(struct mps_softc *sc)
}
mps_unlock(sc);
- mps_dprint(sc, MPS_INFO, "%s:%d\n", __func__,__LINE__);
if (sassc->devq != NULL)
cam_simq_free(sassc->devq);
@@ -848,7 +867,7 @@ mpssas_discovery_end(struct mpssas_softc *sassc)
{
struct mps_softc *sc = sassc->sc;
- mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
if (sassc->flags & MPSSAS_DISCOVERY_TIMEOUT_PENDING)
callout_stop(&sassc->discovery_callout);
@@ -862,17 +881,17 @@ mpssas_discovery_timeout(void *data)
struct mps_softc *sc;
sc = sassc->sc;
- mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
mps_lock(sc);
- mps_printf(sc,
+ mps_dprint(sc, MPS_INFO,
"Timeout waiting for discovery, interrupts may not be working!\n");
sassc->flags &= ~MPSSAS_DISCOVERY_TIMEOUT_PENDING;
/* Poll the hardware for events in case interrupts aren't working */
mps_intr_locked(sc);
- mps_printf(sassc->sc,
+ mps_dprint(sassc->sc, MPS_INFO,
"Finished polling after discovery timeout at %d\n", ticks);
if ((sassc->flags & MPSSAS_IN_DISCOVERY) == 0) {
@@ -902,7 +921,8 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
sassc = cam_sim_softc(sim);
- mps_dprint(sassc->sc, MPS_TRACE, "%s func 0x%x\n", __func__,
+ MPS_FUNCTRACE(sassc->sc);
+ mps_dprint(sassc->sc, MPS_TRACE, "ccb func_code 0x%x\n",
ccb->ccb_h.func_code);
mtx_assert(&sassc->sc->mps_mtx, MA_OWNED);
@@ -986,14 +1006,14 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
ccb->ccb_h.status = CAM_REQ_CMP;
break;
case XPT_RESET_DEV:
- mps_printf(sassc->sc, "mpssas_action XPT_RESET_DEV\n");
+ mps_dprint(sassc->sc, MPS_XINFO, "mpssas_action XPT_RESET_DEV\n");
mpssas_action_resetdev(sassc, ccb);
return;
case XPT_RESET_BUS:
case XPT_ABORT:
case XPT_TERM_IO:
- mps_printf(sassc->sc, "mpssas_action faking success for "
- "abort or reset\n");
+ mps_dprint(sassc->sc, MPS_XINFO,
+ "mpssas_action faking success for abort or reset\n");
ccb->ccb_h.status = CAM_REQ_CMP;
break;
case XPT_SCSI_IO:
@@ -1019,12 +1039,12 @@ mpssas_announce_reset(struct mps_softc *sc, uint32_t ac_code,
path_id_t path_id = cam_sim_path(sc->sassc->sim);
struct cam_path *path;
- mps_printf(sc, "%s code %x target %d lun %d\n", __func__,
+ mps_dprint(sc, MPS_XINFO, "%s code %x target %d lun %d\n", __func__,
ac_code, target_id, lun_id);
if (xpt_create_path(&path, NULL,
path_id, target_id, lun_id) != CAM_REQ_CMP) {
- mps_printf(sc, "unable to create path for reset "
+ mps_dprint(sc, MPS_ERROR, "unable to create path for reset "
"notification\n");
return;
}
@@ -1040,7 +1060,7 @@ mpssas_complete_all_commands(struct mps_softc *sc)
int i;
int completed;
- mps_printf(sc, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
mtx_assert(&sc->mps_mtx, MA_OWNED);
/* complete all commands with a NULL reply */
@@ -1053,7 +1073,7 @@ mpssas_complete_all_commands(struct mps_softc *sc)
cm->cm_flags |= MPS_CM_FLAGS_COMPLETE;
if (cm->cm_complete != NULL) {
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_RECOVERY,
"completing cm %p state %x ccb %p for diag reset\n",
cm, cm->cm_state, cm->cm_ccb);
@@ -1062,7 +1082,7 @@ mpssas_complete_all_commands(struct mps_softc *sc)
}
if (cm->cm_flags & MPS_CM_FLAGS_WAKEUP) {
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_RECOVERY,
"waking up cm %p state %x ccb %p for diag reset\n",
cm, cm->cm_state, cm->cm_ccb);
wakeup(cm);
@@ -1071,7 +1091,7 @@ mpssas_complete_all_commands(struct mps_softc *sc)
if ((completed == 0) && (cm->cm_state != MPS_CM_STATE_FREE)) {
/* this should never happen, but if it does, log */
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_RECOVERY,
"cm %p state %x flags 0x%x ccb %p during diag "
"reset\n", cm, cm->cm_state, cm->cm_flags,
cm->cm_ccb);
@@ -1092,7 +1112,7 @@ mpssas_handle_reinit(struct mps_softc *sc)
* discovery-related activities have finished, the simq will be
* released.
*/
- mps_printf(sc, "%s startup\n", __func__);
+ mps_dprint(sc, MPS_INIT, "%s startup\n", __func__);
sc->sassc->flags |= MPSSAS_IN_STARTUP;
sc->sassc->flags |= MPSSAS_IN_DISCOVERY;
xpt_freeze_simq(sc->sassc->sim, 1);
@@ -1104,7 +1124,8 @@ mpssas_handle_reinit(struct mps_softc *sc)
/* complete and cleanup after all outstanding commands */
mpssas_complete_all_commands(sc);
- mps_printf(sc, "%s startup %u tm %u after command completion\n",
+ mps_dprint(sc, MPS_INIT,
+ "%s startup %u tm %u after command completion\n",
__func__, sc->sassc->startup_refcount, sc->sassc->tm_count);
/*
@@ -1119,7 +1140,7 @@ mpssas_handle_reinit(struct mps_softc *sc)
*/
for (i = 0; i < sc->facts->MaxTargets; i++) {
if (sc->sassc->targets[i].outstanding != 0)
- mps_printf(sc, "target %u outstanding %u\n",
+ mps_dprint(sc, MPS_INIT, "target %u outstanding %u\n",
i, sc->sassc->targets[i].outstanding);
sc->sassc->targets[i].handle = 0x0;
sc->sassc->targets[i].exp_dev_handle = 0x0;
@@ -1127,6 +1148,7 @@ mpssas_handle_reinit(struct mps_softc *sc)
sc->sassc->targets[i].flags = MPSSAS_TARGET_INDIAGRESET;
}
}
+
static void
mpssas_tm_timeout(void *data)
{
@@ -1135,7 +1157,8 @@ mpssas_tm_timeout(void *data)
mtx_assert(&sc->mps_mtx, MA_OWNED);
- mpssas_log_command(tm, "task mgmt %p timed out\n", tm);
+ mpssas_log_command(tm, MPS_INFO|MPS_RECOVERY,
+ "task mgmt %p timed out\n", tm);
mps_reinit(sc);
}
@@ -1158,16 +1181,18 @@ mpssas_logical_unit_reset_complete(struct mps_softc *sc, struct mps_command *tm)
* Currently there should be no way we can hit this case. It only
* happens when we have a failure to allocate chain frames, and
* task management commands don't have S/G lists.
+ * XXXSL So should it be an assertion?
*/
if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
- mps_printf(sc, "%s: cm_flags = %#x for LUN reset! "
+ mps_dprint(sc, MPS_ERROR, "%s: cm_flags = %#x for LUN reset! "
"This should not happen!\n", __func__, tm->cm_flags);
mpssas_free_tm(sc, tm);
return;
}
if (reply == NULL) {
- mpssas_log_command(tm, "NULL reset reply for tm %p\n", tm);
+ mpssas_log_command(tm, MPS_RECOVERY,
+ "NULL reset reply for tm %p\n", tm);
if ((sc->mps_flags & MPS_FLAGS_DIAGRESET) != 0) {
/* this completion was due to a reset, just cleanup */
targ->flags &= ~MPSSAS_TARGET_INRESET;
@@ -1181,7 +1206,7 @@ mpssas_logical_unit_reset_complete(struct mps_softc *sc, struct mps_command *tm)
return;
}
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"logical unit reset status 0x%x code 0x%x count %u\n",
le16toh(reply->IOCStatus), le32toh(reply->ResponseCode),
le32toh(reply->TerminationCount));
@@ -1196,7 +1221,7 @@ mpssas_logical_unit_reset_complete(struct mps_softc *sc, struct mps_command *tm)
}
if (cm_count == 0) {
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY|MPS_INFO,
"logical unit %u finished recovery after reset\n",
tm->cm_lun, tm);
@@ -1221,7 +1246,7 @@ mpssas_logical_unit_reset_complete(struct mps_softc *sc, struct mps_command *tm)
* effectively failed, regardless of the status reported.
* Escalate to a target reset.
*/
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"logical unit reset complete for tm %p, but still have %u command(s)\n",
tm, cm_count);
mpssas_send_reset(sc, tm,
@@ -1248,14 +1273,15 @@ mpssas_target_reset_complete(struct mps_softc *sc, struct mps_command *tm)
* task management commands don't have S/G lists.
*/
if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
- mps_printf(sc, "%s: cm_flags = %#x for target reset! "
+ mps_dprint(sc, MPS_ERROR,"%s: cm_flags = %#x for target reset! "
"This should not happen!\n", __func__, tm->cm_flags);
mpssas_free_tm(sc, tm);
return;
}
if (reply == NULL) {
- mpssas_log_command(tm, "NULL reset reply for tm %p\n", tm);
+ mpssas_log_command(tm, MPS_RECOVERY,
+ "NULL reset reply for tm %p\n", tm);
if ((sc->mps_flags & MPS_FLAGS_DIAGRESET) != 0) {
/* this completion was due to a reset, just cleanup */
targ->flags &= ~MPSSAS_TARGET_INRESET;
@@ -1269,7 +1295,7 @@ mpssas_target_reset_complete(struct mps_softc *sc, struct mps_command *tm)
return;
}
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"target reset status 0x%x code 0x%x count %u\n",
le16toh(reply->IOCStatus), le32toh(reply->ResponseCode),
le32toh(reply->TerminationCount));
@@ -1280,7 +1306,7 @@ mpssas_target_reset_complete(struct mps_softc *sc, struct mps_command *tm)
/* we've finished recovery for this target and all
* of its logical units.
*/
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY|MPS_INFO,
"recovery finished after target reset\n");
mpssas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid,
@@ -1294,7 +1320,7 @@ mpssas_target_reset_complete(struct mps_softc *sc, struct mps_command *tm)
* outstanding commands, the reset effectively failed,
* regardless of the status reported. escalate.
*/
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"target reset complete for tm %p, but still have %u command(s)\n",
tm, targ->outstanding);
mps_reinit(sc);
@@ -1312,7 +1338,7 @@ mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, uint8_t type)
target = tm->cm_targ;
if (target->handle == 0) {
- mps_printf(sc, "%s null devhandle for target_id %d\n",
+ mps_dprint(sc, MPS_ERROR,"%s null devhandle for target_id %d\n",
__func__, target->tid);
return -1;
}
@@ -1326,7 +1352,8 @@ mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, uint8_t type)
/* XXX Need to handle invalid LUNs */
MPS_SET_LUN(req->LUN, tm->cm_lun);
tm->cm_targ->logical_unit_resets++;
- mpssas_log_command(tm, "sending logical unit reset\n");
+ mpssas_log_command(tm, MPS_RECOVERY|MPS_INFO,
+ "sending logical unit reset\n");
tm->cm_complete = mpssas_logical_unit_reset_complete;
}
else if (type == MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET) {
@@ -1334,11 +1361,12 @@ mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, uint8_t type)
req->MsgFlags = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;
tm->cm_targ->target_resets++;
tm->cm_targ->flags |= MPSSAS_TARGET_INRESET;
- mpssas_log_command(tm, "sending target reset\n");
+ mpssas_log_command(tm, MPS_RECOVERY|MPS_INFO,
+ "sending target reset\n");
tm->cm_complete = mpssas_target_reset_complete;
}
else {
- mps_printf(sc, "unexpected reset type 0x%x\n", type);
+ mps_dprint(sc, MPS_ERROR, "unexpected reset type 0x%x\n", type);
return -1;
}
@@ -1351,7 +1379,7 @@ mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, uint8_t type)
err = mps_map_command(sc, tm);
if (err)
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"error %d sending reset type %u\n",
err, type);
@@ -1379,7 +1407,7 @@ mpssas_abort_complete(struct mps_softc *sc, struct mps_command *tm)
* task management commands don't have S/G lists.
*/
if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"cm_flags = %#x for abort %p TaskMID %u!\n",
tm->cm_flags, tm, le16toh(req->TaskMID));
mpssas_free_tm(sc, tm);
@@ -1387,7 +1415,7 @@ mpssas_abort_complete(struct mps_softc *sc, struct mps_command *tm)
}
if (reply == NULL) {
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"NULL abort reply for tm %p TaskMID %u\n",
tm, le16toh(req->TaskMID));
if ((sc->mps_flags & MPS_FLAGS_DIAGRESET) != 0) {
@@ -1402,7 +1430,7 @@ mpssas_abort_complete(struct mps_softc *sc, struct mps_command *tm)
return;
}
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"abort TaskMID %u status 0x%x code 0x%x count %u\n",
le16toh(req->TaskMID),
le16toh(reply->IOCStatus), le32toh(reply->ResponseCode),
@@ -1413,7 +1441,7 @@ mpssas_abort_complete(struct mps_softc *sc, struct mps_command *tm)
/* if there are no more timedout commands, we're done with
* error recovery for this target.
*/
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"finished recovery after aborting TaskMID %u\n",
le16toh(req->TaskMID));
@@ -1422,7 +1450,7 @@ mpssas_abort_complete(struct mps_softc *sc, struct mps_command *tm)
}
else if (le16toh(req->TaskMID) != cm->cm_desc.Default.SMID) {
/* abort success, but we have more timedout commands to abort */
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"continuing recovery after aborting TaskMID %u\n",
le16toh(req->TaskMID));
@@ -1432,7 +1460,7 @@ mpssas_abort_complete(struct mps_softc *sc, struct mps_command *tm)
/* we didn't get a command completion, so the abort
* failed as far as we're concerned. escalate.
*/
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"abort failed for TaskMID %u tm %p\n",
le16toh(req->TaskMID), tm);
@@ -1452,11 +1480,14 @@ mpssas_send_abort(struct mps_softc *sc, struct mps_command *tm, struct mps_comma
targ = cm->cm_targ;
if (targ->handle == 0) {
- mps_printf(sc, "%s null devhandle for target_id %d\n",
+ mps_dprint(sc, MPS_ERROR,"%s null devhandle for target_id %d\n",
__func__, cm->cm_ccb->ccb_h.target_id);
return -1;
}
+ mpssas_log_command(tm, MPS_RECOVERY|MPS_INFO,
+ "Aborting command %p\n", cm);
+
req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
req->DevHandle = htole16(targ->handle);
req->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
@@ -1481,7 +1512,7 @@ mpssas_send_abort(struct mps_softc *sc, struct mps_command *tm, struct mps_comma
err = mps_map_command(sc, tm);
if (err)
- mpssas_log_command(tm,
+ mpssas_log_command(tm, MPS_RECOVERY,
"error %d sending abort for cm %p SMID %u\n",
err, cm, req->TaskMID);
return err;
@@ -1498,9 +1529,10 @@ mpssas_scsiio_timeout(void *data)
cm = (struct mps_command *)data;
sc = cm->cm_sc;
+ MPS_FUNCTRACE(sc);
mtx_assert(&sc->mps_mtx, MA_OWNED);
- mps_printf(sc, "%s checking sc %p cm %p\n", __func__, sc, cm);
+ mps_dprint(sc, MPS_XINFO, "Timeout checking cm %p\n", sc);
/*
* Run the interrupt handler to make sure it's not pending. This
@@ -1509,16 +1541,17 @@ mpssas_scsiio_timeout(void *data)
*/
mps_intr_locked(sc);
if (cm->cm_state == MPS_CM_STATE_FREE) {
- mps_printf(sc, "SCSI command %p sc %p almost timed out\n", cm, sc);
+ mpssas_log_command(cm, MPS_XINFO,
+ "SCSI command %p almost timed out\n", cm);
return;
}
if (cm->cm_ccb == NULL) {
- mps_printf(sc, "command timeout with NULL ccb\n");
+ mps_dprint(sc, MPS_ERROR, "command timeout with NULL ccb\n");
return;
}
- mpssas_log_command(cm, "command timeout cm %p ccb %p\n",
+ mpssas_log_command(cm, MPS_INFO, "command timeout cm %p ccb %p\n",
cm, cm->cm_ccb);
targ = cm->cm_targ;
@@ -1536,11 +1569,12 @@ mpssas_scsiio_timeout(void *data)
/* target already in recovery, just queue up another
* timedout command to be processed later.
*/
- mps_printf(sc, "queued timedout cm %p for processing by tm %p\n",
+ mps_dprint(sc, MPS_RECOVERY,
+ "queued timedout cm %p for processing by tm %p\n",
cm, targ->tm);
}
else if ((targ->tm = mpssas_alloc_tm(sc)) != NULL) {
- mps_printf(sc, "timedout cm %p allocated tm %p\n",
+ mps_dprint(sc, MPS_RECOVERY, "timedout cm %p allocated tm %p\n",
cm, targ->tm);
/* start recovery by aborting the first timedout command */
@@ -1556,8 +1590,8 @@ mpssas_scsiio_timeout(void *data)
* more credits than disks in an enclosure, and limit
* ourselves to one TM per target for recovery.
*/
- mps_printf(sc, "timedout cm %p failed to allocate a tm\n",
- cm);
+ mps_dprint(sc, MPS_RECOVERY,
+ "timedout cm %p failed to allocate a tm\n", cm);
}
}
@@ -1576,20 +1610,21 @@ mpssas_action_scsiio(struct mpssas_softc *sassc, union ccb *ccb)
uint32_t mpi_control;
sc = sassc->sc;
+ MPS_FUNCTRACE(sc);
mtx_assert(&sc->mps_mtx, MA_OWNED);
csio = &ccb->csio;
targ = &sassc->targets[csio->ccb_h.target_id];
- mps_dprint(sc, MPS_TRACE, "%s ccb %p target flag %x\n", __func__, ccb, targ->flags);
+ mps_dprint(sc, MPS_TRACE, "ccb %p target flag %x\n", ccb, targ->flags);
if (targ->handle == 0x0) {
- mps_dprint(sc, MPS_TRACE, "%s NULL handle for target %u\n",
+ mps_dprint(sc, MPS_ERROR, "%s NULL handle for target %u\n",
__func__, csio->ccb_h.target_id);
csio->ccb_h.status = CAM_SEL_TIMEOUT;
xpt_done(ccb);
return;
}
if (targ->flags & MPS_TARGET_FLAGS_RAID_COMPONENT) {
- mps_dprint(sc, MPS_TRACE, "%s Raid component no SCSI IO supported %u\n",
+ mps_dprint(sc, MPS_ERROR, "%s Raid component no SCSI IO supported %u\n",
__func__, csio->ccb_h.target_id);
csio->ccb_h.status = CAM_TID_INVALID;
xpt_done(ccb);
@@ -1610,7 +1645,7 @@ mpssas_action_scsiio(struct mpssas_softc *sassc, union ccb *ccb)
}
if ((sc->mps_flags & MPS_FLAGS_SHUTDOWN) != 0) {
- mps_dprint(sc, MPS_TRACE, "%s shutting down\n", __func__);
+ mps_dprint(sc, MPS_INFO, "%s shutting down\n", __func__);
csio->ccb_h.status = CAM_TID_INVALID;
xpt_done(ccb);
return;
@@ -1792,9 +1827,8 @@ mpssas_action_scsiio(struct mpssas_softc *sassc, union ccb *ccb)
targ->outstanding++;
TAILQ_INSERT_TAIL(&targ->commands, cm, cm_link);
- if ((sc->mps_debug & MPS_TRACE) != 0)
- mpssas_log_command(cm, "%s cm %p ccb %p outstanding %u\n",
- __func__, cm, ccb, targ->outstanding);
+ mpssas_log_command(cm, MPS_XINFO, "%s cm %p ccb %p outstanding %u\n",
+ __func__, cm, ccb, targ->outstanding);
mps_map_command(sc, cm);
return;
@@ -1834,7 +1868,7 @@ mps_response_code(struct mps_softc *sc, u8 response_code)
desc = "unknown";
break;
}
- mps_dprint(sc, MPS_INFO, "response_code(0x%01x): %s\n",
+ mps_dprint(sc, MPS_XINFO, "response_code(0x%01x): %s\n",
response_code, desc);
}
/**
@@ -1968,21 +2002,20 @@ mps_sc_failed_io_info(struct mps_softc *sc, struct ccb_scsiio *csio,
if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID)
strcat(desc_scsi_state, "autosense valid ");
- mps_dprint(sc, MPS_INFO, "\thandle(0x%04x), ioc_status(%s)(0x%04x), \n",
- le16toh(mpi_reply->DevHandle),
- desc_ioc_state, ioc_status);
+ mps_dprint(sc, MPS_XINFO, "\thandle(0x%04x), ioc_status(%s)(0x%04x)\n",
+ le16toh(mpi_reply->DevHandle), desc_ioc_state, ioc_status);
/* We can add more detail about underflow data here
* TO-DO
* */
- mps_dprint(sc, MPS_INFO, "\tscsi_status(%s)(0x%02x), "
+ mps_dprint(sc, MPS_XINFO, "\tscsi_status(%s)(0x%02x), "
"scsi_state(%s)(0x%02x)\n", desc_scsi_status,
scsi_status, desc_scsi_state, scsi_state);
- if (sc->mps_debug & MPS_INFO &&
+ if (sc->mps_debug & MPS_XINFO &&
scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) {
- mps_dprint(sc, MPS_INFO, "-> Sense Buffer Data : Start :\n");
+ mps_dprint(sc, MPS_XINFO, "-> Sense Buffer Data : Start :\n");
scsi_sense_print(csio);
- mps_dprint(sc, MPS_INFO, "-> Sense Buffer Data : End :\n");
+ mps_dprint(sc, MPS_XINFO, "-> Sense Buffer Data : End :\n");
}
if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {
@@ -2004,9 +2037,10 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
int dir = 0, i;
u16 alloc_len;
+ MPS_FUNCTRACE(sc);
mps_dprint(sc, MPS_TRACE,
- "%s cm %p SMID %u ccb %p reply %p outstanding %u\n",
- __func__, cm, cm->cm_desc.Default.SMID, cm->cm_ccb, cm->cm_reply,
+ "cm %p SMID %u ccb %p reply %p outstanding %u\n", cm,
+ cm->cm_desc.Default.SMID, cm->cm_ccb, cm->cm_reply,
cm->cm_targ->outstanding);
callout_stop(&cm->cm_callout);
@@ -2037,30 +2071,30 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) {
TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery);
if (cm->cm_reply != NULL)
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_RECOVERY,
"completed timedout cm %p ccb %p during recovery "
"ioc %x scsi %x state %x xfer %u\n",
cm, cm->cm_ccb,
le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
le32toh(rep->TransferCount));
else
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_RECOVERY,
"completed timedout cm %p ccb %p during recovery\n",
cm, cm->cm_ccb);
} else if (cm->cm_targ->tm != NULL) {
if (cm->cm_reply != NULL)
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_RECOVERY,
"completed cm %p ccb %p during recovery "
"ioc %x scsi %x state %x xfer %u\n",
cm, cm->cm_ccb,
le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
le32toh(rep->TransferCount));
else
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_RECOVERY,
"completed cm %p ccb %p during recovery\n",
cm, cm->cm_ccb);
} else if ((sc->mps_flags & MPS_FLAGS_DIAGRESET) != 0) {
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_RECOVERY,
"reset completed cm %p ccb %p\n",
cm, cm->cm_ccb);
}
@@ -2090,7 +2124,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
if ((sassc->flags & MPSSAS_QUEUE_FROZEN) == 0) {
xpt_freeze_simq(sassc->sim, 1);
sassc->flags |= MPSSAS_QUEUE_FROZEN;
- mps_dprint(sc, MPS_INFO, "Error sending command, "
+ mps_dprint(sc, MPS_XINFO, "Error sending command, "
"freezing SIM queue\n");
}
}
@@ -2107,7 +2141,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
if (sassc->flags & MPSSAS_QUEUE_FROZEN) {
ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
sassc->flags &= ~MPSSAS_QUEUE_FROZEN;
- mps_dprint(sc, MPS_INFO,
+ mps_dprint(sc, MPS_XINFO,
"Unfreezing SIM queue\n");
}
}
@@ -2131,11 +2165,10 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
return;
}
- if (sc->mps_debug & MPS_TRACE)
- mpssas_log_command(cm,
- "ioc %x scsi %x state %x xfer %u\n",
- le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
- le32toh(rep->TransferCount));
+ mpssas_log_command(cm, MPS_XINFO,
+ "ioc %x scsi %x state %x xfer %u\n",
+ le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
+ le32toh(rep->TransferCount));
/*
* If this is a Direct Drive I/O, reissue the I/O to the original IR
@@ -2159,7 +2192,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
if ((le16toh(rep->IOCStatus) & MPI2_IOCSTATUS_MASK) ==
MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR)
- mpssas_log_command(cm, "recovered error\n");
+ mpssas_log_command(cm, MPS_XINFO, "recovered error\n");
/* Completion failed at the transport level. */
if (rep->SCSIState & (MPI2_SCSI_STATE_NO_SCSI_STATUS |
@@ -2304,10 +2337,10 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
* decrementing the retry count.
*/
ccb->ccb_h.status = CAM_REQUEUE_REQ;
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_INFO,
"terminated ioc %x scsi %x state %x xfer %u\n",
- le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
- le32toh(rep->TransferCount));
+ le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
+ le32toh(rep->TransferCount));
break;
case MPI2_IOCSTATUS_INVALID_FUNCTION:
case MPI2_IOCSTATUS_INTERNAL_ERROR:
@@ -2320,10 +2353,10 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
case MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:
case MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED:
default:
- mpssas_log_command(cm,
+ mpssas_log_command(cm, MPS_XINFO,
"completed ioc %x scsi %x state %x xfer %u\n",
- le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
- le32toh(rep->TransferCount));
+ le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
+ le32toh(rep->TransferCount));
csio->resid = cm->cm_length;
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
break;
@@ -2334,7 +2367,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
if (sassc->flags & MPSSAS_QUEUE_FROZEN) {
ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
sassc->flags &= ~MPSSAS_QUEUE_FROZEN;
- mps_dprint(sc, MPS_INFO, "Command completed, "
+ mps_dprint(sc, MPS_XINFO, "Command completed, "
"unfreezing SIM queue\n");
}
@@ -2634,7 +2667,7 @@ mpssas_smpio_complete(struct mps_softc *sc, struct mps_command *cm)
* in the standard request size.
*/
if ((cm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
- mps_printf(sc, "%s: cm_flags = %#x on SMP request!\n",
+ mps_dprint(sc, MPS_ERROR,"%s: cm_flags = %#x on SMP request!\n",
__func__, cm->cm_flags);
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
goto bailout;
@@ -2642,7 +2675,7 @@ mpssas_smpio_complete(struct mps_softc *sc, struct mps_command *cm)
rpl = (MPI2_SMP_PASSTHROUGH_REPLY *)cm->cm_reply;
if (rpl == NULL) {
- mps_dprint(sc, MPS_INFO, "%s: NULL cm_reply!\n", __func__);
+ mps_dprint(sc, MPS_ERROR, "%s: NULL cm_reply!\n", __func__);
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
goto bailout;
}
@@ -2653,13 +2686,13 @@ mpssas_smpio_complete(struct mps_softc *sc, struct mps_command *cm)
if ((le16toh(rpl->IOCStatus) & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS ||
rpl->SASStatus != MPI2_SASSTATUS_SUCCESS) {
- mps_dprint(sc, MPS_INFO, "%s: IOCStatus %04x SASStatus %02x\n",
+ mps_dprint(sc, MPS_XINFO, "%s: IOCStatus %04x SASStatus %02x\n",
__func__, le16toh(rpl->IOCStatus), rpl->SASStatus);
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
goto bailout;
}
- mps_dprint(sc, MPS_INFO, "%s: SMP request to SAS address "
+ mps_dprint(sc, MPS_XINFO, "%s: SMP request to SAS address "
"%#jx completed successfully\n", __func__,
(uintmax_t)sasaddr);
@@ -2700,8 +2733,8 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
switch ((ccb->ccb_h.flags & CAM_DATA_MASK)) {
case CAM_DATA_PADDR:
case CAM_DATA_SG_PADDR:
- mps_printf(sc, "%s: physical addresses not supported\n",
- __func__);
+ mps_dprint(sc, MPS_ERROR,
+ "%s: physical addresses not supported\n", __func__);
ccb->ccb_h.status = CAM_REQ_INVALID;
xpt_done(ccb);
return;
@@ -2712,7 +2745,8 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
*/
if ((ccb->smpio.smp_request_sglist_cnt > 1)
|| (ccb->smpio.smp_response_sglist_cnt > 1)) {
- mps_printf(sc, "%s: multiple request or response "
+ mps_dprint(sc, MPS_ERROR,
+ "%s: multiple request or response "
"buffer segments not supported for SMP\n",
__func__);
ccb->ccb_h.status = CAM_REQ_INVALID;
@@ -2756,7 +2790,8 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
cm = mps_alloc_command(sc);
if (cm == NULL) {
- mps_printf(sc, "%s: cannot allocate command\n", __func__);
+ mps_dprint(sc, MPS_ERROR,
+ "%s: cannot allocate command\n", __func__);
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
xpt_done(ccb);
return;
@@ -2773,7 +2808,7 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
req->SGLFlags =
MPI2_SGLFLAGS_SYSTEM_ADDRESS_SPACE | MPI2_SGLFLAGS_SGL_TYPE_MPI;
- mps_dprint(sc, MPS_INFO, "%s: sending SMP request to SAS "
+ mps_dprint(sc, MPS_XINFO, "%s: sending SMP request to SAS "
"address %#jx\n", __func__, (uintmax_t)sasaddr);
mpi_init_sge(cm, req, &req->SGL);
@@ -2835,7 +2870,8 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
*/
error = mps_map_command(sc, cm);
if ((error != 0) && (error != EINPROGRESS)) {
- mps_printf(sc, "%s: error %d returned from mps_map_command()\n",
+ mps_dprint(sc, MPS_ERROR,
+ "%s: error %d returned from mps_map_command()\n",
__func__, error);
goto bailout_error;
}
@@ -2864,7 +2900,8 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
*/
targ = &sassc->targets[ccb->ccb_h.target_id];
if (targ->handle == 0x0) {
- mps_printf(sc, "%s: target %d does not exist!\n", __func__,
+ mps_dprint(sc, MPS_ERROR,
+ "%s: target %d does not exist!\n", __func__,
ccb->ccb_h.target_id);
ccb->ccb_h.status = CAM_SEL_TIMEOUT;
xpt_done(ccb);
@@ -2912,7 +2949,8 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
#endif
if (targ->parent_handle == 0x0) {
- mps_printf(sc, "%s: handle %d does not have a valid "
+ mps_dprint(sc, MPS_ERROR,
+ "%s: handle %d does not have a valid "
"parent handle!\n", __func__, targ->handle);
ccb->ccb_h.status = CAM_REQ_INVALID;
goto bailout;
@@ -2922,7 +2960,8 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
targ->parent_handle);
if (parent_target == NULL) {
- mps_printf(sc, "%s: handle %d does not have a valid "
+ mps_dprint(sc, MPS_ERROR,
+ "%s: handle %d does not have a valid "
"parent target!\n", __func__, targ->handle);
ccb->ccb_h.status = CAM_REQ_INVALID;
goto bailout;
@@ -2930,7 +2969,8 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
if ((parent_target->devinfo &
MPI2_SAS_DEVICE_INFO_SMP_TARGET) == 0) {
- mps_printf(sc, "%s: handle %d parent %d does not "
+ mps_dprint(sc, MPS_ERROR,
+ "%s: handle %d parent %d does not "
"have an SMP target!\n", __func__,
targ->handle, parent_target->handle);
ccb->ccb_h.status = CAM_REQ_INVALID;
@@ -2942,7 +2982,8 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
#else /* OLD_MPS_PROBE */
if ((targ->parent_devinfo &
MPI2_SAS_DEVICE_INFO_SMP_TARGET) == 0) {
- mps_printf(sc, "%s: handle %d parent %d does not "
+ mps_dprint(sc, MPS_ERROR,
+ "%s: handle %d parent %d does not "
"have an SMP target!\n", __func__,
targ->handle, targ->parent_handle);
ccb->ccb_h.status = CAM_REQ_INVALID;
@@ -2950,7 +2991,8 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
}
if (targ->parent_sasaddr == 0x0) {
- mps_printf(sc, "%s: handle %d parent handle %d does "
+ mps_dprint(sc, MPS_ERROR,
+ "%s: handle %d parent handle %d does "
"not have a valid SAS address!\n",
__func__, targ->handle, targ->parent_handle);
ccb->ccb_h.status = CAM_REQ_INVALID;
@@ -2963,7 +3005,8 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
}
if (sasaddr == 0) {
- mps_printf(sc, "%s: unable to find SAS address for handle %d\n",
+ mps_dprint(sc, MPS_INFO,
+ "%s: unable to find SAS address for handle %d\n",
__func__, targ->handle);
ccb->ccb_h.status = CAM_REQ_INVALID;
goto bailout;
@@ -2986,13 +3029,14 @@ mpssas_action_resetdev(struct mpssas_softc *sassc, union ccb *ccb)
struct mps_command *tm;
struct mpssas_target *targ;
- mps_dprint(sassc->sc, MPS_TRACE, __func__);
+ MPS_FUNCTRACE(sassc->sc);
mtx_assert(&sassc->sc->mps_mtx, MA_OWNED);
sc = sassc->sc;
tm = mps_alloc_command(sc);
if (tm == NULL) {
- mps_printf(sc, "comand alloc failure in mpssas_action_resetdev\n");
+ mps_dprint(sc, MPS_ERROR,
+ "comand alloc failure in mpssas_action_resetdev\n");
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
xpt_done(ccb);
return;
@@ -3021,7 +3065,7 @@ mpssas_resetdev_complete(struct mps_softc *sc, struct mps_command *tm)
MPI2_SCSI_TASK_MANAGE_REPLY *resp;
union ccb *ccb;
- mps_dprint(sc, MPS_TRACE, __func__);
+ MPS_FUNCTRACE(sc);
mtx_assert(&sc->mps_mtx, MA_OWNED);
resp = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
@@ -3037,14 +3081,16 @@ mpssas_resetdev_complete(struct mps_softc *sc, struct mps_command *tm)
req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
- mps_printf(sc, "%s: cm_flags = %#x for reset of handle %#04x! "
+ mps_dprint(sc, MPS_ERROR,
+ "%s: cm_flags = %#x for reset of handle %#04x! "
"This should not happen!\n", __func__, tm->cm_flags,
req->DevHandle);
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
goto bailout;
}
- printf("%s: IOCStatus = 0x%x ResponseCode = 0x%x\n", __func__,
+ mps_dprint(sc, MPS_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) {
@@ -3093,7 +3139,7 @@ mpssas_rescan_done(struct cam_periph *periph, union ccb *done_ccb)
mtx_assert(&sassc->sc->mps_mtx, MA_OWNED);
xpt_path_string(done_ccb->ccb_h.path, path_str, sizeof(path_str));
- mps_dprint(sassc->sc, MPS_INFO, "Completing rescan for %s\n", path_str);
+ mps_dprint(sassc->sc, MPS_XINFO, "Completing rescan for %s\n", path_str);
xpt_free_path(done_ccb->ccb_h.path);
xpt_free_ccb(done_ccb);
@@ -3119,7 +3165,7 @@ mpssas_scanner_thread(void *arg)
sassc = (struct mpssas_softc *)arg;
sc = sassc->sc;
- mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
mps_lock(sc);
for (;;) {
@@ -3127,7 +3173,7 @@ mpssas_scanner_thread(void *arg)
msleep(&sassc->ccb_scanq, &sc->mps_mtx, PRIBIO,
"mps_scanq", 1 * hz);
if (sassc->flags & MPSSAS_SHUTDOWN) {
- mps_dprint(sc, MPS_TRACE, "Scanner shutting down\n");
+ mps_dprint(sc, MPS_XINFO, "Scanner shutting down\n");
break;
}
next_work:
@@ -3139,7 +3185,7 @@ next_work:
TAILQ_REMOVE(&sassc->ccb_scanq, &ccb->ccb_h, sim_links.tqe);
xpt_action(ccb);
if (sassc->flags & MPSSAS_SHUTDOWN) {
- mps_dprint(sc, MPS_TRACE, "Scanner shutting down\n");
+ mps_dprint(sc, MPS_XINFO, "Scanner shutting down\n");
break;
}
goto next_work;
@@ -3168,7 +3214,7 @@ mpssas_rescan(struct mpssas_softc *sassc, union ccb *ccb)
{
char path_str[64];
- mps_dprint(sassc->sc, MPS_TRACE, "%s\n", __func__);
+ MPS_FUNCTRACE(sassc->sc);
mtx_assert(&sassc->sc->mps_mtx, MA_OWNED);
@@ -3176,7 +3222,7 @@ mpssas_rescan(struct mpssas_softc *sassc, union ccb *ccb)
return;
xpt_path_string(ccb->ccb_h.path, path_str, sizeof(path_str));
- mps_dprint(sassc->sc, MPS_INFO, "Queueing rescan for %s\n", path_str);
+ mps_dprint(sassc->sc, MPS_XINFO, "Queueing rescan for %s\n", path_str);
/* Prepare request */
ccb->ccb_h.ppriv_ptr1 = sassc;
@@ -3244,7 +3290,7 @@ mpssas_async(void *callback_arg, uint32_t code, struct cam_path *path,
lun = malloc(sizeof(struct mpssas_lun), M_MPT2,
M_NOWAIT | M_ZERO);
if (lun == NULL) {
- mps_dprint(sc, MPS_FAULT, "Unable to alloc "
+ mps_dprint(sc, MPS_ERROR, "Unable to alloc "
"LUN for EEDP support.\n");
break;
}
@@ -3313,14 +3359,14 @@ mpssas_check_eedp(struct mpssas_softc *sassc)
do {
ccb = xpt_alloc_ccb_nowait();
if (ccb == NULL) {
- mps_dprint(sc, MPS_FAULT, "Unable to alloc CCB "
+ mps_dprint(sc, MPS_ERROR, "Unable to alloc CCB "
"for EEDP support.\n");
return;
}
if (xpt_create_path(&ccb->ccb_h.path, NULL,
pathid, targetid, lunid) != CAM_REQ_CMP) {
- mps_dprint(sc, MPS_FAULT, "Unable to create "
+ mps_dprint(sc, MPS_ERROR, "Unable to create "
"path for EEDP support\n");
xpt_free_ccb(ccb);
return;
@@ -3347,7 +3393,7 @@ mpssas_check_eedp(struct mpssas_softc *sassc)
lun = malloc(sizeof(struct mpssas_lun),
M_MPT2, M_NOWAIT | M_ZERO);
if (lun == NULL) {
- mps_dprint(sc, MPS_FAULT,
+ mps_dprint(sc, MPS_ERROR,
"Unable to alloc LUN for "
"EEDP support.\n");
xpt_free_path(ccb->ccb_h.path);
@@ -3385,7 +3431,7 @@ mpssas_check_eedp(struct mpssas_softc *sassc)
continue;
}
- mps_dprint(sc, MPS_INFO,
+ mps_dprint(sc, MPS_XINFO,
"Sending read cap: path %s"
" handle %d\n", path_str, target->handle );
@@ -3398,7 +3444,7 @@ mpssas_check_eedp(struct mpssas_softc *sassc)
malloc(sizeof(struct scsi_read_capacity_eedp),
M_MPT2, M_NOWAIT| M_ZERO);
if (rcap_buf == NULL) {
- mps_dprint(sc, MPS_FAULT, "Unable to alloc read "
+ mps_dprint(sc, MPS_ERROR, "Unable to alloc read "
"capacity buffer for EEDP support.\n");
xpt_free_path(ccb->ccb_h.path);
xpt_free_ccb(ccb);
@@ -3535,7 +3581,7 @@ mpssas_send_portenable(struct mps_softc *sc)
MPI2_PORT_ENABLE_REQUEST *request;
struct mps_command *cm;
- mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
if ((cm = mps_alloc_command(sc)) == NULL)
return (EBUSY);
@@ -3549,7 +3595,7 @@ mpssas_send_portenable(struct mps_softc *sc)
cm->cm_sge = NULL;
mps_map_command(sc, cm);
- mps_dprint(sc, MPS_TRACE,
+ mps_dprint(sc, MPS_XINFO,
"mps_send_portenable finished cm %p req %p complete %p\n",
cm, cm->cm_req, cm->cm_complete);
return (0);
@@ -3561,7 +3607,7 @@ mpssas_portenable_complete(struct mps_softc *sc, struct mps_command *cm)
MPI2_PORT_ENABLE_REPLY *reply;
struct mpssas_softc *sassc;
- mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+ MPS_FUNCTRACE(sc);
sassc = sc->sassc;
/*
@@ -3570,7 +3616,7 @@ mpssas_portenable_complete(struct mps_softc *sc, struct mps_command *cm)
* port enable commands don't have S/G lists.
*/
if ((cm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
- mps_printf(sc, "%s: cm_flags = %#x for port enable! "
+ mps_dprint(sc, MPS_ERROR, "%s: cm_flags = %#x for port enable! "
"This should not happen!\n", __func__, cm->cm_flags);
}
@@ -3583,7 +3629,7 @@ mpssas_portenable_complete(struct mps_softc *sc, struct mps_command *cm)
mps_free_command(sc, cm);
if (sc->mps_ich.ich_arg != NULL) {
- mps_dprint(sc, MPS_INFO, "disestablish config intrhook\n");
+ mps_dprint(sc, MPS_XINFO, "disestablish config intrhook\n");
config_intrhook_disestablish(&sc->mps_ich);
sc->mps_ich.ich_arg = NULL;
}
OpenPOWER on IntegriCloud