lib: sbi: Allow ecall handlers to directly update register state

Some of the upcoming SBI extensions (such as SSE) will directly
update register state so improve the prototype of ecall handler
to accommodate this. Further, this flexibility allows us to
push the trap redirection from sbi_ecall_handler() to the
sbi_ecall_legacy_handler().

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
This commit is contained in:
Anup Patel
2023-12-11 20:59:14 +05:30
committed by Anup Patel
parent cdebae2cc9
commit 3284bea833
19 changed files with 109 additions and 107 deletions

View File

@@ -33,14 +33,13 @@ static bool andes45_apply_iocp_sw_workaround(void)
}
int andes_sbi_vendor_ext_provider(long funcid,
const struct sbi_trap_regs *regs,
unsigned long *out_value,
struct sbi_trap_info *out_trap,
struct sbi_trap_regs *regs,
struct sbi_ecall_return *out,
const struct fdt_match *match)
{
switch (funcid) {
case SBI_EXT_ANDES_IOCP_SW_WORKAROUND:
*out_value = andes45_apply_iocp_sw_workaround();
out->value = andes45_apply_iocp_sw_workaround();
break;
default:

View File

@@ -3,13 +3,13 @@
#ifndef _RISCV_ANDES_SBI_H
#define _RISCV_ANDES_SBI_H
#include <sbi/sbi_ecall.h>
#include <sbi/sbi_trap.h>
#include <sbi_utils/fdt/fdt_helper.h>
int andes_sbi_vendor_ext_provider(long funcid,
const struct sbi_trap_regs *regs,
unsigned long *out_value,
struct sbi_trap_info *out_trap,
struct sbi_trap_regs *regs,
struct sbi_ecall_return *out,
const struct fdt_match *match);
#endif /* _RISCV_ANDES_SBI_H */

View File

@@ -10,6 +10,7 @@
#ifndef __PLATFORM_OVERRIDE_H__
#define __PLATFORM_OVERRIDE_H__
#include <sbi/sbi_ecall.h>
#include <sbi/sbi_hart.h>
#include <sbi/sbi_types.h>
#include <sbi/sbi_trap.h>
@@ -30,9 +31,8 @@ struct platform_override {
int (*pmu_init)(const struct fdt_match *match);
void (*fw_init)(void *fdt, const struct fdt_match *match);
int (*vendor_ext_provider)(long funcid,
const struct sbi_trap_regs *regs,
unsigned long *out_value,
struct sbi_trap_info *out_trap,
struct sbi_trap_regs *regs,
struct sbi_ecall_return *out,
const struct fdt_match *match);
};

View File

@@ -203,12 +203,10 @@ static bool generic_vendor_ext_check(void)
}
static int generic_vendor_ext_provider(long funcid,
const struct sbi_trap_regs *regs,
unsigned long *out_value,
struct sbi_trap_info *out_trap)
struct sbi_trap_regs *regs,
struct sbi_ecall_return *out)
{
return generic_plat->vendor_ext_provider(funcid, regs,
out_value, out_trap,
return generic_plat->vendor_ext_provider(funcid, regs, out,
generic_plat_match);
}