2000-01-09 06:55:28 +03:00
|
|
|
/* $NetBSD: rcons.c,v 1.37 2000/01/09 03:55:42 simonb Exp $ */
|
1995-04-11 14:23:32 +04:00
|
|
|
|
|
|
|
/*
|
1995-09-11 11:45:36 +04:00
|
|
|
* Copyright (c) 1995
|
1995-04-11 14:23:32 +04:00
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
1995-09-11 11:45:36 +04:00
|
|
|
* Ted Lemon.
|
1995-04-11 14:23:32 +04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 THE REGENTS OR CONTRIBUTORS 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1996-02-02 21:05:36 +03:00
|
|
|
#include "rasterconsole.h"
|
1995-10-05 04:52:44 +03:00
|
|
|
#if NRASTERCONSOLE > 0
|
1995-09-11 11:45:36 +04:00
|
|
|
|
1995-04-11 14:23:32 +04:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/buf.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/tty.h>
|
|
|
|
#include <sys/file.h>
|
1995-09-11 11:45:36 +04:00
|
|
|
#include <sys/stat.h>
|
1995-04-11 14:23:32 +04:00
|
|
|
#include <sys/conf.h>
|
1996-05-19 05:06:14 +04:00
|
|
|
#include <machine/conf.h>
|
1995-09-11 11:45:36 +04:00
|
|
|
#include <sys/vnode.h>
|
1995-04-11 14:23:32 +04:00
|
|
|
|
|
|
|
#include <pmax/dev/sccreg.h>
|
|
|
|
#include <pmax/pmax/kn01.h>
|
|
|
|
#include <pmax/pmax/kn02.h>
|
|
|
|
#include <pmax/pmax/kmin.h>
|
|
|
|
#include <pmax/pmax/maxine.h>
|
|
|
|
#include <pmax/pmax/kn03.h>
|
|
|
|
#include <pmax/pmax/asic.h>
|
1999-12-30 03:31:02 +03:00
|
|
|
#include <pmax/pmax/cons.h>
|
1995-04-11 14:23:32 +04:00
|
|
|
#include <pmax/pmax/turbochannel.h>
|
|
|
|
#include <pmax/pmax/pmaxtype.h>
|
1998-03-24 03:23:55 +03:00
|
|
|
#include <pmax/dev/rconsvar.h>
|
1995-04-11 14:23:32 +04:00
|
|
|
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <machine/fbio.h>
|
1999-04-13 22:53:27 +04:00
|
|
|
#include <dev/wscons/wsdisplayvar.h>
|
2000-01-07 16:43:02 +03:00
|
|
|
#include <dev/wscons/wsconsio.h>
|
1995-09-23 03:48:20 +04:00
|
|
|
#include <dev/rcons/rcons.h>
|
1999-04-22 04:33:30 +04:00
|
|
|
#include <dev/wsfont/wsfont.h>
|
1999-04-13 22:53:27 +04:00
|
|
|
#include <dev/rasops/rasops.h>
|
1995-04-11 14:23:32 +04:00
|
|
|
#include <machine/fbvar.h>
|
|
|
|
|
1995-09-11 11:45:36 +04:00
|
|
|
#include <machine/pmioctl.h>
|
|
|
|
#include <pmax/dev/fbreg.h>
|
1999-01-28 13:35:53 +03:00
|
|
|
#include <pmax/dev/lk201var.h>
|
1995-09-11 11:45:36 +04:00
|
|
|
|
1999-04-22 04:33:30 +04:00
|
|
|
#include "fb.h"
|
1999-04-24 19:22:45 +04:00
|
|
|
#include "px.h"
|
1995-04-11 14:23:32 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Console I/O is redirected to the appropriate device, either a screen and
|
|
|
|
* keyboard, a serial port, or the "virtual" console.
|
|
|
|
*/
|
|
|
|
|
2000-01-09 06:55:28 +03:00
|
|
|
extern struct tty *constty; /* XXX virtual console output device */
|
1995-04-11 14:23:32 +04:00
|
|
|
struct tty *fbconstty; /* Frame buffer console tty... */
|
1995-10-05 04:52:44 +03:00
|
|
|
struct tty rcons_tty [NRASTERCONSOLE]; /* Console tty struct... */
|
1995-04-11 14:23:32 +04:00
|
|
|
|
2000-01-09 06:55:28 +03:00
|
|
|
dev_t cn_in_dev = NODEV; /* console input device. */
|
1995-09-11 11:45:36 +04:00
|
|
|
|
|
|
|
char rcons_maxcols [20];
|
|
|
|
|
1999-04-13 22:53:27 +04:00
|
|
|
static struct rconsole rc;
|
|
|
|
|
2000-01-09 06:55:28 +03:00
|
|
|
static void rcons_vputc __P((dev_t dev, int c));
|
1998-03-24 03:23:55 +03:00
|
|
|
#ifdef notyet
|
2000-01-08 04:02:35 +03:00
|
|
|
void rconsstart __P((struct tty *));
|
1998-03-24 03:23:55 +03:00
|
|
|
static void rcons_later __P((void*));
|
|
|
|
#endif
|
1995-09-23 03:48:20 +04:00
|
|
|
|
1996-05-19 05:06:14 +04:00
|
|
|
|
1995-09-23 03:48:20 +04:00
|
|
|
/*
|
|
|
|
* rcons_connect is called by fbconnect when the first frame buffer is
|
|
|
|
* attached. That frame buffer will always be the console frame buffer.
|
|
|
|
*/
|
1999-04-22 04:33:30 +04:00
|
|
|
#if NFB > 0
|
1995-09-23 03:48:20 +04:00
|
|
|
void
|
1995-04-21 05:24:26 +04:00
|
|
|
rcons_connect (info)
|
|
|
|
struct fbinfo *info;
|
1995-04-11 14:23:32 +04:00
|
|
|
{
|
1999-04-13 22:53:27 +04:00
|
|
|
static struct rasops_info ri;
|
1999-04-22 04:33:30 +04:00
|
|
|
int cookie;
|
1999-04-24 12:01:01 +04:00
|
|
|
|
1999-04-13 22:53:27 +04:00
|
|
|
/* TC mfb has special needs; 8-bits per pel, but monochrome */
|
|
|
|
if (info->fi_type.fb_boardtype == PMAX_FBTYPE_MFB) {
|
|
|
|
ri.ri_depth = 8;
|
1999-08-24 15:16:03 +04:00
|
|
|
ri.ri_flg = RI_CLEAR | RI_FORCEMONO;
|
|
|
|
} else {
|
1999-04-13 22:53:27 +04:00
|
|
|
ri.ri_depth = info->fi_type.fb_depth;
|
1999-08-24 15:16:03 +04:00
|
|
|
ri.ri_flg = RI_CLEAR;
|
|
|
|
}
|
1999-04-24 12:01:01 +04:00
|
|
|
|
1999-04-13 22:53:27 +04:00
|
|
|
ri.ri_width = info->fi_type.fb_width;
|
|
|
|
ri.ri_height = info->fi_type.fb_height;
|
|
|
|
ri.ri_stride = info->fi_linebytes;
|
|
|
|
ri.ri_bits = (u_char *)info->fi_pixels;
|
1999-04-22 04:33:30 +04:00
|
|
|
|
|
|
|
wsfont_init();
|
1999-04-24 12:01:01 +04:00
|
|
|
|
1999-04-22 04:33:30 +04:00
|
|
|
/* Choose 'Gallant' font if this is an 8-bit display */
|
1999-05-15 17:04:03 +04:00
|
|
|
if (ri.ri_depth == 8 && (cookie = wsfont_find("Gallant", 0, 0, 0)) > 0)
|
2000-01-05 21:44:21 +03:00
|
|
|
wsfont_lock(cookie, &ri.ri_font, WSDISPLAY_FONTORDER_L2R,
|
|
|
|
WSDISPLAY_FONTORDER_L2R);
|
1999-04-22 04:33:30 +04:00
|
|
|
|
1999-04-13 22:53:27 +04:00
|
|
|
/* Get operations set and set framebugger colormap */
|
1999-08-24 15:16:03 +04:00
|
|
|
if (rasops_init(&ri, 5000, 80))
|
1999-05-15 17:04:03 +04:00
|
|
|
panic("rcons_connect: rasops_init failed");
|
1999-04-22 04:33:30 +04:00
|
|
|
|
1999-04-13 22:53:27 +04:00
|
|
|
if (ri.ri_depth == 8 && info->fi_type.fb_boardtype != PMAX_FBTYPE_MFB)
|
|
|
|
info->fi_driver->fbd_putcmap(info, rasops_cmap, 0, 256);
|
1995-09-11 11:45:36 +04:00
|
|
|
|
1995-04-11 14:23:32 +04:00
|
|
|
fbconstty = &rcons_tty [0];
|
|
|
|
fbconstty->t_dev = makedev(85, 0); /* /dev/console */
|
|
|
|
fbconstty->t_ispeed = fbconstty->t_ospeed = TTYDEF_SPEED;
|
|
|
|
fbconstty->t_param = (int (*)(struct tty *, struct termios *))nullop;
|
|
|
|
|
1995-09-23 03:48:20 +04:00
|
|
|
/*
|
|
|
|
* Connect the console geometry...
|
|
|
|
* the part that rcons.h says
|
|
|
|
* "This section must be filled in by the framebugger device"
|
|
|
|
*/
|
1999-04-13 22:53:27 +04:00
|
|
|
rc.rc_ops = &ri.ri_ops;
|
|
|
|
rc.rc_cookie = &ri;
|
|
|
|
rc.rc_maxrow = ri.ri_rows;
|
|
|
|
rc.rc_maxcol = ri.ri_cols;
|
1999-01-28 13:35:53 +03:00
|
|
|
rc.rc_bell = lk_bell;
|
1999-04-13 22:53:27 +04:00
|
|
|
rc.rc_width = ri.ri_width;
|
|
|
|
rc.rc_height = ri.ri_height;
|
1999-05-23 21:59:39 +04:00
|
|
|
rc.rc_row = 0;
|
|
|
|
rc.rc_col = 0;
|
1999-08-27 00:49:40 +04:00
|
|
|
rc.rc_deffgcolor = WSCOL_WHITE;
|
|
|
|
rc.rc_defbgcolor = WSCOL_BLACK;
|
1999-05-20 00:34:19 +04:00
|
|
|
rcons_init(&rc, 1);
|
1999-04-13 22:53:27 +04:00
|
|
|
}
|
1999-04-22 04:33:30 +04:00
|
|
|
#endif
|
1995-10-05 04:52:44 +03:00
|
|
|
|
|
|
|
|
1999-04-13 22:53:27 +04:00
|
|
|
/*
|
|
|
|
* Called by drivers which can provide a native 'struct wsdisplay_emulops'.
|
|
|
|
*/
|
1999-04-22 04:33:30 +04:00
|
|
|
#if NPX > 0
|
1999-04-13 22:53:27 +04:00
|
|
|
void
|
|
|
|
rcons_connect_native (ops, cookie, width, height, cols, rows)
|
|
|
|
struct wsdisplay_emulops *ops;
|
|
|
|
void *cookie;
|
|
|
|
int width, height, cols, rows;
|
|
|
|
{
|
|
|
|
/*XXX*/ cn_in_dev = cn_tab->cn_dev; /*XXX*/ /* FIXME */
|
1995-04-11 14:23:32 +04:00
|
|
|
|
1999-04-13 22:53:27 +04:00
|
|
|
fbconstty = &rcons_tty [0];
|
|
|
|
fbconstty->t_dev = makedev(85, 0); /* /dev/console */
|
|
|
|
fbconstty->t_ispeed = fbconstty->t_ospeed = TTYDEF_SPEED;
|
|
|
|
fbconstty->t_param = (int (*)(struct tty *, struct termios *))nullop;
|
1995-10-05 04:52:44 +03:00
|
|
|
|
1999-04-13 22:53:27 +04:00
|
|
|
/*
|
|
|
|
* Connect the console geometry...
|
|
|
|
* the part that rcons.h says
|
|
|
|
* "This section must be filled in by the framebugger device"
|
|
|
|
*/
|
|
|
|
rc.rc_ops = ops;
|
|
|
|
rc.rc_cookie = cookie;
|
|
|
|
rc.rc_bell = lk_bell;
|
|
|
|
rc.rc_width = width;
|
|
|
|
rc.rc_height = width;
|
|
|
|
rc.rc_maxcol = cols;
|
|
|
|
rc.rc_maxrow = rows;
|
1999-05-23 21:59:39 +04:00
|
|
|
rc.rc_row = 0;
|
|
|
|
rc.rc_col = 0;
|
1999-08-27 00:49:40 +04:00
|
|
|
rc.rc_deffgcolor = WSCOL_WHITE;
|
|
|
|
rc.rc_defbgcolor = WSCOL_BLACK;
|
1999-05-20 00:34:19 +04:00
|
|
|
rcons_init(&rc, 1);
|
1995-09-23 03:48:20 +04:00
|
|
|
}
|
1999-04-22 04:33:30 +04:00
|
|
|
#endif
|
1999-04-13 22:53:27 +04:00
|
|
|
|
1999-04-24 12:01:01 +04:00
|
|
|
/*
|
1995-09-23 03:48:20 +04:00
|
|
|
* Hack around the rcons putchar interface not taking a dev_t.
|
|
|
|
*/
|
2000-01-09 06:55:28 +03:00
|
|
|
static void
|
1995-09-23 03:48:20 +04:00
|
|
|
rcons_vputc(dev, c)
|
|
|
|
dev_t dev;
|
|
|
|
int c;
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Call the pointer-to-function that rcons_init tried to give us,
|
|
|
|
* discarding the dev_t argument.
|
|
|
|
*/
|
|
|
|
rcons_cnputc(c);
|
1995-04-11 14:23:32 +04:00
|
|
|
}
|
|
|
|
|
1998-03-24 03:23:55 +03:00
|
|
|
/*
|
|
|
|
* Set up the console device to take input from `dev'
|
|
|
|
* and send output via rcons.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
rcons_indev(cn)
|
|
|
|
struct consdev *cn;
|
|
|
|
{
|
1999-04-24 12:01:01 +04:00
|
|
|
int s;
|
1998-03-24 03:23:55 +03:00
|
|
|
|
|
|
|
s = spltty();
|
|
|
|
|
|
|
|
/* Send any subsequent console calls to this cn_tab to rcons. */
|
1999-04-24 12:01:01 +04:00
|
|
|
cn->cn_dev = makedev (RCONSDEV, 0);
|
1998-03-24 03:23:55 +03:00
|
|
|
|
|
|
|
/* fixup for signature mismatch. */
|
|
|
|
cn->cn_putc = rcons_vputc;
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
1995-09-23 03:48:20 +04:00
|
|
|
/*
|
|
|
|
* Pseudo-device attach routine. rcons doesn't need to be a pseudo
|
|
|
|
* device, and isn't on a sparc; this is a useful point to set up
|
|
|
|
* the vnode, clean up pmax console initialization, and set
|
|
|
|
* the initial tty size.
|
1996-05-19 05:06:14 +04:00
|
|
|
*/
|
1995-04-11 14:23:32 +04:00
|
|
|
/* ARGSUSED */
|
1996-05-19 05:06:14 +04:00
|
|
|
void
|
1995-10-05 04:52:44 +03:00
|
|
|
rasterconsoleattach (n)
|
1995-04-11 14:23:32 +04:00
|
|
|
int n;
|
|
|
|
{
|
1999-04-24 12:01:01 +04:00
|
|
|
struct tty *tp = &rcons_tty [0];
|
1996-05-19 05:06:14 +04:00
|
|
|
|
|
|
|
#ifdef notyet
|
1995-09-11 11:45:36 +04:00
|
|
|
int status;
|
1996-05-19 05:06:14 +04:00
|
|
|
#endif
|
|
|
|
|
1995-09-11 11:45:36 +04:00
|
|
|
|
|
|
|
/* Set up the tty queues now... */
|
|
|
|
clalloc(&tp->t_rawq, 1024, 1);
|
|
|
|
clalloc(&tp->t_canq, 1024, 1);
|
|
|
|
/* output queue doesn't need quoting */
|
|
|
|
clalloc(&tp->t_outq, 1024, 0);
|
|
|
|
#ifdef DEBUG
|
1996-10-13 07:39:27 +04:00
|
|
|
printf("rconsattach: %d raster consoles\n", n);
|
1995-09-11 11:45:36 +04:00
|
|
|
#endif
|
|
|
|
|
1995-09-12 01:29:23 +04:00
|
|
|
#ifdef notyet /* ugly console input on pmaxes */
|
|
|
|
|
1995-09-11 11:45:36 +04:00
|
|
|
/* Try to set up the input device... */
|
|
|
|
if (cn_in_dev != NODEV && cn_in_devvp == NULLVP) {
|
|
|
|
/* try to get a reference on its vnode, but fail silently */
|
|
|
|
cdevvp(cn_in_dev, &cn_in_devvp);
|
|
|
|
status = ((*cdevsw[major(cn_in_dev)].d_open)
|
|
|
|
(cn_in_dev, O_NONBLOCK, S_IFCHR, curproc)); /* XXX */
|
|
|
|
if (status)
|
1996-10-13 07:39:27 +04:00
|
|
|
printf ("rconsattach: input device open failed: %d\n",
|
1995-09-11 11:45:36 +04:00
|
|
|
status);
|
|
|
|
}
|
|
|
|
/* Now the input side has been opened cleanly, we can dispense
|
|
|
|
* with any special-case console input hacks, and point the
|
|
|
|
* console device at rcons.
|
|
|
|
*/
|
1995-09-12 01:29:23 +04:00
|
|
|
#endif
|
1999-04-24 12:01:01 +04:00
|
|
|
|
1995-04-11 14:23:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ARGSUSED */
|
1996-05-19 05:06:14 +04:00
|
|
|
int
|
1995-04-11 14:23:32 +04:00
|
|
|
rconsopen(dev, flag, mode, p)
|
|
|
|
dev_t dev;
|
|
|
|
int flag, mode;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
1999-04-24 12:01:01 +04:00
|
|
|
struct tty *tp = &rcons_tty [0];
|
1996-05-19 05:06:14 +04:00
|
|
|
/*static int firstopen = 1;*/
|
1995-09-11 11:45:36 +04:00
|
|
|
int status;
|
1995-04-11 14:23:32 +04:00
|
|
|
|
|
|
|
if ((tp->t_state & TS_ISOPEN) == 0) {
|
|
|
|
/*
|
|
|
|
* Leave baud rate alone!
|
|
|
|
*/
|
|
|
|
ttychars(tp);
|
|
|
|
tp->t_iflag = TTYDEF_IFLAG;
|
|
|
|
tp->t_oflag = TTYDEF_OFLAG;
|
|
|
|
tp->t_lflag = TTYDEF_LFLAG;
|
|
|
|
tp->t_cflag = TTYDEF_CFLAG;
|
|
|
|
tp->t_state = TS_ISOPEN | TS_CARR_ON;
|
|
|
|
(void)(*tp->t_param)(tp, &tp->t_termios);
|
|
|
|
ttsetwater(tp);
|
|
|
|
} else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0)
|
|
|
|
return (EBUSY);
|
1995-09-11 11:45:36 +04:00
|
|
|
|
|
|
|
status = (*linesw[tp->t_line].l_open)(dev, tp);
|
|
|
|
return status;
|
1995-04-11 14:23:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ARGSUSED */
|
1996-05-19 05:06:14 +04:00
|
|
|
int
|
1995-04-11 14:23:32 +04:00
|
|
|
rconsclose(dev, flag, mode, p)
|
|
|
|
dev_t dev;
|
|
|
|
int flag, mode;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
1999-04-24 12:01:01 +04:00
|
|
|
struct tty *tp = &rcons_tty [0];
|
1995-04-11 14:23:32 +04:00
|
|
|
|
|
|
|
(*linesw[tp->t_line].l_close)(tp, flag);
|
|
|
|
ttyclose(tp);
|
1995-09-11 11:45:36 +04:00
|
|
|
|
1995-04-11 14:23:32 +04:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ARGSUSED */
|
1996-05-19 05:06:14 +04:00
|
|
|
int
|
1995-04-11 14:23:32 +04:00
|
|
|
rconsread(dev, uio, flag)
|
|
|
|
dev_t dev;
|
|
|
|
struct uio *uio;
|
|
|
|
int flag;
|
|
|
|
{
|
1999-04-24 12:01:01 +04:00
|
|
|
struct tty *tp = &rcons_tty [0];
|
1995-04-11 14:23:32 +04:00
|
|
|
|
|
|
|
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ARGSUSED */
|
1996-05-19 05:06:14 +04:00
|
|
|
int
|
1995-04-11 14:23:32 +04:00
|
|
|
rconswrite(dev, uio, flag)
|
|
|
|
dev_t dev;
|
|
|
|
struct uio *uio;
|
|
|
|
int flag;
|
|
|
|
{
|
1999-04-24 12:01:01 +04:00
|
|
|
struct tty *tp;
|
1995-04-21 05:24:26 +04:00
|
|
|
|
1995-04-11 14:23:32 +04:00
|
|
|
tp = &rcons_tty [0];
|
|
|
|
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
|
|
|
|
}
|
|
|
|
|
1995-04-21 05:24:26 +04:00
|
|
|
struct tty *
|
|
|
|
rconstty(dev)
|
|
|
|
dev_t dev;
|
|
|
|
{
|
|
|
|
register struct tty *tp = &rcons_tty [0];
|
|
|
|
return (tp);
|
|
|
|
}
|
|
|
|
|
1996-05-19 05:06:14 +04:00
|
|
|
int
|
1995-04-11 14:23:32 +04:00
|
|
|
rconsioctl(dev, cmd, data, flag, p)
|
|
|
|
dev_t dev;
|
|
|
|
u_long cmd;
|
|
|
|
caddr_t data;
|
|
|
|
int flag;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
1999-04-24 12:01:01 +04:00
|
|
|
struct tty *tp;
|
1995-04-11 14:23:32 +04:00
|
|
|
int error;
|
|
|
|
|
|
|
|
tp = &rcons_tty [0];
|
|
|
|
if ((error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, p)) >= 0)
|
|
|
|
return (error);
|
|
|
|
if ((error = ttioctl(tp, cmd, data, flag, p)) >= 0)
|
|
|
|
return (error);
|
|
|
|
return (ENOTTY);
|
|
|
|
}
|
|
|
|
|
1995-09-11 11:45:36 +04:00
|
|
|
/* ARGSUSED */
|
1996-09-02 10:43:16 +04:00
|
|
|
void
|
|
|
|
rconsstop(tp, rw)
|
1995-04-11 14:23:32 +04:00
|
|
|
struct tty *tp;
|
|
|
|
int rw;
|
|
|
|
{
|
1996-09-02 10:43:16 +04:00
|
|
|
|
1995-04-11 14:23:32 +04:00
|
|
|
}
|
|
|
|
|
1996-05-19 05:06:14 +04:00
|
|
|
int
|
1996-10-13 16:47:55 +04:00
|
|
|
rconspoll(dev, events, p)
|
1995-04-11 14:23:32 +04:00
|
|
|
dev_t dev;
|
1996-10-13 16:47:55 +04:00
|
|
|
int events;
|
1995-04-11 14:23:32 +04:00
|
|
|
struct proc *p;
|
|
|
|
{
|
1996-10-13 16:47:55 +04:00
|
|
|
return (ttpoll(dev, events, p));
|
1995-04-11 14:23:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
1996-05-19 05:06:14 +04:00
|
|
|
int
|
|
|
|
rconsmmap (dev, off, prot)
|
|
|
|
dev_t dev;
|
|
|
|
int off;
|
|
|
|
int prot;
|
1995-04-11 14:23:32 +04:00
|
|
|
{
|
1998-11-19 18:38:20 +03:00
|
|
|
|
|
|
|
return -1;
|
1995-04-11 14:23:32 +04:00
|
|
|
}
|
|
|
|
|
1995-09-11 11:45:36 +04:00
|
|
|
|
1998-11-16 03:10:39 +03:00
|
|
|
#ifdef notyet
|
|
|
|
void
|
|
|
|
rconsstart(tp)
|
|
|
|
struct tty *tp;
|
|
|
|
{
|
|
|
|
struct clist *cl;
|
1999-04-24 12:01:01 +04:00
|
|
|
int s;
|
1998-11-16 03:10:39 +03:00
|
|
|
|
|
|
|
s = spltty();
|
|
|
|
if (tp->t_state & (TS_BUSY|TS_TTSTOP|TS_TIMEOUT))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
cl = &tp->t_outq;
|
|
|
|
if (cl->c_cc) {
|
|
|
|
tp->t_state |= TS_BUSY;
|
|
|
|
if (0 /* hardware prio */) {
|
|
|
|
/* called at level zero - update screen now. */
|
1999-08-05 22:08:08 +04:00
|
|
|
(void) spllowersoftclock();
|
1998-11-16 03:10:39 +03:00
|
|
|
/*kd_putfb(tp);*/
|
|
|
|
(void) spltty();
|
|
|
|
tp->t_state &= ~TS_BUSY;
|
|
|
|
} else {
|
|
|
|
/* called at interrupt level - do it later */
|
|
|
|
timeout(rcons_later, (void*)tp, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cl->c_cc <= tp->t_lowat) {
|
|
|
|
if (tp->t_state & TS_ASLEEP) {
|
|
|
|
tp->t_state &= ~TS_ASLEEP;
|
|
|
|
wakeup((caddr_t)cl);
|
|
|
|
}
|
|
|
|
selwakeup(&tp->t_wsel);
|
|
|
|
}
|
|
|
|
out:
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Timeout function to do delayed writes to the screen.
|
|
|
|
* Called at splsoftclock when requested by rconssstart.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
rcons_later(tpaddr)
|
|
|
|
void *tpaddr;
|
|
|
|
{
|
|
|
|
struct tty *tp = tpaddr;
|
1999-04-24 12:01:01 +04:00
|
|
|
int s;
|
1998-11-16 03:10:39 +03:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
/*XXX*/printf("rcons_later\n");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
s = spltty();
|
|
|
|
(*(fbconstty->t_oproc)) (tp); /* XXX */
|
|
|
|
|
|
|
|
tp->t_state &= ~TS_BUSY;
|
|
|
|
(*linesw[tp->t_line].l_start)(tp);
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
#endif /* notyet */
|
|
|
|
|
|
|
|
|
1998-03-24 03:23:55 +03:00
|
|
|
/*
|
|
|
|
* Our "interrupt" routine for input.
|
|
|
|
* Called by the keyboard device driver at spltty when it has
|
|
|
|
* input for rcons.
|
|
|
|
*/
|
1996-05-19 05:06:14 +04:00
|
|
|
void
|
1995-09-11 11:45:36 +04:00
|
|
|
rcons_input (dev, ic)
|
|
|
|
dev_t dev;
|
|
|
|
int ic;
|
|
|
|
{
|
|
|
|
struct tty *tp;
|
|
|
|
int unit = minor (dev);
|
1998-03-24 03:23:55 +03:00
|
|
|
|
|
|
|
#ifdef RCONS_DEBUG
|
1999-08-24 15:16:03 +04:00
|
|
|
printf("rcons_input: dev %d.%d gives %c\n", major(dev), unit, ic);
|
1998-03-24 03:23:55 +03:00
|
|
|
#endif
|
|
|
|
|
1995-10-05 04:52:44 +03:00
|
|
|
if (unit > NRASTERCONSOLE)
|
1995-09-11 11:45:36 +04:00
|
|
|
return;
|
|
|
|
tp = &rcons_tty [unit];
|
|
|
|
if (!(tp -> t_state & TS_ISOPEN)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
(*linesw [tp -> t_line].l_rint)(ic, tp);
|
|
|
|
}
|
1995-10-05 04:52:44 +03:00
|
|
|
#endif /* NRASTERCONSOLE > 0 */
|