diff mbox series

[4/4] parisc: Fix kgdb_pdc console read/write funtions

Message ID 20221126213621.363838-4-deller@gmx.de (mailing list archive)
State Superseded
Headers show
Series [1/4] parisc: Fix locking in pdc_iodc_print() firmware call | expand

Commit Message

Helge Deller Nov. 26, 2022, 9:36 p.m. UTC
Allow the kgdb debugger to read chars from PDC firmware console
(keyboard or serial port), and fix output to only show up on monitors
since the output to serial ports is already happens in the kgdb serial
driver.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 arch/parisc/kernel/kgdb.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

--
2.38.1
diff mbox series

Patch

diff --git a/arch/parisc/kernel/kgdb.c b/arch/parisc/kernel/kgdb.c
index ab7620f695be..586046d52712 100644
--- a/arch/parisc/kernel/kgdb.c
+++ b/arch/parisc/kernel/kgdb.c
@@ -13,6 +13,7 @@ 
 #include <linux/notifier.h>
 #include <linux/kdebug.h>
 #include <linux/uaccess.h>
+#include <linux/serial_core.h>
 #include <asm/ptrace.h>
 #include <asm/traps.h>
 #include <asm/processor.h>
@@ -211,14 +212,22 @@  int kgdb_arch_handle_exception(int trap, int signo,

 /* KGDB console driver which uses PDC to read chars from keyboard */

+static int kgdb_pdc_read_char(void)
+{
+        int c = pdc_iodc_getc();
+
+        return (c <= 0) ? NO_POLL_CHAR : c;
+}
+
 static void kgdb_pdc_write_char(u8 chr)
 {
-	/* no need to print char. kgdb will do it. */
+	if (PAGE0->mem_cons.cl_class != CL_DUPLEX)
+		pdc_iodc_print(&chr, 1);
 }

 static struct kgdb_io kgdb_pdc_io_ops = {
 	.name		= "kgdb_pdc",
-	.read_char	= pdc_iodc_getc,
+	.read_char	= kgdb_pdc_read_char,
 	.write_char	= kgdb_pdc_write_char,
 };