diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2008-04-17 14:05:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 14:05:37 -0400 |
commit | f2d937f3bf00665ccf048b3b6616ef95859b0945 (patch) | |
tree | 6136ded0706be0d39a09a0a912e8f79a4ab63322 | |
parent | dc7d552705215ac50a0617fcf51bb9c736255b8e (diff) |
consoles: polling support, kgdboc
polled console handling support, to access a console in an irq-less
way while in debug or irq context.
absolutely zero impact as long as CONFIG_CONSOLE_POLL is disabled.
(which is the default)
[ jan.kiszka@siemens.com: lots of cleanups ]
[ mingo@elte.hu: redesign, splitups, cleanups. ]
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | drivers/char/tty_io.c | 47 | ||||
-rw-r--r-- | drivers/serial/8250.c | 58 | ||||
-rw-r--r-- | drivers/serial/Kconfig | 3 | ||||
-rw-r--r-- | drivers/serial/Makefile | 1 | ||||
-rw-r--r-- | drivers/serial/kgdboc.c | 163 | ||||
-rw-r--r-- | drivers/serial/serial_core.c | 72 | ||||
-rw-r--r-- | include/linux/serial_core.h | 4 | ||||
-rw-r--r-- | include/linux/tty_driver.h | 12 |
8 files changed, 357 insertions, 3 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 613ec816ce60..4d3c7018f0c3 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1155,6 +1155,48 @@ static struct tty_driver *get_tty_driver(dev_t device, int *index) | |||
1155 | return NULL; | 1155 | return NULL; |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | #ifdef CONFIG_CONSOLE_POLL | ||
1159 | |||
1160 | /** | ||
1161 | * tty_find_polling_driver - find device of a polled tty | ||
1162 | * @name: name string to match | ||
1163 | * @line: pointer to resulting tty line nr | ||
1164 | * | ||
1165 | * This routine returns a tty driver structure, given a name | ||
1166 | * and the condition that the tty driver is capable of polled | ||
1167 | * operation. | ||
1168 | */ | ||
1169 | struct tty_driver *tty_find_polling_driver(char *name, int *line) | ||
1170 | { | ||
1171 | struct tty_driver *p, *res = NULL; | ||
1172 | int tty_line = 0; | ||
1173 | char *str; | ||
1174 | |||
1175 | mutex_lock(&tty_mutex); | ||
1176 | /* Search through the tty devices to look for a match */ | ||
1177 | list_for_each_entry(p, &tty_drivers, tty_drivers) { | ||
1178 | str = name + strlen(p->name); | ||
1179 | tty_line = simple_strtoul(str, &str, 10); | ||
1180 | if (*str == ',') | ||
1181 | str++; | ||
1182 | if (*str == '\0') | ||
1183 | str = 0; | ||
1184 | |||
1185 | if (tty_line >= 0 && tty_line <= p->num && p->poll_init && | ||
1186 | !p->poll_init(p, tty_line, str)) { | ||
1187 | |||
1188 | res = p; | ||
1189 | *line = tty_line; | ||
1190 | break; | ||
1191 | } | ||
1192 | } | ||
1193 | mutex_unlock(&tty_mutex); | ||
1194 | |||
1195 | return res; | ||
1196 | } | ||
1197 | EXPORT_SYMBOL_GPL(tty_find_polling_driver); | ||
1198 | #endif | ||
1199 | |||
1158 | /** | 1200 | /** |
1159 | * tty_check_change - check for POSIX terminal changes | 1201 | * tty_check_change - check for POSIX terminal changes |
1160 | * @tty: tty to check | 1202 | * @tty: tty to check |
@@ -3850,6 +3892,11 @@ void tty_set_operations(struct tty_driver *driver, | |||
3850 | driver->write_proc = op->write_proc; | 3892 | driver->write_proc = op->write_proc; |
3851 | driver->tiocmget = op->tiocmget; | 3893 | driver->tiocmget = op->tiocmget; |
3852 | driver->tiocmset = op->tiocmset; | 3894 | driver->tiocmset = op->tiocmset; |
3895 | #ifdef CONFIG_CONSOLE_POLL | ||
3896 | driver->poll_init = op->poll_init; | ||
3897 | driver->poll_get_char = op->poll_get_char; | ||
3898 | driver->poll_put_char = op->poll_put_char; | ||
3899 | #endif | ||
3853 | } | 3900 | } |
3854 | 3901 | ||
3855 | 3902 | ||
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 77f7a7f0646e..96a585e1cee8 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -1740,6 +1740,60 @@ static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) | |||
1740 | } | 1740 | } |
1741 | } | 1741 | } |
1742 | 1742 | ||
1743 | #ifdef CONFIG_CONSOLE_POLL | ||
1744 | /* | ||
1745 | * Console polling routines for writing and reading from the uart while | ||
1746 | * in an interrupt or debug context. | ||
1747 | */ | ||
1748 | |||
1749 | static int serial8250_get_poll_char(struct uart_port *port) | ||
1750 | { | ||
1751 | struct uart_8250_port *up = (struct uart_8250_port *)port; | ||
1752 | unsigned char lsr = serial_inp(up, UART_LSR); | ||
1753 | |||
1754 | while (!(lsr & UART_LSR_DR)) | ||
1755 | lsr = serial_inp(up, UART_LSR); | ||
1756 | |||
1757 | return serial_inp(up, UART_RX); | ||
1758 | } | ||
1759 | |||
1760 | |||
1761 | static void serial8250_put_poll_char(struct uart_port *port, | ||
1762 | unsigned char c) | ||
1763 | { | ||
1764 | unsigned int ier; | ||
1765 | struct uart_8250_port *up = (struct uart_8250_port *)port; | ||
1766 | |||
1767 | /* | ||
1768 | * First save the IER then disable the interrupts | ||
1769 | */ | ||
1770 | ier = serial_in(up, UART_IER); | ||
1771 | if (up->capabilities & UART_CAP_UUE) | ||
1772 | serial_out(up, UART_IER, UART_IER_UUE); | ||
1773 | else | ||
1774 | serial_out(up, UART_IER, 0); | ||
1775 | |||
1776 | wait_for_xmitr(up, BOTH_EMPTY); | ||
1777 | /* | ||
1778 | * Send the character out. | ||
1779 | * If a LF, also do CR... | ||
1780 | */ | ||
1781 | serial_out(up, UART_TX, c); | ||
1782 | if (c == 10) { | ||
1783 | wait_for_xmitr(up, BOTH_EMPTY); | ||
1784 | serial_out(up, UART_TX, 13); | ||
1785 | } | ||
1786 | |||
1787 | /* | ||
1788 | * Finally, wait for transmitter to become empty | ||
1789 | * and restore the IER | ||
1790 | */ | ||
1791 | wait_for_xmitr(up, BOTH_EMPTY); | ||
1792 | serial_out(up, UART_IER, ier); | ||
1793 | } | ||
1794 | |||
1795 | #endif /* CONFIG_CONSOLE_POLL */ | ||
1796 | |||
1743 | static int serial8250_startup(struct uart_port *port) | 1797 | static int serial8250_startup(struct uart_port *port) |
1744 | { | 1798 | { |
1745 | struct uart_8250_port *up = (struct uart_8250_port *)port; | 1799 | struct uart_8250_port *up = (struct uart_8250_port *)port; |
@@ -2386,6 +2440,10 @@ static struct uart_ops serial8250_pops = { | |||
2386 | .request_port = serial8250_request_port, | 2440 | .request_port = serial8250_request_port, |
2387 | .config_port = serial8250_config_port, | 2441 | .config_port = serial8250_config_port, |
2388 | .verify_port = serial8250_verify_port, | 2442 | .verify_port = serial8250_verify_port, |
2443 | #ifdef CONFIG_CONSOLE_POLL | ||
2444 | .poll_get_char = serial8250_get_poll_char, | ||
2445 | .poll_put_char = serial8250_put_poll_char, | ||
2446 | #endif | ||
2389 | }; | 2447 | }; |
2390 | 2448 | ||
2391 | static struct uart_8250_port serial8250_ports[UART_NR]; | 2449 | static struct uart_8250_port serial8250_ports[UART_NR]; |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index cf627cd1b4c8..f7cd9504d811 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -961,6 +961,9 @@ config SERIAL_CORE | |||
961 | config SERIAL_CORE_CONSOLE | 961 | config SERIAL_CORE_CONSOLE |
962 | bool | 962 | bool |
963 | 963 | ||
964 | config CONSOLE_POLL | ||
965 | bool | ||
966 | |||
964 | config SERIAL_68328 | 967 | config SERIAL_68328 |
965 | bool "68328 serial support" | 968 | bool "68328 serial support" |
966 | depends on M68328 || M68EZ328 || M68VZ328 | 969 | depends on M68328 || M68EZ328 || M68VZ328 |
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 640cfe44a56d..3cbea5494724 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile | |||
@@ -66,4 +66,5 @@ obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o | |||
66 | obj-$(CONFIG_SERIAL_NETX) += netx-serial.o | 66 | obj-$(CONFIG_SERIAL_NETX) += netx-serial.o |
67 | obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o | 67 | obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o |
68 | obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o | 68 | obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o |
69 | obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o | ||
69 | obj-$(CONFIG_SERIAL_QE) += ucc_uart.o | 70 | obj-$(CONFIG_SERIAL_QE) += ucc_uart.o |
diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c new file mode 100644 index 000000000000..341830791608 --- /dev/null +++ b/drivers/serial/kgdboc.c | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | * Based on the same principle as kgdboe using the NETPOLL api, this | ||
3 | * driver uses a console polling api to implement a gdb serial inteface | ||
4 | * which is multiplexed on a console port. | ||
5 | * | ||
6 | * Maintainer: Jason Wessel <jason.wessel@windriver.com> | ||
7 | * | ||
8 | * 2007-2008 (c) Jason Wessel - Wind River Systems, Inc. | ||
9 | * | ||
10 | * This file is licensed under the terms of the GNU General Public | ||
11 | * License version 2. This program is licensed "as is" without any | ||
12 | * warranty of any kind, whether express or implied. | ||
13 | */ | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/ctype.h> | ||
16 | #include <linux/kgdb.h> | ||
17 | #include <linux/tty.h> | ||
18 | |||
19 | #define MAX_CONFIG_LEN 40 | ||
20 | |||
21 | static struct kgdb_io kgdboc_io_ops; | ||
22 | |||
23 | /* -1 = init not run yet, 0 = unconfigured, 1 = configured. */ | ||
24 | static int configured = -1; | ||
25 | |||
26 | static char config[MAX_CONFIG_LEN]; | ||
27 | static struct kparam_string kps = { | ||
28 | .string = config, | ||
29 | .maxlen = MAX_CONFIG_LEN, | ||
30 | }; | ||
31 | |||
32 | static struct tty_driver *kgdb_tty_driver; | ||
33 | static int kgdb_tty_line; | ||
34 | |||
35 | static int kgdboc_option_setup(char *opt) | ||
36 | { | ||
37 | if (strlen(opt) > MAX_CONFIG_LEN) { | ||
38 | printk(KERN_ERR "kgdboc: config string too long\n"); | ||
39 | return -ENOSPC; | ||
40 | } | ||
41 | strcpy(config, opt); | ||
42 | |||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | __setup("kgdboc=", kgdboc_option_setup); | ||
47 | |||
48 | static int configure_kgdboc(void) | ||
49 | { | ||
50 | struct tty_driver *p; | ||
51 | int tty_line = 0; | ||
52 | int err; | ||
53 | |||
54 | err = kgdboc_option_setup(config); | ||
55 | if (err || !strlen(config) || isspace(config[0])) | ||
56 | goto noconfig; | ||
57 | |||
58 | err = -ENODEV; | ||
59 | |||
60 | p = tty_find_polling_driver(config, &tty_line); | ||
61 | if (!p) | ||
62 | goto noconfig; | ||
63 | |||
64 | kgdb_tty_driver = p; | ||
65 | kgdb_tty_line = tty_line; | ||
66 | |||
67 | err = kgdb_register_io_module(&kgdboc_io_ops); | ||
68 | if (err) | ||
69 | goto noconfig; | ||
70 | |||
71 | configured = 1; | ||
72 | |||
73 | return 0; | ||
74 | |||
75 | noconfig: | ||
76 | config[0] = 0; | ||
77 | configured = 0; | ||
78 | |||
79 | return err; | ||
80 | } | ||
81 | |||
82 | static int __init init_kgdboc(void) | ||
83 | { | ||
84 | /* Already configured? */ | ||
85 | if (configured == 1) | ||
86 | return 0; | ||
87 | |||
88 | return configure_kgdboc(); | ||
89 | } | ||
90 | |||
91 | static void cleanup_kgdboc(void) | ||
92 | { | ||
93 | if (configured == 1) | ||
94 | kgdb_unregister_io_module(&kgdboc_io_ops); | ||
95 | } | ||
96 | |||
97 | static int kgdboc_get_char(void) | ||
98 | { | ||
99 | return kgdb_tty_driver->poll_get_char(kgdb_tty_driver, kgdb_tty_line); | ||
100 | } | ||
101 | |||
102 | static void kgdboc_put_char(u8 chr) | ||
103 | { | ||
104 | kgdb_tty_driver->poll_put_char(kgdb_tty_driver, kgdb_tty_line, chr); | ||
105 | } | ||
106 | |||
107 | static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp) | ||
108 | { | ||
109 | if (strlen(kmessage) >= MAX_CONFIG_LEN) { | ||
110 | printk(KERN_ERR "kgdboc: config string too long\n"); | ||
111 | return -ENOSPC; | ||
112 | } | ||
113 | |||
114 | /* Only copy in the string if the init function has not run yet */ | ||
115 | if (configured < 0) { | ||
116 | strcpy(config, kmessage); | ||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | if (kgdb_connected) { | ||
121 | printk(KERN_ERR | ||
122 | "kgdboc: Cannot reconfigure while KGDB is connected.\n"); | ||
123 | |||
124 | return -EBUSY; | ||
125 | } | ||
126 | |||
127 | strcpy(config, kmessage); | ||
128 | |||
129 | if (configured == 1) | ||
130 | cleanup_kgdboc(); | ||
131 | |||
132 | /* Go and configure with the new params. */ | ||
133 | return configure_kgdboc(); | ||
134 | } | ||
135 | |||
136 | static void kgdboc_pre_exp_handler(void) | ||
137 | { | ||
138 | /* Increment the module count when the debugger is active */ | ||
139 | if (!kgdb_connected) | ||
140 | try_module_get(THIS_MODULE); | ||
141 | } | ||
142 | |||
143 | static void kgdboc_post_exp_handler(void) | ||
144 | { | ||
145 | /* decrement the module count when the debugger detaches */ | ||
146 | if (!kgdb_connected) | ||
147 | module_put(THIS_MODULE); | ||
148 | } | ||
149 | |||
150 | static struct kgdb_io kgdboc_io_ops = { | ||
151 | .name = "kgdboc", | ||
152 | .read_char = kgdboc_get_char, | ||
153 | .write_char = kgdboc_put_char, | ||
154 | .pre_exception = kgdboc_pre_exp_handler, | ||
155 | .post_exception = kgdboc_post_exp_handler, | ||
156 | }; | ||
157 | |||
158 | module_init(init_kgdboc); | ||
159 | module_exit(cleanup_kgdboc); | ||
160 | module_param_call(kgdboc, param_set_kgdboc_var, param_get_string, &kps, 0644); | ||
161 | MODULE_PARM_DESC(kgdboc, "<serial_device>[,baud]"); | ||
162 | MODULE_DESCRIPTION("KGDB Console TTY Driver"); | ||
163 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 0f5a17987cca..4d7eecbead9b 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1827,7 +1827,7 @@ uart_get_console(struct uart_port *ports, int nr, struct console *co) | |||
1827 | * options. The format of the string is <baud><parity><bits><flow>, | 1827 | * options. The format of the string is <baud><parity><bits><flow>, |
1828 | * eg: 115200n8r | 1828 | * eg: 115200n8r |
1829 | */ | 1829 | */ |
1830 | void __init | 1830 | void |
1831 | uart_parse_options(char *options, int *baud, int *parity, int *bits, int *flow) | 1831 | uart_parse_options(char *options, int *baud, int *parity, int *bits, int *flow) |
1832 | { | 1832 | { |
1833 | char *s = options; | 1833 | char *s = options; |
@@ -1842,6 +1842,7 @@ uart_parse_options(char *options, int *baud, int *parity, int *bits, int *flow) | |||
1842 | if (*s) | 1842 | if (*s) |
1843 | *flow = *s; | 1843 | *flow = *s; |
1844 | } | 1844 | } |
1845 | EXPORT_SYMBOL_GPL(uart_parse_options); | ||
1845 | 1846 | ||
1846 | struct baud_rates { | 1847 | struct baud_rates { |
1847 | unsigned int rate; | 1848 | unsigned int rate; |
@@ -1872,7 +1873,7 @@ static const struct baud_rates baud_rates[] = { | |||
1872 | * @bits: number of data bits | 1873 | * @bits: number of data bits |
1873 | * @flow: flow control character - 'r' (rts) | 1874 | * @flow: flow control character - 'r' (rts) |
1874 | */ | 1875 | */ |
1875 | int __init | 1876 | int |
1876 | uart_set_options(struct uart_port *port, struct console *co, | 1877 | uart_set_options(struct uart_port *port, struct console *co, |
1877 | int baud, int parity, int bits, int flow) | 1878 | int baud, int parity, int bits, int flow) |
1878 | { | 1879 | { |
@@ -1924,10 +1925,16 @@ uart_set_options(struct uart_port *port, struct console *co, | |||
1924 | port->mctrl |= TIOCM_DTR; | 1925 | port->mctrl |= TIOCM_DTR; |
1925 | 1926 | ||
1926 | port->ops->set_termios(port, &termios, &dummy); | 1927 | port->ops->set_termios(port, &termios, &dummy); |
1927 | co->cflag = termios.c_cflag; | 1928 | /* |
1929 | * Allow the setting of the UART parameters with a NULL console | ||
1930 | * too: | ||
1931 | */ | ||
1932 | if (co) | ||
1933 | co->cflag = termios.c_cflag; | ||
1928 | 1934 | ||
1929 | return 0; | 1935 | return 0; |
1930 | } | 1936 | } |
1937 | EXPORT_SYMBOL_GPL(uart_set_options); | ||
1931 | #endif /* CONFIG_SERIAL_CORE_CONSOLE */ | 1938 | #endif /* CONFIG_SERIAL_CORE_CONSOLE */ |
1932 | 1939 | ||
1933 | static void uart_change_pm(struct uart_state *state, int pm_state) | 1940 | static void uart_change_pm(struct uart_state *state, int pm_state) |
@@ -2182,6 +2189,60 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, | |||
2182 | } | 2189 | } |
2183 | } | 2190 | } |
2184 | 2191 | ||
2192 | #ifdef CONFIG_CONSOLE_POLL | ||
2193 | |||
2194 | static int uart_poll_init(struct tty_driver *driver, int line, char *options) | ||
2195 | { | ||
2196 | struct uart_driver *drv = driver->driver_state; | ||
2197 | struct uart_state *state = drv->state + line; | ||
2198 | struct uart_port *port; | ||
2199 | int baud = 9600; | ||
2200 | int bits = 8; | ||
2201 | int parity = 'n'; | ||
2202 | int flow = 'n'; | ||
2203 | |||
2204 | if (!state || !state->port) | ||
2205 | return -1; | ||
2206 | |||
2207 | port = state->port; | ||
2208 | if (!(port->ops->poll_get_char && port->ops->poll_put_char)) | ||
2209 | return -1; | ||
2210 | |||
2211 | if (options) { | ||
2212 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
2213 | return uart_set_options(port, NULL, baud, parity, bits, flow); | ||
2214 | } | ||
2215 | |||
2216 | return 0; | ||
2217 | } | ||
2218 | |||
2219 | static int uart_poll_get_char(struct tty_driver *driver, int line) | ||
2220 | { | ||
2221 | struct uart_driver *drv = driver->driver_state; | ||
2222 | struct uart_state *state = drv->state + line; | ||
2223 | struct uart_port *port; | ||
2224 | |||
2225 | if (!state || !state->port) | ||
2226 | return -1; | ||
2227 | |||
2228 | port = state->port; | ||
2229 | return port->ops->poll_get_char(port); | ||
2230 | } | ||
2231 | |||
2232 | static void uart_poll_put_char(struct tty_driver *driver, int line, char ch) | ||
2233 | { | ||
2234 | struct uart_driver *drv = driver->driver_state; | ||
2235 | struct uart_state *state = drv->state + line; | ||
2236 | struct uart_port *port; | ||
2237 | |||
2238 | if (!state || !state->port) | ||
2239 | return; | ||
2240 | |||
2241 | port = state->port; | ||
2242 | port->ops->poll_put_char(port, ch); | ||
2243 | } | ||
2244 | #endif | ||
2245 | |||
2185 | static const struct tty_operations uart_ops = { | 2246 | static const struct tty_operations uart_ops = { |
2186 | .open = uart_open, | 2247 | .open = uart_open, |
2187 | .close = uart_close, | 2248 | .close = uart_close, |
@@ -2206,6 +2267,11 @@ static const struct tty_operations uart_ops = { | |||
2206 | #endif | 2267 | #endif |
2207 | .tiocmget = uart_tiocmget, | 2268 | .tiocmget = uart_tiocmget, |
2208 | .tiocmset = uart_tiocmset, | 2269 | .tiocmset = uart_tiocmset, |
2270 | #ifdef CONFIG_CONSOLE_POLL | ||
2271 | .poll_init = uart_poll_init, | ||
2272 | .poll_get_char = uart_poll_get_char, | ||
2273 | .poll_put_char = uart_poll_put_char, | ||
2274 | #endif | ||
2209 | }; | 2275 | }; |
2210 | 2276 | ||
2211 | /** | 2277 | /** |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 289942fc6655..7cb094a82456 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -213,6 +213,10 @@ struct uart_ops { | |||
213 | void (*config_port)(struct uart_port *, int); | 213 | void (*config_port)(struct uart_port *, int); |
214 | int (*verify_port)(struct uart_port *, struct serial_struct *); | 214 | int (*verify_port)(struct uart_port *, struct serial_struct *); |
215 | int (*ioctl)(struct uart_port *, unsigned int, unsigned long); | 215 | int (*ioctl)(struct uart_port *, unsigned int, unsigned long); |
216 | #ifdef CONFIG_CONSOLE_POLL | ||
217 | void (*poll_put_char)(struct uart_port *, unsigned char); | ||
218 | int (*poll_get_char)(struct uart_port *); | ||
219 | #endif | ||
216 | }; | 220 | }; |
217 | 221 | ||
218 | #define UART_CONFIG_TYPE (1 << 0) | 222 | #define UART_CONFIG_TYPE (1 << 0) |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 85c95cd39bc3..21f69aca4505 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -125,6 +125,7 @@ | |||
125 | #include <linux/cdev.h> | 125 | #include <linux/cdev.h> |
126 | 126 | ||
127 | struct tty_struct; | 127 | struct tty_struct; |
128 | struct tty_driver; | ||
128 | 129 | ||
129 | struct tty_operations { | 130 | struct tty_operations { |
130 | int (*open)(struct tty_struct * tty, struct file * filp); | 131 | int (*open)(struct tty_struct * tty, struct file * filp); |
@@ -157,6 +158,11 @@ struct tty_operations { | |||
157 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 158 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
158 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 159 | int (*tiocmset)(struct tty_struct *tty, struct file *file, |
159 | unsigned int set, unsigned int clear); | 160 | unsigned int set, unsigned int clear); |
161 | #ifdef CONFIG_CONSOLE_POLL | ||
162 | int (*poll_init)(struct tty_driver *driver, int line, char *options); | ||
163 | int (*poll_get_char)(struct tty_driver *driver, int line); | ||
164 | void (*poll_put_char)(struct tty_driver *driver, int line, char ch); | ||
165 | #endif | ||
160 | }; | 166 | }; |
161 | 167 | ||
162 | struct tty_driver { | 168 | struct tty_driver { |
@@ -220,6 +226,11 @@ struct tty_driver { | |||
220 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 226 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
221 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 227 | int (*tiocmset)(struct tty_struct *tty, struct file *file, |
222 | unsigned int set, unsigned int clear); | 228 | unsigned int set, unsigned int clear); |
229 | #ifdef CONFIG_CONSOLE_POLL | ||
230 | int (*poll_init)(struct tty_driver *driver, int line, char *options); | ||
231 | int (*poll_get_char)(struct tty_driver *driver, int line); | ||
232 | void (*poll_put_char)(struct tty_driver *driver, int line, char ch); | ||
233 | #endif | ||
223 | 234 | ||
224 | struct list_head tty_drivers; | 235 | struct list_head tty_drivers; |
225 | }; | 236 | }; |
@@ -230,6 +241,7 @@ struct tty_driver *alloc_tty_driver(int lines); | |||
230 | void put_tty_driver(struct tty_driver *driver); | 241 | void put_tty_driver(struct tty_driver *driver); |
231 | void tty_set_operations(struct tty_driver *driver, | 242 | void tty_set_operations(struct tty_driver *driver, |
232 | const struct tty_operations *op); | 243 | const struct tty_operations *op); |
244 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | ||
233 | 245 | ||
234 | /* tty driver magic number */ | 246 | /* tty driver magic number */ |
235 | #define TTY_DRIVER_MAGIC 0x5402 | 247 | #define TTY_DRIVER_MAGIC 0x5402 |