File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,6 +90,8 @@ pub use model_fpga_subsystem::ModelFpgaSubsystem;
9090#[ cfg( feature = "fpga_subsystem" ) ]
9191pub use model_fpga_subsystem:: XI3CWrapper ;
9292
93+ pub use mcu_boot_status:: { McuBootMilestones , McuRomBootStatus } ;
94+
9395/// Ideally, general-purpose functions would return `impl HwModel` instead of
9496/// `DefaultHwModel` to prevent users from calling functions that aren't
9597/// available on all HwModel implementations. Unfortunately, rust-analyzer
@@ -1285,6 +1287,10 @@ pub trait HwModel: SocManager {
12851287 self . soc_ifc ( ) . cptra_hw_config ( ) . read ( ) . subsystem_mode_en ( )
12861288 }
12871289
1290+ fn mci_boot_milestones ( & mut self ) -> McuBootMilestones {
1291+ McuBootMilestones :: empty ( )
1292+ }
1293+
12881294 fn supports_ocp_lock ( & mut self ) -> bool {
12891295 self . soc_ifc ( ) . cptra_hw_config ( ) . read ( ) . ocp_lock_mode_en ( )
12901296 }
Original file line number Diff line number Diff line change @@ -1758,10 +1758,6 @@ impl ModelFpgaSubsystem {
17581758 ( self . mci_flow_status ( ) & 0x0000_ffff ) as u16
17591759 }
17601760
1761- pub fn mci_boot_milestones ( & mut self ) -> McuBootMilestones {
1762- McuBootMilestones :: from ( ( self . mci_flow_status ( ) >> 16 ) as u16 )
1763- }
1764-
17651761 fn caliptra_axi_bus ( & mut self ) -> Option < FpgaRealtimeBus < ' _ > > {
17661762 self . mmio . caliptra_axi_bus ( )
17671763 }
@@ -1817,6 +1813,10 @@ impl HwModel for ModelFpgaSubsystem {
18171813 self . mmio . mci ( ) . unwrap ( ) . regs ( )
18181814 }
18191815
1816+ fn mci_boot_milestones ( & mut self ) -> McuBootMilestones {
1817+ McuBootMilestones :: from ( ( self . mci_flow_status ( ) >> 16 ) as u16 )
1818+ }
1819+
18201820 fn step ( & mut self ) {
18211821 self . handle_log ( ) ;
18221822 self . handle_flash ( ) ;
@@ -2339,7 +2339,13 @@ impl HwModel for ModelFpgaSubsystem {
23392339 // MCU ROM will wait after reaching the mailbox for this bit before booting RT
23402340 gpio. set ( current | 1 << 31 ) ;
23412341
2342- // ironically, we don't need to support this
2342+ // Wait for MCU to finish cold boot (including ROM integrity check)
2343+ // to avoid mailbox contention with the host.
2344+ self . step_until ( |m| {
2345+ m. mci_boot_milestones ( )
2346+ . contains ( McuBootMilestones :: COLD_BOOT_FLOW_COMPLETE )
2347+ } ) ;
2348+
23432349 Ok ( ( ) )
23442350 }
23452351
You can’t perform that action at this time.
0 commit comments