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/armv7/stand | |
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/armv7/stand')
-rw-r--r-- | sys/arch/armv7/stand/efiboot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/armv7/stand/efiboot/efiboot.c | 36 | ||||
-rw-r--r-- | sys/arch/armv7/stand/efiboot/libsa.h | 4 |
3 files changed, 38 insertions, 6 deletions
diff --git a/sys/arch/armv7/stand/efiboot/conf.c b/sys/arch/armv7/stand/efiboot/conf.c index 084ea3f9fb3..b8391d4bee0 100644 --- a/sys/arch/armv7/stand/efiboot/conf.c +++ b/sys/arch/armv7/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.9 2017/07/31 14:05:57 kettenis Exp $ */ +/* $OpenBSD: conf.c,v 1.10 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.8"; +const char version[] = "0.9"; int debug = 0; struct fs_ops file_system[] = { diff --git a/sys/arch/armv7/stand/efiboot/efiboot.c b/sys/arch/armv7/stand/efiboot/efiboot.c index 621c78a0a62..d3209715da4 100644 --- a/sys/arch/armv7/stand/efiboot/efiboot.c +++ b/sys/arch/armv7/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.17 2017/07/31 14:05:57 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.18 2017/08/07 19:34:53 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -374,7 +374,7 @@ _rtt(void) efi_cons_getc(0); #endif /* - * XXX ResetSystem doesn't seem to work on U-Boot 2016.05 on + * XXX ResetSystem doesn't seem to work on U-Boot 2017.03 on * the CuBox-i. So trigger an unimplemented instruction trap * instead. */ @@ -383,7 +383,8 @@ _rtt(void) #else RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); #endif - while (1) { } + for (;;) + continue; } /* @@ -541,3 +542,32 @@ devopen(struct open_file *f, const char *fname, char **file) return (*dp->dv_open)(f, unit, part); } + +/* + * 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/armv7/stand/efiboot/libsa.h b/sys/arch/armv7/stand/efiboot/libsa.h index 14be675f708..1f0c7b0ec2b 100644 --- a/sys/arch/armv7/stand/efiboot/libsa.h +++ b/sys/arch/armv7/stand/efiboot/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.2 2016/05/17 23:16:10 kettenis Exp $ */ +/* $OpenBSD: libsa.h,v 1.3 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 |