38
38
#include "hw/riscv/ibex_common.h"
39
39
#include "hw/riscv/ibex_irq.h"
40
40
#include "trace.h"
41
+ #include "trace/trace-hw_opentitan.h"
41
42
42
43
43
44
/* clang-format off */
@@ -275,6 +276,11 @@ static void ot_socdbg_ctrl_tick_fsm(OtSoCDbgCtrlState *s)
275
276
{
276
277
bool cpu_boot_done = false;
277
278
279
+ trace_ot_socdbg_ctrl_tick_fsm (s -> ot_id , STATE_NAME (s -> fsm_state ),
280
+ s -> boot_status_bm , s -> lc_broadcast_bm ,
281
+ s -> socdbg_bm , s -> dft_ignore ,
282
+ s -> boot_continue );
283
+
278
284
switch (s -> fsm_state ) {
279
285
case ST_IDLE :
280
286
if (s -> boot_status_bm & R_BOOT_STATUS_LC_DONE_MASK ) {
@@ -319,7 +325,11 @@ static void ot_socdbg_ctrl_tick_fsm(OtSoCDbgCtrlState *s)
319
325
}
320
326
321
327
/* as with PwrMgr, use simple boolean value, not MuBi4 */
322
- ibex_irq_set (& s -> cpu_boot [CPU_BOOT_DONE ], (int )cpu_boot_done );
328
+ int cpu_boot_done_i = (int )cpu_boot_done ;
329
+ if (ibex_irq_get_level (& s -> cpu_boot [CPU_BOOT_DONE ]) != cpu_boot_done_i ) {
330
+ trace_ot_socdbg_ctrl_cpu_boot_done (s -> ot_id , cpu_boot_done_i );
331
+ }
332
+ ibex_irq_set (& s -> cpu_boot [CPU_BOOT_DONE ], cpu_boot_done_i );
323
333
}
324
334
325
335
static void ot_socdbg_ctrl_update (OtSoCDbgCtrlState * s )
@@ -658,9 +668,8 @@ ot_socdbg_ctrl_dmi_read(void *opaque, hwaddr addr, unsigned size)
658
668
break ;
659
669
}
660
670
661
- uint32_t pc = ibex_get_current_pc ();
662
671
trace_ot_socdbg_ctrl_dmi_io_read_out (s -> ot_id , (uint32_t )addr ,
663
- REG_NAME (DMI , reg ), val32 , pc );
672
+ REG_NAME (DMI , reg ), val32 );
664
673
665
674
return (uint32_t )val32 ;
666
675
}
@@ -674,9 +683,8 @@ static void ot_socdbg_ctrl_dmi_write(void *opaque, hwaddr addr, uint64_t value,
674
683
675
684
hwaddr reg = R32_OFF (addr );
676
685
677
- uint32_t pc = ibex_get_current_pc ();
678
686
trace_ot_socdbg_ctrl_dmi_io_write (s -> ot_id , (uint32_t )addr ,
679
- REG_NAME (DMI , reg ), val32 , pc );
687
+ REG_NAME (DMI , reg ), val32 );
680
688
681
689
switch (reg ) {
682
690
case R_DMI_CONTROL :
@@ -733,6 +741,7 @@ static void ot_socdbg_ctrl_reset_enter(Object *dev, ResetType type)
733
741
ot_socdbg_ctrl_core_update_irq (s );
734
742
ibex_irq_set (& s -> alert , 0 );
735
743
ibex_irq_set (& s -> cpu_boot [CPU_BOOT_GOOD ], (int )false);
744
+ ibex_irq_set (& s -> cpu_boot [CPU_BOOT_DONE ], (int )false);
736
745
737
746
CHANGE_STATE (s , IDLE );
738
747
s -> fsm_tick_count = 0u ;
@@ -742,6 +751,7 @@ static void ot_socdbg_ctrl_reset_enter(Object *dev, ResetType type)
742
751
s -> socdbg_state = OT_SOCDBG_ST_PROD ;
743
752
s -> debug_policy = s -> dbg_locked ;
744
753
s -> debug_valid = false;
754
+ s -> boot_continue = false;
745
755
}
746
756
747
757
static void ot_socdbg_ctrl_reset_exit (Object * obj , ResetType type )
@@ -761,7 +771,6 @@ static void ot_socdbg_ctrl_reset_exit(Object *obj, ResetType type)
761
771
SCHEDULE_FSM (s );
762
772
}
763
773
764
-
765
774
static void ot_socdbg_ctrl_realize (DeviceState * dev , Error * * errp )
766
775
{
767
776
OtSoCDbgCtrlState * s = OT_SOCDBG_CTRL (dev );
0 commit comments