From c0af8c04333e499d2ed91dcb98b2dfe1aec1c7e3 Mon Sep 17 00:00:00 2001 From: Marin Hannache Date: Sat, 13 Jul 2013 14:31:15 +0200 Subject: [cmdline] Add "poweroff" command Modified-by: Michael Brown Signed-off-by: Marin Hannache Signed-off-by: Michael Brown --- src/interface/efi/efi_reboot.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/interface') diff --git a/src/interface/efi/efi_reboot.c b/src/interface/efi/efi_reboot.c index bfee36aa3..96638c48e 100644 --- a/src/interface/efi/efi_reboot.c +++ b/src/interface/efi/efi_reboot.c @@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); * */ +#include #include #include @@ -41,4 +42,20 @@ static void efi_reboot ( int warm ) { rs->ResetSystem ( ( warm ? EfiResetWarm : EfiResetCold ), 0, 0, NULL ); } +/** + * Power off system + * + * @ret rc Return status code + */ +static int efi_poweroff ( void ) { + EFI_RUNTIME_SERVICES *rs = efi_systab->RuntimeServices; + + /* Use runtime services to power off system */ + rs->ResetSystem ( EfiResetShutdown, 0, 0, NULL ); + + /* Should never happen */ + return -ECANCELED; +} + PROVIDE_REBOOT ( efi, reboot, efi_reboot ); +PROVIDE_REBOOT ( efi, poweroff, efi_poweroff ); -- cgit v1.2.3-55-g7522