summaryrefslogtreecommitdiff
path: root/include/sbi/sbi_ecall.h
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-01-16 09:08:49 +0300
committerAnup Patel <anup@brainfault.org>2020-01-22 09:43:34 +0300
commit37923c4a66180b2f7881d959cd631038e81dbfec (patch)
tree02b37146d8e63222ae2a7187405b2eb2bdb58c95 /include/sbi/sbi_ecall.h
parent0a411bf717d20a212949af443b275fab9469992f (diff)
downloadopensbi-37923c4a66180b2f7881d959cd631038e81dbfec.tar.xz
lib: Add dynamic registration of SBI extensions
This patch extends our SBI ecall implementation to allow dynamic registration of various SBI extensions. Using this dynamic registration we can break-up SBI ecall implementation into multiple files and even register experimental/custom SBI extensions from platform code. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi/sbi_ecall.h')
-rw-r--r--include/sbi/sbi_ecall.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/sbi/sbi_ecall.h b/include/sbi/sbi_ecall.h
index a5b47a1..e9a9ef6 100644
--- a/include/sbi/sbi_ecall.h
+++ b/include/sbi/sbi_ecall.h
@@ -11,15 +11,37 @@
#define __SBI_ECALL_H__
#include <sbi/sbi_types.h>
+#include <sbi/sbi_list.h>
struct sbi_trap_regs;
+struct sbi_trap_info;
struct sbi_scratch;
+struct sbi_ecall_extension {
+ struct sbi_dlist head;
+ unsigned long extid_start;
+ unsigned long extid_end;
+ int (* probe)(struct sbi_scratch *scratch,
+ unsigned long extid, unsigned long *out_val);
+ int (* handle)(struct sbi_scratch *scratch,
+ unsigned long extid, unsigned long funcid,
+ unsigned long *args, unsigned long *out_val,
+ struct sbi_trap_info *out_trap);
+};
+
u16 sbi_ecall_version_major(void);
u16 sbi_ecall_version_minor(void);
+struct sbi_ecall_extension *sbi_ecall_find_extension(unsigned long extid);
+
+int sbi_ecall_register_extension(struct sbi_ecall_extension *ext);
+
+void sbi_ecall_unregister_extension(struct sbi_ecall_extension *ext);
+
int sbi_ecall_handler(u32 hartid, ulong mcause, struct sbi_trap_regs *regs,
struct sbi_scratch *scratch);
+int sbi_ecall_init(void);
+
#endif