aboutsummaryrefslogtreecommitdiff
path: root/lib/sbi/sbi_hsm.c
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-03-14 14:39:56 +0530
committerAnup Patel <anup@brainfault.org>2020-03-19 09:08:26 +0530
commit19bd531a15d396130056c4853af487e498152795 (patch)
tree4f02b4430379b6d54a08f269e33a05e7b46654da /lib/sbi/sbi_hsm.c
parente23d3ba936698c52c83bbeed8d844fea22ae0859 (diff)
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>
Diffstat (limited to 'lib/sbi/sbi_hsm.c')
-rw-r--r--lib/sbi/sbi_hsm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index e8ca428..b403423 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -55,9 +55,10 @@ int sbi_hsm_hart_state_to_status(int state)
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_scratch *scratch;
scratch = sbi_hartid_to_scratch(hartid);
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);
}
-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;
else
return FALSE;
@@ -104,7 +105,7 @@ int sbi_hsm_hart_started_mask(struct sbi_scratch *scratch,
hcount = BITS_PER_LONG;
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);
}
@@ -262,7 +263,7 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow)
hart_data_offset);
if (sbi_platform_hart_disabled(plat, hartid) ||
- !sbi_hsm_hart_started(scratch, hartid))
+ !sbi_hsm_hart_started(hartid))
return SBI_EINVAL;
oldstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STARTED,