Lines Matching defs:tm

129 static int mprsas_send_abort(struct mpr_softc *sc, struct mpr_command *tm,
225 struct mpr_command *tm;
228 tm = mpr_alloc_high_priority_command(sc);
229 if (tm == NULL)
232 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
234 return tm;
238 mprsas_free_tm(struct mpr_softc *sc, struct mpr_command *tm)
243 if (tm == NULL)
251 if (tm->cm_targ != NULL) {
252 tm->cm_targ->flags &= ~MPRSAS_TARGET_INRESET;
253 target_id = tm->cm_targ->tid;
255 if (tm->cm_ccb) {
258 xpt_release_devq(tm->cm_ccb->ccb_h.path, 1, TRUE);
259 xpt_free_path(tm->cm_ccb->ccb_h.path);
260 xpt_free_ccb(tm->cm_ccb);
263 mpr_free_high_priority_command(sc, tm);
352 mprsas_remove_volume(struct mpr_softc *sc, struct mpr_command *tm)
360 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
361 handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
362 targ = tm->cm_targ;
368 mprsas_free_tm(sc, tm);
380 mpr_free_reply(sc, tm->cm_reply_data);
381 tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */
394 targ = tm->cm_targ;
412 mprsas_free_tm(sc, tm);
489 struct mpr_command *tm;
507 tm = mprsas_alloc_tm(sc);
508 if (tm == NULL) {
516 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
523 tm->cm_targ = targ;
524 tm->cm_data = NULL;
525 tm->cm_complete = mprsas_remove_device;
526 tm->cm_complete_data = (void *)(uintptr_t)handle;
530 mprsas_prepare_for_tm(sc, tm, targ, CAM_LUN_WILDCARD);
532 mpr_map_command(sc, tm);
536 mprsas_remove_device(struct mpr_softc *sc, struct mpr_command *tm)
545 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
546 handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
547 targ = tm->cm_targ;
554 if ((tm->cm_flags & MPR_CM_FLAGS_ERROR_MASK) != 0) {
557 tm->cm_flags, handle);
564 mprsas_free_tm(sc, tm);
576 mpr_free_reply(sc, tm->cm_reply_data);
577 tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */
580 req = (MPI2_SAS_IOUNIT_CONTROL_REQUEST *)tm->cm_req;
585 tm->cm_data = NULL;
586 tm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
587 tm->cm_complete = mprsas_remove_complete;
588 tm->cm_complete_data = (void *)(uintptr_t)handle;
597 mpr_map_command(sc, tm);
600 targ->pending_remove_tm = tm;
613 mprsas_remove_complete(struct mpr_softc *sc, struct mpr_command *tm)
622 reply = (MPI2_SAS_IOUNIT_CONTROL_REPLY *)tm->cm_reply;
623 handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
625 targ = tm->cm_targ;
639 if ((tm->cm_flags & MPR_CM_FLAGS_ERROR_MASK) != 0) {
642 tm->cm_flags, handle);
643 mprsas_free_tm(sc, tm);
651 mprsas_free_tm(sc, tm);
689 mprsas_free_tm(sc, tm);
1188 struct mpr_command *tm = data;
1189 struct mpr_softc *sc = tm->cm_sc;
1193 mprsas_log_command(tm, MPR_INFO|MPR_RECOVERY, "task mgmt %p timed "
1194 "out\n", tm);
1196 KASSERT(tm->cm_state == MPR_CM_STATE_INQUEUE,
1199 tm->cm_state = MPR_CM_STATE_BUSY;
1204 mprsas_logical_unit_reset_complete(struct mpr_softc *sc, struct mpr_command *tm)
1212 callout_stop(&tm->cm_callout);
1214 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1215 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
1216 targ = tm->cm_targ;
1223 if ((tm->cm_flags & MPR_CM_FLAGS_ERROR_MASK) != 0) {
1226 "This should not happen!\n", __func__, tm->cm_flags);
1227 mprsas_free_tm(sc, tm);
1232 mpr_dprint(sc, MPR_RECOVERY, "NULL reset reply for tm %p\n",
1233 tm);
1238 targ->tm = NULL;
1239 mprsas_free_tm(sc, tm);
1261 if (cm->cm_lun == tm->cm_lun)
1271 tm->cm_lun);
1282 mprsas_send_abort(sc, tm, cm);
1284 targ->tm = NULL;
1285 mprsas_free_tm(sc, tm);
1297 mprsas_send_reset(sc, tm,
1305 mprsas_target_reset_complete(struct mpr_softc *sc, struct mpr_command *tm)
1311 callout_stop(&tm->cm_callout);
1313 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1314 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
1315 targ = tm->cm_targ;
1322 if ((tm->cm_flags & MPR_CM_FLAGS_ERROR_MASK) != 0) {
1324 "reset! This should not happen!\n", __func__, tm->cm_flags);
1325 mprsas_free_tm(sc, tm);
1331 "NULL target reset reply for tm %p TaskMID %u\n",
1332 tm, le16toh(req->TaskMID));
1337 targ->tm = NULL;
1338 mprsas_free_tm(sc, tm);
1362 mprsas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid,
1365 targ->tm = NULL;
1366 mprsas_free_tm(sc, tm);
1384 mprsas_send_reset(struct mpr_softc *sc, struct mpr_command *tm, uint8_t type)
1390 target = tm->cm_targ;
1397 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1418 MPR_SET_LUN(req->LUN, tm->cm_lun);
1419 tm->cm_targ->logical_unit_resets++;
1422 target->tid, tm->cm_lun);
1423 tm->cm_complete = mprsas_logical_unit_reset_complete;
1424 mprsas_prepare_for_tm(sc, tm, target, tm->cm_lun);
1426 tm->cm_targ->target_resets++;
1429 tm->cm_complete = mprsas_target_reset_complete;
1430 mprsas_prepare_for_tm(sc, tm, target, CAM_LUN_WILDCARD);
1444 tm->cm_data = NULL;
1445 tm->cm_complete_data = (void *)tm;
1447 callout_reset(&tm->cm_callout, timeout * hz,
1448 mprsas_tm_timeout, tm);
1450 err = mpr_map_command(sc, tm);
1459 mprsas_abort_complete(struct mpr_softc *sc, struct mpr_command *tm)
1466 callout_stop(&tm->cm_callout);
1468 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1469 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
1470 targ = tm->cm_targ;
1477 if ((tm->cm_flags & MPR_CM_FLAGS_ERROR_MASK) != 0) {
1480 tm->cm_flags, tm, le16toh(req->TaskMID));
1481 mprsas_free_tm(sc, tm);
1487 "NULL abort reply for tm %p TaskMID %u\n",
1488 tm, le16toh(req->TaskMID));
1493 targ->tm = NULL;
1494 mprsas_free_tm(sc, tm);
1510 cm = TAILQ_FIRST(&tm->cm_targ->timedout_commands);
1518 targ->tm = NULL;
1519 mprsas_free_tm(sc, tm);
1524 mprsas_send_abort(sc, tm, cm);
1534 mprsas_send_reset(sc, tm,
1542 mprsas_send_abort(struct mpr_softc *sc, struct mpr_command *tm,
1560 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1569 tm->cm_data = NULL;
1570 tm->cm_complete = mprsas_abort_complete;
1571 tm->cm_complete_data = (void *)tm;
1572 tm->cm_targ = cm->cm_targ;
1573 tm->cm_lun = cm->cm_lun;
1580 callout_reset(&tm->cm_callout, timeout * hz,
1581 mprsas_tm_timeout, tm);
1585 mprsas_prepare_for_tm(sc, tm, targ, tm->cm_lun);
1587 err = mpr_map_command(sc, tm);
1652 if (targ->tm != NULL) {
1657 "processing by tm %p\n", cm, targ->tm);
1659 else if ((targ->tm = mprsas_alloc_tm(sc)) != NULL) {
1664 mpr_dprint(sc, MPR_RECOVERY, "timedout cm %p allocated tm %p\n",
1665 cm, targ->tm);
1666 mprsas_send_abort(sc, targ->tm, cm);
1679 "timedout cm %p failed to allocate a tm\n", cm);
2452 } else if (cm->cm_targ->tm != NULL) {
3190 struct mpr_command *tm;
3199 tm = mprsas_alloc_tm(sc);
3200 if (tm == NULL) {
3209 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
3222 tm->cm_data = NULL;
3223 tm->cm_complete = mprsas_resetdev_complete;
3224 tm->cm_complete_data = ccb;
3228 tm->cm_targ = targ;
3230 mprsas_prepare_for_tm(sc, tm, targ, CAM_LUN_WILDCARD);
3231 mpr_map_command(sc, tm);
3235 mprsas_resetdev_complete(struct mpr_softc *sc, struct mpr_command *tm)
3243 resp = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
3244 ccb = tm->cm_complete_data;
3251 if ((tm->cm_flags & MPR_CM_FLAGS_ERROR_MASK) != 0) {
3254 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
3258 tm->cm_flags, req->DevHandle);
3268 mprsas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid,
3276 mprsas_free_tm(sc, tm);
3407 mprsas_prepare_for_tm(struct mpr_softc *sc, struct mpr_command *tm,
3420 tm->cm_ccb = ccb;
3421 tm->cm_targ = target;