aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ppc64/kernel/hvconsole.c3
-rw-r--r--drivers/char/hvc_console.c24
-rw-r--r--include/asm-ppc64/hvconsole.h5
3 files changed, 25 insertions, 7 deletions
diff --git a/arch/ppc64/kernel/hvconsole.c b/arch/ppc64/kernel/hvconsole.c
index c72fb8ffe974..94fb06198ea2 100644
--- a/arch/ppc64/kernel/hvconsole.c
+++ b/arch/ppc64/kernel/hvconsole.c
@@ -93,7 +93,7 @@ EXPORT_SYMBOL(hvc_put_chars);
93 * We hope/assume that the first vty found corresponds to the first console 93 * We hope/assume that the first vty found corresponds to the first console
94 * device. 94 * device.
95 */ 95 */
96int hvc_find_vtys(void) 96static int hvc_find_vtys(void)
97{ 97{
98 struct device_node *vty; 98 struct device_node *vty;
99 int num_found = 0; 99 int num_found = 0;
@@ -119,3 +119,4 @@ int hvc_find_vtys(void)
119 119
120 return num_found; 120 return num_found;
121} 121}
122console_initcall(hvc_find_vtys);
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 7bc65a76dfc4..d59c642f9654 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -219,10 +219,23 @@ struct console hvc_con_driver = {
219 .index = -1, 219 .index = -1,
220}; 220};
221 221
222/* Early console initialization. Preceeds driver initialization. */ 222/*
223 * Early console initialization. Preceeds driver initialization.
224 *
225 * (1) we are first, and the user specified another driver
226 * -- index will remain -1
227 * (2) we are first and the user specified no driver
228 * -- index will be set to 0, then we will fail setup.
229 * (3) we are first and the user specified our driver
230 * -- index will be set to user specified driver, and we will fail
231 * (4) we are after driver, and this initcall will register us
232 * -- if the user didn't specify a driver then the console will match
233 *
234 * Note that for cases 2 and 3, we will match later when the io driver
235 * calls hvc_instantiate() and call register again.
236 */
223static int __init hvc_console_init(void) 237static int __init hvc_console_init(void)
224{ 238{
225 hvc_find_vtys();
226 register_console(&hvc_con_driver); 239 register_console(&hvc_con_driver);
227 return 0; 240 return 0;
228} 241}
@@ -257,6 +270,13 @@ int hvc_instantiate(uint32_t vtermno, int index)
257 if (last_hvc < index) 270 if (last_hvc < index)
258 last_hvc = index; 271 last_hvc = index;
259 272
273 /* if this index is what the user requested, then register
274 * now (setup won't fail at this point). It's ok to just
275 * call register again if previously .setup failed.
276 */
277 if (index == hvc_con_driver.index)
278 register_console(&hvc_con_driver);
279
260 return 0; 280 return 0;
261} 281}
262 282
diff --git a/include/asm-ppc64/hvconsole.h b/include/asm-ppc64/hvconsole.h
index d89d94c91815..91c2414ac00b 100644
--- a/include/asm-ppc64/hvconsole.h
+++ b/include/asm-ppc64/hvconsole.h
@@ -32,9 +32,6 @@
32extern int hvc_get_chars(uint32_t vtermno, char *buf, int count); 32extern int hvc_get_chars(uint32_t vtermno, char *buf, int count);
33extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count); 33extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count);
34 34
35/* Early discovery of console adapters. */ 35/* Register a vterm and a slot index for use as a console */
36extern int hvc_find_vtys(void);
37
38/* Implemented by a console driver */
39extern int hvc_instantiate(uint32_t vtermno, int index); 36extern int hvc_instantiate(uint32_t vtermno, int index);
40#endif /* _PPC64_HVCONSOLE_H */ 37#endif /* _PPC64_HVCONSOLE_H */