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

@ -12,6 +12,7 @@
#include <sbi/sbi_platform.h>
#include <sbi/sbi_scratch.h>
#include <sbi_utils/fdt/fdt_helper.h>
#include <sbi_utils/irqchip/plic.h>
#define DEFAULT_UART_FREQ 0
#define DEFAULT_UART_BAUD 115200
@ -259,8 +260,7 @@ int fdt_parse_uart8250(void *fdt, struct platform_uart_data *uart,
return fdt_parse_uart8250_node(fdt, nodeoffset, uart);
}
int fdt_parse_plic_node(void *fdt, int nodeoffset,
struct platform_plic_data *plic)
int fdt_parse_plic_node(void *fdt, int nodeoffset, struct plic_data *plic)
{
int len, rc;
const fdt32_t *val;
@ -281,15 +281,14 @@ int fdt_parse_plic_node(void *fdt, int nodeoffset,
return 0;
}
int fdt_parse_plic(void *fdt, struct platform_plic_data *plic,
const char *compatible)
int fdt_parse_plic(void *fdt, struct plic_data *plic, const char *compat)
{
int nodeoffset;
if (!compatible || !plic || !fdt)
if (!compat || !plic || !fdt)
return SBI_ENODEV;
nodeoffset = fdt_node_offset_by_compatible(fdt, -1, compatible);
nodeoffset = fdt_node_offset_by_compatible(fdt, -1, compat);
if (nodeoffset < 0)
return nodeoffset;