1*ab4382d2SGreg Kroah-Hartman /* sunhv.c: Serial driver for SUN4V hypervisor console. 2*ab4382d2SGreg Kroah-Hartman * 3*ab4382d2SGreg Kroah-Hartman * Copyright (C) 2006, 2007 David S. Miller (davem@davemloft.net) 4*ab4382d2SGreg Kroah-Hartman */ 5*ab4382d2SGreg Kroah-Hartman 6*ab4382d2SGreg Kroah-Hartman #include <linux/module.h> 7*ab4382d2SGreg Kroah-Hartman #include <linux/kernel.h> 8*ab4382d2SGreg Kroah-Hartman #include <linux/errno.h> 9*ab4382d2SGreg Kroah-Hartman #include <linux/tty.h> 10*ab4382d2SGreg Kroah-Hartman #include <linux/tty_flip.h> 11*ab4382d2SGreg Kroah-Hartman #include <linux/major.h> 12*ab4382d2SGreg Kroah-Hartman #include <linux/circ_buf.h> 13*ab4382d2SGreg Kroah-Hartman #include <linux/serial.h> 14*ab4382d2SGreg Kroah-Hartman #include <linux/sysrq.h> 15*ab4382d2SGreg Kroah-Hartman #include <linux/console.h> 16*ab4382d2SGreg Kroah-Hartman #include <linux/spinlock.h> 17*ab4382d2SGreg Kroah-Hartman #include <linux/slab.h> 18*ab4382d2SGreg Kroah-Hartman #include <linux/delay.h> 19*ab4382d2SGreg Kroah-Hartman #include <linux/init.h> 20*ab4382d2SGreg Kroah-Hartman #include <linux/of_device.h> 21*ab4382d2SGreg Kroah-Hartman 22*ab4382d2SGreg Kroah-Hartman #include <asm/hypervisor.h> 23*ab4382d2SGreg Kroah-Hartman #include <asm/spitfire.h> 24*ab4382d2SGreg Kroah-Hartman #include <asm/prom.h> 25*ab4382d2SGreg Kroah-Hartman #include <asm/irq.h> 26*ab4382d2SGreg Kroah-Hartman 27*ab4382d2SGreg Kroah-Hartman #if defined(CONFIG_MAGIC_SYSRQ) 28*ab4382d2SGreg Kroah-Hartman #define SUPPORT_SYSRQ 29*ab4382d2SGreg Kroah-Hartman #endif 30*ab4382d2SGreg Kroah-Hartman 31*ab4382d2SGreg Kroah-Hartman #include <linux/serial_core.h> 32*ab4382d2SGreg Kroah-Hartman 33*ab4382d2SGreg Kroah-Hartman #include "suncore.h" 34*ab4382d2SGreg Kroah-Hartman 35*ab4382d2SGreg Kroah-Hartman #define CON_BREAK ((long)-1) 36*ab4382d2SGreg Kroah-Hartman #define CON_HUP ((long)-2) 37*ab4382d2SGreg Kroah-Hartman 38*ab4382d2SGreg Kroah-Hartman #define IGNORE_BREAK 0x1 39*ab4382d2SGreg Kroah-Hartman #define IGNORE_ALL 0x2 40*ab4382d2SGreg Kroah-Hartman 41*ab4382d2SGreg Kroah-Hartman static char *con_write_page; 42*ab4382d2SGreg Kroah-Hartman static char *con_read_page; 43*ab4382d2SGreg Kroah-Hartman 44*ab4382d2SGreg Kroah-Hartman static int hung_up = 0; 45*ab4382d2SGreg Kroah-Hartman 46*ab4382d2SGreg Kroah-Hartman static void transmit_chars_putchar(struct uart_port *port, struct circ_buf *xmit) 47*ab4382d2SGreg Kroah-Hartman { 48*ab4382d2SGreg Kroah-Hartman while (!uart_circ_empty(xmit)) { 49*ab4382d2SGreg Kroah-Hartman long status = sun4v_con_putchar(xmit->buf[xmit->tail]); 50*ab4382d2SGreg Kroah-Hartman 51*ab4382d2SGreg Kroah-Hartman if (status != HV_EOK) 52*ab4382d2SGreg Kroah-Hartman break; 53*ab4382d2SGreg Kroah-Hartman 54*ab4382d2SGreg Kroah-Hartman xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 55*ab4382d2SGreg Kroah-Hartman port->icount.tx++; 56*ab4382d2SGreg Kroah-Hartman } 57*ab4382d2SGreg Kroah-Hartman } 58*ab4382d2SGreg Kroah-Hartman 59*ab4382d2SGreg Kroah-Hartman static void transmit_chars_write(struct uart_port *port, struct circ_buf *xmit) 60*ab4382d2SGreg Kroah-Hartman { 61*ab4382d2SGreg Kroah-Hartman while (!uart_circ_empty(xmit)) { 62*ab4382d2SGreg Kroah-Hartman unsigned long ra = __pa(xmit->buf + xmit->tail); 63*ab4382d2SGreg Kroah-Hartman unsigned long len, status, sent; 64*ab4382d2SGreg Kroah-Hartman 65*ab4382d2SGreg Kroah-Hartman len = CIRC_CNT_TO_END(xmit->head, xmit->tail, 66*ab4382d2SGreg Kroah-Hartman UART_XMIT_SIZE); 67*ab4382d2SGreg Kroah-Hartman status = sun4v_con_write(ra, len, &sent); 68*ab4382d2SGreg Kroah-Hartman if (status != HV_EOK) 69*ab4382d2SGreg Kroah-Hartman break; 70*ab4382d2SGreg Kroah-Hartman xmit->tail = (xmit->tail + sent) & (UART_XMIT_SIZE - 1); 71*ab4382d2SGreg Kroah-Hartman port->icount.tx += sent; 72*ab4382d2SGreg Kroah-Hartman } 73*ab4382d2SGreg Kroah-Hartman } 74*ab4382d2SGreg Kroah-Hartman 75*ab4382d2SGreg Kroah-Hartman static int receive_chars_getchar(struct uart_port *port, struct tty_struct *tty) 76*ab4382d2SGreg Kroah-Hartman { 77*ab4382d2SGreg Kroah-Hartman int saw_console_brk = 0; 78*ab4382d2SGreg Kroah-Hartman int limit = 10000; 79*ab4382d2SGreg Kroah-Hartman 80*ab4382d2SGreg Kroah-Hartman while (limit-- > 0) { 81*ab4382d2SGreg Kroah-Hartman long status; 82*ab4382d2SGreg Kroah-Hartman long c = sun4v_con_getchar(&status); 83*ab4382d2SGreg Kroah-Hartman 84*ab4382d2SGreg Kroah-Hartman if (status == HV_EWOULDBLOCK) 85*ab4382d2SGreg Kroah-Hartman break; 86*ab4382d2SGreg Kroah-Hartman 87*ab4382d2SGreg Kroah-Hartman if (c == CON_BREAK) { 88*ab4382d2SGreg Kroah-Hartman if (uart_handle_break(port)) 89*ab4382d2SGreg Kroah-Hartman continue; 90*ab4382d2SGreg Kroah-Hartman saw_console_brk = 1; 91*ab4382d2SGreg Kroah-Hartman c = 0; 92*ab4382d2SGreg Kroah-Hartman } 93*ab4382d2SGreg Kroah-Hartman 94*ab4382d2SGreg Kroah-Hartman if (c == CON_HUP) { 95*ab4382d2SGreg Kroah-Hartman hung_up = 1; 96*ab4382d2SGreg Kroah-Hartman uart_handle_dcd_change(port, 0); 97*ab4382d2SGreg Kroah-Hartman } else if (hung_up) { 98*ab4382d2SGreg Kroah-Hartman hung_up = 0; 99*ab4382d2SGreg Kroah-Hartman uart_handle_dcd_change(port, 1); 100*ab4382d2SGreg Kroah-Hartman } 101*ab4382d2SGreg Kroah-Hartman 102*ab4382d2SGreg Kroah-Hartman if (tty == NULL) { 103*ab4382d2SGreg Kroah-Hartman uart_handle_sysrq_char(port, c); 104*ab4382d2SGreg Kroah-Hartman continue; 105*ab4382d2SGreg Kroah-Hartman } 106*ab4382d2SGreg Kroah-Hartman 107*ab4382d2SGreg Kroah-Hartman port->icount.rx++; 108*ab4382d2SGreg Kroah-Hartman 109*ab4382d2SGreg Kroah-Hartman if (uart_handle_sysrq_char(port, c)) 110*ab4382d2SGreg Kroah-Hartman continue; 111*ab4382d2SGreg Kroah-Hartman 112*ab4382d2SGreg Kroah-Hartman tty_insert_flip_char(tty, c, TTY_NORMAL); 113*ab4382d2SGreg Kroah-Hartman } 114*ab4382d2SGreg Kroah-Hartman 115*ab4382d2SGreg Kroah-Hartman return saw_console_brk; 116*ab4382d2SGreg Kroah-Hartman } 117*ab4382d2SGreg Kroah-Hartman 118*ab4382d2SGreg Kroah-Hartman static int receive_chars_read(struct uart_port *port, struct tty_struct *tty) 119*ab4382d2SGreg Kroah-Hartman { 120*ab4382d2SGreg Kroah-Hartman int saw_console_brk = 0; 121*ab4382d2SGreg Kroah-Hartman int limit = 10000; 122*ab4382d2SGreg Kroah-Hartman 123*ab4382d2SGreg Kroah-Hartman while (limit-- > 0) { 124*ab4382d2SGreg Kroah-Hartman unsigned long ra = __pa(con_read_page); 125*ab4382d2SGreg Kroah-Hartman unsigned long bytes_read, i; 126*ab4382d2SGreg Kroah-Hartman long stat = sun4v_con_read(ra, PAGE_SIZE, &bytes_read); 127*ab4382d2SGreg Kroah-Hartman 128*ab4382d2SGreg Kroah-Hartman if (stat != HV_EOK) { 129*ab4382d2SGreg Kroah-Hartman bytes_read = 0; 130*ab4382d2SGreg Kroah-Hartman 131*ab4382d2SGreg Kroah-Hartman if (stat == CON_BREAK) { 132*ab4382d2SGreg Kroah-Hartman if (uart_handle_break(port)) 133*ab4382d2SGreg Kroah-Hartman continue; 134*ab4382d2SGreg Kroah-Hartman saw_console_brk = 1; 135*ab4382d2SGreg Kroah-Hartman *con_read_page = 0; 136*ab4382d2SGreg Kroah-Hartman bytes_read = 1; 137*ab4382d2SGreg Kroah-Hartman } else if (stat == CON_HUP) { 138*ab4382d2SGreg Kroah-Hartman hung_up = 1; 139*ab4382d2SGreg Kroah-Hartman uart_handle_dcd_change(port, 0); 140*ab4382d2SGreg Kroah-Hartman continue; 141*ab4382d2SGreg Kroah-Hartman } else { 142*ab4382d2SGreg Kroah-Hartman /* HV_EWOULDBLOCK, etc. */ 143*ab4382d2SGreg Kroah-Hartman break; 144*ab4382d2SGreg Kroah-Hartman } 145*ab4382d2SGreg Kroah-Hartman } 146*ab4382d2SGreg Kroah-Hartman 147*ab4382d2SGreg Kroah-Hartman if (hung_up) { 148*ab4382d2SGreg Kroah-Hartman hung_up = 0; 149*ab4382d2SGreg Kroah-Hartman uart_handle_dcd_change(port, 1); 150*ab4382d2SGreg Kroah-Hartman } 151*ab4382d2SGreg Kroah-Hartman 152*ab4382d2SGreg Kroah-Hartman for (i = 0; i < bytes_read; i++) 153*ab4382d2SGreg Kroah-Hartman uart_handle_sysrq_char(port, con_read_page[i]); 154*ab4382d2SGreg Kroah-Hartman 155*ab4382d2SGreg Kroah-Hartman if (tty == NULL) 156*ab4382d2SGreg Kroah-Hartman continue; 157*ab4382d2SGreg Kroah-Hartman 158*ab4382d2SGreg Kroah-Hartman port->icount.rx += bytes_read; 159*ab4382d2SGreg Kroah-Hartman 160*ab4382d2SGreg Kroah-Hartman tty_insert_flip_string(tty, con_read_page, bytes_read); 161*ab4382d2SGreg Kroah-Hartman } 162*ab4382d2SGreg Kroah-Hartman 163*ab4382d2SGreg Kroah-Hartman return saw_console_brk; 164*ab4382d2SGreg Kroah-Hartman } 165*ab4382d2SGreg Kroah-Hartman 166*ab4382d2SGreg Kroah-Hartman struct sunhv_ops { 167*ab4382d2SGreg Kroah-Hartman void (*transmit_chars)(struct uart_port *port, struct circ_buf *xmit); 168*ab4382d2SGreg Kroah-Hartman int (*receive_chars)(struct uart_port *port, struct tty_struct *tty); 169*ab4382d2SGreg Kroah-Hartman }; 170*ab4382d2SGreg Kroah-Hartman 171*ab4382d2SGreg Kroah-Hartman static struct sunhv_ops bychar_ops = { 172*ab4382d2SGreg Kroah-Hartman .transmit_chars = transmit_chars_putchar, 173*ab4382d2SGreg Kroah-Hartman .receive_chars = receive_chars_getchar, 174*ab4382d2SGreg Kroah-Hartman }; 175*ab4382d2SGreg Kroah-Hartman 176*ab4382d2SGreg Kroah-Hartman static struct sunhv_ops bywrite_ops = { 177*ab4382d2SGreg Kroah-Hartman .transmit_chars = transmit_chars_write, 178*ab4382d2SGreg Kroah-Hartman .receive_chars = receive_chars_read, 179*ab4382d2SGreg Kroah-Hartman }; 180*ab4382d2SGreg Kroah-Hartman 181*ab4382d2SGreg Kroah-Hartman static struct sunhv_ops *sunhv_ops = &bychar_ops; 182*ab4382d2SGreg Kroah-Hartman 183*ab4382d2SGreg Kroah-Hartman static struct tty_struct *receive_chars(struct uart_port *port) 184*ab4382d2SGreg Kroah-Hartman { 185*ab4382d2SGreg Kroah-Hartman struct tty_struct *tty = NULL; 186*ab4382d2SGreg Kroah-Hartman 187*ab4382d2SGreg Kroah-Hartman if (port->state != NULL) /* Unopened serial console */ 188*ab4382d2SGreg Kroah-Hartman tty = port->state->port.tty; 189*ab4382d2SGreg Kroah-Hartman 190*ab4382d2SGreg Kroah-Hartman if (sunhv_ops->receive_chars(port, tty)) 191*ab4382d2SGreg Kroah-Hartman sun_do_break(); 192*ab4382d2SGreg Kroah-Hartman 193*ab4382d2SGreg Kroah-Hartman return tty; 194*ab4382d2SGreg Kroah-Hartman } 195*ab4382d2SGreg Kroah-Hartman 196*ab4382d2SGreg Kroah-Hartman static void transmit_chars(struct uart_port *port) 197*ab4382d2SGreg Kroah-Hartman { 198*ab4382d2SGreg Kroah-Hartman struct circ_buf *xmit; 199*ab4382d2SGreg Kroah-Hartman 200*ab4382d2SGreg Kroah-Hartman if (!port->state) 201*ab4382d2SGreg Kroah-Hartman return; 202*ab4382d2SGreg Kroah-Hartman 203*ab4382d2SGreg Kroah-Hartman xmit = &port->state->xmit; 204*ab4382d2SGreg Kroah-Hartman if (uart_circ_empty(xmit) || uart_tx_stopped(port)) 205*ab4382d2SGreg Kroah-Hartman return; 206*ab4382d2SGreg Kroah-Hartman 207*ab4382d2SGreg Kroah-Hartman sunhv_ops->transmit_chars(port, xmit); 208*ab4382d2SGreg Kroah-Hartman 209*ab4382d2SGreg Kroah-Hartman if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 210*ab4382d2SGreg Kroah-Hartman uart_write_wakeup(port); 211*ab4382d2SGreg Kroah-Hartman } 212*ab4382d2SGreg Kroah-Hartman 213*ab4382d2SGreg Kroah-Hartman static irqreturn_t sunhv_interrupt(int irq, void *dev_id) 214*ab4382d2SGreg Kroah-Hartman { 215*ab4382d2SGreg Kroah-Hartman struct uart_port *port = dev_id; 216*ab4382d2SGreg Kroah-Hartman struct tty_struct *tty; 217*ab4382d2SGreg Kroah-Hartman unsigned long flags; 218*ab4382d2SGreg Kroah-Hartman 219*ab4382d2SGreg Kroah-Hartman spin_lock_irqsave(&port->lock, flags); 220*ab4382d2SGreg Kroah-Hartman tty = receive_chars(port); 221*ab4382d2SGreg Kroah-Hartman transmit_chars(port); 222*ab4382d2SGreg Kroah-Hartman spin_unlock_irqrestore(&port->lock, flags); 223*ab4382d2SGreg Kroah-Hartman 224*ab4382d2SGreg Kroah-Hartman if (tty) 225*ab4382d2SGreg Kroah-Hartman tty_flip_buffer_push(tty); 226*ab4382d2SGreg Kroah-Hartman 227*ab4382d2SGreg Kroah-Hartman return IRQ_HANDLED; 228*ab4382d2SGreg Kroah-Hartman } 229*ab4382d2SGreg Kroah-Hartman 230*ab4382d2SGreg Kroah-Hartman /* port->lock is not held. */ 231*ab4382d2SGreg Kroah-Hartman static unsigned int sunhv_tx_empty(struct uart_port *port) 232*ab4382d2SGreg Kroah-Hartman { 233*ab4382d2SGreg Kroah-Hartman /* Transmitter is always empty for us. If the circ buffer 234*ab4382d2SGreg Kroah-Hartman * is non-empty or there is an x_char pending, our caller 235*ab4382d2SGreg Kroah-Hartman * will do the right thing and ignore what we return here. 236*ab4382d2SGreg Kroah-Hartman */ 237*ab4382d2SGreg Kroah-Hartman return TIOCSER_TEMT; 238*ab4382d2SGreg Kroah-Hartman } 239*ab4382d2SGreg Kroah-Hartman 240*ab4382d2SGreg Kroah-Hartman /* port->lock held by caller. */ 241*ab4382d2SGreg Kroah-Hartman static void sunhv_set_mctrl(struct uart_port *port, unsigned int mctrl) 242*ab4382d2SGreg Kroah-Hartman { 243*ab4382d2SGreg Kroah-Hartman return; 244*ab4382d2SGreg Kroah-Hartman } 245*ab4382d2SGreg Kroah-Hartman 246*ab4382d2SGreg Kroah-Hartman /* port->lock is held by caller and interrupts are disabled. */ 247*ab4382d2SGreg Kroah-Hartman static unsigned int sunhv_get_mctrl(struct uart_port *port) 248*ab4382d2SGreg Kroah-Hartman { 249*ab4382d2SGreg Kroah-Hartman return TIOCM_DSR | TIOCM_CAR | TIOCM_CTS; 250*ab4382d2SGreg Kroah-Hartman } 251*ab4382d2SGreg Kroah-Hartman 252*ab4382d2SGreg Kroah-Hartman /* port->lock held by caller. */ 253*ab4382d2SGreg Kroah-Hartman static void sunhv_stop_tx(struct uart_port *port) 254*ab4382d2SGreg Kroah-Hartman { 255*ab4382d2SGreg Kroah-Hartman return; 256*ab4382d2SGreg Kroah-Hartman } 257*ab4382d2SGreg Kroah-Hartman 258*ab4382d2SGreg Kroah-Hartman /* port->lock held by caller. */ 259*ab4382d2SGreg Kroah-Hartman static void sunhv_start_tx(struct uart_port *port) 260*ab4382d2SGreg Kroah-Hartman { 261*ab4382d2SGreg Kroah-Hartman transmit_chars(port); 262*ab4382d2SGreg Kroah-Hartman } 263*ab4382d2SGreg Kroah-Hartman 264*ab4382d2SGreg Kroah-Hartman /* port->lock is not held. */ 265*ab4382d2SGreg Kroah-Hartman static void sunhv_send_xchar(struct uart_port *port, char ch) 266*ab4382d2SGreg Kroah-Hartman { 267*ab4382d2SGreg Kroah-Hartman unsigned long flags; 268*ab4382d2SGreg Kroah-Hartman int limit = 10000; 269*ab4382d2SGreg Kroah-Hartman 270*ab4382d2SGreg Kroah-Hartman spin_lock_irqsave(&port->lock, flags); 271*ab4382d2SGreg Kroah-Hartman 272*ab4382d2SGreg Kroah-Hartman while (limit-- > 0) { 273*ab4382d2SGreg Kroah-Hartman long status = sun4v_con_putchar(ch); 274*ab4382d2SGreg Kroah-Hartman if (status == HV_EOK) 275*ab4382d2SGreg Kroah-Hartman break; 276*ab4382d2SGreg Kroah-Hartman udelay(1); 277*ab4382d2SGreg Kroah-Hartman } 278*ab4382d2SGreg Kroah-Hartman 279*ab4382d2SGreg Kroah-Hartman spin_unlock_irqrestore(&port->lock, flags); 280*ab4382d2SGreg Kroah-Hartman } 281*ab4382d2SGreg Kroah-Hartman 282*ab4382d2SGreg Kroah-Hartman /* port->lock held by caller. */ 283*ab4382d2SGreg Kroah-Hartman static void sunhv_stop_rx(struct uart_port *port) 284*ab4382d2SGreg Kroah-Hartman { 285*ab4382d2SGreg Kroah-Hartman } 286*ab4382d2SGreg Kroah-Hartman 287*ab4382d2SGreg Kroah-Hartman /* port->lock held by caller. */ 288*ab4382d2SGreg Kroah-Hartman static void sunhv_enable_ms(struct uart_port *port) 289*ab4382d2SGreg Kroah-Hartman { 290*ab4382d2SGreg Kroah-Hartman } 291*ab4382d2SGreg Kroah-Hartman 292*ab4382d2SGreg Kroah-Hartman /* port->lock is not held. */ 293*ab4382d2SGreg Kroah-Hartman static void sunhv_break_ctl(struct uart_port *port, int break_state) 294*ab4382d2SGreg Kroah-Hartman { 295*ab4382d2SGreg Kroah-Hartman if (break_state) { 296*ab4382d2SGreg Kroah-Hartman unsigned long flags; 297*ab4382d2SGreg Kroah-Hartman int limit = 10000; 298*ab4382d2SGreg Kroah-Hartman 299*ab4382d2SGreg Kroah-Hartman spin_lock_irqsave(&port->lock, flags); 300*ab4382d2SGreg Kroah-Hartman 301*ab4382d2SGreg Kroah-Hartman while (limit-- > 0) { 302*ab4382d2SGreg Kroah-Hartman long status = sun4v_con_putchar(CON_BREAK); 303*ab4382d2SGreg Kroah-Hartman if (status == HV_EOK) 304*ab4382d2SGreg Kroah-Hartman break; 305*ab4382d2SGreg Kroah-Hartman udelay(1); 306*ab4382d2SGreg Kroah-Hartman } 307*ab4382d2SGreg Kroah-Hartman 308*ab4382d2SGreg Kroah-Hartman spin_unlock_irqrestore(&port->lock, flags); 309*ab4382d2SGreg Kroah-Hartman } 310*ab4382d2SGreg Kroah-Hartman } 311*ab4382d2SGreg Kroah-Hartman 312*ab4382d2SGreg Kroah-Hartman /* port->lock is not held. */ 313*ab4382d2SGreg Kroah-Hartman static int sunhv_startup(struct uart_port *port) 314*ab4382d2SGreg Kroah-Hartman { 315*ab4382d2SGreg Kroah-Hartman return 0; 316*ab4382d2SGreg Kroah-Hartman } 317*ab4382d2SGreg Kroah-Hartman 318*ab4382d2SGreg Kroah-Hartman /* port->lock is not held. */ 319*ab4382d2SGreg Kroah-Hartman static void sunhv_shutdown(struct uart_port *port) 320*ab4382d2SGreg Kroah-Hartman { 321*ab4382d2SGreg Kroah-Hartman } 322*ab4382d2SGreg Kroah-Hartman 323*ab4382d2SGreg Kroah-Hartman /* port->lock is not held. */ 324*ab4382d2SGreg Kroah-Hartman static void sunhv_set_termios(struct uart_port *port, struct ktermios *termios, 325*ab4382d2SGreg Kroah-Hartman struct ktermios *old) 326*ab4382d2SGreg Kroah-Hartman { 327*ab4382d2SGreg Kroah-Hartman unsigned int baud = uart_get_baud_rate(port, termios, old, 0, 4000000); 328*ab4382d2SGreg Kroah-Hartman unsigned int quot = uart_get_divisor(port, baud); 329*ab4382d2SGreg Kroah-Hartman unsigned int iflag, cflag; 330*ab4382d2SGreg Kroah-Hartman unsigned long flags; 331*ab4382d2SGreg Kroah-Hartman 332*ab4382d2SGreg Kroah-Hartman spin_lock_irqsave(&port->lock, flags); 333*ab4382d2SGreg Kroah-Hartman 334*ab4382d2SGreg Kroah-Hartman iflag = termios->c_iflag; 335*ab4382d2SGreg Kroah-Hartman cflag = termios->c_cflag; 336*ab4382d2SGreg Kroah-Hartman 337*ab4382d2SGreg Kroah-Hartman port->ignore_status_mask = 0; 338*ab4382d2SGreg Kroah-Hartman if (iflag & IGNBRK) 339*ab4382d2SGreg Kroah-Hartman port->ignore_status_mask |= IGNORE_BREAK; 340*ab4382d2SGreg Kroah-Hartman if ((cflag & CREAD) == 0) 341*ab4382d2SGreg Kroah-Hartman port->ignore_status_mask |= IGNORE_ALL; 342*ab4382d2SGreg Kroah-Hartman 343*ab4382d2SGreg Kroah-Hartman /* XXX */ 344*ab4382d2SGreg Kroah-Hartman uart_update_timeout(port, cflag, 345*ab4382d2SGreg Kroah-Hartman (port->uartclk / (16 * quot))); 346*ab4382d2SGreg Kroah-Hartman 347*ab4382d2SGreg Kroah-Hartman spin_unlock_irqrestore(&port->lock, flags); 348*ab4382d2SGreg Kroah-Hartman } 349*ab4382d2SGreg Kroah-Hartman 350*ab4382d2SGreg Kroah-Hartman static const char *sunhv_type(struct uart_port *port) 351*ab4382d2SGreg Kroah-Hartman { 352*ab4382d2SGreg Kroah-Hartman return "SUN4V HCONS"; 353*ab4382d2SGreg Kroah-Hartman } 354*ab4382d2SGreg Kroah-Hartman 355*ab4382d2SGreg Kroah-Hartman static void sunhv_release_port(struct uart_port *port) 356*ab4382d2SGreg Kroah-Hartman { 357*ab4382d2SGreg Kroah-Hartman } 358*ab4382d2SGreg Kroah-Hartman 359*ab4382d2SGreg Kroah-Hartman static int sunhv_request_port(struct uart_port *port) 360*ab4382d2SGreg Kroah-Hartman { 361*ab4382d2SGreg Kroah-Hartman return 0; 362*ab4382d2SGreg Kroah-Hartman } 363*ab4382d2SGreg Kroah-Hartman 364*ab4382d2SGreg Kroah-Hartman static void sunhv_config_port(struct uart_port *port, int flags) 365*ab4382d2SGreg Kroah-Hartman { 366*ab4382d2SGreg Kroah-Hartman } 367*ab4382d2SGreg Kroah-Hartman 368*ab4382d2SGreg Kroah-Hartman static int sunhv_verify_port(struct uart_port *port, struct serial_struct *ser) 369*ab4382d2SGreg Kroah-Hartman { 370*ab4382d2SGreg Kroah-Hartman return -EINVAL; 371*ab4382d2SGreg Kroah-Hartman } 372*ab4382d2SGreg Kroah-Hartman 373*ab4382d2SGreg Kroah-Hartman static struct uart_ops sunhv_pops = { 374*ab4382d2SGreg Kroah-Hartman .tx_empty = sunhv_tx_empty, 375*ab4382d2SGreg Kroah-Hartman .set_mctrl = sunhv_set_mctrl, 376*ab4382d2SGreg Kroah-Hartman .get_mctrl = sunhv_get_mctrl, 377*ab4382d2SGreg Kroah-Hartman .stop_tx = sunhv_stop_tx, 378*ab4382d2SGreg Kroah-Hartman .start_tx = sunhv_start_tx, 379*ab4382d2SGreg Kroah-Hartman .send_xchar = sunhv_send_xchar, 380*ab4382d2SGreg Kroah-Hartman .stop_rx = sunhv_stop_rx, 381*ab4382d2SGreg Kroah-Hartman .enable_ms = sunhv_enable_ms, 382*ab4382d2SGreg Kroah-Hartman .break_ctl = sunhv_break_ctl, 383*ab4382d2SGreg Kroah-Hartman .startup = sunhv_startup, 384*ab4382d2SGreg Kroah-Hartman .shutdown = sunhv_shutdown, 385*ab4382d2SGreg Kroah-Hartman .set_termios = sunhv_set_termios, 386*ab4382d2SGreg Kroah-Hartman .type = sunhv_type, 387*ab4382d2SGreg Kroah-Hartman .release_port = sunhv_release_port, 388*ab4382d2SGreg Kroah-Hartman .request_port = sunhv_request_port, 389*ab4382d2SGreg Kroah-Hartman .config_port = sunhv_config_port, 390*ab4382d2SGreg Kroah-Hartman .verify_port = sunhv_verify_port, 391*ab4382d2SGreg Kroah-Hartman }; 392*ab4382d2SGreg Kroah-Hartman 393*ab4382d2SGreg Kroah-Hartman static struct uart_driver sunhv_reg = { 394*ab4382d2SGreg Kroah-Hartman .owner = THIS_MODULE, 395*ab4382d2SGreg Kroah-Hartman .driver_name = "sunhv", 396*ab4382d2SGreg Kroah-Hartman .dev_name = "ttyS", 397*ab4382d2SGreg Kroah-Hartman .major = TTY_MAJOR, 398*ab4382d2SGreg Kroah-Hartman }; 399*ab4382d2SGreg Kroah-Hartman 400*ab4382d2SGreg Kroah-Hartman static struct uart_port *sunhv_port; 401*ab4382d2SGreg Kroah-Hartman 402*ab4382d2SGreg Kroah-Hartman /* Copy 's' into the con_write_page, decoding "\n" into 403*ab4382d2SGreg Kroah-Hartman * "\r\n" along the way. We have to return two lengths 404*ab4382d2SGreg Kroah-Hartman * because the caller needs to know how much to advance 405*ab4382d2SGreg Kroah-Hartman * 's' and also how many bytes to output via con_write_page. 406*ab4382d2SGreg Kroah-Hartman */ 407*ab4382d2SGreg Kroah-Hartman static int fill_con_write_page(const char *s, unsigned int n, 408*ab4382d2SGreg Kroah-Hartman unsigned long *page_bytes) 409*ab4382d2SGreg Kroah-Hartman { 410*ab4382d2SGreg Kroah-Hartman const char *orig_s = s; 411*ab4382d2SGreg Kroah-Hartman char *p = con_write_page; 412*ab4382d2SGreg Kroah-Hartman int left = PAGE_SIZE; 413*ab4382d2SGreg Kroah-Hartman 414*ab4382d2SGreg Kroah-Hartman while (n--) { 415*ab4382d2SGreg Kroah-Hartman if (*s == '\n') { 416*ab4382d2SGreg Kroah-Hartman if (left < 2) 417*ab4382d2SGreg Kroah-Hartman break; 418*ab4382d2SGreg Kroah-Hartman *p++ = '\r'; 419*ab4382d2SGreg Kroah-Hartman left--; 420*ab4382d2SGreg Kroah-Hartman } else if (left < 1) 421*ab4382d2SGreg Kroah-Hartman break; 422*ab4382d2SGreg Kroah-Hartman *p++ = *s++; 423*ab4382d2SGreg Kroah-Hartman left--; 424*ab4382d2SGreg Kroah-Hartman } 425*ab4382d2SGreg Kroah-Hartman *page_bytes = p - con_write_page; 426*ab4382d2SGreg Kroah-Hartman return s - orig_s; 427*ab4382d2SGreg Kroah-Hartman } 428*ab4382d2SGreg Kroah-Hartman 429*ab4382d2SGreg Kroah-Hartman static void sunhv_console_write_paged(struct console *con, const char *s, unsigned n) 430*ab4382d2SGreg Kroah-Hartman { 431*ab4382d2SGreg Kroah-Hartman struct uart_port *port = sunhv_port; 432*ab4382d2SGreg Kroah-Hartman unsigned long flags; 433*ab4382d2SGreg Kroah-Hartman int locked = 1; 434*ab4382d2SGreg Kroah-Hartman 435*ab4382d2SGreg Kroah-Hartman local_irq_save(flags); 436*ab4382d2SGreg Kroah-Hartman if (port->sysrq) { 437*ab4382d2SGreg Kroah-Hartman locked = 0; 438*ab4382d2SGreg Kroah-Hartman } else if (oops_in_progress) { 439*ab4382d2SGreg Kroah-Hartman locked = spin_trylock(&port->lock); 440*ab4382d2SGreg Kroah-Hartman } else 441*ab4382d2SGreg Kroah-Hartman spin_lock(&port->lock); 442*ab4382d2SGreg Kroah-Hartman 443*ab4382d2SGreg Kroah-Hartman while (n > 0) { 444*ab4382d2SGreg Kroah-Hartman unsigned long ra = __pa(con_write_page); 445*ab4382d2SGreg Kroah-Hartman unsigned long page_bytes; 446*ab4382d2SGreg Kroah-Hartman unsigned int cpy = fill_con_write_page(s, n, 447*ab4382d2SGreg Kroah-Hartman &page_bytes); 448*ab4382d2SGreg Kroah-Hartman 449*ab4382d2SGreg Kroah-Hartman n -= cpy; 450*ab4382d2SGreg Kroah-Hartman s += cpy; 451*ab4382d2SGreg Kroah-Hartman while (page_bytes > 0) { 452*ab4382d2SGreg Kroah-Hartman unsigned long written; 453*ab4382d2SGreg Kroah-Hartman int limit = 1000000; 454*ab4382d2SGreg Kroah-Hartman 455*ab4382d2SGreg Kroah-Hartman while (limit--) { 456*ab4382d2SGreg Kroah-Hartman unsigned long stat; 457*ab4382d2SGreg Kroah-Hartman 458*ab4382d2SGreg Kroah-Hartman stat = sun4v_con_write(ra, page_bytes, 459*ab4382d2SGreg Kroah-Hartman &written); 460*ab4382d2SGreg Kroah-Hartman if (stat == HV_EOK) 461*ab4382d2SGreg Kroah-Hartman break; 462*ab4382d2SGreg Kroah-Hartman udelay(1); 463*ab4382d2SGreg Kroah-Hartman } 464*ab4382d2SGreg Kroah-Hartman if (limit < 0) 465*ab4382d2SGreg Kroah-Hartman break; 466*ab4382d2SGreg Kroah-Hartman page_bytes -= written; 467*ab4382d2SGreg Kroah-Hartman ra += written; 468*ab4382d2SGreg Kroah-Hartman } 469*ab4382d2SGreg Kroah-Hartman } 470*ab4382d2SGreg Kroah-Hartman 471*ab4382d2SGreg Kroah-Hartman if (locked) 472*ab4382d2SGreg Kroah-Hartman spin_unlock(&port->lock); 473*ab4382d2SGreg Kroah-Hartman local_irq_restore(flags); 474*ab4382d2SGreg Kroah-Hartman } 475*ab4382d2SGreg Kroah-Hartman 476*ab4382d2SGreg Kroah-Hartman static inline void sunhv_console_putchar(struct uart_port *port, char c) 477*ab4382d2SGreg Kroah-Hartman { 478*ab4382d2SGreg Kroah-Hartman int limit = 1000000; 479*ab4382d2SGreg Kroah-Hartman 480*ab4382d2SGreg Kroah-Hartman while (limit-- > 0) { 481*ab4382d2SGreg Kroah-Hartman long status = sun4v_con_putchar(c); 482*ab4382d2SGreg Kroah-Hartman if (status == HV_EOK) 483*ab4382d2SGreg Kroah-Hartman break; 484*ab4382d2SGreg Kroah-Hartman udelay(1); 485*ab4382d2SGreg Kroah-Hartman } 486*ab4382d2SGreg Kroah-Hartman } 487*ab4382d2SGreg Kroah-Hartman 488*ab4382d2SGreg Kroah-Hartman static void sunhv_console_write_bychar(struct console *con, const char *s, unsigned n) 489*ab4382d2SGreg Kroah-Hartman { 490*ab4382d2SGreg Kroah-Hartman struct uart_port *port = sunhv_port; 491*ab4382d2SGreg Kroah-Hartman unsigned long flags; 492*ab4382d2SGreg Kroah-Hartman int i, locked = 1; 493*ab4382d2SGreg Kroah-Hartman 494*ab4382d2SGreg Kroah-Hartman local_irq_save(flags); 495*ab4382d2SGreg Kroah-Hartman if (port->sysrq) { 496*ab4382d2SGreg Kroah-Hartman locked = 0; 497*ab4382d2SGreg Kroah-Hartman } else if (oops_in_progress) { 498*ab4382d2SGreg Kroah-Hartman locked = spin_trylock(&port->lock); 499*ab4382d2SGreg Kroah-Hartman } else 500*ab4382d2SGreg Kroah-Hartman spin_lock(&port->lock); 501*ab4382d2SGreg Kroah-Hartman 502*ab4382d2SGreg Kroah-Hartman for (i = 0; i < n; i++) { 503*ab4382d2SGreg Kroah-Hartman if (*s == '\n') 504*ab4382d2SGreg Kroah-Hartman sunhv_console_putchar(port, '\r'); 505*ab4382d2SGreg Kroah-Hartman sunhv_console_putchar(port, *s++); 506*ab4382d2SGreg Kroah-Hartman } 507*ab4382d2SGreg Kroah-Hartman 508*ab4382d2SGreg Kroah-Hartman if (locked) 509*ab4382d2SGreg Kroah-Hartman spin_unlock(&port->lock); 510*ab4382d2SGreg Kroah-Hartman local_irq_restore(flags); 511*ab4382d2SGreg Kroah-Hartman } 512*ab4382d2SGreg Kroah-Hartman 513*ab4382d2SGreg Kroah-Hartman static struct console sunhv_console = { 514*ab4382d2SGreg Kroah-Hartman .name = "ttyHV", 515*ab4382d2SGreg Kroah-Hartman .write = sunhv_console_write_bychar, 516*ab4382d2SGreg Kroah-Hartman .device = uart_console_device, 517*ab4382d2SGreg Kroah-Hartman .flags = CON_PRINTBUFFER, 518*ab4382d2SGreg Kroah-Hartman .index = -1, 519*ab4382d2SGreg Kroah-Hartman .data = &sunhv_reg, 520*ab4382d2SGreg Kroah-Hartman }; 521*ab4382d2SGreg Kroah-Hartman 522*ab4382d2SGreg Kroah-Hartman static int __devinit hv_probe(struct platform_device *op, const struct of_device_id *match) 523*ab4382d2SGreg Kroah-Hartman { 524*ab4382d2SGreg Kroah-Hartman struct uart_port *port; 525*ab4382d2SGreg Kroah-Hartman unsigned long minor; 526*ab4382d2SGreg Kroah-Hartman int err; 527*ab4382d2SGreg Kroah-Hartman 528*ab4382d2SGreg Kroah-Hartman if (op->archdata.irqs[0] == 0xffffffff) 529*ab4382d2SGreg Kroah-Hartman return -ENODEV; 530*ab4382d2SGreg Kroah-Hartman 531*ab4382d2SGreg Kroah-Hartman port = kzalloc(sizeof(struct uart_port), GFP_KERNEL); 532*ab4382d2SGreg Kroah-Hartman if (unlikely(!port)) 533*ab4382d2SGreg Kroah-Hartman return -ENOMEM; 534*ab4382d2SGreg Kroah-Hartman 535*ab4382d2SGreg Kroah-Hartman minor = 1; 536*ab4382d2SGreg Kroah-Hartman if (sun4v_hvapi_register(HV_GRP_CORE, 1, &minor) == 0 && 537*ab4382d2SGreg Kroah-Hartman minor >= 1) { 538*ab4382d2SGreg Kroah-Hartman err = -ENOMEM; 539*ab4382d2SGreg Kroah-Hartman con_write_page = kzalloc(PAGE_SIZE, GFP_KERNEL); 540*ab4382d2SGreg Kroah-Hartman if (!con_write_page) 541*ab4382d2SGreg Kroah-Hartman goto out_free_port; 542*ab4382d2SGreg Kroah-Hartman 543*ab4382d2SGreg Kroah-Hartman con_read_page = kzalloc(PAGE_SIZE, GFP_KERNEL); 544*ab4382d2SGreg Kroah-Hartman if (!con_read_page) 545*ab4382d2SGreg Kroah-Hartman goto out_free_con_write_page; 546*ab4382d2SGreg Kroah-Hartman 547*ab4382d2SGreg Kroah-Hartman sunhv_console.write = sunhv_console_write_paged; 548*ab4382d2SGreg Kroah-Hartman sunhv_ops = &bywrite_ops; 549*ab4382d2SGreg Kroah-Hartman } 550*ab4382d2SGreg Kroah-Hartman 551*ab4382d2SGreg Kroah-Hartman sunhv_port = port; 552*ab4382d2SGreg Kroah-Hartman 553*ab4382d2SGreg Kroah-Hartman port->line = 0; 554*ab4382d2SGreg Kroah-Hartman port->ops = &sunhv_pops; 555*ab4382d2SGreg Kroah-Hartman port->type = PORT_SUNHV; 556*ab4382d2SGreg Kroah-Hartman port->uartclk = ( 29491200 / 16 ); /* arbitrary */ 557*ab4382d2SGreg Kroah-Hartman 558*ab4382d2SGreg Kroah-Hartman port->membase = (unsigned char __iomem *) __pa(port); 559*ab4382d2SGreg Kroah-Hartman 560*ab4382d2SGreg Kroah-Hartman port->irq = op->archdata.irqs[0]; 561*ab4382d2SGreg Kroah-Hartman 562*ab4382d2SGreg Kroah-Hartman port->dev = &op->dev; 563*ab4382d2SGreg Kroah-Hartman 564*ab4382d2SGreg Kroah-Hartman err = sunserial_register_minors(&sunhv_reg, 1); 565*ab4382d2SGreg Kroah-Hartman if (err) 566*ab4382d2SGreg Kroah-Hartman goto out_free_con_read_page; 567*ab4382d2SGreg Kroah-Hartman 568*ab4382d2SGreg Kroah-Hartman sunserial_console_match(&sunhv_console, op->dev.of_node, 569*ab4382d2SGreg Kroah-Hartman &sunhv_reg, port->line, false); 570*ab4382d2SGreg Kroah-Hartman 571*ab4382d2SGreg Kroah-Hartman err = uart_add_one_port(&sunhv_reg, port); 572*ab4382d2SGreg Kroah-Hartman if (err) 573*ab4382d2SGreg Kroah-Hartman goto out_unregister_driver; 574*ab4382d2SGreg Kroah-Hartman 575*ab4382d2SGreg Kroah-Hartman err = request_irq(port->irq, sunhv_interrupt, 0, "hvcons", port); 576*ab4382d2SGreg Kroah-Hartman if (err) 577*ab4382d2SGreg Kroah-Hartman goto out_remove_port; 578*ab4382d2SGreg Kroah-Hartman 579*ab4382d2SGreg Kroah-Hartman dev_set_drvdata(&op->dev, port); 580*ab4382d2SGreg Kroah-Hartman 581*ab4382d2SGreg Kroah-Hartman return 0; 582*ab4382d2SGreg Kroah-Hartman 583*ab4382d2SGreg Kroah-Hartman out_remove_port: 584*ab4382d2SGreg Kroah-Hartman uart_remove_one_port(&sunhv_reg, port); 585*ab4382d2SGreg Kroah-Hartman 586*ab4382d2SGreg Kroah-Hartman out_unregister_driver: 587*ab4382d2SGreg Kroah-Hartman sunserial_unregister_minors(&sunhv_reg, 1); 588*ab4382d2SGreg Kroah-Hartman 589*ab4382d2SGreg Kroah-Hartman out_free_con_read_page: 590*ab4382d2SGreg Kroah-Hartman kfree(con_read_page); 591*ab4382d2SGreg Kroah-Hartman 592*ab4382d2SGreg Kroah-Hartman out_free_con_write_page: 593*ab4382d2SGreg Kroah-Hartman kfree(con_write_page); 594*ab4382d2SGreg Kroah-Hartman 595*ab4382d2SGreg Kroah-Hartman out_free_port: 596*ab4382d2SGreg Kroah-Hartman kfree(port); 597*ab4382d2SGreg Kroah-Hartman sunhv_port = NULL; 598*ab4382d2SGreg Kroah-Hartman return err; 599*ab4382d2SGreg Kroah-Hartman } 600*ab4382d2SGreg Kroah-Hartman 601*ab4382d2SGreg Kroah-Hartman static int __devexit hv_remove(struct platform_device *dev) 602*ab4382d2SGreg Kroah-Hartman { 603*ab4382d2SGreg Kroah-Hartman struct uart_port *port = dev_get_drvdata(&dev->dev); 604*ab4382d2SGreg Kroah-Hartman 605*ab4382d2SGreg Kroah-Hartman free_irq(port->irq, port); 606*ab4382d2SGreg Kroah-Hartman 607*ab4382d2SGreg Kroah-Hartman uart_remove_one_port(&sunhv_reg, port); 608*ab4382d2SGreg Kroah-Hartman 609*ab4382d2SGreg Kroah-Hartman sunserial_unregister_minors(&sunhv_reg, 1); 610*ab4382d2SGreg Kroah-Hartman 611*ab4382d2SGreg Kroah-Hartman kfree(port); 612*ab4382d2SGreg Kroah-Hartman sunhv_port = NULL; 613*ab4382d2SGreg Kroah-Hartman 614*ab4382d2SGreg Kroah-Hartman dev_set_drvdata(&dev->dev, NULL); 615*ab4382d2SGreg Kroah-Hartman 616*ab4382d2SGreg Kroah-Hartman return 0; 617*ab4382d2SGreg Kroah-Hartman } 618*ab4382d2SGreg Kroah-Hartman 619*ab4382d2SGreg Kroah-Hartman static const struct of_device_id hv_match[] = { 620*ab4382d2SGreg Kroah-Hartman { 621*ab4382d2SGreg Kroah-Hartman .name = "console", 622*ab4382d2SGreg Kroah-Hartman .compatible = "qcn", 623*ab4382d2SGreg Kroah-Hartman }, 624*ab4382d2SGreg Kroah-Hartman { 625*ab4382d2SGreg Kroah-Hartman .name = "console", 626*ab4382d2SGreg Kroah-Hartman .compatible = "SUNW,sun4v-console", 627*ab4382d2SGreg Kroah-Hartman }, 628*ab4382d2SGreg Kroah-Hartman {}, 629*ab4382d2SGreg Kroah-Hartman }; 630*ab4382d2SGreg Kroah-Hartman MODULE_DEVICE_TABLE(of, hv_match); 631*ab4382d2SGreg Kroah-Hartman 632*ab4382d2SGreg Kroah-Hartman static struct of_platform_driver hv_driver = { 633*ab4382d2SGreg Kroah-Hartman .driver = { 634*ab4382d2SGreg Kroah-Hartman .name = "hv", 635*ab4382d2SGreg Kroah-Hartman .owner = THIS_MODULE, 636*ab4382d2SGreg Kroah-Hartman .of_match_table = hv_match, 637*ab4382d2SGreg Kroah-Hartman }, 638*ab4382d2SGreg Kroah-Hartman .probe = hv_probe, 639*ab4382d2SGreg Kroah-Hartman .remove = __devexit_p(hv_remove), 640*ab4382d2SGreg Kroah-Hartman }; 641*ab4382d2SGreg Kroah-Hartman 642*ab4382d2SGreg Kroah-Hartman static int __init sunhv_init(void) 643*ab4382d2SGreg Kroah-Hartman { 644*ab4382d2SGreg Kroah-Hartman if (tlb_type != hypervisor) 645*ab4382d2SGreg Kroah-Hartman return -ENODEV; 646*ab4382d2SGreg Kroah-Hartman 647*ab4382d2SGreg Kroah-Hartman return of_register_platform_driver(&hv_driver); 648*ab4382d2SGreg Kroah-Hartman } 649*ab4382d2SGreg Kroah-Hartman 650*ab4382d2SGreg Kroah-Hartman static void __exit sunhv_exit(void) 651*ab4382d2SGreg Kroah-Hartman { 652*ab4382d2SGreg Kroah-Hartman of_unregister_platform_driver(&hv_driver); 653*ab4382d2SGreg Kroah-Hartman } 654*ab4382d2SGreg Kroah-Hartman 655*ab4382d2SGreg Kroah-Hartman module_init(sunhv_init); 656*ab4382d2SGreg Kroah-Hartman module_exit(sunhv_exit); 657*ab4382d2SGreg Kroah-Hartman 658*ab4382d2SGreg Kroah-Hartman MODULE_AUTHOR("David S. Miller"); 659*ab4382d2SGreg Kroah-Hartman MODULE_DESCRIPTION("SUN4V Hypervisor console driver"); 660*ab4382d2SGreg Kroah-Hartman MODULE_VERSION("2.0"); 661*ab4382d2SGreg Kroah-Hartman MODULE_LICENSE("GPL"); 662