[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Add EFI PCDP support to automatically find console



ChangeSet 1.1667, 2005/06/03 16:18:11-06:00, djm@xxxxxxxxxxxxxxx

        Add EFI PCDP support to automatically find console
        Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxx>
        



 arch/ia64/Makefile          |    2 
 arch/ia64/pcdp.c            |  120 ++++++++++++++++++++++++++++++++++++++++++++
 arch/ia64/tools/mkbuildtree |    2 
 arch/ia64/xensetup.c        |    5 +
 drivers/char/ns16550.c      |    2 
 include/asm-ia64/config.h   |    2 
 6 files changed, 130 insertions(+), 3 deletions(-)


diff -Nru a/xen/arch/ia64/Makefile b/xen/arch/ia64/Makefile
--- a/xen/arch/ia64/Makefile    2005-06-04 12:02:20 -04:00
+++ b/xen/arch/ia64/Makefile    2005-06-04 12:02:20 -04:00
@@ -4,7 +4,7 @@
 
 OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \
        xenmisc.o pdb-stub.o acpi.o hypercall.o \
-       machvec.o dom0_ops.o domain.o hpsimserial.o \
+       machvec.o dom0_ops.o domain.o hpsimserial.o pcdp.o \
        idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \
        xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \
        extable.o linuxextable.o xenirq.o xentime.o \
diff -Nru a/xen/arch/ia64/pcdp.c b/xen/arch/ia64/pcdp.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/xen/arch/ia64/pcdp.c      2005-06-04 12:02:20 -04:00
@@ -0,0 +1,120 @@
+/*
+ * Parse the EFI PCDP table to locate the console device.
+ *
+ * (c) Copyright 2002, 2003, 2004 Hewlett-Packard Development Company, L.P.
+ *     Khalid Aziz <khalid.aziz@xxxxxx>
+ *     Alex Williamson <alex.williamson@xxxxxx>
+ *     Bjorn Helgaas <bjorn.helgaas@xxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/console.h>
+#include <linux/efi.h>
+#include <linux/serial.h>
+#ifdef XEN
+#include <linux/errno.h>
+#endif
+#include "pcdp.h"
+
+static int __init
+setup_serial_console(struct pcdp_uart *uart)
+{
+#ifdef XEN
+       extern char opt_com1[1];
+       if (opt_com1[0]) return 0;
+       sprintf(&opt_com1[0], "0x%lx,%lu,%dn1",
+               uart->addr.address, uart->baud,
+               uart->bits ? uart->bits : 8);
+       return 0;
+#else
+#ifdef CONFIG_SERIAL_8250_CONSOLE
+       int mmio;
+       static char options[64];
+
+       mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY);
+       snprintf(options, sizeof(options), "console=uart,%s,0x%lx,%lun%d",
+               mmio ? "mmio" : "io", uart->addr.address, uart->baud,
+               uart->bits ? uart->bits : 8);
+
+       return early_serial_console_init(options);
+#else
+       return -ENODEV;
+#endif
+#endif
+}
+
+#ifndef XEN
+static int __init
+setup_vga_console(struct pcdp_vga *vga)
+{
+#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
+       if (efi_mem_type(0xA0000) == EFI_CONVENTIONAL_MEMORY) {
+               printk(KERN_ERR "PCDP: VGA selected, but frame buffer is not 
MMIO!\n");
+               return -ENODEV;
+       }
+
+       conswitchp = &vga_con;
+       printk(KERN_INFO "PCDP: VGA console\n");
+       return 0;
+#else
+       return -ENODEV;
+#endif
+}
+#endif
+
+int __init
+efi_setup_pcdp_console(char *cmdline)
+{
+       struct pcdp *pcdp;
+       struct pcdp_uart *uart;
+       struct pcdp_device *dev, *end;
+       int i, serial = 0;
+
+       pcdp = efi.hcdp;
+       if (!pcdp)
+               return -ENODEV;
+
+#ifndef XEN
+       printk(KERN_INFO "PCDP: v%d at 0x%lx\n", pcdp->rev, __pa(pcdp));
+#endif
+
+       if (strstr(cmdline, "console=hcdp")) {
+               if (pcdp->rev < 3)
+                       serial = 1;
+       } else if (strstr(cmdline, "console=")) {
+#ifndef XEN
+               printk(KERN_INFO "Explicit \"console=\"; ignoring PCDP\n");
+#endif
+               return -ENODEV;
+       }
+
+       if (pcdp->rev < 3 && efi_uart_console_only())
+               serial = 1;
+
+       for (i = 0, uart = pcdp->uart; i < pcdp->num_uarts; i++, uart++) {
+               if (uart->flags & PCDP_UART_PRIMARY_CONSOLE || serial) {
+                       if (uart->type == PCDP_CONSOLE_UART) {
+                               return setup_serial_console(uart);
+                       }
+               }
+       }
+
+#ifndef XEN
+       end = (struct pcdp_device *) ((u8 *) pcdp + pcdp->length);
+       for (dev = (struct pcdp_device *) (pcdp->uart + pcdp->num_uarts);
+            dev < end;
+            dev = (struct pcdp_device *) ((u8 *) dev + dev->length)) {
+               if (dev->flags & PCDP_PRIMARY_CONSOLE) {
+                       if (dev->type == PCDP_CONSOLE_VGA) {
+                               return setup_vga_console((struct pcdp_vga *) 
dev);
+                       }
+               }
+       }
+#endif
+
+       return -ENODEV;
+}
diff -Nru a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree
--- a/xen/arch/ia64/tools/mkbuildtree   2005-06-04 12:02:20 -04:00
+++ b/xen/arch/ia64/tools/mkbuildtree   2005-06-04 12:02:20 -04:00
@@ -309,6 +309,8 @@
 softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h
 softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
 
+softlink drivers/firmware/pcdp.h arch/ia64/pcdp.h
+
 null include/asm-ia64/linux/file.h
 null include/asm-ia64/linux/module.h
 null include/asm-ia64/linux/swap.h
diff -Nru a/xen/arch/ia64/xensetup.c b/xen/arch/ia64/xensetup.c
--- a/xen/arch/ia64/xensetup.c  2005-06-04 12:02:20 -04:00
+++ b/xen/arch/ia64/xensetup.c  2005-06-04 12:02:20 -04:00
@@ -107,12 +107,15 @@
  *     "com2=57600,8n1 console=com2 -- console=ttyS1 console=tty
  * root=/dev/sda3 ro"
  */
+static char null[4] = { 0 };
+
 void early_cmdline_parse(char **cmdline_p)
 {
     char *guest_cmd;
     char *split = "--";
 
     if (*cmdline_p == NULL) {
+       *cmdline_p = &null[0];
        saved_command_line[0] = '\0';
        return;
     }
@@ -121,7 +124,7 @@
     /* If no spliter, whole line is for guest */
     if (guest_cmd == NULL) {
        guest_cmd = *cmdline_p;
-       *cmdline_p = NULL;
+       *cmdline_p = &null[0];
     } else {
        *guest_cmd = '\0';      /* Split boot parameters for xen and guest */
        guest_cmd += strlen(split);
diff -Nru a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
--- a/xen/drivers/char/ns16550.c        2005-06-04 12:02:20 -04:00
+++ b/xen/drivers/char/ns16550.c        2005-06-04 12:02:20 -04:00
@@ -16,7 +16,7 @@
 #include <asm/io.h>
 
 /* Config serial port with a string <baud>,DPS,<io-base>,<irq>. */
-static char opt_com1[30] = "", opt_com2[30] = "";
+char opt_com1[30] = "", opt_com2[30] = "";
 string_param("com1", opt_com1);
 string_param("com2", opt_com2);
 
diff -Nru a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h     2005-06-04 12:02:20 -04:00
+++ b/xen/include/asm-ia64/config.h     2005-06-04 12:02:20 -04:00
@@ -18,6 +18,8 @@
 #define        CONFIG_IA64_PAGE_SIZE_16KB      // 4KB doesn't work?!?
 #define        CONFIG_IA64_GRANULE_16MB
 
+#define CONFIG_EFI_PCDP
+
 #ifndef __ASSEMBLY__
 
 // can't find where this typedef was before?!?

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.