aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/riscv64')
-rw-r--r--arch/riscv64/kernel/power.c6
-rw-r--r--arch/riscv64/kernel/sbi.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/riscv64/kernel/power.c b/arch/riscv64/kernel/power.c
index 49fc9c5..21e4957 100644
--- a/arch/riscv64/kernel/power.c
+++ b/arch/riscv64/kernel/power.c
@@ -49,3 +49,9 @@ stat_t poweroff(enum poweroff_type type)
return ERR_INVAL;
}
+
+stat_t sleep()
+{
+ sbi_hart_stop();
+ return ERR_MISC;
+}
diff --git a/arch/riscv64/kernel/sbi.h b/arch/riscv64/kernel/sbi.h
index fe75c85..d536f58 100644
--- a/arch/riscv64/kernel/sbi.h
+++ b/arch/riscv64/kernel/sbi.h
@@ -149,6 +149,12 @@ static inline struct sbiret sbi_hart_start(unsigned long hartid,
0, 0, 0);
}
+#define FID_HSM_STOP 1
+static inline struct sbiret sbi_hart_stop()
+{
+ return sbi_ecall(EID_HSM, FID_HSM_STOP, 0, 0, 0, 0, 0, 0);
+}
+
/** Hart status function ID. */
#define FID_HSM_STATUS 2