forked from Mirrors/opensbi
lib: utils: Allow PLIC functions to be used for multiple PLICs
We extend all PLIC functions to have a "struct plic_data *" parameter pointing to PLIC details. This allows platforms to use these functions for multiple PLIC instances. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
#include <sbi_utils/sys/clint.h>
|
||||
#include "platform.h"
|
||||
|
||||
static struct plic_data plic = {
|
||||
.addr = K210_PLIC_BASE_ADDR,
|
||||
.num_src = K210_PLIC_NUM_SOURCES,
|
||||
};
|
||||
|
||||
static u32 k210_get_clk_freq(void)
|
||||
{
|
||||
u32 clksel0, pll0;
|
||||
@@ -58,13 +63,12 @@ static int k210_irqchip_init(bool cold_boot)
|
||||
u32 hartid = current_hartid();
|
||||
|
||||
if (cold_boot) {
|
||||
rc = plic_cold_irqchip_init(K210_PLIC_BASE_ADDR,
|
||||
K210_PLIC_NUM_SOURCES);
|
||||
rc = plic_cold_irqchip_init(&plic);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
|
||||
return plic_warm_irqchip_init(hartid * 2, hartid * 2 + 1);
|
||||
return plic_warm_irqchip_init(&plic, hartid * 2, hartid * 2 + 1);
|
||||
}
|
||||
|
||||
static int k210_ipi_init(bool cold_boot)
|
||||
|
Reference in New Issue
Block a user