Lock up kernel console based on login/debug.

- Remove the console setting in defconfig to reduce the size of command
  line.
- Block the char buffer to be read by blocking the delivering char to
  sysrq handler.

Change-Id: I4adf44012570045832dfbdc91d648babb324bc2d
diff --git a/arch/mips/brcmstb/prom.c b/arch/mips/brcmstb/prom.c
index 05e25cb..d45b161 100644
--- a/arch/mips/brcmstb/prom.c
+++ b/arch/mips/brcmstb/prom.c
@@ -44,6 +44,7 @@
 #include <spaces.h>
 
 int cfe_splashmem_present = 0;
+int cfe_lock_console_in = 1;
 unsigned long brcm_dram0_size_mb;
 unsigned long brcm_dram1_size_mb;
 unsigned long brcm_dram1_linux_mb;
@@ -325,6 +326,12 @@
 	BDEV_WR(UART_REG(UART_TX), x);
 }
 
+#ifdef CONFIG_BRUNO
+int lock_console_in(void) {
+	return cfe_lock_console_in;
+}
+#endif  /* CONFIG_BRUNO */
+
 static void __init brcm_setup_early_printk(void)
 {
 	char *arg = strstr(arcs_cmdline, "console=");
@@ -337,6 +344,10 @@
 		0, 0,
 	};
 
+	if (strstr(arcs_cmdline, "login=") || strstr(arcs_cmdline, "debug=")) {
+		cfe_lock_console_in = 0;
+	}
+
 	/*
 	 * quick command line parse to pick the early printk console
 	 * valid formats:
diff --git a/arch/mips/configs/bruno_gfhd100b2_defconfig b/arch/mips/configs/bruno_gfhd100b2_defconfig
index ee1fd25..515c4ad 100644
--- a/arch/mips/configs/bruno_gfhd100b2_defconfig
+++ b/arch/mips/configs/bruno_gfhd100b2_defconfig
@@ -2187,7 +2187,7 @@
 # CONFIG_KGDB is not set
 CONFIG_EARLY_PRINTK=y
 CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=ttyS0,115200 bmem=192m@64m bmem=256m@512m memc1=256m log_buf_len=1048576"
+CONFIG_CMDLINE="bmem=192m@64m bmem=256m@512m memc1=256m log_buf_len=1048576"
 # CONFIG_CMDLINE_OVERRIDE is not set
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
diff --git a/arch/mips/include/asm/brcmstb/brcmapi.h b/arch/mips/include/asm/brcmstb/brcmapi.h
index 0a0719a..fdc0190 100644
--- a/arch/mips/include/asm/brcmstb/brcmapi.h
+++ b/arch/mips/include/asm/brcmstb/brcmapi.h
@@ -103,6 +103,8 @@
 
 void brcm_set_nmi_handler(void (*fn)(struct pt_regs *));
 
+int lock_console_in(void);
+
 /***********************************************************************
  * New exports of standard kernel symbols
  ***********************************************************************/
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 81a99b0..01ea55b 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -50,6 +50,10 @@
 #include "suncore.h"
 #endif
 
+#ifdef CONFIG_BRUNO
+#include <asm/brcmstb/brcmstb.h>
+#endif  /* CONFIG_BRUNO */
+
 /*
  * Configuration:
  *   share_irqs - whether we pass IRQF_SHARED to request_irq().  This option
@@ -1430,6 +1434,11 @@
 			if (lsr & UART_LSR_BI) {
 				lsr &= ~(UART_LSR_FE | UART_LSR_PE);
 				up->port.icount.brk++;
+#ifdef CONFIG_BRUNO
+				if (lock_console_in()) {
+					goto ignore_char;
+				}
+#endif  /* CONFIG_BRUNO */
 				/*
 				 * We do the SysRQ and SAK checking
 				 * here because otherwise the break
@@ -1458,6 +1467,11 @@
 			else if (lsr & UART_LSR_FE)
 				flag = TTY_FRAME;
 		}
+#ifdef CONFIG_BRUNO
+		if (lock_console_in()) {
+			goto ignore_char;
+		}
+#endif  /* CONFIG_BRUNO */
 		if (uart_handle_sysrq_char(&up->port, ch))
 			goto ignore_char;