[sw/silicon_creator] Update lifecyle_state_t
This change
* Reduces the number of `lifecycle_state_t` variants to 5, i.e. to the
ones that we use in mask rom,
* Adds `lifecycle_raw_state_get()` to get the unprocessed life cycle
state from hardware (mostly for debug purposes),
* Removes `lifecycle_state_name_get()`,
* Updates `mock_lifecycle.h`, and
* Updates call sites and existing tests.
Signed-off-by: Alphan Ulusoy <alphan@google.com>
diff --git a/sw/device/silicon_creator/lib/shutdown.c b/sw/device/silicon_creator/lib/shutdown.c
index 5c9274e..fa24236 100644
--- a/sw/device/silicon_creator/lib/shutdown.c
+++ b/sw/device/silicon_creator/lib/shutdown.c
@@ -71,14 +71,7 @@
// Are we in a lifecycle state which needs alert configuration?
uint32_t lc_shift;
switch (lc_state) {
- case kLcStateTestUnlocked0:
- case kLcStateTestUnlocked1:
- case kLcStateTestUnlocked2:
- case kLcStateTestUnlocked3:
- case kLcStateTestUnlocked4:
- case kLcStateTestUnlocked5:
- case kLcStateTestUnlocked6:
- case kLcStateTestUnlocked7:
+ case kLcStateTest:
// Don't configure alerts during manufacturing as OTP may not have been
// programmed yet.
return kErrorOk;
@@ -226,25 +219,25 @@
//
// Note that we cannot use the lifecycle or OTP libraries since an error
// may trigger a call to `shutdown_finalize`.
- lifecycle_state_t lc_state = (lifecycle_state_t)bitfield_field32_read(
- abs_mmio_read32(TOP_EARLGREY_LC_CTRL_BASE_ADDR +
- LC_CTRL_LC_STATE_REG_OFFSET),
- LC_CTRL_LC_STATE_STATE_FIELD);
- switch (lc_state) {
- case kLcStateTestUnlocked0:
- case kLcStateTestUnlocked1:
- case kLcStateTestUnlocked2:
- case kLcStateTestUnlocked3:
- case kLcStateTestUnlocked4:
- case kLcStateTestUnlocked5:
- case kLcStateTestUnlocked6:
- case kLcStateTestUnlocked7:
- case kLcStateRma:
+ uint32_t raw_state =
+ bitfield_field32_read(abs_mmio_read32(TOP_EARLGREY_LC_CTRL_BASE_ADDR +
+ LC_CTRL_LC_STATE_REG_OFFSET),
+ LC_CTRL_LC_STATE_STATE_FIELD);
+ switch (raw_state) {
+ case LC_CTRL_LC_STATE_STATE_VALUE_TEST_UNLOCKED0:
+ case LC_CTRL_LC_STATE_STATE_VALUE_TEST_UNLOCKED1:
+ case LC_CTRL_LC_STATE_STATE_VALUE_TEST_UNLOCKED2:
+ case LC_CTRL_LC_STATE_STATE_VALUE_TEST_UNLOCKED3:
+ case LC_CTRL_LC_STATE_STATE_VALUE_TEST_UNLOCKED4:
+ case LC_CTRL_LC_STATE_STATE_VALUE_TEST_UNLOCKED5:
+ case LC_CTRL_LC_STATE_STATE_VALUE_TEST_UNLOCKED6:
+ case LC_CTRL_LC_STATE_STATE_VALUE_TEST_UNLOCKED7:
+ case LC_CTRL_LC_STATE_STATE_VALUE_RMA:
// No error redaction in TEST_UNLOCKED and RMA states.
return kShutdownErrorRedactNone;
- case kLcStateProd:
- case kLcStateProdEnd:
- case kLcStateDev:
+ case LC_CTRL_LC_STATE_STATE_VALUE_DEV:
+ case LC_CTRL_LC_STATE_STATE_VALUE_PROD:
+ case LC_CTRL_LC_STATE_STATE_VALUE_PROD_END:
// In production states use the redaction level specified in OTP.
return (shutdown_error_redact_t)abs_mmio_read32(
TOP_EARLGREY_OTP_CTRL_CORE_BASE_ADDR +