X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=arch%2Fsandbox%2Fcpu%2Fstate.c;h=d2a7dc9b450f8845811c9575a5731b0557c959c0;hb=2bfe4890856c94d939e193999dccdc75afc5c5bd;hp=033958ce74235b26ecf374a69c83b11175c7b56c;hpb=e1cc4d31f889428a4ca73120951389c756404184;p=oweals%2Fu-boot.git diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 033958ce74..d2a7dc9b45 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -51,7 +51,7 @@ static int state_read_file(struct sandbox_state *state, const char *fname) ret = os_get_filesize(fname, &size); if (ret < 0) { printf("Cannot find sandbox state file '%s'\n", fname); - return ret; + return -ENOENT; } state->state_fdt = os_malloc(size); if (!state->state_fdt) { @@ -337,6 +337,20 @@ struct sandbox_state *state_get_current(void) return state; } +void state_set_skip_delays(bool skip_delays) +{ + struct sandbox_state *state = state_get_current(); + + state->skip_delays = skip_delays; +} + +bool state_get_skip_delays(void) +{ + struct sandbox_state *state = state_get_current(); + + return state->skip_delays; +} + int state_init(void) { state = &main_state; @@ -345,6 +359,10 @@ int state_init(void) state->ram_buf = os_malloc(state->ram_size); assert(state->ram_buf); + /* No reset yet, so mark it as such. Always allow power reset */ + state->last_reset = RESET_COUNT; + state->reset_allowed[RESET_POWER] = true; + /* * Example of how to use GPIOs: *