Lines Matching refs:softc

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