[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: Auto-probe the serial port baud rate if 'com1' or 'com2' is
# HG changeset patch # User Keir Fraser <keir@xxxxxxxxxxxxx> # Date 1190666506 -3600 # Node ID 66fa2bc70e2a7e7dfd27ea490e85ac9cf5dc40f7 # Parent 2b5c427c080f6de05e669b8a01e3419a256b8053 x86: Auto-probe the serial port baud rate if 'com1' or 'com2' is specified as a Xen console target. Avoids need for 'com1=' or 'com2=' command-line option in some cases. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/drivers/char/console.c | 15 +++++++++++++++ xen/drivers/char/ns16550.c | 18 +++++++++--------- xen/include/asm-x86/config.h | 2 +- xen/include/xen/console.h | 1 + 4 files changed, 26 insertions(+), 10 deletions(-) diff -r 2b5c427c080f -r 66fa2bc70e2a xen/drivers/char/console.c --- a/xen/drivers/char/console.c Mon Sep 24 16:03:11 2007 +0100 +++ b/xen/drivers/char/console.c Mon Sep 24 21:41:46 2007 +0100 @@ -592,6 +592,21 @@ void __init console_endboot(void) switch_serial_input(); } +int console_has(const char *device) +{ + char *p; + + for ( p = opt_console; p != NULL; p = strchr(p, ',') ) + { + if ( *p == ',' ) + p++; + if ( strncmp(p, device, strlen(device)) == 0 ) + return 1; + } + + return 0; +} + void console_start_log_everything(void) { atomic_inc(&print_everything); diff -r 2b5c427c080f -r 66fa2bc70e2a xen/drivers/char/ns16550.c --- a/xen/drivers/char/ns16550.c Mon Sep 24 16:03:11 2007 +0100 +++ b/xen/drivers/char/ns16550.c Mon Sep 24 21:41:46 2007 +0100 @@ -9,6 +9,7 @@ */ #include <xen/config.h> +#include <xen/console.h> #include <xen/init.h> #include <xen/irq.h> #include <xen/sched.h> @@ -368,15 +369,14 @@ void __init ns16550_init(int index, stru if ( (index < 0) || (index > 1) ) return; - if ( defaults != NULL ) - { - uart->baud = defaults->baud; - uart->data_bits = defaults->data_bits; - uart->parity = parse_parity_char(defaults->parity); - uart->stop_bits = defaults->stop_bits; - uart->irq = defaults->irq; - uart->io_base = defaults->io_base; - } + uart->baud = (defaults->baud ? : + console_has((index == 0) ? "com1" : "com2") + ? BAUD_AUTO : 0); + uart->data_bits = defaults->data_bits; + uart->parity = parse_parity_char(defaults->parity); + uart->stop_bits = defaults->stop_bits; + uart->irq = defaults->irq; + uart->io_base = defaults->io_base; ns16550_parse_port_config(uart, (index == 0) ? opt_com1 : opt_com2); } diff -r 2b5c427c080f -r 66fa2bc70e2a xen/include/asm-x86/config.h --- a/xen/include/asm-x86/config.h Mon Sep 24 16:03:11 2007 +0100 +++ b/xen/include/asm-x86/config.h Mon Sep 24 21:41:46 2007 +0100 @@ -45,7 +45,7 @@ #define HZ 100 -#define OPT_CONSOLE_STR "com1,vga" +#define OPT_CONSOLE_STR "vga" #ifdef MAX_PHYS_CPUS #define NR_CPUS MAX_PHYS_CPUS diff -r 2b5c427c080f -r 66fa2bc70e2a xen/include/xen/console.h --- a/xen/include/xen/console.h Mon Sep 24 16:03:11 2007 +0100 +++ b/xen/include/xen/console.h Mon Sep 24 21:41:46 2007 +0100 @@ -17,6 +17,7 @@ long read_console_ring(XEN_GUEST_HANDLE( void init_console(void); void console_endboot(void); +int console_has(const char *device); int fill_console_start_info(struct dom0_vga_console_info *); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |