This adds a "machine exit" command like we already have on amd64.
Main motivation is that this would help including our bootloader in
the U-Boot regression tests.

This also changes the code to use RS->ResetSystem() on arm64.  It
seems we don't need the Cubox-i workaround there.  Still doesn't do
the right thing on my overdrive 1000 though :(.

ok?


Index: arch/armv7/stand/efiboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/stand/efiboot/conf.c,v
retrieving revision 1.9
diff -u -p -r1.9 conf.c
--- arch/armv7/stand/efiboot/conf.c     31 Jul 2017 14:05:57 -0000      1.9
+++ arch/armv7/stand/efiboot/conf.c     6 Aug 2017 19:50:19 -0000
@@ -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[] = {
Index: arch/armv7/stand/efiboot/efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/stand/efiboot/efiboot.c,v
retrieving revision 1.17
diff -u -p -r1.17 efiboot.c
--- arch/armv7/stand/efiboot/efiboot.c  31 Jul 2017 14:05:57 -0000      1.17
+++ arch/armv7/stand/efiboot/efiboot.c  6 Aug 2017 19:50:19 -0000
@@ -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.
         */
@@ -540,4 +540,23 @@ devopen(struct open_file *f, const char 
        f->f_dev = dp;
 
        return (*dp->dv_open)(f, unit, part);
+}
+
+/*
+ * Commands
+ */
+
+int Xexit_efi(void);
+
+const struct cmd_table cmd_machine[] = {
+       { "exit",       CMDT_CMD, Xexit_efi },
+       { NULL, 0 }
+};
+
+int
+Xexit_efi(void)
+{
+       EFI_CALL(BS->Exit, IH, 0, 0, NULL);
+       while (1) { };
+       return (0);
 }
Index: arch/armv7/stand/efiboot/libsa.h
===================================================================
RCS file: /cvs/src/sys/arch/armv7/stand/efiboot/libsa.h,v
retrieving revision 1.2
diff -u -p -r1.2 libsa.h
--- arch/armv7/stand/efiboot/libsa.h    17 May 2016 23:16:10 -0000      1.2
+++ arch/armv7/stand/efiboot/libsa.h    6 Aug 2017 19:50:19 -0000
@@ -28,3 +28,5 @@
 
 void machdep(void);
 void devboot(dev_t, char *);
+
+#define MACHINE_CMD    cmd_machine
Index: arch/arm64/stand/efiboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/conf.c,v
retrieving revision 1.6
diff -u -p -r1.6 conf.c
--- arch/arm64/stand/efiboot/conf.c     31 Jul 2017 14:06:29 -0000      1.6
+++ arch/arm64/stand/efiboot/conf.c     6 Aug 2017 19:50:19 -0000
@@ -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[] = {
Index: arch/arm64/stand/efiboot/efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/efiboot.c,v
retrieving revision 1.10
diff -u -p -r1.10 efiboot.c
--- arch/arm64/stand/efiboot/efiboot.c  31 Jul 2017 14:06:29 -0000      1.10
+++ arch/arm64/stand/efiboot/efiboot.c  6 Aug 2017 19:50:19 -0000
@@ -395,16 +395,7 @@ _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) { }
 }
 
@@ -634,4 +625,23 @@ efi_memprobe_find(UINTN pages, UINTN ali
                }
        }
        return EFI_OUT_OF_RESOURCES;
+}
+
+/*
+ * Commands
+ */
+
+int Xexit_efi(void);
+
+const struct cmd_table cmd_machine[] = {
+       { "exit",       CMDT_CMD, Xexit_efi },
+       { NULL, 0 }
+};
+
+int
+Xexit_efi(void)
+{
+       EFI_CALL(BS->Exit, IH, 0, 0, NULL);
+       while (1) { };
+       return (0);
 }
Index: arch/arm64/stand/efiboot/libsa.h
===================================================================
RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/libsa.h,v
retrieving revision 1.1
diff -u -p -r1.1 libsa.h
--- arch/arm64/stand/efiboot/libsa.h    17 Dec 2016 23:38:33 -0000      1.1
+++ arch/arm64/stand/efiboot/libsa.h    6 Aug 2017 19:50:19 -0000
@@ -28,3 +28,5 @@
 
 void machdep(void);
 void devboot(dev_t, char *);
+
+#define MACHINE_CMD    cmd_machine

Reply via email to