aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-10-29 17:15:32 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-10-29 17:15:32 -0400
commit19bf7f8ac3f8131100027281c495dbbe00cd5ae0 (patch)
tree270b97e3ca47c0f62a1babca2ae37f79a76a309c /drivers/tty
parent787c57c0fb393fe8a3974d300ddcfe30373386fe (diff)
parent35fd3dc58da675d659513384221349ef90749a01 (diff)
Merge remote-tracking branch 'master' into queue
Merge reason: development work has dependency on kvm patches merged upstream. Conflicts: arch/powerpc/include/asm/Kbuild arch/powerpc/include/asm/kvm_para.h Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/hvc/hvc_console.c33
-rw-r--r--drivers/tty/hvc/hvc_vio.c123
-rw-r--r--drivers/tty/hvc/hvc_xen.c5
-rw-r--r--drivers/tty/serial/8250/8250_hp300.c20
-rw-r--r--drivers/tty/serial/Kconfig4
-rw-r--r--drivers/tty/serial/kgdboc.c3
-rw-r--r--drivers/tty/serial/omap-serial.c12
-rw-r--r--drivers/tty/serial/sccnxp.c1
-rw-r--r--drivers/tty/serial/sh-sci.c3
-rw-r--r--drivers/tty/sysrq.c1
-rw-r--r--drivers/tty/vt/vt.c13
11 files changed, 137 insertions, 81 deletions
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index 4a652999380..a5dec1ca1b8 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -245,6 +245,20 @@ static void hvc_port_destruct(struct tty_port *port)
245 kfree(hp); 245 kfree(hp);
246} 246}
247 247
248static void hvc_check_console(int index)
249{
250 /* Already enabled, bail out */
251 if (hvc_console.flags & CON_ENABLED)
252 return;
253
254 /* If this index is what the user requested, then register
255 * now (setup won't fail at this point). It's ok to just
256 * call register again if previously .setup failed.
257 */
258 if (index == hvc_console.index)
259 register_console(&hvc_console);
260}
261
248/* 262/*
249 * hvc_instantiate() is an early console discovery method which locates 263 * hvc_instantiate() is an early console discovery method which locates
250 * consoles * prior to the vio subsystem discovering them. Hotplugged 264 * consoles * prior to the vio subsystem discovering them. Hotplugged
@@ -275,12 +289,8 @@ int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops)
275 if (last_hvc < index) 289 if (last_hvc < index)
276 last_hvc = index; 290 last_hvc = index;
277 291
278 /* if this index is what the user requested, then register 292 /* check if we need to re-register the kernel console */
279 * now (setup won't fail at this point). It's ok to just 293 hvc_check_console(index);
280 * call register again if previously .setup failed.
281 */
282 if (index == hvc_console.index)
283 register_console(&hvc_console);
284 294
285 return 0; 295 return 0;
286} 296}
@@ -877,10 +887,15 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
877 i = ++last_hvc; 887 i = ++last_hvc;
878 888
879 hp->index = i; 889 hp->index = i;
890 cons_ops[i] = ops;
891 vtermnos[i] = vtermno;
880 892
881 list_add_tail(&(hp->next), &hvc_structs); 893 list_add_tail(&(hp->next), &hvc_structs);
882 spin_unlock(&hvc_structs_lock); 894 spin_unlock(&hvc_structs_lock);
883 895
896 /* check if we need to re-register the kernel console */
897 hvc_check_console(i);
898
884 return hp; 899 return hp;
885} 900}
886EXPORT_SYMBOL_GPL(hvc_alloc); 901EXPORT_SYMBOL_GPL(hvc_alloc);
@@ -893,8 +908,12 @@ int hvc_remove(struct hvc_struct *hp)
893 tty = tty_port_tty_get(&hp->port); 908 tty = tty_port_tty_get(&hp->port);
894 909
895 spin_lock_irqsave(&hp->lock, flags); 910 spin_lock_irqsave(&hp->lock, flags);
896 if (hp->index < MAX_NR_HVC_CONSOLES) 911 if (hp->index < MAX_NR_HVC_CONSOLES) {
912 console_lock();
897 vtermnos[hp->index] = -1; 913 vtermnos[hp->index] = -1;
914 cons_ops[hp->index] = NULL;
915 console_unlock();
916 }
898 917
899 /* Don't whack hp->irq because tty_hangup() will need to free the irq. */ 918 /* Don't whack hp->irq because tty_hangup() will need to free the irq. */
900 919
diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
index ee307799271..070c0ee6864 100644
--- a/drivers/tty/hvc/hvc_vio.c
+++ b/drivers/tty/hvc/hvc_vio.c
@@ -230,6 +230,69 @@ static const struct hv_ops hvterm_hvsi_ops = {
230 .tiocmset = hvterm_hvsi_tiocmset, 230 .tiocmset = hvterm_hvsi_tiocmset,
231}; 231};
232 232
233static void udbg_hvc_putc(char c)
234{
235 int count = -1;
236
237 if (!hvterm_privs[0])
238 return;
239
240 if (c == '\n')
241 udbg_hvc_putc('\r');
242
243 do {
244 switch(hvterm_privs[0]->proto) {
245 case HV_PROTOCOL_RAW:
246 count = hvterm_raw_put_chars(0, &c, 1);
247 break;
248 case HV_PROTOCOL_HVSI:
249 count = hvterm_hvsi_put_chars(0, &c, 1);
250 break;
251 }
252 } while(count == 0);
253}
254
255static int udbg_hvc_getc_poll(void)
256{
257 int rc = 0;
258 char c;
259
260 if (!hvterm_privs[0])
261 return -1;
262
263 switch(hvterm_privs[0]->proto) {
264 case HV_PROTOCOL_RAW:
265 rc = hvterm_raw_get_chars(0, &c, 1);
266 break;
267 case HV_PROTOCOL_HVSI:
268 rc = hvterm_hvsi_get_chars(0, &c, 1);
269 break;
270 }
271 if (!rc)
272 return -1;
273 return c;
274}
275
276static int udbg_hvc_getc(void)
277{
278 int ch;
279
280 if (!hvterm_privs[0])
281 return -1;
282
283 for (;;) {
284 ch = udbg_hvc_getc_poll();
285 if (ch == -1) {
286 /* This shouldn't be needed...but... */
287 volatile unsigned long delay;
288 for (delay=0; delay < 2000000; delay++)
289 ;
290 } else {
291 return ch;
292 }
293 }
294}
295
233static int __devinit hvc_vio_probe(struct vio_dev *vdev, 296static int __devinit hvc_vio_probe(struct vio_dev *vdev,
234 const struct vio_device_id *id) 297 const struct vio_device_id *id)
235{ 298{
@@ -289,6 +352,13 @@ static int __devinit hvc_vio_probe(struct vio_dev *vdev,
289 return PTR_ERR(hp); 352 return PTR_ERR(hp);
290 dev_set_drvdata(&vdev->dev, hp); 353 dev_set_drvdata(&vdev->dev, hp);
291 354
355 /* register udbg if it's not there already for console 0 */
356 if (hp->index == 0 && !udbg_putc) {
357 udbg_putc = udbg_hvc_putc;
358 udbg_getc = udbg_hvc_getc;
359 udbg_getc_poll = udbg_hvc_getc_poll;
360 }
361
292 return 0; 362 return 0;
293} 363}
294 364
@@ -331,59 +401,6 @@ static void __exit hvc_vio_exit(void)
331} 401}
332module_exit(hvc_vio_exit); 402module_exit(hvc_vio_exit);
333 403
334static void udbg_hvc_putc(char c)
335{
336 int count = -1;
337
338 if (c == '\n')
339 udbg_hvc_putc('\r');
340
341 do {
342 switch(hvterm_priv0.proto) {
343 case HV_PROTOCOL_RAW:
344 count = hvterm_raw_put_chars(0, &c, 1);
345 break;
346 case HV_PROTOCOL_HVSI:
347 count = hvterm_hvsi_put_chars(0, &c, 1);
348 break;
349 }
350 } while(count == 0);
351}
352
353static int udbg_hvc_getc_poll(void)
354{
355 int rc = 0;
356 char c;
357
358 switch(hvterm_priv0.proto) {
359 case HV_PROTOCOL_RAW:
360 rc = hvterm_raw_get_chars(0, &c, 1);
361 break;
362 case HV_PROTOCOL_HVSI:
363 rc = hvterm_hvsi_get_chars(0, &c, 1);
364 break;
365 }
366 if (!rc)
367 return -1;
368 return c;
369}
370
371static int udbg_hvc_getc(void)
372{
373 int ch;
374 for (;;) {
375 ch = udbg_hvc_getc_poll();
376 if (ch == -1) {
377 /* This shouldn't be needed...but... */
378 volatile unsigned long delay;
379 for (delay=0; delay < 2000000; delay++)
380 ;
381 } else {
382 return ch;
383 }
384 }
385}
386
387void __init hvc_vio_init_early(void) 404void __init hvc_vio_init_early(void)
388{ 405{
389 struct device_node *stdout_node; 406 struct device_node *stdout_node;
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 2944ff88fdc..f4abfe238f9 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -478,7 +478,6 @@ static void xencons_backend_changed(struct xenbus_device *dev,
478 case XenbusStateInitialising: 478 case XenbusStateInitialising:
479 case XenbusStateInitialised: 479 case XenbusStateInitialised:
480 case XenbusStateUnknown: 480 case XenbusStateUnknown:
481 case XenbusStateClosed:
482 break; 481 break;
483 482
484 case XenbusStateInitWait: 483 case XenbusStateInitWait:
@@ -488,6 +487,10 @@ static void xencons_backend_changed(struct xenbus_device *dev,
488 xenbus_switch_state(dev, XenbusStateConnected); 487 xenbus_switch_state(dev, XenbusStateConnected);
489 break; 488 break;
490 489
490 case XenbusStateClosed:
491 if (dev->state == XenbusStateClosed)
492 break;
493 /* Missed the backend's CLOSING state -- fallthrough */
491 case XenbusStateClosing: 494 case XenbusStateClosing:
492 xenbus_frontend_closed(dev); 495 xenbus_frontend_closed(dev);
493 break; 496 break;
diff --git a/drivers/tty/serial/8250/8250_hp300.c b/drivers/tty/serial/8250/8250_hp300.c
index 8f1dd2cc00a..f3d0edf4664 100644
--- a/drivers/tty/serial/8250/8250_hp300.c
+++ b/drivers/tty/serial/8250/8250_hp300.c
@@ -162,7 +162,7 @@ int __init hp300_setup_serial_console(void)
162static int __devinit hpdca_init_one(struct dio_dev *d, 162static int __devinit hpdca_init_one(struct dio_dev *d,
163 const struct dio_device_id *ent) 163 const struct dio_device_id *ent)
164{ 164{
165 struct uart_port port; 165 struct uart_8250_port uart;
166 int line; 166 int line;
167 167
168#ifdef CONFIG_SERIAL_8250_CONSOLE 168#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -174,19 +174,19 @@ static int __devinit hpdca_init_one(struct dio_dev *d,
174 memset(&uart, 0, sizeof(uart)); 174 memset(&uart, 0, sizeof(uart));
175 175
176 /* Memory mapped I/O */ 176 /* Memory mapped I/O */
177 port.iotype = UPIO_MEM; 177 uart.port.iotype = UPIO_MEM;
178 port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; 178 uart.port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF;
179 port.irq = d->ipl; 179 uart.port.irq = d->ipl;
180 port.uartclk = HPDCA_BAUD_BASE * 16; 180 uart.port.uartclk = HPDCA_BAUD_BASE * 16;
181 port.mapbase = (d->resource.start + UART_OFFSET); 181 uart.port.mapbase = (d->resource.start + UART_OFFSET);
182 port.membase = (char *)(port.mapbase + DIO_VIRADDRBASE); 182 uart.port.membase = (char *)(uart.port.mapbase + DIO_VIRADDRBASE);
183 port.regshift = 1; 183 uart.port.regshift = 1;
184 port.dev = &d->dev; 184 uart.port.dev = &d->dev;
185 line = serial8250_register_8250_port(&uart); 185 line = serial8250_register_8250_port(&uart);
186 186
187 if (line < 0) { 187 if (line < 0) {
188 printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d" 188 printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d"
189 " irq %d failed\n", d->scode, port.irq); 189 " irq %d failed\n", d->scode, uart.port.irq);
190 return -ENOMEM; 190 return -ENOMEM;
191 } 191 }
192 192
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 233fbaaf255..2a53be5f010 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1150,7 +1150,7 @@ config SERIAL_SC26XX_CONSOLE
1150 Support for Console on SC2681/SC2692 serial ports. 1150 Support for Console on SC2681/SC2692 serial ports.
1151 1151
1152config SERIAL_SCCNXP 1152config SERIAL_SCCNXP
1153 bool "SCCNXP serial port support" 1153 tristate "SCCNXP serial port support"
1154 depends on !SERIAL_SC26XX 1154 depends on !SERIAL_SC26XX
1155 select SERIAL_CORE 1155 select SERIAL_CORE
1156 default n 1156 default n
@@ -1162,7 +1162,7 @@ config SERIAL_SCCNXP
1162 1162
1163config SERIAL_SCCNXP_CONSOLE 1163config SERIAL_SCCNXP_CONSOLE
1164 bool "Console on SCCNXP serial port" 1164 bool "Console on SCCNXP serial port"
1165 depends on SERIAL_SCCNXP 1165 depends on SERIAL_SCCNXP=y
1166 select SERIAL_CORE_CONSOLE 1166 select SERIAL_CORE_CONSOLE
1167 help 1167 help
1168 Support for console on SCCNXP serial ports. 1168 Support for console on SCCNXP serial ports.
diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index c0b334327d9..10020547c60 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -97,7 +97,8 @@ static void kgdboc_restore_input(void)
97 97
98static int kgdboc_register_kbd(char **cptr) 98static int kgdboc_register_kbd(char **cptr)
99{ 99{
100 if (strncmp(*cptr, "kbd", 3) == 0) { 100 if (strncmp(*cptr, "kbd", 3) == 0 ||
101 strncmp(*cptr, "kdb", 3) == 0) {
101 if (kdb_poll_idx < KDB_POLL_FUNC_MAX) { 102 if (kdb_poll_idx < KDB_POLL_FUNC_MAX) {
102 kdb_poll_funcs[kdb_poll_idx] = kdb_get_kbd_char; 103 kdb_poll_funcs[kdb_poll_idx] = kdb_get_kbd_char;
103 kdb_poll_idx++; 104 kdb_poll_idx++;
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 6ede6fd92b4..6d3d26a607b 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -671,19 +671,19 @@ serial_omap_configure_xonxoff
671 671
672 /* 672 /*
673 * IXON Flag: 673 * IXON Flag:
674 * Flow control for OMAP.TX 674 * Enable XON/XOFF flow control on output.
675 * OMAP.RX should listen for XON/XOFF 675 * Transmit XON1, XOFF1
676 */ 676 */
677 if (termios->c_iflag & IXON) 677 if (termios->c_iflag & IXON)
678 up->efr |= OMAP_UART_SW_RX; 678 up->efr |= OMAP_UART_SW_TX;
679 679
680 /* 680 /*
681 * IXOFF Flag: 681 * IXOFF Flag:
682 * Flow control for OMAP.RX 682 * Enable XON/XOFF flow control on input.
683 * OMAP.TX should send XON/XOFF 683 * Receiver compares XON1, XOFF1.
684 */ 684 */
685 if (termios->c_iflag & IXOFF) 685 if (termios->c_iflag & IXOFF)
686 up->efr |= OMAP_UART_SW_TX; 686 up->efr |= OMAP_UART_SW_RX;
687 687
688 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); 688 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB);
689 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); 689 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index b7086d004f5..e821068cd95 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -971,6 +971,7 @@ static const struct platform_device_id sccnxp_id_table[] = {
971 { "sc28202", SCCNXP_TYPE_SC28202 }, 971 { "sc28202", SCCNXP_TYPE_SC28202 },
972 { "sc68681", SCCNXP_TYPE_SC68681 }, 972 { "sc68681", SCCNXP_TYPE_SC68681 },
973 { "sc68692", SCCNXP_TYPE_SC68692 }, 973 { "sc68692", SCCNXP_TYPE_SC68692 },
974 { },
974}; 975};
975MODULE_DEVICE_TABLE(platform, sccnxp_id_table); 976MODULE_DEVICE_TABLE(platform, sccnxp_id_table);
976 977
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 9be296cf729..6ee59001d61 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -530,7 +530,8 @@ static inline int sci_rxd_in(struct uart_port *port)
530 if (s->cfg->port_reg <= 0) 530 if (s->cfg->port_reg <= 0)
531 return 1; 531 return 1;
532 532
533 return !!__raw_readb(s->cfg->port_reg); 533 /* Cast for ARM damage */
534 return !!__raw_readb((void __iomem *)s->cfg->port_reg);
534} 535}
535 536
536/* ********************************************************************** * 537/* ********************************************************************** *
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 05728894a88..16ee6cee07d 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -452,6 +452,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
452 NULL, /* v */ 452 NULL, /* v */
453 &sysrq_showstate_blocked_op, /* w */ 453 &sysrq_showstate_blocked_op, /* w */
454 /* x: May be registered on ppc/powerpc for xmon */ 454 /* x: May be registered on ppc/powerpc for xmon */
455 /* x: May be registered on sparc64 for global PMU dump */
455 NULL, /* x */ 456 NULL, /* x */
456 /* y: May be registered on sparc64 for global register dump */ 457 /* y: May be registered on sparc64 for global register dump */
457 NULL, /* y */ 458 NULL, /* y */
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 999ca63afde..f87d7e8964b 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3442,6 +3442,19 @@ int con_debug_enter(struct vc_data *vc)
3442 kdb_set(2, setargs); 3442 kdb_set(2, setargs);
3443 } 3443 }
3444 } 3444 }
3445 if (vc->vc_cols < 999) {
3446 int colcount;
3447 char cols[4];
3448 const char *setargs[3] = {
3449 "set",
3450 "COLUMNS",
3451 cols,
3452 };
3453 if (kdbgetintenv(setargs[0], &colcount)) {
3454 snprintf(cols, 4, "%i", vc->vc_cols);
3455 kdb_set(2, setargs);
3456 }
3457 }
3445#endif /* CONFIG_KGDB_KDB */ 3458#endif /* CONFIG_KGDB_KDB */
3446 return ret; 3459 return ret;
3447} 3460}