blob: a7ff409f386d0fadcb318fd41eefe90d97783145 [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 {
Ingo Molnar5be44a62014-04-04 08:41:26 +020023 BOOT_TRIPLE = 't',
24 BOOT_KBD = 'k',
25 BOOT_BIOS = 'b',
26 BOOT_ACPI = 'a',
27 BOOT_EFI = 'e',
28 BOOT_CF9_FORCE = 'p',
29 BOOT_CF9_SAFE = 'q',
Robin Holt1b3a5d02013-07-08 16:01:42 -070030};
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
Guenter Roeckb63adb972014-09-26 00:03:16 +000041extern int register_restart_handler(struct notifier_block *);
42extern int unregister_restart_handler(struct notifier_block *);
43extern void do_kernel_restart(char *cmd);
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
45/*
46 * Architecture-specific implementations of sys_reboot commands.
47 */
48
Vivek Goyalc97102b2013-12-18 17:08:31 -080049extern void migrate_to_reboot_cpu(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050extern void machine_restart(char *cmd);
51extern void machine_halt(void);
52extern void machine_power_off(void);
53
Eric W. Biedermandc009d92005-06-25 14:57:52 -070054extern void machine_shutdown(void);
Alexander Nyberg6e274d12005-06-25 14:58:26 -070055struct pt_regs;
56extern void machine_crash_shutdown(struct pt_regs *);
Eric W. Biedermandc009d92005-06-25 14:57:52 -070057
Robin Holt972ee832013-07-08 16:01:34 -070058/*
Eric W. Biederman4a00ea12005-07-26 11:24:14 -060059 * Architecture independent implemenations of sys_reboot commands.
60 */
61
Huang Yingca195b72008-08-15 00:40:24 -070062extern void kernel_restart_prepare(char *cmd);
Eric W. Biederman4a00ea12005-07-26 11:24:14 -060063extern void kernel_restart(char *cmd);
64extern void kernel_halt(void);
65extern void kernel_power_off(void);
Adrian Bunk83cc5ed2006-06-25 05:47:41 -070066
Dave Youngeb5572f2010-03-10 15:23:59 -080067extern int C_A_D; /* for sysctl */
Adrian Bunk83cc5ed2006-06-25 05:47:41 -070068void ctrl_alt_del(void);
Eric W. Biederman4a00ea12005-07-26 11:24:14 -060069
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070070#define POWEROFF_CMD_PATH_LEN 256
71extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
72
Joel Stanley7a54f462015-04-15 16:16:53 -070073extern void orderly_poweroff(bool force);
74extern void orderly_reboot(void);
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070075
Eric W. Biederman7c903472005-07-26 11:29:55 -060076/*
77 * Emergency restart, callable from an interrupt handler.
78 */
79
80extern void emergency_restart(void);
81#include <asm/emergency-restart.h>
82
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#endif /* _LINUX_REBOOT_H */