aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/hvc/hvc_opal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/hvc/hvc_opal.c')
-rw-r--r--drivers/tty/hvc/hvc_opal.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
index b01659bd4f7c..a585079b4b38 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];
61/* For early boot console */ 61/* For early boot console */
62static struct hvc_opal_priv hvc_opal_boot_priv; 62static struct hvc_opal_priv hvc_opal_boot_priv;
63static u32 hvc_opal_boot_termno; 63static u32 hvc_opal_boot_termno;
64static bool hvc_opal_event_registered;
64 65
65static const struct hv_ops hvc_opal_raw_ops = { 66static const struct hv_ops hvc_opal_raw_ops = {
66 .get_chars = opal_get_chars, 67 .get_chars = opal_get_chars,
@@ -161,6 +162,18 @@ static const struct hv_ops hvc_opal_hvsi_ops = {
161 .tiocmset = hvc_opal_hvsi_tiocmset, 162 .tiocmset = hvc_opal_hvsi_tiocmset,
162}; 163};
163 164
165static int hvc_opal_console_event(struct notifier_block *nb,
166 unsigned long events, void *change)
167{
168 if (events & OPAL_EVENT_CONSOLE_INPUT)
169 hvc_kick();
170 return 0;
171}
172
173static struct notifier_block hvc_opal_console_nb = {
174 .notifier_call = hvc_opal_console_event,
175};
176
164static int hvc_opal_probe(struct platform_device *dev) 177static int hvc_opal_probe(struct platform_device *dev)
165{ 178{
166 const struct hv_ops *ops; 179 const struct hv_ops *ops;
@@ -170,6 +183,7 @@ static int hvc_opal_probe(struct platform_device *dev)
170 unsigned int termno, boot = 0; 183 unsigned int termno, boot = 0;
171 const __be32 *reg; 184 const __be32 *reg;
172 185
186
173 if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) { 187 if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) {
174 proto = HV_PROTOCOL_RAW; 188 proto = HV_PROTOCOL_RAW;
175 ops = &hvc_opal_raw_ops; 189 ops = &hvc_opal_raw_ops;
@@ -213,12 +227,18 @@ static int hvc_opal_probe(struct platform_device *dev)
213 dev->dev.of_node->full_name, 227 dev->dev.of_node->full_name,
214 boot ? " (boot console)" : ""); 228 boot ? " (boot console)" : "");
215 229
216 /* We don't do IRQ yet */ 230 /* We don't do IRQ ... */
217 hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS); 231 hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS);
218 if (IS_ERR(hp)) 232 if (IS_ERR(hp))
219 return PTR_ERR(hp); 233 return PTR_ERR(hp);
220 dev_set_drvdata(&dev->dev, hp); 234 dev_set_drvdata(&dev->dev, hp);
221 235
236 /* ... but we use OPAL event to kick the console */
237 if (!hvc_opal_event_registered) {
238 opal_notifier_register(&hvc_opal_console_nb);
239 hvc_opal_event_registered = true;
240 }
241
222 return 0; 242 return 0;
223} 243}
224 244