Deleted Added
full compact
dcons_os.c (228631) dcons_os.c (247005)
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

--- 17 unchanged lines hidden (view full) ---

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 *
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

--- 17 unchanged lines hidden (view full) ---

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: head/sys/dev/dcons/dcons_os.c 228631 2011-12-17 15:08:43Z avg $
34 * $FreeBSD: head/sys/dev/dcons/dcons_os.c 247005 2013-02-19 18:22:25Z mav $
35 */
36
37#include <sys/param.h>
38#include <sys/kdb.h>
39#include <gdb/gdb.h>
40#include <sys/kernel.h>
41#include <sys/module.h>
42#include <sys/systm.h>

--- 26 unchanged lines hidden (view full) ---

69#include "opt_gdb.h"
70#include "opt_ddb.h"
71
72
73#ifndef DCONS_POLL_HZ
74#define DCONS_POLL_HZ 25
75#endif
76
35 */
36
37#include <sys/param.h>
38#include <sys/kdb.h>
39#include <gdb/gdb.h>
40#include <sys/kernel.h>
41#include <sys/module.h>
42#include <sys/systm.h>

--- 26 unchanged lines hidden (view full) ---

69#include "opt_gdb.h"
70#include "opt_ddb.h"
71
72
73#ifndef DCONS_POLL_HZ
74#define DCONS_POLL_HZ 25
75#endif
76
77#ifndef DCONS_POLL_IDLE
78#define DCONS_POLL_IDLE 256
79#endif
80
77#ifndef DCONS_BUF_SIZE
78#define DCONS_BUF_SIZE (16*1024)
79#endif
80
81#ifndef DCONS_FORCE_CONSOLE
82#define DCONS_FORCE_CONSOLE 0 /* Mostly for FreeBSD-4/DragonFly */
83#endif
84
85#ifndef KLD_MODULE
86static char bssbuf[DCONS_BUF_SIZE]; /* buf in bss */
87#endif
88
89/* global data */
90static struct dcons_global dg;
91struct dcons_global *dcons_conf;
92static int poll_hz = DCONS_POLL_HZ;
81#ifndef DCONS_BUF_SIZE
82#define DCONS_BUF_SIZE (16*1024)
83#endif
84
85#ifndef DCONS_FORCE_CONSOLE
86#define DCONS_FORCE_CONSOLE 0 /* Mostly for FreeBSD-4/DragonFly */
87#endif
88
89#ifndef KLD_MODULE
90static char bssbuf[DCONS_BUF_SIZE]; /* buf in bss */
91#endif
92
93/* global data */
94static struct dcons_global dg;
95struct dcons_global *dcons_conf;
96static int poll_hz = DCONS_POLL_HZ;
97static u_int poll_idle = DCONS_POLL_HZ * DCONS_POLL_IDLE;
93
94static struct dcons_softc sc[DCONS_NPORT];
95
96static SYSCTL_NODE(_kern, OID_AUTO, dcons, CTLFLAG_RD, 0, "Dumb Console");
97SYSCTL_INT(_kern_dcons, OID_AUTO, poll_hz, CTLFLAG_RW, &poll_hz, 0,
98 "dcons polling rate");
99
100static int drv_init = 0;

--- 108 unchanged lines hidden (view full) ---

209 struct dcons_softc *dc;
210 int i, c, polltime;
211
212 for (i = 0; i < DCONS_NPORT; i ++) {
213 dc = &sc[i];
214 tp = dc->tty;
215
216 tty_lock(tp);
98
99static struct dcons_softc sc[DCONS_NPORT];
100
101static SYSCTL_NODE(_kern, OID_AUTO, dcons, CTLFLAG_RD, 0, "Dumb Console");
102SYSCTL_INT(_kern_dcons, OID_AUTO, poll_hz, CTLFLAG_RW, &poll_hz, 0,
103 "dcons polling rate");
104
105static int drv_init = 0;

--- 108 unchanged lines hidden (view full) ---

214 struct dcons_softc *dc;
215 int i, c, polltime;
216
217 for (i = 0; i < DCONS_NPORT; i ++) {
218 dc = &sc[i];
219 tp = dc->tty;
220
221 tty_lock(tp);
217 while ((c = dcons_os_checkc_nopoll(dc)) != -1)
222 while ((c = dcons_os_checkc_nopoll(dc)) != -1) {
218 ttydisc_rint(tp, c, 0);
223 ttydisc_rint(tp, c, 0);
224 poll_idle = 0;
225 }
219 ttydisc_rint_done(tp);
220 tty_unlock(tp);
221 }
226 ttydisc_rint_done(tp);
227 tty_unlock(tp);
228 }
222 polltime = hz / poll_hz;
223 if (polltime < 1)
224 polltime = 1;
229 poll_idle++;
230 polltime = hz;
231 if (poll_idle <= (poll_hz * DCONS_POLL_IDLE))
232 polltime /= poll_hz;
225 callout_reset(&dcons_callout, polltime, dcons_timeout, tp);
226}
227
228static void
229dcons_cnprobe(struct consdev *cp)
230{
231 sprintf(cp->cn_name, "dcons");
232#if DCONS_FORCE_CONSOLE

--- 130 unchanged lines hidden (view full) ---

363dcons_attach(void)
364{
365 int polltime;
366
367 dcons_attach_port(DCONS_CON, "dcons", 0);
368 dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB);
369 callout_init(&dcons_callout, CALLOUT_MPSAFE);
370 polltime = hz / poll_hz;
233 callout_reset(&dcons_callout, polltime, dcons_timeout, tp);
234}
235
236static void
237dcons_cnprobe(struct consdev *cp)
238{
239 sprintf(cp->cn_name, "dcons");
240#if DCONS_FORCE_CONSOLE

--- 130 unchanged lines hidden (view full) ---

371dcons_attach(void)
372{
373 int polltime;
374
375 dcons_attach_port(DCONS_CON, "dcons", 0);
376 dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB);
377 callout_init(&dcons_callout, CALLOUT_MPSAFE);
378 polltime = hz / poll_hz;
371 if (polltime < 1)
372 polltime = 1;
373 callout_reset(&dcons_callout, polltime, dcons_timeout, NULL);
374 return(0);
375}
376
377static int
378dcons_detach(int port)
379{
380 struct tty *tp;

--- 102 unchanged lines hidden ---
379 callout_reset(&dcons_callout, polltime, dcons_timeout, NULL);
380 return(0);
381}
382
383static int
384dcons_detach(int port)
385{
386 struct tty *tp;

--- 102 unchanged lines hidden ---