Skip to content

Commit

Permalink
[manuf] DO NOT MERGE
Browse files Browse the repository at this point in the history
This adds detailed log prints to each OTP write that happens during
provisioning for triaging bugs.

Signed-off-by: Tim Trippel <[email protected]>
  • Loading branch information
timothytrippel committed Dec 17, 2024
1 parent 351b36b commit 254c6bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sw/device/lib/testing/otp_ctrl_testutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ status_t otp_ctrl_testutils_dai_access_error_check(
}

status_t otp_ctrl_testutils_wait_for_dai(const dif_otp_ctrl_t *otp_ctrl) {
LOG_INFO("Waiting for DAI to become ready ...");
IBEX_TRY_SPIN_FOR(dai_finished(otp_ctrl), kOtpDaiTimeoutUs);
LOG_INFO("DAI ready.");
return OK_STATUS();
}

Expand Down
1 change: 1 addition & 0 deletions sw/device/silicon_creator/manuf/lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ cc_library(
"//sw/device/lib/crypto/impl:hash",
"//sw/device/lib/dif:flash_ctrl",
"//sw/device/lib/dif:otp_ctrl",
"//sw/device/lib/runtime:log",
"//sw/device/lib/testing:flash_ctrl_testutils",
"//sw/device/lib/testing:otp_ctrl_testutils",
],
Expand Down
12 changes: 12 additions & 0 deletions sw/device/silicon_creator/manuf/lib/individualize_sw_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "sw/device/lib/crypto/include/hash.h"
#include "sw/device/lib/dif/dif_flash_ctrl.h"
#include "sw/device/lib/dif/dif_otp_ctrl.h"
#include "sw/device/lib/runtime/log.h"
#include "sw/device/lib/testing/flash_ctrl_testutils.h"
#include "sw/device/lib/testing/otp_ctrl_testutils.h"
#include "sw/device/silicon_creator/manuf/lib/flash_info_fields.h"
Expand Down Expand Up @@ -82,6 +83,9 @@ static status_t otp_img_write(const dif_otp_ctrl_t *otp,
kv[i].offset < kInvalidAstCfgOtpAddrHigh)) {
continue;
}
LOG_INFO(
"OTP Write: Partition (%d); Idx (%d); Offset (0x%x); Num Vals (%d)",
partition, i, kv[i].offset, kv[i].num_values);
uint32_t offset;
TRY(dif_otp_ctrl_relative_address(partition, kv[i].offset, &offset));
switch (kv[i].type) {
Expand Down Expand Up @@ -267,7 +271,9 @@ status_t manuf_individualize_device_flash_data_default_cfg_check(

status_t manuf_individualize_device_creator_sw_cfg_lock(
const dif_otp_ctrl_t *otp_ctrl) {
LOG_INFO("Locking CreatorSwCfg partition.");
TRY(lock_otp_partition(otp_ctrl, kDifOtpCtrlPartitionCreatorSwCfg));
LOG_INFO("Done.");
return OK_STATUS();
}

Expand Down Expand Up @@ -310,7 +316,9 @@ status_t manuf_individualize_device_partition_expected_read(

status_t manuf_individualize_device_owner_sw_cfg_lock(
const dif_otp_ctrl_t *otp_ctrl) {
LOG_INFO("Locking OwnerSwCfg partition.");
TRY(lock_otp_partition(otp_ctrl, kDifOtpCtrlPartitionOwnerSwCfg));
LOG_INFO("Done.");
return OK_STATUS();
}

Expand All @@ -327,15 +335,19 @@ status_t manuf_individualize_device_rot_creator_auth_codesign(
TRY(otp_img_write(otp_ctrl, kDifOtpCtrlPartitionRotCreatorAuthCodesign,
kOtpKvRotCreatorAuthCodesign,
kOtpKvRotCreatorAuthCodesignSize));
LOG_INFO("Locking RotCreatorAuthCodesign partition.");
TRY(lock_otp_partition(otp_ctrl, kDifOtpCtrlPartitionRotCreatorAuthCodesign));
LOG_INFO("Done.");
return OK_STATUS();
}

status_t manuf_individualize_device_rot_creator_auth_state(
const dif_otp_ctrl_t *otp_ctrl) {
TRY(otp_img_write(otp_ctrl, kDifOtpCtrlPartitionRotCreatorAuthState,
kOtpKvRotCreatorAuthState, kOtpKvRotCreatorAuthStateSize));
LOG_INFO("Locking RotCreatorAuthState partition.");
TRY(lock_otp_partition(otp_ctrl, kDifOtpCtrlPartitionRotCreatorAuthState));
LOG_INFO("Done.");
return OK_STATUS();
}

Expand Down

0 comments on commit 254c6bb

Please sign in to comment.