summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sbi/sbi_hsm.c4
-rw-r--r--lib/sbi/sbi_init.c13
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index e8128a39..557ab131 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -176,8 +176,10 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch)
* If the hsm_dev is ready and it support the hotplug, we can
* use the hsm stop for more power saving
*/
- if (hsm_device_has_hart_hotplug())
+ if (hsm_device_has_hart_hotplug()) {
+ sbi_revert_entry_count(scratch);
hsm_device_hart_stop();
+ }
wfi();
}
diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
index 62c32682..84a63748 100644
--- a/lib/sbi/sbi_init.c
+++ b/lib/sbi/sbi_init.c
@@ -579,6 +579,19 @@ void __noreturn sbi_init(struct sbi_scratch *scratch)
init_warmboot(scratch, hartid);
}
+void sbi_revert_entry_count(struct sbi_scratch *scratch)
+{
+ unsigned long *entry_count, *init_count;
+
+ if (!entry_count_offset || !init_count_offset)
+ sbi_hart_hang();
+
+ entry_count = sbi_scratch_offset_ptr(scratch, entry_count_offset);
+ init_count = sbi_scratch_offset_ptr(scratch, init_count_offset);
+
+ *entry_count = *init_count;
+}
+
unsigned long sbi_entry_count(u32 hartindex)
{
struct sbi_scratch *scratch;