ia64/xen-unstable

changeset 5316:e59a94732dd2

bitkeeper revision 1.1667 (42a0d723C0nVc96mE2UHsAZH4ZSJJA)

Add EFI PCDP support to automatically find console
Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
author djm@kirby.fc.hp.com
date Fri Jun 03 22:18:11 2005 +0000 (2005-06-03)
parents 4c831628f463
children fea2f7f8df31
files .rootkeys xen/arch/ia64/Makefile xen/arch/ia64/pcdp.c xen/arch/ia64/tools/mkbuildtree xen/arch/ia64/xensetup.c xen/drivers/char/ns16550.c xen/include/asm-ia64/config.h
line diff
     1.1 --- a/.rootkeys	Fri Jun 03 16:39:51 2005 +0000
     1.2 +++ b/.rootkeys	Fri Jun 03 22:18:11 2005 +0000
     1.3 @@ -1091,6 +1091,7 @@ 421098b5_kFbvZIIPM3bdCES1Ocqnw xen/arch/
     1.4  421098b5DWbgK-tBR4um8PEAqPwqTA xen/arch/ia64/patch/linux-2.6.7/types.h
     1.5  421098b5il9YfZM0HpeCnaMgVN_q9g xen/arch/ia64/patch/linux-2.6.7/unaligned.c
     1.6  421098b65M5cPramsLGbODg8lQwUjQ xen/arch/ia64/patch/linux-2.6.7/wait.h
     1.7 +42a0d69cCiNxr2Y1GY1khO7qRiNkbw xen/arch/ia64/pcdp.c
     1.8  421098b6cYDwzXP86ViTLlTO2x7ovA xen/arch/ia64/pdb-stub.c
     1.9  41a26ebcqaSGVQ8qTMwpPwOJSJ7qSw xen/arch/ia64/privop.c
    1.10  41a26ebc4BOHDUsT0TSnryPeV2xfRA xen/arch/ia64/process.c
     2.1 --- a/xen/arch/ia64/Makefile	Fri Jun 03 16:39:51 2005 +0000
     2.2 +++ b/xen/arch/ia64/Makefile	Fri Jun 03 22:18:11 2005 +0000
     2.3 @@ -4,7 +4,7 @@ include $(BASEDIR)/Rules.mk
     2.4  
     2.5  OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \
     2.6  	xenmisc.o pdb-stub.o acpi.o hypercall.o \
     2.7 -	machvec.o dom0_ops.o domain.o hpsimserial.o \
     2.8 +	machvec.o dom0_ops.o domain.o hpsimserial.o pcdp.o \
     2.9  	idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \
    2.10  	xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \
    2.11  	extable.o linuxextable.o xenirq.o xentime.o \
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xen/arch/ia64/pcdp.c	Fri Jun 03 22:18:11 2005 +0000
     3.3 @@ -0,0 +1,120 @@
     3.4 +/*
     3.5 + * Parse the EFI PCDP table to locate the console device.
     3.6 + *
     3.7 + * (c) Copyright 2002, 2003, 2004 Hewlett-Packard Development Company, L.P.
     3.8 + *	Khalid Aziz <khalid.aziz@hp.com>
     3.9 + *	Alex Williamson <alex.williamson@hp.com>
    3.10 + *	Bjorn Helgaas <bjorn.helgaas@hp.com>
    3.11 + *
    3.12 + * This program is free software; you can redistribute it and/or modify
    3.13 + * it under the terms of the GNU General Public License version 2 as
    3.14 + * published by the Free Software Foundation.
    3.15 + */
    3.16 +
    3.17 +#include <linux/acpi.h>
    3.18 +#include <linux/console.h>
    3.19 +#include <linux/efi.h>
    3.20 +#include <linux/serial.h>
    3.21 +#ifdef XEN
    3.22 +#include <linux/errno.h>
    3.23 +#endif
    3.24 +#include "pcdp.h"
    3.25 +
    3.26 +static int __init
    3.27 +setup_serial_console(struct pcdp_uart *uart)
    3.28 +{
    3.29 +#ifdef XEN
    3.30 +	extern char opt_com1[1];
    3.31 +	if (opt_com1[0]) return 0;
    3.32 +	sprintf(&opt_com1[0], "0x%lx,%lu,%dn1",
    3.33 +		uart->addr.address, uart->baud,
    3.34 +		uart->bits ? uart->bits : 8);
    3.35 +	return 0;
    3.36 +#else
    3.37 +#ifdef CONFIG_SERIAL_8250_CONSOLE
    3.38 +	int mmio;
    3.39 +	static char options[64];
    3.40 +
    3.41 +	mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY);
    3.42 +	snprintf(options, sizeof(options), "console=uart,%s,0x%lx,%lun%d",
    3.43 +		mmio ? "mmio" : "io", uart->addr.address, uart->baud,
    3.44 +		uart->bits ? uart->bits : 8);
    3.45 +
    3.46 +	return early_serial_console_init(options);
    3.47 +#else
    3.48 +	return -ENODEV;
    3.49 +#endif
    3.50 +#endif
    3.51 +}
    3.52 +
    3.53 +#ifndef XEN
    3.54 +static int __init
    3.55 +setup_vga_console(struct pcdp_vga *vga)
    3.56 +{
    3.57 +#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
    3.58 +	if (efi_mem_type(0xA0000) == EFI_CONVENTIONAL_MEMORY) {
    3.59 +		printk(KERN_ERR "PCDP: VGA selected, but frame buffer is not MMIO!\n");
    3.60 +		return -ENODEV;
    3.61 +	}
    3.62 +
    3.63 +	conswitchp = &vga_con;
    3.64 +	printk(KERN_INFO "PCDP: VGA console\n");
    3.65 +	return 0;
    3.66 +#else
    3.67 +	return -ENODEV;
    3.68 +#endif
    3.69 +}
    3.70 +#endif
    3.71 +
    3.72 +int __init
    3.73 +efi_setup_pcdp_console(char *cmdline)
    3.74 +{
    3.75 +	struct pcdp *pcdp;
    3.76 +	struct pcdp_uart *uart;
    3.77 +	struct pcdp_device *dev, *end;
    3.78 +	int i, serial = 0;
    3.79 +
    3.80 +	pcdp = efi.hcdp;
    3.81 +	if (!pcdp)
    3.82 +		return -ENODEV;
    3.83 +
    3.84 +#ifndef XEN
    3.85 +	printk(KERN_INFO "PCDP: v%d at 0x%lx\n", pcdp->rev, __pa(pcdp));
    3.86 +#endif
    3.87 +
    3.88 +	if (strstr(cmdline, "console=hcdp")) {
    3.89 +		if (pcdp->rev < 3)
    3.90 +			serial = 1;
    3.91 +	} else if (strstr(cmdline, "console=")) {
    3.92 +#ifndef XEN
    3.93 +		printk(KERN_INFO "Explicit \"console=\"; ignoring PCDP\n");
    3.94 +#endif
    3.95 +		return -ENODEV;
    3.96 +	}
    3.97 +
    3.98 +	if (pcdp->rev < 3 && efi_uart_console_only())
    3.99 +		serial = 1;
   3.100 +
   3.101 +	for (i = 0, uart = pcdp->uart; i < pcdp->num_uarts; i++, uart++) {
   3.102 +		if (uart->flags & PCDP_UART_PRIMARY_CONSOLE || serial) {
   3.103 +			if (uart->type == PCDP_CONSOLE_UART) {
   3.104 +				return setup_serial_console(uart);
   3.105 +			}
   3.106 +		}
   3.107 +	}
   3.108 +
   3.109 +#ifndef XEN
   3.110 +	end = (struct pcdp_device *) ((u8 *) pcdp + pcdp->length);
   3.111 +	for (dev = (struct pcdp_device *) (pcdp->uart + pcdp->num_uarts);
   3.112 +	     dev < end;
   3.113 +	     dev = (struct pcdp_device *) ((u8 *) dev + dev->length)) {
   3.114 +		if (dev->flags & PCDP_PRIMARY_CONSOLE) {
   3.115 +			if (dev->type == PCDP_CONSOLE_VGA) {
   3.116 +				return setup_vga_console((struct pcdp_vga *) dev);
   3.117 +			}
   3.118 +		}
   3.119 +	}
   3.120 +#endif
   3.121 +
   3.122 +	return -ENODEV;
   3.123 +}
     4.1 --- a/xen/arch/ia64/tools/mkbuildtree	Fri Jun 03 16:39:51 2005 +0000
     4.2 +++ b/xen/arch/ia64/tools/mkbuildtree	Fri Jun 03 22:18:11 2005 +0000
     4.3 @@ -309,6 +309,8 @@ softlink include/linux/topology.h includ
     4.4  softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h
     4.5  softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
     4.6  
     4.7 +softlink drivers/firmware/pcdp.h arch/ia64/pcdp.h
     4.8 +
     4.9  null include/asm-ia64/linux/file.h
    4.10  null include/asm-ia64/linux/module.h
    4.11  null include/asm-ia64/linux/swap.h
     5.1 --- a/xen/arch/ia64/xensetup.c	Fri Jun 03 16:39:51 2005 +0000
     5.2 +++ b/xen/arch/ia64/xensetup.c	Fri Jun 03 22:18:11 2005 +0000
     5.3 @@ -107,12 +107,15 @@ static void __init do_initcalls(void)
     5.4   *	"com2=57600,8n1 console=com2 -- console=ttyS1 console=tty
     5.5   * root=/dev/sda3 ro"
     5.6   */
     5.7 +static char null[4] = { 0 };
     5.8 +
     5.9  void early_cmdline_parse(char **cmdline_p)
    5.10  {
    5.11      char *guest_cmd;
    5.12      char *split = "--";
    5.13  
    5.14      if (*cmdline_p == NULL) {
    5.15 +	*cmdline_p = &null[0];
    5.16  	saved_command_line[0] = '\0';
    5.17  	return;
    5.18      }
    5.19 @@ -121,7 +124,7 @@ void early_cmdline_parse(char **cmdline_
    5.20      /* If no spliter, whole line is for guest */
    5.21      if (guest_cmd == NULL) {
    5.22  	guest_cmd = *cmdline_p;
    5.23 -	*cmdline_p = NULL;
    5.24 +	*cmdline_p = &null[0];
    5.25      } else {
    5.26  	*guest_cmd = '\0';	/* Split boot parameters for xen and guest */
    5.27  	guest_cmd += strlen(split);
     6.1 --- a/xen/drivers/char/ns16550.c	Fri Jun 03 16:39:51 2005 +0000
     6.2 +++ b/xen/drivers/char/ns16550.c	Fri Jun 03 22:18:11 2005 +0000
     6.3 @@ -16,7 +16,7 @@
     6.4  #include <asm/io.h>
     6.5  
     6.6  /* Config serial port with a string <baud>,DPS,<io-base>,<irq>. */
     6.7 -static char opt_com1[30] = "", opt_com2[30] = "";
     6.8 +char opt_com1[30] = "", opt_com2[30] = "";
     6.9  string_param("com1", opt_com1);
    6.10  string_param("com2", opt_com2);
    6.11  
     7.1 --- a/xen/include/asm-ia64/config.h	Fri Jun 03 16:39:51 2005 +0000
     7.2 +++ b/xen/include/asm-ia64/config.h	Fri Jun 03 22:18:11 2005 +0000
     7.3 @@ -18,6 +18,8 @@
     7.4  #define	CONFIG_IA64_PAGE_SIZE_16KB	// 4KB doesn't work?!?
     7.5  #define	CONFIG_IA64_GRANULE_16MB
     7.6  
     7.7 +#define CONFIG_EFI_PCDP
     7.8 +
     7.9  #ifndef __ASSEMBLY__
    7.10  
    7.11  // can't find where this typedef was before?!?