diff options
| author | Anup Patel <[email protected]> | 2020-01-15 11:16:54 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2020-01-22 12:10:37 +0530 |
| commit | da9b76b957dae1cf59272cc0f351ae425351c3c8 (patch) | |
| tree | 69d0eb671608a15a3d5a8960ff25b868053844ae | |
| parent | 3d2aaac69a967ff1986f57862c4048d42acfe1ec (diff) | |
lib: Introduce sbi_ipi_send_halt() API
Instead of directly calling sbi_ipi_send_many(), we introduce
sbi_ipi_send_halt() for halting a set of HARTs.
This way in future we can assign any IPI event number for HART
halting within sbi_ipi.c only.
Signed-off-by: Anup Patel <[email protected]>
Reviewed-by: Atish Patra <[email protected]>
| -rw-r--r-- | include/sbi/sbi_ipi.h | 2 | ||||
| -rw-r--r-- | lib/sbi/sbi_ipi.c | 6 | ||||
| -rw-r--r-- | lib/sbi/sbi_system.c | 10 |
3 files changed, 12 insertions, 6 deletions
diff --git a/include/sbi/sbi_ipi.h b/include/sbi/sbi_ipi.h index 45f655ce..4a1bed0a 100644 --- a/include/sbi/sbi_ipi.h +++ b/include/sbi/sbi_ipi.h @@ -29,6 +29,8 @@ int sbi_ipi_send_smode(struct sbi_scratch *scratch, ulong hmask, ulong hbase); void sbi_ipi_clear_smode(struct sbi_scratch *scratch); +int sbi_ipi_send_halt(struct sbi_scratch *scratch, ulong hmask, ulong hbase); + void sbi_ipi_process(struct sbi_scratch *scratch); int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot); diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index 701b49b9..68c3584e 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -112,6 +112,12 @@ void sbi_ipi_clear_smode(struct sbi_scratch *scratch) csr_clear(CSR_MIP, MIP_SSIP); } +int sbi_ipi_send_halt(struct sbi_scratch *scratch, ulong hmask, ulong hbase) +{ + return sbi_ipi_send_many(scratch, hmask, hbase, + SBI_IPI_EVENT_HALT, NULL); +} + void sbi_ipi_process(struct sbi_scratch *scratch) { unsigned long ipi_type; diff --git a/lib/sbi/sbi_system.c b/lib/sbi/sbi_system.c index d189a898..0fd4999f 100644 --- a/lib/sbi/sbi_system.c +++ b/lib/sbi/sbi_system.c @@ -39,9 +39,8 @@ void __noreturn sbi_system_reboot(struct sbi_scratch *scratch, u32 type) u32 current_hartid_mask = 1UL << sbi_current_hartid(); /* Send HALT IPI to every hart other than the current hart */ - sbi_ipi_send_many(scratch, - sbi_hart_available_mask() & ~current_hartid_mask, - 0, SBI_IPI_EVENT_HALT, NULL); + sbi_ipi_send_halt(scratch, + sbi_hart_available_mask() & ~current_hartid_mask, 0); /* Platform specific reooot */ sbi_platform_system_reboot(sbi_platform_ptr(scratch), type); @@ -55,9 +54,8 @@ void __noreturn sbi_system_shutdown(struct sbi_scratch *scratch, u32 type) u32 current_hartid_mask = 1UL << sbi_current_hartid(); /* Send HALT IPI to every hart other than the current hart */ - sbi_ipi_send_many(scratch, - sbi_hart_available_mask() & ~current_hartid_mask, - 0, SBI_IPI_EVENT_HALT, NULL); + sbi_ipi_send_halt(scratch, + sbi_hart_available_mask() & ~current_hartid_mask, 0); /* Platform specific shutdown */ sbi_platform_system_shutdown(sbi_platform_ptr(scratch), type); |
