Lines Matching refs:tp

157 	struct tty *tp;
165 tp = sc->sc_tty;
178 if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
181 if ((rr & RR_BREAK) && tp->t_dev == cn_tab->cn_dev) {
186 (*tp->t_linesw->l_rint)(code, tp);
191 if (tp != NULL) {
192 tp->t_state &= ~(TS_BUSY|TS_FLUSH);
193 (*tp->t_linesw->l_start)(tp);
199 siostart(struct tty *tp)
204 sc = device_lookup_private(&siotty_cd, minor(tp->t_dev));
206 if (tp->t_state & (TS_BUSY|TS_TIMEOUT|TS_TTSTOP))
208 if (!ttypull(tp))
210 tp->t_state |= TS_BUSY;
212 if ((c = getc(&tp->t_outq)) == -1)
221 siostop(struct tty *tp, int flag)
226 if (TS_BUSY == (tp->t_state & (TS_BUSY|TS_TTSTOP))) {
230 tp->t_state |= TS_FLUSH;
236 sioparam(struct tty *tp, struct termios *t)
241 sc = device_lookup_private(&siotty_cd, minor(tp->t_dev));
260 if (tp->t_ospeed == t->c_ospeed && tp->t_cflag == t->c_cflag)
263 tp->t_ispeed = t->c_ispeed;
264 tp->t_ospeed = t->c_ospeed;
265 tp->t_cflag = t->c_cflag;
269 switch (tp->t_cflag & CSIZE) {
277 if (tp->t_cflag & PARENB) {
279 if ((tp->t_cflag & PARODD) == 0)
282 wr4 |= (tp->t_cflag & CSTOPB) ? WR4_STOP2 : WR4_STOP1;
345 struct tty *tp;
351 if ((tp = sc->sc_tty) == NULL) {
352 tp = sc->sc_tty = tty_alloc();
353 tty_attach(tp);
356 tp->t_oproc = siostart;
357 tp->t_param = sioparam;
358 tp->t_hwiflow = NULL /* XXX siohwiflow XXX */;
359 tp->t_dev = dev;
361 if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
364 if ((tp->t_state & TS_ISOPEN) == 0 && tp->t_wopen == 0) {
369 tp->t_ospeed = 0; /* force register update */
370 (void)sioparam(tp, &t);
371 tp->t_iflag = TTYDEF_IFLAG;
372 tp->t_oflag = TTYDEF_OFLAG;
373 tp->t_lflag = TTYDEF_LFLAG;
374 ttychars(tp);
375 ttsetwater(tp);
378 tp->t_state |= TS_CARR_ON; /* assume detected all the time */
381 || (tp->t_cflag & MDMBUF)
383 tp->t_state |= TS_CARR_ON;
385 tp->t_state &= ~TS_CARR_ON;
389 error = ttyopen(tp, 0, (flag & O_NONBLOCK));
392 return (*tp->t_linesw->l_open)(dev, tp);
399 struct tty *tp = sc->sc_tty;
402 (*tp->t_linesw->l_close)(tp, flag);
407 if ((tp->t_cflag & HUPCL)
408 || tp->t_wopen || (tp->t_state & TS_ISOPEN) == 0) {
415 return ttyclose(tp);
422 struct tty *tp;
425 tp = sc->sc_tty;
426 return (*tp->t_linesw->l_read)(tp, uio, flag);
433 struct tty *tp;
436 tp = sc->sc_tty;
437 return (*tp->t_linesw->l_write)(tp, uio, flag);
444 struct tty *tp;
447 tp = sc->sc_tty;
448 return ((*tp->t_linesw->l_poll)(tp, events, l));
455 struct tty *tp;
459 tp = sc->sc_tty;
460 error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, l);
464 error = ttioctl(tp, cmd, data, flag, l);