mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 03:54:02 +00:00
kgdboc,kdb: Allow kdb to work on a non open console port
If kdb is open on a serial port that is not actually a console make sure to call the poll routines to emit and receive characters. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Acked-by: Martin Hicks <mort@sgi.com>
This commit is contained in:
parent
1cee5e35f1
commit
efe2f29e32
3 changed files with 33 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include <linux/kgdb.h>
|
#include <linux/kgdb.h>
|
||||||
#include <linux/kdb.h>
|
#include <linux/kdb.h>
|
||||||
#include <linux/tty.h>
|
#include <linux/tty.h>
|
||||||
|
#include <linux/console.h>
|
||||||
|
|
||||||
#define MAX_CONFIG_LEN 40
|
#define MAX_CONFIG_LEN 40
|
||||||
|
|
||||||
|
@ -93,12 +94,14 @@ static int configure_kgdboc(void)
|
||||||
int tty_line = 0;
|
int tty_line = 0;
|
||||||
int err;
|
int err;
|
||||||
char *cptr = config;
|
char *cptr = config;
|
||||||
|
struct console *cons;
|
||||||
|
|
||||||
err = kgdboc_option_setup(config);
|
err = kgdboc_option_setup(config);
|
||||||
if (err || !strlen(config) || isspace(config[0]))
|
if (err || !strlen(config) || isspace(config[0]))
|
||||||
goto noconfig;
|
goto noconfig;
|
||||||
|
|
||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
|
kgdboc_io_ops.is_console = 0;
|
||||||
kgdb_tty_driver = NULL;
|
kgdb_tty_driver = NULL;
|
||||||
|
|
||||||
if (kgdboc_register_kbd(&cptr))
|
if (kgdboc_register_kbd(&cptr))
|
||||||
|
@ -108,6 +111,17 @@ static int configure_kgdboc(void)
|
||||||
if (!p)
|
if (!p)
|
||||||
goto noconfig;
|
goto noconfig;
|
||||||
|
|
||||||
|
cons = console_drivers;
|
||||||
|
while (cons) {
|
||||||
|
int idx;
|
||||||
|
if (cons->device && cons->device(cons, &idx) == p &&
|
||||||
|
idx == tty_line) {
|
||||||
|
kgdboc_io_ops.is_console = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cons = cons->next;
|
||||||
|
}
|
||||||
|
|
||||||
kgdb_tty_driver = p;
|
kgdb_tty_driver = p;
|
||||||
kgdb_tty_line = tty_line;
|
kgdb_tty_line = tty_line;
|
||||||
|
|
||||||
|
|
|
@ -247,6 +247,8 @@ struct kgdb_arch {
|
||||||
* the I/O driver.
|
* the I/O driver.
|
||||||
* @post_exception: Pointer to a function that will do any cleanup work
|
* @post_exception: Pointer to a function that will do any cleanup work
|
||||||
* for the I/O driver.
|
* for the I/O driver.
|
||||||
|
* @is_console: 1 if the end device is a console 0 if the I/O device is
|
||||||
|
* not a console
|
||||||
*/
|
*/
|
||||||
struct kgdb_io {
|
struct kgdb_io {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -256,6 +258,7 @@ struct kgdb_io {
|
||||||
int (*init) (void);
|
int (*init) (void);
|
||||||
void (*pre_exception) (void);
|
void (*pre_exception) (void);
|
||||||
void (*post_exception) (void);
|
void (*post_exception) (void);
|
||||||
|
int is_console;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct kgdb_arch arch_kgdb_ops;
|
extern struct kgdb_arch arch_kgdb_ops;
|
||||||
|
|
|
@ -673,6 +673,14 @@ kdb_printit:
|
||||||
if (!dbg_kdb_mode && kgdb_connected) {
|
if (!dbg_kdb_mode && kgdb_connected) {
|
||||||
gdbstub_msg_write(kdb_buffer, retlen);
|
gdbstub_msg_write(kdb_buffer, retlen);
|
||||||
} else {
|
} else {
|
||||||
|
if (!dbg_io_ops->is_console) {
|
||||||
|
len = strlen(kdb_buffer);
|
||||||
|
cp = kdb_buffer;
|
||||||
|
while (len--) {
|
||||||
|
dbg_io_ops->write_char(*cp);
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
while (c) {
|
while (c) {
|
||||||
c->write(c, kdb_buffer, retlen);
|
c->write(c, kdb_buffer, retlen);
|
||||||
touch_nmi_watchdog();
|
touch_nmi_watchdog();
|
||||||
|
@ -719,6 +727,14 @@ kdb_printit:
|
||||||
kdb_input_flush();
|
kdb_input_flush();
|
||||||
c = console_drivers;
|
c = console_drivers;
|
||||||
|
|
||||||
|
if (!dbg_io_ops->is_console) {
|
||||||
|
len = strlen(moreprompt);
|
||||||
|
cp = moreprompt;
|
||||||
|
while (len--) {
|
||||||
|
dbg_io_ops->write_char(*cp);
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
while (c) {
|
while (c) {
|
||||||
c->write(c, moreprompt, strlen(moreprompt));
|
c->write(c, moreprompt, strlen(moreprompt));
|
||||||
touch_nmi_watchdog();
|
touch_nmi_watchdog();
|
||||||
|
|
Loading…
Add table
Reference in a new issue