diff options
Diffstat (limited to 'drivers/tty/hvc/hvc_opal.c')
| -rw-r--r-- | drivers/tty/hvc/hvc_opal.c | 34 | 
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c index cd69b48f6df..a585079b4b3 100644 --- a/drivers/tty/hvc/hvc_opal.c +++ b/drivers/tty/hvc/hvc_opal.c @@ -61,6 +61,7 @@ static struct hvc_opal_priv *hvc_opal_privs[MAX_NR_HVC_CONSOLES];  /* For early boot console */  static struct hvc_opal_priv hvc_opal_boot_priv;  static u32 hvc_opal_boot_termno; +static bool hvc_opal_event_registered;  static const struct hv_ops hvc_opal_raw_ops = {  	.get_chars = opal_get_chars, @@ -161,6 +162,18 @@ static const struct hv_ops hvc_opal_hvsi_ops = {  	.tiocmset = hvc_opal_hvsi_tiocmset,  }; +static int hvc_opal_console_event(struct notifier_block *nb, +				  unsigned long events, void *change) +{ +	if (events & OPAL_EVENT_CONSOLE_INPUT) +		hvc_kick(); +	return 0; +} + +static struct notifier_block hvc_opal_console_nb = { +	.notifier_call	= hvc_opal_console_event, +}; +  static int hvc_opal_probe(struct platform_device *dev)  {  	const struct hv_ops *ops; @@ -170,6 +183,7 @@ static int hvc_opal_probe(struct platform_device *dev)  	unsigned int termno, boot = 0;  	const __be32 *reg; +  	if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) {  		proto = HV_PROTOCOL_RAW;  		ops = &hvc_opal_raw_ops; @@ -213,12 +227,18 @@ static int hvc_opal_probe(struct platform_device *dev)  		dev->dev.of_node->full_name,  		boot ? " (boot console)" : ""); -	/* We don't do IRQ yet */ +	/* We don't do IRQ ... */  	hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS);  	if (IS_ERR(hp))  		return PTR_ERR(hp);  	dev_set_drvdata(&dev->dev, hp); +	/* ...  but we use OPAL event to kick the console */ +	if (!hvc_opal_event_registered) { +		opal_notifier_register(&hvc_opal_console_nb); +		hvc_opal_event_registered = true; +	} +  	return 0;  } @@ -255,13 +275,7 @@ static int __init hvc_opal_init(void)  	/* Register as a vio device to receive callbacks */  	return platform_driver_register(&hvc_opal_driver);  } -module_init(hvc_opal_init); - -static void __exit hvc_opal_exit(void) -{ -	platform_driver_unregister(&hvc_opal_driver); -} -module_exit(hvc_opal_exit); +device_initcall(hvc_opal_init);  static void udbg_opal_putc(char c)  { @@ -329,7 +343,7 @@ static void udbg_init_opal_common(void)  void __init hvc_opal_init_early(void)  {  	struct device_node *stdout_node = NULL; -	const u32 *termno; +	const __be32 *termno;  	const char *name = NULL;  	const struct hv_ops *ops;  	u32 index; @@ -371,7 +385,7 @@ void __init hvc_opal_init_early(void)  	if (!stdout_node)  		return;  	termno = of_get_property(stdout_node, "reg", NULL); -	index = termno ? *termno : 0; +	index = termno ? be32_to_cpup(termno) : 0;  	if (index >= MAX_NR_HVC_CONSOLES)  		return;  	hvc_opal_privs[index] = &hvc_opal_boot_priv;  | 
