Lines Matching defs:vldcp
73 static int i_vldc_mdeg_register(vldc_t *vldcp);
74 static int i_vldc_mdeg_unregister(vldc_t *vldcp);
75 static int i_vldc_add_port(vldc_t *vldcp, md_t *mdp, mde_cookie_t node);
76 static int i_vldc_remove_port(vldc_t *vldcp, uint_t portno);
77 static int i_vldc_close_port(vldc_t *vldcp, uint_t portno);
350 vldc_t *vldcp;
362 vldcp = (vldc_t *)cb_argp;
364 mutex_enter(&vldcp->lock);
365 if (vldcp->detaching == B_TRUE) {
367 mutex_exit(&vldcp->lock);
382 if ((rv = i_vldc_add_port(vldcp, mdp, node)) != MDEG_SUCCESS) {
403 if ((rv = i_vldc_remove_port(vldcp, portno)) != 0) {
414 mutex_exit(&vldcp->lock);
421 i_vldc_mdeg_register(vldc_t *vldcp)
434 inst = ddi_prop_get_int(DDI_DEV_T_ANY, vldcp->dip,
438 ddi_get_instance(vldcp->dip));
443 rv = ddi_prop_lookup_string(DDI_DEV_T_ANY, vldcp->dip,
447 ddi_get_instance(vldcp->dip));
481 vldcp, &mdeg_hdl);
493 vldcp->inst_spec = inst_specp;
494 vldcp->mdeg_hdl = mdeg_hdl;
501 i_vldc_mdeg_unregister(vldc_t *vldcp)
506 D1("i_vldc_mdeg_unregister: hdl=0x%lx\n", vldcp->mdeg_hdl);
508 rv = mdeg_unregister(vldcp->mdeg_hdl);
516 name = VLDC_MDEG_PROP_NAME(vldcp->inst_spec->specp);
520 kmem_free(vldcp->inst_spec->specp, sizeof (vldc_prop_template));
521 vldcp->inst_spec->specp = NULL;
523 kmem_free(vldcp->inst_spec, sizeof (mdeg_node_spec_t));
524 vldcp->inst_spec = NULL;
577 i_vldc_add_port(vldc_t *vldcp, md_t *mdp, mde_cookie_t node)
588 ASSERT(MUTEX_HELD(&vldcp->lock));
603 vport = &(vldcp->port[portno]);
629 for (minor_idx = 0; minor_idx < vldcp->minors_assigned;
631 if (strcmp(vldcp->minor_tbl[minor_idx].sname, sname) == 0) {
638 if (minor_idx == vldcp->minors_assigned) {
640 if (vldcp->minors_assigned == VLDC_MAX_MINORS) {
646 (void) strlcpy(vldcp->minor_tbl[minor_idx].sname,
649 vldcp->minors_assigned++;
653 if (vldcp->minor_tbl[minor_idx].portno != VLDC_INVALID_PORTNO) {
656 portno, vldcp->minor_tbl[minor_idx].portno);
660 vldc_inst = ddi_get_instance(vldcp->dip);
663 vport->minorp = &vldcp->minor_tbl[minor_idx];
664 vldcp->minor_tbl[minor_idx].portno = portno;
665 vldcp->minor_tbl[minor_idx].in_use = 0;
676 rv = ddi_create_minor_node(vldcp->dip, sname, S_IFCHR,
682 vldcp->minor_tbl[minor_idx].portno = VLDC_INVALID_PORTNO;
684 vldcp->minors_assigned--;
702 i_vldc_remove_port(vldc_t *vldcp, uint_t portno)
707 ASSERT(vldcp != NULL);
708 ASSERT(MUTEX_HELD(&vldcp->lock));
710 vport = &(vldcp->port[portno]);
737 (void) i_vldc_close_port(vldcp, portno);
741 ddi_remove_minor_node(vldcp->dip, vport->minorp->sname);
796 i_vldc_close_port(vldc_t *vldcp, uint_t portno)
802 vport = &(vldcp->port[portno]);
875 vldc_t *vldcp;
887 vldcp = ddi_get_soft_state(vldc_ssp, instance);
888 if (vldcp == NULL) {
895 mutex_init(&vldcp->lock, NULL, MUTEX_DRIVER, NULL);
896 vldcp->dip = dip;
897 vldcp->detaching = B_FALSE;
901 vldcp->port[i].minorp = NULL;
905 mutex_init(&(vldcp->minor_tbl[i].lock), NULL,
907 cv_init(&(vldcp->minor_tbl[i].cv), NULL,
910 vldcp->minor_tbl[i].portno = VLDC_INVALID_PORTNO;
914 if (i_vldc_mdeg_register(vldcp) != DDI_SUCCESS) {
938 vldc_t *vldcp;
946 vldcp = ddi_get_soft_state(vldc_ssp, instance);
947 if (vldcp == NULL) {
953 mutex_enter(&vldcp->lock);
957 if (vldcp->minor_tbl[i].portno != VLDC_INVALID_PORTNO) {
960 instance, vldcp->minor_tbl[i].portno);
961 mutex_exit(&vldcp->lock);
972 vldcp->detaching = B_TRUE;
974 mutex_exit(&vldcp->lock);
976 if (i_vldc_mdeg_unregister(vldcp) != MDEG_SUCCESS) {
977 vldcp->detaching = B_FALSE;
983 if (vldcp->minor_tbl[i].portno != VLDC_INVALID_PORTNO) {
984 (void) i_vldc_remove_port(vldcp, i);
986 mutex_destroy(&(vldcp->minor_tbl[i].lock));
987 cv_destroy(&(vldcp->minor_tbl[i].cv));
990 mutex_destroy(&vldcp->lock);
1014 vldc_t *vldcp;
1020 vldcp = ddi_get_soft_state(vldc_ssp, instance);
1021 if (vldcp == NULL)
1024 vminor = VLDCMINOR(vldcp, minor);
1032 vport = &(vldcp->port[portno]);
1066 vldc_t *vldcp;
1072 vldcp = ddi_get_soft_state(vldc_ssp, instance);
1073 if (vldcp == NULL) {
1077 vminor = VLDCMINOR(vldcp, minor);
1087 rv = i_vldc_close_port(vldcp, portno);
1095 vldc_set_ldc_mode(vldc_port_t *vport, vldc_t *vldcp, int channel_mode)
1131 attr.instance = ddi_get_instance(vldcp->dip);
1331 i_vldc_ioctl_opt_op(vldc_port_t *vport, vldc_t *vldcp, void *arg, int mode)
1408 rv = vldc_set_ldc_mode(vport, vldcp, vldc_cmd.opt_val);
1434 vldc_t *vldcp;
1440 vldcp = ddi_get_soft_state(vldc_ssp, instance);
1441 if (vldcp == NULL) {
1445 vminor = VLDCMINOR(vldcp, minor);
1455 vport = &(vldcp->port[portno]);
1462 rv = i_vldc_ioctl_opt_op(vport, vldcp, (void *)arg, mode);
1512 vldc_t *vldcp;
1519 vldcp = ddi_get_soft_state(vldc_ssp, instance);
1520 if (vldcp == NULL) {
1524 vminor = VLDCMINOR(vldcp, minor);
1534 vport = &(vldcp->port[portno]);
1587 vldc_t *vldcp;
1594 vldcp = ddi_get_soft_state(vldc_ssp, instance);
1595 if (vldcp == NULL) {
1599 vminor = VLDCMINOR(vldcp, minor);
1607 vport = &(vldcp->port[portno]);
1661 vldc_t *vldcp;
1668 vldcp = ddi_get_soft_state(vldc_ssp, instance);
1669 if (vldcp == NULL) {
1673 vminor = VLDCMINOR(vldcp, minor);
1681 vport = &(vldcp->port[portno]);