diff options
| author | Anup Patel <[email protected]> | 2023-12-11 21:11:03 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-12-19 15:56:37 +0530 |
| commit | 5a57e8cd41f3c8754a5f0e511a63072724c1f0b7 (patch) | |
| tree | 6a91d738f3e7814d023495b811f12fd28753b1d0 | |
| parent | 3284bea83368de2ced244d5b2b0eaeaae812a08d (diff) | |
lib: sbi: Remove the SBI_ETRAP error code
The SBI_ETRAP error code was introduced only for doing trap
redirection in generic sbi_ecall_handler(). Now the trap
redirection is moved into sbi_ecall_legacy.c and SBI_ETRAP
error code is only used in this source file so let us remove
it.
Signed-off-by: Anup Patel <[email protected]>
| -rw-r--r-- | include/sbi/sbi_error.h | 5 | ||||
| -rw-r--r-- | lib/sbi/sbi_ecall_legacy.c | 32 |
2 files changed, 14 insertions, 23 deletions
diff --git a/include/sbi/sbi_error.h b/include/sbi/sbi_error.h index 7f97506d..a77e3f8b 100644 --- a/include/sbi/sbi_error.h +++ b/include/sbi/sbi_error.h @@ -32,9 +32,8 @@ #define SBI_EILL -1004 #define SBI_ENOSPC -1005 #define SBI_ENOMEM -1006 -#define SBI_ETRAP -1007 -#define SBI_EUNKNOWN -1008 -#define SBI_ENOENT -1009 +#define SBI_EUNKNOWN -1007 +#define SBI_ENOENT -1008 /* clang-format on */ diff --git a/lib/sbi/sbi_ecall_legacy.c b/lib/sbi/sbi_ecall_legacy.c index 48bd2274..14913c96 100644 --- a/lib/sbi/sbi_ecall_legacy.c +++ b/lib/sbi/sbi_ecall_legacy.c @@ -24,22 +24,22 @@ #include <sbi/sbi_unpriv.h> #include <sbi/sbi_hart.h> -static int sbi_load_hart_mask_unpriv(ulong *pmask, ulong *hmask, - struct sbi_trap_info *uptrap) +static bool sbi_load_hart_mask_unpriv(ulong *pmask, ulong *hmask, + struct sbi_trap_info *uptrap) { ulong mask = 0; if (pmask) { mask = sbi_load_ulong(pmask, uptrap); if (uptrap->cause) - return SBI_ETRAP; + return false; } else { sbi_hsm_hart_interruptible_mask(sbi_domain_thishart_ptr(), 0, &mask); } *hmask = mask; - return 0; + return true; } static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid, @@ -70,56 +70,48 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid, sbi_ipi_clear_smode(); break; case SBI_EXT_0_1_SEND_IPI: - ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0, - &hmask, &trap); - if (ret != SBI_ETRAP) { + if (sbi_load_hart_mask_unpriv((ulong *)regs->a0, + &hmask, &trap)) { ret = sbi_ipi_send_smode(hmask, 0); } else { - ret = 0; trap.epc = regs->mepc; sbi_trap_redirect(regs, &trap); out->skip_regs_update = true; } break; case SBI_EXT_0_1_REMOTE_FENCE_I: - ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0, - &hmask, &trap); - if (ret != SBI_ETRAP) { + if (sbi_load_hart_mask_unpriv((ulong *)regs->a0, + &hmask, &trap)) { SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0, 0, SBI_TLB_FENCE_I, source_hart); ret = sbi_tlb_request(hmask, 0, &tlb_info); } else { - ret = 0; trap.epc = regs->mepc; sbi_trap_redirect(regs, &trap); out->skip_regs_update = true; } break; case SBI_EXT_0_1_REMOTE_SFENCE_VMA: - ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0, - &hmask, &trap); - if (ret != SBI_ETRAP) { + if (sbi_load_hart_mask_unpriv((ulong *)regs->a0, + &hmask, &trap)) { SBI_TLB_INFO_INIT(&tlb_info, regs->a1, regs->a2, 0, 0, SBI_TLB_SFENCE_VMA, source_hart); ret = sbi_tlb_request(hmask, 0, &tlb_info); } else { - ret = 0; trap.epc = regs->mepc; sbi_trap_redirect(regs, &trap); out->skip_regs_update = true; } break; case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID: - ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0, - &hmask, &trap); - if (ret != SBI_ETRAP) { + if (sbi_load_hart_mask_unpriv((ulong *)regs->a0, + &hmask, &trap)) { SBI_TLB_INFO_INIT(&tlb_info, regs->a1, regs->a2, regs->a3, 0, SBI_TLB_SFENCE_VMA_ASID, source_hart); ret = sbi_tlb_request(hmask, 0, &tlb_info); } else { - ret = 0; trap.epc = regs->mepc; sbi_trap_redirect(regs, &trap); out->skip_regs_update = true; |
