xref: /linux/arch/riscv/kernel/reset.c (revision 0d4a777c4cdaf6d55aa337a3c9fb825fd03fd371)
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 
10 static void default_power_off(void)
11 {
12 	while (1)
13 		wait_for_interrupt();
14 }
15 
16 void (*pm_power_off)(void) = NULL;
17 EXPORT_SYMBOL(pm_power_off);
18 
19 void 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 
31 void machine_halt(void)
32 {
33 	do_kernel_power_off();
34 	default_power_off();
35 }
36 
37 void machine_power_off(void)
38 {
39 	do_kernel_power_off();
40 	default_power_off();
41 }
42