*/
void fdt_plic_priority_restore(const u8 *priority, u32 num);
-void fdt_plic_context_save(bool smode, u32 *enable, u32 *threshold);
+void fdt_plic_context_save(bool smode, u32 *enable, u32 *threshold, u32 num);
-void fdt_plic_context_restore(bool smode, const u32 *enable, u32 threshold);
+void fdt_plic_context_restore(bool smode, const u32 *enable, u32 threshold,
+ u32 num);
void thead_plic_restore(void);
u32 num);
void plic_context_save(const struct plic_data *plic, int context_id,
- u32 *enable, u32 *threshold);
+ u32 *enable, u32 *threshold, u32 num);
void plic_context_restore(const struct plic_data *plic, int context_id,
- const u32 *enable, u32 threshold);
+ const u32 *enable, u32 threshold, u32 num);
int plic_context_init(const struct plic_data *plic, int context_id,
bool enable, u32 threshold);
plic_priority_restore(plic, priority, num);
}
-void fdt_plic_context_save(bool smode, u32 *enable, u32 *threshold)
+void fdt_plic_context_save(bool smode, u32 *enable, u32 *threshold, u32 num)
{
u32 hartid = current_hartid();
plic_context_save(plic_hartid2data[hartid],
plic_hartid2context[hartid][smode],
- enable, threshold);
+ enable, threshold, num);
}
-void fdt_plic_context_restore(bool smode, const u32 *enable, u32 threshold)
+void fdt_plic_context_restore(bool smode, const u32 *enable, u32 threshold,
+ u32 num)
{
u32 hartid = current_hartid();
plic_context_restore(plic_hartid2data[hartid],
plic_hartid2context[hartid][smode],
- enable, threshold);
+ enable, threshold, num);
}
static int irqchip_plic_warm_init(void)
}
void plic_context_save(const struct plic_data *plic, int context_id,
- u32 *enable, u32 *threshold)
+ u32 *enable, u32 *threshold, u32 num)
{
u32 ie_words = plic->num_src / 32 + 1;
- for (u32 i = 0; i < ie_words; i++)
+ if (num > ie_words)
+ num = ie_words;
+
+ for (u32 i = 0; i < num; i++)
enable[i] = plic_get_ie(plic, context_id, i);
*threshold = plic_get_thresh(plic, context_id);
}
void plic_context_restore(const struct plic_data *plic, int context_id,
- const u32 *enable, u32 threshold)
+ const u32 *enable, u32 threshold, u32 num)
{
u32 ie_words = plic->num_src / 32 + 1;
- for (u32 i = 0; i < ie_words; i++)
+ if (num > ie_words)
+ num = ie_words;
+
+ for (u32 i = 0; i < num; i++)
plic_set_ie(plic, context_id, i, enable[i]);
plic_set_thresh(plic, context_id, threshold);
static void sun20i_d1_plic_save(void)
{
- fdt_plic_context_save(true, plic_sie, &plic_threshold);
+ fdt_plic_context_save(true, plic_sie, &plic_threshold, PLIC_IE_WORDS);
fdt_plic_priority_save(plic_priority, PLIC_SOURCES);
}
{
thead_plic_restore();
fdt_plic_priority_restore(plic_priority, PLIC_SOURCES);
- fdt_plic_context_restore(true, plic_sie, plic_threshold);
+ fdt_plic_context_restore(true, plic_sie, plic_threshold,
+ PLIC_IE_WORDS);
}
/*