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:
Anup Patel
2020-05-12 12:57:52 +05:30
committed by Anup Patel
parent 73d6ef3b29
commit 446a9c6d1e
12 changed files with 127 additions and 82 deletions

View File

@@ -46,6 +46,11 @@
/* clang-format on */
static struct plic_data plic = {
.addr = FU540_PLIC_ADDR,
.num_src = FU540_PLIC_NUM_SOURCES,
};
static void fu540_modify_dt(void *fdt)
{
fdt_cpu_fixup(fdt);
@@ -88,13 +93,12 @@ static int fu540_irqchip_init(bool cold_boot)
u32 hartid = current_hartid();
if (cold_boot) {
rc = plic_cold_irqchip_init(FU540_PLIC_ADDR,
FU540_PLIC_NUM_SOURCES);
rc = plic_cold_irqchip_init(&plic);
if (rc)
return rc;
}
return plic_warm_irqchip_init((hartid) ? (2 * hartid - 1) : 0,
return plic_warm_irqchip_init(&plic, (hartid) ? (2 * hartid - 1) : 0,
(hartid) ? (2 * hartid) : -1);
}