diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-03-14 19:43:26 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-03-19 09:27:51 +0530 |
commit | 75eec9dd3f04febd7df8e5ee3fb90c236e50ded3 (patch) | |
tree | a9eb0e50ebe821430f936d5ca60972329934cd91 /lib/sbi/sbi_init.c | |
parent | 814f38dc1d9ec6cd7f75b0d6be15e861ddac9ac5 (diff) |
lib: Don't use sbi_platform_hart_count() API
We don't need to use sbi_platform_hart_count() in sbi_init and
sbi_scratch because checking sbi_platform_hart_disabled() or
return value of sbi_hartid_to_scratch() is sufficient.
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_init.c')
-rw-r--r-- | lib/sbi/sbi_init.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index f75b904..1c2f6b9 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -59,8 +59,6 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid) /* Platform details */ sbi_printf("Platform Name : %s\n", sbi_platform_name(plat)); sbi_printf("Platform HART Features : RV%d%s\n", xlen, str); - sbi_printf("Platform Max HARTs : %d\n", - sbi_platform_hart_count(plat)); sbi_printf("Current Hart : %u\n", hartid); /* Firmware details */ sbi_printf("Firmware Base : 0x%lx\n", scratch->fw_start); @@ -119,7 +117,6 @@ static void wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid) static void wake_coldboot_harts(struct sbi_scratch *scratch, u32 hartid) { const struct sbi_platform *plat = sbi_platform_ptr(scratch); - int max_hart = sbi_platform_hart_count(plat); /* Acquire coldboot lock */ spin_lock(&coldboot_lock); @@ -128,7 +125,7 @@ static void wake_coldboot_harts(struct sbi_scratch *scratch, u32 hartid) coldboot_done = 1; /* Send an IPI to all HARTs waiting for coldboot */ - for (int i = 0; i < max_hart; i++) { + for (int i = 0; i < SBI_HARTMASK_MAX_BITS; i++) { if ((i != hartid) && sbi_hartmask_test_hart(i, &coldboot_wait_hmask)) sbi_platform_ipi_send(plat, i); @@ -282,7 +279,6 @@ void __noreturn sbi_init(struct sbi_scratch *scratch) const struct sbi_platform *plat = sbi_platform_ptr(scratch); if ((SBI_HARTMASK_MAX_BITS <= hartid) || - (sbi_platform_hart_count(plat) <= hartid) || sbi_platform_hart_disabled(plat, hartid)) sbi_hart_hang(); @@ -300,8 +296,7 @@ unsigned long sbi_init_count(u32 hartid) struct sbi_scratch *scratch; unsigned long *init_count; - if (sbi_platform_hart_count(sbi_platform_thishart_ptr()) <= hartid || - !init_count_offset) + if (!init_count_offset) return 0; scratch = sbi_hartid_to_scratch(hartid); |