Lines Matching refs:tm

159 static int  mpssas_send_abort(struct mps_softc *sc, struct mps_command *tm, struct mps_command *cm);
160 static int mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, uint8_t type);
238 struct mps_command *tm; in mpssas_alloc_tm() local
240 tm = mps_alloc_high_priority_command(sc); in mpssas_alloc_tm()
241 if (tm != NULL) { in mpssas_alloc_tm()
249 return tm; in mpssas_alloc_tm()
253 mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm) in mpssas_free_tm() argument
255 if (tm == NULL) in mpssas_free_tm()
269 mps_free_high_priority_command(sc, tm); in mpssas_free_tm()
348 mpssas_remove_volume(struct mps_softc *sc, struct mps_command *tm) in mpssas_remove_volume() argument
356 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply; in mpssas_remove_volume()
357 handle = (uint16_t)(uintptr_t)tm->cm_complete_data; in mpssas_remove_volume()
358 targ = tm->cm_targ; in mpssas_remove_volume()
364 mpssas_free_tm(sc, tm); in mpssas_remove_volume()
371 mpssas_free_tm(sc, tm); in mpssas_remove_volume()
376 mps_free_reply(sc, tm->cm_reply_data); in mpssas_remove_volume()
377 tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */ in mpssas_remove_volume()
388 targ = tm->cm_targ; in mpssas_remove_volume()
399 mpssas_free_tm(sc, tm); in mpssas_remove_volume()
530 mpssas_remove_device(struct mps_softc *sc, struct mps_command *tm) in mpssas_remove_device() argument
540 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply; in mpssas_remove_device()
541 handle = (uint16_t)(uintptr_t)tm->cm_complete_data; in mpssas_remove_device()
542 targ = tm->cm_targ; in mpssas_remove_device()
549 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) { in mpssas_remove_device()
551 "This should not happen!\n", __func__, tm->cm_flags, in mpssas_remove_device()
553 mpssas_free_tm(sc, tm); in mpssas_remove_device()
561 mpssas_free_tm(sc, tm); in mpssas_remove_device()
568 mpssas_free_tm(sc, tm); in mpssas_remove_device()
574 mps_free_reply(sc, tm->cm_reply_data); in mpssas_remove_device()
575 tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */ in mpssas_remove_device()
578 req = (MPI2_SAS_IOUNIT_CONTROL_REQUEST *)tm->cm_req; in mpssas_remove_device()
583 tm->cm_data = NULL; in mpssas_remove_device()
584 tm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mpssas_remove_device()
585 tm->cm_complete = mpssas_remove_complete; in mpssas_remove_device()
586 tm->cm_complete_data = (void *)(uintptr_t)handle; in mpssas_remove_device()
588 mps_map_command(sc, tm); in mpssas_remove_device()
592 TAILQ_FOREACH_MUTABLE(tm, &targ->commands, cm_link, next_cm) { in mpssas_remove_device()
595 mps_dprint(sc, MPS_INFO, "Completing missed command %p\n", tm); in mpssas_remove_device()
596 ccb = tm->cm_complete_data; in mpssas_remove_device()
598 mpssas_scsiio_complete(sc, tm); in mpssas_remove_device()
603 mpssas_remove_complete(struct mps_softc *sc, struct mps_command *tm) in mpssas_remove_complete() argument
611 reply = (MPI2_SAS_IOUNIT_CONTROL_REPLY *)tm->cm_reply; in mpssas_remove_complete()
612 handle = (uint16_t)(uintptr_t)tm->cm_complete_data; in mpssas_remove_complete()
619 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) { in mpssas_remove_complete()
621 "This should not happen!\n", __func__, tm->cm_flags, in mpssas_remove_complete()
623 mpssas_free_tm(sc, tm); in mpssas_remove_complete()
631 mpssas_free_tm(sc, tm); in mpssas_remove_complete()
645 targ = tm->cm_targ; in mpssas_remove_complete()
656 mpssas_free_tm(sc, tm); in mpssas_remove_complete()
1126 struct mps_command *tm = data; in mpssas_tm_timeout() local
1127 struct mps_softc *sc = tm->cm_sc; in mpssas_tm_timeout()
1130 mpssas_log_command(tm, "task mgmt %p timed out\n", tm); in mpssas_tm_timeout()
1136 mpssas_logical_unit_reset_complete(struct mps_softc *sc, struct mps_command *tm) in mpssas_logical_unit_reset_complete() argument
1143 callout_stop(&tm->cm_callout); in mpssas_logical_unit_reset_complete()
1145 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply; in mpssas_logical_unit_reset_complete()
1146 targ = tm->cm_targ; in mpssas_logical_unit_reset_complete()
1153 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) { in mpssas_logical_unit_reset_complete()
1155 "This should not happen!\n", __func__, tm->cm_flags); in mpssas_logical_unit_reset_complete()
1156 mpssas_free_tm(sc, tm); in mpssas_logical_unit_reset_complete()
1161 mpssas_log_command(tm, "NULL reset reply for tm %p\n", tm); in mpssas_logical_unit_reset_complete()
1165 targ->tm = NULL; in mpssas_logical_unit_reset_complete()
1166 mpssas_free_tm(sc, tm); in mpssas_logical_unit_reset_complete()
1175 mpssas_log_command(tm, in mpssas_logical_unit_reset_complete()
1185 if (cm->cm_lun == tm->cm_lun) in mpssas_logical_unit_reset_complete()
1190 mpssas_log_command(tm, in mpssas_logical_unit_reset_complete()
1192 tm->cm_lun); in mpssas_logical_unit_reset_complete()
1194 mpssas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid, in mpssas_logical_unit_reset_complete()
1195 tm->cm_lun); in mpssas_logical_unit_reset_complete()
1203 mpssas_send_abort(sc, tm, cm); in mpssas_logical_unit_reset_complete()
1206 targ->tm = NULL; in mpssas_logical_unit_reset_complete()
1207 mpssas_free_tm(sc, tm); in mpssas_logical_unit_reset_complete()
1215 mpssas_log_command(tm, in mpssas_logical_unit_reset_complete()
1217 tm, cm_count); in mpssas_logical_unit_reset_complete()
1218 mpssas_send_reset(sc, tm, in mpssas_logical_unit_reset_complete()
1224 mpssas_target_reset_complete(struct mps_softc *sc, struct mps_command *tm) in mpssas_target_reset_complete() argument
1229 callout_stop(&tm->cm_callout); in mpssas_target_reset_complete()
1231 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply; in mpssas_target_reset_complete()
1232 targ = tm->cm_targ; in mpssas_target_reset_complete()
1239 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) { in mpssas_target_reset_complete()
1241 "This should not happen!\n", __func__, tm->cm_flags); in mpssas_target_reset_complete()
1242 mpssas_free_tm(sc, tm); in mpssas_target_reset_complete()
1247 mpssas_log_command(tm, "NULL reset reply for tm %p\n", tm); in mpssas_target_reset_complete()
1251 targ->tm = NULL; in mpssas_target_reset_complete()
1252 mpssas_free_tm(sc, tm); in mpssas_target_reset_complete()
1261 mpssas_log_command(tm, in mpssas_target_reset_complete()
1272 mpssas_log_command(tm, in mpssas_target_reset_complete()
1275 mpssas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid, in mpssas_target_reset_complete()
1278 targ->tm = NULL; in mpssas_target_reset_complete()
1279 mpssas_free_tm(sc, tm); in mpssas_target_reset_complete()
1286 mpssas_log_command(tm, in mpssas_target_reset_complete()
1288 tm, targ->outstanding); in mpssas_target_reset_complete()
1296 mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, uint8_t type) in mpssas_send_reset() argument
1302 target = tm->cm_targ; in mpssas_send_reset()
1309 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req; in mpssas_send_reset()
1316 MPS_SET_LUN(req->LUN, tm->cm_lun); in mpssas_send_reset()
1317 tm->cm_targ->logical_unit_resets++; in mpssas_send_reset()
1318 mpssas_log_command(tm, "sending logical unit reset\n"); in mpssas_send_reset()
1319 tm->cm_complete = mpssas_logical_unit_reset_complete; in mpssas_send_reset()
1324 tm->cm_targ->target_resets++; in mpssas_send_reset()
1325 tm->cm_targ->flags |= MPSSAS_TARGET_INRESET; in mpssas_send_reset()
1326 mpssas_log_command(tm, "sending target reset\n"); in mpssas_send_reset()
1327 tm->cm_complete = mpssas_target_reset_complete; in mpssas_send_reset()
1334 tm->cm_data = NULL; in mpssas_send_reset()
1335 tm->cm_desc.HighPriority.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; in mpssas_send_reset()
1336 tm->cm_complete_data = (void *)tm; in mpssas_send_reset()
1338 callout_reset(&tm->cm_callout, MPS_RESET_TIMEOUT * hz, in mpssas_send_reset()
1339 mpssas_tm_timeout, tm); in mpssas_send_reset()
1341 err = mps_map_command(sc, tm); in mpssas_send_reset()
1343 mpssas_log_command(tm, in mpssas_send_reset()
1352 mpssas_abort_complete(struct mps_softc *sc, struct mps_command *tm) in mpssas_abort_complete() argument
1359 callout_stop(&tm->cm_callout); in mpssas_abort_complete()
1361 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req; in mpssas_abort_complete()
1362 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply; in mpssas_abort_complete()
1363 targ = tm->cm_targ; in mpssas_abort_complete()
1370 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) { in mpssas_abort_complete()
1371 mpssas_log_command(tm, in mpssas_abort_complete()
1373 tm->cm_flags, tm, req->TaskMID); in mpssas_abort_complete()
1374 mpssas_free_tm(sc, tm); in mpssas_abort_complete()
1379 mpssas_log_command(tm, in mpssas_abort_complete()
1381 tm, req->TaskMID); in mpssas_abort_complete()
1384 targ->tm = NULL; in mpssas_abort_complete()
1385 mpssas_free_tm(sc, tm); in mpssas_abort_complete()
1394 mpssas_log_command(tm, in mpssas_abort_complete()
1400 cm = TAILQ_FIRST(&tm->cm_targ->timedout_commands); in mpssas_abort_complete()
1405 mpssas_log_command(tm, in mpssas_abort_complete()
1409 targ->tm = NULL; in mpssas_abort_complete()
1410 mpssas_free_tm(sc, tm); in mpssas_abort_complete()
1414 mpssas_log_command(tm, in mpssas_abort_complete()
1418 mpssas_send_abort(sc, tm, cm); in mpssas_abort_complete()
1424 mpssas_log_command(tm, in mpssas_abort_complete()
1426 req->TaskMID, tm); in mpssas_abort_complete()
1428 mpssas_send_reset(sc, tm, in mpssas_abort_complete()
1436 mpssas_send_abort(struct mps_softc *sc, struct mps_command *tm, struct mps_command *cm) in mpssas_send_abort() argument
1449 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req; in mpssas_send_abort()
1459 tm->cm_data = NULL; in mpssas_send_abort()
1460 tm->cm_desc.HighPriority.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; in mpssas_send_abort()
1461 tm->cm_complete = mpssas_abort_complete; in mpssas_send_abort()
1462 tm->cm_complete_data = (void *)tm; in mpssas_send_abort()
1463 tm->cm_targ = cm->cm_targ; in mpssas_send_abort()
1464 tm->cm_lun = cm->cm_lun; in mpssas_send_abort()
1466 callout_reset(&tm->cm_callout, MPS_ABORT_TIMEOUT * hz, in mpssas_send_abort()
1467 mpssas_tm_timeout, tm); in mpssas_send_abort()
1471 err = mps_map_command(sc, tm); in mpssas_send_abort()
1473 mpssas_log_command(tm, in mpssas_send_abort()
1524 if (targ->tm != NULL) { in mpssas_scsiio_timeout()
1529 cm, targ->tm); in mpssas_scsiio_timeout()
1531 else if ((targ->tm = mpssas_alloc_tm(sc)) != NULL) { in mpssas_scsiio_timeout()
1533 cm, targ->tm); in mpssas_scsiio_timeout()
1536 mpssas_send_abort(sc, targ->tm, cm); in mpssas_scsiio_timeout()
1838 } else if (cm->cm_targ->tm != NULL) { in mpssas_scsiio_complete()
2758 struct mps_command *tm; in mpssas_action_resetdev() local
2765 tm = mps_alloc_command(sc); in mpssas_action_resetdev()
2766 if (tm == NULL) { in mpssas_action_resetdev()
2774 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req; in mpssas_action_resetdev()
2782 tm->cm_data = NULL; in mpssas_action_resetdev()
2783 tm->cm_desc.HighPriority.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; in mpssas_action_resetdev()
2784 tm->cm_complete = mpssas_resetdev_complete; in mpssas_action_resetdev()
2785 tm->cm_complete_data = ccb; in mpssas_action_resetdev()
2786 tm->cm_targ = targ; in mpssas_action_resetdev()
2787 mps_map_command(sc, tm); in mpssas_action_resetdev()
2791 mpssas_resetdev_complete(struct mps_softc *sc, struct mps_command *tm) in mpssas_resetdev_complete() argument
2799 resp = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply; in mpssas_resetdev_complete()
2800 ccb = tm->cm_complete_data; in mpssas_resetdev_complete()
2807 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) { in mpssas_resetdev_complete()
2810 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req; in mpssas_resetdev_complete()
2813 "This should not happen!\n", __func__, tm->cm_flags, in mpssas_resetdev_complete()
2824 mpssas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid, in mpssas_resetdev_complete()
2832 mpssas_free_tm(sc, tm); in mpssas_resetdev_complete()