0001
0002
0003
0004
0005
0006 #include <linux/kernel.h>
0007 #include <linux/reboot.h>
0008 #include <linux/export.h>
0009 #include <linux/pm.h>
0010 #include <linux/of.h>
0011
0012 #include <asm/oplib.h>
0013 #include <asm/prom.h>
0014 #include <asm/setup.h>
0015
0016
0017
0018
0019 int scons_pwroff = 1;
0020
0021
0022
0023
0024 void (*pm_power_off)(void) = machine_power_off;
0025 EXPORT_SYMBOL(pm_power_off);
0026
0027 void machine_power_off(void)
0028 {
0029 if (!of_node_is_type(of_console_device, "serial") || scons_pwroff)
0030 prom_halt_power_off();
0031
0032 prom_halt();
0033 }
0034
0035 void machine_halt(void)
0036 {
0037 prom_halt();
0038 panic("Halt failed!");
0039 }
0040
0041 void machine_restart(char *cmd)
0042 {
0043 char *p;
0044
0045 p = strchr(reboot_command, '\n');
0046 if (p)
0047 *p = 0;
0048 if (cmd)
0049 prom_reboot(cmd);
0050 if (*reboot_command)
0051 prom_reboot(reboot_command);
0052 prom_reboot("");
0053 panic("Reboot failed!");
0054 }
0055