Skip to content

Commit

Permalink
[ot] Update CSRNG SW_CMD_STS.CMD_RDY
Browse files Browse the repository at this point in the history
CMD_RDY is gated on CTRL.ENABLE since commit 042e0b9158.

This change is needed to, for instance, make `csrng_send_app_cmd`
progress when it loops waiting for the "status register to be ready
to accept the next command."

Signed-off-by: Luís Marques <luismarques@lowrisc.org>
  • Loading branch information
luismarques committed Nov 29, 2024
1 parent a484863 commit 7b3560c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hw/opentitan/ot_csrng.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ static void ot_csrng_handle_enable(OtCSRNGState *s)
xtrace_ot_csrng_info("enable: no ES gen tracking", gennum);
}
s->enabled = true;
s->regs[R_SW_CMD_STS] |= R_SW_CMD_STS_CMD_RDY_MASK;
s->es_retry_count = ENTROPY_SRC_INITIAL_REQUEST_COUNT;
s->entropy_gennum = gennum;
}
Expand All @@ -934,6 +935,7 @@ static void ot_csrng_handle_enable(OtCSRNGState *s)
}
}
s->enabled = false;
s->regs[R_SW_CMD_STS] &= R_SW_CMD_STS_CMD_RDY_MASK;
s->es_retry_count = 0;
s->entropy_gennum = cls->get_random_generation(randif);
xtrace_ot_csrng_info("disable: last RS generation", s->entropy_gennum);
Expand Down

0 comments on commit 7b3560c

Please sign in to comment.