]> Git Repo - J-linux.git/blobdiff - arch/openrisc/kernel/process.c
Merge tag 'kthread-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel...
[J-linux.git] / arch / openrisc / kernel / process.c
index d9697cc9bc4ddb4ab3956013e7ec96c69d50af69..52dc983ddeba30c6e978aa683e256be746da7139 100644 (file)
@@ -52,6 +52,8 @@ void machine_restart(char *cmd)
 {
        do_kernel_restart(cmd);
 
+       __asm__("l.nop 13");
+
        /* Give a grace period for failure to restart of 1s */
        mdelay(1000);
 
@@ -60,6 +62,16 @@ void machine_restart(char *cmd)
        while (1);
 }
 
+/*
+ * This is used if pm_power_off has not been set by a power management
+ * driver, in this case we can assume we are on a simulator.  On
+ * OpenRISC simulators l.nop 1 will trigger the simulator exit.
+ */
+static void default_power_off(void)
+{
+       __asm__("l.nop 1");
+}
+
 /*
  * Similar to machine_power_off, but don't shut off power.  Add code
  * here to freeze the system for e.g. post-mortem debug purpose when
@@ -75,7 +87,10 @@ void machine_halt(void)
 void machine_power_off(void)
 {
        printk(KERN_INFO "*** MACHINE POWER OFF ***\n");
-       __asm__("l.nop 1");
+       if (pm_power_off != NULL)
+               pm_power_off();
+       else
+               default_power_off();
 }
 
 /*
@@ -89,7 +104,7 @@ void arch_cpu_idle(void)
                mtspr(SPR_PMR, mfspr(SPR_PMR) | SPR_PMR_DME);
 }
 
-void (*pm_power_off) (void) = machine_power_off;
+void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 
 /*
This page took 0.028227 seconds and 4 git commands to generate.