forked from Mirrors/opensbi
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>
This commit is contained in:

committed by
Anup Patel

parent
2ea7799d56
commit
8c362e7d06
@@ -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
|
||||
|
Reference in New Issue
Block a user