tty: Update hypervisor tty drivers to use core stdout parsing code.
The evh_bytechan, hvc_opal and hvc_vio drivers all open code the parsing of the stdout node in the device tree. This patch simplifies the driver by removing the duplicated functionality. Signed-off-by: Grant Likely <grant.likely@linaro.org>
此提交包含在:
@@ -342,22 +342,13 @@ static void udbg_init_opal_common(void)
|
||||
|
||||
void __init hvc_opal_init_early(void)
|
||||
{
|
||||
struct device_node *stdout_node = NULL;
|
||||
struct device_node *stdout_node = of_node_get(of_stdout);
|
||||
const __be32 *termno;
|
||||
const char *name = NULL;
|
||||
const struct hv_ops *ops;
|
||||
u32 index;
|
||||
|
||||
/* find the boot console from /chosen/stdout */
|
||||
if (of_chosen)
|
||||
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
|
||||
if (name) {
|
||||
stdout_node = of_find_node_by_path(name);
|
||||
if (!stdout_node) {
|
||||
pr_err("hvc_opal: Failed to locate default console!\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/* If the console wasn't in /chosen, try /ibm,opal */
|
||||
if (!stdout_node) {
|
||||
struct device_node *opal, *np;
|
||||
|
||||
/* Current OPAL takeover doesn't provide the stdout
|
||||
|
@@ -404,42 +404,35 @@ module_exit(hvc_vio_exit);
|
||||
|
||||
void __init hvc_vio_init_early(void)
|
||||
{
|
||||
struct device_node *stdout_node;
|
||||
const __be32 *termno;
|
||||
const char *name;
|
||||
const struct hv_ops *ops;
|
||||
|
||||
/* find the boot console from /chosen/stdout */
|
||||
if (!of_chosen)
|
||||
if (!of_stdout)
|
||||
return;
|
||||
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
|
||||
if (name == NULL)
|
||||
return;
|
||||
stdout_node = of_find_node_by_path(name);
|
||||
if (!stdout_node)
|
||||
return;
|
||||
name = of_get_property(stdout_node, "name", NULL);
|
||||
name = of_get_property(of_stdout, "name", NULL);
|
||||
if (!name) {
|
||||
printk(KERN_WARNING "stdout node missing 'name' property!\n");
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if it's a virtual terminal */
|
||||
if (strncmp(name, "vty", 3) != 0)
|
||||
goto out;
|
||||
termno = of_get_property(stdout_node, "reg", NULL);
|
||||
return;
|
||||
termno = of_get_property(of_stdout, "reg", NULL);
|
||||
if (termno == NULL)
|
||||
goto out;
|
||||
return;
|
||||
hvterm_priv0.termno = of_read_number(termno, 1);
|
||||
spin_lock_init(&hvterm_priv0.buf_lock);
|
||||
hvterm_privs[0] = &hvterm_priv0;
|
||||
|
||||
/* Check the protocol */
|
||||
if (of_device_is_compatible(stdout_node, "hvterm1")) {
|
||||
if (of_device_is_compatible(of_stdout, "hvterm1")) {
|
||||
hvterm_priv0.proto = HV_PROTOCOL_RAW;
|
||||
ops = &hvterm_raw_ops;
|
||||
}
|
||||
else if (of_device_is_compatible(stdout_node, "hvterm-protocol")) {
|
||||
else if (of_device_is_compatible(of_stdout, "hvterm-protocol")) {
|
||||
hvterm_priv0.proto = HV_PROTOCOL_HVSI;
|
||||
ops = &hvterm_hvsi_ops;
|
||||
hvsilib_init(&hvterm_priv0.hvsi, hvc_get_chars, hvc_put_chars,
|
||||
@@ -447,7 +440,7 @@ void __init hvc_vio_init_early(void)
|
||||
/* HVSI, perform the handshake now */
|
||||
hvsilib_establish(&hvterm_priv0.hvsi);
|
||||
} else
|
||||
goto out;
|
||||
return;
|
||||
udbg_putc = udbg_hvc_putc;
|
||||
udbg_getc = udbg_hvc_getc;
|
||||
udbg_getc_poll = udbg_hvc_getc_poll;
|
||||
@@ -456,14 +449,12 @@ void __init hvc_vio_init_early(void)
|
||||
* backend for HVSI, only do udbg
|
||||
*/
|
||||
if (hvterm_priv0.proto == HV_PROTOCOL_HVSI)
|
||||
goto out;
|
||||
return;
|
||||
#endif
|
||||
/* Check whether the user has requested a different console. */
|
||||
if (!strstr(cmd_line, "console="))
|
||||
add_preferred_console("hvc", 0, NULL);
|
||||
hvc_instantiate(0, 0, ops);
|
||||
out:
|
||||
of_node_put(stdout_node);
|
||||
}
|
||||
|
||||
/* call this from early_init() for a working debug console on
|
||||
|
新增問題並參考
封鎖使用者