PERFORCE change 186345 for review

Matt Jacob mjacob at FreeBSD.org
Sat Nov 27 20:43:30 UTC 2010


http://p4web.freebsd.org/@@186345?ac=10

Change 186345 by mjacob at mjacob-sandbox on 2010/11/27 20:43:28

	Put in sysctl to suppress serial console output.

Affected files ...

.. //depot/projects/mjacob-dev/sys/dev/uart/uart_tty.c#2 edit
.. //depot/projects/mjacob-dev/sys/kern/kern_shutdown.c#2 edit
.. //depot/projects/mjacob-dev/sys/kern/subr_kdb.c#2 edit

Differences ...

==== //depot/projects/mjacob-dev/sys/dev/uart/uart_tty.c#2 (text+ko) ====

@@ -40,6 +40,7 @@
 #include <machine/bus.h>
 #include <sys/rman.h>
 #include <sys/tty.h>
+#include <sys/sysctl.h>
 #include <machine/resource.h>
 #include <machine/stdarg.h>
 
@@ -107,10 +108,15 @@
 	uart_term(cp->cn_arg);
 }
 
+int sio_suppressed = 0;
+SYSCTL_INT(_machdep, OID_AUTO, sio_suppressed, CTLFLAG_RW, &sio_suppressed, 0, "");
+
 static void
 uart_cnputc(struct consdev *cp, int c)
 {
-
+	if (sio_suppressed) {
+		return;
+	}
 	uart_putc(cp->cn_arg, c);
 }
 

==== //depot/projects/mjacob-dev/sys/kern/kern_shutdown.c#2 (text+ko) ====

@@ -512,6 +512,8 @@
 	/* NOTREACHED */ /* assuming reset worked */
 }
 
+extern int sio_suppressed;
+
 /*
  * Panic is called on unresolvable fatal errors.  It prints "panic: mesg",
  * and then reboots.  If we are called twice, then we avoid trying to sync
@@ -528,6 +530,7 @@
 	va_list ap;
 	static char buf[256];
 
+	sio_suppressed = 0;
 	critical_enter();
 #ifdef SMP
 	/*

==== //depot/projects/mjacob-dev/sys/kern/subr_kdb.c#2 (text+ko) ====

@@ -287,6 +287,7 @@
 	return (brk);
 }
 
+extern int sio_suppressed;
 /*
  * Print a backtrace of the calling thread. The backtrace is generated by
  * the selected debugger, provided it supports backtraces. If no debugger
@@ -297,6 +298,8 @@
 void
 kdb_backtrace(void)
 {
+	int osup = sio_suppressed;
+	sio_suppressed = 0;
 
 	if (kdb_dbbe != NULL && kdb_dbbe->dbbe_trace != NULL) {
 		printf("KDB: stack backtrace:\n");
@@ -311,6 +314,7 @@
 		stack_print_ddb(&st);
 	}
 #endif
+	sio_suppressed = osup;
 }
 
 /*
@@ -343,6 +347,8 @@
 void
 kdb_enter(const char *why, const char *msg)
 {
+	int osup = sio_suppressed;
+	sio_suppressed = 0;
 
 	if (kdb_dbbe != NULL && kdb_active == 0) {
 		if (msg != NULL)
@@ -351,6 +357,7 @@
 		breakpoint();
 		kdb_why = KDB_WHY_UNSET;
 	}
+	sio_suppressed = osup;
 }
 
 /*
@@ -518,6 +525,8 @@
 	int did_stop_cpus;
 #endif
 	int handled;
+	int osup = sio_suppressed;
+	sio_suppressed = 0;
 
 	if (kdb_dbbe == NULL || kdb_dbbe->dbbe_trap == NULL)
 		return (0);
@@ -554,5 +563,6 @@
 
 	intr_restore(intr);
 
+	sio_suppressed = osup;
 	return (handled);
 }


More information about the p4-projects mailing list