]> xenbits.xensource.com Git - xen.git/commitdiff
x86: Auto-probe the serial port baud rate if 'com1' or 'com2' is
authorKeir Fraser <keir@xensource.com>
Mon, 24 Sep 2007 20:41:46 +0000 (21:41 +0100)
committerKeir Fraser <keir@xensource.com>
Mon, 24 Sep 2007 20:41:46 +0000 (21:41 +0100)
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>
xen/drivers/char/console.c
xen/drivers/char/ns16550.c
xen/include/asm-x86/config.h
xen/include/xen/console.h

index 7d52a4c3ca864b511cbf06933ca26c97783994d3..e4acd802b43923147b8c7ab735e9cf9545046ab7 100644 (file)
@@ -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);
index 4b37656270a9cf72c4551cdc3500ebcc12fd1a9c..8a67f544891ea08ee6a456355b5182c80503adff 100644 (file)
@@ -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, struct ns16550_defaults *defaults)
     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);
 }
index a9bfc7076eca3547fe44b3208a5c9717c6b47915..698868fc74051f0a13be5c32aab9432366767b78 100644 (file)
@@ -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
index d6c0510281c29c6d985cdfcf97b43b0e8cdd0f47..7c786ab5df9328311cb26b3729449fa57f03bb1f 100644 (file)
@@ -17,6 +17,7 @@ long read_console_ring(XEN_GUEST_HANDLE(char), u32 *, int);
 
 void init_console(void);
 void console_endboot(void);
+int console_has(const char *device);
 
 int fill_console_start_info(struct dom0_vga_console_info *);