forked from Mirrors/opensbi
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:
@@ -12,9 +12,8 @@
|
||||
#include <sbi/sbi_cppc.h>
|
||||
|
||||
static int sbi_ecall_cppc_handler(unsigned long extid, unsigned long funcid,
|
||||
const struct sbi_trap_regs *regs,
|
||||
unsigned long *out_val,
|
||||
struct sbi_trap_info *out_trap)
|
||||
struct sbi_trap_regs *regs,
|
||||
struct sbi_ecall_return *out)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t temp;
|
||||
@@ -22,14 +21,14 @@ static int sbi_ecall_cppc_handler(unsigned long extid, unsigned long funcid,
|
||||
switch (funcid) {
|
||||
case SBI_EXT_CPPC_READ:
|
||||
ret = sbi_cppc_read(regs->a0, &temp);
|
||||
*out_val = temp;
|
||||
out->value = temp;
|
||||
break;
|
||||
case SBI_EXT_CPPC_READ_HI:
|
||||
#if __riscv_xlen == 32
|
||||
ret = sbi_cppc_read(regs->a0, &temp);
|
||||
*out_val = temp >> 32;
|
||||
out->value = temp >> 32;
|
||||
#else
|
||||
*out_val = 0;
|
||||
out->value = 0;
|
||||
#endif
|
||||
break;
|
||||
case SBI_EXT_CPPC_WRITE:
|
||||
@@ -38,7 +37,7 @@ static int sbi_ecall_cppc_handler(unsigned long extid, unsigned long funcid,
|
||||
case SBI_EXT_CPPC_PROBE:
|
||||
ret = sbi_cppc_probe(regs->a0);
|
||||
if (ret >= 0) {
|
||||
*out_val = ret;
|
||||
out->value = ret;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user