diff --git a/exosphere/src/cpu_context.c b/exosphere/src/cpu_context.c index 8e91bf36b..56cd95905 100644 --- a/exosphere/src/cpu_context.c +++ b/exosphere/src/cpu_context.c @@ -109,7 +109,7 @@ uint32_t cpu_on(uint32_t core, uintptr_t entrypoint_addr, uint64_t argument) { void power_down_current_core(void) { unsigned int current_core = get_core_id(); flow_set_csr(current_core, 0); - flow_set_halt_events(current_core, 0); + flow_set_halt_events(current_core, false); flow_set_cc4_ctrl(current_core, 0); save_current_core_context(); g_cpu_contexts[current_core].is_active = 0; diff --git a/exosphere/src/flow.h b/exosphere/src/flow.h index 91f3e4698..014b42abd 100644 --- a/exosphere/src/flow.h +++ b/exosphere/src/flow.h @@ -2,6 +2,7 @@ #define EXOSPHERE_FLOW_CTLR_H #include +#include #include "cpu_context.h" #include "memory_map.h" @@ -36,12 +37,12 @@ static inline void flow_set_cc4_ctrl(uint32_t core, uint32_t cc4_ctrl) { MAKE_FLOW_REG(g_flow_core_offsets[core].CC4_COREN_CTRL_OFS) = cc4_ctrl; } -static inline void flow_set_halt_events(uint32_t core, uint32_t halt_events) { - MAKE_FLOW_REG(g_flow_core_offsets[core].HALT_CPUN_EVENTS_OFS) = halt_events; +static inline void flow_set_halt_events(uint32_t core, bool halt_events) { + MAKE_FLOW_REG(g_flow_core_offsets[core].HALT_CPUN_EVENTS_OFS) = (halt_events ? 0x40000F00 : 0x40000000); } static inline void flow_set_csr(uint32_t core, uint32_t csr) { - MAKE_FLOW_REG(g_flow_core_offsets[core].CPUN_CSR_OFS) = csr; + MAKE_FLOW_REG(g_flow_core_offsets[core].CPUN_CSR_OFS) = (0x100 << core) | (csr << 12) | 0xC001; } static inline void flow_clear_csr0_and_events(uint32_t core) { diff --git a/exosphere/src/lp0.c b/exosphere/src/lp0.c index 4c93f7c7e..7811f8726 100644 --- a/exosphere/src/lp0.c +++ b/exosphere/src/lp0.c @@ -172,7 +172,7 @@ uint32_t cpu_suspend(uint64_t power_state, uint64_t entrypoint, uint64_t argumen FLOW_CTLR_HALT_COP_EVENTS_0 = 0; /* Prepare the current core for sleep. */ flow_set_cc4_ctrl(current_core, 0); - flow_set_halt_events(current_core, 0); + flow_set_halt_events(current_core, false); FLOW_CTLR_L2FLUSH_CONTROL_0 = 0; flow_set_csr(current_core, 2);