5 #include "sw/device/silicon_creator/manuf/lib/flash_info_fields.h"
9 #include "sw/device/lib/base/status.h"
11 #include "sw/device/lib/testing/flash_ctrl_testutils.h"
12 #include "sw/device/silicon_creator/lib/attestation.h"
14 #include "flash_ctrl_regs.h"
15 #include "otp_ctrl_regs.h"
33 .byte_offset = OTP_CTRL_PARAM_DEVICE_ID_SIZE,
41 OTP_CTRL_PARAM_DEVICE_ID_SIZE + OTP_CTRL_PARAM_MANUF_STATE_SIZE,
48 .byte_offset = OTP_CTRL_PARAM_DEVICE_ID_SIZE +
49 OTP_CTRL_PARAM_MANUF_STATE_SIZE +
50 kFlashInfoAstCalibrationDataSizeIn32BitWords,
78 .byte_offset = kFlashInfoFieldUdsKeySeedIdx * kAttestationSeedBytes,
85 .byte_offset = kFlashInfoFieldCdi0KeySeedIdx * kAttestationSeedBytes,
92 .byte_offset = kFlashInfoFieldCdi1KeySeedIdx * kAttestationSeedBytes,
99 .byte_offset = kFlashInfoFieldTpmEkKeySeedIdx * kAttestationSeedBytes,
106 .byte_offset = FLASH_CTRL_PARAM_BYTES_PER_PAGE -
sizeof(uint32_t),
111 uint32_t *data_out,
size_t num_words) {
113 uint32_t byte_address =
115 TRY(flash_ctrl_testutils_read(flash_state, byte_address, field.partition,
116 data_out, kDifFlashCtrlPartitionTypeInfo,
124 uint32_t *data_in,
size_t num_words,
125 bool erase_page_before_write) {
127 uint32_t byte_address =
129 if (erase_page_before_write) {
130 TRY(flash_ctrl_testutils_erase_and_write_page(
131 flash_state, byte_address, field.partition, data_in,
132 kDifFlashCtrlPartitionTypeInfo, num_words));
134 TRY(flash_ctrl_testutils_write(flash_state, byte_address, field.partition,
135 data_in, kDifFlashCtrlPartitionTypeInfo,