summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorMarin Hannache2013-07-13 14:31:15 +0200
committerMichael Brown2013-07-15 13:49:48 +0200
commitc0af8c04333e499d2ed91dcb98b2dfe1aec1c7e3 (patch)
treedd91fb9d367e5e2ff16425b9e0b75d218e8a63a3 /src/interface
parent[legal] Add missing FILE_LICENCE declarations (diff)
downloadipxe-c0af8c04333e499d2ed91dcb98b2dfe1aec1c7e3.tar.gz
ipxe-c0af8c04333e499d2ed91dcb98b2dfe1aec1c7e3.tar.xz
ipxe-c0af8c04333e499d2ed91dcb98b2dfe1aec1c7e3.zip
[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>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_reboot.c17
1 files changed, 17 insertions, 0 deletions
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 <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 );