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

@@ -25,11 +25,6 @@ struct platform_uart_data {
unsigned long reg_io_width;
};
struct platform_plic_data {
unsigned long addr;
unsigned long num_src;
};
const struct fdt_match *fdt_match_node(void *fdt, int nodeoff,
const struct fdt_match *match_table);
@@ -52,11 +47,11 @@ int fdt_parse_uart8250_node(void *fdt, int nodeoffset,
int fdt_parse_uart8250(void *fdt, struct platform_uart_data *uart,
const char *compatible);
int fdt_parse_plic_node(void *fdt, int nodeoffset,
struct platform_plic_data *plic);
struct plic_data;
int fdt_parse_plic(void *fdt, struct platform_plic_data *plic,
const char *compatible);
int fdt_parse_plic_node(void *fdt, int nodeoffset, struct plic_data *plic);
int fdt_parse_plic(void *fdt, struct plic_data *plic, const char *compat);
int fdt_parse_compat_addr(void *fdt, unsigned long *addr,
const char *compatible);

View File

@@ -12,12 +12,18 @@
#include <sbi/sbi_types.h>
int plic_warm_irqchip_init(int m_cntx_id, int s_cntx_id);
struct plic_data {
unsigned long addr;
unsigned long num_src;
};
int plic_cold_irqchip_init(unsigned long base, u32 num_sources);
int plic_warm_irqchip_init(struct plic_data *plic,
int m_cntx_id, int s_cntx_id);
void plic_set_thresh(u32 cntxid, u32 val);
int plic_cold_irqchip_init(struct plic_data *plic);
void plic_set_ie(u32 cntxid, u32 word_index, u32 val);
void plic_set_thresh(struct plic_data *plic, u32 cntxid, u32 val);
void plic_set_ie(struct plic_data *plic, u32 cntxid, u32 word_index, u32 val);
#endif