lib: irqchip/plic: Disable all contexts and IRQs

To initialize PLIC in sane state, we should:
1. set maximum threshold value of M-mode PLIC contexts
2. set maximum threshold value of S-mode PLIC contexts
3. set irq priorities to miniumum

Fix the comment and initialize the threshold/priorities correctly.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Atish Patra
2020-02-11 17:42:50 -08:00
committed by Anup Patel
parent 1a8ca08cc0
commit c2bfa2bff3

View File

@@ -91,13 +91,13 @@ int plic_warm_irqchip_init(u32 target_hart, int m_cntx_id, int s_cntx_id)
plic_set_ie(s_cntx_id, i, 0); plic_set_ie(s_cntx_id, i, 0);
} }
/* By default, enable M-mode threshold */ /* By default, disable M-mode threshold */
if (m_cntx_id > -1) if (m_cntx_id > -1)
plic_set_thresh(m_cntx_id, 1); plic_set_thresh(m_cntx_id, 0xffffffff);
/* By default, disable S-mode threshold */ /* By default, disable S-mode threshold */
if (s_cntx_id > -1) if (s_cntx_id > -1)
plic_set_thresh(s_cntx_id, 0); plic_set_thresh(s_cntx_id, 0xffffffff);
return 0; return 0;
} }
@@ -112,7 +112,7 @@ int plic_cold_irqchip_init(unsigned long base, u32 num_sources, u32 hart_count)
/* Configure default priorities of all IRQs */ /* Configure default priorities of all IRQs */
for (i = 1; i <= plic_num_sources; i++) for (i = 1; i <= plic_num_sources; i++)
plic_set_priority(i, 1); plic_set_priority(i, 0);
return 0; return 0;
} }