Skip to content

Commit 689d664

Browse files
committed
[ot] hw/opentitan: ot_lc_ctrl: Set LC_STATE to POST_TRANSITION after a transition
From <https://opentitan.org/book/hw/ip/lc_ctrl/doc/programmers_guide.html>: "Note that all life cycle state transition increments the LC_TRANSITION_CNT and moves the life cycle state into the temporary POST_TRANSITION state - even if the transition was unsuccessful" This is checked by manufacturing tests (on the host side). Signed-off-by: Luís Marques <[email protected]>
1 parent 7d7c5ee commit 689d664

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hw/opentitan/ot_lc_ctrl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,7 @@ static void ot_lc_ctrl_handle_otp_ack(void *opaque, bool ack)
12841284
s->regs[R_STATUS] |= R_STATUS_OTP_ERROR_MASK;
12851285
}
12861286
LC_FSM_CHANGE_STATE(s, ST_POST_TRANS);
1287+
s->lc_state = LC_STATE_POST_TRANSITION;
12871288
break;
12881289
default:
12891290
g_assert_not_reached();
@@ -1302,6 +1303,7 @@ static void ot_lc_ctrl_program_otp(OtLcCtrlState *s, unsigned lc_tcount,
13021303
__func__);
13031304
s->regs[R_STATUS] |= R_STATUS_OTP_ERROR_MASK;
13041305
LC_FSM_CHANGE_STATE(s, ST_POST_TRANS);
1306+
s->lc_state = LC_STATE_POST_TRANSITION;
13051307
return;
13061308
}
13071309

@@ -1315,6 +1317,7 @@ static void ot_lc_ctrl_program_otp(OtLcCtrlState *s, unsigned lc_tcount,
13151317
trace_ot_lc_ctrl_error(s->ot_id, "OTP program request rejected");
13161318
s->regs[R_STATUS] |= R_STATUS_STATE_ERROR_MASK;
13171319
LC_FSM_CHANGE_STATE(s, ST_POST_TRANS);
1320+
s->lc_state = LC_STATE_POST_TRANSITION;
13181321
return;
13191322
}
13201323
}
@@ -1454,10 +1457,12 @@ static void ot_lc_ctrl_resume_transition(OtLcCtrlState *s)
14541457
trace_ot_lc_ctrl_error(s->ot_id, "Invalid transition");
14551458
s->regs[R_STATUS] |= R_STATUS_TRANSITION_ERROR_MASK;
14561459
LC_FSM_CHANGE_STATE(s, ST_POST_TRANS);
1460+
s->lc_state = LC_STATE_POST_TRANSITION;
14571461
} else if (!ot_lc_ctrl_match_token(s, token)) {
14581462
trace_ot_lc_ctrl_error(s->ot_id, "Invalid OTP token");
14591463
s->regs[R_STATUS] |= R_STATUS_TOKEN_ERROR_MASK;
14601464
LC_FSM_CHANGE_STATE(s, ST_POST_TRANS);
1465+
s->lc_state = LC_STATE_POST_TRANSITION;
14611466
} else {
14621467
trace_ot_lc_ctrl_info(s->ot_id, "Valid token");
14631468

0 commit comments

Comments
 (0)