diff options
author | andy.hu <andy.hu@starfivetech.com> | 2024-05-31 11:24:17 +0300 |
---|---|---|
committer | andy.hu <andy.hu@starfivetech.com> | 2024-05-31 11:24:17 +0300 |
commit | d5e88252154dc08ddb13f326a3d765a051215fab (patch) | |
tree | 39f8bdc5a1160b86f0a24c5030640eccffa3705b /lib/sbi/sbi_ipi.c | |
parent | c6a092cd80112529cb2e92e180767ff5341b22a3 (diff) | |
parent | 9aab611e6e064edb088c48c231e27fd09a2bda4d (diff) | |
download | opensbi-JH7110_VisionFive2_devel.tar.xz |
Merge branch 'CR_10877_IPI_AMP_minda' into 'master'JH7110_VisionFive2_6.6_v5.14.0JH7110_VisionFive2_6.12_v5.14.0JH7110_VisionFive2_515_v5.14.0JH7110_VF2_6.6_v5.14.1JH7110_VF2_6.6_v5.14.0JH7110_VF2_6.6_v5.13.2JH7110_VF2_6.6_v5.13.1JH7110_VF2_6.12_v5.14.1JH7110_VF2_6.12_v5.14.0JH7110_VF2_515_v5.14.1JH7110_VF2_515_v5.14.0JH7110_VF2_515_v5.13.2JH7110_VF2_515_v5.13.1JH7110_VisionFive2_devel
CR_10877 sbi: add amp ipi call function support
See merge request sdk/opensbi!5
Diffstat (limited to 'lib/sbi/sbi_ipi.c')
-rw-r--r-- | lib/sbi/sbi_ipi.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index b9f6205..49a3ae5 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -11,6 +11,7 @@ #include <sbi/riscv_asm.h> #include <sbi/riscv_atomic.h> #include <sbi/riscv_barrier.h> +#include <sbi/sbi_console.h> #include <sbi/sbi_bitops.h> #include <sbi/sbi_domain.h> #include <sbi/sbi_error.h> @@ -150,7 +151,7 @@ static struct sbi_ipi_event_ops ipi_smode_ops = { }; static u32 ipi_smode_event = SBI_IPI_EVENT_MAX; - +static unsigned long* amp_data_addr; int sbi_ipi_send_smode(ulong hmask, ulong hbase) { return sbi_ipi_send_many(hmask, hbase, ipi_smode_event, NULL); @@ -161,6 +162,34 @@ void sbi_ipi_clear_smode(void) csr_clear(CSR_MIP, MIP_SSIP); } +int sbi_ipi_send_ext(u32 type, u32 hartid, u32 msg_bits) +{ + if (!amp_data_addr) + return SBI_EINVAL; + + atomic_raw_set_bit(msg_bits, (void *)(amp_data_addr + hartid)); + + return sbi_ipi_send(sbi_scratch_thishart_ptr(), hartid, ipi_smode_event, NULL); +} + +void sbi_ipi_set_amp_data_addr(unsigned long addr) +{ + amp_data_addr = (void *)addr; +} + +void sbi_ipi_clear_ext_ipi(unsigned long addr) +{ + unsigned long msg_type; + + if (!amp_data_addr) + return; + + msg_type = atomic_raw_xchg_ulong(amp_data_addr + current_hartid(), 0); + *(unsigned long *)addr = msg_type; + + sbi_ipi_clear_smode(); +} + static void sbi_ipi_process_halt(struct sbi_scratch *scratch) { sbi_hsm_hart_stop(scratch, true); |