aboutsummaryrefslogtreecommitdiff
path: root/include/sbi/sbi_ipi.h
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-01-15 12:44:10 +0530
committerAnup Patel <anup@brainfault.org>2020-01-22 12:10:44 +0530
commit5f762d14f0473dec97ee248e53d29b78be8a833e (patch)
tree99d779e04a7be17dd538d67fcd13fc315c8b603b /include/sbi/sbi_ipi.h
parenta8b4b83b7fef84b0491f5a897651a30f98d75a9a (diff)
lib: Introduce sbi_ipi_event_create/destroy() APIs
This patch introduces sbi_ipi_event_create/destroy() APIs and struct sbi_ipi_event_ops for creating/destroying IPI events at runtime based of event operations. This new APIs will help platform code and utils code to create custom IPI events which are not part of generic OpenSBI library. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi/sbi_ipi.h')
-rw-r--r--include/sbi/sbi_ipi.h34
1 files changed, 31 insertions, 3 deletions
diff --git a/include/sbi/sbi_ipi.h b/include/sbi/sbi_ipi.h
index 4a1bed0..d680148 100644
--- a/include/sbi/sbi_ipi.h
+++ b/include/sbi/sbi_ipi.h
@@ -14,17 +14,45 @@
/* clang-format off */
-#define SBI_IPI_EVENT_SOFT 0x1
-#define SBI_IPI_EVENT_FENCE 0x2
-#define SBI_IPI_EVENT_HALT 0x10
+#define SBI_IPI_EVENT_MAX __riscv_xlen
/* clang-format on */
struct sbi_scratch;
+/** IPI event operations or callbacks */
+struct sbi_ipi_event_ops {
+ /** Name of the IPI event operations */
+ char name[32];
+
+ /** Update callback to save/enqueue data for remote HART
+ * Note: This is an optional callback and it is called just before
+ * triggering IPI to remote HART.
+ */
+ int (* update)(struct sbi_scratch *scratch,
+ struct sbi_scratch *remote_scratch,
+ u32 remote_hartid, void *data);
+
+ /** Sync callback to wait for remote HART
+ * Note: This is an optional callback and it is called just after
+ * triggering IPI to remote HART.
+ */
+ void (* sync)(struct sbi_scratch *scratch);
+
+ /** Process callback to handle IPI event
+ * Note: This is a mandatory callback and it is called on the
+ * remote HART after IPI is triggered.
+ */
+ void (* process)(struct sbi_scratch *scratch);
+};
+
int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong hmask,
ulong hbase, u32 event, void *data);
+int sbi_ipi_event_create(const struct sbi_ipi_event_ops *ops);
+
+void sbi_ipi_event_destroy(u32 event);
+
int sbi_ipi_send_smode(struct sbi_scratch *scratch, ulong hmask, ulong hbase);
void sbi_ipi_clear_smode(struct sbi_scratch *scratch);