diff mbox series

[1/1] sandbox: implement runtime system reset

Message ID 20201202152211.486380-1-xypron.glpk@gmx.de
State Accepted
Commit 9c54729c77c4664474c43b53e545f919e2504e8c
Delegated to: Simon Glass
Headers show
Series [1/1] sandbox: implement runtime system reset | expand

Commit Message

Heinrich Schuchardt Dec. 2, 2020, 3:22 p.m. UTC
Implement a reset function that we can call after ExitBootServices(),
when all driver model devices are gone.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 arch/sandbox/cpu/start.c | 10 ++++++++++
 lib/efi_loader/Kconfig   |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

--
2.29.2

Comments

Simon Glass Dec. 12, 2020, 3:39 p.m. UTC | #1
On Wed, 2 Dec 2020 at 08:22, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Implement a reset function that we can call after ExitBootServices(),
> when all driver model devices are gone.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  arch/sandbox/cpu/start.c | 10 ++++++++++
>  lib/efi_loader/Kconfig   |  3 ++-
>  2 files changed, 12 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Dec. 23, 2020, 3:43 p.m. UTC | #2
On Wed, 2 Dec 2020 at 08:22, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Implement a reset function that we can call after ExitBootServices(),
> when all driver model devices are gone.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  arch/sandbox/cpu/start.c | 10 ++++++++++
>  lib/efi_loader/Kconfig   |  3 ++-
>  2 files changed, 12 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index a03e5aa0b3..cd324767d0 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -6,6 +6,7 @@ 
 #include <common.h>
 #include <command.h>
 #include <dm/root.h>
+#include <efi_loader.h>
 #include <errno.h>
 #include <init.h>
 #include <os.h>
@@ -406,6 +407,15 @@  void state_show(struct sandbox_state *state)
 	printf("\n");
 }

+void __efi_runtime EFIAPI efi_reset_system(
+		enum efi_reset_type reset_type,
+		efi_status_t reset_status,
+		unsigned long data_size, void *reset_data)
+{
+	os_fd_restore();
+	os_relaunch(os_argv);
+}
+
 void sandbox_reset(void)
 {
 	/* Do this here while it still has an effect */
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 7fd3a3c90c..31da8800e0 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -165,7 +165,8 @@  config EFI_HAVE_RUNTIME_RESET
 	# bool "Reset runtime service is available"
 	bool
 	default y
-	depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || SYSRESET_X86
+	depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || \
+		   SANDBOX || SYSRESET_X86

 config EFI_GRUB_ARM32_WORKAROUND
 	bool "Workaround for GRUB on 32bit ARM"