aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-08-03 18:50:06 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-08-03 18:50:06 +0300
commit5f30284181fcfe5b16dfb94d4fba9a9ed4a2dc6a (patch)
tree9e52287fc627631e56f184d074a1cac990f42a78 /arch/riscv64/kernel
parent551b5427798e0fabcd14dc801b064a79df5de41a (diff)
downloadkmi-5f30284181fcfe5b16dfb94d4fba9a9ed4a2dc6a.tar.gz
kmi-5f30284181fcfe5b16dfb94d4fba9a9ed4a2dc6a.zip
add sbi_hart_start
Diffstat (limited to 'arch/riscv64/kernel')
-rw-r--r--arch/riscv64/kernel/sbi.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/arch/riscv64/kernel/sbi.h b/arch/riscv64/kernel/sbi.h
index ef38b35..8abff25 100644
--- a/arch/riscv64/kernel/sbi.h
+++ b/arch/riscv64/kernel/sbi.h
@@ -64,7 +64,7 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
#define EID_TIME 0x54494D45
/** Function ID of sbi_set_timer(). */
-#define FID_SET_TIMER 0
+#define FID_TIME_SET_TIMER 0
/**
* Start timer. IRQs have to be enabled for the timer to trigger.
@@ -76,10 +76,11 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
static inline struct sbiret sbi_set_timer(uint64_t stime_value)
{
#if defined(riscv32)
- return sbi_ecall(EID_TIME, FID_SET_TIMER, stime_value,
+ return sbi_ecall(EID_TIME, FID_TIME_SET_TIMER, stime_value,
stime_value >> 32, 0, 0, 0, 0);
#else
- return sbi_ecall(EID_TIME, FID_SET_TIMER, stime_value, 0, 0, 0, 0, 0);
+ return sbi_ecall(EID_TIME, FID_TIME_SET_TIMER, stime_value,
+ 0, 0, 0, 0, 0);
#endif
}
@@ -87,7 +88,7 @@ static inline struct sbiret sbi_set_timer(uint64_t stime_value)
#define EID_SRST 0x53525354
/** Function ID of sbi_system_reset(). */
-#define FID_RESET 0
+#define FID_SRST_RESET 0
/**
* Reset system.
@@ -102,15 +103,15 @@ static inline struct sbiret sbi_set_timer(uint64_t stime_value)
static inline struct sbiret sbi_system_reset(uint32_t reset_type,
uint32_t reset_reason)
{
- return sbi_ecall(EID_SRST, FID_RESET, reset_type, reset_reason, 0, 0, 0,
- 0);
+ return sbi_ecall(EID_SRST, FID_SRST_RESET, reset_type, reset_reason,
+ 0, 0, 0, 0);
}
/** Supervisor IPI extension ID. */
#define EID_sPI 0x735049
/** Supervisor IPI function ID. */
-#define FID_IPI 0
+#define FID_sPI_IPI 0
/**
* Send IPI.
@@ -122,8 +123,22 @@ static inline struct sbiret sbi_system_reset(uint32_t reset_type,
static inline struct sbiret sbi_send_ipi(unsigned long hart_mask,
unsigned long hart_mask_base)
{
- return sbi_ecall(EID_sPI, FID_IPI, hart_mask, hart_mask_base,
+ return sbi_ecall(EID_sPI, FID_sPI_IPI, hart_mask, hart_mask_base,
0, 0, 0, 0);
}
+/** Hart state management extension ID. */
+#define EID_HSM 0x48534D
+
+/** Hart start function ID. */
+#define FID_HSM_START 0
+
+static inline struct sbiret sbi_hart_start(unsigned long hartid,
+ unsigned long start_addr,
+ unsigned long opaque)
+{
+ return sbi_ecall(EID_HSM, FID_HSM_START, hartid, start_addr, opaque,
+ 0, 0, 0);
+}
+
#endif /* KMI_RISCV_SBI_H */