Skip to content

Commit 215a7e2

Browse files
committed
[manuf,qemu] Handle default uninitialized flash value in QEMU
See the relevant comments. Only changes the provisioning code path for the QEMU case, to handle assumptions already built in for the FPGA case. Signed-off-by: Alex Jones <[email protected]>
1 parent 9c8ef7b commit 215a7e2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

sw/device/silicon_creator/manuf/lib/individualize.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,23 @@ status_t manuf_individualize_device_hw_cfg(
100100
flash_state, kFlashInfoFieldAstCfgVersion, &ast_cfg_version,
101101
kFlashInfoFieldAstCfgVersionSizeIn32BitWords));
102102

103+
// On non-silicon targets, the default behaviour is to expect that the flash
104+
// starts "programmed/set" to 0 and must be erased first before it can be
105+
// written. This means that we expect the CP device ID and AST configuration
106+
// version fields from flash to read as all empty, which the provisioning
107+
// flow relies on to function on these targets.
108+
//
109+
// QEMU emulation instead defaults to being erased (all 1s) by default,
110+
// meaning that the AST configuration version that is read will be all 1s,
111+
// and the CP device ID will be programmed to some meaningful value.
112+
if (kDeviceType == kDeviceSimQemu && ast_cfg_version == UINT32_MAX) {
113+
ast_cfg_version = 0;
114+
115+
// For now, we don't erase the CP Device ID for QEMU, meaning it retains
116+
// some meaningful value and we do not set it to all 1s later to identify
117+
// it as a Sim-generated device ID.
118+
}
119+
103120
// Check if AST configuration version is an 8-bit value.
104121
if (ast_cfg_version > UINT8_MAX) {
105122
return OUT_OF_RANGE();

0 commit comments

Comments
 (0)