Lines Matching +full:powered +full:- +full:while +full:- +full:suspended

147  *	of all paths. Set it to -1 to disable discovery of all paths.
171 static uint_t mdi_pathmap_instance = 1; /* 0 -> any path */
174 static mod_hash_t *mdi_pathmap_bypath; /* "path"->instance */
175 static mod_hash_t *mdi_pathmap_byinstance; /* instance->"path" */
176 static mod_hash_t *mdi_pathmap_sbyinstance; /* inst->shortpath */
181 const char *mdi_component_prop = "mpxio-component";
189 const char *mdi_client_guid_prop = "client-guid";
194 const char *mdi_load_balance = "load-balance";
196 const char *mdi_load_balance_rr = "round-robin";
197 const char *mdi_load_balance_lba = "logical-block";
335 /* Allocate ['path_instance' <-> "path"] maps */ in i_mdi_init()
356 * XXX This doesn't work under multi-level MPxIO and should be
362 return (DEVI(dip)->devi_mdi_component); in mdi_get_component_type()
388 ASSERT(vops->vo_revision <= MDI_VHCI_OPS_REV); in mdi_vhci_register()
411 for (vh = mdi_vhci_head; vh != NULL; vh = vh->vh_next) { in mdi_vhci_register()
412 if (strcmp(vh->vh_class, class) == 0) { in mdi_vhci_register()
418 if (vh->vh_ops != NULL) { in mdi_vhci_register()
440 vh->vh_client_table = hash; in mdi_vhci_register()
441 vh->vh_class = kmem_zalloc(strlen(class) + 1, KM_SLEEP); in mdi_vhci_register()
442 (void) strcpy(vh->vh_class, class); in mdi_vhci_register()
443 vh->vh_lb = LOAD_BALANCE_RR; in mdi_vhci_register()
447 vh->vh_lb = LOAD_BALANCE_NONE; in mdi_vhci_register()
450 vh->vh_lb = LOAD_BALANCE_LBA; in mdi_vhci_register()
455 mutex_init(&vh->vh_phci_mutex, NULL, MUTEX_DEFAULT, NULL); in mdi_vhci_register()
456 mutex_init(&vh->vh_client_mutex, NULL, MUTEX_DEFAULT, NULL); in mdi_vhci_register()
461 vh->vh_dip = vdip; in mdi_vhci_register()
462 vh->vh_ops = vops; in mdi_vhci_register()
470 mdi_vhci_tail->vh_next = vh; in mdi_vhci_register()
479 DEVI(vdip)->devi_mdi_component |= MDI_COMPONENT_VHCI; in mdi_vhci_register()
484 DEVI(vdip)->devi_mdi_xhci = (caddr_t)vh; in mdi_vhci_register()
516 for (found = mdi_vhci_head; found != NULL; found = found->vh_next) { in mdi_vhci_unregister()
533 if (vh->vh_refcnt || vh->vh_phci_count || vh->vh_client_count) { in mdi_vhci_unregister()
549 mdi_vhci_head = vh->vh_next; in mdi_vhci_unregister()
551 prev->vh_next = vh->vh_next; in mdi_vhci_unregister()
556 mdi_vhci_count--; in mdi_vhci_unregister()
559 vh->vh_ops = NULL; in mdi_vhci_unregister()
560 DEVI(vdip)->devi_mdi_component &= ~MDI_COMPONENT_VHCI; in mdi_vhci_unregister()
561 DEVI(vdip)->devi_mdi_xhci = NULL; in mdi_vhci_unregister()
562 kmem_free(vh->vh_class, strlen(vh->vh_class)+1); in mdi_vhci_unregister()
563 kmem_free(vh->vh_client_table, in mdi_vhci_unregister()
565 mutex_destroy(&vh->vh_phci_mutex); in mdi_vhci_unregister()
566 mutex_destroy(&vh->vh_client_mutex); in mdi_vhci_unregister()
587 for (vh = mdi_vhci_head; vh != NULL; vh = vh->vh_next) { in i_mdi_vhci_class2vhci()
588 if (strcmp(vh->vh_class, class) == 0) { in i_mdi_vhci_class2vhci()
608 vh = (mdi_vhci_t *)DEVI(vdip)->devi_mdi_xhci; in i_devi_get_vhci()
634 * different thread than the one doing the pHCI attach(9E) - the in mdi_phci_register()
643 * Check for mpxio-disable property. Enable mpxio if the property is in mdi_phci_register()
647 if ((ddi_prop_lookup_string(DDI_DEV_T_ANY, pdip, 0, "mpxio-disable", in mdi_phci_register()
668 mutex_init(&ph->ph_mutex, NULL, MUTEX_DEFAULT, NULL); in mdi_phci_register()
669 ph->ph_dip = pdip; in mdi_phci_register()
670 ph->ph_vhci = vh; in mdi_phci_register()
671 ph->ph_next = NULL; in mdi_phci_register()
672 ph->ph_unstable = 0; in mdi_phci_register()
673 ph->ph_vprivate = 0; in mdi_phci_register()
674 cv_init(&ph->ph_unstable_cv, NULL, CV_DRIVER, NULL); in mdi_phci_register()
679 DEVI(pdip)->devi_mdi_component |= MDI_COMPONENT_PHCI; in mdi_phci_register()
680 DEVI(pdip)->devi_mdi_xhci = (caddr_t)ph; in mdi_phci_register()
682 vhcache_phci_add(vh->vh_config, ph); in mdi_phci_register()
685 if (vh->vh_phci_head == NULL) { in mdi_phci_register()
686 vh->vh_phci_head = ph; in mdi_phci_register()
688 if (vh->vh_phci_tail) { in mdi_phci_register()
689 vh->vh_phci_tail->ph_next = ph; in mdi_phci_register()
691 vh->vh_phci_tail = ph; in mdi_phci_register()
692 vh->vh_phci_count++; in mdi_phci_register()
727 vh = ph->ph_vhci; in mdi_phci_unregister()
735 tmp = vh->vh_phci_head; in mdi_phci_unregister()
736 while (tmp) { in mdi_phci_unregister()
741 tmp = tmp->ph_next; in mdi_phci_unregister()
744 if (ph == vh->vh_phci_head) { in mdi_phci_unregister()
745 vh->vh_phci_head = ph->ph_next; in mdi_phci_unregister()
747 prev->ph_next = ph->ph_next; in mdi_phci_unregister()
750 if (ph == vh->vh_phci_tail) { in mdi_phci_unregister()
751 vh->vh_phci_tail = prev; in mdi_phci_unregister()
754 vh->vh_phci_count--; in mdi_phci_unregister()
759 for (pip = (mdi_pathinfo_t *)ph->ph_path_head; pip; in mdi_phci_unregister()
760 pip = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link) in mdi_phci_unregister()
761 MDI_PI(pip)->pi_phci = NULL; in mdi_phci_unregister()
764 i_mdi_log_sysevent(pdip, ph->ph_vhci->vh_class, in mdi_phci_unregister()
766 vhcache_phci_remove(vh->vh_config, ph); in mdi_phci_unregister()
767 cv_destroy(&ph->ph_unstable_cv); in mdi_phci_unregister()
768 mutex_destroy(&ph->ph_mutex); in mdi_phci_unregister()
770 DEVI(pdip)->devi_mdi_component &= ~MDI_COMPONENT_PHCI; in mdi_phci_unregister()
771 DEVI(pdip)->devi_mdi_xhci = NULL; in mdi_phci_unregister()
785 ph = (mdi_phci_t *)DEVI(pdip)->devi_mdi_xhci; in i_devi_get_phci()
815 * occurred - this is OK because we know that the framework thread in mdi_devi_enter()
941 if (ph && ph->ph_vhci) in mdi_devi_get_vdip()
942 return (ph->ph_vhci->vh_dip); in mdi_devi_get_vdip()
962 ph = vh->vh_phci_head; in mdi_devi_pdip_entered()
963 while (ph) { in mdi_devi_pdip_entered()
964 if (ph->ph_dip && DEVI_BUSY_OWNED(ph->ph_dip)) { in mdi_devi_pdip_entered()
968 ph = ph->ph_next; in mdi_devi_pdip_entered()
999 ph = vh->vh_phci_head; in mdi_phci_path2devinfo()
1000 while (ph != NULL) { in mdi_phci_path2devinfo()
1001 pdip = ph->ph_dip; in mdi_phci_path2devinfo()
1008 ph = ph->ph_next; in mdi_phci_path2devinfo()
1031 count = ph->ph_path_count; in mdi_phci_get_path_count()
1053 while (MDI_PHCI_TRYLOCK(ph) == 0) { in i_mdi_phci_lock()
1113 ndi_devi_alloc_sleep(vh->vh_dip, name, DEVI_SID_NODEID, &cdip); in i_mdi_devinfo_create()
1157 ndi_devi_enter(vh->vh_dip); in i_mdi_devinfo_find()
1158 ndip = (dev_info_t *)DEVI(vh->vh_dip)->devi_child; in i_mdi_devinfo_find()
1159 while ((cdip = ndip) != NULL) { in i_mdi_devinfo_find()
1160 ndip = (dev_info_t *)DEVI(cdip)->devi_sibling; in i_mdi_devinfo_find()
1162 if (strcmp(DEVI(cdip)->devi_node_name, name)) { in i_mdi_devinfo_find()
1179 ndi_devi_exit(vh->vh_dip); in i_mdi_devinfo_find()
1227 ct = (mdi_client_t *)DEVI(cdip)->devi_mdi_client; in i_devi_get_client()
1243 dip = DEVI(vdip)->devi_child; in i_mdi_is_child_present()
1244 while (dip) { in i_mdi_is_child_present()
1249 dip = dip->devi_sibling; in i_mdi_is_child_present()
1275 while (MDI_CLIENT_TRYLOCK(ct) == 0) { in i_mdi_client_lock()
1329 mutex_init(&ct->ct_mutex, NULL, MUTEX_DEFAULT, NULL); in i_mdi_client_alloc()
1330 ct->ct_hnext = NULL; in i_mdi_client_alloc()
1331 ct->ct_hprev = NULL; in i_mdi_client_alloc()
1332 ct->ct_dip = NULL; in i_mdi_client_alloc()
1333 ct->ct_vhci = vh; in i_mdi_client_alloc()
1334 ct->ct_drvname = kmem_alloc(strlen(name) + 1, KM_SLEEP); in i_mdi_client_alloc()
1335 (void) strcpy(ct->ct_drvname, name); in i_mdi_client_alloc()
1336 ct->ct_guid = kmem_alloc(strlen(lguid) + 1, KM_SLEEP); in i_mdi_client_alloc()
1337 (void) strcpy(ct->ct_guid, lguid); in i_mdi_client_alloc()
1338 ct->ct_cprivate = NULL; in i_mdi_client_alloc()
1339 ct->ct_vprivate = NULL; in i_mdi_client_alloc()
1340 ct->ct_flags = 0; in i_mdi_client_alloc()
1341 ct->ct_state = MDI_CLIENT_STATE_FAILED; in i_mdi_client_alloc()
1347 ct->ct_failover_flags = 0; in i_mdi_client_alloc()
1348 ct->ct_failover_status = 0; in i_mdi_client_alloc()
1349 cv_init(&ct->ct_failover_cv, NULL, CV_DRIVER, NULL); in i_mdi_client_alloc()
1350 ct->ct_unstable = 0; in i_mdi_client_alloc()
1351 cv_init(&ct->ct_unstable_cv, NULL, CV_DRIVER, NULL); in i_mdi_client_alloc()
1352 cv_init(&ct->ct_powerchange_cv, NULL, CV_DRIVER, NULL); in i_mdi_client_alloc()
1353 ct->ct_lb = vh->vh_lb; in i_mdi_client_alloc()
1354 ct->ct_lb_args = kmem_zalloc(sizeof (client_lb_args_t), KM_SLEEP); in i_mdi_client_alloc()
1355 ct->ct_lb_args->region_size = LOAD_BALANCE_DEFAULT_REGION_SIZE; in i_mdi_client_alloc()
1356 ct->ct_path_count = 0; in i_mdi_client_alloc()
1357 ct->ct_path_head = NULL; in i_mdi_client_alloc()
1358 ct->ct_path_tail = NULL; in i_mdi_client_alloc()
1359 ct->ct_path_last = NULL; in i_mdi_client_alloc()
1381 index = i_mdi_get_hash_key(ct->ct_guid); in i_mdi_client_enlist_table()
1382 head = &vh->vh_client_table[index]; in i_mdi_client_enlist_table()
1383 ct->ct_hnext = (mdi_client_t *)head->ct_hash_head; in i_mdi_client_enlist_table()
1384 head->ct_hash_head = ct; in i_mdi_client_enlist_table()
1385 head->ct_hash_count++; in i_mdi_client_enlist_table()
1386 vh->vh_client_count++; in i_mdi_client_enlist_table()
1405 guid = ct->ct_guid; in i_mdi_client_delist_table()
1407 head = &vh->vh_client_table[index]; in i_mdi_client_delist_table()
1410 next = (mdi_client_t *)head->ct_hash_head; in i_mdi_client_delist_table()
1411 while (next != NULL) { in i_mdi_client_delist_table()
1416 next = next->ct_hnext; in i_mdi_client_delist_table()
1420 head->ct_hash_count--; in i_mdi_client_delist_table()
1422 head->ct_hash_head = ct->ct_hnext; in i_mdi_client_delist_table()
1424 last->ct_hnext = ct->ct_hnext; in i_mdi_client_delist_table()
1426 ct->ct_hnext = NULL; in i_mdi_client_delist_table()
1427 vh->vh_client_count--; in i_mdi_client_delist_table()
1440 int flags = ct->ct_flags; in i_mdi_client_free()
1446 vdip = vh->vh_dip; in i_mdi_client_free()
1447 cdip = ct->ct_dip; in i_mdi_client_free()
1450 DEVI(cdip)->devi_mdi_component &= ~MDI_COMPONENT_CLIENT; in i_mdi_client_free()
1451 DEVI(cdip)->devi_mdi_client = NULL; in i_mdi_client_free()
1456 ct->ct_dip = NULL; in i_mdi_client_free()
1466 kmem_free(ct->ct_drvname, strlen(ct->ct_drvname) + 1); in i_mdi_client_free()
1467 kmem_free(ct->ct_guid, strlen(ct->ct_guid) + 1); in i_mdi_client_free()
1468 kmem_free(ct->ct_lb_args, sizeof (client_lb_args_t)); in i_mdi_client_free()
1469 cv_destroy(&ct->ct_failover_cv); in i_mdi_client_free()
1470 cv_destroy(&ct->ct_unstable_cv); in i_mdi_client_free()
1471 cv_destroy(&ct->ct_powerchange_cv); in i_mdi_client_free()
1472 mutex_destroy(&ct->ct_mutex); in i_mdi_client_free()
1497 head = &vh->vh_client_table[index]; in i_mdi_client_find()
1499 ct = head->ct_hash_head; in i_mdi_client_find()
1500 while (ct != NULL) { in i_mdi_client_find()
1501 if (strcmp(ct->ct_guid, guid) == 0 && in i_mdi_client_find()
1502 (cname == NULL || strcmp(ct->ct_drvname, cname) == 0)) { in i_mdi_client_find()
1505 ct = ct->ct_hnext; in i_mdi_client_find()
1516 * MDI_CLIENT_STATE_OPTIMAL - Client in optimal state with more
1518 * MDI_CLIENT_STATE_DEGRADED - Client device in degraded state with
1521 * MDI_CLIENT_STATE_FAILED - Client device in failed state with
1539 * while computing the new value. Used by
1552 pip = ct->ct_path_head; in i_mdi_client_compute_state()
1553 while (pip != NULL) { in i_mdi_client_compute_state()
1555 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in i_mdi_client_compute_state()
1556 if (MDI_PI(pip)->pi_phci == ph) { in i_mdi_client_compute_state()
1562 if ((MDI_PI(pip)->pi_state & MDI_PATHINFO_STATE_MASK) in i_mdi_client_compute_state()
1565 else if ((MDI_PI(pip)->pi_state & MDI_PATHINFO_STATE_MASK) in i_mdi_client_compute_state()
1575 MDI_DEBUG(2, (MDI_NOTE, ct->ct_dip, in i_mdi_client_compute_state()
1601 return (ct->ct_dip); in i_mdi_client2devinfo()
1625 ndip = (dev_info_t *)DEVI(vdip)->devi_child; in mdi_client_path2devinfo()
1626 while ((cdip = ndip) != NULL) { in mdi_client_path2devinfo()
1627 ndip = (dev_info_t *)DEVI(cdip)->devi_sibling; in mdi_client_path2devinfo()
1660 count = ct->ct_path_count; in mdi_client_get_path_count()
1681 return (hash % (CLIENT_HASH_TABLE_SIZE - 1)); in i_mdi_get_hash_key()
1696 lb = ct->ct_lb; in mdi_get_lb_policy()
1703 * Set current region size for the load-balance
1712 if (ct != NULL && ct->ct_lb_args != NULL) { in mdi_set_lb_region_size()
1713 ct->ct_lb_args->region_size = region_size; in mdi_set_lb_region_size()
1731 ct->ct_lb = lb; in mdi_set_lb_policy()
1746 * a failover operation. This is typically due to non-availability
1812 * We do not allow failovers to progress while client path state in mdi_failover()
1815 if (ct->ct_unstable) { in mdi_failover()
1820 while (ct->ct_unstable) in mdi_failover()
1821 cv_wait(&ct->ct_unstable_cv, &ct->ct_mutex); in mdi_failover()
1842 ct->ct_failover_flags = flags; in mdi_failover()
1876 mdi_vhci_t *vh = ct->ct_vhci; in i_mdi_failover()
1880 if (vh->vh_ops->vo_failover != NULL) { in i_mdi_failover()
1884 rv = (*vh->vh_ops->vo_failover)(vh->vh_dip, ct->ct_dip, in i_mdi_failover()
1885 ct->ct_failover_flags); in i_mdi_failover()
1894 ct->ct_failover_status = rv; in i_mdi_failover()
1903 cv_broadcast(&ct->ct_failover_cv); in i_mdi_failover()
1912 * performance by cache-hit on some of the RAID devices.
1915 * If no paths are found then default to round-robin.
1920 int path_index = -1; in i_mdi_lba_lb()
1923 int region_size = ct->ct_lb_args->region_size; in i_mdi_lba_lb()
1928 pip = ct->ct_path_head; in i_mdi_lba_lb()
1929 while (pip) { in i_mdi_lba_lb()
1931 if (MDI_PI(pip)->pi_state == in i_mdi_lba_lb()
1932 MDI_PATHINFO_STATE_ONLINE && MDI_PI(pip)->pi_preferred) { in i_mdi_lba_lb()
1934 } else if (MDI_PI(pip)->pi_state == in i_mdi_lba_lb()
1935 MDI_PATHINFO_STATE_ONLINE && !MDI_PI(pip)->pi_preferred) { in i_mdi_lba_lb()
1939 MDI_PI(pip)->pi_client_link; in i_mdi_lba_lb()
1954 path_index = (bp->b_blkno >> region_size) % path_cnt; in i_mdi_lba_lb()
1955 pip = ct->ct_path_head; in i_mdi_lba_lb()
1956 while (pip && path_index != -1) { in i_mdi_lba_lb()
1959 (MDI_PI(pip)->pi_state == in i_mdi_lba_lb()
1961 MDI_PI(pip)->pi_preferred == preferred) { in i_mdi_lba_lb()
1967 path_index --; in i_mdi_lba_lb()
1969 MDI_PI(pip)->pi_client_link; in i_mdi_lba_lb()
1973 MDI_DEBUG(4, (MDI_NOTE, ct->ct_dip, in i_mdi_lba_lb()
1975 bp->b_lblkno, mdi_pi_spathname(pip), (void *)pip)); in i_mdi_lba_lb()
2015 * The non-standard behavior is used by the scsi_vhci driver,
2026 * MDI_SUCCESS - Completed successfully
2027 * MDI_BUSY - Client device is busy failing over
2028 * MDI_NOPATH - Client device is online, but no valid path are
2030 * MDI_FAILURE - Invalid client device or state
2032 * - Client device (struct dev_info state) is in
2120 head = ct->ct_path_head; in mdi_select_path()
2131 pip = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link) in mdi_select_path()
2151 if ((MDI_PI(pip)->pi_state == MDI_PATHINFO_STATE_INIT) || in mdi_select_path()
2152 (MDI_PI(pip)->pi_phci == NULL)) { in mdi_select_path()
2182 lbp = sb ? ct->ct_lb : LOAD_BALANCE_RR; in mdi_select_path()
2192 pip = (mdi_pathinfo_t *)ct->ct_path_last; in mdi_select_path()
2204 if ((MDI_PI(pip)->pi_state == in mdi_select_path()
2206 preferred == MDI_PI(pip)->pi_preferred) { in mdi_select_path()
2213 ct->ct_path_last = pip; in mdi_select_path()
2228 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in mdi_select_path()
2239 } while (cont); in mdi_select_path()
2249 if ((ct->ct_lb_args != NULL) && in mdi_select_path()
2250 (ct->ct_lb_args->region_size) && bp && in mdi_select_path()
2271 preferred = MDI_PI(start_pip)->pi_preferred; in mdi_select_path()
2276 start = sb ? (mdi_pathinfo_t *)ct->ct_path_last : start_pip; in mdi_select_path()
2280 pip = (mdi_pathinfo_t *)MDI_PI(start)->pi_client_link; in mdi_select_path()
2317 cond = ((MDI_PI(pip)->pi_state == in mdi_select_path()
2319 MDI_PI(pip)->pi_preferred == in mdi_select_path()
2323 cond = ((MDI_PI(pip)->pi_state == in mdi_select_path()
2325 MDI_PI(pip)->pi_preferred == in mdi_select_path()
2328 cond = ((MDI_PI(pip)->pi_state == in mdi_select_path()
2330 MDI_PI(pip)->pi_preferred == in mdi_select_path()
2334 cond = (((MDI_PI(pip)->pi_state == in mdi_select_path()
2336 (MDI_PI(pip)->pi_state == in mdi_select_path()
2338 MDI_PI(pip)->pi_preferred == in mdi_select_path()
2344 cond = (((MDI_PI(pip)->pi_state == in mdi_select_path()
2346 (MDI_PI(pip)->pi_state == in mdi_select_path()
2348 (MDI_PI(pip)->pi_state == in mdi_select_path()
2351 (MDI_PI(pip)->pi_state == in mdi_select_path()
2354 MDI_PI(pip)->pi_preferred == in mdi_select_path()
2360 cond = (((MDI_PI(pip)->pi_state == in mdi_select_path()
2362 (MDI_PI(pip)->pi_state == in mdi_select_path()
2382 ct->ct_path_last = pip; in mdi_select_path()
2398 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in mdi_select_path()
2422 * Non-preferred. Bail out now. in mdi_select_path()
2442 * non-preferred path in the following in mdi_select_path()
2445 * +------+ +------+ +------+ +-----+ in mdi_select_path()
2446 * | A : 1| - | B : 1| - | C : 0| - |NULL | in mdi_select_path()
2447 * +------+ +------+ +------+ +-----+ in mdi_select_path()
2450 * skip beyond B to pick C which is non - in mdi_select_path()
2457 (MDI_PI(start_pip)->pi_preferred in mdi_select_path()
2480 } while (cont); in mdi_select_path()
2521 ct = (mdi_client_t *)DEVI(ct_dip)->devi_mdi_client; in mdi_get_next_phci_path()
2525 return ((mdi_pathinfo_t *)ct->ct_path_head); in mdi_get_next_phci_path()
2527 return ((mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link); in mdi_get_next_phci_path()
2545 ph = (mdi_phci_t *)DEVI(ph_dip)->devi_mdi_xhci; in mdi_get_next_client_path()
2549 return ((mdi_pathinfo_t *)ph->ph_path_head); in mdi_get_next_client_path()
2551 return ((mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link); in mdi_get_next_client_path()
2585 if (MDI_PI(pip)->pi_ref_cnt == 0) { in mdi_rele_path()
2586 cv_broadcast(&MDI_PI(pip)->pi_ref_cv); in mdi_rele_path()
2657 vh = ph->ph_vhci; in mdi_pi_find()
2681 pip = (mdi_pathinfo_t *)ph->ph_path_head; in mdi_pi_find()
2683 while (pip != NULL) { in mdi_pi_find()
2684 if (strcmp(MDI_PI(pip)->pi_addr, paddr) == 0) { in mdi_pi_find()
2687 pip = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in mdi_pi_find()
2696 * XXX - Is the rest of the code in this function really necessary? in mdi_pi_find()
2709 * XXX - Passing NULL to the following function works as long as the in mdi_pi_find()
2732 * respect the locking order while acquiring. in mdi_pi_find()
2736 pip = (mdi_pathinfo_t *)ct->ct_path_head; in mdi_pi_find()
2737 while (pip != NULL) { in mdi_pi_find()
2741 if ((MDI_PI(pip)->pi_phci == ph) && in mdi_pi_find()
2742 strcmp(MDI_PI(pip)->pi_addr, paddr) == 0) { in mdi_pi_find()
2745 pip = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in mdi_pi_find()
2766 * contexts. DDI_NOSLEEP flag should be used while calling
2816 vh = ph->ph_vhci; in mdi_pi_alloc_compatible()
2828 * offline/suspended states in mdi_pi_alloc_compatible()
2846 if (ct->ct_dip == NULL) { in mdi_pi_alloc_compatible()
2850 ct->ct_dip = i_mdi_devinfo_create(vh, cname, caddr, in mdi_pi_alloc_compatible()
2852 if (ct->ct_dip == NULL) { in mdi_pi_alloc_compatible()
2857 cdip = ct->ct_dip; in mdi_pi_alloc_compatible()
2859 DEVI(cdip)->devi_mdi_component |= MDI_COMPONENT_CLIENT; in mdi_pi_alloc_compatible()
2860 DEVI(cdip)->devi_mdi_client = (caddr_t)ct; in mdi_pi_alloc_compatible()
2863 pip = (mdi_pathinfo_t *)ct->ct_path_head; in mdi_pi_alloc_compatible()
2864 while (pip != NULL) { in mdi_pi_alloc_compatible()
2868 if ((MDI_PI(pip)->pi_phci == ph) && in mdi_pi_alloc_compatible()
2869 strcmp(MDI_PI(pip)->pi_addr, paddr) == 0) { in mdi_pi_alloc_compatible()
2872 pip = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in mdi_pi_alloc_compatible()
2905 vhcache_pi_add(vh->vh_config, MDI_PI(pip)); in mdi_pi_alloc_compatible()
2935 ASSERT(MDI_VHCI_CLIENT_LOCKED(ph->ph_vhci)); in i_mdi_pi_alloc()
2938 mutex_init(&MDI_PI(pip)->pi_mutex, NULL, MUTEX_DEFAULT, NULL); in i_mdi_pi_alloc()
2939 MDI_PI(pip)->pi_state = MDI_PATHINFO_STATE_INIT | in i_mdi_pi_alloc()
2951 MDI_PI(pip)->pi_old_state = MDI_PATHINFO_STATE_INIT; in i_mdi_pi_alloc()
2952 cv_init(&MDI_PI(pip)->pi_state_cv, NULL, CV_DEFAULT, NULL); in i_mdi_pi_alloc()
2953 MDI_PI(pip)->pi_client = ct; in i_mdi_pi_alloc()
2954 MDI_PI(pip)->pi_phci = ph; in i_mdi_pi_alloc()
2955 MDI_PI(pip)->pi_addr = kmem_alloc(strlen(paddr) + 1, KM_SLEEP); in i_mdi_pi_alloc()
2956 (void) strcpy(MDI_PI(pip)->pi_addr, paddr); in i_mdi_pi_alloc()
2968 (void) ddi_pathname(ph->ph_dip, path); in i_mdi_pi_alloc()
2986 ddi_driver_name(ph->ph_dip), ddi_get_instance(ph->ph_dip), in i_mdi_pi_alloc()
2994 MDI_PI(pip)->pi_path_instance = path_instance; in i_mdi_pi_alloc()
2996 (void) nvlist_alloc(&MDI_PI(pip)->pi_prop, NV_UNIQUE_NAME, KM_SLEEP); in i_mdi_pi_alloc()
2997 ASSERT(MDI_PI(pip)->pi_prop != NULL); in i_mdi_pi_alloc()
2998 MDI_PI(pip)->pi_pprivate = NULL; in i_mdi_pi_alloc()
2999 MDI_PI(pip)->pi_cprivate = NULL; in i_mdi_pi_alloc()
3000 MDI_PI(pip)->pi_vprivate = NULL; in i_mdi_pi_alloc()
3001 MDI_PI(pip)->pi_client_link = NULL; in i_mdi_pi_alloc()
3002 MDI_PI(pip)->pi_phci_link = NULL; in i_mdi_pi_alloc()
3003 MDI_PI(pip)->pi_ref_cnt = 0; in i_mdi_pi_alloc()
3004 MDI_PI(pip)->pi_kstats = NULL; in i_mdi_pi_alloc()
3005 MDI_PI(pip)->pi_preferred = 1; in i_mdi_pi_alloc()
3006 cv_init(&MDI_PI(pip)->pi_ref_cv, NULL, CV_DEFAULT, NULL); in i_mdi_pi_alloc()
3016 ndi_devi_enter(ct->ct_dip); in i_mdi_pi_alloc()
3017 ndi_devi_enter(ph->ph_dip); in i_mdi_pi_alloc()
3022 ndi_devi_exit(ph->ph_dip); in i_mdi_pi_alloc()
3023 ndi_devi_exit(ct->ct_dip); in i_mdi_pi_alloc()
3077 * Caller should per-pHCI mutex
3082 ASSERT(DEVI_BUSY_OWNED(ph->ph_dip)); in i_mdi_phci_add_path()
3085 if (ph->ph_path_head == NULL) { in i_mdi_phci_add_path()
3086 ph->ph_path_head = pip; in i_mdi_phci_add_path()
3088 MDI_PI(ph->ph_path_tail)->pi_phci_link = MDI_PI(pip); in i_mdi_phci_add_path()
3090 ph->ph_path_tail = pip; in i_mdi_phci_add_path()
3091 ph->ph_path_count++; in i_mdi_phci_add_path()
3102 ASSERT(DEVI_BUSY_OWNED(ct->ct_dip)); in i_mdi_client_add_path()
3105 if (ct->ct_path_head == NULL) { in i_mdi_client_add_path()
3106 ct->ct_path_head = pip; in i_mdi_client_add_path()
3108 MDI_PI(ct->ct_path_tail)->pi_client_link = MDI_PI(pip); in i_mdi_client_add_path()
3110 ct->ct_path_tail = pip; in i_mdi_client_add_path()
3111 ct->ct_path_count++; in i_mdi_client_add_path()
3136 ph = MDI_PI(pip)->pi_phci; in mdi_pi_free()
3149 vh = ph->ph_vhci; in mdi_pi_free()
3153 MDI_DEBUG(1, (MDI_WARN, ph->ph_dip, in mdi_pi_free()
3160 ct = MDI_PI(pip)->pi_client; in mdi_pi_free()
3166 MDI_DEBUG(1, (MDI_WARN, ph->ph_dip, in mdi_pi_free()
3183 MDI_DEBUG(1, (MDI_WARN, ct->ct_dip, in mdi_pi_free()
3189 while (MDI_PI(pip)->pi_ref_cnt != 0) { in mdi_pi_free()
3193 MDI_DEBUG(1, (MDI_NOTE, ct->ct_dip, in mdi_pi_free()
3195 MDI_PI(pip)->pi_ref_cnt, in mdi_pi_free()
3197 if (cv_reltimedwait(&MDI_PI(pip)->pi_ref_cv, in mdi_pi_free()
3198 &MDI_PI(pip)->pi_mutex, drv_usectohz(60 * 1000000), in mdi_pi_free()
3199 TR_CLOCK_TICK) == -1) { in mdi_pi_free()
3204 MDI_DEBUG(1, (MDI_NOTE, ct->ct_dip, in mdi_pi_free()
3207 MDI_DEBUG(1, (MDI_NOTE, ct->ct_dip, in mdi_pi_free()
3209 MDI_PI(pip)->pi_ref_cnt, in mdi_pi_free()
3215 if (MDI_PI(pip)->pi_pm_held) { in mdi_pi_free()
3220 vhcache_pi_remove(vh->vh_config, MDI_PI(pip)); in mdi_pi_free()
3230 while (MDI_CLIENT_IS_FAILOVER_IN_PROGRESS(ct)) in mdi_pi_free()
3231 cv_wait(&ct->ct_failover_cv, &ct->ct_mutex); in mdi_pi_free()
3240 f = vh->vh_ops->vo_pi_uninit; in mdi_pi_free()
3242 rv = (*f)(vh->vh_dip, pip, 0); in mdi_pi_free()
3251 MDI_DEBUG(4, (MDI_NOTE, ct->ct_dip, in mdi_pi_free()
3256 if (ct->ct_path_count == 0) { in mdi_pi_free()
3262 (void) i_mdi_client_free(ct->ct_vhci, ct); in mdi_pi_free()
3271 vhcache_pi_add(vh->vh_config, MDI_PI(pip)); in mdi_pi_free()
3286 * remove any per-path kstats in i_mdi_pi_free()
3291 ndi_devi_enter(ct->ct_dip); in i_mdi_pi_free()
3292 ndi_devi_enter(ph->ph_dip); in i_mdi_pi_free()
3297 ndi_devi_exit(ph->ph_dip); in i_mdi_pi_free()
3298 ndi_devi_exit(ct->ct_dip); in i_mdi_pi_free()
3300 mutex_destroy(&MDI_PI(pip)->pi_mutex); in i_mdi_pi_free()
3301 cv_destroy(&MDI_PI(pip)->pi_state_cv); in i_mdi_pi_free()
3302 cv_destroy(&MDI_PI(pip)->pi_ref_cv); in i_mdi_pi_free()
3303 if (MDI_PI(pip)->pi_addr) { in i_mdi_pi_free()
3304 kmem_free(MDI_PI(pip)->pi_addr, in i_mdi_pi_free()
3305 strlen(MDI_PI(pip)->pi_addr) + 1); in i_mdi_pi_free()
3306 MDI_PI(pip)->pi_addr = NULL; in i_mdi_pi_free()
3309 if (MDI_PI(pip)->pi_prop) { in i_mdi_pi_free()
3310 (void) nvlist_free(MDI_PI(pip)->pi_prop); in i_mdi_pi_free()
3311 MDI_PI(pip)->pi_prop = NULL; in i_mdi_pi_free()
3321 * Caller should hold per-pHCI mutex
3329 ASSERT(DEVI_BUSY_OWNED(ph->ph_dip)); in i_mdi_phci_remove_path()
3332 path = ph->ph_path_head; in i_mdi_phci_remove_path()
3333 while (path != NULL) { in i_mdi_phci_remove_path()
3338 path = (mdi_pathinfo_t *)MDI_PI(path)->pi_phci_link; in i_mdi_phci_remove_path()
3342 ph->ph_path_count--; in i_mdi_phci_remove_path()
3344 MDI_PI(prev)->pi_phci_link = MDI_PI(path)->pi_phci_link; in i_mdi_phci_remove_path()
3346 ph->ph_path_head = in i_mdi_phci_remove_path()
3347 (mdi_pathinfo_t *)MDI_PI(path)->pi_phci_link; in i_mdi_phci_remove_path()
3349 if (ph->ph_path_tail == path) { in i_mdi_phci_remove_path()
3350 ph->ph_path_tail = prev; in i_mdi_phci_remove_path()
3357 MDI_PI(pip)->pi_phci_link = NULL; in i_mdi_phci_remove_path()
3358 MDI_PI(pip)->pi_phci = NULL; in i_mdi_phci_remove_path()
3372 ASSERT(DEVI_BUSY_OWNED(ct->ct_dip)); in i_mdi_client_remove_path()
3375 path = ct->ct_path_head; in i_mdi_client_remove_path()
3376 while (path != NULL) { in i_mdi_client_remove_path()
3381 path = (mdi_pathinfo_t *)MDI_PI(path)->pi_client_link; in i_mdi_client_remove_path()
3385 ct->ct_path_count--; in i_mdi_client_remove_path()
3387 MDI_PI(prev)->pi_client_link = in i_mdi_client_remove_path()
3388 MDI_PI(path)->pi_client_link; in i_mdi_client_remove_path()
3390 ct->ct_path_head = in i_mdi_client_remove_path()
3391 (mdi_pathinfo_t *)MDI_PI(path)->pi_client_link; in i_mdi_client_remove_path()
3393 if (ct->ct_path_tail == path) { in i_mdi_client_remove_path()
3394 ct->ct_path_tail = prev; in i_mdi_client_remove_path()
3396 if (ct->ct_path_last == path) { in i_mdi_client_remove_path()
3397 ct->ct_path_last = ct->ct_path_head; in i_mdi_client_remove_path()
3400 MDI_PI(pip)->pi_client_link = NULL; in i_mdi_client_remove_path()
3401 MDI_PI(pip)->pi_client = NULL; in i_mdi_client_remove_path()
3425 ph = MDI_PI(pip)->pi_phci; in i_mdi_pi_state_change()
3438 vh = ph->ph_vhci; in i_mdi_pi_state_change()
3445 MDI_DEBUG(1, (MDI_WARN, ph->ph_dip, in i_mdi_pi_state_change()
3451 ct = MDI_PI(pip)->pi_client; in i_mdi_pi_state_change()
3458 MDI_DEBUG(1, (MDI_WARN, ph->ph_dip, in i_mdi_pi_state_change()
3471 f = vh->vh_ops->vo_pi_init; in i_mdi_pi_state_change()
3473 rv = (*f)(vh->vh_dip, pip, 0); in i_mdi_pi_state_change()
3475 MDI_DEBUG(1, (MDI_WARN, ct->ct_dip, in i_mdi_pi_state_change()
3487 * Do not allow state transition when pHCI is in offline/suspended in i_mdi_pi_state_change()
3492 MDI_DEBUG(1, (MDI_WARN, ct->ct_dip, in i_mdi_pi_state_change()
3507 while (MDI_PI_IS_TRANSIENT(pip)) { in i_mdi_pi_state_change()
3508 cv_wait(&MDI_PI(pip)->pi_state_cv, in i_mdi_pi_state_change()
3509 &MDI_PI(pip)->pi_mutex); in i_mdi_pi_state_change()
3523 while (MDI_CLIENT_IS_FAILOVER_IN_PROGRESS(ct)) in i_mdi_pi_state_change()
3524 cv_wait(&ct->ct_failover_cv, &ct->ct_mutex); in i_mdi_pi_state_change()
3554 * If this is a user initiated path online->offline operation in i_mdi_pi_state_change()
3558 cdip = ct->ct_dip; in i_mdi_pi_state_change()
3602 f = vh->vh_ops->vo_pi_state_change; in i_mdi_pi_state_change()
3604 rv = (*f)(vh->vh_dip, pip, state, 0, flag); in i_mdi_pi_state_change()
3612 MDI_DEBUG(2, (MDI_WARN, ct->ct_dip, in i_mdi_pi_state_change()
3619 MDI_PI(pip)->pi_state = MDI_PI_OLD_STATE(pip); in i_mdi_pi_state_change()
3626 cv_broadcast(&MDI_PI(pip)->pi_state_cv); in i_mdi_pi_state_change()
3634 if (ct->ct_unstable == 0) { in i_mdi_pi_state_change()
3635 cdip = ct->ct_dip; in i_mdi_pi_state_change()
3673 * non-user initiated events. in i_mdi_pi_state_change()
3740 mdi_client_t *ct = MDI_PI(pip)->pi_client; in mdi_pi_online()
3750 if (MDI_PI(pip)->pi_pm_held == 0) { in mdi_pi_online()
3751 MDI_DEBUG(4, (MDI_NOTE, ct->ct_dip, in mdi_pi_online()
3760 if (ct->ct_power_cnt == 0) { in mdi_pi_online()
3764 MDI_DEBUG(4, (MDI_NOTE, ct->ct_dip, in mdi_pi_online()
3827 if (MDI_PI(pip)->pi_pm_held) { in mdi_pi_offline()
3833 ct = MDI_PI(pip)->pi_client; in mdi_pi_offline()
3835 MDI_DEBUG(4, (MDI_NOTE, ct->ct_dip, in mdi_pi_offline()
3859 ct = MDI_PI(pip)->pi_client; in i_mdi_pi_offline()
3862 while (MDI_PI(pip)->pi_ref_cnt != 0) { in i_mdi_pi_offline()
3866 MDI_DEBUG(1, (MDI_NOTE, ct->ct_dip, in i_mdi_pi_offline()
3868 MDI_PI(pip)->pi_ref_cnt, mdi_pi_spathname(pip), in i_mdi_pi_offline()
3870 if (cv_reltimedwait(&MDI_PI(pip)->pi_ref_cv, in i_mdi_pi_offline()
3871 &MDI_PI(pip)->pi_mutex, drv_usectohz(60 * 1000000), in i_mdi_pi_offline()
3872 TR_CLOCK_TICK) == -1) { in i_mdi_pi_offline()
3877 MDI_DEBUG(1, (MDI_NOTE, ct->ct_dip, in i_mdi_pi_offline()
3880 MDI_DEBUG(1, (MDI_NOTE, ct->ct_dip, in i_mdi_pi_offline()
3882 MDI_PI(pip)->pi_ref_cnt, in i_mdi_pi_offline()
3886 vh = ct->ct_vhci; in i_mdi_pi_offline()
3887 vdip = vh->vh_dip; in i_mdi_pi_offline()
3892 ASSERT(vh->vh_ops); in i_mdi_pi_offline()
3893 f = vh->vh_ops->vo_pi_state_change; in i_mdi_pi_offline()
3900 MDI_DEBUG(1, (MDI_WARN, ct->ct_dip, in i_mdi_pi_offline()
3912 cv_broadcast(&MDI_PI(pip)->pi_state_cv); in i_mdi_pi_offline()
3917 if (ct->ct_unstable == 0) { in i_mdi_pi_offline()
3918 dev_info_t *cdip = ct->ct_dip; in i_mdi_pi_offline()
3972 MDI_DEBUG(2, (MDI_NOTE, ct->ct_dip, in i_mdi_pi_offline()
3991 ph = MDI_PI(pip)->pi_phci; in i_mdi_pi_online()
3992 vh = ph->ph_vhci; in i_mdi_pi_online()
3993 ct = MDI_PI(pip)->pi_client; in i_mdi_pi_online()
3996 f = vh->vh_ops->vo_pi_state_change; in i_mdi_pi_online()
3999 rv = (*f)(vh->vh_dip, pip, MDI_PATHINFO_STATE_ONLINE, 0, flags); in i_mdi_pi_online()
4002 cv_broadcast(&MDI_PI(pip)->pi_state_cv); in i_mdi_pi_online()
4005 dev_info_t *cdip = ct->ct_dip; in i_mdi_pi_online()
4022 MDI_PI(pip)->pi_state = in i_mdi_pi_online()
4044 MDI_PI(pip)->pi_state = MDI_PI_OLD_STATE(pip); in i_mdi_pi_online()
4067 ct = MDI_PI(pip)->pi_client; in mdi_pi_get_node_name()
4068 if ((ct == NULL) || (ct->ct_dip == NULL)) in mdi_pi_get_node_name()
4070 return (ddi_node_name(ct->ct_dip)); in mdi_pi_get_node_name()
4086 return (MDI_PI(pip)->pi_addr); in mdi_pi_get_addr()
4102 return (MDI_PI(pip)->pi_path_instance); in mdi_pi_get_path_instance()
4143 if (mdi_prop_lookup_string(pip, "obp-path", &obp_path) == MDI_SUCCESS) { in mdi_pi_pathname_obp()
4176 rc = mdi_prop_update_string(pip, "obp-path", obp_path); in mdi_pi_pathname_obp_set()
4195 dip = MDI_PI(pip)->pi_client->ct_dip; in mdi_pi_get_client()
4213 ph = MDI_PI(pip)->pi_phci; in mdi_pi_get_phci()
4215 dip = ph->ph_dip; in mdi_pi_get_phci()
4230 cprivate = MDI_PI(pip)->pi_cprivate; in mdi_pi_get_client_private()
4243 MDI_PI(pip)->pi_cprivate = priv; in mdi_pi_set_client_private()
4258 pprivate = MDI_PI(pip)->pi_pprivate; in mdi_pi_get_phci_private()
4271 MDI_PI(pip)->pi_pprivate = priv; in mdi_pi_set_phci_private()
4306 return (pip ? MDI_PI(pip)->pi_flags : 0); in mdi_pi_get_flags()
4343 return (MDI_PI(pip)->pi_preferred); in mdi_pi_get_preferred()
4356 MDI_PI(pip)->pi_preferred = preferred; in mdi_pi_set_preferred()
4370 ext_state = MDI_PI(pip)->pi_state & MDI_PATHINFO_EXT_STATE_MASK; in mdi_pi_set_state()
4371 MDI_PI(pip)->pi_state = state; in mdi_pi_set_state()
4372 MDI_PI(pip)->pi_state |= ext_state; in mdi_pi_set_state()
4414 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_pi_get_next_prop()
4418 return (nvlist_next_nvpair(MDI_PI(pip)->pi_prop, prev)); in mdi_pi_get_next_prop()
4433 if (MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_remove()
4438 (void) nvlist_remove_all(MDI_PI(pip)->pi_prop, name); in mdi_prop_remove()
4442 nvp = nvlist_next_nvpair(MDI_PI(pip)->pi_prop, NULL); in mdi_prop_remove()
4443 while (nvp) { in mdi_prop_remove()
4445 next = nvlist_next_nvpair(MDI_PI(pip)->pi_prop, nvp); in mdi_prop_remove()
4448 (void) nvlist_remove_all(MDI_PI(pip)->pi_prop, in mdi_prop_remove()
4470 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_prop_size()
4474 rv = nvlist_size(MDI_PI(pip)->pi_prop, in mdi_prop_size()
4491 if ((pip == NULL) || MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_pack()
4498 rv = nvlist_pack(MDI_PI(pip)->pi_prop, bufp, (size_t *)&bufsize, in mdi_prop_pack()
4518 if (MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_update_byte()
4522 rv = nvlist_add_byte(MDI_PI(pip)->pi_prop, name, data); in mdi_prop_update_byte()
4542 if (MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_update_byte_array()
4546 rv = nvlist_add_byte_array(MDI_PI(pip)->pi_prop, name, data, nelements); in mdi_prop_update_byte_array()
4565 if (MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_update_int()
4569 rv = nvlist_add_int32(MDI_PI(pip)->pi_prop, name, (int32_t)data); in mdi_prop_update_int()
4588 if (MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_update_int64()
4592 rv = nvlist_add_int64(MDI_PI(pip)->pi_prop, name, data); in mdi_prop_update_int64()
4612 if (MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_update_int_array()
4616 rv = nvlist_add_int32_array(MDI_PI(pip)->pi_prop, name, (int32_t *)data, in mdi_prop_update_int_array()
4636 if (MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_update_string()
4640 rv = nvlist_add_string(MDI_PI(pip)->pi_prop, name, data); in mdi_prop_update_string()
4660 if (MDI_PI(pip)->pi_prop == NULL) { in mdi_prop_update_string_array()
4664 rv = nvlist_add_string_array(MDI_PI(pip)->pi_prop, name, data, in mdi_prop_update_string_array()
4681 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_prop_lookup_byte()
4684 rv = nvlist_lookup_byte(MDI_PI(pip)->pi_prop, name, data); in mdi_prop_lookup_byte()
4701 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_prop_lookup_byte_array()
4704 rv = nvlist_lookup_byte_array(MDI_PI(pip)->pi_prop, name, data, in mdi_prop_lookup_byte_array()
4720 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_prop_lookup_int()
4723 rv = nvlist_lookup_int32(MDI_PI(pip)->pi_prop, name, (int32_t *)data); in mdi_prop_lookup_int()
4737 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_prop_lookup_int64()
4740 rv = nvlist_lookup_int64(MDI_PI(pip)->pi_prop, name, data); in mdi_prop_lookup_int64()
4756 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_prop_lookup_int_array()
4759 rv = nvlist_lookup_int32_array(MDI_PI(pip)->pi_prop, name, in mdi_prop_lookup_int_array()
4775 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_prop_lookup_string()
4778 rv = nvlist_lookup_string(MDI_PI(pip)->pi_prop, name, data); in mdi_prop_lookup_string()
4794 if ((pip == NULL) || (MDI_PI(pip)->pi_prop == NULL)) { in mdi_prop_lookup_string_array()
4797 rv = nvlist_lookup_string_array(MDI_PI(pip)->pi_prop, name, data, in mdi_prop_lookup_string_array()
4823 dev_info_t *cdip = ct->ct_dip; in i_mdi_report_path_state()
4828 if ((cdip == NULL) || (ddi_get_instance(cdip) == -1) || in i_mdi_report_path_state()
4869 if (ct->ct_lb == LOAD_BALANCE_LBA) { in i_mdi_report_path_state()
4871 "%s, region-size: %d", mdi_load_balance_lba, in i_mdi_report_path_state()
4872 ct->ct_lb_args->region_size); in i_mdi_report_path_state()
4873 } else if (ct->ct_lb == LOAD_BALANCE_NONE) { in i_mdi_report_path_state()
5021 ASSERT((ct->ct_dip == NULL) || (ct->ct_dip == ct_dip)); in i_mdi_client_online()
5022 ct->ct_dip = ct_dip; in i_mdi_client_online()
5024 if (ct->ct_power_cnt == 0) in i_mdi_client_online()
5141 if (ph->ph_unstable) { in i_mdi_phci_offline()
5150 pip = ph->ph_path_head; in i_mdi_phci_offline()
5151 while (pip != NULL) { in i_mdi_phci_offline()
5153 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in i_mdi_phci_offline()
5159 ct = MDI_PI(pip)->pi_client; in i_mdi_phci_offline()
5162 (ct->ct_unstable)) { in i_mdi_phci_offline()
5181 cdip = ct->ct_dip; in i_mdi_phci_offline()
5213 pip = ph->ph_path_head; in i_mdi_phci_offline()
5214 while (pip != failed_pip) { in i_mdi_phci_offline()
5216 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in i_mdi_phci_offline()
5217 ct = MDI_PI(pip)->pi_client; in i_mdi_phci_offline()
5219 cdip = ct->ct_dip; in i_mdi_phci_offline()
5263 pip = ph->ph_path_head; in i_mdi_phci_offline()
5264 while (pip != NULL) { in i_mdi_phci_offline()
5266 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in i_mdi_phci_offline()
5277 pip = ph->ph_path_head; in i_mdi_phci_offline()
5278 while (pip != NULL) { in i_mdi_phci_offline()
5279 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in i_mdi_phci_offline()
5282 ct = MDI_PI(pip)->pi_client; in i_mdi_phci_offline()
5326 pip = ph->ph_path_head; in mdi_phci_mark_retiring()
5327 while (pip != NULL) { in mdi_phci_mark_retiring()
5329 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in mdi_phci_mark_retiring()
5331 ct = MDI_PI(pip)->pi_client; in mdi_phci_mark_retiring()
5335 cdip = ct->ct_dip; in mdi_phci_mark_retiring()
5380 if (ph->ph_unstable) { in mdi_phci_retire_notify()
5387 pip = ph->ph_path_head; in mdi_phci_retire_notify()
5388 while (pip != NULL) { in mdi_phci_retire_notify()
5390 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in mdi_phci_retire_notify()
5396 ct = MDI_PI(pip)->pi_client; in mdi_phci_retire_notify()
5399 (ct->ct_unstable)) { in mdi_phci_retire_notify()
5415 cdip = ct->ct_dip; in mdi_phci_retire_notify()
5476 if (ph->ph_unstable) { in mdi_phci_retire_finalize()
5480 pip = ph->ph_path_head; in mdi_phci_retire_finalize()
5481 while (pip != NULL) { in mdi_phci_retire_finalize()
5483 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in mdi_phci_retire_finalize()
5488 ct = MDI_PI(pip)->pi_client; in mdi_phci_retire_finalize()
5491 (ct->ct_unstable)) { in mdi_phci_retire_finalize()
5500 cdip = ct->ct_dip; in mdi_phci_retire_finalize()
5514 * path - MPXIO will then fail all I/Os to the client). in mdi_phci_retire_finalize()
5554 pip = ph->ph_path_head; in mdi_phci_retire_finalize()
5555 while (pip != NULL) { in mdi_phci_retire_finalize()
5557 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in mdi_phci_retire_finalize()
5568 pip = ph->ph_path_head; in mdi_phci_retire_finalize()
5569 while (pip != NULL) { in mdi_phci_retire_finalize()
5570 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in mdi_phci_retire_finalize()
5573 ct = MDI_PI(pip)->pi_client; in mdi_phci_retire_finalize()
5608 pip = ph->ph_path_head; in mdi_phci_unretire()
5609 while (pip != NULL) { in mdi_phci_unretire()
5611 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in mdi_phci_unretire()
5636 if (ct->ct_unstable) { in i_mdi_client_offline()
5667 ct->ct_dip = NULL; in i_mdi_client_offline()
5683 if ((DEVI(dip)->devi_mdi_component != MDI_COMPONENT_NONE) && in mdi_pre_attach()
5762 vh = ct->ct_vhci; in mdi_post_attach()
5763 if (vh->vh_ops->vo_client_attached) in mdi_post_attach()
5764 (*vh->vh_ops->vo_client_attached)(dip); in mdi_post_attach()
5845 * pHCI is getting suspended. Since mpxio client in i_mdi_phci_pre_detach()
5846 * devices may not be suspended at this point, to avoid in i_mdi_phci_pre_detach()
5848 * client devices before pHCI can be suspended. in i_mdi_phci_pre_detach()
5856 pip = ph->ph_path_head; in i_mdi_phci_pre_detach()
5857 while (pip != NULL && rv == DDI_SUCCESS) { in i_mdi_phci_pre_detach()
5861 (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in i_mdi_phci_pre_detach()
5862 ct = MDI_PI(pip)->pi_client; in i_mdi_phci_pre_detach()
5864 cdip = ct->ct_dip; in i_mdi_phci_pre_detach()
5896 * Revert back all the suspended client device states in i_mdi_phci_pre_detach()
5899 pip = ph->ph_path_head; in i_mdi_phci_pre_detach()
5900 while (pip != failed_pip) { in i_mdi_phci_pre_detach()
5904 (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in i_mdi_phci_pre_detach()
5905 ct = MDI_PI(pip)->pi_client; in i_mdi_phci_pre_detach()
5907 cdip = ct->ct_dip; in i_mdi_phci_pre_detach()
6048 i_mdi_pm_rele_client(ct, ct->ct_path_count); in i_mdi_client_post_detach()
6074 return (MDI_PI(pip)->pi_kstats ? 1 : 0); in mdi_pi_kstat_exists()
6078 * create and install per-path (client - pHCI) statistics
6080 * Error stats - hard errors, soft errors, & transport errors
6089 if (MDI_PI(pip)->pi_kstats != NULL) in mdi_pi_kstat_create()
6106 nsp = (struct pi_errs *)kerrsp->ks_data; in mdi_pi_kstat_create()
6107 kstat_named_init(&nsp->pi_softerrs, "Soft Errors", KSTAT_DATA_UINT32); in mdi_pi_kstat_create()
6108 kstat_named_init(&nsp->pi_harderrs, "Hard Errors", KSTAT_DATA_UINT32); in mdi_pi_kstat_create()
6109 kstat_named_init(&nsp->pi_transerrs, "Transport Errors", in mdi_pi_kstat_create()
6111 kstat_named_init(&nsp->pi_icnt_busy, "Interconnect Busy", in mdi_pi_kstat_create()
6113 kstat_named_init(&nsp->pi_icnt_errors, "Interconnect Errors", in mdi_pi_kstat_create()
6115 kstat_named_init(&nsp->pi_phci_rsrc, "pHCI No Resources", in mdi_pi_kstat_create()
6117 kstat_named_init(&nsp->pi_phci_localerr, "pHCI Local Errors", in mdi_pi_kstat_create()
6119 kstat_named_init(&nsp->pi_phci_invstate, "pHCI Invalid State", in mdi_pi_kstat_create()
6121 kstat_named_init(&nsp->pi_failedfrom, "Failed From", in mdi_pi_kstat_create()
6123 kstat_named_init(&nsp->pi_failedto, "Failed To", KSTAT_DATA_UINT32); in mdi_pi_kstat_create()
6126 mdi_statp->pi_kstat_ref = 1; in mdi_pi_kstat_create()
6127 mdi_statp->pi_kstat_iostats = kiosp; in mdi_pi_kstat_create()
6128 mdi_statp->pi_kstat_errstats = kerrsp; in mdi_pi_kstat_create()
6131 MDI_PI(pip)->pi_kstats = mdi_statp; in mdi_pi_kstat_create()
6136 * destroy per-path properties
6144 if (MDI_PI(pip)->pi_kstats == NULL) in i_mdi_pi_kstat_destroy()
6146 if ((mdi_statp = MDI_PI(pip)->pi_kstats) == NULL) in i_mdi_pi_kstat_destroy()
6149 MDI_PI(pip)->pi_kstats = NULL; in i_mdi_pi_kstat_destroy()
6156 ASSERT(mdi_statp->pi_kstat_ref > 0); in i_mdi_pi_kstat_destroy()
6157 if (--mdi_statp->pi_kstat_ref != 0) in i_mdi_pi_kstat_destroy()
6160 kstat_delete(mdi_statp->pi_kstat_iostats); in i_mdi_pi_kstat_destroy()
6161 kstat_delete(mdi_statp->pi_kstat_errstats); in i_mdi_pi_kstat_destroy()
6180 if (bp != NULL && MDI_PI(pip)->pi_kstats != NULL) { in mdi_pi_kstat_iosupdate()
6181 iostatp = MDI_PI(pip)->pi_kstats->pi_kstat_iostats; in mdi_pi_kstat_iosupdate()
6182 xfer_cnt = bp->b_bcount - bp->b_resid; in mdi_pi_kstat_iosupdate()
6183 if (bp->b_flags & B_READ) { in mdi_pi_kstat_iosupdate()
6184 KSTAT_IO_PTR(iostatp)->reads++; in mdi_pi_kstat_iosupdate()
6185 KSTAT_IO_PTR(iostatp)->nread += xfer_cnt; in mdi_pi_kstat_iosupdate()
6187 KSTAT_IO_PTR(iostatp)->writes++; in mdi_pi_kstat_iosupdate()
6188 KSTAT_IO_PTR(iostatp)->nwritten += xfer_cnt; in mdi_pi_kstat_iosupdate()
6203 ph = MDI_PI(pip)->pi_phci; in mdi_pi_enable_path()
6211 (void) i_mdi_enable_disable_path(pip, ph->ph_vhci, flags, in mdi_pi_enable_path()
6213 MDI_DEBUG(5, (MDI_NOTE, ph->ph_dip, in mdi_pi_enable_path()
6230 ph = MDI_PI(pip)->pi_phci; in mdi_pi_disable_path()
6239 ph->ph_vhci, flags, MDI_DISABLE_OP); in mdi_pi_disable_path()
6240 MDI_DEBUG(5, (MDI_NOTE, ph->ph_dip, in mdi_pi_disable_path()
6295 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in i_mdi_enable_disable_path()
6300 f = vh->vh_ops->vo_pi_state_change; in i_mdi_enable_disable_path()
6310 rv = (*f)(vh->vh_dip, pip, 0, in i_mdi_enable_disable_path()
6315 MDI_DEBUG(2, (MDI_WARN, vh->vh_dip, in i_mdi_enable_disable_path()
6320 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_phci_link; in i_mdi_enable_disable_path()
6351 rv = (*f)(vh->vh_dip, pip, 0, in i_mdi_enable_disable_path()
6356 MDI_DEBUG(2, (MDI_WARN, vh->vh_dip, in i_mdi_enable_disable_path()
6394 vh = ph->ph_vhci; in i_mdi_pi_enable_disable()
6435 pip = ph->ph_path_head; in i_mdi_pi_enable_disable()
6436 while (pip != NULL) { in i_mdi_pi_enable_disable()
6453 pip = ct->ct_path_head; in i_mdi_pi_enable_disable()
6455 while (pip != NULL) { in i_mdi_pi_enable_disable()
6457 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in i_mdi_pi_enable_disable()
6458 if (MDI_PI(pip)->pi_phci == ph) { in i_mdi_pi_enable_disable()
6485 * Ensure phci powered up
6495 if (MDI_PI(pip)->pi_pm_held) { in i_mdi_pm_hold_pip()
6508 DEVI(ph_dip)->devi_pm_kidsupcnt)); in i_mdi_pm_hold_pip()
6511 DEVI(ph_dip)->devi_pm_kidsupcnt)); in i_mdi_pm_hold_pip()
6515 if (DEVI(ph_dip)->devi_pm_info) in i_mdi_pm_hold_pip()
6516 MDI_PI(pip)->pi_pm_held = 1; in i_mdi_pm_hold_pip()
6520 * Allow phci powered down
6530 if (MDI_PI(pip)->pi_pm_held == 0) { in i_mdi_pm_rele_pip()
6542 "kidsupcnt was %d", DEVI(ph_dip)->devi_pm_kidsupcnt)); in i_mdi_pm_rele_pip()
6545 "kidsupcnt is %d", DEVI(ph_dip)->devi_pm_kidsupcnt)); in i_mdi_pm_rele_pip()
6548 MDI_PI(pip)->pi_pm_held = 0; in i_mdi_pm_rele_pip()
6556 ct->ct_power_cnt += incr; in i_mdi_pm_hold_client()
6557 MDI_DEBUG(4, (MDI_NOTE, ct->ct_dip, in i_mdi_pm_hold_client()
6559 (void *)ct, ct->ct_power_cnt, incr)); in i_mdi_pm_hold_client()
6560 ASSERT(ct->ct_power_cnt >= 0); in i_mdi_pm_hold_client()
6569 pip = (mdi_pathinfo_t *)ct->ct_path_head; in i_mdi_rele_all_phci()
6570 while (pip != NULL) { in i_mdi_rele_all_phci()
6576 pip = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in i_mdi_rele_all_phci()
6585 if (i_ddi_devi_attached(ct->ct_dip)) { in i_mdi_pm_rele_client()
6586 ct->ct_power_cnt -= decr; in i_mdi_pm_rele_client()
6587 MDI_DEBUG(4, (MDI_NOTE, ct->ct_dip, in i_mdi_pm_rele_client()
6589 (void *)ct, ct->ct_power_cnt, decr)); in i_mdi_pm_rele_client()
6592 ASSERT(ct->ct_power_cnt >= 0); in i_mdi_pm_rele_client()
6593 if (ct->ct_power_cnt == 0) { in i_mdi_pm_rele_client()
6602 MDI_DEBUG(4, (MDI_NOTE, ct->ct_dip, in i_mdi_pm_reset_client()
6603 "%p ct_power_cnt = %d", (void *)ct, ct->ct_power_cnt)); in i_mdi_pm_reset_client()
6605 ct->ct_power_cnt = 0; in i_mdi_pm_reset_client()
6607 ct->ct_powercnt_config = 0; in i_mdi_pm_reset_client()
6608 ct->ct_powercnt_unconfig = 0; in i_mdi_pm_reset_client()
6609 ct->ct_powercnt_reset = 1; in i_mdi_pm_reset_client()
6653 pip = (mdi_pathinfo_t *)ct->ct_path_head; in i_mdi_power_all_phci()
6654 while (pip != NULL) { in i_mdi_power_all_phci()
6666 ASSERT(ct == MDI_PI(pip)->pi_client); in i_mdi_power_all_phci()
6670 pip = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in i_mdi_power_all_phci()
6678 * 1. Place the phci(s) into powered up state so that
6680 * 2. Ensure phci powered up as client power managing
6709 cdip = bpc->bpc_dip; in mdi_bus_power()
6713 cdip = bphc->bphc_dip; in mdi_bus_power()
6731 MDI_DEBUG(4, (MDI_NOTE, bpc->bpc_dip, in mdi_bus_power()
6734 ddi_node_name(bpc->bpc_dip), PM_ADDR(bpc->bpc_dip), in mdi_bus_power()
6735 bpc->bpc_olevel, bpc->bpc_nlevel, bpc->bpc_comp)); in mdi_bus_power()
6738 while (MDI_CLIENT_IS_POWER_TRANSITION(ct)) in mdi_bus_power()
6739 cv_wait(&ct->ct_powerchange_cv, &ct->ct_mutex); in mdi_bus_power()
6743 if (ct->ct_power_cnt == 0) { in mdi_bus_power()
6749 * - hold phci(s) in mdi_bus_power()
6750 * - power up phci(s) if not already in mdi_bus_power()
6753 if (bpc->bpc_nlevel > 0) { in mdi_bus_power()
6754 if (!DEVI_IS_ATTACHING(ct->ct_dip)) { in mdi_bus_power()
6755 MDI_DEBUG(4, (MDI_NOTE, bpc->bpc_dip, in mdi_bus_power()
6757 i_mdi_pm_hold_client(ct, ct->ct_path_count); in mdi_bus_power()
6762 MDI_DEBUG(4, (MDI_NOTE, bpc->bpc_dip, in mdi_bus_power()
6765 ddi_node_name(bpc->bpc_dip), PM_ADDR(bpc->bpc_dip), in mdi_bus_power()
6766 bpc->bpc_olevel, bpc->bpc_nlevel, bpc->bpc_comp, in mdi_bus_power()
6770 if (bpc->bpc_nlevel > 0) { in mdi_bus_power()
6777 /* release the hold we did in pre-notification */ in mdi_bus_power()
6778 if (bpc->bpc_nlevel > 0 && (*(int *)result != DDI_SUCCESS) && in mdi_bus_power()
6779 !DEVI_IS_ATTACHING(ct->ct_dip)) { in mdi_bus_power()
6780 MDI_DEBUG(4, (MDI_NOTE, bpc->bpc_dip, in mdi_bus_power()
6782 i_mdi_pm_rele_client(ct, ct->ct_path_count); in mdi_bus_power()
6785 if (bpc->bpc_nlevel == 0 && (*(int *)result == DDI_SUCCESS)) { in mdi_bus_power()
6787 if (DEVI_IS_ATTACHING(ct->ct_dip)) { in mdi_bus_power()
6788 MDI_DEBUG(4, (MDI_NOTE, bpc->bpc_dip, in mdi_bus_power()
6790 i_mdi_pm_rele_client(ct, ct->ct_path_count); in mdi_bus_power()
6792 } else if (!DEVI_IS_DETACHING(ct->ct_dip)) { in mdi_bus_power()
6793 MDI_DEBUG(4, (MDI_NOTE, bpc->bpc_dip, in mdi_bus_power()
6800 cv_broadcast(&ct->ct_powerchange_cv); in mdi_bus_power()
6806 MDI_DEBUG(4, (MDI_NOTE, bphc->bphc_dip, in mdi_bus_power()
6809 ddi_node_name(bphc->bphc_dip), PM_ADDR(bphc->bphc_dip), in mdi_bus_power()
6810 bphc->bphc_olevel, bphc->bphc_nlevel, bphc->bphc_comp)); in mdi_bus_power()
6812 if (bphc->bphc_nlevel > 0 && in mdi_bus_power()
6813 bphc->bphc_nlevel > bphc->bphc_olevel) { in mdi_bus_power()
6814 if (ct->ct_power_cnt == 0) { in mdi_bus_power()
6817 MDI_DEBUG(4, (MDI_NOTE, bphc->bphc_dip, in mdi_bus_power()
6819 i_mdi_pm_hold_client(ct, ct->ct_path_count); in mdi_bus_power()
6822 if (bphc->bphc_nlevel == 0 && bphc->bphc_olevel != -1) { in mdi_bus_power()
6823 MDI_DEBUG(4, (MDI_NOTE, bphc->bphc_dip, in mdi_bus_power()
6825 i_mdi_pm_rele_client(ct, ct->ct_path_count); in mdi_bus_power()
6849 while (MDI_CLIENT_IS_POWER_TRANSITION(ct)) in i_mdi_pm_pre_config_one()
6850 cv_wait(&ct->ct_powerchange_cv, &ct->ct_mutex); in i_mdi_pm_pre_config_one()
6858 if (ct->ct_powercnt_config) { in i_mdi_pm_pre_config_one()
6864 if (ct->ct_power_cnt == 0) { in i_mdi_pm_pre_config_one()
6868 i_mdi_pm_hold_client(ct, ct->ct_path_count); in i_mdi_pm_pre_config_one()
6869 ct->ct_powercnt_config = 1; in i_mdi_pm_pre_config_one()
6870 ct->ct_powercnt_reset = 0; in i_mdi_pm_pre_config_one()
6892 while (cdip) { in i_mdi_pm_pre_config()
6915 while (MDI_CLIENT_IS_POWER_TRANSITION(ct)) in i_mdi_pm_pre_unconfig_one()
6916 cv_wait(&ct->ct_powerchange_cv, &ct->ct_mutex); in i_mdi_pm_pre_unconfig_one()
6926 MDI_DEBUG(4, (MDI_NOTE, child, "auto-modunload\n")); in i_mdi_pm_pre_unconfig_one()
6931 if (ct->ct_powercnt_unconfig) { in i_mdi_pm_pre_unconfig_one()
6938 if (ct->ct_power_cnt == 0) { in i_mdi_pm_pre_unconfig_one()
6942 i_mdi_pm_hold_client(ct, ct->ct_path_count); in i_mdi_pm_pre_unconfig_one()
6943 ct->ct_powercnt_unconfig = 1; in i_mdi_pm_pre_unconfig_one()
6944 ct->ct_powercnt_reset = 0; in i_mdi_pm_pre_unconfig_one()
6970 while (cdip) { in i_mdi_pm_pre_unconfig()
6994 while (MDI_CLIENT_IS_POWER_TRANSITION(ct)) in i_mdi_pm_post_config_one()
6995 cv_wait(&ct->ct_powerchange_cv, &ct->ct_mutex); in i_mdi_pm_post_config_one()
6997 if (ct->ct_powercnt_reset || !ct->ct_powercnt_config) { in i_mdi_pm_post_config_one()
7010 /* another thread might have powered it down or detached it */ in i_mdi_pm_post_config_one()
7022 pip = ct->ct_path_head; in i_mdi_pm_post_config_one()
7023 while (pip != NULL) { in i_mdi_pm_post_config_one()
7025 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in i_mdi_pm_post_config_one()
7033 ct->ct_powercnt_config = 0; in i_mdi_pm_post_config_one()
7054 while (cdip) { in i_mdi_pm_post_config()
7073 while (MDI_CLIENT_IS_POWER_TRANSITION(ct)) in i_mdi_pm_post_unconfig_one()
7074 cv_wait(&ct->ct_powerchange_cv, &ct->ct_mutex); in i_mdi_pm_post_unconfig_one()
7076 if (!ct->ct_powercnt_unconfig || ct->ct_powercnt_reset) { in i_mdi_pm_post_unconfig_one()
7094 pip = ct->ct_path_head; in i_mdi_pm_post_unconfig_one()
7095 while (pip != NULL) { in i_mdi_pm_post_unconfig_one()
7097 next = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link; in i_mdi_pm_post_unconfig_one()
7104 ct->ct_powercnt_unconfig = 0; in i_mdi_pm_post_unconfig_one()
7130 while (cdip) { in i_mdi_pm_post_unconfig()
7190 if (ct->ct_power_cnt == 0) { in mdi_power()
7194 i_mdi_pm_hold_client(ct, ct->ct_path_count); in mdi_power()
7200 i_mdi_pm_rele_client(ct, ct->ct_path_count); in mdi_power()
7230 vhci = DEVI(dip)->devi_mdi_xhci; in mdi_component_is_vhci()
7232 *mdi_class = vhci->vh_class; in mdi_component_is_vhci()
7247 phci = DEVI(dip)->devi_mdi_xhci; in mdi_component_is_phci()
7249 *mdi_class = phci->ph_vhci->vh_class; in mdi_component_is_phci()
7264 client = DEVI(dip)->devi_mdi_client; in mdi_component_is_client()
7266 *mdi_class = client->ct_vhci->vh_class; in mdi_component_is_client()
7279 return (ct->ct_vprivate); in mdi_client_get_vhci_private()
7291 ct->ct_vprivate = data; in mdi_client_set_vhci_private()
7304 vprivate = MDI_PI(pip)->pi_vprivate; in mdi_pi_get_vhci_private()
7317 MDI_PI(pip)->pi_vprivate = priv; in mdi_pi_set_vhci_private()
7333 return (ph->ph_vprivate); in mdi_phci_get_vhci_private()
7349 ph->ph_vprivate = priv; in mdi_phci_set_vhci_private()
7373 for (pip = ct->ct_path_head; pip; in i_mdi_client_all_devices_removed()
7374 pip = (mdi_pathinfo_t *)MDI_PI(pip)->pi_client_link) { in i_mdi_client_all_devices_removed()
7405 ct = MDI_PI(pip)->pi_client; in mdi_pi_device_remove()
7406 if (ct && ct->ct_dip && i_mdi_client_all_devices_removed(ct)) in mdi_pi_device_remove()
7407 (void) ndi_devi_device_remove(ct->ct_dip); in mdi_pi_device_remove()
7445 * During boot time, the on-disk vhci cache for every vhci class is read
7457 * Given vhci class name, return its on-disk vhci cache filename.
7469 * fmt contains the on-disk vhci cache file name format; in vhclass2vhcache_filename()
7473 /* the -1 below is to account for "%s" in the format string */ in vhclass2vhcache_filename()
7474 len = strlen(fmt) + strlen(vhclass) - 1; in vhclass2vhcache_filename()
7482 * initialize the vhci cache related data structures and read the on-disk
7494 vh->vh_config = vhc; in setup_vhci_cache()
7495 vhcache = &vhc->vhc_vhcache; in setup_vhci_cache()
7497 vhc->vhc_vhcache_filename = vhclass2vhcache_filename(vh->vh_class); in setup_vhci_cache()
7499 mutex_init(&vhc->vhc_lock, NULL, MUTEX_DEFAULT, NULL); in setup_vhci_cache()
7500 cv_init(&vhc->vhc_cv, NULL, CV_DRIVER, NULL); in setup_vhci_cache()
7502 rw_init(&vhcache->vhcache_lock, NULL, RW_DRIVER, NULL); in setup_vhci_cache()
7508 vhcache->vhcache_client_hash = mod_hash_create_extended(vh->vh_class, in setup_vhci_cache()
7514 * The on-disk vhci cache is read during booting prior to the in setup_vhci_cache()
7515 * lights-out period by mdi_read_devices_files(). in setup_vhci_cache()
7518 if (strcmp(vhci_class_list[i], vh->vh_class) == 0) { in setup_vhci_cache()
7530 nvl = read_on_disk_vhci_cache(vh->vh_class); in setup_vhci_cache()
7533 rw_enter(&vhcache->vhcache_lock, RW_WRITER); in setup_vhci_cache()
7535 vhcache->vhcache_flags |= MDI_VHCI_CACHE_SETUP_DONE; in setup_vhci_cache()
7539 vhc->vhc_vhcache_filename); in setup_vhci_cache()
7541 rw_exit(&vhcache->vhcache_lock); in setup_vhci_cache()
7545 vhc->vhc_cbid = callb_add(stop_vhcache_flush_thread, vhc, in setup_vhci_cache()
7548 vhc->vhc_path_discovery_boot = mdi_path_discovery_boot; in setup_vhci_cache()
7549 vhc->vhc_path_discovery_postboot = mdi_path_discovery_postboot; in setup_vhci_cache()
7558 mdi_vhci_config_t *vhc = vh->vh_config; in destroy_vhci_cache()
7559 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in destroy_vhci_cache()
7567 kmem_free(vhc->vhc_vhcache_filename, in destroy_vhci_cache()
7568 strlen(vhc->vhc_vhcache_filename) + 1); in destroy_vhci_cache()
7570 mod_hash_destroy_strhash(vhcache->vhcache_client_hash); in destroy_vhci_cache()
7572 for (cphci = vhcache->vhcache_phci_head; cphci != NULL; in destroy_vhci_cache()
7574 cphci_next = cphci->cphci_next; in destroy_vhci_cache()
7578 for (cct = vhcache->vhcache_client_head; cct != NULL; cct = cct_next) { in destroy_vhci_cache()
7579 cct_next = cct->cct_next; in destroy_vhci_cache()
7580 for (cpi = cct->cct_cpi_head; cpi != NULL; cpi = cpi_next) { in destroy_vhci_cache()
7581 cpi_next = cpi->cpi_next; in destroy_vhci_cache()
7587 rw_destroy(&vhcache->vhcache_lock); in destroy_vhci_cache()
7589 mutex_destroy(&vhc->vhc_lock); in destroy_vhci_cache()
7590 cv_destroy(&vhc->vhc_cv); in destroy_vhci_cache()
7603 mutex_enter(&vhc->vhc_lock); in stop_vhcache_async_threads()
7604 vhc->vhc_flags |= MDI_VHC_EXIT; in stop_vhcache_async_threads()
7605 ASSERT(vhc->vhc_acc_thrcount >= 0); in stop_vhcache_async_threads()
7606 cv_broadcast(&vhc->vhc_cv); in stop_vhcache_async_threads()
7608 while ((vhc->vhc_flags & MDI_VHC_VHCACHE_FLUSH_THREAD) || in stop_vhcache_async_threads()
7609 vhc->vhc_acc_thrcount != 0) { in stop_vhcache_async_threads()
7610 mutex_exit(&vhc->vhc_lock); in stop_vhcache_async_threads()
7612 mutex_enter(&vhc->vhc_lock); in stop_vhcache_async_threads()
7615 vhc->vhc_flags &= ~MDI_VHC_EXIT; in stop_vhcache_async_threads()
7617 for (acc = vhc->vhc_acc_list_head; acc != NULL; acc = acc_next) { in stop_vhcache_async_threads()
7618 acc_next = acc->acc_next; in stop_vhcache_async_threads()
7621 vhc->vhc_acc_list_head = NULL; in stop_vhcache_async_threads()
7622 vhc->vhc_acc_list_tail = NULL; in stop_vhcache_async_threads()
7623 vhc->vhc_acc_count = 0; in stop_vhcache_async_threads()
7625 if (vhc->vhc_flags & MDI_VHC_VHCACHE_DIRTY) { in stop_vhcache_async_threads()
7626 vhc->vhc_flags &= ~MDI_VHC_VHCACHE_DIRTY; in stop_vhcache_async_threads()
7627 mutex_exit(&vhc->vhc_lock); in stop_vhcache_async_threads()
7633 mutex_exit(&vhc->vhc_lock); in stop_vhcache_async_threads()
7635 if (callb_delete(vhc->vhc_cbid) != 0) in stop_vhcache_async_threads()
7650 mutex_enter(&vhc->vhc_lock); in stop_vhcache_flush_thread()
7651 vhc->vhc_flags |= MDI_VHC_EXIT; in stop_vhcache_flush_thread()
7652 cv_broadcast(&vhc->vhc_cv); in stop_vhcache_flush_thread()
7654 while (vhc->vhc_flags & MDI_VHC_VHCACHE_FLUSH_THREAD) { in stop_vhcache_flush_thread()
7655 mutex_exit(&vhc->vhc_lock); in stop_vhcache_flush_thread()
7657 mutex_enter(&vhc->vhc_lock); in stop_vhcache_flush_thread()
7660 if (vhc->vhc_flags & MDI_VHC_VHCACHE_DIRTY) { in stop_vhcache_flush_thread()
7661 vhc->vhc_flags &= ~MDI_VHC_VHCACHE_DIRTY; in stop_vhcache_flush_thread()
7662 mutex_exit(&vhc->vhc_lock); in stop_vhcache_flush_thread()
7665 mutex_exit(&vhc->vhc_lock); in stop_vhcache_flush_thread()
7676 cphci->cphci_next = NULL; in enqueue_vhcache_phci()
7677 if (vhcache->vhcache_phci_head == NULL) in enqueue_vhcache_phci()
7678 vhcache->vhcache_phci_head = cphci; in enqueue_vhcache_phci()
7680 vhcache->vhcache_phci_tail->cphci_next = cphci; in enqueue_vhcache_phci()
7681 vhcache->vhcache_phci_tail = cphci; in enqueue_vhcache_phci()
7691 cpi->cpi_next = NULL; in enqueue_tail_vhcache_pathinfo()
7692 if (cct->cct_cpi_head == NULL) in enqueue_tail_vhcache_pathinfo()
7693 cct->cct_cpi_head = cpi; in enqueue_tail_vhcache_pathinfo()
7695 cct->cct_cpi_tail->cpi_next = cpi; in enqueue_tail_vhcache_pathinfo()
7696 cct->cct_cpi_tail = cpi; in enqueue_tail_vhcache_pathinfo()
7711 if (cct->cct_cpi_head == NULL || in enqueue_vhcache_pathinfo()
7712 (newcpi->cpi_flags & MDI_CPI_HINT_PATH_DOES_NOT_EXIST)) in enqueue_vhcache_pathinfo()
7715 for (cpi = cct->cct_cpi_head, prev_cpi = NULL; cpi != NULL && in enqueue_vhcache_pathinfo()
7716 !(cpi->cpi_flags & MDI_CPI_HINT_PATH_DOES_NOT_EXIST); in enqueue_vhcache_pathinfo()
7717 prev_cpi = cpi, cpi = cpi->cpi_next) in enqueue_vhcache_pathinfo()
7721 cct->cct_cpi_head = newcpi; in enqueue_vhcache_pathinfo()
7723 prev_cpi->cpi_next = newcpi; in enqueue_vhcache_pathinfo()
7725 newcpi->cpi_next = cpi; in enqueue_vhcache_pathinfo()
7728 cct->cct_cpi_tail = newcpi; in enqueue_vhcache_pathinfo()
7739 cct->cct_next = NULL; in enqueue_vhcache_client()
7740 if (vhcache->vhcache_client_head == NULL) in enqueue_vhcache_client()
7741 vhcache->vhcache_client_head = cct; in enqueue_vhcache_client()
7743 vhcache->vhcache_client_tail->cct_next = cct; in enqueue_vhcache_client()
7744 vhcache->vhcache_client_tail = cct; in enqueue_vhcache_client()
7764 kmem_free(cphci->cphci_path, strlen(cphci->cphci_path) + 1); in free_vhcache_phci()
7771 kmem_free(cpi->cpi_addr, strlen(cpi->cpi_addr) + 1); in free_vhcache_pathinfo()
7778 kmem_free(cct->cct_name_addr, strlen(cct->cct_name_addr) + 1); in free_vhcache_client()
7811 while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { in paddrnvl_to_vhcache()
7814 cpi->cpi_addr = i_ddi_strdup(nvpair_name(nvp), KM_SLEEP); in paddrnvl_to_vhcache()
7817 cpi->cpi_cphci = cphci_list[val[0]]; in paddrnvl_to_vhcache()
7818 cpi->cpi_flags = val[1]; in paddrnvl_to_vhcache()
7837 while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { in caddrmapnvl_to_vhcache()
7840 cct->cct_name_addr = i_ddi_strdup(nvpair_name(nvp), KM_SLEEP); in caddrmapnvl_to_vhcache()
7844 ASSERT(cct->cct_cpi_head != NULL); in caddrmapnvl_to_vhcache()
7847 (void) mod_hash_insert(vhcache->vhcache_client_hash, in caddrmapnvl_to_vhcache()
7848 (mod_hash_key_t)cct->cct_name_addr, (mod_hash_val_t)cct); in caddrmapnvl_to_vhcache()
7879 * pi_addr1 uint32_array (phci-id, cpi_flags)
7880 * pi_addr2 uint32_array (phci-id, cpi_flags)
7884 * phci-ids are integers that identify pHCIs to which the
7899 ASSERT(RW_WRITE_HELD(&vhcache->vhcache_lock)); in mainnvl_to_vhcache()
7915 cphci->cphci_path = i_ddi_strdup(*phci_namep, KM_SLEEP); in mainnvl_to_vhcache()
7920 ASSERT(vhcache->vhcache_phci_head != NULL); in mainnvl_to_vhcache()
7943 ASSERT(RW_LOCK_HELD(&vhcache->vhcache_lock)); in vhcache_to_paddrnvl()
7948 for (cpi = cct->cct_cpi_head; cpi != NULL; cpi = cpi->cpi_next) { in vhcache_to_paddrnvl()
7949 val[0] = cpi->cpi_cphci->cphci_id; in vhcache_to_paddrnvl()
7950 val[1] = cpi->cpi_flags; in vhcache_to_paddrnvl()
7951 if ((err = nvlist_add_uint32_array(nvl, cpi->cpi_addr, val, 2)) in vhcache_to_paddrnvl()
7956 err = nvlist_add_nvlist(caddrmapnvl, cct->cct_name_addr, nvl); in vhcache_to_paddrnvl()
7974 ASSERT(RW_LOCK_HELD(&vhcache->vhcache_lock)); in vhcache_to_caddrmapnvl()
7979 for (cct = vhcache->vhcache_client_head; cct != NULL; in vhcache_to_caddrmapnvl()
7980 cct = cct->cct_next) { in vhcache_to_caddrmapnvl()
8014 rw_enter(&vhcache->vhcache_lock, RW_READER); in vhcache_to_mainnvl()
8015 if (vhcache->vhcache_phci_head == NULL) { in vhcache_to_mainnvl()
8016 rw_exit(&vhcache->vhcache_lock); in vhcache_to_mainnvl()
8021 for (cphci = vhcache->vhcache_phci_head; cphci != NULL; in vhcache_to_mainnvl()
8022 cphci = cphci->cphci_next) in vhcache_to_mainnvl()
8023 cphci->cphci_id = phci_count++; in vhcache_to_mainnvl()
8027 for (cphci = vhcache->vhcache_phci_head, i = 0; cphci != NULL; in vhcache_to_mainnvl()
8028 cphci = cphci->cphci_next, i++) in vhcache_to_mainnvl()
8029 phcis[i] = i_ddi_strdup(cphci->cphci_path, KM_SLEEP); in vhcache_to_mainnvl()
8037 rw_exit(&vhcache->vhcache_lock); in vhcache_to_mainnvl()
8041 rw_exit(&vhcache->vhcache_lock); in vhcache_to_mainnvl()
8055 ASSERT(RW_LOCK_HELD(&vhcache->vhcache_lock)); in lookup_vhcache_phci_by_name()
8057 for (cphci = vhcache->vhcache_phci_head; cphci != NULL; in lookup_vhcache_phci_by_name()
8058 cphci = cphci->cphci_next) { in lookup_vhcache_phci_by_name()
8059 if (strcmp(cphci->cphci_path, phci_path) == 0) in lookup_vhcache_phci_by_name()
8074 ASSERT(RW_LOCK_HELD(&vhcache->vhcache_lock)); in lookup_vhcache_phci_by_addr()
8076 for (cphci = vhcache->vhcache_phci_head; cphci != NULL; in lookup_vhcache_phci_by_addr()
8077 cphci = cphci->cphci_next) { in lookup_vhcache_phci_by_addr()
8078 if (cphci->cphci_phci == ph) in lookup_vhcache_phci_by_addr()
8091 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in vhcache_phci_add()
8096 rw_enter(&vhcache->vhcache_lock, RW_WRITER); in vhcache_phci_add()
8099 (void) ddi_pathname(ph->ph_dip, pathname); in vhcache_phci_add()
8102 cphci->cphci_phci = ph; in vhcache_phci_add()
8106 cphci->cphci_path = i_ddi_strdup(pathname, KM_SLEEP); in vhcache_phci_add()
8107 cphci->cphci_phci = ph; in vhcache_phci_add()
8112 rw_exit(&vhcache->vhcache_lock); in vhcache_phci_add()
8119 mutex_enter(&vhc->vhc_lock); in vhcache_phci_add()
8120 vhc->vhc_path_discovery_cutoff_time = 0; in vhcache_phci_add()
8121 mutex_exit(&vhc->vhc_lock); in vhcache_phci_add()
8134 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in vhcache_phci_remove()
8137 rw_enter(&vhcache->vhcache_lock, RW_WRITER); in vhcache_phci_remove()
8140 cphci->cphci_phci = NULL; in vhcache_phci_remove()
8142 rw_exit(&vhcache->vhcache_lock); in vhcache_phci_remove()
8150 dst->lt_cct = NULL; in init_vhcache_lookup_token()
8151 dst->lt_cct_lookup_time = 0; in init_vhcache_lookup_token()
8153 dst->lt_cct = src->lt_cct; in init_vhcache_lookup_token()
8154 dst->lt_cct_lookup_time = src->lt_cct_lookup_time; in init_vhcache_lookup_token()
8169 ASSERT(RW_LOCK_HELD(&vhcache->vhcache_lock)); in lookup_vhcache_client()
8178 vhcache->vhcache_clean_time < token->lt_cct_lookup_time) in lookup_vhcache_client()
8179 return (token->lt_cct); in lookup_vhcache_client()
8182 if (mod_hash_find(vhcache->vhcache_client_hash, in lookup_vhcache_client()
8185 token->lt_cct = (mdi_vhcache_client_t *)hv; in lookup_vhcache_client()
8186 token->lt_cct_lookup_time = ddi_get_lbolt64(); in lookup_vhcache_client()
8190 token->lt_cct = NULL; in lookup_vhcache_client()
8191 token->lt_cct_lookup_time = 0; in lookup_vhcache_client()
8207 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in vhcache_pi_add()
8210 mdi_phci_t *ph = pip->pi_phci; in vhcache_pi_add()
8211 mdi_client_t *ct = pip->pi_client; in vhcache_pi_add()
8214 rw_enter(&vhcache->vhcache_lock, RW_WRITER); in vhcache_pi_add()
8217 if ((cct = lookup_vhcache_client(vhcache, ct->ct_drvname, ct->ct_guid, in vhcache_pi_add()
8220 cct->cct_name_addr = vhcache_mknameaddr(ct->ct_drvname, in vhcache_pi_add()
8221 ct->ct_guid, NULL); in vhcache_pi_add()
8223 (void) mod_hash_insert(vhcache->vhcache_client_hash, in vhcache_pi_add()
8224 (mod_hash_key_t)cct->cct_name_addr, (mod_hash_val_t)cct); in vhcache_pi_add()
8228 for (cpi = cct->cct_cpi_head; cpi != NULL; cpi = cpi->cpi_next) { in vhcache_pi_add()
8229 if (cpi->cpi_cphci->cphci_phci == ph && in vhcache_pi_add()
8230 strcmp(cpi->cpi_addr, pip->pi_addr) == 0) { in vhcache_pi_add()
8231 cpi->cpi_pip = pip; in vhcache_pi_add()
8232 if (cpi->cpi_flags & MDI_CPI_HINT_PATH_DOES_NOT_EXIST) { in vhcache_pi_add()
8233 cpi->cpi_flags &= in vhcache_pi_add()
8244 cpi->cpi_addr = i_ddi_strdup(pip->pi_addr, KM_SLEEP); in vhcache_pi_add()
8245 cpi->cpi_cphci = lookup_vhcache_phci_by_addr(vhcache, ph); in vhcache_pi_add()
8246 ASSERT(cpi->cpi_cphci != NULL); in vhcache_pi_add()
8247 cpi->cpi_pip = pip; in vhcache_pi_add()
8252 rw_exit(&vhcache->vhcache_lock); in vhcache_pi_add()
8264 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in vhcache_pi_remove()
8265 mdi_client_t *ct = pip->pi_client; in vhcache_pi_remove()
8269 rw_enter(&vhcache->vhcache_lock, RW_WRITER); in vhcache_pi_remove()
8270 if ((cct = lookup_vhcache_client(vhcache, ct->ct_drvname, ct->ct_guid, in vhcache_pi_remove()
8272 for (cpi = cct->cct_cpi_head; cpi != NULL; in vhcache_pi_remove()
8273 cpi = cpi->cpi_next) { in vhcache_pi_remove()
8274 if (cpi->cpi_pip == pip) { in vhcache_pi_remove()
8275 cpi->cpi_pip = NULL; in vhcache_pi_remove()
8280 rw_exit(&vhcache->vhcache_lock); in vhcache_pi_remove()
8303 if ((nvl = vhcache_to_mainnvl(&vhc->vhc_vhcache)) != NULL) { in flush_vhcache()
8304 err = fwrite_nvlist(vhc->vhc_vhcache_filename, nvl); in flush_vhcache()
8310 mutex_enter(&vhc->vhc_lock); in flush_vhcache()
8313 vhc->vhc_flags |= MDI_VHC_READONLY_FS; in flush_vhcache()
8314 vhc->vhc_flags &= ~(MDI_VHC_VHCACHE_FLUSH_ERROR | in flush_vhcache()
8317 if (!(vhc->vhc_flags & MDI_VHC_VHCACHE_FLUSH_ERROR)) { in flush_vhcache()
8319 vhc->vhc_vhcache_filename); in flush_vhcache()
8320 vhc->vhc_flags |= MDI_VHC_VHCACHE_FLUSH_ERROR; in flush_vhcache()
8324 } else if (vhc->vhc_flags & MDI_VHC_VHCACHE_FLUSH_ERROR) { in flush_vhcache()
8326 "%s: update now ok\n", vhc->vhc_vhcache_filename); in flush_vhcache()
8327 vhc->vhc_flags &= ~MDI_VHC_VHCACHE_FLUSH_ERROR; in flush_vhcache()
8329 mutex_exit(&vhc->vhc_lock); in flush_vhcache()
8348 CALLB_CPR_INIT(&cprinfo, &vhc->vhc_lock, callb_generic_cpr, in vhcache_flush_thread()
8350 mutex_enter(&vhc->vhc_lock); in vhcache_flush_thread()
8352 while (!(vhc->vhc_flags & MDI_VHC_EXIT) && in vhcache_flush_thread()
8353 (vhc->vhc_flags & MDI_VHC_VHCACHE_DIRTY)) { in vhcache_flush_thread()
8354 if (ddi_get_lbolt() < vhc->vhc_flush_at_ticks) { in vhcache_flush_thread()
8356 (void) cv_timedwait(&vhc->vhc_cv, in vhcache_flush_thread()
8357 &vhc->vhc_lock, vhc->vhc_flush_at_ticks); in vhcache_flush_thread()
8358 CALLB_CPR_SAFE_END(&cprinfo, &vhc->vhc_lock); in vhcache_flush_thread()
8360 vhc->vhc_flags &= ~MDI_VHC_VHCACHE_DIRTY; in vhcache_flush_thread()
8361 mutex_exit(&vhc->vhc_lock); in vhcache_flush_thread()
8366 mutex_enter(&vhc->vhc_lock); in vhcache_flush_thread()
8372 while (!(vhc->vhc_flags & MDI_VHC_EXIT) && in vhcache_flush_thread()
8373 !(vhc->vhc_flags & MDI_VHC_VHCACHE_DIRTY) && in vhcache_flush_thread()
8376 (void) cv_timedwait(&vhc->vhc_cv, &vhc->vhc_lock, in vhcache_flush_thread()
8378 CALLB_CPR_SAFE_END(&cprinfo, &vhc->vhc_lock); in vhcache_flush_thread()
8381 if ((vhc->vhc_flags & MDI_VHC_EXIT) || in vhcache_flush_thread()
8382 !(vhc->vhc_flags & MDI_VHC_VHCACHE_DIRTY)) in vhcache_flush_thread()
8387 vhc->vhc_flags &= ~MDI_VHC_VHCACHE_FLUSH_THREAD; in vhcache_flush_thread()
8388 /* CALLB_CPR_EXIT releases the vhc->vhc_lock */ in vhcache_flush_thread()
8398 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in vhcache_dirty()
8401 rw_enter(&vhcache->vhcache_lock, RW_READER); in vhcache_dirty()
8403 if (!(vhcache->vhcache_flags & MDI_VHCI_CACHE_SETUP_DONE)) { in vhcache_dirty()
8404 rw_exit(&vhcache->vhcache_lock); in vhcache_dirty()
8407 rw_exit(&vhcache->vhcache_lock); in vhcache_dirty()
8409 mutex_enter(&vhc->vhc_lock); in vhcache_dirty()
8410 if (vhc->vhc_flags & MDI_VHC_READONLY_FS) { in vhcache_dirty()
8411 mutex_exit(&vhc->vhc_lock); in vhcache_dirty()
8415 vhc->vhc_flags |= MDI_VHC_VHCACHE_DIRTY; in vhcache_dirty()
8416 vhc->vhc_flush_at_ticks = ddi_get_lbolt() + in vhcache_dirty()
8418 if (vhc->vhc_flags & MDI_VHC_VHCACHE_FLUSH_THREAD) { in vhcache_dirty()
8419 cv_broadcast(&vhc->vhc_cv); in vhcache_dirty()
8422 vhc->vhc_flags |= MDI_VHC_VHCACHE_FLUSH_THREAD; in vhcache_dirty()
8425 mutex_exit(&vhc->vhc_lock); in vhcache_dirty()
8433 * phci bus config structure - one for for each phci bus config operation that
8442 /* vhci bus config structure - one for each vhci bus config operation */
8459 mdi_vhci_bus_config_t *vhbc = phbc->phbc_vhbusconfig; in bus_config_phci()
8466 if ((ph_dip = e_ddi_hold_devi_by_path(phbc->phbc_phci_path, 0)) in bus_config_phci()
8468 if (vhbc->vhbc_op == BUS_CONFIG_DRIVER || in bus_config_phci()
8469 vhbc->vhbc_op == BUS_UNCONFIG_DRIVER) { in bus_config_phci()
8471 vhbc->vhbc_op_flags, in bus_config_phci()
8472 vhbc->vhbc_op_major); in bus_config_phci()
8475 vhbc->vhbc_op_flags); in bus_config_phci()
8481 kmem_free(phbc->phbc_phci_path, strlen(phbc->phbc_phci_path) + 1); in bus_config_phci()
8484 mutex_enter(&vhbc->vhbc_lock); in bus_config_phci()
8485 vhbc->vhbc_thr_count--; in bus_config_phci()
8486 if (vhbc->vhbc_thr_count == 0) in bus_config_phci()
8487 cv_broadcast(&vhbc->vhbc_cv); in bus_config_phci()
8488 mutex_exit(&vhbc->vhbc_lock); in bus_config_phci()
8503 rw_enter(&vhcache->vhcache_lock, RW_READER); in bus_config_all_phcis()
8504 if (vhcache->vhcache_phci_head == NULL) { in bus_config_all_phcis()
8505 rw_exit(&vhcache->vhcache_lock); in bus_config_all_phcis()
8511 for (cphci = vhcache->vhcache_phci_head; cphci != NULL; in bus_config_all_phcis()
8512 cphci = cphci->cphci_next) { in bus_config_all_phcis()
8514 if (!modrootloaded && (cphci->cphci_phci == NULL)) in bus_config_all_phcis()
8517 phbc->phbc_phci_path = i_ddi_strdup(cphci->cphci_path, in bus_config_all_phcis()
8519 phbc->phbc_vhbusconfig = vhbc; in bus_config_all_phcis()
8520 phbc->phbc_next = phbc_head; in bus_config_all_phcis()
8522 vhbc->vhbc_thr_count++; in bus_config_all_phcis()
8524 rw_exit(&vhcache->vhcache_lock); in bus_config_all_phcis()
8526 vhbc->vhbc_op = op; in bus_config_all_phcis()
8527 vhbc->vhbc_op_major = maj; in bus_config_all_phcis()
8528 vhbc->vhbc_op_flags = NDI_NO_EVENT | in bus_config_all_phcis()
8530 mutex_init(&vhbc->vhbc_lock, NULL, MUTEX_DEFAULT, NULL); in bus_config_all_phcis()
8531 cv_init(&vhbc->vhbc_cv, NULL, CV_DRIVER, NULL); in bus_config_all_phcis()
8535 phbc_next = phbc->phbc_next; in bus_config_all_phcis()
8543 mutex_enter(&vhbc->vhbc_lock); in bus_config_all_phcis()
8545 while (vhbc->vhbc_thr_count > 0) in bus_config_all_phcis()
8546 cv_wait(&vhbc->vhbc_cv, &vhbc->vhbc_lock); in bus_config_all_phcis()
8547 mutex_exit(&vhbc->vhbc_lock); in bus_config_all_phcis()
8549 mutex_destroy(&vhbc->vhbc_lock); in bus_config_all_phcis()
8550 cv_destroy(&vhbc->vhbc_cv); in bus_config_all_phcis()
8561 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in st_bus_config_all_phcis()
8601 devnm--; in bus_config_one_phci_child()
8617 for (cpi = cct->cct_cpi_head; cpi != NULL; cpi = cpi->cpi_next) { in build_phclient_path_list()
8622 if (cpi->cpi_pip == NULL) in build_phclient_path_list()
8625 MDI_PI_LOCK(cpi->cpi_pip); in build_phclient_path_list()
8626 if (MDI_PI_IS_INIT(cpi->cpi_pip)) in build_phclient_path_list()
8628 MDI_PI_UNLOCK(cpi->cpi_pip); in build_phclient_path_list()
8633 len = strlen(cpi->cpi_cphci->cphci_path) + in build_phclient_path_list()
8634 strlen(ct_name) + strlen(cpi->cpi_addr) + 3; in build_phclient_path_list()
8635 pp->phys_path = kmem_alloc(len, KM_SLEEP); in build_phclient_path_list()
8636 (void) snprintf(pp->phys_path, len, "%s/%s@%s", in build_phclient_path_list()
8637 cpi->cpi_cphci->cphci_path, ct_name, in build_phclient_path_list()
8638 cpi->cpi_addr); in build_phclient_path_list()
8639 pp->phys_path_next = NULL; in build_phclient_path_list()
8644 pp_tail->phys_path_next = pp; in build_phclient_path_list()
8661 pp_next = pp->phys_path_next; in free_phclient_path_list()
8662 kmem_free(pp->phys_path, strlen(pp->phys_path) + 1); in free_phclient_path_list()
8677 acc->acc_ct_name = i_ddi_strdup(ct_name, KM_SLEEP); in alloc_async_client_config()
8678 acc->acc_ct_addr = i_ddi_strdup(ct_addr, KM_SLEEP); in alloc_async_client_config()
8679 acc->acc_phclient_path_list_head = pp_head; in alloc_async_client_config()
8680 init_vhcache_lookup_token(&acc->acc_token, tok); in alloc_async_client_config()
8681 acc->acc_next = NULL; in alloc_async_client_config()
8691 if (acc->acc_phclient_path_list_head) in free_async_client_config()
8692 free_phclient_path_list(acc->acc_phclient_path_list_head); in free_async_client_config()
8693 kmem_free(acc->acc_ct_name, strlen(acc->acc_ct_name) + 1); in free_async_client_config()
8694 kmem_free(acc->acc_ct_addr, strlen(acc->acc_ct_addr) + 1); in free_async_client_config()
8709 cpi_head = cct->cct_cpi_head; in sort_vhcache_paths()
8710 cct->cct_cpi_head = cct->cct_cpi_tail = NULL; in sort_vhcache_paths()
8712 cpi_next = cpi->cpi_next; in sort_vhcache_paths()
8723 * on-disk vhci cache. So every time this flag is updated the cache must be
8730 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in adjust_sort_vhcache_paths()
8734 rw_enter(&vhcache->vhcache_lock, RW_READER); in adjust_sort_vhcache_paths()
8737 rw_exit(&vhcache->vhcache_lock); in adjust_sort_vhcache_paths()
8742 * to avoid unnecessary on-disk cache updates, first check if an in adjust_sort_vhcache_paths()
8745 for (cpi = cct->cct_cpi_head; cpi != NULL; cpi = cpi->cpi_next) { in adjust_sort_vhcache_paths()
8746 if ((cpi->cpi_pip != NULL && in adjust_sort_vhcache_paths()
8747 (cpi->cpi_flags & MDI_CPI_HINT_PATH_DOES_NOT_EXIST)) || in adjust_sort_vhcache_paths()
8748 (cpi->cpi_pip == NULL && in adjust_sort_vhcache_paths()
8749 !(cpi->cpi_flags & MDI_CPI_HINT_PATH_DOES_NOT_EXIST))) { in adjust_sort_vhcache_paths()
8754 rw_exit(&vhcache->vhcache_lock); in adjust_sort_vhcache_paths()
8758 if (rw_tryupgrade(&vhcache->vhcache_lock) == 0) { in adjust_sort_vhcache_paths()
8759 rw_exit(&vhcache->vhcache_lock); in adjust_sort_vhcache_paths()
8760 rw_enter(&vhcache->vhcache_lock, RW_WRITER); in adjust_sort_vhcache_paths()
8763 rw_exit(&vhcache->vhcache_lock); in adjust_sort_vhcache_paths()
8768 for (cpi = cct->cct_cpi_head; cpi != NULL; cpi = cpi->cpi_next) { in adjust_sort_vhcache_paths()
8769 if (cpi->cpi_pip != NULL) in adjust_sort_vhcache_paths()
8770 cpi->cpi_flags &= ~MDI_CPI_HINT_PATH_DOES_NOT_EXIST; in adjust_sort_vhcache_paths()
8772 cpi->cpi_flags |= MDI_CPI_HINT_PATH_DOES_NOT_EXIST; in adjust_sort_vhcache_paths()
8776 rw_exit(&vhcache->vhcache_lock); in adjust_sort_vhcache_paths()
8789 for (pp = pp_head; pp != NULL; pp = pp->phys_path_next) in config_client_paths_sync()
8790 (void) bus_config_one_phci_child(pp->phys_path); in config_client_paths_sync()
8807 CALLB_CPR_INIT(&cprinfo, &vhc->vhc_lock, callb_generic_cpr, in config_client_paths_thread()
8813 mutex_enter(&vhc->vhc_lock); in config_client_paths_thread()
8814 while (!(vhc->vhc_flags & MDI_VHC_EXIT) && in config_client_paths_thread()
8815 vhc->vhc_acc_list_head == NULL && in config_client_paths_thread()
8818 (void) cv_timedwait(&vhc->vhc_cv, &vhc->vhc_lock, in config_client_paths_thread()
8820 CALLB_CPR_SAFE_END(&cprinfo, &vhc->vhc_lock); in config_client_paths_thread()
8823 if ((vhc->vhc_flags & MDI_VHC_EXIT) || in config_client_paths_thread()
8824 vhc->vhc_acc_list_head == NULL) in config_client_paths_thread()
8827 acc = vhc->vhc_acc_list_head; in config_client_paths_thread()
8828 vhc->vhc_acc_list_head = acc->acc_next; in config_client_paths_thread()
8829 if (vhc->vhc_acc_list_head == NULL) in config_client_paths_thread()
8830 vhc->vhc_acc_list_tail = NULL; in config_client_paths_thread()
8831 vhc->vhc_acc_count--; in config_client_paths_thread()
8832 mutex_exit(&vhc->vhc_lock); in config_client_paths_thread()
8834 config_client_paths_sync(vhc, acc->acc_ct_name, in config_client_paths_thread()
8835 acc->acc_ct_addr, acc->acc_phclient_path_list_head, in config_client_paths_thread()
8836 &acc->acc_token); in config_client_paths_thread()
8842 vhc->vhc_acc_thrcount--; in config_client_paths_thread()
8843 /* CALLB_CPR_EXIT releases the vhc->vhc_lock */ in config_client_paths_thread()
8870 mutex_enter(&vhc->vhc_lock); in config_client_paths_async()
8871 for (acc = vhc->vhc_acc_list_head; acc != NULL; acc = acc->acc_next) { in config_client_paths_async()
8872 if (strcmp(ct_name, acc->acc_ct_name) == 0 && in config_client_paths_async()
8873 strcmp(ct_addr, acc->acc_ct_addr) == 0) { in config_client_paths_async()
8875 mutex_exit(&vhc->vhc_lock); in config_client_paths_async()
8880 if (vhc->vhc_acc_list_head == NULL) in config_client_paths_async()
8881 vhc->vhc_acc_list_head = newacc; in config_client_paths_async()
8883 vhc->vhc_acc_list_tail->acc_next = newacc; in config_client_paths_async()
8884 vhc->vhc_acc_list_tail = newacc; in config_client_paths_async()
8885 vhc->vhc_acc_count++; in config_client_paths_async()
8886 if (vhc->vhc_acc_count <= vhc->vhc_acc_thrcount) { in config_client_paths_async()
8887 cv_broadcast(&vhc->vhc_cv); in config_client_paths_async()
8890 vhc->vhc_acc_thrcount++; in config_client_paths_async()
8893 mutex_exit(&vhc->vhc_lock); in config_client_paths_async()
8909 for (cpi = cct->cct_cpi_head; cpi != NULL; cpi = cpi->cpi_next) { in nonline_paths()
8910 if (cpi->cpi_pip != NULL) { in nonline_paths()
8911 MDI_PI_LOCK(cpi->cpi_pip); in nonline_paths()
8912 if (cpi->cpi_pip->pi_state == MDI_PATHINFO_STATE_ONLINE) in nonline_paths()
8914 MDI_PI_UNLOCK(cpi->cpi_pip); in nonline_paths()
8931 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in config_client_paths()
8936 ASSERT(RW_LOCK_HELD(&vhcache->vhcache_lock)); in config_client_paths()
8944 rw_exit(&vhcache->vhcache_lock); in config_client_paths()
8950 rw_exit(&vhcache->vhcache_lock); in config_client_paths()
8955 rw_exit(&vhcache->vhcache_lock); in config_client_paths()
8957 for (pp = pp_head; pp != NULL; pp = pp->phys_path_next) { in config_client_paths()
8958 if (bus_config_one_phci_child(pp->phys_path) == MDI_SUCCESS) { in config_client_paths()
8959 rw_enter(&vhcache->vhcache_lock, RW_READER); in config_client_paths()
8963 rw_exit(&vhcache->vhcache_lock); in config_client_paths()
8968 pp->phys_path_next != NULL) { in config_client_paths()
8969 rw_exit(&vhcache->vhcache_lock); in config_client_paths()
8971 pp->phys_path_next, &tok); in config_client_paths()
8972 pp->phys_path_next = NULL; in config_client_paths()
8976 rw_exit(&vhcache->vhcache_lock); in config_client_paths()
8988 mutex_enter(&vhc->vhc_lock); in single_threaded_vhconfig_enter()
8989 while (vhc->vhc_flags & MDI_VHC_SINGLE_THREADED) in single_threaded_vhconfig_enter()
8990 cv_wait(&vhc->vhc_cv, &vhc->vhc_lock); in single_threaded_vhconfig_enter()
8991 vhc->vhc_flags |= MDI_VHC_SINGLE_THREADED; in single_threaded_vhconfig_enter()
8992 mutex_exit(&vhc->vhc_lock); in single_threaded_vhconfig_enter()
8998 mutex_enter(&vhc->vhc_lock); in single_threaded_vhconfig_exit()
8999 vhc->vhc_flags &= ~MDI_VHC_SINGLE_THREADED; in single_threaded_vhconfig_exit()
9000 cv_broadcast(&vhc->vhc_cv); in single_threaded_vhconfig_exit()
9001 mutex_exit(&vhc->vhc_lock); in single_threaded_vhconfig_exit()
9013 * specified using ddi-vhci-class and ddi-no-root-support properties in the
9014 * phci driver.conf file. The built-in tables below contain this information
9078 if (dnp->dn_flags & DN_PHCI_DRIVER) { in get_phci_driver_list()
9079 LOCK_DEV_OPS(&dnp->dn_lock); in get_phci_driver_list()
9080 if (dnp->dn_global_prop_ptr != NULL && in get_phci_driver_list()
9083 &dnp->dn_global_prop_ptr->prop_list)) != NULL && in get_phci_driver_list()
9084 strcmp(propp->prop_val, vhci_class) == 0) { in get_phci_driver_list()
9088 &dnp->dn_global_prop_ptr->prop_list) in get_phci_driver_list()
9092 cur_elements, max_elements, dnp->dn_name, in get_phci_driver_list()
9095 UNLOCK_DEV_OPS(&dnp->dn_lock); in get_phci_driver_list()
9097 UNLOCK_DEV_OPS(&dnp->dn_lock); in get_phci_driver_list()
9103 /* add the phci drivers specified in the built-in tables */ in get_phci_driver_list()
9120 if (strcmp((*driver_list)[j], p->phdriver_name) == 0) in get_phci_driver_list()
9125 cur_elements, max_elements, p->phdriver_name, in get_phci_driver_list()
9126 p->phdriver_root_support); in get_phci_driver_list()
9179 mdi_vhci_config_t *vhc = vh->vh_config; in build_vhci_cache()
9180 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in build_vhci_cache()
9184 rw_enter(&vhcache->vhcache_lock, RW_READER); in build_vhci_cache()
9185 if (vhcache->vhcache_flags & MDI_VHCI_CACHE_SETUP_DONE) { in build_vhci_cache()
9186 rw_exit(&vhcache->vhcache_lock); in build_vhci_cache()
9190 rw_exit(&vhcache->vhcache_lock); in build_vhci_cache()
9192 attach_phci_drivers(vh->vh_class); in build_vhci_cache()
9196 rw_enter(&vhcache->vhcache_lock, RW_WRITER); in build_vhci_cache()
9197 vhcache->vhcache_flags |= MDI_VHCI_CACHE_SETUP_DONE; in build_vhci_cache()
9198 rw_exit(&vhcache->vhcache_lock); in build_vhci_cache()
9213 mutex_enter(&vhc->vhc_lock); in vhcache_do_discovery()
9215 if (vhc->vhc_path_discovery_boot > 0) { in vhcache_do_discovery()
9216 vhc->vhc_path_discovery_boot--; in vhcache_do_discovery()
9220 if (vhc->vhc_path_discovery_postboot > 0) { in vhcache_do_discovery()
9221 vhc->vhc_path_discovery_postboot--; in vhcache_do_discovery()
9231 if (mdi_path_discovery_interval != -1 && in vhcache_do_discovery()
9232 ddi_get_lbolt64() >= vhc->vhc_path_discovery_cutoff_time) in vhcache_do_discovery()
9237 mutex_exit(&vhc->vhc_lock); in vhcache_do_discovery()
9250 mdi_vhci_config_t *vhc = vh->vh_config; in vhcache_discover_paths()
9251 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in vhcache_discover_paths()
9257 attach_phci_drivers(vh->vh_class); in vhcache_discover_paths()
9261 mutex_enter(&vhc->vhc_lock); in vhcache_discover_paths()
9262 vhc->vhc_path_discovery_cutoff_time = ddi_get_lbolt64() + in vhcache_discover_paths()
9264 mutex_exit(&vhc->vhc_lock); in vhcache_discover_paths()
9302 mdi_vhci_config_t *vhc = vh->vh_config; in mdi_vhci_bus_config()
9303 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in mdi_vhci_bus_config()
9323 rw_enter(&vhcache->vhcache_lock, RW_READER); in mdi_vhci_bus_config()
9324 if (!(vhcache->vhcache_flags & MDI_VHCI_CACHE_SETUP_DONE)) { in mdi_vhci_bus_config()
9325 rw_exit(&vhcache->vhcache_lock); in mdi_vhci_bus_config()
9327 rw_enter(&vhcache->vhcache_lock, RW_READER); in mdi_vhci_bus_config()
9335 while (*cp != '\0' && *cp != '@') in mdi_vhci_bus_config()
9347 rw_exit(&vhcache->vhcache_lock); in mdi_vhci_bus_config()
9351 rw_exit(&vhcache->vhcache_lock); in mdi_vhci_bus_config()
9358 rw_exit(&vhcache->vhcache_lock); in mdi_vhci_bus_config()
9360 st_bus_config_all_phcis(vhc, flags, op, -1); in mdi_vhci_bus_config()
9364 rw_exit(&vhcache->vhcache_lock); in mdi_vhci_bus_config()
9389 * Read the on-disk vhci cache into an nvlist for the specified vhci class.
9414 * Read on-disk vhci cache into nvlists for all vhci classes.
9432 mdi_vhci_cache_t *vhcache = &vhc->vhc_vhcache; in clean_vhcache()
9437 rw_enter(&vhcache->vhcache_lock, RW_WRITER); in clean_vhcache()
9439 client = vhcache->vhcache_client_head; in clean_vhcache()
9440 vhcache->vhcache_client_head = vhcache->vhcache_client_tail = NULL; in clean_vhcache()
9442 nxt_client = client->cct_next; in clean_vhcache()
9444 path = client->cct_cpi_head; in clean_vhcache()
9445 client->cct_cpi_head = client->cct_cpi_tail = NULL; in clean_vhcache()
9447 nxt_path = path->cpi_next; in clean_vhcache()
9448 if ((path->cpi_cphci->cphci_phci != NULL) && in clean_vhcache()
9449 (path->cpi_pip != NULL)) { in clean_vhcache()
9451 } else if (path->cpi_pip != NULL) { in clean_vhcache()
9457 if (client->cct_cpi_head != NULL) in clean_vhcache()
9460 (void) mod_hash_destroy(vhcache->vhcache_client_hash, in clean_vhcache()
9461 (mod_hash_key_t)client->cct_name_addr); in clean_vhcache()
9466 phci = vhcache->vhcache_phci_head; in clean_vhcache()
9467 vhcache->vhcache_phci_head = vhcache->vhcache_phci_tail = NULL; in clean_vhcache()
9470 nxt_phci = phci->cphci_next; in clean_vhcache()
9471 if (phci->cphci_phci != NULL) in clean_vhcache()
9477 vhcache->vhcache_clean_time = ddi_get_lbolt64(); in clean_vhcache()
9478 rw_exit(&vhcache->vhcache_lock); in clean_vhcache()
9484 * Called by i_ddi_clean_devices_files() during the execution of devfsadm -C
9492 for (vh = mdi_vhci_head; vh != NULL; vh = vh->vh_next) { in mdi_clean_vhcache()
9493 vh->vh_refcnt++; in mdi_clean_vhcache()
9495 clean_vhcache(vh->vh_config); in mdi_clean_vhcache()
9497 vh->vh_refcnt--; in mdi_clean_vhcache()
9519 while (cdip) { in mdi_vhci_walk_clients()
9545 ph = vh->vh_phci_head; in mdi_vhci_walk_phcis()
9546 while (ph) { in mdi_vhci_walk_phcis()
9549 if (((*f)(ph->ph_dip, arg)) == DDI_WALK_CONTINUE) in mdi_vhci_walk_phcis()
9550 next = ph->ph_next; in mdi_vhci_walk_phcis()
9574 for (vh = mdi_vhci_head; vh != NULL; vh = vh->vh_next) { in mdi_walk_vhcis()
9575 vh->vh_refcnt++; in mdi_walk_vhcis()
9577 if (((*f)(vh->vh_dip, arg)) != DDI_WALK_CONTINUE) { in mdi_walk_vhcis()
9579 vh->vh_refcnt--; in mdi_walk_vhcis()
9583 vh->vh_refcnt--; in mdi_walk_vhcis()
9685 * information passed by the pHCI - specifics of the cinfo
9702 * NOTE: mdi_phci_register() does "mpxio-disable" processing, and in mdi_is_dev_supported()
9710 if ((vh == NULL) || (vh->vh_ops->vo_is_dev_supported == NULL)) { in mdi_is_dev_supported()
9715 return (vh->vh_ops->vo_is_dev_supported(vh->vh_dip, pdip, cinfo)); in mdi_is_dev_supported()
9748 ASSERT(MDI_PI(pip)->pi_state); in mdi_dc_return_dev_state()
9751 if (copyout(&devstate, dcp->cpyout_buf, sizeof (uint_t)) != 0) in mdi_dc_return_dev_state()