Deleted Added
sdiff udiff text old ( 189596 ) new ( 189617 )
full compact
1/*-
2 * Copyright (c) 1992-1998 S�ren Schmidt
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The DragonFly Project
6 * by Sascha Wildner <saw@online.de>
7 *
8 * Redistribution and use in source and binary forms, with or without

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

25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/dev/syscons/syscons.c 189617 2009-03-10 11:28:54Z ed $");
34
35#include "opt_compat.h"
36#include "opt_syscons.h"
37#include "opt_splash.h"
38#include "opt_ddb.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>

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

90 int rev_color; /* reverse hardware color */
91} default_attr;
92
93static default_attr user_default = {
94 SC_NORM_ATTR,
95 SC_NORM_REV_ATTR,
96};
97
98static int sc_console_unit = -1;
99static int sc_saver_keyb_only = 1;
100static scr_stat *sc_console;
101static struct consdev *sc_consptr;
102static scr_stat main_console;
103static struct tty *main_devs[MAXCONS];
104
105static char init_done = COLD;
106static char shutdown_in_progress = FALSE;
107static char sc_malloc = FALSE;
108
109static int saver_mode = CONS_NO_SAVER; /* LKM/user saver */

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

312 if (scp->status & SLKED ||
313 (scp == scp->sc->cur_scp && scp->sc->blink_in_progress))
314 return;
315
316 for (;;) {
317 len = ttydisc_getc(tp, buf, sizeof buf);
318 if (len == 0)
319 break;
320 sc_puts(scp, buf, len, 0);
321 }
322}
323
324static struct tty *
325sc_alloc_tty(int index, const char *fmt, ...)
326{
327 va_list ap;
328 struct sc_ttysoftc *stc;

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

362 if (sc_console_unit == unit) {
363 /*
364 * If this unit is being used as the system console, we need to
365 * adjust some variables and buffers before and after scinit().
366 */
367 /* assert(sc_console != NULL) */
368 flags |= SC_KERNEL_CONSOLE;
369 scmeminit(NULL);
370 }
371 scinit(unit, flags);
372
373 sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE);
374 sc->config = flags;
375 scp = sc_get_stat(sc->dev[0]);
376 if (sc_console == NULL) /* sc_console_unit < 0 */
377 sc_console = scp;
378
379#ifdef SC_PIXEL_MODE

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

1482 sc_console = NULL;
1483}
1484
1485static void
1486sc_cnputc(struct consdev *cd, int c)
1487{
1488 u_char buf[1];
1489 scr_stat *scp = sc_console;
1490#ifndef SC_NO_HISTORY
1491#if 0
1492 struct tty *tp;
1493#endif
1494#endif /* !SC_NO_HISTORY */
1495 int s;
1496
1497 /* assert(sc_console != NULL) */

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

1517 tty_lock(tp);
1518 if (tty_opened(tp))
1519 sctty_outwakeup(tp);
1520 tty_unlock(tp);
1521#endif
1522 }
1523#endif /* !SC_NO_HISTORY */
1524
1525 buf[0] = c;
1526 sc_puts(scp, buf, 1, 1);
1527
1528 s = spltty(); /* block sckbdevent and scrn_timer */
1529 sccnupdate(scp);
1530 splx(s);
1531}
1532
1533static int
1534sc_cngetc(struct consdev *cd)

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

2462 if (sc->old_scp->kbd_mode != scp->kbd_mode)
2463 kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
2464 update_kbd_state(scp, scp->status, LOCK_MASK);
2465
2466 mark_all(scp);
2467}
2468
2469void
2470sc_puts(scr_stat *scp, u_char *buf, int len, int kernel)
2471{
2472 int need_unlock = 0;
2473
2474#ifdef DEV_SPLASH
2475 /* make screensaver happy */
2476 if (!sticky_splash && scp == scp->sc->cur_scp && !sc_saver_keyb_only)
2477 run_scrn_saver = FALSE;
2478#endif
2479
2480 if (scp->tsw) {
2481 if (!kdb_active && !mtx_owned(&scp->scr_lock)) {
2482 need_unlock = 1;
2483 mtx_lock_spin(&scp->scr_lock);
2484 }
2485 (*scp->tsw->te_puts)(scp, buf, len, kernel);
2486 if (need_unlock)
2487 mtx_unlock_spin(&scp->scr_lock);
2488 }
2489
2490 if (scp->sc->delayed_next_scr)
2491 sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
2492}
2493

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

2724 row = scp->ysize - 1;
2725 scp->xpos = col;
2726 scp->ypos = row;
2727 scp->cursor_pos = scp->cursor_oldpos = row*scp->xsize + col;
2728
2729 if (sc_init_emulator(scp, SC_DFLT_TERM))
2730 sc_init_emulator(scp, "*");
2731 (*scp->tsw->te_default_attr)(scp,
2732 user_default.std_color,
2733 user_default.rev_color);
2734 } else {
2735 /* assert(sc_malloc) */
2736 sc->dev = malloc(sizeof(struct tty *)*sc->vtys, M_DEVBUF,
2737 M_WAITOK|M_ZERO);
2738 sc->dev[0] = sc_alloc_tty(0, "ttyv%r", unit * MAXCONS);
2739 scp = alloc_scp(sc, sc->first_vty);
2740 SC_STAT(sc->dev[0]) = scp;
2741 }

--- 935 unchanged lines hidden ---