ia64/linux-2.6.18-xen.hg

changeset 762:a070228ac76e

add hvc compatibility mode to xencons.

Makes switching back and forth with a pvops kernel easier. Taken from
http://lists.alioth.debian.org/pipermail/pkg-xen-devel/2008-October/002098.html
http://svn.debian.org/viewsvn/kernel?rev=12337&view=rev with thanks to
Bastian Blank.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Ian Campbell <ian.campbell@citrix.com>
date Thu Dec 11 13:38:48 2008 +0000 (2008-12-11)
parents 5e1269aa5c29
children ff9683032b76
files drivers/xen/console/console.c
line diff
     1.1 --- a/drivers/xen/console/console.c	Wed Dec 10 13:32:32 2008 +0000
     1.2 +++ b/drivers/xen/console/console.c	Thu Dec 11 13:38:48 2008 +0000
     1.3 @@ -66,13 +66,14 @@
     1.4   *  'xencons=tty'  [XC_TTY]:     Console attached to '/dev/tty[0-9]+'.
     1.5   *  'xencons=ttyS' [XC_SERIAL]:  Console attached to '/dev/ttyS[0-9]+'.
     1.6   *  'xencons=xvc'  [XC_XVC]:     Console attached to '/dev/xvc0'.
     1.7 + *  'xencons=hvc'  [XC_HVC]:     Console attached to '/dev/hvc0'.
     1.8   *  default:                     XC_XVC
     1.9   * 
    1.10   * NB. In mode XC_TTY, we create dummy consoles for tty2-63. This suppresses
    1.11   * warnings from standard distro startup scripts.
    1.12   */
    1.13  static enum {
    1.14 -	XC_OFF, XC_TTY, XC_SERIAL, XC_XVC
    1.15 +	XC_OFF, XC_TTY, XC_SERIAL, XC_XVC, XC_HVC
    1.16  } xc_mode = XC_XVC;
    1.17  static int xc_num = -1;
    1.18  
    1.19 @@ -80,6 +81,10 @@ static int xc_num = -1;
    1.20  #define XEN_XVC_MAJOR 204
    1.21  #define XEN_XVC_MINOR 191
    1.22  
    1.23 +/* /dev/hvc0 device number */
    1.24 +#define XEN_HVC_MAJOR 229
    1.25 +#define XEN_HVC_MINOR 0
    1.26 +
    1.27  #ifdef CONFIG_MAGIC_SYSRQ
    1.28  static unsigned long sysrq_requested;
    1.29  extern int sysrq_enabled;
    1.30 @@ -102,6 +107,9 @@ static int __init xencons_setup(char *st
    1.31  	} else if (!strncmp(str, "xvc", 3)) {
    1.32  		xc_mode = XC_XVC;
    1.33  		str += 3;
    1.34 +	} else if (!strncmp(str, "hvc", 3)) {
    1.35 +		xc_mode = XC_HVC;
    1.36 +		str += 3;
    1.37  	} else if (!strncmp(str, "off", 3)) {
    1.38  		xc_mode = XC_OFF;
    1.39  		str += 3;
    1.40 @@ -210,6 +218,14 @@ static int __init xen_console_init(void)
    1.41  			xc_num = 0;
    1.42  		break;
    1.43  
    1.44 +	case XC_HVC:
    1.45 +		strcpy(kcons_info.name, "hvc");
    1.46 +		if (xc_num == -1)
    1.47 +			xc_num = 0;
    1.48 +		if (!is_initial_xendomain())
    1.49 +			add_preferred_console(kcons_info.name, xc_num, NULL);
    1.50 +		break;
    1.51 +
    1.52  	case XC_SERIAL:
    1.53  		strcpy(kcons_info.name, "ttyS");
    1.54  		if (xc_num == -1)
    1.55 @@ -685,6 +701,12 @@ static int __init xencons_init(void)
    1.56  		DRV(xencons_driver)->minor_start = XEN_XVC_MINOR;
    1.57  		DRV(xencons_driver)->name_base   = xc_num;
    1.58  		break;
    1.59 +	case XC_HVC:
    1.60 +		DRV(xencons_driver)->name        = "hvc";
    1.61 +		DRV(xencons_driver)->major       = XEN_HVC_MAJOR;
    1.62 +		DRV(xencons_driver)->minor_start = XEN_HVC_MINOR;
    1.63 +		DRV(xencons_driver)->name_base   = xc_num;
    1.64 +		break;
    1.65  	case XC_SERIAL:
    1.66  		DRV(xencons_driver)->name        = "ttyS";
    1.67  		DRV(xencons_driver)->minor_start = 64 + xc_num;