diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-08-07 19:34:54 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-08-07 19:34:54 +0000 |
commit | cee1c57d02b7a0d9c9453f40476fd858f4025aa2 (patch) | |
tree | dacb9b14cb0b740a7867bac5b333b01d3643c4c4 /sys/arch/arm64 | |
parent | 663d1c76c856c2a244418e2a7ad3565ad9f98329 (diff) |
Add "machine exit" and "machine poweroff" commands to the arm64 and armv7
bootloaders. Replace while (1) { } with for (;;) continue; per request
from tom@.
ok tom@, jsg@
Diffstat (limited to 'sys/arch/arm64')
-rw-r--r-- | sys/arch/arm64/stand/efiboot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efiboot.c | 43 | ||||
-rw-r--r-- | sys/arch/arm64/stand/efiboot/libsa.h | 4 |
3 files changed, 37 insertions, 14 deletions
diff --git a/sys/arch/arm64/stand/efiboot/conf.c b/sys/arch/arm64/stand/efiboot/conf.c index 7351350e548..5fff9bb92c4 100644 --- a/sys/arch/arm64/stand/efiboot/conf.c +++ b/sys/arch/arm64/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.6 2017/07/31 14:06:29 kettenis Exp $ */ +/* $OpenBSD: conf.c,v 1.7 2017/08/07 19:34:53 kettenis Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -35,7 +35,7 @@ #include "efiboot.h" #include "efidev.h" -const char version[] = "0.6"; +const char version[] = "0.7"; int debug = 0; struct fs_ops file_system[] = { diff --git a/sys/arch/arm64/stand/efiboot/efiboot.c b/sys/arch/arm64/stand/efiboot/efiboot.c index defb4e3ab4f..b5ce52427dd 100644 --- a/sys/arch/arm64/stand/efiboot/efiboot.c +++ b/sys/arch/arm64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.10 2017/07/31 14:06:29 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.11 2017/08/07 19:34:53 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -395,17 +395,9 @@ _rtt(void) printf("Hit any key to reboot\n"); efi_cons_getc(0); #endif - /* - * XXX ResetSystem doesn't seem to work on U-Boot 2016.05 on - * the CuBox-i. So trigger an unimplemented instruction trap - * instead. - */ -#if 1 - asm volatile(".word 0xa000f7f0\n"); -#else RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); -#endif - while (1) { } + for (;;) + continue; } /* @@ -635,3 +627,32 @@ efi_memprobe_find(UINTN pages, UINTN align, EFI_PHYSICAL_ADDRESS *addr) } return EFI_OUT_OF_RESOURCES; } + +/* + * Commands + */ + +int Xexit_efi(void); +int Xpoweroff_efi(void); + +const struct cmd_table cmd_machine[] = { + { "exit", CMDT_CMD, Xexit_efi }, + { "poweroff", CMDT_CMD, Xpoweroff_efi }, + { NULL, 0 } +}; + +int +Xexit_efi(void) +{ + EFI_CALL(BS->Exit, IH, 0, 0, NULL); + for (;;) + continue; + return (0); +} + +int +Xpoweroff_efi(void) +{ + EFI_CALL(RS->ResetSystem, EfiResetShutdown, EFI_SUCCESS, 0, NULL); + return (0); +} diff --git a/sys/arch/arm64/stand/efiboot/libsa.h b/sys/arch/arm64/stand/efiboot/libsa.h index a75b5589bb5..08bd403f085 100644 --- a/sys/arch/arm64/stand/efiboot/libsa.h +++ b/sys/arch/arm64/stand/efiboot/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.1 2016/12/17 23:38:33 patrick Exp $ */ +/* $OpenBSD: libsa.h,v 1.2 2017/08/07 19:34:53 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -28,3 +28,5 @@ void machdep(void); void devboot(dev_t, char *); + +#define MACHINE_CMD cmd_machine |