diff options
author | Samuel Holland <samuel@sholland.org> | 2022-06-13 04:03:50 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2022-06-13 09:24:06 +0300 |
commit | 8c362e7d065eaf4d55da23a190a464ba870f89aa (patch) | |
tree | 0e329ebde4ba12c1119e7dfc299d63bcf33b0588 /include/sbi_utils | |
parent | 2ea7799d563ed9bbaf3b677728e928a6cd8f580c (diff) | |
download | opensbi-8c362e7d065eaf4d55da23a190a464ba870f89aa.tar.xz |
lib: irqchip/plic: Factor out a context init function
This simplifies both the callers and the callees by removing duplicated
code and consolidating the error handling. It also fixes two bugs in the
process:
1) ie_words was one too large when plic->num_src was a multiple of 32.
2) plic_set_ie takes a 32-bit mask, not a Boolean value, so the FPGA
platforms previously only enabled one out of every 32 interrupts.
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'include/sbi_utils')
-rw-r--r-- | include/sbi_utils/irqchip/plic.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/sbi_utils/irqchip/plic.h b/include/sbi_utils/irqchip/plic.h index 50be5df..8f21af6 100644 --- a/include/sbi_utils/irqchip/plic.h +++ b/include/sbi_utils/irqchip/plic.h @@ -17,14 +17,12 @@ struct plic_data { unsigned long num_src; }; +int plic_context_init(const struct plic_data *plic, int context_id, + bool enable, u32 threshold); + int plic_warm_irqchip_init(const struct plic_data *plic, int m_cntx_id, int s_cntx_id); int plic_cold_irqchip_init(const struct plic_data *plic); -void plic_set_thresh(const struct plic_data *plic, u32 cntxid, u32 val); - -void plic_set_ie(const struct plic_data *plic, u32 cntxid, - u32 word_index, u32 val); - #endif |