GNU Linux-libre 4.19.286-gnu1
[releases.git] / arch / riscv / kernel / reset.c
1 /*
2  * Copyright (C) 2012 Regents of the University of California
3  *
4  *   This program is free software; you can redistribute it and/or
5  *   modify it under the terms of the GNU General Public License
6  *   as published by the Free Software Foundation, version 2.
7  *
8  *   This program is distributed in the hope that it will be useful,
9  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *   GNU General Public License for more details.
12  */
13
14 #include <linux/reboot.h>
15 #include <linux/export.h>
16 #include <asm/sbi.h>
17
18 void (*pm_power_off)(void) = machine_power_off;
19 EXPORT_SYMBOL(pm_power_off);
20
21 void machine_restart(char *cmd)
22 {
23         do_kernel_restart(cmd);
24         while (1);
25 }
26
27 void machine_halt(void)
28 {
29         machine_power_off();
30 }
31
32 void machine_power_off(void)
33 {
34         sbi_shutdown();
35         while (1);
36 }