2 * Parse the EFI PCDP table to locate the console device.
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>
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.
14 #include <linux/acpi.h>
15 #include <linux/console.h>
16 #include <linux/efi.h>
17 #include <linux/serial.h>
21 setup_serial_console(struct pcdp_uart *uart)
23 #ifdef CONFIG_SERIAL_8250_CONSOLE
25 static char options[64];
27 mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY);
28 snprintf(options, sizeof(options), "console=uart,%s,0x%lx,%lun%d",
29 mmio ? "mmio" : "io", uart->addr.address, uart->baud,
30 uart->bits ? uart->bits : 8);
32 return early_serial_console_init(options);
39 setup_vga_console(struct pcdp_vga *vga)
41 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
42 if (efi_mem_type(0xA0000) == EFI_CONVENTIONAL_MEMORY) {
43 printk(KERN_ERR "PCDP: VGA selected, but frame buffer is not MMIO!\n");
47 conswitchp = &vga_con;
48 printk(KERN_INFO "PCDP: VGA console\n");
56 efi_setup_pcdp_console(char *cmdline)
59 struct pcdp_uart *uart;
60 struct pcdp_device *dev, *end;
67 printk(KERN_INFO "PCDP: v%d at 0x%lx\n", pcdp->rev, __pa(pcdp));
69 if (strstr(cmdline, "console=hcdp")) {
72 } else if (strstr(cmdline, "console=")) {
73 printk(KERN_INFO "Explicit \"console=\"; ignoring PCDP\n");
77 if (pcdp->rev < 3 && efi_uart_console_only())
80 for (i = 0, uart = pcdp->uart; i < pcdp->num_uarts; i++, uart++) {
81 if (uart->flags & PCDP_UART_PRIMARY_CONSOLE || serial) {
82 if (uart->type == PCDP_CONSOLE_UART) {
83 return setup_serial_console(uart);
88 end = (struct pcdp_device *) ((u8 *) pcdp + pcdp->length);
89 for (dev = (struct pcdp_device *) (pcdp->uart + pcdp->num_uarts);
91 dev = (struct pcdp_device *) ((u8 *) dev + dev->length)) {
92 if (dev->flags & PCDP_PRIMARY_CONSOLE) {
93 if (dev->type == PCDP_CONSOLE_VGA) {
94 return setup_vga_console((struct pcdp_vga *) dev);
102 #ifdef CONFIG_IA64_EARLY_PRINTK_UART
104 hcdp_early_uart (void)
106 efi_system_table_t *systab;
107 efi_config_table_t *config_tables;
108 unsigned long addr = 0;
109 struct pcdp *pcdp = 0;
110 struct pcdp_uart *uart;
113 systab = (efi_system_table_t *) ia64_boot_param->efi_systab;
116 systab = __va(systab);
118 config_tables = (efi_config_table_t *) systab->tables;
121 config_tables = __va(config_tables);
123 for (i = 0; i < systab->nr_tables; i++) {
124 if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) {
125 pcdp = (struct pcdp *) config_tables[i].table;
133 for (i = 0, uart = pcdp->uart; i < pcdp->num_uarts; i++, uart++) {
134 if (uart->type == PCDP_CONSOLE_UART) {
135 addr = uart->addr.address;
141 #endif /* CONFIG_IA64_EARLY_PRINTK_UART */