summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSamuel Holland <[email protected]>2024-11-04 20:10:04 -0800
committerAnup Patel <[email protected]>2024-11-28 09:36:46 +0530
commit69448a07906523c9c798c8f1d02a7be52e96b38e (patch)
tree0c3e1278cf16ee67140736694f628292dd5525de /include
parentc26e3fd2ed655c1ae6efd1fd0cfc70360c1b967b (diff)
lib: utils/irqchip: plic: Provide a hartindex to context map
This removes platform-specific arguments to plic_warm_irqchip_init(), which makes the driver independent from the platform after cold init, and allows for further refactoring. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sbi_utils/irqchip/plic.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/sbi_utils/irqchip/plic.h b/include/sbi_utils/irqchip/plic.h
index cbe66761..e6b6f823 100644
--- a/include/sbi_utils/irqchip/plic.h
+++ b/include/sbi_utils/irqchip/plic.h
@@ -17,6 +17,7 @@ struct plic_data {
unsigned long size;
unsigned long num_src;
unsigned long flags;
+ s16 context_map[][2];
};
/** Work around a bug on Ariane that requires enabling interrupts at boot */
@@ -24,6 +25,12 @@ struct plic_data {
/** PLIC must be delegated to S-mode like T-HEAD C906 and C910 */
#define PLIC_FLAG_THEAD_DELEGATION BIT(1)
+#define PLIC_M_CONTEXT 0
+#define PLIC_S_CONTEXT 1
+
+#define PLIC_DATA_SIZE(__hart_count) (sizeof(struct plic_data) + \
+ (__hart_count) * 2 * sizeof(s16))
+
/* So far, priorities on all consumers of these functions fit in 8 bits. */
void plic_priority_save(const struct plic_data *plic, u8 *priority, u32 num);
@@ -32,14 +39,13 @@ void plic_priority_restore(const struct plic_data *plic, const u8 *priority,
void plic_delegate(const struct plic_data *plic);
-void plic_context_save(const struct plic_data *plic, int context_id,
+void plic_context_save(const struct plic_data *plic, bool smode,
u32 *enable, u32 *threshold, u32 num);
-void plic_context_restore(const struct plic_data *plic, int context_id,
+void plic_context_restore(const struct plic_data *plic, bool smode,
const u32 *enable, u32 threshold, u32 num);
-int plic_warm_irqchip_init(const struct plic_data *plic,
- int m_cntx_id, int s_cntx_id);
+int plic_warm_irqchip_init(const struct plic_data *plic);
int plic_cold_irqchip_init(const struct plic_data *plic);