blob: 3734cd8f38a896d55af2ff3a3f3518707444c4fe [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_REBOOT_H
3#define _LINUX_REBOOT_H
4
5
6#include <linux/notifier.h>
7#include <uapi/linux/reboot.h>
8
9struct device;
10
11#define SYS_DOWN 0x0001 /* Notify of system down */
12#define SYS_RESTART SYS_DOWN
13#define SYS_HALT 0x0002 /* Notify of system halt */
14#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
15
16enum reboot_mode {
David Brazdil0f672f62019-12-10 10:32:29 +000017 REBOOT_UNDEFINED = -1,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000018 REBOOT_COLD = 0,
19 REBOOT_WARM,
20 REBOOT_HARD,
21 REBOOT_SOFT,
22 REBOOT_GPIO,
23};
24extern enum reboot_mode reboot_mode;
David Brazdil0f672f62019-12-10 10:32:29 +000025extern enum reboot_mode panic_reboot_mode;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000026
27enum reboot_type {
28 BOOT_TRIPLE = 't',
29 BOOT_KBD = 'k',
30 BOOT_BIOS = 'b',
31 BOOT_ACPI = 'a',
32 BOOT_EFI = 'e',
33 BOOT_CF9_FORCE = 'p',
34 BOOT_CF9_SAFE = 'q',
35};
36extern enum reboot_type reboot_type;
37
38extern int reboot_default;
39extern int reboot_cpu;
40extern int reboot_force;
41
42
43extern int register_reboot_notifier(struct notifier_block *);
44extern int unregister_reboot_notifier(struct notifier_block *);
45
46extern int devm_register_reboot_notifier(struct device *, struct notifier_block *);
47
48extern int register_restart_handler(struct notifier_block *);
49extern int unregister_restart_handler(struct notifier_block *);
50extern void do_kernel_restart(char *cmd);
51
52/*
53 * Architecture-specific implementations of sys_reboot commands.
54 */
55
56extern void migrate_to_reboot_cpu(void);
57extern void machine_restart(char *cmd);
58extern void machine_halt(void);
59extern void machine_power_off(void);
60
61extern void machine_shutdown(void);
62struct pt_regs;
63extern void machine_crash_shutdown(struct pt_regs *);
64
65/*
66 * Architecture independent implemenations of sys_reboot commands.
67 */
68
69extern void kernel_restart_prepare(char *cmd);
70extern void kernel_restart(char *cmd);
71extern void kernel_halt(void);
72extern void kernel_power_off(void);
73
74extern int C_A_D; /* for sysctl */
75void ctrl_alt_del(void);
76
77#define POWEROFF_CMD_PATH_LEN 256
78extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
79
80extern void orderly_poweroff(bool force);
81extern void orderly_reboot(void);
82
83/*
84 * Emergency restart, callable from an interrupt handler.
85 */
86
87extern void emergency_restart(void);
88#include <asm/emergency-restart.h>
89
90#endif /* _LINUX_REBOOT_H */