Lines Matching refs:softc

353 	struct tsalarm_softc *softc;  in tsalarm_getinfo()  local
358 if ((softc = getsoftc(inst)) == NULL) { in tsalarm_getinfo()
362 *result = (void *)softc->dip; in tsalarm_getinfo()
382 struct tsalarm_softc *softc = NULL; in tsalarm_attach() local
396 softc = getsoftc(inst); in tsalarm_attach()
397 softc->dip = dip; in tsalarm_attach()
398 softc->mtu_size = PCP_DEF_MTU_SZ; in tsalarm_attach()
399 softc->msg_xid = 0; in tsalarm_attach()
400 softc->read_area = NULL; in tsalarm_attach()
401 softc->read_head = NULL; in tsalarm_attach()
402 softc->read_tail = NULL; in tsalarm_attach()
403 softc->req_ptr = NULL; in tsalarm_attach()
404 softc->resp_ptr = NULL; in tsalarm_attach()
406 mutex_init(&softc->mutex, NULL, MUTEX_DRIVER, NULL); in tsalarm_attach()
429 if (softc) { in tsalarm_attach()
430 mutex_destroy(&softc->mutex); in tsalarm_attach()
443 struct tsalarm_softc *softc; in tsalarm_detach() local
449 if ((softc = getsoftc(inst)) == NULL) in tsalarm_detach()
455 mutex_destroy(&softc->mutex); in tsalarm_detach()
473 struct tsalarm_softc *softc; in tsalarm_open() local
477 softc = (struct tsalarm_softc *)getsoftc(inst); in tsalarm_open()
478 if (softc == NULL) { in tsalarm_open()
483 mutex_enter(&softc->mutex); in tsalarm_open()
485 rv = ldi_ident_from_dev(*devp, &softc->li); in tsalarm_open()
490 softc->flags |= TSAL_IDENTED; in tsalarm_open()
492 rv = ldi_open_by_name(ALARM_CHANNEL, FREAD | FWRITE, kcred, &softc->lh, in tsalarm_open()
493 softc->li); in tsalarm_open()
498 softc->flags |= TSAL_OPENED; in tsalarm_open()
505 if ((rv = ldi_ioctl(softc->lh, GLVC_XPORT_IOCTL_OPT_OP, in tsalarm_open()
510 softc->mtu_size = channel_op.opt_val; in tsalarm_open()
512 if ((softc->req_ptr = (tsal_pcp_alarm_req_t *)kmem_zalloc( in tsalarm_open()
517 if ((softc->resp_ptr = (tsal_pcp_alarm_resp_t *)kmem_zalloc( in tsalarm_open()
522 if ((softc->req_msg_hdr = (tsal_pcp_req_msg_hdr_t *)kmem_zalloc( in tsalarm_open()
527 if ((softc->resp_msg_hdr = (tsal_pcp_resp_msg_hdr_t *)kmem_zalloc( in tsalarm_open()
532 if ((softc->peek_area = (uint8_t *)kmem_zalloc(softc->mtu_size, in tsalarm_open()
536 if ((softc->peek_read_area = (uint8_t *)kmem_zalloc(2*softc->mtu_size, in tsalarm_open()
545 if (softc->flags & TSAL_OPENED) in tsalarm_open()
546 (void) ldi_close(softc->lh, FREAD|FWRITE, credp); in tsalarm_open()
547 if (softc->flags & TSAL_IDENTED) in tsalarm_open()
548 (void) ldi_ident_release(softc->li); in tsalarm_open()
549 softc->flags &= ~(TSAL_OPENED | TSAL_IDENTED); in tsalarm_open()
550 if (softc->req_ptr != NULL) in tsalarm_open()
551 kmem_free(softc->req_ptr, in tsalarm_open()
553 if (softc->resp_ptr != NULL) in tsalarm_open()
554 kmem_free(softc->resp_ptr, in tsalarm_open()
556 if (softc->req_msg_hdr != NULL) in tsalarm_open()
557 kmem_free(softc->req_msg_hdr, in tsalarm_open()
559 if (softc->resp_msg_hdr != NULL) in tsalarm_open()
560 kmem_free(softc->resp_msg_hdr, in tsalarm_open()
562 if (softc->peek_area != NULL) in tsalarm_open()
563 kmem_free(softc->peek_area, softc->mtu_size); in tsalarm_open()
564 if (softc->peek_read_area != NULL) in tsalarm_open()
565 kmem_free(softc->peek_read_area, 2*softc->mtu_size); in tsalarm_open()
567 mutex_exit(&softc->mutex); in tsalarm_open()
578 struct tsalarm_softc *softc; in tsalarm_close() local
580 softc = (struct tsalarm_softc *)getsoftc(inst); in tsalarm_close()
582 if (softc == NULL) { in tsalarm_close()
586 mutex_enter(&softc->mutex); in tsalarm_close()
588 rv = ldi_close(softc->lh, FREAD | FWRITE, kcred); in tsalarm_close()
593 ldi_ident_release(softc->li); in tsalarm_close()
594 softc->flags &= ~(TSAL_OPENED | TSAL_IDENTED); in tsalarm_close()
596 mutex_exit(&softc->mutex); in tsalarm_close()
601 if (softc->read_area != NULL) { in tsalarm_close()
602 kmem_free(softc->read_area, 2*softc->mtu_size); in tsalarm_close()
603 softc->read_area = NULL; in tsalarm_close()
605 if (softc->req_ptr != NULL) { in tsalarm_close()
606 kmem_free(softc->req_ptr, in tsalarm_close()
608 softc->req_ptr = NULL; in tsalarm_close()
610 if (softc->resp_ptr != NULL) { in tsalarm_close()
611 kmem_free(softc->resp_ptr, in tsalarm_close()
613 softc->resp_ptr = NULL; in tsalarm_close()
615 if (softc->req_msg_hdr != NULL) { in tsalarm_close()
616 kmem_free(softc->req_msg_hdr, in tsalarm_close()
618 softc->req_msg_hdr = NULL; in tsalarm_close()
620 if (softc->resp_msg_hdr != NULL) { in tsalarm_close()
621 kmem_free(softc->resp_msg_hdr, in tsalarm_close()
623 softc->resp_msg_hdr = NULL; in tsalarm_close()
625 if (softc->peek_area != NULL) { in tsalarm_close()
626 kmem_free(softc->peek_area, softc->mtu_size); in tsalarm_close()
627 softc->peek_area = NULL; in tsalarm_close()
629 if (softc->peek_read_area != NULL) { in tsalarm_close()
630 kmem_free(softc->peek_read_area, 2*softc->mtu_size); in tsalarm_close()
631 softc->peek_read_area = NULL; in tsalarm_close()
644 struct tsalarm_softc *softc; in tsalarm_ioctl() local
649 if ((softc = getsoftc(inst)) == NULL) in tsalarm_ioctl()
652 mutex_enter(&softc->mutex); in tsalarm_ioctl()
673 softc); in tsalarm_ioctl()
715 retval = glvc_alarm_set(alarm_type, alarm_state, softc); in tsalarm_ioctl()
725 mutex_exit(&softc->mutex); in tsalarm_ioctl()