aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2014-05-13 18:43:13 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2014-05-14 09:30:20 +0100
commit2b9e5a4592ade13c19888fa04fdced46ce5cbb65 (patch)
tree25e54388ad5a8fbdc5374505be376be56d70de7c
parent175b66b0d8bc71c91c4e7275fe08aeb491977dc7 (diff)
serial: kgdb_nmi: Improve console integration with KDB I/Odev/kdb-fiq-v0.9
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>
-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 edcad315ec05..5f5b30d79cad 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)");
static bool kgdb_nmi_tty_enabled;
+static int kgdb_nmi_console_setup(struct console *co, char *options)
+{
+ /* The NMI console uses the dbg_io_ops to issue console messages. To
+ * avoid duplicate messages during kdb sessions we must inform kdb's
+ * I/O utilities that messages sent to the console will automatically
+ * be displayed on the dbg_io.
+ */
+ dbg_io_ops->is_console = true;
+
+ return 0;
+}
+
static void kgdb_nmi_console_write(struct console *co, const char *s, uint c)
{
int i;
- if (!kgdb_nmi_tty_enabled || atomic_read(&kgdb_active) >= 0)
- return;
-
for (i = 0; i < c; i++) {
if (s[i] == '\n')
dbg_io_ops->write_char('\r');
@@ -68,6 +77,7 @@ static struct tty_driver *kgdb_nmi_console_device(struct console *co, int *idx)
static struct console kgdb_nmi_console = {
.name = "ttyNMI",
+ .setup = kgdb_nmi_console_setup,
.write = kgdb_nmi_console_write,
.device = kgdb_nmi_console_device,
.flags = CON_PRINTBUFFER | CON_ANYTIME | CON_ENABLED,