lib: sbi: Use SBI_HSM_STATE_xyz defines instead of SBI_STATE_xyz defines

We replace the use of SBI_STATE_xyz defines with SBI_HSM_STATE_xyz
defines because the HSM state defines are complete enough to implement
HSM state machine in OpenSBI. As a result of this, we can now remove
sbi_hsm_hart_state_to_status() function because it is now redundant
and sbi_hsm_hart_get_state() can directly return HSM state or error.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Anup Patel
2021-02-01 16:13:03 +05:30
committed by Anup Patel
parent 5487cf095d
commit 8df1f9a0d3
3 changed files with 24 additions and 55 deletions

View File

@@ -23,7 +23,7 @@ static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid,
struct sbi_trap_info *out_trap)
{
ulong smode;
int ret = 0, hstate;
int ret = 0;
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
switch (funcid) {
@@ -37,9 +37,8 @@ static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid,
ret = sbi_hsm_hart_stop(scratch, TRUE);
break;
case SBI_EXT_HSM_HART_GET_STATUS:
hstate = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(),
regs->a0);
ret = sbi_hsm_hart_state_to_status(hstate);
ret = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(),
regs->a0);
break;
default:
ret = SBI_ENOTSUPP;