ia64/xen-unstable

view xen/arch/ia64/xen/pcdp.c @ 9768:63af1c14fa18

[IA64] missed chunk of Kevin's hypercall cleanup patch

Missed this chunk of Kevin's patch when merging with dom0vp changes

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author awilliam@xenbuild.aw
date Tue Apr 25 22:30:07 2006 -0600 (2006-04-25)
parents 0b0be946cf9c
children cf4a70ab3f59
line source
1 /*
2 * Parse the EFI PCDP table to locate the console device.
3 *
4 * (c) Copyright 2002, 2003, 2004 Hewlett-Packard Development Company, L.P.
5 * Khalid Aziz <khalid.aziz@hp.com>
6 * Alex Williamson <alex.williamson@hp.com>
7 * Bjorn Helgaas <bjorn.helgaas@hp.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
14 #include <linux/acpi.h>
15 #include <linux/console.h>
16 #include <linux/efi.h>
17 #include <linux/serial.h>
18 #ifdef XEN
19 #include <linux/errno.h>
20 #endif
21 #include "pcdp.h"
23 static int __init
24 setup_serial_console(struct pcdp_uart *uart)
25 {
26 #ifdef XEN
27 extern struct ns16550_defaults ns16550_com1;
28 ns16550_com1.baud = uart->baud;
29 ns16550_com1.io_base = uart->addr.address;
30 if (uart->bits)
31 ns16550_com1.data_bits = uart->bits;
32 return 0;
33 #else
34 #ifdef CONFIG_SERIAL_8250_CONSOLE
35 int mmio;
36 static char options[64];
38 mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY);
39 snprintf(options, sizeof(options), "console=uart,%s,0x%lx,%lun%d",
40 mmio ? "mmio" : "io", uart->addr.address, uart->baud,
41 uart->bits ? uart->bits : 8);
43 return early_serial_console_init(options);
44 #else
45 return -ENODEV;
46 #endif
47 #endif
48 }
50 #ifndef XEN
51 static int __init
52 setup_vga_console(struct pcdp_vga *vga)
53 {
54 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
55 if (efi_mem_type(0xA0000) == EFI_CONVENTIONAL_MEMORY) {
56 printk(KERN_ERR "PCDP: VGA selected, but frame buffer is not MMIO!\n");
57 return -ENODEV;
58 }
60 conswitchp = &vga_con;
61 printk(KERN_INFO "PCDP: VGA console\n");
62 return 0;
63 #else
64 return -ENODEV;
65 #endif
66 }
67 #endif
69 int __init
70 efi_setup_pcdp_console(char *cmdline)
71 {
72 struct pcdp *pcdp;
73 struct pcdp_uart *uart;
74 #ifndef XEN
75 struct pcdp_device *dev, *end;
76 #endif
77 int i, serial = 0;
79 pcdp = efi.hcdp;
80 if (!pcdp)
81 return -ENODEV;
83 #ifndef XEN
84 printk(KERN_INFO "PCDP: v%d at 0x%lx\n", pcdp->rev, __pa(pcdp));
85 #endif
87 if (strstr(cmdline, "console=hcdp")) {
88 if (pcdp->rev < 3)
89 serial = 1;
90 } else if (strstr(cmdline, "console=")) {
91 #ifndef XEN
92 printk(KERN_INFO "Explicit \"console=\"; ignoring PCDP\n");
93 #endif
94 return -ENODEV;
95 }
97 if (pcdp->rev < 3 && efi_uart_console_only())
98 serial = 1;
100 for (i = 0, uart = pcdp->uart; i < pcdp->num_uarts; i++, uart++) {
101 if (uart->flags & PCDP_UART_PRIMARY_CONSOLE || serial) {
102 if (uart->type == PCDP_CONSOLE_UART) {
103 return setup_serial_console(uart);
104 }
105 }
106 }
108 #ifndef XEN
109 end = (struct pcdp_device *) ((u8 *) pcdp + pcdp->length);
110 for (dev = (struct pcdp_device *) (pcdp->uart + pcdp->num_uarts);
111 dev < end;
112 dev = (struct pcdp_device *) ((u8 *) dev + dev->length)) {
113 if (dev->flags & PCDP_PRIMARY_CONSOLE) {
114 if (dev->type == PCDP_CONSOLE_VGA) {
115 return setup_vga_console((struct pcdp_vga *) dev);
116 }
117 }
118 }
119 #endif
121 return -ENODEV;
122 }