From 5b4824082ff8826f77d6bc670e16068d0744ff7f Mon Sep 17 00:00:00 2001 From: Atish Patra Date: Tue, 11 Feb 2020 17:32:38 -0800 Subject: lib: Add possible hart status values SBI HSM extension defines possible hart status values in the specification. Define all possible status values. Add a helper function to convert hart state to status because hart states are internal to OpenSBI only and may not match the status values defined in the specification. Signed-off-by: Atish Patra Reviewed-by: Anup Patel --- include/sbi/sbi_ecall_interface.h | 5 +++++ include/sbi/sbi_hsm.h | 1 + 2 files changed, 6 insertions(+) (limited to 'include') diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h index 93c07474..ba88e8b1 100644 --- a/include/sbi/sbi_ecall_interface.h +++ b/include/sbi/sbi_ecall_interface.h @@ -51,6 +51,11 @@ #define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA 0x5 #define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID 0x6 +#define SBI_HSM_HART_STATUS_STARTED 0x0 +#define SBI_HSM_HART_STATUS_STOPPED 0x1 +#define SBI_HSM_HART_STATUS_START_PENDING 0x2 +#define SBI_HSM_HART_STATUS_STOP_PENDING 0x3 + #define SBI_SPEC_VERSION_MAJOR_OFFSET 24 #define SBI_SPEC_VERSION_MAJOR_MASK 0x7f #define SBI_SPEC_VERSION_MINOR_MASK 0xffffff diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h index 2566afb7..11ea7cfe 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -25,6 +25,7 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid, ulong saddr, ulong priv); int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow); int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid); +int sbi_hsm_hart_state_to_status(int state); bool sbi_hsm_hart_started(struct sbi_scratch *scratch, u32 hartid); void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid); #endif -- cgit v1.3.1