Skip to content

Commit c03cc5b

Browse files
authored
Make sure we're muxed to the SP before setting the mux to the host (#2457)
I noticed that the SP hangs if you call `set_mux(HostCPU)` twice in a row. This is because the first call switches the mux from the SP to the host; the second call tries to read from flash while it's muxed to the host (to find the APOB, ABL0 version, etc). When the flash is muxed to the host, the FPGA never loads bytes into the SP's FIFO, so this hangs the `hf` task forever.
1 parent 51e396d commit c03cc5b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drv/cosmo-hf/src/hf.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,11 @@ impl idl::InOrderHostFlashImpl for ServerImpl {
606606
// - We will only load an APOB that's pinned to that version
607607
// - After booting, we'll use that version when persisting a new APOB
608608
if state == HfMuxState::HostCPU {
609+
// We can only swap the mux state to the host if it's currently
610+
// muxed to the SP, because we must read from flash (to find ABL0
611+
// version, APOB state, etc) before swapping the mux.
612+
self.drv.check_flash_mux_state()?;
613+
609614
self.abl0_version = match self.find_abl0_version() {
610615
Ok(v) => {
611616
// If the previous ABL0 version has not been consumed by

0 commit comments

Comments
 (0)