aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2014-05-29 04:48:46 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-29 14:28:05 -0400
commitbd71a1c08807966636daf52138119108c12c6061 (patch)
tree461fa928de53a33c90e6c05e6b10c10d406c4daf /drivers/tty
parent8a0ff60f7eeab3df34d475c952b9d75799de8975 (diff)
serial: kgdb_nmi: Improve console integration with KDB I/O
kgdb_nmi_tty_enabled is used for two unrelated purposes, namely to suppress normal TTY input handling and to suppress console output (although it has no effect at all on TTY output). A much better way to handle muting the console is to not have to mute it in the first place! That's what this patch does. Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/kgdb_nmi.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
index 20d21d09ee86..cfadf2971b12 100644
--- a/drivers/tty/serial/kgdb_nmi.c
+++ b/drivers/tty/serial/kgdb_nmi.c
@@ -44,13 +44,22 @@ MODULE_PARM_DESC(magic, "magic sequence to enter NMI debugger (default $3#33)");
44 44
45static bool kgdb_nmi_tty_enabled; 45static bool kgdb_nmi_tty_enabled;
46 46
47static int kgdb_nmi_console_setup(struct console *co, char *options)
48{
49 /* The NMI console uses the dbg_io_ops to issue console messages. To
50 * avoid duplicate messages during kdb sessions we must inform kdb's
51 * I/O utilities that messages sent to the console will automatically
52 * be displayed on the dbg_io.
53 */
54 dbg_io_ops->is_console = true;
55
56 return 0;
57}
58
47static void kgdb_nmi_console_write(struct console *co, const char *s, uint c) 59static void kgdb_nmi_console_write(struct console *co, const char *s, uint c)
48{ 60{
49 int i; 61 int i;
50 62
51 if (!kgdb_nmi_tty_enabled || atomic_read(&kgdb_active) >= 0)
52 return;
53
54 for (i = 0; i < c; i++) 63 for (i = 0; i < c; i++)
55 dbg_io_ops->write_char(s[i]); 64 dbg_io_ops->write_char(s[i]);
56} 65}
@@ -65,6 +74,7 @@ static struct tty_driver *kgdb_nmi_console_device(struct console *co, int *idx)
65 74
66static struct console kgdb_nmi_console = { 75static struct console kgdb_nmi_console = {
67 .name = "ttyNMI", 76 .name = "ttyNMI",
77 .setup = kgdb_nmi_console_setup,
68 .write = kgdb_nmi_console_write, 78 .write = kgdb_nmi_console_write,
69 .device = kgdb_nmi_console_device, 79 .device = kgdb_nmi_console_device,
70 .flags = CON_PRINTBUFFER | CON_ANYTIME | CON_ENABLED, 80 .flags = CON_PRINTBUFFER | CON_ANYTIME | CON_ENABLED,