lib: sbi_hsm: Simplify hart_get_state() and hart_started() APIs
We remove redundant scratch parameter from sbi_hsm_hart_get_state() and sbi_hsm_hart_started() APIs. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
parent
e23d3ba936
commit
19bd531a15
|
@ -24,9 +24,9 @@ void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch);
|
||||||
int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid,
|
int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid,
|
||||||
ulong saddr, ulong priv);
|
ulong saddr, ulong priv);
|
||||||
int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow);
|
int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow);
|
||||||
int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid);
|
int sbi_hsm_hart_get_state(u32 hartid);
|
||||||
int sbi_hsm_hart_state_to_status(int state);
|
int sbi_hsm_hart_state_to_status(int state);
|
||||||
bool sbi_hsm_hart_started(struct sbi_scratch *scratch, u32 hartid);
|
bool sbi_hsm_hart_started(u32 hartid);
|
||||||
int sbi_hsm_hart_started_mask(struct sbi_scratch *scratch,
|
int sbi_hsm_hart_started_mask(struct sbi_scratch *scratch,
|
||||||
ulong hbase, ulong *out_hmask);
|
ulong hbase, ulong *out_hmask);
|
||||||
void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid);
|
void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid);
|
||||||
|
|
|
@ -30,7 +30,7 @@ static int sbi_ecall_hsm_handler(struct sbi_scratch *scratch,
|
||||||
ret = sbi_hsm_hart_stop(scratch, TRUE);
|
ret = sbi_hsm_hart_stop(scratch, TRUE);
|
||||||
break;
|
break;
|
||||||
case SBI_EXT_HSM_HART_GET_STATUS:
|
case SBI_EXT_HSM_HART_GET_STATUS:
|
||||||
hstate = sbi_hsm_hart_get_state(scratch, args[0]);
|
hstate = sbi_hsm_hart_get_state(args[0]);
|
||||||
ret = sbi_hsm_hart_state_to_status(hstate);
|
ret = sbi_hsm_hart_state_to_status(hstate);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -55,9 +55,10 @@ int sbi_hsm_hart_state_to_status(int state)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid)
|
int sbi_hsm_hart_get_state(u32 hartid)
|
||||||
{
|
{
|
||||||
struct sbi_hsm_data *hdata;
|
struct sbi_hsm_data *hdata;
|
||||||
|
struct sbi_scratch *scratch;
|
||||||
|
|
||||||
scratch = sbi_hartid_to_scratch(hartid);
|
scratch = sbi_hartid_to_scratch(hartid);
|
||||||
hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset);
|
hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset);
|
||||||
|
@ -65,9 +66,9 @@ int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid)
|
||||||
return atomic_read(&hdata->state);
|
return atomic_read(&hdata->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sbi_hsm_hart_started(struct sbi_scratch *scratch, u32 hartid)
|
bool sbi_hsm_hart_started(u32 hartid)
|
||||||
{
|
{
|
||||||
if (sbi_hsm_hart_get_state(scratch, hartid) == SBI_HART_STARTED)
|
if (sbi_hsm_hart_get_state(hartid) == SBI_HART_STARTED)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -104,7 +105,7 @@ int sbi_hsm_hart_started_mask(struct sbi_scratch *scratch,
|
||||||
hcount = BITS_PER_LONG;
|
hcount = BITS_PER_LONG;
|
||||||
|
|
||||||
for (i = hbase; i < hcount; i++) {
|
for (i = hbase; i < hcount; i++) {
|
||||||
if (sbi_hsm_hart_get_state(scratch, i) == SBI_HART_STARTED)
|
if (sbi_hsm_hart_get_state(i) == SBI_HART_STARTED)
|
||||||
*out_hmask |= 1UL << (i - hbase);
|
*out_hmask |= 1UL << (i - hbase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +263,7 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow)
|
||||||
hart_data_offset);
|
hart_data_offset);
|
||||||
|
|
||||||
if (sbi_platform_hart_disabled(plat, hartid) ||
|
if (sbi_platform_hart_disabled(plat, hartid) ||
|
||||||
!sbi_hsm_hart_started(scratch, hartid))
|
!sbi_hsm_hart_started(hartid))
|
||||||
return SBI_EINVAL;
|
return SBI_EINVAL;
|
||||||
|
|
||||||
oldstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STARTED,
|
oldstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STARTED,
|
||||||
|
|
Loading…
Reference in New Issue