mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-19 08:28:51 +09:00
![Sean Anderson](/assets/img/avatar_default.png)
The previous IPI code initialized the device whenever the first call was made to a riscv_*_ipi function. This made it difficult to determine when the IPI device was initialized. This patch introduces a new function riscv_init_ipi. It is called once during arch_cpu_init_dm. In SPL, it is called in spl_invoke_opensbi. Before this point, no riscv_*_ipi functions should be called. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Rick Chen <rick@andestech.com>
43 lines
616 B
C
43 lines
616 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2019 Fraunhofer AISEC,
|
|
* Lukas Auer <lukas.auer@aisec.fraunhofer.de>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/encoding.h>
|
|
#include <asm/sbi.h>
|
|
|
|
int riscv_init_ipi(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int riscv_send_ipi(int hart)
|
|
{
|
|
ulong mask;
|
|
|
|
mask = 1UL << hart;
|
|
sbi_send_ipi(&mask);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int riscv_clear_ipi(int hart)
|
|
{
|
|
csr_clear(CSR_SIP, SIP_SSIP);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int riscv_get_ipi(int hart, int *pending)
|
|
{
|
|
/*
|
|
* The SBI does not support reading the IPI status. We always return 0
|
|
* to indicate that no IPI is pending.
|
|
*/
|
|
*pending = 0;
|
|
|
|
return 0;
|
|
}
|