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