aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/sbi.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-08-04 20:50:41 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-08-04 20:50:41 +0300
commite16f5f81dfb2e97a554ec19b941ec05a7942fd2d (patch)
tree46f0609b5be009d4d1057fa02ece4461732941e0 /arch/riscv64/kernel/sbi.h
parent5f30284181fcfe5b16dfb94d4fba9a9ed4a2dc6a (diff)
downloadkmi-e16f5f81dfb2e97a554ec19b941ec05a7942fd2d.tar.gz
kmi-e16f5f81dfb2e97a554ec19b941ec05a7942fd2d.zip
add initial smp bringup
Diffstat (limited to 'arch/riscv64/kernel/sbi.h')
-rw-r--r--arch/riscv64/kernel/sbi.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/riscv64/kernel/sbi.h b/arch/riscv64/kernel/sbi.h
index 8abff25..fe75c85 100644
--- a/arch/riscv64/kernel/sbi.h
+++ b/arch/riscv64/kernel/sbi.h
@@ -133,6 +133,14 @@ static inline struct sbiret sbi_send_ipi(unsigned long hart_mask,
/** Hart start function ID. */
#define FID_HSM_START 0
+/**
+ * Start hart.
+ *
+ * @param hartid Hart to start.
+ * @param start_addr Address to jump to in S mode.
+ * @param opaque OS-specific argument passed to hart.
+ * @return SBI call return. \see sbiret.
+ */
static inline struct sbiret sbi_hart_start(unsigned long hartid,
unsigned long start_addr,
unsigned long opaque)
@@ -141,4 +149,25 @@ static inline struct sbiret sbi_hart_start(unsigned long hartid,
0, 0, 0);
}
+/** Hart status function ID. */
+#define FID_HSM_STATUS 2
+
+/**
+ * Get hart status.
+ *
+ * @param hartid Hart ID.
+ * @return SBI call return. \see sbiret.
+ */
+static inline struct sbiret sbi_hart_status(unsigned long hartid)
+{
+ return sbi_ecall(EID_HSM, FID_HSM_STATUS, hartid,
+ 0, 0, 0, 0, 0);
+}
+
+/**
+ * Status code \ref sbi_hart_status() returns for a started hart.
+ * The only one we're currently interested in.
+ */
+#define SBI_HART_STARTED 0
+
#endif /* KMI_RISCV_SBI_H */