sbi_ecall.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2019 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. */
  9. #ifndef __SBI_ECALL_H__
  10. #define __SBI_ECALL_H__
  11. #include <sbi/sbi_types.h>
  12. #include <sbi/sbi_list.h>
  13. #define SBI_ECALL_VERSION_MAJOR 1
  14. #define SBI_ECALL_VERSION_MINOR 0
  15. #define SBI_OPENSBI_IMPID 1
  16. struct sbi_trap_regs;
  17. struct sbi_trap_info;
  18. struct sbi_ecall_extension {
  19. struct sbi_dlist head;
  20. unsigned long extid_start;
  21. unsigned long extid_end;
  22. int (* probe)(unsigned long extid, unsigned long *out_val);
  23. int (* handle)(unsigned long extid, unsigned long funcid,
  24. const struct sbi_trap_regs *regs,
  25. unsigned long *out_val,
  26. struct sbi_trap_info *out_trap);
  27. };
  28. u16 sbi_ecall_version_major(void);
  29. u16 sbi_ecall_version_minor(void);
  30. unsigned long sbi_ecall_get_impid(void);
  31. void sbi_ecall_set_impid(unsigned long impid);
  32. struct sbi_ecall_extension *sbi_ecall_find_extension(unsigned long extid);
  33. int sbi_ecall_register_extension(struct sbi_ecall_extension *ext);
  34. void sbi_ecall_unregister_extension(struct sbi_ecall_extension *ext);
  35. int sbi_ecall_handler(struct sbi_trap_regs *regs);
  36. int sbi_ecall_init(void);
  37. #endif