diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-09-07 11:11:29 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-09-16 09:05:22 +0530 |
commit | 6734304f8c759c782cab12ecfd6c20fb23b8ee44 (patch) | |
tree | 37b5a05628e96be9a1740e7dcd68808d1607eddf /lib/sbi/sbi_hsm.c | |
parent | c1c7c3ee9eb70e5c25914621f0363bfe244ebc79 (diff) |
lib: sbi: Allow specifying start mode to sbi_hsm_hart_start() API
The sbi_scratch already has provision to specify the next stage mode
so we can leverage this to specify start mode to sbi_hsm_hart_start().
In future, this will be useful in providing SBI calls to U-mode on
embedded cores where we M-mode and U-mode but no S-mode.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_hsm.c')
-rw-r--r-- | lib/sbi/sbi_hsm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 013647a..b430793 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -203,7 +203,7 @@ fail_exit: } int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid, - ulong saddr, ulong priv) + ulong saddr, ulong smode, ulong priv) { int rc; unsigned long init_count; @@ -212,6 +212,9 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid, struct sbi_hsm_data *hdata; const struct sbi_platform *plat = sbi_platform_ptr(scratch); + if (smode != PRV_M && smode != PRV_S && smode != PRV_U) + return SBI_EINVAL; + rscratch = sbi_hartid_to_scratch(hartid); if (!rscratch) return SBI_EINVAL; @@ -236,6 +239,7 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid, init_count = sbi_init_count(hartid); rscratch->next_arg1 = priv; rscratch->next_addr = saddr; + rscratch->next_mode = smode; if (sbi_platform_has_hart_hotplug(plat) || (sbi_platform_has_hart_secondary_boot(plat) && !init_count)) { |