BACKPORT: boot state: add ability to block state transitions
In order to properly sequence the boot state machine it's important that outside code can block the transition from one state to the next. When timers are not involved there's no reason for any of the existing code to block a state transition. However, if there is a timer callback that needs to complete by a certain point in the boot sequence it is necessary to place a block for the given state. To that end, 4 new functions are added to provide the API for blocking a state. 1. boot_state_block(boot_state_t state, boot_state_sequence_t seq); 2. boot_state_unblock(boot_state_t state, boot_state_sequence_t seq); 3. boot_state_current_block(void); 4. boot_state_current_unblock(void); BUG=None BRANCH=None TEST=Compiled and booted Change-Id: I3de15e5b91e7fd1c833bc99b0d0af46a5a7c4bee Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/50455 Reviewed-by: Stefan Reinauer <reinauer@google.com>
This commit is contained in:
parent
35e088ba4a
commit
cbc47ea87f
2 changed files with 126 additions and 19 deletions
|
|
@ -156,6 +156,14 @@ int boot_state_sched_on_entry(struct boot_state_callback *bscb,
|
|||
int boot_state_sched_on_exit(struct boot_state_callback *bscb,
|
||||
boot_state_t state);
|
||||
|
||||
/* Block/Unblock the (state, seq) pair from transitioning. Returns 0 on
|
||||
* success < 0 when the phase of the (state,seq) has already ran. */
|
||||
int boot_state_block(boot_state_t state, boot_state_sequence_t seq);
|
||||
int boot_state_unblock(boot_state_t state, boot_state_sequence_t seq);
|
||||
/* Block/Unblock current state phase from transitioning. */
|
||||
void boot_state_current_block(void);
|
||||
void boot_state_current_unblock(void);
|
||||
|
||||
/* Entry into the boot state machine. */
|
||||
void hardwaremain(int boot_complete);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue