Home | History | Annotate | Line # | Download | only in dev
kd.c revision 1.21
      1  1.21       gwr /*	$NetBSD: kd.c,v 1.21 1996/11/20 18:56:55 gwr Exp $	*/
      2   1.4       cgd 
      3  1.21       gwr /*-
      4  1.21       gwr  * Copyright (c) 1996 The NetBSD Foundation, Inc.
      5   1.1       gwr  * All rights reserved.
      6   1.1       gwr  *
      7  1.21       gwr  * This code is derived from software contributed to The NetBSD Foundation
      8  1.21       gwr  * by Gordon W. Ross.
      9  1.21       gwr  *
     10   1.1       gwr  * Redistribution and use in source and binary forms, with or without
     11   1.1       gwr  * modification, are permitted provided that the following conditions
     12   1.1       gwr  * are met:
     13   1.1       gwr  * 1. Redistributions of source code must retain the above copyright
     14   1.1       gwr  *    notice, this list of conditions and the following disclaimer.
     15   1.1       gwr  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1       gwr  *    notice, this list of conditions and the following disclaimer in the
     17   1.1       gwr  *    documentation and/or other materials provided with the distribution.
     18  1.21       gwr  * 3. All advertising materials mentioning features or use of this software
     19  1.11       gwr  *    must display the following acknowledgement:
     20  1.21       gwr  *        This product includes software developed by the NetBSD
     21  1.21       gwr  *        Foundation, Inc. and its contributors.
     22  1.21       gwr  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.21       gwr  *    contributors may be used to endorse or promote products derived
     24  1.21       gwr  *    from this software without specific prior written permission.
     25   1.1       gwr  *
     26  1.21       gwr  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.21       gwr  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.21       gwr  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.21       gwr  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
     30  1.21       gwr  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.21       gwr  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.21       gwr  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.21       gwr  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.21       gwr  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.21       gwr  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.21       gwr  * POSSIBILITY OF SUCH DAMAGE.
     37   1.1       gwr  */
     38   1.1       gwr 
     39   1.1       gwr /*
     40   1.1       gwr  * Keyboard/Display device.
     41   1.1       gwr  *
     42   1.1       gwr  * This driver exists simply to provide a tty device that
     43   1.1       gwr  * the indirect console driver can point to.
     44   1.1       gwr  * The kbd driver sends its input here.
     45  1.20  christos  * Output goes to the screen via PROM printf.
     46   1.1       gwr  */
     47   1.1       gwr 
     48   1.1       gwr #include <sys/param.h>
     49   1.1       gwr #include <sys/proc.h>
     50   1.1       gwr #include <sys/systm.h>
     51   1.1       gwr #include <sys/ioctl.h>
     52   1.1       gwr #include <sys/tty.h>
     53   1.1       gwr #include <sys/file.h>
     54   1.1       gwr #include <sys/conf.h>
     55   1.1       gwr #include <sys/device.h>
     56   1.1       gwr 
     57   1.1       gwr #include <machine/autoconf.h>
     58   1.1       gwr #include <machine/mon.h>
     59  1.11       gwr #include <machine/psl.h>
     60   1.1       gwr 
     61   1.1       gwr #include <dev/cons.h>
     62  1.14       gwr #include <dev/sun/kbd_xlate.h>
     63   1.1       gwr 
     64  1.14       gwr #define	KDMAJOR 1
     65  1.14       gwr #define PUT_WSIZE	64
     66  1.14       gwr 
     67  1.14       gwr cdev_decl(kd);	/* open, close, read, write, ioctl, stop, ... */
     68  1.14       gwr 
     69  1.14       gwr struct kd_softc {
     70  1.14       gwr 	struct	device kd_dev;		/* required first: base device */
     71  1.14       gwr 	struct  tty *kd_tty;
     72  1.14       gwr };
     73   1.1       gwr 
     74  1.13       gwr /*
     75  1.13       gwr  * There is no point in pretending there might be
     76  1.13       gwr  * more than one keyboard/display device.
     77  1.13       gwr  */
     78  1.14       gwr struct kd_softc kd_softc;
     79   1.1       gwr 
     80   1.1       gwr static int kdparam(struct tty *, struct termios *);
     81   1.1       gwr static void kdstart(struct tty *);
     82   1.1       gwr 
     83  1.10       gwr int kd_is_console;
     84  1.10       gwr 
     85  1.14       gwr /*
     86  1.14       gwr  * This is called by kbd_attach()
     87  1.14       gwr  * XXX - Make this a proper child of kbd?
     88  1.14       gwr  */
     89   1.7       gwr void
     90  1.14       gwr kd_init(unit)
     91  1.14       gwr 	int unit;
     92   1.1       gwr {
     93  1.14       gwr 	struct kd_softc *kd;
     94  1.14       gwr 	struct tty *tp;
     95  1.14       gwr 
     96  1.14       gwr 	if (unit != 0)
     97  1.14       gwr 		return;
     98  1.14       gwr 	kd = &kd_softc; 	/* XXX */
     99  1.17       gwr 
    100  1.14       gwr 	tp = ttymalloc();
    101  1.14       gwr 	tp->t_oproc = kdstart;
    102  1.14       gwr 	tp->t_param = kdparam;
    103  1.14       gwr 	tp->t_dev = makedev(KDMAJOR, unit);
    104  1.17       gwr 	tty_attach(tp);
    105  1.17       gwr 
    106  1.17       gwr 	kd->kd_tty = tp;
    107  1.14       gwr 
    108  1.14       gwr 	return;
    109  1.13       gwr }
    110  1.13       gwr 
    111  1.13       gwr struct tty *
    112  1.13       gwr kdtty(dev)
    113  1.13       gwr 	dev_t dev;
    114  1.13       gwr {
    115  1.14       gwr 	struct kd_softc *kd;
    116  1.14       gwr 
    117  1.14       gwr 	kd = &kd_softc; 	/* XXX */
    118  1.14       gwr 	return (kd->kd_tty);
    119   1.1       gwr }
    120   1.1       gwr 
    121   1.1       gwr int
    122   1.1       gwr kdopen(dev, flag, mode, p)
    123   1.1       gwr 	dev_t dev;
    124   1.1       gwr 	int flag, mode;
    125   1.1       gwr 	struct proc *p;
    126   1.1       gwr {
    127  1.14       gwr 	struct kd_softc *kd;
    128  1.14       gwr 	int error, s, unit;
    129   1.1       gwr 	struct tty *tp;
    130   1.1       gwr 
    131   1.1       gwr 	unit = minor(dev);
    132  1.14       gwr 	if (unit != 0)
    133   1.1       gwr 		return ENXIO;
    134  1.14       gwr 	kd = &kd_softc; 	/* XXX */
    135  1.14       gwr 	tp = kd->kd_tty;
    136   1.3       gwr 
    137  1.14       gwr 	if ((error = kbd_iopen(unit)) != 0) {
    138   1.8       gwr #ifdef	DIAGNOSTIC
    139  1.20  christos 		printf("kd: kbd_iopen, error=%d\n", error);
    140   1.8       gwr #endif
    141   1.3       gwr 		return (error);
    142   1.8       gwr 	}
    143   1.1       gwr 
    144  1.14       gwr 	/* It's simpler to do this up here. */
    145  1.14       gwr 	if (((tp->t_state & (TS_ISOPEN | TS_XCLUDE))
    146  1.14       gwr 	     ==             (TS_ISOPEN | TS_XCLUDE))
    147  1.14       gwr 	    && (p->p_ucred->cr_uid != 0) )
    148  1.14       gwr 	{
    149  1.14       gwr 		return (EBUSY);
    150  1.14       gwr 	}
    151  1.14       gwr 
    152  1.14       gwr 	s = spltty();
    153  1.14       gwr 
    154   1.1       gwr 	if ((tp->t_state & TS_ISOPEN) == 0) {
    155  1.14       gwr 		/* First open. */
    156   1.1       gwr 		ttychars(tp);
    157   1.1       gwr 		tp->t_iflag = TTYDEF_IFLAG;
    158   1.1       gwr 		tp->t_oflag = TTYDEF_OFLAG;
    159   1.1       gwr 		tp->t_cflag = TTYDEF_CFLAG;
    160   1.1       gwr 		tp->t_lflag = TTYDEF_LFLAG;
    161   1.1       gwr 		tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
    162  1.14       gwr 		(void) kdparam(tp, &tp->t_termios);
    163   1.1       gwr 		ttsetwater(tp);
    164  1.14       gwr 		/* Flush pending input?  Clear translator? */
    165  1.14       gwr 		/* This (pseudo)device always has SOFTCAR */
    166  1.14       gwr 		tp->t_state |= TS_CARR_ON;
    167  1.14       gwr 	}
    168  1.14       gwr 
    169  1.14       gwr 	splx(s);
    170   1.1       gwr 
    171   1.1       gwr 	return ((*linesw[tp->t_line].l_open)(dev, tp));
    172   1.1       gwr }
    173   1.1       gwr 
    174   1.1       gwr int
    175   1.1       gwr kdclose(dev, flag, mode, p)
    176   1.1       gwr 	dev_t dev;
    177   1.1       gwr 	int flag, mode;
    178   1.1       gwr 	struct proc *p;
    179   1.1       gwr {
    180  1.14       gwr 	struct kd_softc *kd;
    181  1.14       gwr 	struct tty *tp;
    182  1.14       gwr 
    183  1.14       gwr 	kd = &kd_softc; 	/* XXX */
    184  1.14       gwr 	tp = kd->kd_tty;
    185  1.14       gwr 
    186  1.14       gwr 	/* XXX This is for cons.c. */
    187  1.14       gwr 	if ((tp->t_state & TS_ISOPEN) == 0)
    188  1.14       gwr 		return 0;
    189   1.1       gwr 
    190   1.1       gwr 	(*linesw[tp->t_line].l_close)(tp, flag);
    191   1.1       gwr 	ttyclose(tp);
    192   1.1       gwr 	return (0);
    193   1.1       gwr }
    194   1.1       gwr 
    195   1.1       gwr int
    196   1.1       gwr kdread(dev, uio, flag)
    197   1.1       gwr 	dev_t dev;
    198   1.1       gwr 	struct uio *uio;
    199   1.1       gwr 	int flag;
    200   1.1       gwr {
    201  1.14       gwr 	struct kd_softc *kd;
    202  1.14       gwr 	struct tty *tp;
    203  1.14       gwr 
    204  1.14       gwr 	kd = &kd_softc; 	/* XXX */
    205  1.14       gwr 	tp = kd->kd_tty;
    206   1.1       gwr 
    207   1.1       gwr 	return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
    208   1.1       gwr }
    209   1.1       gwr 
    210   1.1       gwr int
    211   1.1       gwr kdwrite(dev, uio, flag)
    212   1.1       gwr 	dev_t dev;
    213   1.1       gwr 	struct uio *uio;
    214   1.1       gwr 	int flag;
    215   1.1       gwr {
    216  1.14       gwr 	struct kd_softc *kd;
    217  1.14       gwr 	struct tty *tp;
    218  1.14       gwr 
    219  1.14       gwr 	kd = &kd_softc; 	/* XXX */
    220  1.14       gwr 	tp = kd->kd_tty;
    221   1.1       gwr 
    222   1.1       gwr 	return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
    223  1.12   mycroft }
    224  1.12   mycroft 
    225  1.12   mycroft int
    226   1.1       gwr kdioctl(dev, cmd, data, flag, p)
    227   1.1       gwr 	dev_t dev;
    228  1.14       gwr 	u_long cmd;
    229   1.1       gwr 	caddr_t data;
    230   1.1       gwr 	int flag;
    231   1.1       gwr 	struct proc *p;
    232   1.1       gwr {
    233  1.14       gwr 	struct kd_softc *kd;
    234  1.14       gwr 	struct tty *tp;
    235   1.1       gwr 	int error;
    236  1.14       gwr 
    237  1.14       gwr 	kd = &kd_softc; 	/* XXX */
    238  1.14       gwr 	tp = kd->kd_tty;
    239   1.1       gwr 
    240   1.1       gwr 	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
    241   1.1       gwr 	if (error >= 0)
    242   1.1       gwr 		return error;
    243   1.1       gwr 	error = ttioctl(tp, cmd, data, flag, p);
    244   1.1       gwr 	if (error >= 0)
    245   1.1       gwr 		return error;
    246   1.1       gwr 
    247   1.1       gwr 	/* Handle any ioctl commands specific to kbd/display. */
    248   1.1       gwr 	/* XXX - Send KB* ioctls to kbd module? */
    249   1.1       gwr 	/* XXX - Send FB* ioctls to fb module?  */
    250   1.1       gwr 
    251   1.1       gwr 	return ENOTTY;
    252   1.1       gwr }
    253   1.1       gwr 
    254  1.14       gwr 
    255  1.14       gwr static int
    256  1.14       gwr kdparam(tp, t)
    257  1.14       gwr 	struct tty *tp;
    258  1.14       gwr 	struct termios *t;
    259  1.14       gwr {
    260  1.14       gwr 	/* XXX - These are ignored... */
    261  1.14       gwr 	tp->t_ispeed = t->c_ispeed;
    262  1.14       gwr 	tp->t_ospeed = t->c_ospeed;
    263  1.14       gwr 	tp->t_cflag = t->c_cflag;
    264  1.14       gwr 	return 0;
    265  1.14       gwr }
    266  1.14       gwr 
    267  1.14       gwr 
    268  1.18   mycroft void
    269  1.14       gwr kdstop(tp, flag)
    270  1.14       gwr 	struct tty *tp;
    271  1.14       gwr 	int flag;
    272  1.14       gwr {
    273  1.14       gwr 
    274  1.14       gwr }
    275  1.14       gwr 
    276  1.11       gwr static void kd_later(void*);
    277  1.11       gwr static void kd_putfb(struct tty *);
    278  1.11       gwr 
    279   1.1       gwr void
    280   1.1       gwr kdstart(tp)
    281   1.1       gwr 	struct tty *tp;
    282   1.1       gwr {
    283   1.1       gwr 	struct clist *cl;
    284  1.11       gwr 	register int s;
    285   1.1       gwr 
    286   1.1       gwr 	s = spltty();
    287   1.1       gwr 	if (tp->t_state & (TS_BUSY|TS_TTSTOP|TS_TIMEOUT))
    288   1.1       gwr 		goto out;
    289  1.11       gwr 
    290   1.1       gwr 	cl = &tp->t_outq;
    291  1.11       gwr 	if (cl->c_cc) {
    292  1.10       gwr 		if (kd_is_console) {
    293  1.11       gwr 			tp->t_state |= TS_BUSY;
    294  1.11       gwr 			if ((s & PSL_IPL) == 0) {
    295  1.11       gwr 				/* called at level zero - update screen now. */
    296  1.11       gwr 				(void) splsoftclock();
    297  1.11       gwr 				kd_putfb(tp);
    298  1.11       gwr 				(void) spltty();
    299  1.11       gwr 				tp->t_state &= ~TS_BUSY;
    300  1.11       gwr 			} else {
    301  1.11       gwr 				/* called at interrupt level - do it later */
    302  1.11       gwr 				timeout(kd_later, (void*)tp, 0);
    303  1.11       gwr 			}
    304  1.11       gwr 		} else {
    305  1.11       gwr 			/*
    306  1.11       gwr 			 * This driver uses the PROM for writing the screen,
    307  1.11       gwr 			 * and that only works if this is the console device.
    308  1.11       gwr 			 * If this is not the console, just flush the output.
    309  1.11       gwr 			 * Sorry.  (In that case, use xdm instead of getty.)
    310  1.11       gwr 			 */
    311  1.11       gwr 			ndflush(cl, cl->c_cc);
    312  1.11       gwr 		}
    313  1.11       gwr 	}
    314  1.11       gwr 	if (cl->c_cc <= tp->t_lowat) {
    315  1.11       gwr 		if (tp->t_state & TS_ASLEEP) {
    316  1.11       gwr 			tp->t_state &= ~TS_ASLEEP;
    317  1.11       gwr 			wakeup((caddr_t)cl);
    318  1.10       gwr 		}
    319  1.11       gwr 		selwakeup(&tp->t_wsel);
    320   1.1       gwr 	}
    321  1.11       gwr out:
    322  1.11       gwr 	splx(s);
    323  1.11       gwr }
    324  1.11       gwr 
    325  1.11       gwr /*
    326  1.11       gwr  * Timeout function to do delayed writes to the screen.
    327  1.11       gwr  * Called at splsoftclock when requested by kdstart.
    328  1.11       gwr  */
    329  1.11       gwr static void
    330  1.11       gwr kd_later(tpaddr)
    331  1.11       gwr 	void *tpaddr;
    332  1.11       gwr {
    333  1.11       gwr 	struct tty *tp = tpaddr;
    334  1.11       gwr 	register int s;
    335   1.1       gwr 
    336  1.11       gwr 	kd_putfb(tp);
    337  1.11       gwr 
    338  1.11       gwr 	s = spltty();
    339   1.1       gwr 	tp->t_state &= ~TS_BUSY;
    340  1.16       gwr 	(*linesw[tp->t_line].l_start)(tp);
    341  1.11       gwr 	splx(s);
    342  1.11       gwr }
    343  1.11       gwr 
    344  1.11       gwr /*
    345  1.11       gwr  * Put text on the screen using the PROM monitor.
    346  1.11       gwr  * This can take a while, so to avoid missing
    347  1.11       gwr  * interrupts, this is called at splsoftclock.
    348  1.11       gwr  */
    349  1.11       gwr static void kd_putfb(tp)
    350  1.11       gwr 	struct tty *tp;
    351  1.11       gwr {
    352  1.14       gwr 	char buf[PUT_WSIZE];
    353  1.11       gwr 	struct clist *cl = &tp->t_outq;
    354  1.11       gwr 	char *p, *end;
    355  1.11       gwr 	int len;
    356  1.11       gwr 
    357  1.14       gwr 	while ((len = q_to_b(cl, buf, PUT_WSIZE-1)) > 0) {
    358  1.11       gwr 		/* PROM will barf if high bits are set. */
    359  1.11       gwr 		p = buf;
    360  1.11       gwr 		end = buf + len;
    361  1.11       gwr 		while (p < end)
    362  1.11       gwr 			*p++ &= 0x7f;
    363  1.11       gwr 		(romVectorPtr->fbWriteStr)(buf, len);
    364   1.1       gwr 	}
    365   1.1       gwr }
    366   1.1       gwr 
    367  1.14       gwr /*
    368  1.15       gwr  * Our "interrupt" routine for input. This is called by
    369  1.15       gwr  * the keyboard driver (dev/sun/kbd.c) at spltty.
    370  1.14       gwr  */
    371  1.14       gwr void
    372  1.14       gwr kd_input(c)
    373  1.14       gwr 	int c;
    374  1.14       gwr {
    375  1.14       gwr 	struct kd_softc *kd = &kd_softc;
    376  1.14       gwr 	struct tty *tp;
    377  1.14       gwr 
    378  1.14       gwr 	/* XXX: Make sure the device is open. */
    379  1.14       gwr 	tp = kd->kd_tty;
    380  1.14       gwr 	if (tp == NULL)
    381  1.14       gwr 		return;
    382  1.14       gwr     if ((tp->t_state & TS_ISOPEN) == 0)
    383  1.14       gwr 		return;
    384  1.11       gwr 
    385  1.16       gwr 	(*linesw[tp->t_line].l_rint)(c, tp);
    386   1.1       gwr }
    387   1.1       gwr 
    388   1.1       gwr 
    389  1.14       gwr /****************************************************************
    390   1.1       gwr  * kd console support
    391  1.14       gwr  ****************************************************************/
    392   1.1       gwr 
    393  1.14       gwr extern void *zs_conschan;
    394  1.14       gwr extern int zs_getc();
    395  1.14       gwr extern void nullcnprobe();
    396  1.14       gwr cons_decl(kd);
    397   1.1       gwr 
    398  1.14       gwr /* The debugger gets its own key translation state. */
    399  1.14       gwr static struct kbd_state kdcn_state;
    400   1.1       gwr 
    401  1.14       gwr void
    402  1.14       gwr kdcninit(cn)
    403  1.14       gwr 	struct consdev *cn;
    404   1.1       gwr {
    405  1.14       gwr 	struct kbd_state *ks = &kdcn_state;
    406   1.8       gwr 
    407  1.14       gwr 	mon_printf("console on kd0 (keyboard/display)\n");
    408   1.8       gwr 
    409   1.8       gwr 	/* This prepares kbd_translate() */
    410  1.14       gwr 	ks->kbd_id = KBD_MIN_TYPE;
    411  1.14       gwr 	kbd_xlate_init(ks);
    412  1.10       gwr 
    413  1.10       gwr 	/* Indicate that it is OK to use the PROM fbwrite */
    414  1.10       gwr 	kd_is_console = 1;
    415   1.1       gwr }
    416   1.1       gwr 
    417  1.14       gwr int
    418   1.1       gwr kdcngetc(dev)
    419   1.1       gwr 	dev_t dev;
    420   1.1       gwr {
    421  1.14       gwr 	struct kbd_state *ks = &kdcn_state;
    422  1.14       gwr 	int code, class, data, keysym;
    423  1.14       gwr 
    424  1.14       gwr 	for (;;) {
    425  1.14       gwr 		code = zs_getc(zs_conschan);
    426  1.14       gwr 		keysym = kbd_code_to_keysym(ks, code);
    427  1.14       gwr 		class = KEYSYM_CLASS(keysym);
    428  1.14       gwr 
    429  1.14       gwr 		switch (class) {
    430  1.14       gwr 		case KEYSYM_ASCII:
    431  1.14       gwr 			goto out;
    432  1.14       gwr 
    433  1.14       gwr 		case KEYSYM_CLRMOD:
    434  1.14       gwr 		case KEYSYM_SETMOD:
    435  1.14       gwr 			data = (keysym & 0x1F);
    436  1.14       gwr 			/* Only allow ctrl or shift. */
    437  1.14       gwr 			if (data > KBMOD_SHIFT_R)
    438  1.14       gwr 				break;
    439  1.14       gwr 			data = 1 << data;
    440  1.14       gwr 			if (class == KEYSYM_SETMOD)
    441  1.14       gwr 				ks->kbd_modbits |= data;
    442  1.14       gwr 			else
    443  1.14       gwr 				ks->kbd_modbits &= ~data;
    444  1.14       gwr 			break;
    445   1.1       gwr 
    446  1.14       gwr 		case KEYSYM_ALL_UP:
    447  1.14       gwr 			/* No toggle keys here. */
    448  1.14       gwr 			ks->kbd_modbits = 0;
    449  1.14       gwr 			break;
    450   1.1       gwr 
    451  1.14       gwr 		default:	/* ignore all other keysyms */
    452  1.14       gwr 			break;
    453  1.14       gwr 		}
    454  1.14       gwr 	}
    455  1.14       gwr out:
    456  1.14       gwr 	return (keysym);
    457   1.1       gwr }
    458   1.1       gwr 
    459  1.14       gwr void
    460   1.1       gwr kdcnputc(dev, c)
    461   1.1       gwr 	dev_t dev;
    462   1.1       gwr 	int c;
    463   1.1       gwr {
    464  1.11       gwr 	(romVectorPtr->fbWriteChar)(c & 0x7f);
    465   1.9       gwr }
    466   1.9       gwr 
    467   1.9       gwr extern void fb_unblank();
    468   1.9       gwr void kdcnpollc(dev, on)
    469   1.9       gwr 	dev_t dev;
    470   1.9       gwr 	int on;
    471   1.9       gwr {
    472  1.14       gwr 	struct kbd_state *ks = &kdcn_state;
    473  1.14       gwr 
    474  1.14       gwr 	if (on) {
    475  1.14       gwr 		/* Entering debugger. */
    476   1.9       gwr 		fb_unblank();
    477  1.14       gwr 		/* Clear shift keys too. */
    478  1.14       gwr 		ks->kbd_modbits = 0;
    479  1.14       gwr 	} else {
    480  1.14       gwr 		/* Resuming kernel. */
    481  1.14       gwr 	}
    482   1.1       gwr }
    483  1.14       gwr 
    484  1.14       gwr struct consdev consdev_kd = {
    485  1.14       gwr 	nullcnprobe,
    486  1.14       gwr 	kdcninit,
    487  1.14       gwr 	kdcngetc,
    488  1.14       gwr 	kdcnputc,
    489  1.14       gwr 	kdcnpollc,
    490  1.14       gwr 	makedev(KDMAJOR, 0),
    491  1.14       gwr 	CN_INTERNAL
    492  1.14       gwr };
    493  1.14       gwr 
    494