summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2022-06-13 04:03:50 +0300
committerAnup Patel <anup@brainfault.org>2022-06-13 09:24:06 +0300
commit8c362e7d065eaf4d55da23a190a464ba870f89aa (patch)
tree0e329ebde4ba12c1119e7dfc299d63bcf33b0588 /include
parent2ea7799d563ed9bbaf3b677728e928a6cd8f580c (diff)
downloadopensbi-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')
-rw-r--r--include/sbi_utils/irqchip/plic.h8
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