summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorClément Léger <[email protected]>2025-01-10 14:15:54 +0100
committerAnup Patel <[email protected]>2025-01-30 10:40:49 +0530
commit93f7d819fdeb3c5e82d5d761968c325f1407d517 (patch)
treef883dd87676fb643a466cabe8e86b05bccf65faf /include
parent147978f3124418609c88e25ba30bef7205250a4d (diff)
lib: sbi: sse: allow adding new events
In order to allow events to be dynamically added, remove the existing static array of events and use a simply linked list of supported events. This allows us to move the cb_ops into this list and associated it with an event_id. Drivers can now register cb_ops before bringing up the sse core to handle additional events (platform ones for instance). sbi_sse_init() now allocates as many events as present in the linked list. Events can now be added with sbi_sse_add_event() which allows to add new supported events with some callback operations if any. If an event is not to be supported, then sbi_sse_add_event() should not be called. This approach currently consider that local events are to be supported on all harts (ie, they all support the same ISA or dependencies). If per-hart event availability needs to be supported, then, an is_supported() callback could be added later and called for each hart. Signed-off-by: Clément Léger <[email protected]> Reviewed-by: Samuel Holland <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_sse.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/sbi/sbi_sse.h b/include/sbi/sbi_sse.h
index 7419698a..fb796545 100644
--- a/include/sbi/sbi_sse.h
+++ b/include/sbi/sbi_sse.h
@@ -54,12 +54,12 @@ struct sbi_sse_cb_ops {
void (*disable_cb)(uint32_t event_id);
};
-/* Set the callback operations for an event
- * @param event_id Event identifier (SBI_SSE_EVENT_*)
- * @param cb_ops Callback operations
+/* Add a supported event with associated callback operations
+ * @param event_id Event identifier (SBI_SSE_EVENT_* or a custom platform one)
+ * @param cb_ops Callback operations (Can be NULL if any)
* @return 0 on success, error otherwise
*/
-int sbi_sse_set_cb_ops(uint32_t event_id, const struct sbi_sse_cb_ops *cb_ops);
+int sbi_sse_add_event(uint32_t event_id, const struct sbi_sse_cb_ops *cb_ops);
/* Inject an event to the current hard
* @param event_id Event identifier (SBI_SSE_EVENT_*)