projects/linux·blob master · refs

41 lines · 719 B

1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2012 Regents of the University of California
4 */
5
6#include <linux/efi.h>
7#include <linux/reboot.h>
8#include <linux/pm.h>
9
10static void __noreturn default_power_off(void)
11{
12 while (1)
13 wait_for_interrupt();
14}
15
16void (*pm_power_off)(void) = NULL;
17EXPORT_SYMBOL(pm_power_off);
18
19void machine_restart(char *cmd)
20{
21 /*
22 * UpdateCapsule() depends on the system being reset via ResetSystem().
23 */
24 if (efi_enabled(EFI_RUNTIME_SERVICES))
25 efi_reboot(reboot_mode, NULL);
26
27 do_kernel_restart(cmd);
28 while (1);
29}
30
31void machine_halt(void)
32{
33 do_kernel_power_off();
34 default_power_off();
35}
36
37void machine_power_off(void)
38{
39 do_kernel_power_off();
40 default_power_off();
41}