[cmdline] Add "poweroff" command

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Marin Hannache
2013-07-13 14:31:15 +02:00
committed by Michael Brown
parent 9b93b669d1
commit c0af8c0433
9 changed files with 226 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
#include <errno.h>
#include <ipxe/efi/efi.h>
#include <ipxe/reboot.h>
@@ -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 );