Lines Matching refs:port

74 static void	fepcmd(struct digi_p *port, int cmd, int op, int ncmds);
84 #define fepcmd_b(port, cmd, op1, op2, ncmds) \
85 fepcmd(port, cmd, (op2 << 8) | op1, ncmds)
217 struct digi_p *port;
250 * another port module. For now, we just re-initialise
273 outb(sc->port, FEPCLR);
292 outb(sc->port, FEPRST | FEPMEM);
294 for (i = 0; ((sc->pcibus ? PCIPORT : inb(sc->port)) &
343 outb(sc->port, FEPCLR);
346 outb(sc->port, FEPCLR | FEPMEM);
350 for (i = 0; ((sc->pcibus ? PCIPORT : inb(sc->port)) & FEPMASK)
399 outb(sc->port, FEPREQ | FEPMEM);
400 outb(sc->port, FEPCLR | FEPMEM);
425 outb(sc->port, FEPREQ);
426 outb(sc->port, FEPCLR);
461 if (sc->port)
462 outb(sc->port, 0); /* XXX necessary ? */
481 outb(sc->port, FEPREQ | FEPMEM); /* send interrupt to BIOS */
482 outb(sc->port, FEPCLR | FEPMEM);
524 * XXX Should read port 0xc90 for an array of 2byte values, 1 per
525 * port. If the value is 0, the port is broken....
530 /* We should now init per-port structures */
538 port = sc->ports + i;
539 port->pnum = i;
540 port->sc = sc;
541 port->status = ENABLED;
542 port->bc = bc;
543 tp = port->tp = ttyalloc();
553 tp->t_sc = port;
556 port->txbuf = ptr +
558 port->rxbuf = ptr +
560 port->txwin = FEPWIN | ((bc->tseg - sc->mem_seg) >> 9);
561 port->rxwin = FEPWIN | ((bc->rseg - sc->mem_seg) >> 9);
563 port->txbuf = ptr + ((bc->tseg - sc->mem_seg) << 4);
564 port->rxbuf = ptr + ((bc->rseg - sc->mem_seg) << 4);
565 port->txwin = port->rxwin = 0;
567 port->txbuf = ptr +
569 port->rxbuf = ptr +
571 port->txwin = FEPWIN |
573 port->rxwin = FEPWIN |
576 port->txbufsize = bc->tmax + 1;
577 port->rxbufsize = bc->rmax + 1;
579 lowwater = port->txbufsize >> 2;
583 fepcmd_w(port, STXLWATER, lowwater, 10);
584 fepcmd_w(port, SRXLWATER, port->rxbufsize >> 2, 10);
585 fepcmd_w(port, SRXHWATER, (3 * port->rxbufsize) >> 2, 10);
590 port->send_ring = 1; /* Default action on signal RI */
606 struct digi_p *port;
609 port = tp->t_sc;
610 sc = port->sc;
613 port->sc->setwin(port->sc, 0);
614 mstat = port->bc->mstat;
615 port->sc->hidewin(port->sc);
616 if (mstat & port->sc->csigs->rts)
618 if (mstat & port->cd)
620 if (mstat & port->dsr)
622 if (mstat & port->sc->csigs->cts)
624 if (mstat & port->sc->csigs->ri)
626 if (mstat & port->sc->csigs->dtr)
635 bitand |= port->sc->csigs->dtr;
637 bitand |= port->sc->csigs->rts;
639 bitor |= port->sc->csigs->dtr;
641 bitor |= port->sc->csigs->rts;
642 fepcmd_b(port, SETMODEM, bitor, ~bitand, 0);
665 struct digi_p *port;
668 port = tp->t_sc;
669 sc = port->sc;
675 bc = port->bc;
689 bc->mint = port->cd | port->sc->csigs->ri;
691 if (port->ialtpin) {
692 port->cd = sc->csigs->dsr;
693 port->dsr = sc->csigs->cd;
695 port->cd = sc->csigs->cd;
696 port->dsr = sc->csigs->dsr;
718 struct digi_p *port = chan;
720 port->status &= ~DIGI_DTR_OFF;
721 wakeup(&port->tp->t_dtr_wait);
722 port->tp->t_wopeners--;
729 struct digi_p *port;
732 port = tp->t_sc;
733 bc = port->bc;
736 port->sc->setwin(port->sc, 0);
742 (!tp->t_actout && !(bc->mstat & port->cd) &&
749 timeout(&digidtrwakeup, port, tp->t_dtr_wait);
750 port->status |= DIGI_DTR_OFF;
836 struct digi_p *port;
839 port = dev->si_drv1;
840 sc = port->sc;
845 *(int *)data = port->ialtpin;
847 *(int *)data = port->laltpin;
853 if (!port->laltpin) {
854 port->ialtpin = !!*(int *)data;
856 "port%d: initial ALTPIN %s\n", port->pnum,
857 port->ialtpin ? "set" : "cleared"));
860 port->laltpin = !!*(int *)data;
862 "port%d: ALTPIN %slocked\n",
863 port->pnum, port->laltpin ? "" : "un"));
915 struct digi_p *port;
921 port = tp->t_sc;
922 sc = port->sc;
926 if (!(port->status & ENABLED))
931 *(int *)data = !!(port->dsr == sc->csigs->cd);
935 if (!port->laltpin) {
938 "port%d: ALTPIN set\n", port->pnum));
939 port->cd = sc->csigs->dsr;
940 port->dsr = sc->csigs->cd;
943 "port%d: ALTPIN cleared\n", port->pnum));
944 port->cd = sc->csigs->cd;
945 port->dsr = sc->csigs->dsr;
957 port->send_ring = (u_char)*(int *)data;
968 struct digi_p *port;
970 port = tp->t_sc;
977 fepcmd_w(port, SENDBREAK, 400, 10);
984 struct digi_p *port;
991 port = tp->t_sc;
992 sc = port->sc;
993 DLOG(DIGIDB_SET, (sc->dev, "port%d: setting parameters\n", port->pnum));
1009 DLOG(DIGIDB_SET, (sc->dev, "port%d: hangup\n", port->pnum));
1010 digimodem(port->tp, 0, SER_DTR | SER_RTS);
1012 digimodem(port->tp, SER_DTR | SER_RTS, 0);
1014 DLOG(DIGIDB_SET, (sc->dev, "port%d: CBAUD = %d\n", port->pnum,
1038 DLOG(DIGIDB_SET, (sc->dev, "port%d: CFLAG = 0x%x\n", port->pnum,
1040 fepcmd_w(port, SETCFLAGS, (unsigned)cflag, 0);
1045 if (port->c_iflag & IXON)
1047 if (port->c_iflag & IXANY)
1049 if (port->c_iflag & IXOFF)
1052 DLOG(DIGIDB_SET, (sc->dev, "port%d: set iflag = 0x%x\n", port->pnum, iflag));
1053 fepcmd_w(port, SETIFLAGS, (unsigned)iflag, 0);
1063 hflow |= port->dsr;
1065 hflow |= port->cd;
1067 DLOG(DIGIDB_SET, (sc->dev, "port%d: set hflow = 0x%x\n", port->pnum, hflow));
1068 fepcmd_w(port, SETHFLOW, 0xff00 | (unsigned)hflow, 0);
1070 DLOG(DIGIDB_SET, (sc->dev, "port%d: set startc(0x%x), stopc(0x%x)\n",
1071 port->pnum, t->c_cc[VSTART], t->c_cc[VSTOP]));
1072 fepcmd_b(port, SONOFFC, t->c_cc[VSTART], t->c_cc[VSTOP], 0);
1086 struct digi_p *port;
1178 log(LOG_ERR, "digi%d: port %d: got event"
1179 " on nonexisting port\n", sc->res.unit,
1183 port = &sc->ports[event.pnum];
1184 bc = port->bc;
1185 tp = port->tp;
1189 "port %d: event 0x%x on closed port\n",
1199 log(LOG_ERR, "digi%d: port%d: ? event 0x%x mstat 0x%x"
1204 DLOG(DIGIDB_IRQ, (sc->dev, "port %d: DATA_IND\n",
1206 wrapmask = port->rxbufsize - 1;
1219 "port %d: p rx head = %d tail = %d\n",
1222 sc->towin(sc, port->rxwin);
1225 size = b_to_q((char *)port->rxbuf +
1230 ttyld_rint(tp, port->rxbuf[tail]);
1231 sc->towin(sc, port->rxwin);
1246 CE_RECORD(port, CE_OVERRUN);
1247 log(LOG_ERR, "digi%d: port%d: %s\n",
1255 port->status |= PAUSE_RX;
1256 DLOG(DIGIDB_RX, (sc->dev, "port %d: pause RX\n",
1264 DLOG(DIGIDB_MODEM, (sc->dev, "port %d: MODEMCHG_IND\n",
1267 if ((event.mstat ^ event.lstat) & port->cd) {
1269 ttyld_modem(tp, event.mstat & port->cd);
1275 DLOG(DIGIDB_RI, (sc->dev, "port %d: RING\n",
1277 if (port->send_ring) {
1288 DLOG(DIGIDB_MODEM, (sc->dev, "port %d: BREAK_IND\n",
1293 DLOG(DIGIDB_IRQ, (sc->dev, "port %d:%s%s\n",
1311 struct digi_p *port;
1319 port = tp->t_sc;
1320 sc = port->sc;
1321 bc = port->bc;
1323 wmask = port->txbufsize - 1;
1326 port->lcc = tp->t_outq.c_cc;
1329 if (port->status & PAUSE_RX) {
1330 DLOG(DIGIDB_RX, (sc->dev, "port %d: resume RX\n",
1331 port->pnum));
1337 port->status &= ~PAUSE_RX;
1340 if (!(tp->t_state & TS_TTSTOP) && port->status & PAUSE_TX) {
1341 DLOG(DIGIDB_TX, (sc->dev, "port %d: resume TX\n", port->pnum));
1342 port->status &= ~PAUSE_TX;
1343 fepcmd_w(port, RESUMETX, 0, 10);
1353 DLOG(DIGIDB_INT, (sc->dev, "port%d: s tx head = %d tail = %d\n",
1354 port->pnum, head, tail));
1359 size = port->txbufsize - head;
1366 sc->towin(sc, port->txwin);
1367 ocount = q_to_b(&tp->t_outq, port->txbuf + head, size);
1376 port->lostcc = tp->t_outq.c_cc;
1379 size = port->txbufsize - tail + head;
1383 port->lbuf = size;
1384 DLOG(DIGIDB_INT, (sc->dev, "port%d: s total cnt = %d\n", port->pnum, totcnt));
1393 struct digi_p *port;
1395 port = tp->t_sc;
1396 sc = port->sc;
1398 DLOG(DIGIDB_TX, (sc->dev, "port %d: pause TX\n", port->pnum));
1399 port->status |= PAUSE_TX;
1400 fepcmd_w(port, PAUSETX, 0, 10);
1404 fepcmd(struct digi_p *port, int cmd, int op1, int ncmds)
1410 mem = port->sc->memcmd;
1412 port->sc->setwin(port->sc, 0);
1414 head = port->sc->gdata->cin;
1416 mem[head + 1] = port->pnum;
1419 head = (head + 4) & port->sc->gdata->cmax;
1420 port->sc->gdata->cin = head;
1423 head = port->sc->gdata->cin;
1424 tail = port->sc->gdata->cout;
1425 n = (head - tail) & port->sc->gdata->cmax;
1431 log(LOG_ERR, "digi%d: port%d: timeout on FEP command\n",
1432 port->sc->res.unit, port->pnum);
1469 struct digi_p *port;
1471 port = &sc->ports[0];
1472 for (i = 0; i < sc->numports; i++, port++)
1473 if (port->tp->t_state & TS_ISOPEN) {
1474 DLOG(DIGIDB_INIT, (sc->dev, "port%d: busy\n", i));
1476 } else if (port->tp->t_wopeners || port->opencnt) {
1477 DLOG(DIGIDB_INIT, (sc->dev, "port%d: blocked in open\n",