Lines Matching refs:tgt

34 static void pmcs_ds_operational(pmcs_phy_t *pptr, pmcs_xscsi_t *tgt);
36 pmcs_xscsi_t *tgt, pmcs_hw_t *pwp, const char *func_name,
50 pmcs_prt(pwp, PMCS_PRT_DEBUG3, phyp, xp, "%s: tgt(0x%p)", __func__,
147 "%s: ds: 0x%x tgt: 0x%p phy: 0x%p", __func__, ds, (void *)xp,
224 pmcs_ds_operational(pmcs_phy_t *pptr, pmcs_xscsi_t *tgt)
231 if (tgt != NULL) {
232 tgt->recover_wait = 0;
245 pmcs_handle_ds_recovery_error(pptr, tgt, pwp, __func__,
263 pmcs_xscsi_t *tgt;
298 tgt = NULL;
312 tgt = pptr->target;
314 if (tgt != NULL) {
315 mutex_enter(&tgt->statlock);
316 if (tgt->recover_wait == 0) {
319 tgt_dev_state = tgt->dev_state;
327 pmcs_prt(pwp, PMCS_PRT_DEBUG2, pptr, tgt,
331 if ((tgt) && (tgt->recover_wait)) {
342 rc = pmcs_get_dev_state(pwp, pptr, tgt, &ds);
344 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
349 pmcs_handle_ds_recovery_error(pptr, tgt, pwp,
357 pmcs_ds_operational(pptr, tgt);
363 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, pptr, tgt,
365 (void *)tgt);
367 if (tgt != NULL) {
368 tgt->dev_state = ds;
372 rc = pmcs_send_err_recovery_cmd(pwp, ds, pptr, tgt);
373 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, pptr, tgt,
375 "result(%d) tgt(0x%p) ds(0x%x) tgt->ds(0x%x)",
376 __func__, rc, (void *)tgt, ds, tgt_dev_state);
379 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
384 pmcs_handle_ds_recovery_error(pptr, tgt, pwp,
394 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, pptr, tgt,
401 if (tgt != NULL) {
402 mutex_exit(&tgt->statlock);
405 if (tgt != NULL) {
406 mutex_enter(&tgt->statlock);
409 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
413 pmcs_handle_ds_recovery_error(pptr, tgt, pwp,
424 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
430 if (tgt != NULL) {
431 mutex_exit(&tgt->statlock);
434 if (tgt != NULL) {
435 mutex_enter(&tgt->statlock);
439 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
443 pmcs_handle_ds_recovery_error(pptr, tgt,
453 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, pptr, tgt,
454 "%s: Set PHY/tgt 0x%p/0x%p to OPERATIONAL state",
455 __func__, (void *)pptr, (void *)tgt);
456 rc = pmcs_set_dev_state(pwp, pptr, tgt,
459 pmcs_ds_operational(pptr, tgt);
461 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, pptr, tgt,
462 "%s: Failed to SET tgt 0x%p to OPERATIONAL state",
463 __func__, (void *)tgt);
465 pmcs_handle_ds_recovery_error(pptr, tgt, pwp,
466 __func__, "SET tgt to OPERATIONAL state");
472 if (tgt) {
473 mutex_exit(&tgt->statlock);
499 pmcs_xscsi_t *tgt)
504 if (tgt != NULL) {
505 ASSERT(mutex_owned(&tgt->statlock));
506 if (tgt->recovering) {
510 tgt->recovering = 1;
511 tgt_dev_state = tgt->dev_state;
515 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, NULL, tgt,
522 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, phyp, tgt,
523 "%s: ds: 0x%x, tgt ds(0x%x)", __func__, dev_state, tgt_dev_state);
528 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, phyp, tgt,
530 (void *)tgt);
535 rc = pmcs_set_dev_state(pwp, phyp, tgt,
538 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, phyp, tgt,
539 "%s(1): Failed to set tgt(0x%p) to IN_RECOVERY",
540 __func__, (void *)tgt);
547 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, phyp, tgt,
549 __func__, (void *)tgt);
553 rc = pmcs_set_dev_state(pwp, phyp, tgt,
555 if (tgt != NULL) {
556 tgt->reset_success = 1;
559 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, phyp, tgt,
560 "%s(2): Failed to SET tgt(0x%p) to OPERATIONAL",
561 __func__, (void *)tgt);
562 if (tgt != NULL) {
563 tgt->reset_success = 0;
572 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, phyp, tgt,
575 if (tgt != NULL) {
576 tgt->dev_state = PMCS_DEVICE_STATE_NON_OPERATIONAL;
583 pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, phyp, tgt,
591 if (tgt != NULL) {
592 tgt->recovering = 0;
608 pmcs_xscsi_t *tgt = pwrk->xp;
614 if (tgt != NULL) {
615 mutex_enter(&tgt->statlock);
616 if (!tgt->assigned) {
623 mutex_exit(&tgt->statlock);
638 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
649 if (tgt != NULL) {
650 mutex_enter(&tgt->statlock);
653 if ((tgt != NULL) && (tgt->dev_state !=
655 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
658 tgt->dev_state =
662 if (tgt != NULL) {
663 mutex_exit(&tgt->statlock);
684 if (tgt != NULL) {
685 mutex_exit(&tgt->statlock);
692 if (tgt == NULL) {
694 "%s: Not scheduling SSP event recovery for NULL tgt"
709 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
713 mutex_exit(&tgt->statlock);
726 tgt->event_recovery = 1;
727 mutex_exit(&tgt->statlock);
731 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
732 "%s: Scheduling SSP event recovery for tgt(0x%p) "
733 "pwrk(%p) tag(0x%x)", __func__, (void *)tgt, (void *)pwrk,
745 * tgt->statlock should not be held.
753 pmcs_xscsi_t *tgt = pwrk->xp;
761 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
780 pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, tgt,
781 "%s: No pending command for tgt 0x%p",
782 __func__, (void *)tgt);
805 tgt = pwrk->xp;
807 if (tgt != NULL) {
808 mutex_enter(&tgt->statlock);
809 pmcs_start_dev_state_recovery(tgt, pptr);
810 mutex_exit(&tgt->statlock);
821 pmcs_xscsi_t *tgt;
831 tgt = pwp->targets[idx];
833 if (tgt == NULL) {
837 mutex_enter(&tgt->statlock);
838 if (!tgt->assigned) {
839 mutex_exit(&tgt->statlock);
842 pphy = tgt->phy;
843 er_flag = tgt->event_recovery;
844 mutex_exit(&tgt->statlock);
851 pmcs_prt(pwp, PMCS_PRT_DEBUG, pphy, tgt,
852 "%s: found target(0x%p)", __func__, (void *) tgt);
855 mutex_enter(&tgt->aqlock);
856 STAILQ_FOREACH(cp, &tgt->aq, cmd_next) {
871 pmcs_prt(pwp, PMCS_PRT_DEBUG, pphy, tgt,
874 mutex_exit(&tgt->aqlock);
881 /* All bets are off on tgt/aq now, restart */
886 mutex_exit(&tgt->aqlock);
887 mutex_enter(&tgt->statlock);
888 tgt->event_recovery = 0;
889 pmcs_prt(pwp, PMCS_PRT_DEBUG, pphy, tgt,
891 __func__, (void *) tgt);
892 mutex_exit(&tgt->statlock);
908 "%s: Start ds_recovery for tgt 0x%p/PHY 0x%p (%s)",
928 pmcs_handle_ds_recovery_error(pmcs_phy_t *phyp, pmcs_xscsi_t *tgt,
932 ASSERT((tgt == NULL) || mutex_owned(&tgt->statlock));
937 pmcs_prt(pwp, PMCS_PRT_DEBUG, phyp, tgt,
940 if (tgt != NULL) {
941 tgt->recover_wait = 0;
956 pmcs_prt(pwp, PMCS_PRT_DEBUG, phyp, tgt, "%s: max number of "
959 if (tgt != NULL) {
960 tgt->recover_wait = 0;