From a36c168e5473bcc973e50f3773cfc6a647ee515a Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Tue, 23 Jul 2024 15:22:44 +0800 Subject: [PATCH] riscv/nsbi: fix up_udelay for rv32 This fixes riscv_sbi_get_time for rv32 and NuttSBI is used. Signed-off-by: Yanfeng Liu --- arch/risc-v/src/common/supervisor/riscv_sbi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/risc-v/src/common/supervisor/riscv_sbi.c b/arch/risc-v/src/common/supervisor/riscv_sbi.c index c8bdd9425e385..626e2d068ff13 100644 --- a/arch/risc-v/src/common/supervisor/riscv_sbi.c +++ b/arch/risc-v/src/common/supervisor/riscv_sbi.c @@ -111,7 +111,11 @@ uint64_t riscv_sbi_get_time(void) sbiret_t ret = sbi_ecall(SBI_EXT_FIRMWARE, SBI_EXT_FIRMWARE_GET_MTIME, 0, 0, 0, 0, 0, 0); +# ifdef CONFIG_ARCH_RV64 return ret.error; +# else + return (((uint64_t)ret.value << 32) | ret.error); +# endif #elif defined(CONFIG_ARCH_RV64) return READ_CSR(CSR_TIME); #else