Deleted Added
full compact
syscons.c (189596) syscons.c (189617)
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>
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 189596 2009-03-09 19:46:19Z ed $");
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
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 default_attr kernel_default = {
99 SC_KERNEL_CONS_ATTR,
100 SC_KERNEL_CONS_REV_ATTR,
101};
102
103static int sc_console_unit = -1;
104static int sc_saver_keyb_only = 1;
105static scr_stat *sc_console;
106static struct consdev *sc_consptr;
98static int sc_console_unit = -1;
99static int sc_saver_keyb_only = 1;
100static scr_stat *sc_console;
101static struct consdev *sc_consptr;
107static void *kernel_console_ts;
108static scr_stat main_console;
109static struct tty *main_devs[MAXCONS];
110
111static char init_done = COLD;
112static char shutdown_in_progress = FALSE;
113static char sc_malloc = FALSE;
114
115static int saver_mode = CONS_NO_SAVER; /* LKM/user saver */

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

318 if (scp->status & SLKED ||
319 (scp == scp->sc->cur_scp && scp->sc->blink_in_progress))
320 return;
321
322 for (;;) {
323 len = ttydisc_getc(tp, buf, sizeof buf);
324 if (len == 0)
325 break;
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;
326 sc_puts(scp, buf, len);
320 sc_puts(scp, buf, len, 0);
327 }
328}
329
330static struct tty *
331sc_alloc_tty(int index, const char *fmt, ...)
332{
333 va_list ap;
334 struct sc_ttysoftc *stc;

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

368 if (sc_console_unit == unit) {
369 /*
370 * If this unit is being used as the system console, we need to
371 * adjust some variables and buffers before and after scinit().
372 */
373 /* assert(sc_console != NULL) */
374 flags |= SC_KERNEL_CONSOLE;
375 scmeminit(NULL);
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);
376
377 scinit(unit, flags);
378
379 if (sc_console->tsw->te_size > 0) {
380 /* assert(sc_console->ts != NULL); */
381 kernel_console_ts = sc_console->ts;
382 sc_console->ts = malloc(sc_console->tsw->te_size,
383 M_DEVBUF, M_WAITOK);
384 bcopy(kernel_console_ts, sc_console->ts, sc_console->tsw->te_size);
385 (*sc_console->tsw->te_default_attr)(sc_console,
386 user_default.std_color,
387 user_default.rev_color);
388 }
389 } else {
390 scinit(unit, flags);
391 }
370 }
371 scinit(unit, flags);
392
393 sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE);
394 sc->config = flags;
395 scp = sc_get_stat(sc->dev[0]);
396 if (sc_console == NULL) /* sc_console_unit < 0 */
397 sc_console = scp;
398
399#ifdef SC_PIXEL_MODE

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

1502 sc_console = NULL;
1503}
1504
1505static void
1506sc_cnputc(struct consdev *cd, int c)
1507{
1508 u_char buf[1];
1509 scr_stat *scp = sc_console;
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;
1510 void *save;
1511#ifndef SC_NO_HISTORY
1512#if 0
1513 struct tty *tp;
1514#endif
1515#endif /* !SC_NO_HISTORY */
1516 int s;
1517
1518 /* assert(sc_console != NULL) */

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

1538 tty_lock(tp);
1539 if (tty_opened(tp))
1540 sctty_outwakeup(tp);
1541 tty_unlock(tp);
1542#endif
1543 }
1544#endif /* !SC_NO_HISTORY */
1545
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
1546 save = scp->ts;
1547 if (kernel_console_ts != NULL)
1548 scp->ts = kernel_console_ts;
1549 buf[0] = c;
1525 buf[0] = c;
1550 sc_puts(scp, buf, 1);
1551 scp->ts = save;
1526 sc_puts(scp, buf, 1, 1);
1552
1553 s = spltty(); /* block sckbdevent and scrn_timer */
1554 sccnupdate(scp);
1555 splx(s);
1556}
1557
1558static int
1559sc_cngetc(struct consdev *cd)

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

2487 if (sc->old_scp->kbd_mode != scp->kbd_mode)
2488 kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
2489 update_kbd_state(scp, scp->status, LOCK_MASK);
2490
2491 mark_all(scp);
2492}
2493
2494void
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
2495sc_puts(scr_stat *scp, u_char *buf, int len)
2470sc_puts(scr_stat *scp, u_char *buf, int len, int kernel)
2496{
2497 int need_unlock = 0;
2498
2499#ifdef DEV_SPLASH
2500 /* make screensaver happy */
2501 if (!sticky_splash && scp == scp->sc->cur_scp && !sc_saver_keyb_only)
2502 run_scrn_saver = FALSE;
2503#endif
2504
2505 if (scp->tsw) {
2506 if (!kdb_active && !mtx_owned(&scp->scr_lock)) {
2507 need_unlock = 1;
2508 mtx_lock_spin(&scp->scr_lock);
2509 }
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 }
2510 (*scp->tsw->te_puts)(scp, buf, len);
2485 (*scp->tsw->te_puts)(scp, buf, len, kernel);
2511 if (need_unlock)
2512 mtx_unlock_spin(&scp->scr_lock);
2513 }
2514
2515 if (scp->sc->delayed_next_scr)
2516 sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
2517}
2518

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

2749 row = scp->ysize - 1;
2750 scp->xpos = col;
2751 scp->ypos = row;
2752 scp->cursor_pos = scp->cursor_oldpos = row*scp->xsize + col;
2753
2754 if (sc_init_emulator(scp, SC_DFLT_TERM))
2755 sc_init_emulator(scp, "*");
2756 (*scp->tsw->te_default_attr)(scp,
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,
2757 kernel_default.std_color,
2758 kernel_default.rev_color);
2732 user_default.std_color,
2733 user_default.rev_color);
2759 } else {
2760 /* assert(sc_malloc) */
2761 sc->dev = malloc(sizeof(struct tty *)*sc->vtys, M_DEVBUF,
2762 M_WAITOK|M_ZERO);
2763 sc->dev[0] = sc_alloc_tty(0, "ttyv%r", unit * MAXCONS);
2764 scp = alloc_scp(sc, sc->first_vty);
2765 SC_STAT(sc->dev[0]) = scp;
2766 }

--- 935 unchanged lines hidden ---
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 ---