[U-Boot] [PATCH 06/17] sandbox: Exit when SYSRESET_POWER_OFF is requested

Simon Glass sjg at chromium.org
Sat May 18 17:59:43 UTC 2019


At present this returns but it seems better to just exit sandbox
immediately.

Signed-off-by: Simon Glass <sjg at chromium.org>

reset

---

 arch/sandbox/cpu/state.c            | 1 +
 drivers/sysreset/sysreset_sandbox.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index d3b9c059859..2333240fda8 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -356,6 +356,7 @@ void state_reset_for_test(struct sandbox_state *state)
 	/* No reset yet, so mark it as such. Always allow power reset */
 	state->last_sysreset = SYSRESET_COUNT;
 	state->sysreset_allowed[SYSRESET_POWER] = true;
+	state->sysreset_allowed[SYSRESET_POWER_OFF] = true;
 
 	memset(&state->wdt, '\0', sizeof(state->wdt));
 	memset(state->spi, '\0', sizeof(state->spi));
diff --git a/drivers/sysreset/sysreset_sandbox.c b/drivers/sysreset/sysreset_sandbox.c
index 38e2a7e241d..7dfd89460f0 100644
--- a/drivers/sysreset/sysreset_sandbox.c
+++ b/drivers/sysreset/sysreset_sandbox.c
@@ -66,6 +66,7 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
 	case SYSRESET_POWER_OFF:
 		if (!state->sysreset_allowed[type])
 			return -EACCES;
+		sandbox_exit();
 	default:
 		return -ENOSYS;
 	}
-- 
2.21.0.1020.gf2820cf01a-goog



More information about the U-Boot mailing list