projects/linux·blob master · refs

64 lines · 1.3 KiB

1/*
2 * Copyright (C) 2009 Michal Simek <[email protected]>
3 * Copyright (C) 2009 PetaLogix
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#include <linux/init.h>
11#include <linux/delay.h>
12#include <linux/reboot.h>
13
14void machine_shutdown(void)
15{
16 pr_notice("Machine shutdown...\n");
17 while (1)
18 ;
19}
20
21void machine_halt(void)
22{
23 pr_notice("Machine halt...\n");
24 while (1)
25 ;
26}
27
28void machine_power_off(void)
29{
30 pr_notice("Machine power off...\n");
31 do_kernel_power_off();
32 while (1)
33 ;
34}
35
36void machine_restart(char *cmd)
37{
38 do_kernel_restart(cmd);
39 /* Give the restart hook 1 s to take us down */
40 mdelay(1000);
41 pr_emerg("Reboot failed -- System halted\n");
42 while (1);
43}
44
45#ifdef CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC
46static int unaligned_pc_sys_off(struct sys_off_data *data)
47{
48 __asm__(
49 "bri 1\n"
50 );
51
52 return NOTIFY_DONE;
53}
54
55static int __init register_unaligned_pc_sys_off(void)
56{
57 struct sys_off_handler *sys_off;
58
59 sys_off = register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_LOW,
60 unaligned_pc_sys_off, NULL);
61 return PTR_ERR_OR_ZERO(sys_off);
62}
63device_initcall(register_unaligned_pc_sys_off);
64#endif /* CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC */