Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jun 2005 22:55:10 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 78472 for review
Message-ID:  <200506122255.j5CMtAiq020876@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=78472

Change 78472 by marcel@marcel_nfs on 2005/06/12 22:54:54

	Mute the low-level console when the VT has been wired up.
	Only allow low-level console output for debugger output.

Affected files ...

.. //depot/projects/tty/sys/dev/vtc/vtc_con.c#10 edit
.. //depot/projects/tty/sys/dev/vtc/vtc_core.c#9 edit

Differences ...

==== //depot/projects/tty/sys/dev/vtc/vtc_con.c#10 (text+ko) ====

@@ -33,6 +33,7 @@
 #include <machine/bus.h>
 #include <sys/bus.h>
 #include <sys/cons.h>
+#include <sys/kdb.h>
 #include <sys/rman.h>
 #include <sys/tty.h>
 
@@ -46,8 +47,9 @@
 static cn_putc_t vtc_cnputc;
 static cn_term_t vtc_cnterm;
 
-static int cncol = 0;
-static int cnrow = 0;
+static int vtc_cncol = 0;
+static int vtc_cnrow = 0;
+static int vtc_cnmute = 0;
 
 CONS_DRIVER(vtc, vtc_cnprobe, vtc_cninit, vtc_cnterm, vtc_cngetc, vtc_cncheckc,
     vtc_cnputc, NULL);
@@ -98,28 +100,32 @@
 	if (c <= 0 || c >= 0x7f)
 		return;
 
+	/* Allow low-level console output to be surpressed. */
+	if (vtc_cnmute && !kdb_active)
+		return;
+
 	width = vc->vtc_con_width;
 	switch (c) {
 	case 8:		/* BS */
-		if (cncol > 0)
-			cncol--;
+		if (vtc_cncol > 0)
+			vtc_cncol--;
 		ch = ' ';
 		break;
 	case 9:		/* HT */
-		cncol = (cncol + 7) & 7;
-		if (cncol >= 80)
-			cncol = 79;
+		vtc_cncol = (vtc_cncol + 7) & 7;
+		if (vtc_cncol >= 80)
+			vtc_cncol = 79;
 		ch = 0;
 		break;
 	case 10:	/* LF */
 	case 11:	/* VT (processed as LF) */
 	case 12:	/* FF (processed as LF) */
-		cncol = 0;
-		cnrow++;
+		vtc_cncol = 0;
+		vtc_cnrow++;
 		ch = 0;
 		break;
 	case 13:	/* CR */
-		cncol = 0;
+		vtc_cncol = 0;
 		ch = 0;
 		break;
 	default:
@@ -130,21 +136,21 @@
 	if (ch != 0) {
 		glyph = vtc_font_8x16 + ((ch - ' ') * 16);
 		vc->vtc_con_bitblt(vc, BITBLT_H1TOFB, (uintptr_t)glyph,
-		    width * cnrow * 16 + cncol * 8, 8, 16, 0, 7);
+		    width * vtc_cnrow * 16 + vtc_cncol * 8, 8, 16, 0, 7);
 		if (c != 8)
-			cncol++;
+			vtc_cncol++;
 	}
 
-	if (cncol >= 80) {
-		cncol = 0;
-		cnrow++;
+	if (vtc_cncol >= 80) {
+		vtc_cncol = 0;
+		vtc_cnrow++;
 	}
-	if (cnrow >= 30) {
+	if (vtc_cnrow >= 30) {
 		vc->vtc_con_bitblt(vc, BITBLT_FBTOFB, width * 16, 0, width,
 		    29 * 16);
 		vc->vtc_con_bitblt(vc, BITBLT_CTOFB, 0, width * 29 * 16, width,
 		    16);
-		cnrow = 29;
+		vtc_cnrow = 29;
 	}
 }
 
@@ -161,3 +167,12 @@
 
 	return (-1);
 }
+
+static void
+vtc_cnfinalize(void *data __unused)
+{
+
+	/* Shut the low-level console up. */
+	vtc_cnmute = 1;
+}
+SYSINIT(cnfinalize, SI_SUB_VTC, SI_ORDER_ANY, vtc_cnfinalize, NULL)

==== //depot/projects/tty/sys/dev/vtc/vtc_core.c#9 (text+ko) ====

@@ -242,7 +242,7 @@
 			strcpy(vc->vtc_consdev->cn_name, "ttyV0");
 	}
 }
-SYSINIT(initial, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vtc_initial, NULL)
+SYSINIT(vtc_initial, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vtc_initial, NULL)
 
 /*
  * Preempt the low-level console driver with the accelerated driver.
@@ -264,7 +264,7 @@
 			TAILQ_INSERT_TAIL(&te->te_vodevs, vo, vo_tedevs);
 	}
 }
-SYSINIT(finalize, SI_SUB_VTC, SI_ORDER_ANY, vtc_finalize, NULL)
+SYSINIT(vtc_finalize, SI_SUB_VTC, SI_ORDER_FIRST, vtc_finalize, NULL)
 
 static int
 vtc_modevent(module_t mod, int type, void *data)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506122255.j5CMtAiq020876>