Skip to content

Commit 1ebf36e

Browse files
committed
Small APOB tweaks
1 parent 0b4db4a commit 1ebf36e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

drv/cosmo-hf/src/apob.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ enum Trace {
161161
expected_hash: [u8; 32],
162162
actual_hash: [u8; 32],
163163
},
164+
ApobSlotErase {
165+
slot: ApobSlot,
166+
},
167+
ApobSlotEraseDone {
168+
slot: ApobSlot,
169+
time_ms: u64,
170+
},
164171
ApobSlotSectorErase {
165172
slot: ApobSlot,
166173
offset: u32,
@@ -400,6 +407,8 @@ impl ApobState {
400407

401408
/// Erases the given APOB slot
402409
fn slot_erase(drv: &mut FlashDriver, slot: ApobSlot) {
410+
let start = userlib::sys_get_timer().now;
411+
ringbuf_entry!(Trace::ApobSlotErase { slot });
403412
static_assertions::const_assert!(
404413
APOB_SLOT_SIZE.is_multiple_of(SECTOR_SIZE_BYTES)
405414
);
@@ -427,6 +436,11 @@ impl ApobState {
427436
}
428437
}
429438
}
439+
let end = userlib::sys_get_timer().now;
440+
ringbuf_entry!(Trace::ApobSlotEraseDone {
441+
slot,
442+
time_ms: end - start
443+
});
430444
}
431445

432446
/// Finds a valid APOB slot within the given meta region
@@ -699,8 +713,7 @@ impl ApobState {
699713
expected_hash,
700714
actual_hash: out.into()
701715
});
702-
let commit_result = Err(ApobCommitError::ValidationFailed);
703-
return commit_result;
716+
return Err(ApobCommitError::ValidationFailed);
704717
}
705718
}
706719
}

0 commit comments

Comments
 (0)