powerpc: Put exception configuration in a common place
[cascardo/linux.git] / arch / powerpc / platforms / powernv / opal.c
index 0256d07..8b4fc68 100644 (file)
@@ -55,8 +55,9 @@ struct device_node *opal_node;
 static DEFINE_SPINLOCK(opal_write_lock);
 static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX];
 static uint32_t opal_heartbeat;
+static struct task_struct *kopald_tsk;
 
-static void opal_reinit_cores(void)
+void opal_configure_cores(void)
 {
        /* Do the actual re-init, This will clobber all FPRs, VRs, etc...
         *
@@ -69,6 +70,10 @@ static void opal_reinit_cores(void)
 #else
        opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_LE);
 #endif
+
+       /* Restore some bits */
+       if (cur_cpu_spec->cpu_restore)
+               cur_cpu_spec->cpu_restore();
 }
 
 int __init early_init_dt_scan_opal(unsigned long node,
@@ -105,13 +110,6 @@ int __init early_init_dt_scan_opal(unsigned long node,
                panic("OPAL != V3 detected, no longer supported.\n");
        }
 
-       /* Reinit all cores with the right endian */
-       opal_reinit_cores();
-
-       /* Restore some bits */
-       if (cur_cpu_spec->cpu_restore)
-               cur_cpu_spec->cpu_restore();
-
        return 1;
 }
 
@@ -653,6 +651,7 @@ static void opal_i2c_create_devs(void)
 
 static int kopald(void *unused)
 {
+       unsigned long timeout = msecs_to_jiffies(opal_heartbeat) + 1;
        __be64 events;
 
        set_freezable();
@@ -660,12 +659,18 @@ static int kopald(void *unused)
                try_to_freeze();
                opal_poll_events(&events);
                opal_handle_events(be64_to_cpu(events));
-               msleep_interruptible(opal_heartbeat);
+               schedule_timeout_interruptible(timeout);
        } while (!kthread_should_stop());
 
        return 0;
 }
 
+void opal_wake_poller(void)
+{
+       if (kopald_tsk)
+               wake_up_process(kopald_tsk);
+}
+
 static void opal_init_heartbeat(void)
 {
        /* Old firwmware, we assume the HVC heartbeat is sufficient */
@@ -674,7 +679,7 @@ static void opal_init_heartbeat(void)
                opal_heartbeat = 0;
 
        if (opal_heartbeat)
-               kthread_run(kopald, NULL, "kopald");
+               kopald_tsk = kthread_run(kopald, NULL, "kopald");
 }
 
 static int __init opal_init(void)
@@ -751,6 +756,9 @@ static int __init opal_init(void)
        opal_pdev_init(opal_node, "ibm,opal-flash");
        opal_pdev_init(opal_node, "ibm,opal-prd");
 
+       /* Initialise platform device: oppanel interface */
+       opal_pdev_init(opal_node, "ibm,opal-oppanel");
+
        /* Initialise OPAL kmsg dumper for flushing console on panic */
        opal_kmsg_init();
 
@@ -885,3 +893,5 @@ EXPORT_SYMBOL_GPL(opal_i2c_request);
 /* Export these symbols for PowerNV LED class driver */
 EXPORT_SYMBOL_GPL(opal_leds_get_ind);
 EXPORT_SYMBOL_GPL(opal_leds_set_ind);
+/* Export this symbol for PowerNV Operator Panel class driver */
+EXPORT_SYMBOL_GPL(opal_write_oppanel_async);