summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/board/poweroff.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox/board/poweroff.c')
-rw-r--r--arch/sandbox/board/poweroff.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/sandbox/board/poweroff.c b/arch/sandbox/board/poweroff.c
index 6b5a6dff15..8ce739af72 100644
--- a/arch/sandbox/board/poweroff.c
+++ b/arch/sandbox/board/poweroff.c
@@ -1,6 +1,7 @@
#include <common.h>
#include <init.h>
#include <poweroff.h>
+#include <restart.h>
#include <mach/linux.h>
static void sandbox_poweroff(struct poweroff_handler *poweroff)
@@ -8,9 +9,33 @@ static void sandbox_poweroff(struct poweroff_handler *poweroff)
linux_exit();
}
+static void sandbox_rst_hang(struct restart_handler *rst)
+{
+ linux_hang();
+}
+
+static struct restart_handler rst_hang = {
+ .name = "hang",
+ .restart = sandbox_rst_hang
+};
+
+static void sandbox_rst_reexec(struct restart_handler *rst)
+{
+ linux_reexec();
+}
+
+static struct restart_handler rst_reexec = {
+ .name = "reexec", .priority = 200,
+ .restart = sandbox_rst_reexec,
+};
+
static int poweroff_register_feature(void)
{
poweroff_handler_register_fn(sandbox_poweroff);
+ restart_handler_register(&rst_hang);
+
+ if (IS_ENABLED(CONFIG_SANDBOX_REEXEC))
+ restart_handler_register(&rst_reexec);
return 0;
}