ia64/xen-unstable

changeset 15974:66fa2bc70e2a

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@xensource.com>
author Keir Fraser <keir@xensource.com>
date Mon Sep 24 21:41:46 2007 +0100 (2007-09-24)
parents 2b5c427c080f
children ad339d88639d
files xen/drivers/char/console.c xen/drivers/char/ns16550.c xen/include/asm-x86/config.h xen/include/xen/console.h
line diff
     1.1 --- a/xen/drivers/char/console.c	Mon Sep 24 16:03:11 2007 +0100
     1.2 +++ b/xen/drivers/char/console.c	Mon Sep 24 21:41:46 2007 +0100
     1.3 @@ -592,6 +592,21 @@ void __init console_endboot(void)
     1.4      switch_serial_input();
     1.5  }
     1.6  
     1.7 +int console_has(const char *device)
     1.8 +{
     1.9 +    char *p;
    1.10 +
    1.11 +    for ( p = opt_console; p != NULL; p = strchr(p, ',') )
    1.12 +    {
    1.13 +        if ( *p == ',' )
    1.14 +            p++;
    1.15 +        if ( strncmp(p, device, strlen(device)) == 0 )
    1.16 +            return 1;
    1.17 +    }
    1.18 +
    1.19 +    return 0;
    1.20 +}
    1.21 +
    1.22  void console_start_log_everything(void)
    1.23  {
    1.24      atomic_inc(&print_everything);
     2.1 --- a/xen/drivers/char/ns16550.c	Mon Sep 24 16:03:11 2007 +0100
     2.2 +++ b/xen/drivers/char/ns16550.c	Mon Sep 24 21:41:46 2007 +0100
     2.3 @@ -9,6 +9,7 @@
     2.4   */
     2.5  
     2.6  #include <xen/config.h>
     2.7 +#include <xen/console.h>
     2.8  #include <xen/init.h>
     2.9  #include <xen/irq.h>
    2.10  #include <xen/sched.h>
    2.11 @@ -368,15 +369,14 @@ void __init ns16550_init(int index, stru
    2.12      if ( (index < 0) || (index > 1) )
    2.13          return;
    2.14  
    2.15 -    if ( defaults != NULL )
    2.16 -    {
    2.17 -        uart->baud      = defaults->baud;
    2.18 -        uart->data_bits = defaults->data_bits;
    2.19 -        uart->parity    = parse_parity_char(defaults->parity);
    2.20 -        uart->stop_bits = defaults->stop_bits;
    2.21 -        uart->irq       = defaults->irq;
    2.22 -        uart->io_base   = defaults->io_base;
    2.23 -    }
    2.24 +    uart->baud      = (defaults->baud ? :
    2.25 +                       console_has((index == 0) ? "com1" : "com2")
    2.26 +                       ? BAUD_AUTO : 0);
    2.27 +    uart->data_bits = defaults->data_bits;
    2.28 +    uart->parity    = parse_parity_char(defaults->parity);
    2.29 +    uart->stop_bits = defaults->stop_bits;
    2.30 +    uart->irq       = defaults->irq;
    2.31 +    uart->io_base   = defaults->io_base;
    2.32  
    2.33      ns16550_parse_port_config(uart, (index == 0) ? opt_com1 : opt_com2);
    2.34  }
     3.1 --- a/xen/include/asm-x86/config.h	Mon Sep 24 16:03:11 2007 +0100
     3.2 +++ b/xen/include/asm-x86/config.h	Mon Sep 24 21:41:46 2007 +0100
     3.3 @@ -45,7 +45,7 @@
     3.4  
     3.5  #define HZ 100
     3.6  
     3.7 -#define OPT_CONSOLE_STR "com1,vga"
     3.8 +#define OPT_CONSOLE_STR "vga"
     3.9  
    3.10  #ifdef MAX_PHYS_CPUS
    3.11  #define NR_CPUS MAX_PHYS_CPUS
     4.1 --- a/xen/include/xen/console.h	Mon Sep 24 16:03:11 2007 +0100
     4.2 +++ b/xen/include/xen/console.h	Mon Sep 24 21:41:46 2007 +0100
     4.3 @@ -17,6 +17,7 @@ long read_console_ring(XEN_GUEST_HANDLE(
     4.4  
     4.5  void init_console(void);
     4.6  void console_endboot(void);
     4.7 +int console_has(const char *device);
     4.8  
     4.9  int fill_console_start_info(struct dom0_vga_console_info *);
    4.10