Home | History | Annotate | Line # | Download | only in dev
kd.c revision 1.1.6.1
      1 /*	$NetBSD: kd.c,v 1.1.6.1 2002/05/19 07:41:24 gehenna Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1996 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Gordon W. Ross.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*
     40  * Keyboard/Display device.
     41  *
     42  * This driver exists simply to provide a tty device that
     43  * the indirect console driver can point to.
     44  * The kbd driver sends its input here.
     45  * Output goes to the screen via PROM printf.
     46  */
     47 
     48 #include <sys/param.h>
     49 #include <sys/proc.h>
     50 #include <sys/systm.h>
     51 #include <sys/ioctl.h>
     52 #include <sys/tty.h>
     53 #include <sys/file.h>
     54 #include <sys/conf.h>
     55 #include <sys/device.h>
     56 
     57 #include <machine/promlib.h>
     58 #include <machine/eeprom.h>
     59 #include <machine/psl.h>
     60 #include <machine/cpu.h>
     61 #include <machine/kbd.h>
     62 #include <machine/autoconf.h>
     63 
     64 #ifdef RASTERCONSOLE
     65 #include <dev/sun/fbio.h>
     66 #include <machine/fbvar.h>
     67 #endif
     68 
     69 
     70 #include <dev/cons.h>
     71 #include <dev/sun/event_var.h>
     72 #include <dev/sun/kbd_xlate.h>
     73 #include <dev/sun/kbdvar.h>
     74 #include <sun2/dev/cons.h>
     75 
     76 struct	tty *fbconstty = 0;	/* tty structure for frame buffer console */
     77 
     78 #define PUT_WSIZE	64
     79 
     80 struct kd_softc {
     81 	struct	device kd_dev;		/* required first: base device */
     82 	struct  tty *kd_tty;
     83 	int rows, cols;
     84 
     85 	/* Console input hook */
     86 	struct cons_channel *kd_in;
     87 };
     88 
     89 /*
     90  * There is no point in pretending there might be
     91  * more than one keyboard/display device.
     92  */
     93 static struct kd_softc kd_softc;
     94 static int kd_is_console;
     95 
     96 static int kdparam(struct tty *, struct termios *);
     97 static void kdstart(struct tty *);
     98 static void kd_init __P((struct kd_softc *));
     99 static void kd_cons_input __P((int));
    100 static int  kdcngetc __P((dev_t));
    101 
    102 int	cons_ocount;		/* output byte count */
    103 
    104 dev_type_open(kdopen);
    105 dev_type_close(kdclose);
    106 dev_type_read(kdread);
    107 dev_type_write(kdwrite);
    108 dev_type_ioctl(kdioctl);
    109 dev_type_tty(kdtty);
    110 dev_type_poll(kdpoll);
    111 
    112 const struct cdevsw kd_cdevsw = {
    113 	kdopen, kdclose, kdread, kdwrite, kdioctl,
    114 	nostop, kdtty, kdpoll, nommap, D_TTY
    115 };
    116 
    117 /*
    118  * This is called by kbd_attach()
    119  * XXX - Make this a proper child of kbd?
    120  */
    121 void
    122 kd_init(kd)
    123 	struct kd_softc *kd;
    124 {
    125 	struct tty *tp;
    126 #ifdef	PROM_OLDMON
    127 	struct eeprom *ep;
    128 #endif
    129 #ifdef	notyet /* PROM_OBP_V2 */
    130 	int i;
    131 	char *prop;
    132 #endif
    133 
    134 	kd = &kd_softc; 	/* XXX */
    135 
    136 	tp = ttymalloc();
    137 	tp->t_oproc = kdstart;
    138 	tp->t_param = kdparam;
    139 	tp->t_dev = makedev(cdevsw_lookup_major(&kd_cdevsw), 0);
    140 
    141 	tty_attach(tp);
    142 	kd->kd_tty = tp;
    143 
    144 	/*
    145 	 * get the console struct winsize.
    146 	 */
    147 	if (kd_is_console) {
    148 		fbconstty = tp;
    149 #ifdef RASTERCONSOLE
    150 		kd->rows = fbrcons_rows();
    151 		kd->cols = fbrcons_cols();
    152 		rcons_ttyinit(tp);
    153 #endif
    154 	}
    155 
    156 	/* else, consult the PROM */
    157 	switch (prom_version()) {
    158 #ifdef	PROM_OLDMON
    159 	case PROM_OLDMON:
    160 		if ((ep = (struct eeprom *)eeprom_va) == NULL)
    161 			break;
    162 		if (kd->rows == 0)
    163 			kd->rows = (u_short)ep->eeTtyRows;
    164 		if (kd->cols == 0)
    165 			kd->cols = (u_short)ep->eeTtyCols;
    166 		break;
    167 #endif	/* PROM_OLDMON */
    168 #ifdef	notyet /* PROM_OBP_V2 */
    169 	case PROM_OBP_V0:
    170 	case PROM_OBP_V2:
    171 	case PROM_OBP_V3:
    172 	case PROM_OPENFIRM:
    173 
    174 		if (kd->rows == 0 &&
    175 		    (prop = PROM_getpropstring(optionsnode, "screen-#rows"))) {
    176 			i = 0;
    177 			while (*prop != '\0')
    178 				i = i * 10 + *prop++ - '0';
    179 			kd->rows = (unsigned short)i;
    180 		}
    181 		if (kd->cols == 0 &&
    182 		    (prop = PROM_getpropstring(optionsnode, "screen-#columns"))) {
    183 			i = 0;
    184 			while (*prop != '\0')
    185 				i = i * 10 + *prop++ - '0';
    186 			kd->cols = (unsigned short)i;
    187 		}
    188 		break;
    189 #endif	/* PROM_OBP_V2 */
    190 	}
    191 	return;
    192 }
    193 
    194 struct tty *
    195 kdtty(dev)
    196 	dev_t dev;
    197 {
    198 	struct kd_softc *kd;
    199 
    200 	kd = &kd_softc; 	/* XXX */
    201 	return (kd->kd_tty);
    202 }
    203 
    204 int
    205 kdopen(dev, flag, mode, p)
    206 	dev_t dev;
    207 	int flag, mode;
    208 	struct proc *p;
    209 {
    210 	struct kd_softc *kd;
    211 	int error, s, unit;
    212 	struct tty *tp;
    213 static	int firstopen = 1;
    214 
    215 	unit = minor(dev);
    216 	if (unit != 0)
    217 		return ENXIO;
    218 	kd = &kd_softc; 	/* XXX */
    219 
    220 	if (firstopen) {
    221 		kd_init(kd);
    222 		firstopen = 0;
    223 	}
    224 	tp = kd->kd_tty;
    225 
    226 	/* It's simpler to do this up here. */
    227 	if (((tp->t_state & (TS_ISOPEN | TS_XCLUDE))
    228 	     ==             (TS_ISOPEN | TS_XCLUDE))
    229 	    && (p->p_ucred->cr_uid != 0) )
    230 	{
    231 		return (EBUSY);
    232 	}
    233 
    234 	s = spltty();
    235 
    236 	if ((tp->t_state & TS_ISOPEN) == 0) {
    237 		/* First open. */
    238 
    239 		/* Notify the input device that serves us */
    240 		struct cons_channel *cc = kd->kd_in;
    241 		if (cc != NULL &&
    242 		    (error = (*cc->cc_iopen)(cc)) != 0) {
    243 			splx(s);
    244 			return (error);
    245 		}
    246 
    247 		ttychars(tp);
    248 		tp->t_iflag = TTYDEF_IFLAG;
    249 		tp->t_oflag = TTYDEF_OFLAG;
    250 		tp->t_cflag = TTYDEF_CFLAG;
    251 		tp->t_lflag = TTYDEF_LFLAG;
    252 		tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
    253 		(void) kdparam(tp, &tp->t_termios);
    254 		ttsetwater(tp);
    255 		tp->t_winsize.ws_row = kd->rows;
    256 		tp->t_winsize.ws_col = kd->cols;
    257 		/* Flush pending input?  Clear translator? */
    258 		/* This (pseudo)device always has SOFTCAR */
    259 		tp->t_state |= TS_CARR_ON;
    260 	}
    261 
    262 	splx(s);
    263 
    264 	return ((*tp->t_linesw->l_open)(dev, tp));
    265 }
    266 
    267 int
    268 kdclose(dev, flag, mode, p)
    269 	dev_t dev;
    270 	int flag, mode;
    271 	struct proc *p;
    272 {
    273 	struct kd_softc *kd;
    274 	struct tty *tp;
    275 	struct cons_channel *cc;
    276 
    277 	kd = &kd_softc; 	/* XXX */
    278 	tp = kd->kd_tty;
    279 
    280 	/* XXX This is for cons.c. */
    281 	if ((tp->t_state & TS_ISOPEN) == 0)
    282 		return 0;
    283 
    284 	(*tp->t_linesw->l_close)(tp, flag);
    285 	ttyclose(tp);
    286 
    287 	if ((cc = kd->kd_in) != NULL)
    288 		(void)(*cc->cc_iclose)(cc->cc_dev);
    289 
    290 	return (0);
    291 }
    292 
    293 int
    294 kdread(dev, uio, flag)
    295 	dev_t dev;
    296 	struct uio *uio;
    297 	int flag;
    298 {
    299 	struct kd_softc *kd;
    300 	struct tty *tp;
    301 
    302 	kd = &kd_softc; 	/* XXX */
    303 	tp = kd->kd_tty;
    304 
    305 	return ((*tp->t_linesw->l_read)(tp, uio, flag));
    306 }
    307 
    308 int
    309 kdwrite(dev, uio, flag)
    310 	dev_t dev;
    311 	struct uio *uio;
    312 	int flag;
    313 {
    314 	struct kd_softc *kd;
    315 	struct tty *tp;
    316 
    317 	kd = &kd_softc; 	/* XXX */
    318 	tp = kd->kd_tty;
    319 
    320 	return ((*tp->t_linesw->l_write)(tp, uio, flag));
    321 }
    322 
    323 int
    324 kdpoll(dev, events, p)
    325 	dev_t dev;
    326 	int events;
    327 	struct proc *p;
    328 {
    329 	struct kd_softc *kd;
    330 	struct tty *tp;
    331 
    332 	kd = &kd_softc; 	/* XXX */
    333 	tp = kd->kd_tty;
    334 
    335 	return ((*tp->t_linesw->l_poll)(tp, events, p));
    336 }
    337 
    338 int
    339 kdioctl(dev, cmd, data, flag, p)
    340 	dev_t dev;
    341 	u_long cmd;
    342 	caddr_t data;
    343 	int flag;
    344 	struct proc *p;
    345 {
    346 	struct kd_softc *kd;
    347 	struct tty *tp;
    348 	int error;
    349 
    350 	kd = &kd_softc; 	/* XXX */
    351 	tp = kd->kd_tty;
    352 
    353 	error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, p);
    354 	if (error != EPASSTHROUGH)
    355 		return error;
    356 
    357 	error = ttioctl(tp, cmd, data, flag, p);
    358 	if (error != EPASSTHROUGH)
    359 		return error;
    360 
    361 	/* Handle any ioctl commands specific to kbd/display. */
    362 	/* XXX - Send KB* ioctls to kbd module? */
    363 	/* XXX - Send FB* ioctls to fb module?  */
    364 
    365 	return EPASSTHROUGH;
    366 }
    367 
    368 void
    369 kdstop(tp, flag)
    370 	struct tty *tp;
    371 	int flag;
    372 {
    373 
    374 }
    375 
    376 
    377 static int
    378 kdparam(tp, t)
    379 	struct tty *tp;
    380 	struct termios *t;
    381 {
    382 	/* XXX - These are ignored... */
    383 	tp->t_ispeed = t->c_ispeed;
    384 	tp->t_ospeed = t->c_ospeed;
    385 	tp->t_cflag = t->c_cflag;
    386 	return 0;
    387 }
    388 
    389 
    390 static void kd_later(void*);
    391 static void kd_putfb(struct tty *);
    392 
    393 static void
    394 kdstart(tp)
    395 	struct tty *tp;
    396 {
    397 	struct clist *cl;
    398 	register int s;
    399 
    400 	s = spltty();
    401 	if (tp->t_state & (TS_BUSY|TS_TTSTOP|TS_TIMEOUT))
    402 		goto out;
    403 
    404 	cl = &tp->t_outq;
    405 	if (cl->c_cc) {
    406 		if (kd_is_console) {
    407 			tp->t_state |= TS_BUSY;
    408 			if (is_spl0(s)) {
    409 				/* called at level zero - update screen now. */
    410 				(void) spllowersoftclock();
    411 				kd_putfb(tp);
    412 				(void) spltty();
    413 				tp->t_state &= ~TS_BUSY;
    414 			} else {
    415 				/* called at interrupt level - do it later */
    416 				callout_reset(&tp->t_rstrt_ch, 0,
    417 				    kd_later, tp);
    418 			}
    419 		} else {
    420 			/*
    421 			 * This driver uses the PROM for writing the screen,
    422 			 * and that only works if this is the console device.
    423 			 * If this is not the console, just flush the output.
    424 			 * Sorry.  (In that case, use xdm instead of getty.)
    425 			 */
    426 			ndflush(cl, cl->c_cc);
    427 		}
    428 	}
    429 	if (cl->c_cc <= tp->t_lowat) {
    430 		if (tp->t_state & TS_ASLEEP) {
    431 			tp->t_state &= ~TS_ASLEEP;
    432 			wakeup((caddr_t)cl);
    433 		}
    434 		selwakeup(&tp->t_wsel);
    435 	}
    436 out:
    437 	splx(s);
    438 }
    439 
    440 /*
    441  * Timeout function to do delayed writes to the screen.
    442  * Called at splsoftclock when requested by kdstart.
    443  */
    444 static void
    445 kd_later(tpaddr)
    446 	void *tpaddr;
    447 {
    448 	struct tty *tp = tpaddr;
    449 	register int s;
    450 
    451 	kd_putfb(tp);
    452 
    453 	s = spltty();
    454 	tp->t_state &= ~TS_BUSY;
    455 	(*tp->t_linesw->l_start)(tp);
    456 	splx(s);
    457 }
    458 
    459 /*
    460  * Put text on the screen using the PROM monitor.
    461  * This can take a while, so to avoid missing
    462  * interrupts, this is called at splsoftclock.
    463  */
    464 static void
    465 kd_putfb(tp)
    466 	struct tty *tp;
    467 {
    468 	char buf[PUT_WSIZE];
    469 	struct clist *cl = &tp->t_outq;
    470 	char *p, *end;
    471 	int len;
    472 
    473 	while ((len = q_to_b(cl, buf, PUT_WSIZE-1)) > 0) {
    474 		/* PROM will barf if high bits are set. */
    475 		p = buf;
    476 		end = buf + len;
    477 		while (p < end)
    478 			*p++ &= 0x7f;
    479 		/* Now let the PROM print it. */
    480 		prom_putstr(buf, len);
    481 	}
    482 }
    483 
    484 /*
    485  * Default PROM-based console input stream
    486  */
    487 static int kd_rom_iopen __P((struct cons_channel *));
    488 static int kd_rom_iclose __P((struct cons_channel *));
    489 
    490 static struct cons_channel prom_cons_channel;
    491 
    492 int
    493 kd_rom_iopen(cc)
    494 	struct cons_channel *cc;
    495 {
    496 	return (0);
    497 }
    498 
    499 int
    500 kd_rom_iclose(cc)
    501 	struct cons_channel *cc;
    502 {
    503 	return (0);
    504 }
    505 
    506 /*
    507  * Our "interrupt" routine for input. This is called by
    508  * the keyboard driver (dev/sun/kbd.c) at spltty.
    509  */
    510 void
    511 kd_cons_input(c)
    512 	int c;
    513 {
    514 	struct kd_softc *kd = &kd_softc;
    515 	struct tty *tp;
    516 
    517 	/* XXX: Make sure the device is open. */
    518 	tp = kd->kd_tty;
    519 	if (tp == NULL)
    520 		return;
    521 	if ((tp->t_state & TS_ISOPEN) == 0)
    522 		return;
    523 
    524 	(*tp->t_linesw->l_rint)(c, tp);
    525 }
    526 
    527 
    528 /****************************************************************
    529  * kd console support
    530  ****************************************************************/
    531 
    532 /* The debugger gets its own key translation state. */
    533 static struct kbd_state *kdcn_state;
    534 
    535 static void kdcnprobe __P((struct consdev *));
    536 static void kdcninit __P((struct consdev *));
    537 static void kdcnputc __P((dev_t, int));
    538 static void kdcnpollc __P((dev_t, int));
    539 
    540 /* The keyboard driver uses cn_hw to access the real console driver */
    541 extern struct consdev consdev_prom;
    542 struct consdev consdev_kd = {
    543 	kdcnprobe,
    544 	kdcninit,
    545 	kdcngetc,
    546 	kdcnputc,
    547 	kdcnpollc,
    548 	NULL,
    549 };
    550 struct consdev *cn_hw = &consdev_kd;
    551 
    552 void
    553 cons_attach_input(cc, cn)
    554 	struct cons_channel *cc;
    555 	struct consdev *cn;
    556 {
    557 	struct kd_softc *kd = &kd_softc;
    558 	struct kbd_softc *kds = cc->cc_dev;
    559 	struct kbd_state *ks;
    560 
    561 	/* Share the keyboard state */
    562 	kdcn_state = ks = &kds->k_state;
    563 
    564 	kd->kd_in = cc;
    565 	cc->cc_upstream = kd_cons_input;
    566 
    567 	/* Attach lower level. */
    568 	cn_hw->cn_dev = cn->cn_dev;
    569 	cn_hw->cn_pollc = cn->cn_pollc;
    570 	cn_hw->cn_getc = cn->cn_getc;
    571 
    572 	/* Attach us as console. */
    573 	cn_tab->cn_dev = makedev(cdevsw_lookup_major(&kd_cdevsw), 0);
    574 	cn_tab->cn_probe = kdcnprobe;
    575 	cn_tab->cn_init = kdcninit;
    576 	cn_tab->cn_getc = kdcngetc;
    577 	cn_tab->cn_pollc = kdcnpollc;
    578 	cn_tab->cn_pri = CN_INTERNAL;
    579 
    580 	/* Set up initial PROM input channel for /dev/console */
    581 	prom_cons_channel.cc_dev = NULL;
    582 	prom_cons_channel.cc_iopen = kd_rom_iopen;
    583 	prom_cons_channel.cc_iclose = kd_rom_iclose;
    584 
    585 	/* Indicate that it is OK to use the PROM fbwrite */
    586 	kd_is_console = 1;
    587 }
    588 
    589 
    590 void kd_attach_input(struct cons_channel *);
    591 void
    592 kd_attach_input(cc)
    593 	struct cons_channel *cc;
    594 {
    595 	struct kd_softc *kd = &kd_softc;
    596 
    597 	kd->kd_in = cc;
    598 	cc->cc_upstream = kd_cons_input;
    599 }
    600 
    601 
    602 /* We never call this. */
    603 static void
    604 kdcnprobe(cn)
    605 	struct consdev *cn;
    606 {
    607 }
    608 
    609 static void
    610 kdcninit(cn)
    611 	struct consdev *cn;
    612 {
    613 #if 0
    614 	struct kbd_state *ks = kdcn_state;
    615 
    616 	cn->cn_dev = makedev(cdevsw_lookup_major(&kd_cdevsw), 0);
    617 	cn->cn_pri = CN_INTERNAL;
    618 
    619 	/* This prepares kbd_translate() */
    620 	ks->kbd_id = KBD_MIN_TYPE;
    621 	kbd_xlate_init(ks);
    622 
    623 	/* Set up initial PROM input channel for /dev/console */
    624 	prom_cons_channel.cc_dev = NULL;
    625 	prom_cons_channel.cc_iopen = kd_rom_iopen;
    626 	prom_cons_channel.cc_iclose = kd_rom_iclose;
    627 	cons_attach_input(&prom_cons_channel);
    628 
    629 	/* Indicate that it is OK to use the PROM fbwrite */
    630 	kd_is_console = 1;
    631 #endif
    632 }
    633 
    634 static int
    635 kdcngetc(dev)
    636 	dev_t dev;
    637 {
    638 	struct kbd_state *ks = kdcn_state;
    639 	int code, class, data, keysym;
    640 	extern int prom_cngetc __P((dev_t));
    641 
    642 
    643 	if (cn_hw->cn_getc == prom_cngetc) return (*cn_hw->cn_getc)(dev);
    644 	for (;;) {
    645 		code = (*cn_hw->cn_getc)(dev);
    646 		keysym = kbd_code_to_keysym(ks, code);
    647 		class = KEYSYM_CLASS(keysym);
    648 
    649 		switch (class) {
    650 		case KEYSYM_ASCII:
    651 			goto out;
    652 
    653 		case KEYSYM_CLRMOD:
    654 		case KEYSYM_SETMOD:
    655 			data = (keysym & 0x1F);
    656 			/* Only allow ctrl or shift. */
    657 			if (data > KBMOD_SHIFT_R)
    658 				break;
    659 			data = 1 << data;
    660 			if (class == KEYSYM_SETMOD)
    661 				ks->kbd_modbits |= data;
    662 			else
    663 				ks->kbd_modbits &= ~data;
    664 			break;
    665 
    666 		case KEYSYM_ALL_UP:
    667 			/* No toggle keys here. */
    668 			ks->kbd_modbits = 0;
    669 			break;
    670 
    671 		default:	/* ignore all other keysyms */
    672 			break;
    673 		}
    674 	}
    675 out:
    676 	return (keysym);
    677 }
    678 
    679 static void
    680 kdcnputc(dev, c)
    681 	dev_t dev;
    682 	int c;
    683 {
    684 	int s;
    685 
    686 	s = splhigh();
    687 	prom_putchar(c);
    688 	splx(s);
    689 }
    690 
    691 static void
    692 kdcnpollc(dev, on)
    693 	dev_t dev;
    694 	int on;
    695 {
    696 	struct kbd_state *ks = kdcn_state;
    697 
    698 	if (on) {
    699 		/* Entering debugger. */
    700 #if NFB > 0
    701 		fb_unblank();
    702 #endif
    703 		/* Clear shift keys too. */
    704 		ks->kbd_modbits = 0;
    705 	} else {
    706 		/* Resuming kernel. */
    707 	}
    708 	(*cn_hw->cn_pollc)(dev, on);
    709 }
    710