Lines Matching refs:tgt

157 	pmcs_xscsi_t	*tgt = NULL;
227 tgt = pmcs_get_target(iport, tgt_port, B_TRUE);
229 if (tgt == NULL) {
231 "No tgt for tgt_port (%s)", __func__, tgt_port);
235 phyp = tgt->phy;
241 pmcs_prt(pwp, PMCS_PRT_DEBUG2, phyp, tgt, "@%s tgt = 0x%p, dip = 0x%p",
242 ua, (void *)tgt, (void *)tgt_dip);
248 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
249 "No LUN for tgt %p", (void *)tgt);
253 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt, "%s: @%s tgt 0x%p phy "
254 "0x%p (%s)", __func__, ua, (void *)tgt, (void *)phyp, phyp->path);
256 mutex_enter(&tgt->statlock);
257 tgt->dtype = phyp->dtype;
258 if (tgt->dtype != SAS && tgt->dtype != SATA) {
259 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
265 if ((tgt->dtype == SATA) && (lun_num > 0)) {
266 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
268 "(target = 0x%p)", __func__, (void *)tgt);
278 if (ddi_soft_state_bystr_zalloc(tgt->lun_sstate, ua) != DDI_SUCCESS) {
279 pmcs_prt(pwp, PMCS_PRT_DEBUG2, phyp, tgt,
284 lun = ddi_soft_state_bystr_get(tgt->lun_sstate, ua);
286 pmcs_prt(pwp, PMCS_PRT_DEBUG2, phyp, tgt,
299 lun->target = tgt;
304 if (tgt->target_num == PMCS_INVALID_TARGET_NUM) {
311 pwp->targets[target] = tgt;
312 tgt->target_num = (uint16_t)target;
317 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
323 tgt->dip = sd->sd_dev;
325 list_insert_tail(&tgt->lun_list, lun);
327 if (!pmcs_assign_device(pwp, tgt)) {
329 pwp->targets[tgt->target_num] = NULL;
330 tgt->target_num = PMCS_INVALID_TARGET_NUM;
331 tgt->phy = NULL;
332 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
334 __func__, (void *)tgt);
339 tgt->ref_count++;
342 SCSI_ADDR_PROP_TARGET, (uint32_t)(tgt->target_num));
345 if (tgt->dtype == SATA) {
351 tgt->phy_addressable = PMCS_PHY_ADDRESSABLE(phyp);
353 if (tgt->phy_addressable) {
366 mutex_exit(&tgt->statlock);
379 list_remove(&tgt->lun_list, lun);
380 ddi_soft_state_bystr_free(tgt->lun_sstate, ua);
383 mutex_exit(&tgt->statlock);
394 if (tgt && tgt->ref_count == 0) {
399 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
400 "%s: failed for @%s tgt 0x%p phy 0x%p", __func__, ua,
401 (void *)tgt, (void *)phyp);
445 "%s: for @%s tgt 0x%p phy 0x%p", __func__, unit_address,
656 "NULL. No tgt/phy to do ABORT_ALL", __func__);
1213 pmcs_xscsi_t *tgt;
1252 tgt = pmcs_get_target(iport, tgt_port, B_TRUE);
1253 if (tgt == NULL) {
1255 "%s: tgt softstate not found", __func__);
1261 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, NULL, tgt, "%s: %s (%s)",
1264 mutex_enter(&tgt->statlock);
1265 phy = tgt->phy;
1280 mutex_exit(&tgt->statlock);
1286 mutex_enter(&tgt->statlock);
1292 if (tgt->target_num == PMCS_INVALID_TARGET_NUM) {
1299 pwp->targets[target] = tgt;
1300 tgt->target_num = (uint16_t)target;
1301 tgt->assigned = 1;
1302 tgt->dev_state = PMCS_DEVICE_STATE_OPERATIONAL;
1313 if (!pmcs_assign_device(pwp, tgt)) {
1314 pwp->targets[tgt->target_num] = NULL;
1315 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, NULL, tgt,
1317 __func__, (void *)tgt);
1324 tgt->smpd = smp_sd;
1329 tgt->ref_count++;
1330 tgt->dtype = phy->dtype;
1331 mutex_exit(&tgt->statlock);
1346 tgt->phy = NULL;
1347 tgt->target_num = PMCS_INVALID_TARGET_NUM;
1352 mutex_exit(&tgt->statlock);
1355 ddi_soft_state_bystr_free(iport->tgt_sstate, tgt->unit_address);
1367 pmcs_xscsi_t *tgt;
1393 tgt = ddi_soft_state_bystr_get(iport->tgt_sstate, tgt_port);
1394 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, NULL, tgt, "%s: %s (%s)", __func__,
1398 if (tgt == NULL) {
1400 "%s: tgt softstate not found", __func__);
1405 phyp = tgt->phy;
1412 mutex_enter(&tgt->statlock);
1414 if (--tgt->ref_count == 0) {
1421 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, NULL, tgt,
1423 (void *)tgt, tgt->target_num);
1424 pwp->targets[tgt->target_num] = NULL;
1425 tgt->target_num = PMCS_INVALID_TARGET_NUM;
1427 if (phyp && (phyp->target == tgt)) {
1430 tgt->phy = NULL;
1431 pmcs_destroy_target(tgt);
1433 mutex_exit(&tgt->statlock);
1597 "%s: Flushing wait queue for dead tgt 0x%p", __func__,
1752 pmcs_xscsi_t *tgt;
1801 tgt = sp->cmd_target;
1802 pmcs_prt(pwp, PMCS_PRT_DEBUG3, NULL, tgt,
1803 "%s: calling completion on %p for tgt %p", __func__,
1804 (void *)sp, (void *)tgt);
1805 if (tgt) {
1806 mutex_enter(&tgt->statlock);
1807 ASSERT(tgt->actv_pkts != 0);
1808 tgt->actv_pkts--;
1809 mutex_exit(&tgt->statlock);
1876 "%s: Failed to get IO IQ entry for tgt %d",
1915 "%s: Failed to dma_load for tgt %d (QF)",
2130 "%s: pkt %p tgt %u path %s "
2136 "%s: pkt %p tgt %u path %s "
2181 pptr, xp, "%s: tgt 0x%p "
2205 "%s: pkt %p tgt %u done reason=%x state=%x resid=%ld status=%x",
2301 "%s: Aborted cmd for tgt 0x%p, signaling waiters",
2318 "back on wq during recovery for tgt 0x%p", __func__,
2478 "%s: Failed to get IO IQ entry for tgt %d",
2572 "%s: Failed to dma_load for tgt %d",
2659 pmcs_prt(pwp, PMCS_PRT_DEBUG2, pptr, xp, "%s: pkt %p tgt %u done",
2709 "%s: pkt %p tgt %u done reason=%x state=%x resid=%ld status=%x",
2800 "%s: Aborted cmd for tgt 0x%p, signaling waiters",
3169 pmcs_xscsi_t *tgt;
3184 tgt = ddi_soft_state_bystr_get(iport->tgt_sstate, tgt_port);
3186 if (tgt) {
3187 mutex_enter(&tgt->statlock);
3192 if (tgt->phy && (tgt->phy != phyp)) {
3193 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
3195 (void *)tgt->phy, (void *)phyp);
3196 if (!IS_ROOT_PHY(tgt->phy)) {
3197 pmcs_dec_phy_ref_count(tgt->phy);
3200 tgt->phy->target = NULL;
3209 if ((tgt->phy == NULL) && !alloc_tgt) {
3210 pmcs_prt(pwp, PMCS_PRT_DEBUG, phyp, tgt,
3212 "%s", __func__, tgt->unit_address);
3213 for (int idx = 0; idx < tgt->ref_count; idx++) {
3222 tgt->dev_gone = 0;
3223 tgt->assigned = 1;
3224 tgt->dtype = phyp->dtype;
3225 tgt->dev_state = PMCS_DEVICE_STATE_OPERATIONAL;
3226 tgt->phy = phyp;
3227 phyp->target = tgt;
3229 mutex_exit(&tgt->statlock);
3230 return (tgt);
3259 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
3266 tgt = ddi_soft_state_bystr_get(iport->tgt_sstate, unit_address);
3267 ASSERT(tgt != NULL);
3268 STAILQ_INIT(&tgt->wq);
3269 STAILQ_INIT(&tgt->aq);
3270 STAILQ_INIT(&tgt->sq);
3271 mutex_init(&tgt->statlock, NULL, MUTEX_DRIVER,
3273 mutex_init(&tgt->wqlock, NULL, MUTEX_DRIVER,
3275 mutex_init(&tgt->aqlock, NULL, MUTEX_DRIVER,
3277 cv_init(&tgt->reset_cv, NULL, CV_DRIVER, NULL);
3278 cv_init(&tgt->abort_cv, NULL, CV_DRIVER, NULL);
3279 list_create(&tgt->lun_list, sizeof (pmcs_lun_t),
3281 tgt->qdepth = 1;
3282 tgt->target_num = PMCS_INVALID_TARGET_NUM;
3283 bcopy(unit_address, tgt->unit_address, PMCS_MAX_UA_SIZE);
3284 tgt->pwp = pwp;
3285 tgt->ua = strdup(iport->ua);
3286 tgt->phy = phyp;
3287 ASSERT((phyp->target == NULL) || (phyp->target == tgt));
3289 phyp->target = tgt;
3296 return (tgt);
3299 if (ddi_soft_state_bystr_init(&tgt->lun_sstate,
3301 pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, phyp, tgt,
3308 return (tgt);