add one-way counter offset for auto-audit

for the first few boots (3 in this case), automatically
print an audit to the console. This is used to verify that
the chip was programmed correctly in chip probe.
This commit is contained in:
bunnie 2026-02-10 03:28:31 +08:00
parent fae35dd9f5
commit c1b7612e7e
No known key found for this signature in database
2 changed files with 13 additions and 0 deletions

View file

@ -50,6 +50,13 @@ pub const SERVER_NAME_KBD: &str = "_Matrix keyboard driver_";
/// circular dependencies on the IFRAM block.
pub const SERVER_NAME_BAO1X_HAL: &str = "_bao1x-SoC HAL_";
/// Number of boots to trigger the 'audit' command. It's set to be bigger than 1, because
/// the chip tester may power cycle the chip during the provisioning process before the
/// log can be displayed. Once we have seen the actual chip tester infrastructure working,
/// we can dial this down; but 3 times should be enough for us to capture a log during
/// tester bring-up.
pub const AUTO_AUDIT_LIMIT: u32 = 3;
/// Flags register in the backup register bank. Used to track system state between soft resets.
#[bitfield(u32)]
#[derive(PartialEq, Eq, Debug)]

View file

@ -66,6 +66,12 @@ macro_rules! encode_oneway {
// =========== ONE WAY COUNTER SLOTS ==============
/// This is used to count the number of boots, up to a certain threshold. The main
/// purpose is to turn off the "audit" auto-print which is used to verify chip testing.
pub const EARLY_BOOT_COUNT: usize = 47;
// gap of 8 slots [48..=55] left in case more anti-rollback slots are desired
/// Anti-rollback counters only count up and are used to note what is the minimum rollback
/// version allowed for a firmware stage. Note that this is different from a semver because
/// semvers can change without there being security problems. Anti-rollback counter is in