Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Oct 2018 16:24:49 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339334 - head/stand/efi/loader
Message-ID:  <201810121624.w9CGOnxe026091@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Fri Oct 12 16:24:49 2018
New Revision: 339334
URL: https://svnweb.freebsd.org/changeset/base/339334

Log:
  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

Modified:
  head/stand/efi/loader/main.c

Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c	Fri Oct 12 16:00:21 2018	(r339333)
+++ head/stand/efi/loader/main.c	Fri Oct 12 16:24:49 2018	(r339334)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810121624.w9CGOnxe026091>