xref: /openbmc/linux/arch/riscv/kernel/reset.c (revision 405db98b)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2012 Regents of the University of California
4  */
5 
6 #include <linux/reboot.h>
7 #include <linux/pm.h>
8 
9 static void default_power_off(void)
10 {
11 	while (1)
12 		wait_for_interrupt();
13 }
14 
15 void (*pm_power_off)(void) = NULL;
16 EXPORT_SYMBOL(pm_power_off);
17 
18 void machine_restart(char *cmd)
19 {
20 	do_kernel_restart(cmd);
21 	while (1);
22 }
23 
24 void machine_halt(void)
25 {
26 	if (pm_power_off != NULL)
27 		pm_power_off();
28 	else
29 		default_power_off();
30 }
31 
32 void machine_power_off(void)
33 {
34 	if (pm_power_off != NULL)
35 		pm_power_off();
36 	else
37 		default_power_off();
38 }
39