From 0f31e1e6a8be7c82ab90e7c06a7b64547fab1764 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Fri, 12 Oct 2018 16:24:49 +0000 Subject: [PATCH] loader.efi: add poweroff command Add poweroff command to make life a bit easier. Reviewed by: imp, allanjude Approved by: re (kib) Differential Revision: https://reviews.freebsd.org/D17535 --- stand/efi/loader/main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index f5925e6ed448..784afff239ac 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -993,6 +993,23 @@ main(int argc, CHAR16 *argv[]) return (EFI_SUCCESS); /* keep compiler happy */ } +COMMAND_SET(poweroff, "poweroff", "power off the system", command_poweroff); + +static int +command_poweroff(int argc __unused, char *argv[] __unused) +{ + int i; + + for (i = 0; devsw[i] != NULL; ++i) + if (devsw[i]->dv_cleanup != NULL) + (devsw[i]->dv_cleanup)(); + + RS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); + + /* NOTREACHED */ + return (CMD_ERROR); +} + COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); static int