sandbox: Exit when SYSRESET_POWER_OFF is requested
authorSimon Glass <sjg@chromium.org>
Sat, 18 May 2019 17:59:43 +0000 (11:59 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 10 Jul 2019 22:52:58 +0000 (16:52 -0600)
At present this returns but it seems better to just exit sandbox
immediately.

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

arch/sandbox/cpu/state.c
drivers/sysreset/sysreset_sandbox.c

index d3b9c0598596585c93593a668d7c4e287234586b..2333240fda82b7059c8523dc4195511d5e351e96 100644 (file)
@@ -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));
index 38e2a7e241ddd6679cb54fabfd850fa4a9149d36..7dfd89460f0d5d3e0553550af0c9fa34271eaff5 100644 (file)
@@ -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;
        }