Module Name: src Committed By: jmcneill Date: Sun Sep 9 18:00:20 UTC 2018
Modified Files: src/sys/stand/efiboot: boot.c efiboot.c efiboot.h Log Message: Add a reboot command to the bootloader To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/boot.c cvs rdiff -u -r1.5 -r1.6 src/sys/stand/efiboot/efiboot.c \ src/sys/stand/efiboot/efiboot.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/stand/efiboot/boot.c diff -u src/sys/stand/efiboot/boot.c:1.8 src/sys/stand/efiboot/boot.c:1.9 --- src/sys/stand/efiboot/boot.c:1.8 Sun Sep 9 17:55:22 2018 +++ src/sys/stand/efiboot/boot.c Sun Sep 9 18:00:20 2018 @@ -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 <non...@netbsd.org> @@ -80,6 +80,8 @@ const struct boot_command commands[] = { { "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 @@ command_quit(char *arg) efi_exit(); } +void +command_reset(char *arg) +{ + efi_reboot(); +} + int set_default_device(char *arg) { Index: src/sys/stand/efiboot/efiboot.c diff -u src/sys/stand/efiboot/efiboot.c:1.5 src/sys/stand/efiboot/efiboot.c:1.6 --- src/sys/stand/efiboot/efiboot.c:1.5 Mon Sep 3 00:04:02 2018 +++ src/sys/stand/efiboot/efiboot.c Sun Sep 9 18:00:20 2018 @@ -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 <jmcne...@invisible.ca> @@ -109,6 +109,14 @@ efi_exit(void) } 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; Index: src/sys/stand/efiboot/efiboot.h diff -u src/sys/stand/efiboot/efiboot.h:1.5 src/sys/stand/efiboot/efiboot.h:1.6 --- src/sys/stand/efiboot/efiboot.h:1.5 Sun Sep 9 13:37:54 2018 +++ src/sys/stand/efiboot/efiboot.h Sun Sep 9 18:00:20 2018 @@ -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 <non...@netbsd.org> @@ -67,6 +67,7 @@ extern EFI_LOADED_IMAGE *efi_li; void efi_cleanup(void); void efi_exit(void); void efi_delay(int); +void efi_reboot(void); /* efichar.c */ size_t ucs2len(const CHAR16 *);