DEVFS - remove dev_ops_add(), dev_ops_get(), and get_dev()
[dragonfly.git] / sys / dev / misc / dcons / dcons_os.c
CommitLineData
d8d65eca
HS
1/*
2 * Copyright (C) 2003,2004
3 * Hidetoshi Shimokawa. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 *
16 * This product includes software developed by Hidetoshi Shimokawa.
17 *
18 * 4. Neither the name of the author nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * $FreeBSD: src/sys/dev/dcons/dcons_os.c,v 1.4 2004/10/24 12:41:04 simokawa Exp $
13721694 35 * $DragonFly: src/sys/dev/misc/dcons/dcons_os.c,v 1.13 2007/08/07 13:14:11 hasso Exp $
d8d65eca
HS
36 */
37
38#include <sys/param.h>
39#if __FreeBSD_version >= 502122
40#include <sys/kdb.h>
41#include <gdb/gdb.h>
42#endif
43#include <sys/kernel.h>
44#include <sys/module.h>
45#include <sys/systm.h>
46#include <sys/types.h>
47#include <sys/conf.h>
48#include <sys/cons.h>
49#include <sys/consio.h>
50#include <sys/tty.h>
51#include <sys/malloc.h>
52#include <sys/proc.h>
895c1f85 53#include <sys/priv.h>
6434890e 54#include <sys/thread2.h>
d8d65eca 55#include <sys/ucred.h>
1f7ab7c9 56#include <sys/bus.h>
d8d65eca 57
d8d65eca
HS
58#include "dcons.h"
59#include "dcons_os.h"
d8d65eca
HS
60
61#include <ddb/ddb.h>
62#include <sys/reboot.h>
63
64#include <sys/sysctl.h>
65
66#include <vm/vm.h>
67#include <vm/vm_param.h>
68#include <vm/pmap.h>
69
70#include "opt_ddb.h"
71#include "opt_comconsole.h"
72#include "opt_dcons.h"
73
74#ifndef DCONS_POLL_HZ
75#define DCONS_POLL_HZ 100
76#endif
77
78#ifndef DCONS_BUF_SIZE
79#define DCONS_BUF_SIZE (16*1024)
80#endif
81
82#ifndef DCONS_FORCE_CONSOLE
83#define DCONS_FORCE_CONSOLE 0 /* Mostly for FreeBSD-4/DragonFly */
84#endif
85
86#ifndef DCONS_FORCE_GDB
87#define DCONS_FORCE_GDB 1
88#endif
89
fef8985e
MD
90#define CDEV_MAJOR 184
91
d8d65eca
HS
92static d_open_t dcons_open;
93static d_close_t dcons_close;
d8d65eca 94static d_ioctl_t dcons_ioctl;
d8d65eca 95
fef8985e
MD
96static struct dev_ops dcons_ops = {
97 { "dcons", CDEV_MAJOR, D_TTY },
d8d65eca
HS
98 .d_open = dcons_open,
99 .d_close = dcons_close,
fef8985e
MD
100 .d_read = ttyread,
101 .d_write = ttywrite,
102 .d_ioctl = dcons_ioctl,
103 .d_poll = ttypoll,
a32446b7 104 .d_revoke = ttyrevoke
d8d65eca
HS
105};
106
107#ifndef KLD_MODULE
108static char bssbuf[DCONS_BUF_SIZE]; /* buf in bss */
109#endif
110
111/* global data */
112static struct dcons_global dg;
113struct dcons_global *dcons_conf;
114static int poll_hz = DCONS_POLL_HZ;
115
116static struct dcons_softc sc[DCONS_NPORT];
117
118SYSCTL_NODE(_kern, OID_AUTO, dcons, CTLFLAG_RD, 0, "Dumb Console");
119SYSCTL_INT(_kern_dcons, OID_AUTO, poll_hz, CTLFLAG_RW, &poll_hz, 0,
120 "dcons polling rate");
121
122static int drv_init = 0;
123static struct callout dcons_callout;
124struct dcons_buf *dcons_buf; /* for local dconschat */
125
126#ifdef __DragonFly__
b13267a5 127#define DEV cdev_t
d8d65eca
HS
128#define THREAD d_thread_t
129#elif __FreeBSD_version < 500000
b13267a5 130#define DEV cdev_t
d8d65eca
HS
131#define THREAD struct proc
132#else
133#define DEV struct cdev *
134#define THREAD struct thread
135#endif
136
137
138static void dcons_tty_start(struct tty *);
139static int dcons_tty_param(struct tty *, struct termios *);
140static void dcons_timeout(void *);
141static int dcons_drv_init(int);
142
143static cn_probe_t dcons_cnprobe;
144static cn_init_t dcons_cninit;
ce81f184 145static cn_init_fini_t dcons_cninit_fini;
d8d65eca
HS
146static cn_getc_t dcons_cngetc;
147static cn_checkc_t dcons_cncheckc;
148static cn_putc_t dcons_cnputc;
149
ce81f184
MD
150CONS_DRIVER(dcons, dcons_cnprobe, dcons_cninit, dcons_cninit_fini,
151 NULL, dcons_cngetc, dcons_cncheckc, dcons_cnputc, NULL);
d8d65eca
HS
152
153#if __FreeBSD_version >= 502122
154static gdb_probe_f dcons_dbg_probe;
155static gdb_init_f dcons_dbg_init;
156static gdb_term_f dcons_dbg_term;
157static gdb_getc_f dcons_dbg_getc;
158static gdb_checkc_f dcons_dbg_checkc;
159static gdb_putc_f dcons_dbg_putc;
160
161GDB_DBGPORT(dcons, dcons_dbg_probe, dcons_dbg_init, dcons_dbg_term,
162 dcons_dbg_checkc, dcons_dbg_getc, dcons_dbg_putc);
163
164extern struct gdb_dbgport *gdb_cur;
165#endif
166
167#if (KDB || DDB) && ALT_BREAK_TO_DEBUGGER
168static int
169dcons_check_break(struct dcons_softc *dc, int c)
170{
171 if (c < 0)
172 return (c);
173
174#if __FreeBSD_version >= 502122
175 if (kdb_alt_break(c, &dc->brk_state)) {
176 if ((dc->flags & DC_GDB) != 0) {
177 if (gdb_cur == &dcons_gdb_dbgport) {
178 kdb_dbbe_select("gdb");
179 breakpoint();
180 }
181 } else
182 breakpoint();
183 }
184#else
185 switch (dc->brk_state) {
186 case STATE1:
187 if (c == KEY_TILDE)
188 dc->brk_state = STATE2;
189 else
190 dc->brk_state = STATE0;
191 break;
192 case STATE2:
193 dc->brk_state = STATE0;
194 if (c == KEY_CTRLB) {
195#if DCONS_FORCE_GDB
196 if (dc->flags & DC_GDB)
197 boothowto |= RB_GDB;
198#endif
199 breakpoint();
200 }
201 }
202 if (c == KEY_CR)
203 dc->brk_state = STATE1;
204#endif
205 return (c);
206}
207#else
208#define dcons_check_break(dc, c) (c)
209#endif
210
211static int
212dcons_os_checkc(struct dcons_softc *dc)
213{
214 int c;
215
216 if (dg.dma_tag != NULL)
217 bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_POSTREAD);
218
219 c = dcons_check_break(dc, dcons_checkc(dc));
220
221 if (dg.dma_tag != NULL)
222 bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_PREREAD);
223
224 return (c);
225}
226
227static int
228dcons_os_getc(struct dcons_softc *dc)
229{
230 int c;
231
232 while ((c = dcons_os_checkc(dc)) == -1);
233
234 return (c & 0xff);
235}
236
237static void
238dcons_os_putc(struct dcons_softc *dc, int c)
239{
240 if (dg.dma_tag != NULL)
241 bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_POSTWRITE);
242
243 dcons_putc(dc, c);
244
245 if (dg.dma_tag != NULL)
246 bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_PREWRITE);
247}
248static int
fef8985e 249dcons_open(struct dev_open_args *ap)
d8d65eca 250{
b13267a5 251 cdev_t dev = ap->a_head.a_dev;
d8d65eca 252 struct tty *tp;
6434890e 253 int unit, error;
d8d65eca
HS
254
255 unit = minor(dev);
256 if (unit != 0)
257 return (ENXIO);
258
259 tp = dev->si_tty = ttymalloc(dev->si_tty);
260 tp->t_oproc = dcons_tty_start;
261 tp->t_param = dcons_tty_param;
262 tp->t_stop = nottystop;
263 tp->t_dev = dev;
264
265 error = 0;
266
6434890e 267 crit_enter();
d8d65eca
HS
268 if ((tp->t_state & TS_ISOPEN) == 0) {
269 tp->t_state |= TS_CARR_ON;
270 ttychars(tp);
271 tp->t_iflag = TTYDEF_IFLAG;
272 tp->t_oflag = TTYDEF_OFLAG;
273 tp->t_cflag = TTYDEF_CFLAG|CLOCAL;
274 tp->t_lflag = TTYDEF_LFLAG;
275 tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
276 ttsetwater(tp);
895c1f85 277 } else if ((tp->t_state & TS_XCLUDE) && priv_check_cred(ap->a_cred, PRIV_ROOT, 0)) {
6434890e 278 crit_exit();
d8d65eca
HS
279 return (EBUSY);
280 }
6434890e 281 crit_exit();
d8d65eca
HS
282
283#if __FreeBSD_version < 502113
284 error = (*linesw[tp->t_line].l_open)(dev, tp);
285#else
286 error = ttyld_open(tp, dev);
287#endif
288
289 return (error);
290}
291
292static int
fef8985e 293dcons_close(struct dev_close_args *ap)
d8d65eca 294{
b13267a5 295 cdev_t dev = ap->a_head.a_dev;
d8d65eca
HS
296 int unit;
297 struct tty *tp;
298
299 unit = minor(dev);
300 if (unit != 0)
301 return (ENXIO);
302
303 tp = dev->si_tty;
304 if (tp->t_state & TS_ISOPEN) {
fef8985e 305 (*linesw[tp->t_line].l_close)(tp, ap->a_fflag);
d8d65eca 306 ttyclose(tp);
d8d65eca
HS
307 }
308
309 return (0);
310}
311
d8d65eca 312static int
fef8985e 313dcons_ioctl(struct dev_ioctl_args *ap)
d8d65eca 314{
b13267a5 315 cdev_t dev = ap->a_head.a_dev;
d8d65eca
HS
316 int unit;
317 struct tty *tp;
318 int error;
319
320 unit = minor(dev);
321 if (unit != 0)
322 return (ENXIO);
323
324 tp = dev->si_tty;
fef8985e 325 error = (*linesw[tp->t_line].l_ioctl)(tp, ap->a_cmd, ap->a_data, ap->a_fflag, ap->a_cred);
d8d65eca
HS
326 if (error != ENOIOCTL)
327 return (error);
328
fef8985e 329 error = ttioctl(tp, ap->a_cmd, ap->a_data, ap->a_fflag);
d8d65eca
HS
330 if (error != ENOIOCTL)
331 return (error);
332
333 return (ENOTTY);
334}
d8d65eca
HS
335
336static int
337dcons_tty_param(struct tty *tp, struct termios *t)
338{
339 tp->t_ispeed = t->c_ispeed;
340 tp->t_ospeed = t->c_ospeed;
341 tp->t_cflag = t->c_cflag;
342 return 0;
343}
344
345static void
346dcons_tty_start(struct tty *tp)
347{
348 struct dcons_softc *dc;
d8d65eca
HS
349
350 dc = (struct dcons_softc *)tp->t_dev->si_drv1;
6434890e 351 crit_enter();
d8d65eca
HS
352 if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) {
353 ttwwakeup(tp);
354 return;
355 }
356
357 tp->t_state |= TS_BUSY;
358 while (tp->t_outq.c_cc != 0)
0ced1954 359 dcons_os_putc(dc, clist_getc(&tp->t_outq));
d8d65eca
HS
360 tp->t_state &= ~TS_BUSY;
361
362 ttwwakeup(tp);
6434890e 363 crit_exit();
d8d65eca
HS
364}
365
366static void
367dcons_timeout(void *v)
368{
369 struct tty *tp;
370 struct dcons_softc *dc;
371 int i, c, polltime;
372
373 for (i = 0; i < DCONS_NPORT; i ++) {
374 dc = &sc[i];
375 tp = ((DEV)dc->dev)->si_tty;
376 while ((c = dcons_os_checkc(dc)) != -1)
377 if (tp->t_state & TS_ISOPEN)
378#if __FreeBSD_version < 502113
379 (*linesw[tp->t_line].l_rint)(c, tp);
380#else
381 ttyld_rint(tp, c);
382#endif
383 }
384 polltime = hz / poll_hz;
385 if (polltime < 1)
386 polltime = 1;
387 callout_reset(&dcons_callout, polltime, dcons_timeout, tp);
388}
389
390static void
391dcons_cnprobe(struct consdev *cp)
392{
393#ifdef __DragonFly__
ce81f184 394 cp->cn_probegood = 1;
d8d65eca 395#elif __FreeBSD_version >= 501109
f8c7a42d 396 ksprintf(cp->cn_name, "dcons");
d8d65eca
HS
397#else
398 cp->cn_dev = makedev(CDEV_MAJOR, DCONS_CON);
399#endif
400#if DCONS_FORCE_CONSOLE
401 cp->cn_pri = CN_REMOTE;
402#else
403 cp->cn_pri = CN_NORMAL;
404#endif
405}
406
407static void
408dcons_cninit(struct consdev *cp)
409{
410 dcons_drv_init(0);
411#if CONS_NODEV
412 cp->cn_arg
413#else
ce81f184 414 cp->cn_private
d8d65eca
HS
415#endif
416 = (void *)&sc[DCONS_CON]; /* share port0 with unit0 */
417}
418
ce81f184
MD
419static void
420dcons_cninit_fini(struct consdev *cp)
421{
422 cp->cn_dev = make_dev(&dcons_ops, DCONS_CON,
423 UID_ROOT, GID_WHEEL, 0600, "dcons");
424}
425
d8d65eca
HS
426#if CONS_NODEV
427static int
428dcons_cngetc(struct consdev *cp)
429{
430 struct dcons_softc *dc = (struct dcons_softc *)cp->cn_arg;
431 return (dcons_os_getc(dc));
432}
433static int
434dcons_cncheckc(struct consdev *cp)
435{
436 struct dcons_softc *dc = (struct dcons_softc *)cp->cn_arg;
437 return (dcons_os_checkc(dc));
438}
439static void
440dcons_cnputc(struct consdev *cp, int c)
441{
442 struct dcons_softc *dc = (struct dcons_softc *)cp->cn_arg;
443 dcons_os_putc(dc, c);
444}
445#else
446static int
ce81f184 447dcons_cngetc(void *private)
d8d65eca 448{
ce81f184 449 struct dcons_softc *dc = (struct dcons_softc *)private;
d8d65eca
HS
450 return (dcons_os_getc(dc));
451}
452static int
ce81f184 453dcons_cncheckc(void *private)
d8d65eca 454{
ce81f184 455 struct dcons_softc *dc = (struct dcons_softc *)private;
d8d65eca
HS
456 return (dcons_os_checkc(dc));
457}
458static void
ce81f184 459dcons_cnputc(void *private, int c)
d8d65eca 460{
ce81f184 461 struct dcons_softc *dc = (struct dcons_softc *)private;
d8d65eca
HS
462 dcons_os_putc(dc, c);
463}
464#endif
465
466static int
467dcons_drv_init(int stage)
468{
469#ifdef __i386__
470 quad_t addr, size;
471#endif
472
473 if (drv_init)
474 return(drv_init);
475
476 drv_init = -1;
477
478 bzero(&dg, sizeof(dg));
479 dcons_conf = &dg;
480 dg.cdev = &dcons_consdev;
481 dg.buf = NULL;
482 dg.size = DCONS_BUF_SIZE;
483
484#ifdef __i386__
bc01a404
MD
485 if (kgetenv_quad("dcons.addr", &addr) > 0 &&
486 kgetenv_quad("dcons.size", &size) > 0) {
d8d65eca
HS
487 vm_paddr_t pa;
488 /*
489 * Allow read/write access to dcons buffer.
490 */
491 for (pa = trunc_page(addr); pa < addr + size; pa += PAGE_SIZE)
9ad680a3 492 pmap_kmodify_rw((vm_offset_t)(KERNBASE + pa));
d8d65eca
HS
493 cpu_invltlb();
494 /* XXX P to V */
495 dg.buf = (struct dcons_buf *)(vm_offset_t)(KERNBASE + addr);
496 dg.size = size;
497 if (dcons_load_buffer(dg.buf, dg.size, sc) < 0)
498 dg.buf = NULL;
499 }
500#endif
501 if (dg.buf != NULL)
502 goto ok;
503
504#ifndef KLD_MODULE
505 if (stage == 0) { /* XXX or cold */
506 /*
507 * DCONS_FORCE_CONSOLE == 1 and statically linked.
508 * called from cninit(). can't use contigmalloc yet .
509 */
510 dg.buf = (struct dcons_buf *) bssbuf;
511 dcons_init(dg.buf, dg.size, sc);
512 } else
513#endif
514 {
515 /*
516 * DCONS_FORCE_CONSOLE == 0 or kernel module case.
517 * if the module is loaded after boot,
518 * bssbuf could be non-continuous.
519 */
520 dg.buf = (struct dcons_buf *) contigmalloc(dg.size,
521 M_DEVBUF, 0, 0x10000, 0xffffffff, PAGE_SIZE, 0ul);
522 dcons_init(dg.buf, dg.size, sc);
523 }
524
525ok:
526 dcons_buf = dg.buf;
527
d8d65eca 528#if DDB && DCONS_FORCE_GDB
ce81f184
MD
529 if (gdb_tab == NULL) {
530 gdb_tab = &dcons_consdev;
531 dcons_consdev.cn_gdbprivate = &sc[DCONS_GDB];
532 }
d8d65eca
HS
533#endif
534 drv_init = 1;
535
536 return 0;
537}
538
539
540static int
541dcons_attach_port(int port, char *name, int flags)
542{
543 struct dcons_softc *dc;
544 struct tty *tp;
545 DEV dev;
546
547 dc = &sc[port];
548 dc->flags = flags;
fef8985e 549 dev = make_dev(&dcons_ops, port,
d8d65eca
HS
550 UID_ROOT, GID_WHEEL, 0600, name);
551 dc->dev = (void *)dev;
552 tp = ttymalloc(NULL);
553
554 dev->si_drv1 = (void *)dc;
555 dev->si_tty = tp;
556
557 tp->t_oproc = dcons_tty_start;
558 tp->t_param = dcons_tty_param;
559 tp->t_stop = nottystop;
560 tp->t_dev = dc->dev;
561
562 return(0);
563}
564
565static int
566dcons_attach(void)
567{
568 int polltime;
569
d8d65eca
HS
570 dcons_attach_port(DCONS_CON, "dcons", 0);
571 dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB);
572#if __FreeBSD_version < 500000
573 callout_init(&dcons_callout);
574#else
575 callout_init(&dcons_callout, 0);
576#endif
577 polltime = hz / poll_hz;
578 if (polltime < 1)
579 polltime = 1;
580 callout_reset(&dcons_callout, polltime, dcons_timeout, NULL);
581 return(0);
582}
583
584static int
585dcons_detach(int port)
586{
587 struct tty *tp;
588 struct dcons_softc *dc;
589
590 dc = &sc[port];
591
592 tp = ((DEV)dc->dev)->si_tty;
593
594 if (tp->t_state & TS_ISOPEN) {
e3869ec7 595 kprintf("dcons: still opened\n");
d8d65eca
HS
596#if __FreeBSD_version < 502113
597 (*linesw[tp->t_line].l_close)(tp, 0);
d8d65eca 598 ttyclose(tp);
d8d65eca
HS
599#else
600 ttyld_close(tp, 0);
601 tty_close(tp);
602#endif
603 }
604 /* XXX
605 * must wait until all device are closed.
606 */
607#ifdef __DragonFly__
608 tsleep((void *)dc, 0, "dcodtc", hz/4);
609#else
610 tsleep((void *)dc, PWAIT, "dcodtc", hz/4);
611#endif
612 destroy_dev(dc->dev);
613
614 return(0);
615}
616
617
618/* cnXXX works only for FreeBSD-5 */
619static int
620dcons_modevent(module_t mode, int type, void *data)
621{
622 int err = 0, ret;
623
624 switch (type) {
625 case MOD_LOAD:
626 ret = dcons_drv_init(1);
627 dcons_attach();
628#if __FreeBSD_version >= 500000
629 if (ret == 0) {
630 dcons_cnprobe(&dcons_consdev);
631 dcons_cninit(&dcons_consdev);
632 cnadd(&dcons_consdev);
633 }
634#endif
635 break;
636 case MOD_UNLOAD:
e3869ec7 637 kprintf("dcons: unload\n");
d8d65eca
HS
638 callout_stop(&dcons_callout);
639#if __FreeBSD_version < 502122
640#if DDB && DCONS_FORCE_GDB
641#if CONS_NODEV
642 gdb_arg = NULL;
643#else
ce81f184
MD
644 if (gdb_tab == &dcons_consdev)
645 gdb_tab = NULL;
d8d65eca
HS
646#endif
647#endif
648#endif
649#if __FreeBSD_version >= 500000
650 cnremove(&dcons_consdev);
651#endif
652 dcons_detach(DCONS_CON);
653 dcons_detach(DCONS_GDB);
654 dg.buf->magic = 0;
655
656 contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF);
657
658 break;
659 case MOD_SHUTDOWN:
660 dg.buf->magic = 0;
661 break;
662 default:
663 err = EOPNOTSUPP;
664 break;
665 }
666 return(err);
667}
668
669#if __FreeBSD_version >= 502122
670/* Debugger interface */
671
672static int
673dcons_dbg_probe(void)
674{
675 return(DCONS_FORCE_GDB);
676}
677
678static void
679dcons_dbg_init(void)
680{
681}
682
683static void
684dcons_dbg_term(void)
685{
686}
687
688static void
689dcons_dbg_putc(int c)
690{
691 struct dcons_softc *dc = &sc[DCONS_GDB];
692 dcons_os_putc(dc, c);
693}
694
695static int
696dcons_dbg_checkc(void)
697{
698 struct dcons_softc *dc = &sc[DCONS_GDB];
699 return (dcons_os_checkc(dc));
700}
701
702static int
703dcons_dbg_getc(void)
704{
705 struct dcons_softc *dc = &sc[DCONS_GDB];
706 return (dcons_os_getc(dc));
707}
708#endif
709
710DEV_MODULE(dcons, dcons_modevent, NULL);
711MODULE_VERSION(dcons, DCONS_VERSION);