blob: 9e7db9e73cc13ffc04d05b02c9c5ea0d877be7e9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_REBOOT_H
2#define _LINUX_REBOOT_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
5#include <linux/notifier.h>
David Howells607ca462012-10-13 10:46:48 +01006#include <uapi/linux/reboot.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
Amerigo Wangc5f41752011-07-25 17:13:10 -07008#define SYS_DOWN 0x0001 /* Notify of system down */
9#define SYS_RESTART SYS_DOWN
10#define SYS_HALT 0x0002 /* Notify of system halt */
11#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
12
Robin Holtedf2b132013-07-08 16:01:35 -070013enum reboot_mode {
14 REBOOT_COLD = 0,
15 REBOOT_WARM,
Robin Holtc97a7002013-07-08 16:01:36 -070016 REBOOT_HARD,
17 REBOOT_SOFT,
Robin Holt7b6d8642013-07-08 16:01:40 -070018 REBOOT_GPIO,
Robin Holtedf2b132013-07-08 16:01:35 -070019};
Robin Holt1b3a5d02013-07-08 16:01:42 -070020extern enum reboot_mode reboot_mode;
21
22enum reboot_type {
23 BOOT_TRIPLE = 't',
24 BOOT_KBD = 'k',
25 BOOT_BIOS = 'b',
26 BOOT_ACPI = 'a',
27 BOOT_EFI = 'e',
28 BOOT_CF9 = 'p',
29 BOOT_CF9_COND = 'q',
30};
31extern enum reboot_type reboot_type;
32
33extern int reboot_default;
34extern int reboot_cpu;
35extern int reboot_force;
36
Robin Holtedf2b132013-07-08 16:01:35 -070037
Linus Torvalds1da177e2005-04-16 15:20:36 -070038extern int register_reboot_notifier(struct notifier_block *);
39extern int unregister_reboot_notifier(struct notifier_block *);
40
41
42/*
43 * Architecture-specific implementations of sys_reboot commands.
44 */
45
Vivek Goyalc97102b2013-12-18 17:08:31 -080046extern void migrate_to_reboot_cpu(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047extern void machine_restart(char *cmd);
48extern void machine_halt(void);
49extern void machine_power_off(void);
50
Eric W. Biedermandc009d92005-06-25 14:57:52 -070051extern void machine_shutdown(void);
Alexander Nyberg6e274d12005-06-25 14:58:26 -070052struct pt_regs;
53extern void machine_crash_shutdown(struct pt_regs *);
Eric W. Biedermandc009d92005-06-25 14:57:52 -070054
Robin Holt972ee832013-07-08 16:01:34 -070055/*
Eric W. Biederman4a00ea12005-07-26 11:24:14 -060056 * Architecture independent implemenations of sys_reboot commands.
57 */
58
Huang Yingca195b72008-08-15 00:40:24 -070059extern void kernel_restart_prepare(char *cmd);
Eric W. Biederman4a00ea12005-07-26 11:24:14 -060060extern void kernel_restart(char *cmd);
61extern void kernel_halt(void);
62extern void kernel_power_off(void);
Adrian Bunk83cc5ed2006-06-25 05:47:41 -070063
Dave Youngeb5572f2010-03-10 15:23:59 -080064extern int C_A_D; /* for sysctl */
Adrian Bunk83cc5ed2006-06-25 05:47:41 -070065void ctrl_alt_del(void);
Eric W. Biederman4a00ea12005-07-26 11:24:14 -060066
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070067#define POWEROFF_CMD_PATH_LEN 256
68extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
69
70extern int orderly_poweroff(bool force);
71
Eric W. Biederman7c903472005-07-26 11:29:55 -060072/*
73 * Emergency restart, callable from an interrupt handler.
74 */
75
76extern void emergency_restart(void);
77#include <asm/emergency-restart.h>
78
Linus Torvalds1da177e2005-04-16 15:20:36 -070079#endif /* _LINUX_REBOOT_H */