ia64/xen-unstable

changeset 15564:6a89339b81d0

[IA64] Enable Xen VGA autodetection

This patch enables console autodetection for VGA on systems
implementing a PCDP table. With this, setting the primary console to
VGA or serial will cause both Xen and Dom0 output to go to the right
place automatically (overridden by manually specifying a console=).
This shouldn't help or hurt systems without an HCDP/PCDP table.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author Alex Williamson <alex.williamson@hp.com>
date Wed Jul 25 13:13:02 2007 -0600 (2007-07-25)
parents 1ef9dc28810d
children 37833b33ae77
files xen/arch/ia64/xen/pcdp.c xen/arch/ia64/xen/xensetup.c
line diff
     1.1 --- a/xen/arch/ia64/xen/pcdp.c	Wed Jul 25 13:09:27 2007 -0600
     1.2 +++ b/xen/arch/ia64/xen/pcdp.c	Wed Jul 25 13:13:02 2007 -0600
     1.3 @@ -137,7 +137,7 @@ setup_pcdp_irq(struct pcdp *pcdp, struct
     1.4  }
     1.5  
     1.6  static int __init
     1.7 -setup_serial_console(struct pcdp *pcdp, struct pcdp_uart *uart)
     1.8 +setup_serial_console(struct pcdp_uart *uart)
     1.9  {
    1.10  
    1.11  	ns16550_com1.baud = uart->baud ? uart->baud : BAUD_AUTO;
    1.12 @@ -145,11 +145,43 @@ setup_serial_console(struct pcdp *pcdp, 
    1.13  	if (uart->bits)
    1.14  		ns16550_com1.data_bits = uart->bits;
    1.15  
    1.16 -	setup_pcdp_irq(pcdp, uart);
    1.17 +	setup_pcdp_irq(efi.hcdp, uart);
    1.18 +
    1.19 +	/* Hide the HCDP table from dom0, xencons will be the console */
    1.20 +	efi.hcdp = NULL;
    1.21  
    1.22  	return 0;
    1.23  }
    1.24 +
    1.25 +static int __init
    1.26 +setup_vga_console(struct pcdp_vga *vga)
    1.27 +{
    1.28 +#ifdef CONFIG_VGA
    1.29 +	/*
    1.30 +	 * There was no console= in the original cmdline, and the PCDP
    1.31 +	 * is telling us VGA is the primary console.  We can call
    1.32 +	 * cmdline_parse() manually to make things appear automagic.
    1.33 +	 *
    1.34 +	 * NB - cmdline_parse() expects the first part of the cmdline
    1.35 +	 * to be the image name.  So "pcdp" below is just filler.
    1.36 +	 */
    1.37 +	char *console_cmdline = "pcdp console=vga";
    1.38 +
    1.39 +	cmdline_parse(console_cmdline);
    1.40 +
    1.41 +	/*
    1.42 +	 * Leave efi.hcdp intact since dom0 will take ownership.
    1.43 +	 * vga=keep is handled in start_kernel().
    1.44 +	 */
    1.45 +
    1.46 +	return 0;
    1.47  #else
    1.48 +	return -ENODEV;
    1.49 +#endif
    1.50 +}
    1.51 +
    1.52 +#else /* XEN */
    1.53 +
    1.54  static int __init
    1.55  setup_serial_console(struct pcdp_uart *uart)
    1.56  {
    1.57 @@ -184,33 +216,27 @@ setup_vga_console(struct pcdp_vga *vga)
    1.58  	return -ENODEV;
    1.59  #endif
    1.60  }
    1.61 -#endif
    1.62 +#endif /* XEN */
    1.63  
    1.64  int __init
    1.65  efi_setup_pcdp_console(char *cmdline)
    1.66  {
    1.67  	struct pcdp *pcdp;
    1.68  	struct pcdp_uart *uart;
    1.69 -#ifndef XEN
    1.70  	struct pcdp_device *dev, *end;
    1.71 -#endif
    1.72  	int i, serial = 0;
    1.73  
    1.74  	pcdp = efi.hcdp;
    1.75  	if (!pcdp)
    1.76  		return -ENODEV;
    1.77  
    1.78 -#ifndef XEN
    1.79  	printk(KERN_INFO "PCDP: v%d at 0x%lx\n", pcdp->rev, __pa(pcdp));
    1.80 -#endif
    1.81  
    1.82  	if (strstr(cmdline, "console=hcdp")) {
    1.83  		if (pcdp->rev < 3)
    1.84  			serial = 1;
    1.85  	} else if (strstr(cmdline, "console=")) {
    1.86 -#ifndef XEN
    1.87  		printk(KERN_INFO "Explicit \"console=\"; ignoring PCDP\n");
    1.88 -#endif
    1.89  		return -ENODEV;
    1.90  	}
    1.91  
    1.92 @@ -220,17 +246,12 @@ efi_setup_pcdp_console(char *cmdline)
    1.93  	for (i = 0, uart = pcdp->uart; i < pcdp->num_uarts; i++, uart++) {
    1.94  		if (uart->flags & PCDP_UART_PRIMARY_CONSOLE || serial) {
    1.95  			if (uart->type == PCDP_CONSOLE_UART) {
    1.96 -#ifndef XEN
    1.97  				return setup_serial_console(uart);
    1.98 -#else
    1.99 -				return setup_serial_console(pcdp, uart);
   1.100 -#endif
   1.101  				
   1.102  			}
   1.103  		}
   1.104  	}
   1.105  
   1.106 -#ifndef XEN
   1.107  	end = (struct pcdp_device *) ((u8 *) pcdp + pcdp->length);
   1.108  	for (dev = (struct pcdp_device *) (pcdp->uart + pcdp->num_uarts);
   1.109  	     dev < end;
   1.110 @@ -241,7 +262,6 @@ efi_setup_pcdp_console(char *cmdline)
   1.111  			}
   1.112  		}
   1.113  	}
   1.114 -#endif
   1.115  
   1.116  	return -ENODEV;
   1.117  }
     2.1 --- a/xen/arch/ia64/xen/xensetup.c	Wed Jul 25 13:09:27 2007 -0600
     2.2 +++ b/xen/arch/ia64/xen/xensetup.c	Wed Jul 25 13:13:02 2007 -0600
     2.3 @@ -561,9 +561,6 @@ printk("num_online_cpus=%d, max_cpus=%d\
     2.4              }
     2.5          }
     2.6          serial_init_postirq();
     2.7 -
     2.8 -        /* Hide the HCDP table from dom0 */
     2.9 -        efi.hcdp = NULL;
    2.10      }
    2.11  
    2.12      expose_p2m_init();