Lines Matching refs:vh

276 				mdi_vhci_t *vh, int flags, int op);
385 mdi_vhci_t *vh = NULL; in mdi_vhci_register() local
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()
430 if (vh == NULL) { in mdi_vhci_register()
437 vh = kmem_zalloc(sizeof (mdi_vhci_t), KM_SLEEP); 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()
464 setup_vhci_cache(vh); in mdi_vhci_register()
467 mdi_vhci_head = vh; in mdi_vhci_register()
470 mdi_vhci_tail->vh_next = vh; in mdi_vhci_register()
472 mdi_vhci_tail = vh; in mdi_vhci_register()
484 DEVI(vdip)->devi_mdi_xhci = (caddr_t)vh; in mdi_vhci_register()
502 mdi_vhci_t *found, *vh, *prev = NULL; in mdi_vhci_unregister() local
509 if ((vh = i_devi_get_vhci(vdip)) == NULL) in mdi_vhci_unregister()
517 if (found == vh) in mdi_vhci_unregister()
532 MDI_VHCI_PHCI_LOCK(vh); in mdi_vhci_unregister()
533 if (vh->vh_refcnt || vh->vh_phci_count || vh->vh_client_count) { in mdi_vhci_unregister()
534 MDI_VHCI_PHCI_UNLOCK(vh); in mdi_vhci_unregister()
538 MDI_VHCI_PHCI_UNLOCK(vh); in mdi_vhci_unregister()
540 if (destroy_vhci_cache(vh) != MDI_SUCCESS) { in mdi_vhci_unregister()
548 if (vh == mdi_vhci_head) { 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()
553 if (vh == mdi_vhci_tail) { in mdi_vhci_unregister()
559 vh->vh_ops = 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()
568 kmem_free(vh, sizeof (mdi_vhci_t)); in mdi_vhci_unregister()
582 mdi_vhci_t *vh = NULL; in i_mdi_vhci_class2vhci() local
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()
593 return (vh); in i_mdi_vhci_class2vhci()
606 mdi_vhci_t *vh = NULL; in i_devi_get_vhci() local
608 vh = (mdi_vhci_t *)DEVI(vdip)->devi_mdi_xhci; in i_devi_get_vhci()
610 return (vh); in i_devi_get_vhci()
629 mdi_vhci_t *vh; in mdi_phci_register() local
662 vh = (mdi_vhci_t *)i_mdi_vhci_class2vhci(class); in mdi_phci_register()
663 if (vh == NULL) { in mdi_phci_register()
670 ph->ph_vhci = vh; in mdi_phci_register()
682 vhcache_phci_add(vh->vh_config, ph); in mdi_phci_register()
684 MDI_VHCI_PHCI_LOCK(vh); 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()
693 MDI_VHCI_PHCI_UNLOCK(vh); in mdi_phci_register()
713 mdi_vhci_t *vh; in mdi_phci_unregister() local
727 vh = ph->ph_vhci; in mdi_phci_unregister()
728 ASSERT(vh != NULL); in mdi_phci_unregister()
729 if (vh == NULL) { in mdi_phci_unregister()
734 MDI_VHCI_PHCI_LOCK(vh); in mdi_phci_unregister()
735 tmp = vh->vh_phci_head; 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()
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()
755 MDI_VHCI_PHCI_UNLOCK(vh); in mdi_phci_unregister()
766 vhcache_phci_remove(vh->vh_config, ph); in mdi_phci_unregister()
954 mdi_vhci_t *vh; in mdi_devi_pdip_entered() local
957 vh = i_devi_get_vhci(vdip); in mdi_devi_pdip_entered()
958 if (vh == NULL) in mdi_devi_pdip_entered()
961 MDI_VHCI_PHCI_LOCK(vh); in mdi_devi_pdip_entered()
962 ph = vh->vh_phci_head; in mdi_devi_pdip_entered()
965 MDI_VHCI_PHCI_UNLOCK(vh); in mdi_devi_pdip_entered()
970 MDI_VHCI_PHCI_UNLOCK(vh); in mdi_devi_pdip_entered()
983 mdi_vhci_t *vh; in mdi_phci_path2devinfo() local
987 vh = i_devi_get_vhci(vdip); in mdi_phci_path2devinfo()
988 ASSERT(vh != NULL); in mdi_phci_path2devinfo()
990 if (vh == NULL) { in mdi_phci_path2devinfo()
998 MDI_VHCI_PHCI_LOCK(vh); in mdi_phci_path2devinfo()
999 ph = vh->vh_phci_head; in mdi_phci_path2devinfo()
1013 MDI_VHCI_PHCI_UNLOCK(vh); in mdi_phci_path2devinfo()
1097 i_mdi_devinfo_create(mdi_vhci_t *vh, char *name, char *guid, in i_mdi_devinfo_create() argument
1102 ASSERT(MDI_VHCI_CLIENT_LOCKED(vh)); in i_mdi_devinfo_create()
1105 cdip = i_mdi_devinfo_find(vh, name, guid); in i_mdi_devinfo_create()
1113 ndi_devi_alloc_sleep(vh->vh_dip, name, DEVI_SID_NODEID, &cdip); in i_mdi_devinfo_create()
1151 i_mdi_devinfo_find(mdi_vhci_t *vh, caddr_t name, char *guid) in i_mdi_devinfo_find() argument
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()
1179 ndi_devi_exit(vh->vh_dip); in i_mdi_devinfo_find()
1319 i_mdi_client_alloc(mdi_vhci_t *vh, char *name, char *lguid) in i_mdi_client_alloc() argument
1323 ASSERT(MDI_VHCI_CLIENT_LOCKED(vh)); in i_mdi_client_alloc()
1333 ct->ct_vhci = vh; in i_mdi_client_alloc()
1353 ct->ct_lb = vh->vh_lb; in i_mdi_client_alloc()
1364 i_mdi_client_enlist_table(vh, ct); in i_mdi_client_alloc()
1374 i_mdi_client_enlist_table(mdi_vhci_t *vh, mdi_client_t *ct) in i_mdi_client_enlist_table() argument
1379 ASSERT(MDI_VHCI_CLIENT_LOCKED(vh)); in i_mdi_client_enlist_table()
1382 head = &vh->vh_client_table[index]; in i_mdi_client_enlist_table()
1386 vh->vh_client_count++; in i_mdi_client_enlist_table()
1395 i_mdi_client_delist_table(mdi_vhci_t *vh, mdi_client_t *ct) in i_mdi_client_delist_table() argument
1403 ASSERT(MDI_VHCI_CLIENT_LOCKED(vh)); in i_mdi_client_delist_table()
1407 head = &vh->vh_client_table[index]; in i_mdi_client_delist_table()
1427 vh->vh_client_count--; in i_mdi_client_delist_table()
1437 i_mdi_client_free(mdi_vhci_t *vh, mdi_client_t *ct) in i_mdi_client_free() argument
1444 ASSERT(MDI_VHCI_CLIENT_LOCKED(vh)); in i_mdi_client_free()
1446 vdip = vh->vh_dip; in i_mdi_client_free()
1461 i_mdi_client_delist_table(vh, ct); in i_mdi_client_free()
1475 MDI_VHCI_CLIENT_UNLOCK(vh); in i_mdi_client_free()
1477 MDI_VHCI_CLIENT_LOCK(vh); in i_mdi_client_free()
1488 i_mdi_client_find(mdi_vhci_t *vh, char *cname, char *guid) in i_mdi_client_find() argument
1494 ASSERT(MDI_VHCI_CLIENT_LOCKED(vh)); in i_mdi_client_find()
1497 head = &vh->vh_client_table[index]; in i_mdi_client_find()
1876 mdi_vhci_t *vh = ct->ct_vhci; in i_mdi_failover() local
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()
2639 mdi_vhci_t *vh; in mdi_pi_find() local
2657 vh = ph->ph_vhci; in mdi_pi_find()
2658 if (vh == NULL) { in mdi_pi_find()
2706 MDI_VHCI_CLIENT_LOCK(vh); in mdi_pi_find()
2712 ct = i_mdi_client_find(vh, NULL, caddr); in mdi_pi_find()
2718 MDI_VHCI_CLIENT_UNLOCK(vh); in mdi_pi_find()
2734 MDI_VHCI_CLIENT_UNLOCK(vh); in mdi_pi_find()
2778 mdi_vhci_t *vh; in mdi_pi_alloc_compatible() local
2816 vh = ph->ph_vhci; in mdi_pi_alloc_compatible()
2817 if (vh == NULL) { in mdi_pi_alloc_compatible()
2839 MDI_VHCI_CLIENT_LOCK(vh); in mdi_pi_alloc_compatible()
2840 ct = i_mdi_client_find(vh, cname, caddr); in mdi_pi_alloc_compatible()
2842 ct = i_mdi_client_alloc(vh, cname, caddr); in mdi_pi_alloc_compatible()
2850 ct->ct_dip = i_mdi_devinfo_create(vh, cname, caddr, in mdi_pi_alloc_compatible()
2853 (void) i_mdi_client_free(vh, ct); in mdi_pi_alloc_compatible()
2891 MDI_VHCI_CLIENT_UNLOCK(vh); in mdi_pi_alloc_compatible()
2905 vhcache_pi_add(vh->vh_config, MDI_PI(pip)); in mdi_pi_alloc_compatible()
3129 mdi_vhci_t *vh; in mdi_pi_free() local
3149 vh = ph->ph_vhci; in mdi_pi_free()
3150 ASSERT(vh != NULL); in mdi_pi_free()
3151 if (vh == NULL) { in mdi_pi_free()
3220 vhcache_pi_remove(vh->vh_config, MDI_PI(pip)); in mdi_pi_free()
3234 MDI_VHCI_CLIENT_LOCK(vh); 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()
3263 MDI_VHCI_CLIENT_UNLOCK(vh); in mdi_pi_free()
3268 MDI_VHCI_CLIENT_UNLOCK(vh); in mdi_pi_free()
3271 vhcache_pi_add(vh->vh_config, MDI_PI(pip)); in mdi_pi_free()
3417 mdi_vhci_t *vh; in i_mdi_pi_state_change() local
3438 vh = ph->ph_vhci; in i_mdi_pi_state_change()
3439 ASSERT(vh); in i_mdi_pi_state_change()
3440 if (vh == NULL) { 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()
3477 (void *)vh, mdi_pi_spathname(pip), 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()
3853 mdi_vhci_t *vh = NULL; in i_mdi_pi_offline() local
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()
3984 mdi_vhci_t *vh = NULL; in i_mdi_pi_online() local
3992 vh = ph->ph_vhci; 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()
5700 mdi_vhci_t *vh; in mdi_post_attach() local
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()
6279 i_mdi_enable_disable_path(mdi_pathinfo_t *pip, mdi_vhci_t *vh, int flags, in i_mdi_enable_disable_path() argument
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()
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()
6373 mdi_vhci_t *vh = NULL; in i_mdi_pi_enable_disable() local
6394 vh = ph->ph_vhci; in i_mdi_pi_enable_disable()
6437 pip = i_mdi_enable_disable_path(pip, vh, flags, op); in i_mdi_pi_enable_disable()
6475 (void) i_mdi_enable_disable_path(pip, vh, flags, op); in i_mdi_pi_enable_disable()
7486 setup_vhci_cache(mdi_vhci_t *vh) in setup_vhci_cache() argument
7494 vh->vh_config = vhc; in setup_vhci_cache()
7497 vhc->vhc_vhcache_filename = vhclass2vhcache_filename(vh->vh_class); in setup_vhci_cache()
7508 vhcache->vhcache_client_hash = mod_hash_create_extended(vh->vh_class, 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()
7556 destroy_vhci_cache(mdi_vhci_t *vh) in destroy_vhci_cache() argument
7558 mdi_vhci_config_t *vhc = vh->vh_config; in destroy_vhci_cache()
9177 build_vhci_cache(mdi_vhci_t *vh) in build_vhci_cache() argument
9179 mdi_vhci_config_t *vhc = vh->vh_config; in build_vhci_cache()
9192 attach_phci_drivers(vh->vh_class); in build_vhci_cache()
9248 vhcache_discover_paths(mdi_vhci_t *vh) in vhcache_discover_paths() argument
9250 mdi_vhci_config_t *vhc = vh->vh_config; in vhcache_discover_paths()
9257 attach_phci_drivers(vh->vh_class); in vhcache_discover_paths()
9301 mdi_vhci_t *vh = i_devi_get_vhci(vdip); in mdi_vhci_bus_config() local
9302 mdi_vhci_config_t *vhc = vh->vh_config; in mdi_vhci_bus_config()
9326 rv = build_vhci_cache(vh); in mdi_vhci_bus_config()
9379 if (vhcache_discover_paths(vh) && in mdi_vhci_bus_config()
9489 mdi_vhci_t *vh; in mdi_clean_vhcache() local
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()
9513 mdi_vhci_t *vh = i_devi_get_vhci(vdip); in mdi_vhci_walk_clients() local
9517 MDI_VHCI_CLIENT_LOCK(vh); in mdi_vhci_walk_clients()
9530 MDI_VHCI_CLIENT_UNLOCK(vh); in mdi_vhci_walk_clients()
9541 mdi_vhci_t *vh = i_devi_get_vhci(vdip); in mdi_vhci_walk_phcis() local
9544 MDI_VHCI_PHCI_LOCK(vh); in mdi_vhci_walk_phcis()
9545 ph = vh->vh_phci_head; in mdi_vhci_walk_phcis()
9557 MDI_VHCI_PHCI_UNLOCK(vh); in mdi_vhci_walk_phcis()
9568 mdi_vhci_t *vh = NULL; in mdi_walk_vhcis() local
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()
9694 mdi_vhci_t *vh; in mdi_is_dev_supported() local
9709 vh = (mdi_vhci_t *)i_mdi_vhci_class2vhci(class); 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()