ia64/xen-unstable

changeset 10638:9fd92e7e91a5

[LINUX] Fix booting with e.g. xencons=tty3, so that tty1/tty2 are valid (dummy) devices.

Attached patch makes it always create valid devices on tty1-tty63, but
all but the one specified by xencons are dummy devices.

From: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@dhcp93.uk.xensource.com
date Mon Jul 03 08:52:27 2006 +0100 (2006-07-03)
parents 856caf975abd
children 5f5d400eb60a
files linux-2.6-xen-sparse/drivers/xen/console/console.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Mon Jul 03 08:35:12 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Mon Jul 03 08:52:27 2006 +0100
     1.3 @@ -267,7 +267,8 @@ void xencons_force_flush(void)
     1.4  /******************** User-space console driver (/dev/console) ************/
     1.5  
     1.6  #define DRV(_d)         (_d)
     1.7 -#define TTY_INDEX(_tty) ((_tty)->index)
     1.8 +#define DUMMY_TTY(_tty) ((xc_mode != XC_SERIAL) &&		\
     1.9 +			 ((_tty)->index != (xc_num - 1)))
    1.10  
    1.11  static struct termios *xencons_termios[MAX_NR_CONSOLES];
    1.12  static struct termios *xencons_termios_locked[MAX_NR_CONSOLES];
    1.13 @@ -391,7 +392,7 @@ static void xencons_send_xchar(struct tt
    1.14  {
    1.15  	unsigned long flags;
    1.16  
    1.17 -	if (TTY_INDEX(tty) != 0)
    1.18 +	if (DUMMY_TTY(tty))
    1.19  		return;
    1.20  
    1.21  	spin_lock_irqsave(&xencons_lock, flags);
    1.22 @@ -402,7 +403,7 @@ static void xencons_send_xchar(struct tt
    1.23  
    1.24  static void xencons_throttle(struct tty_struct *tty)
    1.25  {
    1.26 -	if (TTY_INDEX(tty) != 0)
    1.27 +	if (DUMMY_TTY(tty))
    1.28  		return;
    1.29  
    1.30  	if (I_IXOFF(tty))
    1.31 @@ -411,7 +412,7 @@ static void xencons_throttle(struct tty_
    1.32  
    1.33  static void xencons_unthrottle(struct tty_struct *tty)
    1.34  {
    1.35 -	if (TTY_INDEX(tty) != 0)
    1.36 +	if (DUMMY_TTY(tty))
    1.37  		return;
    1.38  
    1.39  	if (I_IXOFF(tty)) {
    1.40 @@ -426,7 +427,7 @@ static void xencons_flush_buffer(struct 
    1.41  {
    1.42  	unsigned long flags;
    1.43  
    1.44 -	if (TTY_INDEX(tty) != 0)
    1.45 +	if (DUMMY_TTY(tty))
    1.46  		return;
    1.47  
    1.48  	spin_lock_irqsave(&xencons_lock, flags);
    1.49 @@ -451,7 +452,7 @@ static int xencons_write(
    1.50  	int i;
    1.51  	unsigned long flags;
    1.52  
    1.53 -	if (TTY_INDEX(tty) != 0)
    1.54 +	if (DUMMY_TTY(tty))
    1.55  		return count;
    1.56  
    1.57  	spin_lock_irqsave(&xencons_lock, flags);
    1.58 @@ -472,7 +473,7 @@ static void xencons_put_char(struct tty_
    1.59  {
    1.60  	unsigned long flags;
    1.61  
    1.62 -	if (TTY_INDEX(tty) != 0)
    1.63 +	if (DUMMY_TTY(tty))
    1.64  		return;
    1.65  
    1.66  	spin_lock_irqsave(&xencons_lock, flags);
    1.67 @@ -484,7 +485,7 @@ static void xencons_flush_chars(struct t
    1.68  {
    1.69  	unsigned long flags;
    1.70  
    1.71 -	if (TTY_INDEX(tty) != 0)
    1.72 +	if (DUMMY_TTY(tty))
    1.73  		return;
    1.74  
    1.75  	spin_lock_irqsave(&xencons_lock, flags);
    1.76 @@ -496,7 +497,7 @@ static void xencons_wait_until_sent(stru
    1.77  {
    1.78  	unsigned long orig_jiffies = jiffies;
    1.79  
    1.80 -	if (TTY_INDEX(tty) != 0)
    1.81 +	if (DUMMY_TTY(tty))
    1.82  		return;
    1.83  
    1.84  	while (DRV(tty->driver)->chars_in_buffer(tty)) {
    1.85 @@ -515,7 +516,7 @@ static int xencons_open(struct tty_struc
    1.86  {
    1.87  	unsigned long flags;
    1.88  
    1.89 -	if (TTY_INDEX(tty) != 0)
    1.90 +	if (DUMMY_TTY(tty))
    1.91  		return 0;
    1.92  
    1.93  	spin_lock_irqsave(&xencons_lock, flags);
    1.94 @@ -532,7 +533,7 @@ static void xencons_close(struct tty_str
    1.95  {
    1.96  	unsigned long flags;
    1.97  
    1.98 -	if (TTY_INDEX(tty) != 0)
    1.99 +	if (DUMMY_TTY(tty))
   1.100  		return;
   1.101  
   1.102  	if (tty->count == 1) {
   1.103 @@ -588,8 +589,7 @@ static int __init xencons_init(void)
   1.104  	DRV(xencons_driver)->init_termios    = tty_std_termios;
   1.105  	DRV(xencons_driver)->flags           =
   1.106  		TTY_DRIVER_REAL_RAW |
   1.107 -		TTY_DRIVER_RESET_TERMIOS |
   1.108 -		TTY_DRIVER_NO_DEVFS;
   1.109 +		TTY_DRIVER_RESET_TERMIOS;
   1.110  	DRV(xencons_driver)->termios         = xencons_termios;
   1.111  	DRV(xencons_driver)->termios_locked  = xencons_termios_locked;
   1.112  
   1.113 @@ -599,8 +599,8 @@ static int __init xencons_init(void)
   1.114  		DRV(xencons_driver)->name_base   = 0 + xc_num;
   1.115  	} else {
   1.116  		DRV(xencons_driver)->name        = "tty";
   1.117 -		DRV(xencons_driver)->minor_start = xc_num;
   1.118 -		DRV(xencons_driver)->name_base   = xc_num;
   1.119 +		DRV(xencons_driver)->minor_start = 1;
   1.120 +		DRV(xencons_driver)->name_base   = 1;
   1.121  	}
   1.122  
   1.123  	tty_set_operations(xencons_driver, &xencons_ops);
   1.124 @@ -615,8 +615,6 @@ static int __init xencons_init(void)
   1.125  		return rc;
   1.126  	}
   1.127  
   1.128 -	tty_register_device(xencons_driver, 0, NULL);
   1.129 -
   1.130  	if (xen_start_info->flags & SIF_INITDOMAIN) {
   1.131  		xencons_priv_irq = bind_virq_to_irqhandler(
   1.132  			VIRQ_CONSOLE,
   1.133 @@ -629,8 +627,7 @@ static int __init xencons_init(void)
   1.134  	}
   1.135  
   1.136  	printk("Xen virtual console successfully installed as %s%d\n",
   1.137 -	       DRV(xencons_driver)->name,
   1.138 -	       DRV(xencons_driver)->name_base );
   1.139 +	       DRV(xencons_driver)->name, xc_num);
   1.140  
   1.141  	return 0;
   1.142  }