summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-03-18 12:43:06 +0300
committerAnup Patel <anup@brainfault.org>2020-03-19 06:51:08 +0300
commit680b09872dd9fe43adfaa29dd95d0d035f5e0ac2 (patch)
tree833009d03cb77949c1e46641da0304935bf8321b /lib
parentc9f60fc6b7d940c970d4562656424aa9519e9b90 (diff)
downloadopensbi-680b09872dd9fe43adfaa29dd95d0d035f5e0ac2.tar.xz
lib: sbi_hsm: Don't use sbi_platform_hart_count() API
We remove usage of sbi_platform_hart_count() API from sbi_hsm so that discontinuous and sparse HART ids can be supported. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/sbi/sbi_hsm.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index 1219924..906a8eb 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -16,6 +16,7 @@
#include <sbi/sbi_error.h>
#include <sbi/sbi_ecall_interface.h>
#include <sbi/sbi_hart.h>
+#include <sbi/sbi_hartmask.h>
#include <sbi/sbi_hsm.h>
#include <sbi/sbi_init.h>
#include <sbi/sbi_ipi.h>
@@ -89,17 +90,7 @@ int sbi_hsm_hart_started_mask(struct sbi_scratch *scratch,
ulong hbase, ulong *out_hmask)
{
ulong i;
- ulong hcount = sbi_platform_hart_count(sbi_platform_ptr(scratch));
-
- /*
- * The SBI_HARTMASK_MAX_BITS represents the maximum HART ids generic
- * OpenSBI can handle whereas sbi_platform_hart_count() represents
- * the maximum HART ids (or HARTs) on underlying platform.
- *
- * Currently, we only support continuous HART ids so this function
- * is written with same assumption. In future, this function will
- * change when we support discontinuous and sparse HART ids.
- */
+ ulong hcount = SBI_HARTMASK_MAX_BITS;
*out_hmask = 0;
if (hcount <= hbase)
@@ -153,20 +144,18 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch, u32 hartid)
int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot)
{
+ u32 i;
struct sbi_scratch *rscratch;
struct sbi_hsm_data *hdata;
- u32 hart_count, i;
- const struct sbi_platform *plat = sbi_platform_ptr(scratch);
if (cold_boot) {
hart_data_offset = sbi_scratch_alloc_offset(sizeof(*hdata),
"HART_DATA");
if (!hart_data_offset)
return SBI_ENOMEM;
- hart_count = sbi_platform_hart_count(plat);
/* Initialize hart state data for every hart */
- for (i = 0; i < hart_count; i++) {
+ for (i = 0; i < SBI_HARTMASK_MAX_BITS; i++) {
rscratch = sbi_hartid_to_scratch(i);
if (!rscratch)
continue;