Lines Matching refs:uqi

305 sm_is_flag_set(sm_uqi_t *uqi, uint_t flag, uint_t howmany)
312 for (lqi = uqi->sm_lqs; lqi; lqi = lqi->sm_nlqi) {
324 sm_uwq_error(sm_uqi_t *uqi)
326 return (sm_is_flag_set(uqi, (WERROR_MODE|HANGUP_MODE), uqi->sm_nlqs));
334 sm_q_count(sm_uqi_t *uqi, uint_t flag)
339 for (lqi = uqi->sm_lqs; lqi; lqi = lqi->sm_nlqi) {
351 sm_qs_without(sm_uqi_t *uqi, uint_t flag, uint_t ioflag)
356 for (lqi = uqi->sm_lqs; lqi; lqi = lqi->sm_nlqi) {
368 sm_good_qs(sm_uqi_t *uqi)
370 return (sm_q_count(uqi, (WERROR_MODE|HANGUP_MODE)));
374 sm_cnt_oqs(sm_uqi_t *uqi)
376 return (sm_qs_without(uqi, (WERROR_MODE|HANGUP_MODE),
474 sm_uqi_t *uqi;
485 (uqi = get_uqi(sm_ssp, unit)) == 0) {
486 sm_dbg('@', (" invalid: lqi=0x%p lui=0x%p:", plqi, uqi));
507 LOCK_UNIT(uqi);
512 plqi->sm_ttycommon->t_cflag = uqi->sm_ttycommon->
514 plqi->sm_ttycommon->t_flags = uqi->sm_ttycommon->
516 plqi->sm_uqi = uqi;
527 plqi->sm_nlqi = uqi->sm_lqs;
528 uqi->sm_lqs = plqi;
531 if (uqi->sm_lqs) {
533 for (lq = uqi->sm_lqs; lq->sm_nlqi;
538 uqi->sm_lqs = plqi;
540 uqi->sm_nlqs++;
544 UNLOCK_UNIT(uqi);
554 if ((uqi->sm_flags & FULLY_OPEN) || uqi->sm_waitq)
592 sm_uqi_t *uqi;
602 (uqi = get_uqi(sm_ssp, unit)) == 0) {
603 sm_dbg('@', ("invalid: lqi=0x%p lui=0x%p", plqi, uqi));
657 sm_uqi_t *uqi = q->q_ptr;
659 if (uqi->sm_ttybid != 0)
660 qunbufcall(q, uqi->sm_ttybid);
664 uqi->sm_ttybid = qbufcall(q, memreq, pri, fn, uqi);
671 sm_reenable_q(sm_uqi_t *uqi)
673 queue_t *wq = SM_WQ(uqi);
675 if ((uqi->sm_flags & SM_STOPPED) == 0) {
686 sm_senddown(sm_uqi_t *uqi)
690 for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) {
703 sm_dupmsg(sm_uqi_t *uqi, mblk_t *mp)
708 for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) {
723 for (flqi = uqi->sm_lqs; flqi != lqi;
731 return (sm_cnt_oqs(uqi) * msgdsize(mp));
744 sm_cansenddown(sm_uqi_t *uqi)
749 if (uqi->sm_lqs == 0)
752 for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) {
767 register sm_uqi_t *uqi = (sm_uqi_t *)q->q_ptr;
772 if (uqi->sm_lqs == 0 || (uqi->sm_flags & WERROR_MODE)) {
774 sm_dbg('Q', ("sm_putqs: freeing (0x%p 0x%p).\n", uqi->sm_lqs,
775 uqi->sm_flags));
777 } else if (pri != BPRI_HI && sm_cansenddown(uqi) == 0) {
781 } else if ((memreq = sm_dupmsg(uqi, mp)) == 0) {
783 sm_senddown(uqi);
874 sm_uqi_t *uqi;
892 uqi = plqi->sm_uqi;
897 if (uqi)
898 (void) sm_disassociate(uqi->sm_lunit,
922 if (uqi &&
924 (uqi->sm_flags & FULLY_OPEN) &&
925 sm_uwq_error(uqi) &&
926 putnextctl(SM_RQ(uqi), M_HANGUP) == 0) {
994 sm_update_ttyinfo(mblk_t *mp, sm_uqi_t *uqi)
1015 uqi->sm_flags |= FLUSHR_PEND;
1023 (tcflag_t)(~uqi->sm_cmask);
1024 uqi->sm_ttycommon->t_cflag =
1030 uqi->sm_flags |= FLUSHR_PEND;
1037 (tcflag_t)(~uqi->sm_cmask);
1038 uqi->sm_ttycommon->t_cflag =
1046 uqi->sm_ttycommon->t_flags |= TS_SOFTCAR;
1048 uqi->sm_ttycommon->t_flags &= ~TS_SOFTCAR;
1054 uqi->sm_mbits = *(int *)info.sm_data;
1058 uqi->sm_mbits |= *(int *)info.sm_data;
1062 uqi->sm_mbits &= ~(*(int *)info.sm_data);
1069 if ((uqi->sm_mbits & TIOCM_CD) ||
1070 (uqi->sm_ttycommon->t_flags & TS_SOFTCAR) ||
1071 (uqi->sm_ttycommon->t_cflag & CLOCAL))
1072 uqi->sm_flags |= SM_CARON;
1074 uqi->sm_flags &= ~SM_CARON;
1093 sm_uqi_t *uqi = (sm_uqi_t *)(wq->q_ptr);
1107 * Could set uqi->sm_flags & WANT_FLUSH but then what happens
1129 for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi) {
1142 for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi) {
1150 for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi) {
1158 uqi->sm_flags |= SM_STOPPED;
1160 for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi)
1168 uqi->sm_flags &= ~SM_STOPPED;
1171 for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi)
1202 sm_uqi_t *uqi;
1204 uqi = (sm_uqi_t *)(wq->q_ptr);
1219 (void) ttycommon_ioctl(uqi->sm_ttycommon, wq, mp, &err);
1228 if ((err = sm_update_ttyinfo(mp, uqi)) != 0) {
1234 * If uqi->sm_siocdata.sm_iocid just overwrite it since the stream
1237 uqi->sm_siocdata.sm_iocid = iobp->ioc_id;
1238 uqi->sm_siocdata.sm_acked = 0;
1239 uqi->sm_siocdata.sm_nacks = sm_good_qs(uqi);
1240 uqi->sm_siocdata.sm_acnt = 0;
1241 uqi->sm_siocdata.sm_policy = uqi->sm_policy;
1242 uqi->sm_siocdata.sm_flags = 0;
1244 uqi->sm_siocdata.sm_nacks, iobp->ioc_id));
1256 sm_uqi_t *uqi;
1261 uqi = (sm_uqi_t *)(wq->q_ptr);
1264 ASSERT(uqi != 0 && sm_ssp != 0);
1329 (void) sm_ioctl_cmd(uqi, mp);
1372 sm_uqi_t *uqi = (sm_uqi_t *)(q->q_ptr);
1375 ASSERT(q == SM_WQ(uqi));
1391 if (uqi->sm_flags & SM_STOPPED) {
1429 * It's safe to lock uqi since lwsrv runs asynchronously
1453 sm_uqi_t *uqi = (sm_uqi_t *)rq->q_ptr;
1463 if (info.sm_id == uqi->sm_piocdata.sm_iocid) {
1464 iodp = &uqi->sm_piocdata;
1465 } else if (info.sm_id == uqi->sm_siocdata.sm_iocid) {
1466 iodp = &uqi->sm_siocdata;
1530 (void) sm_update_ttyinfo(mp, uqi);
1532 if (iodp == &uqi->sm_piocdata) {
1534 uqi->sm_flags &= ~SM_IOCPENDING;
1555 sm_uqi_t *uqi = (sm_uqi_t *)q->q_ptr;
1570 if (sm_uwq_error(uqi)) {
1572 uqi->sm_flags &= ~SM_CARON;
1580 if (sm_uwq_error(uqi)) {
1582 uqi->sm_flags &= ~SM_CARON;
1586 uqi->sm_flags &= ~ERROR_MODE;
1599 uqi->sm_flags |= SM_CLOSE;
1605 uqi->sm_flags |= SM_CARON;
1634 sm_uqi_t *uqi = (sm_uqi_t *)q->q_ptr;
1636 int flags = uqi->sm_flags;
1642 uqi->sm_flags |= WANT_RENB;
1651 if ((flags & WANT_RENB) && !(uqi->sm_flags & WANT_RENB)) {
1655 uqi->sm_flags &= ~WANT_RENB;
1656 for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) {
1919 sm_ok_to_open(sm_uqi_t *uqi, int protocol, cred_t *credp, int *abort_waiters)
1928 if ((uqi->sm_protocol == NULL_PROTOCOL) ||
1929 (uqi->sm_protocol == ASYN_PROTOCOL)) {
1940 if ((uqi->sm_protocol == NULL_PROTOCOL) ||
1941 (uqi->sm_protocol == OUTD_PROTOCOL)) {
1944 } else if (uqi->sm_protocol == ASYN_PROTOCOL) {
1950 if (uqi->sm_flags & FULLY_OPEN)
1964 (uqi->sm_ttycommon->t_flags & TS_XCLUDE) &&
1967 if (uqi->sm_flags & FULLY_OPEN) {
1977 uqi->sm_protocol = proto;
1980 uqi, protocol, uqi->sm_protocol, rval, *abort_waiters));
2003 sm_qwait_sig(sm_uqi_t *uqi, queue_t *q)
2009 uqi->sm_waitq = q;
2010 uqi->sm_nwaiters++; /* required by the close routine */
2012 if (--uqi->sm_nwaiters == 0)
2013 uqi->sm_waitq = 0;
2019 else if (uqi->sm_flags & SM_CLOSE) {
2020 uqi->sm_flags &= ~SM_CLOSE;
2035 sm_defer_open(sm_uqi_t *uqi, queue_t *q)
2040 while ((nqs = sm_good_qs(uqi)) == 0) {
2042 if (err = sm_qwait_sig(uqi, q))
2046 while ((uqi->sm_flags & SM_CARON) == 0) {
2051 uqi->sm_flags, cmdflags));
2053 if (err = sm_qwait_sig(uqi, q))
2067 if (uqi->sm_piocdata.sm_iocid == 0) {
2072 if (err = sm_qwait_sig(uqi, q)) {
2080 uqi->sm_flags |= SM_IOCPENDING;
2082 uqi->sm_piocdata.sm_iocid =
2084 uqi->sm_piocdata.sm_acked = 0;
2085 uqi->sm_piocdata.sm_nacks = nqs;
2086 uqi->sm_piocdata.sm_acnt = 0;
2087 uqi->sm_piocdata.sm_ackcnt = uqi->
2089 uqi->sm_piocdata.sm_policy = uqi->sm_policy;
2090 uqi->sm_piocdata.sm_flags = SM_INTERNALIOC;
2092 uqi->sm_piocdata.sm_iocid = 0;
2098 sm_dbg('C', ("sm_defer_open: flags 0x%x\n", uqi->sm_flags));
2099 while ((uqi->sm_flags & SM_CARON) == 0 &&
2100 (uqi->sm_flags & SM_IOCPENDING) != 0)
2101 if (err = sm_qwait_sig(uqi, q))
2104 sm_dbg('C', ("defer_open: uq flags 0x%x.\n", uqi->sm_flags));
2116 sm_uqi_t *uqi;
2132 uqi = get_uqi(sm_ssp, unit);
2134 sm_dbg('C', ("open(0x%p, %d, 0x%x) :- unit=%d, proto=%d, uqi=0x%p\n",
2135 rq, *devp, flag, unit, protocol, uqi));
2137 if (uqi == 0)
2140 if (sm_refuse_opens && unit > smctlunit && uqi->sm_nlqs == 0)
2143 if (uqi->sm_flags & EXCL_OPEN && (flag & FEXCL)) {
2151 if ((uqi->sm_flags & FULLY_OPEN) || uqi->sm_nwaiters > 0)
2154 uqi->sm_flags |= EXCL_OPEN;
2157 if (uqi->sm_protocol == NULL_PROTOCOL) {
2169 uqi->sm_ttycommon->t_iflag = termiosp->c_iflag;
2170 uqi->sm_ttycommon->t_cflag = termiosp->c_cflag;
2171 uqi->sm_ttycommon->t_stopc = termiosp->c_cc[VSTOP];
2172 uqi->sm_ttycommon->t_startc = termiosp->c_cc[VSTART];
2187 bzero((caddr_t)uqi->sm_ttycommon,
2188 sizeof (uqi->sm_ttycommon));
2191 uqi->sm_cmask = sm_cmask;
2192 uqi->sm_ttycommon->t_flags |= TS_SOFTCAR;
2194 uqi->sm_ttycommon->t_flags &= ~TS_SOFTCAR;
2202 uqi->sm_ttycommon->t_cflag &= ~(uqi->sm_cmask|CLOCAL);
2203 uqi->sm_mbits = 0;
2204 uqi->sm_policy = FIRSTACK;
2211 sm_ssp->sm_lconsole = uqi;
2220 !(flag & (FNDELAY|FNONBLOCK)), !(protocol == OUTLINE), uqi->sm_lqs,
2221 uqi->sm_flags));
2226 if (ftstat = sm_ok_to_open(uqi, protocol, credp, &abort_waiters)) {
2229 if ((uqi->sm_flags & FULLY_OPEN) == 0 && uqi->sm_nwaiters == 0)
2230 uqi->sm_protocol = NULL_PROTOCOL;
2232 uqi->sm_flags &= ~EXCL_OPEN;
2237 uqi->sm_dev = *devp;
2239 SM_RQ(uqi) = rq;
2240 SM_WQ(uqi) = WR(rq);
2245 uqi->sm_dev = *devp;
2246 rq->q_ptr = WR(rq)->q_ptr = uqi;
2247 SM_RQ(uqi) = rq;
2248 SM_WQ(uqi) = WR(rq);
2250 for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) {
2259 if (*devp != rconsdev && BLOCKING(uqi, protocol, flag)) {
2261 uqi->sm_flags |= WANT_CDSTAT;
2270 if ((ftstat = sm_defer_open(uqi, rq)) != EINTR) {
2278 if (uqi->sm_nwaiters == 0) { /* clean up */
2286 if ((uqi->sm_flags & FULLY_OPEN) == 0) {
2290 uqi->sm_dev = NODEV;
2292 for (lqi = uqi->sm_lqs; lqi != 0;
2301 SM_RQ(uqi) = 0;
2302 SM_WQ(uqi) = 0;
2305 if ((uqi->sm_flags & FULLY_OPEN) == 0 &&
2306 uqi->sm_nwaiters == 0)
2307 uqi->sm_protocol = NULL_PROTOCOL;
2309 uqi->sm_flags &= ~EXCL_OPEN;
2312 } while (BLOCKING(uqi, protocol, flag));
2315 uqi->sm_flags |= FULLY_OPEN;
2328 sm_uqi_t *uqi = (sm_uqi_t *)rq->q_ptr;
2334 if (uqi == NULL) {
2339 sm_dbg('C', ("close: uqi=0x%p unit=%d q=0x%p)\n", uqi, uqi->sm_lunit,
2342 if (SM_RQ(uqi) != rq)
2343 sm_dbg('C', ("sm_close: rq != current uqi queue\n"));
2345 if (uqi->sm_ttybid) {
2346 qunbufcall(SM_RQ(uqi), uqi->sm_ttybid);
2347 uqi->sm_ttybid = 0;
2357 for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) {
2372 LOCK_UNIT(uqi);
2373 if (uqi->sm_waitq == 0)
2374 uqi->sm_flags = (uqi->sm_flags & SM_OBPCNDEV) ? SM_OBPCNDEV :
2377 uqi->sm_dev = NODEV;
2378 uqi->sm_protocol = NULL_PROTOCOL;
2379 ttycommon_close(uqi->sm_ttycommon);
2382 uqi->sm_ttycommon->t_cflag = 0;
2383 uqi->sm_ttycommon->t_flags = 0;
2392 UNLOCK_UNIT(uqi);
2394 if (sm_ssp->sm_lconsole == uqi) {
2402 if (uqi->sm_waitq) {
2404 rq, uqi->sm_waitq));
2405 if (rq == uqi->sm_waitq)
2407 (void) putctl(uqi->sm_waitq, M_CTL);
2410 uqi->sm_flags &= ~(EXCL_OPEN | FULLY_OPEN);
2463 sm_uqi_t *uqi;
2570 uqi = get_uqi(sm_ssp, unit);
2571 uqi->sm_lqs = 0;
2572 uqi->sm_dev = NODEV;
2573 uqi->sm_nlqs = 0;
2574 uqi->sm_lunit = unit;
2575 uqi->sm_protocol = NULL_PROTOCOL;
2576 mutex_init(uqi->sm_umutex, NULL, MUTEX_DRIVER, NULL);
2577 cv_init(uqi->sm_ucv, NULL, CV_DRIVER, NULL);
2578 mutex_init(&uqi->sm_ttycommon->t_excl, NULL,