Lines Matching +full:console +full:- +full:size
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
87 static MALLOC_DEFINE(M_TTYCONS, "tty console", "tty console handling");
100 int cons_avail_mask = 0; /* Bit mask. Each registered low level console
108 "State of the console muting");
112 struct msgbuf consmsgbuf; /* message buffer for console tty */
116 struct tty *constty; /* pointer to console "window" tty */
130 * of kbd.c is contingent on any number of keyboard/console drivers being
146 printf("-- Muting boot messages --\n");
160 * Check if we should mute the console (for security reasons perhaps)
171 * Bring up the kbd layer just in time for cnprobe. Console drivers
179 * Find the first console with the highest priority.
186 if (cn->cn_ops == NULL)
188 cn->cn_ops->cn_probe(cn);
189 if (cn->cn_pri == CN_DEAD)
191 if (best_cn == NULL || cn->cn_pri > best_cn->cn_pri)
195 * Initialize console, and attach to it.
197 cn->cn_ops->cn_init(cn);
204 best_cn->cn_ops->cn_init(best_cn);
210 * Make the best console the preferred console.
216 * Release early console.
229 /* add a new physical console to back the virtual console */
237 if (cnd->cnd_cn == cn)
241 if (cnd->cnd_cn == NULL)
244 if (cnd->cnd_cn != NULL)
246 cnd->cnd_cn = cn;
247 if (cn->cn_name[0] == '\0') {
249 printf("WARNING: console at %p has no name\n", cn);
253 ttyconsdev_select(cnd->cnd_cn->cn_name);
256 cnavailable(cn, (cn->cn_flags & CN_FLAG_NOAVAIL) == 0);
268 if (cnd->cnd_cn != cn)
273 cnd->cnd_cn = NULL;
284 * syscons gets really confused if console resources are
287 if (cn->cn_term != NULL)
288 cn->cn_ops->cn_term(cn);
300 if (cnd->cnd_cn != cn)
306 ttyconsdev_select(cnd->cnd_cn->cn_name);
323 cn->cn_flags &= ~CN_FLAG_NOAVAIL;
327 cn->cn_flags |= CN_FLAG_NOAVAIL;
357 sbuf_printf(sb, "%s,", cnd->cnd_cn->cn_name);
361 if (cp->cn_name[0] != '\0')
362 sbuf_printf(sb, "%s,", cp->cn_name);
366 if (error == 0 && req->newptr != NULL) {
370 if (*p == '-') {
376 if (strcmp(p, cp->cn_name) != 0)
393 SYSCTL_PROC(_kern, OID_AUTO, console,
396 "Console device control");
405 cn = cnd->cnd_cn;
406 if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG))
407 cn->cn_ops->cn_grab(cn);
418 cn = cnd->cnd_cn;
419 if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG))
420 cn->cn_ops->cn_ungrab(cn);
431 cn = cnd->cnd_cn;
432 if (cn->cn_ops->cn_resume != NULL)
433 cn->cn_ops->cn_resume(cn);
438 * Low level console routines.
446 return (-1);
447 while ((c = cncheckc()) == -1)
450 c = '\n'; /* console input is always ICRNL */
462 return (-1);
464 cn = cnd->cnd_cn;
465 if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG)) {
466 c = cn->cn_ops->cn_getc(cn);
467 if (c != -1)
471 return (-1);
475 cngets(char *cp, size_t size, int visible)
483 end = cp + size - 1;
498 lp--;
541 cn = cnd->cnd_cn;
542 if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG)) {
544 cn->cn_ops->cn_putc(cn, '\r');
545 cn->cn_ops->cn_putc(cn, c);
571 * console driver clients can cause the "cnputs_mtx"
595 0, "Console tty buffer size");
598 * Redirect console output to a tty.
603 int size = consmsgbuf_size;
614 buf = malloc(size, M_TTYCONS, M_WAITOK);
625 msgbuf_init(&consmsgbuf, buf, size);
637 * Disable console redirection to a tty.
651 while ((c = msgbuf_getchar(&consmsgbuf)) != -1)
657 /* Times per second to check for pending console tty messages. */
661 "Times per second to check for pending console tty messages");
670 while ((c = msgbuf_getchar(&consmsgbuf)) != -1) {
743 0, "Console vty driver");