2 * Kernel Debugger Console I/O handler
4 * Copyright (C) 1999 Silicon Graphics, Inc.
5 * Copyright (C) Scott Lurndal (slurn@engr.sgi.com)
6 * Copyright (C) Scott Foehner (sfoehner@engr.sgi.com)
7 * Copyright (C) Srinivasa Thirumalachar (sprasad@engr.sgi.com)
9 * See the file LIA-COPYRIGHT for additional information.
11 * Written March 1999 by Scott Lurndal at Silicon Graphics, Inc.
14 * Chuck Fleckenstein 1999/07/20
15 * Move kdb_info struct declaration to this file
16 * for cases where serial support is not compiled into
19 * Masahiro Adegawa 1999/07/20
20 * Handle some peculiarities of japanese 86/106
23 * marc@mucom.co.il 1999/07/20
24 * Catch buffer overflow for serial input.
29 * Scott Lurndal 2000/01/03
30 * Restructure for v1.0
32 * Keith Owens 2000/05/23
35 * Andi Kleen 2000/03/19
36 * Support simultaneous input from serial line and keyboard.
39 #include <linux/kernel.h>
41 #include <linux/wait.h>
42 #include <linux/delay.h>
43 #include <linux/pc_keyb.h>
44 #include <linux/console.h>
45 #include <linux/ctype.h>
46 #include <linux/keyboard.h>
47 #include <linux/serial_reg.h>
49 #include <linux/kdb.h>
50 #include <linux/kdbprivate.h>
51 #include <asm/machdep.h>
58 * This module contains code to read characters from the keyboard or a serial
61 * It is used by the kernel debugger, and is polled, not interrupt driven.
65 kdb_resetkeyboard(void)
68 kdb_kbdsend(KBD_CMD_ENABLE);
74 /* code that may be resurrected later.. */
75 #if defined(CONFIG_VT)
77 * Check if the keyboard controller has a keypress for us.
78 * Some parts (Enter Release, LED change) are still blocking polled here,
79 * but hopefully they are all short.
81 static int get_kbd_char(void)
84 /* keychar = inchar(); */
85 keychar = ppc_md.udbg_getc_poll();
95 kdb_printf("%c", keychar);
99 #endif /* CONFIG_VT */
102 static int get_char_lp(void)
105 keychar = ppc_md.udbg_getc_poll();
113 /* echo the character. */
115 kdb_printf("%c", keychar);
123 kdba_read(char *buffer, size_t bufsize)
126 char *bufend = buffer+bufsize-2; /* Reserve space for newline and null byte */
129 unsigned char key = ppc_md.udbg_getc();
130 /* Echo is done in the low level functions */
132 case '\b': /* backspace */
133 case '\x7f': /* delete */
139 case '\n': /* enter */
140 case '\r': /* - the other enter... */
141 ppc_md.udbg_putc('\n');
147 ppc_md.udbg_putc(key);