Index: head/etc/etc.sparc64/ttys =================================================================== --- head/etc/etc.sparc64/ttys (revision 109920) +++ head/etc/etc.sparc64/ttys (revision 109921) @@ -1,311 +1,311 @@ # # $FreeBSD$ # @(#)ttys 5.1 (Berkeley) 4/17/89 # # This file specifies various information about terminals on the system. # It is used by several different programs. Common entries for the # various columns include: # # name The name of the terminal device. # # getty The program to start running on the terminal. Typically a # getty program, as the name implies. Other common entries # include none, when no getty is needed, and xdm, to start the # X Window System. # # type The initial terminal type for this port. For hardwired # terminal lines, this will contain the type of terminal used. # For virtual consoles, the correct type is typically cons25, but # vt220 will work better if you need interoperability with other # systems like Solaris or GNU/Linux. # Other common values include network for network connections on # pseudo-terminals, dialup for incoming modem ports, and unknown # when the terminal type cannot be predetermined. # # status Must be on or off. If on, init will run the getty program on # the specified port. If the word "secure" appears, this tty # allows root login. # # name getty type status comments # # If console is marked "insecure", then init will ask for the root password # when going to single-user mode. console none unknown off secure -# Openfirmware console -ofwcons "/usr/libexec/getty std.9600" vt100 on secure # +screen "/usr/libexec/getty Pc" cons25 on secure +ttya "/usr/libexec/getty 3wire.9600" cons25 on secure +ttyb "/usr/libexec/getty 3wire.9600" cons25 off secure +# #ttyv0 "/usr/libexec/getty Pc" cons25 on secure # Virtual terminals #ttyv1 "/usr/libexec/getty Pc" cons25 on secure #ttyv2 "/usr/libexec/getty Pc" cons25 on secure #ttyv3 "/usr/libexec/getty Pc" cons25 on secure #ttyv4 "/usr/libexec/getty Pc" cons25 on secure #ttyv5 "/usr/libexec/getty Pc" cons25 on secure #ttyv6 "/usr/libexec/getty Pc" cons25 on secure #ttyv7 "/usr/libexec/getty Pc" cons25 on secure #ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttya "/usr/libexec/getty local.9600" dialup off secure -ttyb "/usr/libexec/getty local.9600" dialup off secure ttyd0 "/usr/libexec/getty std.9600" dialup off secure ttyd1 "/usr/libexec/getty std.9600" dialup off secure ttyd2 "/usr/libexec/getty std.9600" dialup off secure ttyd3 "/usr/libexec/getty std.9600" dialup off secure # Pseudo terminals ttyp0 none network ttyp1 none network ttyp2 none network ttyp3 none network ttyp4 none network ttyp5 none network ttyp6 none network ttyp7 none network ttyp8 none network ttyp9 none network ttypa none network ttypb none network ttypc none network ttypd none network ttype none network ttypf none network ttypg none network ttyph none network ttypi none network ttypj none network ttypk none network ttypl none network ttypm none network ttypn none network ttypo none network ttypp none network ttypq none network ttypr none network ttyps none network ttypt none network ttypu none network ttypv none network ttyq0 none network ttyq1 none network ttyq2 none network ttyq3 none network ttyq4 none network ttyq5 none network ttyq6 none network ttyq7 none network ttyq8 none network ttyq9 none network ttyqa none network ttyqb none network ttyqc none network ttyqd none network ttyqe none network ttyqf none network ttyqg none network ttyqh none network ttyqi none network ttyqj none network ttyqk none network ttyql none network ttyqm none network ttyqn none network ttyqo none network ttyqp none network ttyqq none network ttyqr none network ttyqs none network ttyqt none network ttyqu none network ttyqv none network ttyr0 none network ttyr1 none network ttyr2 none network ttyr3 none network ttyr4 none network ttyr5 none network ttyr6 none network ttyr7 none network ttyr8 none network ttyr9 none network ttyra none network ttyrb none network ttyrc none network ttyrd none network ttyre none network ttyrf none network ttyrg none network ttyrh none network ttyri none network ttyrj none network ttyrk none network ttyrl none network ttyrm none network ttyrn none network ttyro none network ttyrp none network ttyrq none network ttyrr none network ttyrs none network ttyrt none network ttyru none network ttyrv none network ttys0 none network ttys1 none network ttys2 none network ttys3 none network ttys4 none network ttys5 none network ttys6 none network ttys7 none network ttys8 none network ttys9 none network ttysa none network ttysb none network ttysc none network ttysd none network ttyse none network ttysf none network ttysg none network ttysh none network ttysi none network ttysj none network ttysk none network ttysl none network ttysm none network ttysn none network ttyso none network ttysp none network ttysq none network ttysr none network ttyss none network ttyst none network ttysu none network ttysv none network ttyP0 none network ttyP1 none network ttyP2 none network ttyP3 none network ttyP4 none network ttyP5 none network ttyP6 none network ttyP7 none network ttyP8 none network ttyP9 none network ttyPa none network ttyPb none network ttyPc none network ttyPd none network ttyPe none network ttyPf none network ttyPg none network ttyPh none network ttyPi none network ttyPj none network ttyPk none network ttyPl none network ttyPm none network ttyPn none network ttyPo none network ttyPp none network ttyPq none network ttyPr none network ttyPs none network ttyPt none network ttyPu none network ttyPv none network ttyQ0 none network ttyQ1 none network ttyQ2 none network ttyQ3 none network ttyQ4 none network ttyQ5 none network ttyQ6 none network ttyQ7 none network ttyQ8 none network ttyQ9 none network ttyQa none network ttyQb none network ttyQc none network ttyQd none network ttyQe none network ttyQf none network ttyQg none network ttyQh none network ttyQi none network ttyQj none network ttyQk none network ttyQl none network ttyQm none network ttyQn none network ttyQo none network ttyQp none network ttyQq none network ttyQr none network ttyQs none network ttyQt none network ttyQu none network ttyQv none network ttyR0 none network ttyR1 none network ttyR2 none network ttyR3 none network ttyR4 none network ttyR5 none network ttyR6 none network ttyR7 none network ttyR8 none network ttyR9 none network ttyRa none network ttyRb none network ttyRc none network ttyRd none network ttyRe none network ttyRf none network ttyRg none network ttyRh none network ttyRi none network ttyRj none network ttyRk none network ttyRl none network ttyRm none network ttyRn none network ttyRo none network ttyRp none network ttyRq none network ttyRr none network ttyRs none network ttyRt none network ttyRu none network ttyRv none network ttyS0 none network ttyS1 none network ttyS2 none network ttyS3 none network ttyS4 none network ttyS5 none network ttyS6 none network ttyS7 none network ttyS8 none network ttyS9 none network ttySa none network ttySb none network ttySc none network ttySd none network ttySe none network ttySf none network ttySg none network ttySh none network ttySi none network ttySj none network ttySk none network ttySl none network ttySm none network ttySn none network ttySo none network ttySp none network ttySq none network ttySr none network ttySs none network ttySt none network ttySu none network ttySv none network Index: head/sys/dev/ofw/ofw_console.c =================================================================== --- head/sys/dev/ofw/ofw_console.c (revision 109920) +++ head/sys/dev/ofw/ofw_console.c (revision 109921) @@ -1,325 +1,326 @@ /* * Copyright (C) 2001 Benno Rice. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef lint static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ #include #include #include #include #include #include #include #include #include #define OFW_POLL_HZ 4 static d_open_t ofw_dev_open; static d_close_t ofw_dev_close; static d_ioctl_t ofw_dev_ioctl; #define CDEV_MAJOR 97 static struct cdevsw ofw_cdevsw = { /* open */ ofw_dev_open, /* close */ ofw_dev_close, /* read */ ttyread, /* write */ ttywrite, /* ioctl */ ofw_dev_ioctl, /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ "ofw", /* major */ CDEV_MAJOR, /* dump */ nodump, /* psize */ nopsize, /* flags */ 0, }; static struct tty *ofw_tp = NULL; static int polltime; static struct callout_handle ofw_timeouthandle = CALLOUT_HANDLE_INITIALIZER(&ofw_timeouthandle); static void ofw_tty_start(struct tty *); static int ofw_tty_param(struct tty *, struct termios *); static void ofw_tty_stop(struct tty *, int); static void ofw_timeout(void *); static cn_probe_t ofw_cons_probe; static cn_init_t ofw_cons_init; static cn_getc_t ofw_cons_getc; static cn_checkc_t ofw_cons_checkc; static cn_putc_t ofw_cons_putc; CONS_DRIVER(ofw, ofw_cons_probe, ofw_cons_init, NULL, ofw_cons_getc, ofw_cons_checkc, ofw_cons_putc, NULL); static void cn_drvinit(void *unused) { phandle_t options; char output[32]; if (ofw_consdev.cn_dev != NULL) { if ((options = OF_finddevice("/options")) == -1 || OF_getprop(options, "output-device", output, sizeof(output)) == -1) return; - make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "ofwcons"); - make_dev_alias(ofw_consdev.cn_dev, "%s", output); + make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s", + output); + make_dev_alias(ofw_consdev.cn_dev, "ofwcons"); } } SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE + CDEV_MAJOR, cn_drvinit, NULL) static int stdin; static int stdout; static int ofw_dev_open(dev_t dev, int flag, int mode, struct thread *td) { struct tty *tp; int unit; int error, setuptimeout; error = 0; setuptimeout = 0; unit = minor(dev); tp = ofw_tp = dev->si_tty = ttymalloc(ofw_tp); tp->t_oproc = ofw_tty_start; tp->t_param = ofw_tty_param; tp->t_stop = ofw_tty_stop; tp->t_dev = dev; if ((tp->t_state & TS_ISOPEN) == 0) { tp->t_state |= TS_CARR_ON; ttychars(tp); tp->t_iflag = TTYDEF_IFLAG; tp->t_oflag = TTYDEF_OFLAG; tp->t_cflag = TTYDEF_CFLAG|CLOCAL; tp->t_lflag = TTYDEF_LFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); setuptimeout = 1; } else if ((tp->t_state & TS_XCLUDE) && suser(td)) { return (EBUSY); } error = (*linesw[tp->t_line].l_open)(dev, tp); if (error == 0 && setuptimeout) { polltime = hz / OFW_POLL_HZ; if (polltime < 1) { polltime = 1; } ofw_timeouthandle = timeout(ofw_timeout, tp, polltime); } return (error); } static int ofw_dev_close(dev_t dev, int flag, int mode, struct thread *td) { int unit; struct tty *tp; unit = minor(dev); tp = ofw_tp; if (unit != 0) { return (ENXIO); } (*linesw[tp->t_line].l_close)(tp, flag); ttyclose(tp); return (0); } static int ofw_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int unit; struct tty *tp; int error; unit = minor(dev); tp = ofw_tp; if (unit != 0) { return (ENXIO); } error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) { return (error); } error = ttioctl(tp, cmd, data, flag); if (error != ENOIOCTL) { return (error); } return (ENOTTY); } static int ofw_tty_param(struct tty *tp, struct termios *t) { return (0); } static void ofw_tty_start(struct tty *tp) { if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { ttwwakeup(tp); return; } tp->t_state |= TS_BUSY; while (tp->t_outq.c_cc != 0) { ofw_cons_putc(tp->t_dev, getc(&tp->t_outq)); } tp->t_state &= ~TS_BUSY; ttwwakeup(tp); } static void ofw_tty_stop(struct tty *tp, int flag) { if (tp->t_state & TS_BUSY) { if ((tp->t_state & TS_TTSTOP) == 0) { tp->t_state |= TS_FLUSH; } } } static void ofw_timeout(void *v) { struct tty *tp; int c; tp = (struct tty *)v; while ((c = ofw_cons_checkc(tp->t_dev)) != -1) { if (tp->t_state & TS_ISOPEN) { (*linesw[tp->t_line].l_rint)(c, tp); } } ofw_timeouthandle = timeout(ofw_timeout, tp, polltime); } static void ofw_cons_probe(struct consdev *cp) { int chosen; if ((chosen = OF_finddevice("/chosen")) == -1) { cp->cn_pri = CN_DEAD; return; } if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) == -1) { cp->cn_pri = CN_DEAD; return; } if (OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == -1) { cp->cn_pri = CN_DEAD; return; } cp->cn_dev = NULL; cp->cn_pri = CN_INTERNAL; } static void ofw_cons_init(struct consdev *cp) { cp->cn_dev = makedev(CDEV_MAJOR, 0); cp->cn_tp = ofw_tp; } static int ofw_cons_getc(dev_t dev) { unsigned char ch; int l; ch = '\0'; while ((l = OF_read(stdin, &ch, 1)) != 1) { if (l != -2 && l != 0) { return (-1); } } return (ch); } static int ofw_cons_checkc(dev_t dev) { unsigned char ch; if (OF_read(stdin, &ch, 1) > 0) { return (ch); } return (-1); } static void ofw_cons_putc(dev_t dev, int c) { char cbuf; if (c == '\n') { cbuf = '\r'; OF_write(stdout, &cbuf, 1); } cbuf = c; OF_write(stdout, &cbuf, 1); }