diff options
author | Anton Blanchard <anton@samba.org> | 2011-07-12 15:44:05 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-07-19 01:13:07 -0400 |
commit | 762e77ae7dd055d0b77e0ad34d87db7416df109e (patch) | |
tree | 5267193f4224aaed3117746cc2e3f47d1e0e1025 /drivers/tty | |
parent | 19df9abdd30a0448e5940c6aa3527096bb69aca7 (diff) |
hvc_console: Add kdb support
Add poll_get_char and poll_put_char for kdb. Enable kdb at boot with:
kgdboc=hvc0
or at runtime with:
echo hvc0 > /sys/module/kgdboc/parameters/kgdboc
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/hvc/hvc_console.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 59000750cc73..e1aaf4f309b3 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/freezer.h> | 40 | #include <linux/freezer.h> |
41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
42 | #include <linux/serial_core.h> | ||
42 | 43 | ||
43 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
44 | 45 | ||
@@ -766,6 +767,39 @@ static int hvc_tiocmset(struct tty_struct *tty, | |||
766 | return hp->ops->tiocmset(hp, set, clear); | 767 | return hp->ops->tiocmset(hp, set, clear); |
767 | } | 768 | } |
768 | 769 | ||
770 | #ifdef CONFIG_CONSOLE_POLL | ||
771 | int hvc_poll_init(struct tty_driver *driver, int line, char *options) | ||
772 | { | ||
773 | return 0; | ||
774 | } | ||
775 | |||
776 | static int hvc_poll_get_char(struct tty_driver *driver, int line) | ||
777 | { | ||
778 | struct tty_struct *tty = driver->ttys[0]; | ||
779 | struct hvc_struct *hp = tty->driver_data; | ||
780 | int n; | ||
781 | char ch; | ||
782 | |||
783 | n = hp->ops->get_chars(hp->vtermno, &ch, 1); | ||
784 | |||
785 | if (n == 0) | ||
786 | return NO_POLL_CHAR; | ||
787 | |||
788 | return ch; | ||
789 | } | ||
790 | |||
791 | static void hvc_poll_put_char(struct tty_driver *driver, int line, char ch) | ||
792 | { | ||
793 | struct tty_struct *tty = driver->ttys[0]; | ||
794 | struct hvc_struct *hp = tty->driver_data; | ||
795 | int n; | ||
796 | |||
797 | do { | ||
798 | n = hp->ops->put_chars(hp->vtermno, &ch, 1); | ||
799 | } while (n <= 0); | ||
800 | } | ||
801 | #endif | ||
802 | |||
769 | static const struct tty_operations hvc_ops = { | 803 | static const struct tty_operations hvc_ops = { |
770 | .open = hvc_open, | 804 | .open = hvc_open, |
771 | .close = hvc_close, | 805 | .close = hvc_close, |
@@ -776,6 +810,11 @@ static const struct tty_operations hvc_ops = { | |||
776 | .chars_in_buffer = hvc_chars_in_buffer, | 810 | .chars_in_buffer = hvc_chars_in_buffer, |
777 | .tiocmget = hvc_tiocmget, | 811 | .tiocmget = hvc_tiocmget, |
778 | .tiocmset = hvc_tiocmset, | 812 | .tiocmset = hvc_tiocmset, |
813 | #ifdef CONFIG_CONSOLE_POLL | ||
814 | .poll_init = hvc_poll_init, | ||
815 | .poll_get_char = hvc_poll_get_char, | ||
816 | .poll_put_char = hvc_poll_put_char, | ||
817 | #endif | ||
779 | }; | 818 | }; |
780 | 819 | ||
781 | struct hvc_struct *hvc_alloc(uint32_t vtermno, int data, | 820 | struct hvc_struct *hvc_alloc(uint32_t vtermno, int data, |