diff options
author | Keir Fraser <keir@xensource.com> | 2007-11-05 16:37:48 +0000 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-11-05 16:37:48 +0000 |
commit | a9ed24081c614ba6cd9f4eaf07c1c6a9000a9450 (patch) | |
tree | 143716131117027826a253015e6acf847c2ae76f | |
parent | 7b7bd4b67748f4b8922ee19b05c0653a798a34ce (diff) | |
download | xen-a9ed24081c614ba6cd9f4eaf07c1c6a9000a9450.tar.gz xen-a9ed24081c614ba6cd9f4eaf07c1c6a9000a9450.tar.bz2 xen-a9ed24081c614ba6cd9f4eaf07c1c6a9000a9450.zip |
Small cleanups to console-input-redirect code in Xen.
Signed-off-by: Keir Fraser <keir@xensource.com>
-rw-r--r-- | xen/drivers/char/console.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 0bd11fc33d..164572ffca 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -43,7 +43,7 @@ string_param("console", opt_console); /* Char 1: CTRL+<char1> is used to switch console input between Xen and DOM0 */ /* Char 2: If this character is 'x', then do not auto-switch to DOM0 when it */ /* boots. Any other value, or omitting the char, enables auto-switch */ -static unsigned char opt_conswitch[5] = "a"; +static unsigned char opt_conswitch[3] = "a"; string_param("conswitch", opt_conswitch); /* sync_console: force synchronous console output (useful for debugging). */ @@ -267,19 +267,18 @@ static void sercon_puts(const char *s) } /* CTRL-<switch_char> switches input direction between Xen and DOM0. */ -#define SWITCH_CODE (opt_conswitch[0]-'a'+1) +#define switch_code (opt_conswitch[0]-'a'+1) static int xen_rx = 1; /* FALSE => serial input passed to domain 0. */ static void switch_serial_input(void) { static char *input_str[2] = { "DOM0", "Xen" }; xen_rx = !xen_rx; - if ( (SWITCH_CODE != 0) && (dom0 != NULL) ) - { - printk("*** Serial input -> %s " - "(type 'CTRL-%c' three times to switch input to %s).\n", - input_str[xen_rx], opt_conswitch[0], input_str[!xen_rx]); - } + printk("*** Serial input -> %s", input_str[xen_rx]); + if ( switch_code ) + printk(" (type 'CTRL-%c' three times to switch input to %s)", + opt_conswitch[0], input_str[!xen_rx]); + printk("\n"); } static void __serial_rx(char c, struct cpu_user_regs *regs) @@ -298,20 +297,19 @@ static void serial_rx(char c, struct cpu_user_regs *regs) { static int switch_code_count = 0; - if ( (SWITCH_CODE != 0) && (c == SWITCH_CODE) ) + if ( switch_code && (c == switch_code) ) { /* We eat CTRL-<switch_char> in groups of 3 to switch console input. */ if ( ++switch_code_count == 3 ) { switch_serial_input(); switch_code_count = 0; - return; } + return; } - else - { - switch_code_count = 0; - } + + for ( ; switch_code_count != 0; switch_code_count-- ) + __serial_rx(switch_code, regs); /* Finally process the just-received character. */ __serial_rx(c, regs); |