summaryrefslogtreecommitdiff
path: root/lib/sbi/sbi_ecall.c
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2019-11-17 11:46:24 +0300
committerAnup Patel <anup@brainfault.org>2019-11-21 11:27:33 +0300
commit0e1322bacbaccb34f167ebe243ab04836b99105c (patch)
treeb7c767b8dd31dba21d672afd6cb8dd9fc512721a /lib/sbi/sbi_ecall.c
parentb1d8c988bcca84cf7cd8ee5bf4fe528e256cfeab (diff)
downloadopensbi-0e1322bacbaccb34f167ebe243ab04836b99105c.tar.xz
lib: Better naming of unpriv APIs for wider use
The unpriv APIs can be useful to external firmware and out-of-tree platform support code. This patch adds "sbi_" prefix to unpriv load/store APIs and rename struct riscv_unpriv to struct sbi_trap_info everywhere. We also place struct sbi_trap_info in sbi/sbi_trap.h so that we can use it for sbi_trap_redirect() as well. Overall, this patch will make naming of unpriv APIs consistent with other OpenSBI APIs. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_ecall.c')
-rw-r--r--lib/sbi/sbi_ecall.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/sbi/sbi_ecall.c b/lib/sbi/sbi_ecall.c
index 5864590..a393919 100644
--- a/lib/sbi/sbi_ecall.c
+++ b/lib/sbi/sbi_ecall.c
@@ -118,7 +118,7 @@ int sbi_ecall_0_1_handler(struct sbi_scratch *scratch, unsigned long extid,
int ret = 0;
struct sbi_tlb_info tlb_info;
u32 source_hart = sbi_current_hartid();
- struct unpriv_trap uptrap = {0};
+ struct sbi_trap_info uptrap = {0};
switch (extid) {
case SBI_EXT_0_1_SET_TIMER:
@@ -190,9 +190,8 @@ int sbi_ecall_handler(u32 hartid, ulong mcause, struct sbi_trap_regs *regs,
int ret = 0;
unsigned long extension_id = regs->a7;
unsigned long func_id = regs->a6;
+ struct sbi_trap_info trap = {0};
unsigned long out_val;
- unsigned long out_tval;
- unsigned long out_tcause;
bool is_0_1_spec = 0;
unsigned long args[6];
@@ -206,24 +205,24 @@ int sbi_ecall_handler(u32 hartid, ulong mcause, struct sbi_trap_regs *regs,
if (extension_id >= SBI_EXT_0_1_SET_TIMER &&
extension_id <= SBI_EXT_0_1_SHUTDOWN) {
ret = sbi_ecall_0_1_handler(scratch, extension_id, args,
- &out_tval, &out_tcause);
+ &trap.tval, &trap.cause);
is_0_1_spec = 1;
} else if (extension_id == SBI_EXT_BASE)
ret = sbi_ecall_base_handler(scratch, extension_id, func_id,
args, &out_val,
- &out_tval, &out_tcause);
+ &trap.tval, &trap.cause);
else if (extension_id >= SBI_EXT_VENDOR_START &&
extension_id <= SBI_EXT_VENDOR_END) {
ret = sbi_ecall_vendor_ext_handler(scratch, extension_id,
func_id, args, &out_val,
- &out_tval, &out_tcause);
+ &trap.tval, &trap.cause);
} else {
ret = SBI_ENOTSUPP;
}
if (ret == SBI_ETRAP) {
- sbi_trap_redirect(regs, scratch, regs->mepc,
- out_tcause, out_tval);
+ trap.epc = regs->mepc;
+ sbi_trap_redirect(regs, &trap, scratch);
} else {
/* This function should return non-zero value only in case of
* fatal error. However, there is no good way to distinguish