[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [IA64] SN2 polling console driver
# HG changeset patch # User Alex Williamson <alex.williamson@xxxxxx> # Date 1180037638 21600 # Node ID 40542d29da2bda69fb3ed17b303e01d723b0aa9a # Parent 03e04b861d91b78fbbf392b118dabfbbd61fe75f [IA64] SN2 polling console driver First cut of super simple console driver with polled input support. In addition switch driver to use ia64_sn_console_putb() post-boot to get interactive response. Signed-off-by: Jes Sorensen <jes@xxxxxxx> --- xen/arch/ia64/xen/sn_console.c | 74 ++++++++++++++++++++++++++++++++++++++--- 1 files changed, 69 insertions(+), 5 deletions(-) diff -r 03e04b861d91 -r 40542d29da2b xen/arch/ia64/xen/sn_console.c --- a/xen/arch/ia64/xen/sn_console.c Wed May 23 10:40:19 2007 -0600 +++ b/xen/arch/ia64/xen/sn_console.c Thu May 24 14:13:58 2007 -0600 @@ -8,18 +8,83 @@ #include <asm/acpi.h> #include <asm/sn/sn_sal.h> #include <xen/serial.h> +#include <xen/sched.h> + +struct sn_console_data { + struct timer timer; + unsigned int timeout_ms; + int booted; +}; + +static struct sn_console_data console_data = { + .timeout_ms = 8 * 16 * 1000 / 9600, +}; + /* * sn_putc - Send a character to the console, polled or interrupt mode */ static void sn_putc(struct serial_port *port, char c) { - ia64_sn_console_putc(c); + struct sn_console_data *sndata = port->uart; + + if (sndata->booted) + ia64_sn_console_putb(&c, 1); + else + ia64_sn_console_putc(c); } +/* + * sn_getc - Get a character from the console, polled or interrupt mode + */ +static int sn_getc(struct serial_port *port, char *pc) +{ + int ch; + + ia64_sn_console_getc(&ch); + *pc = ch & 0xff; + return 1; +} + +static void sn_endboot(struct serial_port *port) +{ + struct sn_console_data *sndata = port->uart; + + sndata->booted = 1; +} + + +static void sn_poll(void *data) +{ + int ch, status; + struct serial_port *port = data; + struct sn_console_data *sndata = port->uart; + struct cpu_user_regs *regs = guest_cpu_user_regs(); + + status = ia64_sn_console_check(&ch); + if (!status && ch) { + serial_rx_interrupt(port, regs); + } + set_timer(&sndata->timer, NOW() + MILLISECS(sndata->timeout_ms)); +} + + +static void sn_init_postirq(struct serial_port *port) +{ + struct sn_console_data *sndata = port->uart; + + init_timer(&sndata->timer, sn_poll, port, 0); + set_timer(&sndata->timer, NOW() + MILLISECS(console_data.timeout_ms)); +} + + static struct uart_driver sn_sal_console = { + .init_postirq = sn_init_postirq, .putc = sn_putc, + .getc = sn_getc, + .endboot = sn_endboot, }; + /** * early_sn_setup - early setup routine for SN platforms @@ -45,8 +110,7 @@ static void __init early_sn_setup(void) efi_systab = (efi_system_table_t *) __va(ia64_boot_param->efi_systab); config_tables = __va(efi_systab->tables); for (i = 0; i < efi_systab->nr_tables; i++) { - if (efi_guidcmp(config_tables[i].guid, SAL_SYSTEM_TABLE_GUID) == - 0) { + if (!efi_guidcmp(config_tables[i].guid, SAL_SYSTEM_TABLE_GUID)) { sal_systab = __va(config_tables[i].table); p = (char *)(sal_systab + 1); for (j = 0; j < sal_systab->entry_count; j++) { @@ -73,11 +137,11 @@ static void __init early_sn_setup(void) */ int __init sn_serial_console_early_setup(void) { - if (strcmp("sn2",acpi_get_sysname())) + if (strcmp("sn2", acpi_get_sysname())) return -1; early_sn_setup(); /* Find SAL entry points */ - serial_register_uart(0, &sn_sal_console, NULL); + serial_register_uart(0, &sn_sal_console, &console_data); return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |