mirror of
https://github.com/ipxe/ipxe
synced 2025-12-22 13:00:39 +03:00
[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:
committed by
Michael Brown
parent
9b93b669d1
commit
c0af8c0433
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user