Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot Add a reboot command to the bootloader



details:   https://anonhg.NetBSD.org/src/rev/3662cb43e3b4
branches:  trunk
changeset: 993414:3662cb43e3b4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Sep 09 18:00:20 2018 +0000

description:
Add a reboot command to the bootloader

diffstat:

 sys/stand/efiboot/boot.c    |  10 +++++++++-
 sys/stand/efiboot/efiboot.c |  10 +++++++++-
 sys/stand/efiboot/efiboot.h |   3 ++-
 3 files changed, 20 insertions(+), 3 deletions(-)

diffs (72 lines):

diff -r 14f59a98de7a -r 3662cb43e3b4 sys/stand/efiboot/boot.c
--- a/sys/stand/efiboot/boot.c  Sun Sep 09 17:55:22 2018 +0000
+++ b/sys/stand/efiboot/boot.c  Sun Sep 09 18:00:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot.c,v 1.8 2018/09/09 17:55:22 jmcneill Exp $        */
+/*     $NetBSD: boot.c,v 1.9 2018/09/09 18:00:20 jmcneill Exp $        */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -80,6 +80,8 @@
        { "setenv",     command_setenv,         "setenv <key> <value>" },
        { "clearenv",   command_clearenv,       "clearenv <key>" },
        { "resetenv",   command_resetenv,       "resetenv" },
+       { "reboot",     command_reset,          "reboot|reset" },
+       { "reset",      command_reset,          NULL },
        { "version",    command_version,        "version" },
        { "help",       command_help,           "help|?" },
        { "?",          command_help,           NULL },
@@ -216,6 +218,12 @@
        efi_exit();
 }
 
+void
+command_reset(char *arg)
+{
+       efi_reboot();
+}
+
 int
 set_default_device(char *arg)
 {
diff -r 14f59a98de7a -r 3662cb43e3b4 sys/stand/efiboot/efiboot.c
--- a/sys/stand/efiboot/efiboot.c       Sun Sep 09 17:55:22 2018 +0000
+++ b/sys/stand/efiboot/efiboot.c       Sun Sep 09 18:00:20 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiboot.c,v 1.5 2018/09/03 00:04:02 jmcneill Exp $ */
+/* $NetBSD: efiboot.c,v 1.6 2018/09/09 18:00:20 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -109,6 +109,14 @@
 }
 
 void
+efi_reboot(void)
+{
+       uefi_call_wrapper(RT->ResetSystem, 4, EfiResetCold, EFI_SUCCESS, 0, NULL);
+
+       printf("WARNING: Reset failed\n");
+}
+
+void
 efi_delay(int us)
 {
        EFI_STATUS status;
diff -r 14f59a98de7a -r 3662cb43e3b4 sys/stand/efiboot/efiboot.h
--- a/sys/stand/efiboot/efiboot.h       Sun Sep 09 17:55:22 2018 +0000
+++ b/sys/stand/efiboot/efiboot.h       Sun Sep 09 18:00:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efiboot.h,v 1.5 2018/09/09 13:37:54 jmcneill Exp $     */
+/*     $NetBSD: efiboot.h,v 1.6 2018/09/09 18:00:20 jmcneill Exp $     */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -67,6 +67,7 @@
 void efi_cleanup(void);
 void efi_exit(void);
 void efi_delay(int);
+void efi_reboot(void);
 
 /* efichar.c */
 size_t ucs2len(const CHAR16 *);



Home | Main Index | Thread Index | Old Index